iAdd gemini export - 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 a9cc963e39455b4f75af129ca00d635a02fc1702 /scm/cl-yag/commit/a9cc963e39455b4f75af129ca00d635a02fc1702.gph bitreich.org 70
1parent 929692a3001141f9e9350b888565c51b92851e10 /scm/cl-yag/commit/929692a3001141f9e9350b888565c51b92851e10.gph bitreich.org 70
hAuthor: Solene Rapenne <solene@perso.pw> URL:mailto:solene@perso.pw bitreich.org 70
iDate: Mon, 30 Nov 2020 21:46:43 +0100 Err bitreich.org 70
i Err bitreich.org 70
iAdd gemini export Err bitreich.org 70
i Err bitreich.org 70
iDiffstat: Err bitreich.org 70
i M Makefile | 1 + Err bitreich.org 70
i M data/README.md | 22 +++++++++++++++------- Err bitreich.org 70
i M data/articles.lisp | 3 +++ Err bitreich.org 70
i M generator.lisp | 68 +++++++++++++++++++++++++++++++ Err bitreich.org 70
i A templates/gemini_head.tpl | 6 ++++++ Err bitreich.org 70
i M templates/gopher_head.tpl | 2 +- Err bitreich.org 70
i Err bitreich.org 70
i6 files changed, 94 insertions(+), 8 deletions(-) Err bitreich.org 70
i--- Err bitreich.org 70
1diff --git a/Makefile b/Makefile /scm/cl-yag/file/Makefile.gph bitreich.org 70
i@@ -8,6 +8,7 @@ html: $(HTML) css Err bitreich.org 70
i dirs: Err bitreich.org 70
i mkdir -p "output/html/static" Err bitreich.org 70
i mkdir -p "output/gopher" Err bitreich.org 70
i+ mkdir -p "output/gemini/articles/" Err bitreich.org 70
i Err bitreich.org 70
i Err bitreich.org 70
i clean: Err bitreich.org 70
1diff --git a/data/README.md b/data/README.md /scm/cl-yag/file/data/README.md.gph bitreich.org 70
i@@ -51,13 +51,15 @@ least the following files and folders: Err bitreich.org 70
i | `-- articles.lisp Err bitreich.org 70
i |-- generator.lisp Err bitreich.org 70
i |-- output/ Err bitreich.org 70
i- | |-- gopher/ Err bitreich.org 70
i+ | |-- gemini/ Err bitreich.org 70
i+ | |-- gopher/ Err bitreich.org 70
i | `-- html/ Err bitreich.org 70
i |-- static/ Err bitreich.org 70
i | |-- css/style.css Err bitreich.org 70
i | `-- img/ Err bitreich.org 70
i `-- templates/ Err bitreich.org 70
i |-- article.tpl Err bitreich.org 70
i+ |-- gemini_head.tpl Err bitreich.org 70
i |-- gopher_head.tpl Err bitreich.org 70
i |-- layout.tpl Err bitreich.org 70
i |-- one-tag.tpl Err bitreich.org 70
i@@ -129,6 +131,12 @@ The *config* variable is used to assign the following values: Err bitreich.org 70
i - ``t`` to export html website. Set ``nil`` to disable. Err bitreich.org 70
i - **gopher** Err bitreich.org 70
i - ``t`` to export gopher website. Set ``nil`` to disable. Err bitreich.org 70
i+- **gemini** Err bitreich.org 70
i+ - ``t`` to export gemini capsule. Set ``nil`` to disable. Err bitreich.org 70
i+- **gemini-path** Err bitreich.org 70
i+ - This is the absolute public gemini url. Err bitreich.org 70
i+- **gemini-index** Err bitreich.org 70
i+ - This is the name of the index file. Default is ``index.md`` Err bitreich.org 70
i - **gopher-path** Err bitreich.org 70
i - This is the full path of the directory to access your gopher hole. Err bitreich.org 70
i - **gopher-server** Err bitreich.org 70
i@@ -187,9 +195,9 @@ publishing your static sites. Err bitreich.org 70
i All you need to do in order to publish is to go into your cl-yag Err bitreich.org 70
i directory and type ``make``. Err bitreich.org 70
i Err bitreich.org 70
i-The make command creates html and gopher files in the defined location. Err bitreich.org 70
i-The default is the **output/** directory, but you can use a symbolic link Err bitreich.org 70
i-pointing to some other directory as well. Err bitreich.org 70
i+The make command creates html, gemini and gopher files in the defined Err bitreich.org 70
i+location. The default is the **output/** directory, but you can use a Err bitreich.org 70
i+symbolic link pointing to some other directory as well. Err bitreich.org 70
i Err bitreich.org 70
i Err bitreich.org 70
i ## Howto Add A New Page Err bitreich.org 70
i@@ -261,8 +269,8 @@ displays: "Tags: ". Err bitreich.org 70
i ### A Note On Themes Err bitreich.org 70
i Err bitreich.org 70
i Although cl-yag may ship with a minimalistic template, cl-yag focuses Err bitreich.org 70
i-on generating html- and gopher-compliant structural markup - not Err bitreich.org 70
i-themed layouts. Err bitreich.org 70
i+on generating html-, gemini and gopher-compliant structural markup - Err bitreich.org 70
i+not themed layouts. Err bitreich.org 70
i Err bitreich.org 70
i If you want some deeply refined, cross-browser compatible, responsive, Err bitreich.org 70
i webscale style sheets, you need to create them yourself. However, Err bitreich.org 70
i@@ -272,7 +280,7 @@ style sheets a part of cl-yag you're very welcome to contact me. Err bitreich.org 70
i Err bitreich.org 70
i # Hacking cl-yag Err bitreich.org 70
i Err bitreich.org 70
i-I tried to make cl-yag easy to extend. Err bitreich.org 70
i+I tried to make cl-yag easy to extend. Err bitreich.org 70
i If you want to contribute, feel free to contact me and/or to send in a patch. Err bitreich.org 70
i Err bitreich.org 70
i - If you are looking for a way to contribute: Err bitreich.org 70
1diff --git a/data/articles.lisp b/data/articles.lisp /scm/cl-yag/file/data/articles.lisp.gph bitreich.org 70
i@@ -14,6 +14,9 @@ Err bitreich.org 70
i :default-converter :markdown2 Err bitreich.org 70
i :html t ;; 't' to enable export to a html website / 'nil' to disable Err bitreich.org 70
i :gopher t ;; 't' to enable export to a gopher website / 'nil' to disable Err bitreich.org 70
i+ :gemini t ;; 't' to enable export to a gemini capsule / 'nil' to disable Err bitreich.org 70
i+ :gemini-path "gemini://perso.pw/blog/"; ;; absolute path of your gemini capsule Err bitreich.org 70
i+ :gemini-index "index.md" ;; filename of index file Err bitreich.org 70
i :gopher-path "/user" ;; absolute path of your gopher directory Err bitreich.org 70
i :gopher-server "my.website" ;; hostname of the gopher server Err bitreich.org 70
i :gopher-port "70" ;; tcp port of the gopher server, 70 usually Err bitreich.org 70
1diff --git a/generator.lisp b/generator.lisp /scm/cl-yag/file/generator.lisp.gph bitreich.org 70
i@@ -173,6 +173,19 @@ Err bitreich.org 70
i `(progn Err bitreich.org 70
i (save-file ,name (generate-layout ,@data)))) Err bitreich.org 70
i Err bitreich.org 70
i+;; generate a gemini index file Err bitreich.org 70
i+(defun generate-gemini-index(articles) Err bitreich.org 70
i+ (let ((output (load-file "templates/gemini_head.tpl"))) Err bitreich.org 70
i+ (dolist (article articles) Err bitreich.org 70
i+ (setf output Err bitreich.org 70
i+ (string Err bitreich.org 70
i+ (concatenate 'string output Err bitreich.org 70
i+ (format nil "=> ~a/articles/~a.txt ~a~%" Err bitreich.org 70
i+ (getf *config* :gemini-path) Err bitreich.org 70
i+ (article-id article) Err bitreich.org 70
i+ (article-title article)))))) Err bitreich.org 70
i+ output)) Err bitreich.org 70
i+ Err bitreich.org 70
i ;; generate a gopher index file Err bitreich.org 70
i (defun generate-gopher-index(articles) Err bitreich.org 70
i (let ((output (load-file "templates/gopher_head.tpl"))) Err bitreich.org 70
i@@ -339,6 +352,59 @@ Err bitreich.org 70
i ;;(generate-file-rss) Err bitreich.org 70
i (save-file "output/html/rss.xml" (generate-rss))) Err bitreich.org 70
i Err bitreich.org 70
i+;; we do all the gemini capsule Err bitreich.org 70
i+(defun create-gemini-capsule() Err bitreich.org 70
i+ Err bitreich.org 70
i+ ;; produce the index.md file Err bitreich.org 70
i+ (save-file (concatenate 'string "output/gemini/" (getf *config* :gemini-index)) Err bitreich.org 70
i+ (generate-gemini-index *articles*)) Err bitreich.org 70
i+ Err bitreich.org 70
i+ ;; produce a tag list menu Err bitreich.org 70
i+ (let* ((directory-path "output/gemini/_tags_/") Err bitreich.org 70
i+ (index-path (concatenate 'string directory-path (getf *config* :gemini-index)))) Err bitreich.org 70
i+ (ensure-directories-exist directory-path) Err bitreich.org 70
i+ (save-file index-path Err bitreich.org 70
i+ (let ((output (load-file "templates/gemini_head.tpl"))) Err bitreich.org 70
i+ (loop for tag in Err bitreich.org 70
i+ ;; sort tags per articles in it Err bitreich.org 70
i+ (sort (articles-by-tag) #'> Err bitreich.org 70
i+ :key #'(lambda (x) (length (getf x :value)))) Err bitreich.org 70
i+ do Err bitreich.org 70
i+ (setf output Err bitreich.org 70
i+ (string Err bitreich.org 70
i+ (concatenate Err bitreich.org 70
i+ 'string output Err bitreich.org 70
i+ (format nil "=> ~a/~a/index.md ~a ~d~%" Err bitreich.org 70
i+ (getf *config* :gemini-path) Err bitreich.org 70
i+ (getf tag :name) Err bitreich.org 70
i+ (getf tag :name) Err bitreich.org 70
i+ (length (getf tag :value))))))) Err bitreich.org 70
i+ output))) Err bitreich.org 70
i+ Err bitreich.org 70
i+ ;; produce each tag gemini index Err bitreich.org 70
i+ (loop for tag in (articles-by-tag) do Err bitreich.org 70
i+ (let* ((directory-path (concatenate 'string "output/gemini/" (getf tag :NAME) "/")) Err bitreich.org 70
i+ (index-path (concatenate 'string directory-path (getf *config* :gemini-index))) Err bitreich.org 70
i+ (articles-with-tag (loop for article in *articles* Err bitreich.org 70
i+ when (member (article-id article) (getf tag :VALUE) :test #'equal) Err bitreich.org 70
i+ collect article))) Err bitreich.org 70
i+ (ensure-directories-exist directory-path) Err bitreich.org 70
i+ (save-file index-path (generate-gemini-index articles-with-tag)))) Err bitreich.org 70
i+ 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/gemini/articles/~a.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) #\Newline Err bitreich.org 70
i+ "Author: " (article-author article) #\Newline Err bitreich.org 70
i+ "Date : " (date-format (getf *config* :date-format) (article-date article)) #\Newline Err bitreich.org 70
i+ "Tags : " (article-tag article) #\Newline #\Newline 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 ;; we do all the gopher hole Err bitreich.org 70
i (defun create-gopher-hole() Err bitreich.org 70
i Err bitreich.org 70
i@@ -410,6 +476,8 @@ Err bitreich.org 70
i (defun generate-site() Err bitreich.org 70
i (if (getf *config* :html) Err bitreich.org 70
i (create-html-site)) Err bitreich.org 70
i+ (if (getf *config* :gemini) Err bitreich.org 70
i+ (create-gemini-capsule)) Err bitreich.org 70
i (if (getf *config* :gopher) Err bitreich.org 70
i (create-gopher-hole))) Err bitreich.org 70
i Err bitreich.org 70
1diff --git a/templates/gemini_head.tpl b/templates/gemini_head.tpl /scm/cl-yag/file/templates/gemini_head.tpl.gph bitreich.org 70
i@@ -0,0 +1,6 @@ Err bitreich.org 70
i+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+=> /index.md Home Err bitreich.org 70
i+ Err bitreich.org 70
i+------------------------------------------------------------------ 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,7 +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|Phlog index|/~me/|server|port]i 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
.
Response:
text/plain