Add articles metadata as header in gopher articles - cl-yag - Common Lisp Yet A… | |
git clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit eeb8131035ae98f04288c319848f23acb16c35cd | |
parent e9fb727d69131de4b7b2662825bc130e2bf0020d | |
Author: Solene Rapenne <[email protected]> | |
Date: Fri, 12 Oct 2018 16:56:55 +0200 | |
Add articles metadata as header in gopher articles | |
Diffstat: | |
M generator.lisp | 22 ++++++++++++++-------- | |
M templates/gopher_head.tpl | 1 + | |
2 files changed, 15 insertions(+), 8 deletions(-) | |
--- | |
diff --git a/generator.lisp b/generator.lisp | |
@@ -24,7 +24,6 @@ | |
(declare (ignore second minute hour date month year dst-p tz)) | |
day-of-week)) | |
- | |
;; parse the date to | |
(defun date-parse(date) | |
(if (= 8 (length date)) | |
@@ -41,7 +40,7 @@ | |
:year year)) | |
nil)) | |
-(defun post(&optional &key title tag date id (tiny nil) (author nil) (converte… | |
+(defun post(&optional &key title tag date id (tiny nil) (author (getf *config*… | |
(push (make-article :title title | |
:tag tag | |
:date (date-parse date) | |
@@ -394,13 +393,20 @@ | |
(ensure-directories-exist directory-path) | |
(save-file index-path (generate-gopher-index articles-with-tag)))) | |
- ;; produce each article file (only a copy/paste in fact) | |
+ ;; produce each article file (adding some headers) | |
(loop for article in *articles* | |
- do | |
- (with-converter | |
- (let ((id (article-id article))) | |
- (save-file (format nil "output/gopher/article-~d.txt" id) | |
- (load-file (format nil "data/~d~d" id (converter-extensi… | |
+ do | |
+ (with-converter | |
+ (let ((id (article-id article))) | |
+ (save-file (format nil "output/gopher/article-~d.txt" id) | |
+ (format nil "~{~a~}" | |
+ (list | |
+ "Title: " (article-title article) "~%" | |
+ "Author: " (article-author article) "~%" | |
+ "Date: " (date-format (getf *config* :date-fo… | |
+ "Tags: " (article-tag article) "~%" | |
+ "==========~%~%" | |
+ (load-file (format nil "data/~d~d" id (conver… | |
;; This is function called when running the tool | |
diff --git a/templates/gopher_head.tpl b/templates/gopher_head.tpl | |
@@ -2,6 +2,7 @@ Hello, this is the head of your gophermap page, you can | |
customize it how you want ! | |
[0|RSS Feed|/~me/rss.xml|server|port] | |
+[1|Phlog index|/~me/|server|port] | |
[1|Browse by tag|/~me/_tags_/|server|port] | |
----------------------------------------------------------------- |