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