sort tags list per articles in it - cl-yag - Common Lisp Yet Another website Ge… | |
git clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit e9fb727d69131de4b7b2662825bc130e2bf0020d | |
parent 142b84ab78cb64423e2781a3e520bbd1e9cb40cd | |
Author: Solene Rapenne <[email protected]> | |
Date: Fri, 12 Oct 2018 11:50:16 +0200 | |
sort tags list per articles in it | |
Diffstat: | |
M data/articles.lisp | 3 ++- | |
M generator.lisp | 15 +++++++++++++-- | |
2 files changed, 15 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/data/articles.lisp b/data/articles.lisp | |
@@ -47,7 +47,8 @@ | |
(post :title "test" | |
- :id "t" :date "20171214" :tag "f" :converter :org-mode) | |
+ :id "t" :date "20171214" :tag "cl-yag" :converter :org-mode) | |
+ | |
;; CSS | |
(post :title "CSS For cl-yag" | |
:id "css" :date "20171202" :tag "cl-yag" | |
diff --git a/generator.lisp b/generator.lisp | |
@@ -357,7 +357,10 @@ | |
(ensure-directories-exist directory-path) | |
(save-file index-path | |
(let ((output (load-file "templates/gopher_head.tpl"))) | |
- (loop for tag in (articles-by-tag) | |
+ (loop for tag in | |
+ ;; sort tags per articles in it | |
+ (sort (articles-by-tag) #'> | |
+ :key #'(lambda (x) (length (getf x :value)))) | |
do | |
(setf output | |
(string | |
@@ -365,7 +368,15 @@ | |
'string output | |
(format nil (getf *config* :gopher-format) | |
1 ;; gopher type, 1 for menus | |
- (getf tag :NAME) | |
+ ;; here we create a 72 width char string… | |
+ ;; and number of articles on the right | |
+ ;; we truncate the article title if it's… | |
+ (let ((title (format nil "~72a" | |
+ (if (< 72 (length (… | |
+ (subseq (getf t… | |
+ (getf tag :NAME… | |
+ (article-number (format nil "~d ar… | |
+ (replace title article-number :start1 … | |
(concatenate 'string | |
(getf *config* :gopher-path… | |
(getf *config* :gopher-server) |