SMOLNET PORTAL home about changes
iCleaner code using structure for storing articles metadata Posts are declared individually with a function instead of modifying a global variable, this is much cleaner. Gopher index format and index file name can be customized in the config file, no need to tweak generator.lisp anymore Tell multimarkdown to export to html, specifying the output format is now mandatory in multimarkdown Examples of the future way to handle multiple markup language by declaring converters - 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 52bd9a828bdd422d4c4ec8fbd30ba8f5ef253e76	/scm/cl-yag/commit/52bd9a828bdd422d4c4ec8fbd30ba8f5ef253e76.gph	bitreich.org	70
1parent bbf0687d3956613d10973d651dd4154337a34880	/scm/cl-yag/commit/bbf0687d3956613d10973d651dd4154337a34880.gph	bitreich.org	70
hAuthor: Solene Rapenne <solene@perso.pw>	URL:mailto:solene@perso.pw	bitreich.org	70
iDate:   Wed, 13 Dec 2017 12:08:57 +0100	Err	bitreich.org	70
i	Err	bitreich.org	70
iCleaner code using structure for storing articles metadata	Err	bitreich.org	70
iPosts are declared individually with a function instead of modifying a global variable, this is much cleaner.	Err	bitreich.org	70
iGopher index format and index file name can be customized in the config file, no need to tweak generator.lisp anymore	Err	bitreich.org	70
iTell multimarkdown to export to html, specifying the output format is now mandatory in multimarkdown	Err	bitreich.org	70
iExamples of the future way to handle multiple markup language by declaring converters	Err	bitreich.org	70
i	Err	bitreich.org	70
iDiffstat:	Err	bitreich.org	70
i  M Makefile                            |       2 +-	Err	bitreich.org	70
i  M README.md                           |      31 ++++++++++++++++++-------------	Err	bitreich.org	70
i  M data/1.md                           |       4 +++-	Err	bitreich.org	70
i  M data/README.md                      |      31 ++++++++++++++++++-------------	Err	bitreich.org	70
i  M data/articles.lisp                  |      55 ++++++++++++++++++-------------	Err	bitreich.org	70
i  M generator.lisp                      |      15 ++++++++++++---	Err	bitreich.org	70
i	Err	bitreich.org	70
i6 files changed, 84 insertions(+), 54 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@@ -1,5 +1,5 @@	Err	bitreich.org	70
i LISP=          sbcl	Err	bitreich.org	70
i-MD=            multimarkdown -o	Err	bitreich.org	70
i+MD=            multimarkdown -t html -o	Err	bitreich.org	70
i 	Err	bitreich.org	70
i HTMLDIR=       temp/data	Err	bitreich.org	70
i ARTICLES!=     ls data/*.md	Err	bitreich.org	70
1diff --git a/README.md b/README.md	/scm/cl-yag/file/README.md.gph	bitreich.org	70
i@@ -3,17 +3,18 @@	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Introduction	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-cl-yag is a lightweight, static site generator that produces **gopher** sites as well as **html** websites.  	Err	bitreich.org	70
i-The name 'cl-yag' stands for 'Common Lisp - Yet Another website Generator'.  	Err	bitreich.org	70
i-It runs without Quicklisp.	Err	bitreich.org	70
i+cl-yag is a lightweight, static site generator that produces	Err	bitreich.org	70
i+**gopher** sites as well as **html** websites.  The name 'cl-yag'	Err	bitreich.org	70
i+stands for 'Common Lisp - Yet Another website Generator'.  It runs	Err	bitreich.org	70
i+without needing Quicklisp (Common LISP library manager).	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Showcase	Err	bitreich.org	70
i 	Err	bitreich.org	70
i I am using cl-yag to create and maintain my websites in the	Err	bitreich.org	70
i-world-wide-web (visit: *[Solene's	Err	bitreich.org	70
i-percent](https://dataswamp.org/~solene/)*) as well as [in	Err	bitreich.org	70
i-gopher-space](gopher://dataswamp.org/1/~solene/).	Err	bitreich.org	70
i+world-wide-web (visit: *[Solene's percent]	Err	bitreich.org	70
i+(https://dataswamp.org/~solene/)*) as well as [in gopher-space]	Err	bitreich.org	70
i+(gopher://dataswamp.org/1/~solene/).	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Requirements	Err	bitreich.org	70
i@@ -101,7 +102,7 @@ to set most of the values in this file.	Err	bitreich.org	70
i **data/articles.lisp** has two parts:	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 1. A variable called *config*. Its values define your webpage.	Err	bitreich.org	70
i-2. A variable called *articles*. Its values define your posts.	Err	bitreich.org	70
i+2. "posts" declaration with their metadata	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Values are assigned by placing a string (e.g. ``"foo"``) or a boolean	Err	bitreich.org	70
i (i.e. ``t`` or ``nil``) behind a keyword (e.g. ``:title``).	Err	bitreich.org	70
i@@ -134,12 +135,16 @@ The *config* variable is used to assign the following values:	Err	bitreich.org	70
i     - Hostname of the gopher server. It needs to be included in each link.	Err	bitreich.org	70
i - **gopher-port**	Err	bitreich.org	70
i     - tcp port of the gopher server. 70 is the default port. It needs to be included in each link.	Err	bitreich.org	70
i+- **gopher-format**	Err	bitreich.org	70
i+    - format of the gopher server. default is the geomyidae format, gophernicus format is commented.	Err	bitreich.org	70
i+- **gopher-index**	Err	bitreich.org	70
i+    - name of the gopher menu file. defaut is index.gph for geomyidae, gophermap file is commented.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-### The *articles* Variable	Err	bitreich.org	70
i+### Posts declarations	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-The *articles* variable holds post metadata.  	Err	bitreich.org	70
i-So you need to create an entry in the *articles* variable for each of your posts.	Err	bitreich.org	70
i+Each post is declared with its metadata using the function "post".	Err	bitreich.org	70
i+So you need to add a new line for each of your posts.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Of the following keywords, only ``:author`` and ``:short`` can be omitted.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -178,18 +183,18 @@ Then write a corresponding **data/2.md** file, using markdown.	Err	bitreich.org	70
i ## Howto Publish A Post	Err	bitreich.org	70
i 	Err	bitreich.org	70
i I prepared a Makefile to facilitate the process of generating and	Err	bitreich.org	70
i-publishing your static sites.  	Err	bitreich.org	70
i+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 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 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Howto Add A New Page	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-You may want to have some dedicated pages besides the index or a post.  	Err	bitreich.org	70
i+You may want to have some dedicated pages besides the index or a post.	Err	bitreich.org	70
i To create one, edit the *generate-site* function in cl-yag's	Err	bitreich.org	70
i **generator.lisp** and add a function call, like this:	Err	bitreich.org	70
i 	Err	bitreich.org	70
1diff --git a/data/1.md b/data/1.md	/scm/cl-yag/file/data/1.md.gph	bitreich.org	70
i@@ -1 +1,3 @@	Err	bitreich.org	70
i-This contains the text of the article with id 1	Err	bitreich.org	70
i+This contains the text of the article with id 1.	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+It has two paragraphs and is displayed on the homepage.	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@@ -3,17 +3,18 @@	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Introduction	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-cl-yag is a lightweight, static site generator that produces **gopher** sites as well as **html** websites.  	Err	bitreich.org	70
i-The name 'cl-yag' stands for 'Common Lisp - Yet Another website Generator'.  	Err	bitreich.org	70
i-It runs without Quicklisp.	Err	bitreich.org	70
i+cl-yag is a lightweight, static site generator that produces	Err	bitreich.org	70
i+**gopher** sites as well as **html** websites.  The name 'cl-yag'	Err	bitreich.org	70
i+stands for 'Common Lisp - Yet Another website Generator'.  It runs	Err	bitreich.org	70
i+without needing Quicklisp (Common LISP library manager).	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Showcase	Err	bitreich.org	70
i 	Err	bitreich.org	70
i I am using cl-yag to create and maintain my websites in the	Err	bitreich.org	70
i-world-wide-web (visit: *[Solene's	Err	bitreich.org	70
i-percent](https://dataswamp.org/~solene/)*) as well as [in	Err	bitreich.org	70
i-gopher-space](gopher://dataswamp.org/1/~solene/).	Err	bitreich.org	70
i+world-wide-web (visit: *[Solene's percent]	Err	bitreich.org	70
i+(https://dataswamp.org/~solene/)*) as well as [in gopher-space]	Err	bitreich.org	70
i+(gopher://dataswamp.org/1/~solene/).	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Requirements	Err	bitreich.org	70
i@@ -101,7 +102,7 @@ to set most of the values in this file.	Err	bitreich.org	70
i **data/articles.lisp** has two parts:	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 1. A variable called *config*. Its values define your webpage.	Err	bitreich.org	70
i-2. A variable called *articles*. Its values define your posts.	Err	bitreich.org	70
i+2. "posts" declaration with their metadata	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Values are assigned by placing a string (e.g. ``"foo"``) or a boolean	Err	bitreich.org	70
i (i.e. ``t`` or ``nil``) behind a keyword (e.g. ``:title``).	Err	bitreich.org	70
i@@ -134,12 +135,16 @@ The *config* variable is used to assign the following values:	Err	bitreich.org	70
i     - Hostname of the gopher server. It needs to be included in each link.	Err	bitreich.org	70
i - **gopher-port**	Err	bitreich.org	70
i     - tcp port of the gopher server. 70 is the default port. It needs to be included in each link.	Err	bitreich.org	70
i+- **gopher-format**	Err	bitreich.org	70
i+    - format of the gopher server. default is the geomyidae format, gophernicus format is commented.	Err	bitreich.org	70
i+- **gopher-index**	Err	bitreich.org	70
i+    - name of the gopher menu file. defaut is index.gph for geomyidae, gophermap file is commented.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-### The *articles* Variable	Err	bitreich.org	70
i+### Posts declarations	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-The *articles* variable holds post metadata.  	Err	bitreich.org	70
i-So you need to create an entry in the *articles* variable for each of your posts.	Err	bitreich.org	70
i+Each post is declared with its metadata using the function "post".	Err	bitreich.org	70
i+So you need to add a new line for each of your posts.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Of the following keywords, only ``:author`` and ``:short`` can be omitted.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -178,18 +183,18 @@ Then write a corresponding **data/2.md** file, using markdown.	Err	bitreich.org	70
i ## Howto Publish A Post	Err	bitreich.org	70
i 	Err	bitreich.org	70
i I prepared a Makefile to facilitate the process of generating and	Err	bitreich.org	70
i-publishing your static sites.  	Err	bitreich.org	70
i+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 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 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Howto Add A New Page	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-You may want to have some dedicated pages besides the index or a post.  	Err	bitreich.org	70
i+You may want to have some dedicated pages besides the index or a post.	Err	bitreich.org	70
i To create one, edit the *generate-site* function in cl-yag's	Err	bitreich.org	70
i **generator.lisp** and add a function call, like this:	Err	bitreich.org	70
i 	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@@ -8,39 +8,48 @@	Err	bitreich.org	70
i    :webmaster       "Your autor name here"	Err	bitreich.org	70
i    :title           "Your website's title."	Err	bitreich.org	70
i    :description     "Yet another website on the net"	Err	bitreich.org	70
i-   :url             "https://my.website/~~user/";     ;; the trailing slash is mandatory! RSS links will fail without it. Notice the '~~' to produce a literal '~'	Err	bitreich.org	70
i-   :rss-item-number 10                               ;; limit total amount of items in RSS feed to 10	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-   :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
i+   :url             "https://my.website/~~user/";        ;; the trailing slash is mandatory! RSS links will fail without it. Notice the '~~' to produce a literal '~'	Err	bitreich.org	70
i+   :rss-item-number 10                                  ;; limit total amount of items in RSS feed to 10	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+   :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
i+   :gopher-format "[0|~a|~a/article-~d.txt|~a|~a]~%~%"  ;; geomyidae	Err	bitreich.org	70
i+   :gopher-index "index.gph"                            ;; geomyidae	Err	bitreich.org	70
i+   ;; :gopher-format "0~a        ~a/article-~d.txt        ~a        ~a~%~%" ;; gophernicus and others	Err	bitreich.org	70
i+   ;; :gopher-index "gophermap"                         ;; gophernicus and others	Err	bitreich.org	70
i    ))	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i+(converter :name :markdown  :extension ".md" :command "peg-markdown -o %IN")	Err	bitreich.org	70
i+(converter :name :markdown2 :extension ".md" :command "multimarkdown -o %IN")	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-;; Define your articles and their display-order on the website in *articles* below.	Err	bitreich.org	70
i+;; Define your articles and their display-order on the website below.	Err	bitreich.org	70
i ;; Display Order is 'lifo', i.e. the top entry in this list gets displayed as the topmost entry.	Err	bitreich.org	70
i ;; 	Err	bitreich.org	70
i ;; An Example Of A Minimal Definition:	Err	bitreich.org	70
i-;; (list :id "4" :date "2015-05-04" :title "The article title" :author "Me" :tiny "Short description for home page")	Err	bitreich.org	70
i+;; (post :id "4" :date "2015-12-31" :title "Happy new year" :tag "news")	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+;; An Example Of A Definitions With Options:	Err	bitreich.org	70
i+;; (post :id "4" :date "2015-05-04" :title "The article title" :tag "news" :author "Me" :tiny "Short description for home page")	Err	bitreich.org	70
i ;;	Err	bitreich.org	70
i ;; A Note On Keywords:	Err	bitreich.org	70
i ;; :author  can be omitted.   If so, it's value gets replaced by the value of :webmaster.	Err	bitreich.org	70
i ;; :tiny    can be omitted.   If so, the article's full text gets displayed on the all-articles view. (most people don't want this.)	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-(defvar *articles*	Err	bitreich.org	70
i-  (list	Err	bitreich.org	70
i-   ;; CSS	Err	bitreich.org	70
i-   (list :id "css"               :date "02.12.2017"  :tag "cl-yag"	Err	bitreich.org	70
i-         :title "CSS For cl-yag" :author "lambda"    :tiny "Read more")	Err	bitreich.org	70
i-   ;; README	Err	bitreich.org	70
i-   (list :id "README"    :date "23.11.2017"  :tag "cl-yag"	Err	bitreich.org	70
i-         :title "README" :author "lambda"    :tiny "Read cl-yag's README")	Err	bitreich.org	70
i-   ;; 1	Err	bitreich.org	70
i-   (list :id "1"                   :date "29.04.2016"                :tag "pony"	Err	bitreich.org	70
i-         :title "My first message" :short "This is my first message" :author "Solène" :tiny "Read more")	Err	bitreich.org	70
i-   ))	Err	bitreich.org	70
i 	Err	bitreich.org	70
i+;; CSS	Err	bitreich.org	70
i+(post :title "CSS For cl-yag"	Err	bitreich.org	70
i+      :id "css" :date "02.12.2017" :tag "cl-yag"	Err	bitreich.org	70
i+      :author "lambda" :tiny "Read more")	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+;; README	Err	bitreich.org	70
i+(post :title "README"	Err	bitreich.org	70
i+      :id "README" :date "23.11.2017" :tag "cl-yag"	Err	bitreich.org	70
i+      :author "lambda" :tiny "Read cl-yag's README")	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+;; 1	Err	bitreich.org	70
i+(post :title "My first post"	Err	bitreich.org	70
i+      :id "1" :date "29.04.2016" :tag "pony"	Err	bitreich.org	70
i+      :tiny "This is the first message" :author "Solène")	Err	bitreich.org	70
1diff --git a/generator.lisp b/generator.lisp	/scm/cl-yag/file/generator.lisp.gph	bitreich.org	70
i@@ -1,7 +1,9 @@	Err	bitreich.org	70
i (defparameter *articles* '())	Err	bitreich.org	70
i+(defparameter *converters* '())	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ;; structure to store links	Err	bitreich.org	70
i (defstruct article title tag date id tiny author short)	Err	bitreich.org	70
i+(defstruct converter name command extension)	Err	bitreich.org	70
i 	Err	bitreich.org	70
i (defun post(&optional &key title tag date id (tiny nil) (author nil) (short nil))	Err	bitreich.org	70
i   (push (make-article :title title	Err	bitreich.org	70
i@@ -13,7 +15,15 @@	Err	bitreich.org	70
i                       :id id)	Err	bitreich.org	70
i         *articles*))	Err	bitreich.org	70
i 	Err	bitreich.org	70
i+;; we add a converter to the list of the one availables	Err	bitreich.org	70
i+(defun converter(&optional &key name command extension)	Err	bitreich.org	70
i+  (push (make-converter :name name	Err	bitreich.org	70
i+                        :command command	Err	bitreich.org	70
i+                        :extension extension)	Err	bitreich.org	70
i+        *converters*))	Err	bitreich.org	70
i+	Err	bitreich.org	70
i (load "data/articles.lisp")	Err	bitreich.org	70
i+(setf *articles* (reverse *articles*))	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ;; common-lisp don't have a replace string function natively	Err	bitreich.org	70
i@@ -200,14 +210,13 @@	Err	bitreich.org	70
i (defun create-gopher-hole()	Err	bitreich.org	70
i 	Err	bitreich.org	70
i   ;; produce the gophermap file	Err	bitreich.org	70
i-  (save-file "output/gopher/gophermap"	Err	bitreich.org	70
i+  (save-file (concatenate 'string "output/gopher/" (getf *config* :gopher-index))	Err	bitreich.org	70
i              (let ((output (load-file "templates/gopher_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 "0~a        ~a/article-~d.txt        ~a        ~a~%~%"	Err	bitreich.org	70
i-                                             	Err	bitreich.org	70
i+                                     (format nil (getf *config* :gopher-format)	Err	bitreich.org	70
i                                              ;; here we create a 80 width char string with title on the left	Err	bitreich.org	70
i                                              ;; and date on the right	Err	bitreich.org	70
i                                              ;; we truncate the article title if it's too large	Err	bitreich.org	70
.
Response: text/plain
Original URLgopher://bitreich.org/0/scm/cl-yag/commit/52bd9a828bdd422...
Content-Typetext/plain; charset=utf-8