SMOLNET PORTAL home about changes
iGopher export available - 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 b70cc28e578b4ce432d7e81dab33b60eb118ccaf	/scm/cl-yag/commit/b70cc28e578b4ce432d7e81dab33b60eb118ccaf.gph	bitreich.org	70
1parent 76baf068a53ee155aa4850c0beac0ecfeb51b59d	/scm/cl-yag/commit/76baf068a53ee155aa4850c0beac0ecfeb51b59d.gph	bitreich.org	70
hAuthor: solene rapenne <solene@dataswamp.org>	URL:mailto:solene@dataswamp.org	bitreich.org	70
iDate:   Thu, 11 Aug 2016 14:51:05 +0200	Err	bitreich.org	70
i	Err	bitreich.org	70
iGopher export available	Err	bitreich.org	70
i	Err	bitreich.org	70
iDiffstat:	Err	bitreich.org	70
i  M Makefile                            |      32 ++++++++++++++++++++++---------	Err	bitreich.org	70
i  M README.md                           |      34 ++++++++++++++-----------------	Err	bitreich.org	70
i  A data/1.md                           |       1 +	Err	bitreich.org	70
i  D data/1.txt                          |       1 -	Err	bitreich.org	70
i  A data/2.md                           |       1 +	Err	bitreich.org	70
i  D data/2.txt                          |       1 -	Err	bitreich.org	70
i  M data/articles.lisp                  |       4 ++++	Err	bitreich.org	70
i  M generator.lisp                      |      58 ++++++++++++++++++++++++-------	Err	bitreich.org	70
i  A template/gopher_head.tpl            |       5 +++++	Err	bitreich.org	70
i	Err	bitreich.org	70
i9 files changed, 95 insertions(+), 42 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,9 @@	Err	bitreich.org	70
i-LISP=clisp	Err	bitreich.org	70
i-PARAM=	Err	bitreich.org	70
i+LISP=          sbcl	Err	bitreich.org	70
i+MD=            multimarkdown -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
i+HTML=          $(ARTICLES:.md=.html)	Err	bitreich.org	70
i 	Err	bitreich.org	70
i .if "${LISP}" == "sbcl"	Err	bitreich.org	70
i PARAM=--dynamic-space-size 60 --script	Err	bitreich.org	70
i@@ -9,14 +13,24 @@ PARAM=	Err	bitreich.org	70
i PARAM=-shell	Err	bitreich.org	70
i .endif	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-all:	Err	bitreich.org	70
i-        mkdir -p output/static	Err	bitreich.org	70
i-        cp -fr static/* output/static/	Err	bitreich.org	70
i-        LANG=POSIX.UTF-8 $(LISP) $(PARAM) generator.lisp	Err	bitreich.org	70
i+all: clean dirs html	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+html: $(HTML) css	Err	bitreich.org	70
i+        LANG=en_US.UTF-8 $(LISP) $(PARAM) generator.lisp	Err	bitreich.org	70
i+        rm -fr "temp"	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+dirs:	Err	bitreich.org	70
i+        mkdir -p "$(HTMLDIR)"	Err	bitreich.org	70
i+        mkdir -p "output/html/static"	Err	bitreich.org	70
i+        mkdir -p "output/gopher"	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+.SUFFIXES: .md .html	Err	bitreich.org	70
i+.md.html:	Err	bitreich.org	70
i+        $(MD) "$(HTMLDIR)/$(@F)" "$<"	Err	bitreich.org	70
i 	Err	bitreich.org	70
i clean:	Err	bitreich.org	70
i-        rm -fr output/*	Err	bitreich.org	70
i+        rm -fr output/html/* output/gopher/* "temp"	Err	bitreich.org	70
i 	Err	bitreich.org	70
i css:	Err	bitreich.org	70
i-        mkdir -p output/static	Err	bitreich.org	70
i-        cp -fr static/* output/static/        	Err	bitreich.org	70
i+        mkdir -p "output/html/static"	Err	bitreich.org	70
i+        cp -fr static/* "output/html/static/"	Err	bitreich.org	70
1diff --git a/README.md b/README.md	/scm/cl-yag/file/README.md.gph	bitreich.org	70
i@@ -1,12 +1,13 @@	Err	bitreich.org	70
i # Introduction	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-cl-yag stands for Common Lisp Yet Another Generator and obviously it's written in Common Lisp.	Err	bitreich.org	70
i+cl-yag stands for Common Lisp Yet Another Generator and obviously it's written in Common Lisp. Currently, cl-yag can generate **gopher** and **html** website.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-It has only one dependency : a common lisp interpreter. It is regularly tested with sbcl, clisp and ecl which are free, open-source and multi-platform. You don't need quicklisp library manager.	Err	bitreich.org	70
i+**It needs a Common Lisp interpreter and a markdown-to-html export tool (like multimarkdown).**	Err	bitreich.org	70
i+It is regularly tested with sbcl, clisp and ecl which are free, open-source and multi-platform. You don't need quicklisp library manager.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i **This comes with a minimalistic template**, don't expect something good looking without work. You will have to write the CSS entirely and modify the html to fit your need.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-As a "demo", there is [my website](https://dataswamp.org/~solene/) using cl-yag.	Err	bitreich.org	70
i+As a "demo", there is [my website](https://dataswamp.org/~solene/) using cl-yag for html version, and [my gopher](gopher://perso.pw) for gopher version.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## The hierarchy	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -18,8 +19,10 @@ Here are the files and folder of cl-yag :	Err	bitreich.org	70
i + **static/** : contains the static files like images, css, js etc... that will be published	Err	bitreich.org	70
i + **data/** : 	Err	bitreich.org	70
i   + **articles.lisp** : contains metadata about the website and the list of the articles with their id/title/date/tag/*author*/*short description* (fields in *italic* are not mandatory)	Err	bitreich.org	70
i-  + **${id}.txt** : contains the html text of the article ${id} that will be used when displayed	Err	bitreich.org	70
i-+ **output** : folder where the website is generated when your run *make*. It is cleaned when you run *make clean*; You can make it a symbolic link to the web server folder.	Err	bitreich.org	70
i+  + **${id}.md** : contains the article using markdown syntax that will be used when exported	Err	bitreich.org	70
i++ **output/** :	Err	bitreich.org	70
i+  + **gopher/** : contains the exported website for gopher	Err	bitreich.org	70
i+  + **html/** : contains the exported website in html	Err	bitreich.org	70
i 	Err	bitreich.org	70
i # Usage	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -32,6 +35,10 @@ In data/articles.lisp there is a ***config*** variable with the following fields	Err	bitreich.org	70
i + **:description** : This text is used in the *description* field of the Atom RSS	Err	bitreich.org	70
i + **:url** : This is the full url of the blog with the final slash. If the url contains a ~ it should be doubled (e.g. : https://mydomain/~~user/ is a valid url)	Err	bitreich.org	70
i + **:rss-item-number** : This is the number of RSS items you want to published when you generate the files, it will publish the last N articles	Err	bitreich.org	70
i++ **html** : t to export html website / nil to disable	Err	bitreich.org	70
i++ **gopher** : t to export gopher website / nil to disable	Err	bitreich.org	70
i++ **gopher-server**: hostname of the gopher server because gopher doesn't have relative links like html, so you need to know where you put your files	Err	bitreich.org	70
i++ **gopher-port** : tcp port of the gopher server, 70 is the default port, it's included in every link as explained in gopher-server	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## How to add an article	Err	bitreich.org	70
i  	Err	bitreich.org	70
i@@ -53,7 +60,9 @@ The _:tag_ field is used to create a page with all the articles with the same ta	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## How to publish	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-There is a makefile, all you need to do is to type "make" in the folder, this will create the files in the **output/** location (which can be a symbolic link to somewhere else). If you want to use a different lisp interpreter (default is **sbcl**), you can set the variable LISP to the name of your binary. 	Err	bitreich.org	70
i+There is a makefile, all you need to do is to type "make" in the folder, this will create the files in the **output/** location (which can be a symbolic link to somewhere else). The Gopher website will be generated inside **output/gopher** and the html will be generated in **output/html**.	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+If you want to use a different lisp interpreter (default is **sbcl**), you can set the variable LISP to the name of your binary. 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i Example with clisp : 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i@@ -85,19 +94,6 @@ In **generate-site** function we can load a file, apply the template and save it	Err	bitreich.org	70
i   	Err	bitreich.org	70
i This will produce the file **somepage.html** in the output folder.	Err	bitreich.org	70
i 	Err	bitreich.org	70
i- 	Err	bitreich.org	70
i-# How to use markdown for articles	Err	bitreich.org	70
i-	Err	bitreich.org	70
i- 	Err	bitreich.org	70
i-Here is a tip to produce html files from markdown using emacs	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-1. edit the article file with emacs using ham-mode which will convert the html to markdown	Err	bitreich.org	70
i-2. write your text with markdown syntax 	Err	bitreich.org	70
i-3. save your file, ham-mode will convert it back to html	Err	bitreich.org	70
i-4. run *make* to update your site	Err	bitreich.org	70
i-	Err	bitreich.org	70
i-The generator don't do it natively because I didn't want it to have dependencies. You can use what you want to produces the html files.	Err	bitreich.org	70
i-	Err	bitreich.org	70
i # Known limitations	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ## Use of ~ character	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@@ -0,0 +1 @@	Err	bitreich.org	70
i+This contains the text of the article with id 1	Err	bitreich.org	70
1diff --git a/data/1.txt b/data/1.txt	/scm/cl-yag/file/data/1.txt.gph	bitreich.org	70
i@@ -1 +0,0 @@	Err	bitreich.org	70
i-<p>This contains the text of the article with id 1</p>	Err	bitreich.org	70
1diff --git a/data/2.md b/data/2.md	/scm/cl-yag/file/data/2.md.gph	bitreich.org	70
i@@ -0,0 +1 @@	Err	bitreich.org	70
i+**hello in bold**	Err	bitreich.org	70
1diff --git a/data/2.txt b/data/2.txt	/scm/cl-yag/file/data/2.txt.gph	bitreich.org	70
i@@ -1 +0,0 @@	Err	bitreich.org	70
i-<p>hello</p>	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@@ -11,6 +11,10 @@	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 fails without it	Err	bitreich.org	70
i    :rss-item-number 10 ;; we want 10 items in our RSS feed	Err	bitreich.org	70
i+   :html t ;; t to export html website / nil to disable	Err	bitreich.org	70
i+   :gopher t ;; t to export gopher website / nil to disable	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    ))	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ;; describes articles (ordered on the website as they are displayed here, the first in list is the top of the website)	Err	bitreich.org	70
1diff --git a/generator.lisp b/generator.lisp	/scm/cl-yag/file/generator.lisp.gph	bitreich.org	70
i@@ -43,7 +43,7 @@	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ;; save a string in a file	Err	bitreich.org	70
i (defun save-file(path data)	Err	bitreich.org	70
i-  (with-open-file (stream (concatenate 'string "output/" path) :direction :output :if-exists :supersede)	Err	bitreich.org	70
i+  (with-open-file (stream path :direction :output :if-exists :supersede)	Err	bitreich.org	70
i     (format stream data)))	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ;; simplify the str replace work	Err	bitreich.org	70
i@@ -103,7 +103,7 @@	Err	bitreich.org	70
i            (template "%%Tags%%" (get-tag-list-article article))	Err	bitreich.org	70
i            (template "%%Text%%" (if (and tiny (member :tiny article))	Err	bitreich.org	70
i                                     (getf article :tiny)	Err	bitreich.org	70
i-                                  (load-file (format nil "data/~d.txt" (getf article :id)))))))	Err	bitreich.org	70
i+                                  (load-file (format nil "temp/data/~d.html" (getf article :id)))))))	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ;; return a html string	Err	bitreich.org	70
i ;; produce the code of a whole page with title+layout with the parameter as the content	Err	bitreich.org	70
i@@ -136,7 +136,7 @@	Err	bitreich.org	70
i          collect	Err	bitreich.org	70
i          (prepare "template/rss-item.tpl"	Err	bitreich.org	70
i                   (template "%%Title%%" (getf article :title))	Err	bitreich.org	70
i-                  (template "%%Description%%" (load-file (format nil "data/~d.txt" (getf article :id))))	Err	bitreich.org	70
i+                  (template "%%Description%%" (load-file (format nil "temp/data/~d.html" (getf article :id))))	Err	bitreich.org	70
i                   (template "%%Url%%"	Err	bitreich.org	70
i                             (format nil "~darticle-~d.html"	Err	bitreich.org	70
i                                     (getf *config* :url)	Err	bitreich.org	70
i@@ -151,27 +151,61 @@	Err	bitreich.org	70
i            (template "%%Items%%" (generate-rss-item))))	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i-;; ENGINE START !	Err	bitreich.org	70
i-;; This is function called when running the tool	Err	bitreich.org	70
i-(defun generate-site()	Err	bitreich.org	70
i-	Err	bitreich.org	70
i+;; We do all the website	Err	bitreich.org	70
i+(defun create-html-site()	Err	bitreich.org	70
i   ;; produce index.html	Err	bitreich.org	70
i-  (generate "index.html" (generate-semi-mainpage))	Err	bitreich.org	70
i+  (generate "output/html/index.html" (generate-semi-mainpage))	Err	bitreich.org	70
i   	Err	bitreich.org	70
i   ;; produce each article file	Err	bitreich.org	70
i   (dolist (article *articles*)	Err	bitreich.org	70
i-    (generate (format nil "article-~d.html" (getf article :id))	Err	bitreich.org	70
i+    (generate (format nil "output/html/article-~d.html" (getf article :id))	Err	bitreich.org	70
i               (create-article article :tiny nil)	Err	bitreich.org	70
i               :title (concatenate 'string (getf *config* :title) " : " (getf article :title))))	Err	bitreich.org	70
i-	Err	bitreich.org	70
i+  	Err	bitreich.org	70
i   ;; produce index file for each tag	Err	bitreich.org	70
i   (loop for tag in (articles-by-tag) do	Err	bitreich.org	70
i-        (generate (format nil"tag-~d.html" (getf tag :NAME))	Err	bitreich.org	70
i+        (generate (format nil "output/html/tag-~d.html" (getf tag :NAME))	Err	bitreich.org	70
i                   (generate-tag-mainpage (getf tag :VALUE))))	Err	bitreich.org	70
i   	Err	bitreich.org	70
i   ;;(generate-file-rss)	Err	bitreich.org	70
i-  (save-file "rss.xml" (generate-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 gopher hole	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+             (let ((output (load-file "template/gopher_head.tpl")))	Err	bitreich.org	70
i+               (dolist (article *articles*)	Err	bitreich.org	70
i+                 (setf output	Err	bitreich.org	70
i+                       (concatenate 'string output	Err	bitreich.org	70
i+                                    (format nil "~a by ~a tagged (~a) ~%0~a        /article-~d.txt        ~a        ~a~%~%"	Err	bitreich.org	70
i+                                            (getf article :date)	Err	bitreich.org	70
i+                                            (getf article :author (getf *config* :webmaster))	Err	bitreich.org	70
i+                                            (getf article :tag)	Err	bitreich.org	70
i+                                            (getf article :title)	Err	bitreich.org	70
i+                                            (getf article :id)	Err	bitreich.org	70
i+                                            (getf *config* :gopher-server)	Err	bitreich.org	70
i+                                            (getf *config* :gopher-port)	Err	bitreich.org	70
i+                                            ))))	Err	bitreich.org	70
i+               output))	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+  (dolist (article *articles*)	Err	bitreich.org	70
i+    (let ((id (getf article :id)))	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.md" id)))))	Err	bitreich.org	70
i   	Err	bitreich.org	70
i   )	Err	bitreich.org	70
i 	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+;; ENGINE START !	Err	bitreich.org	70
i+;; This is function called when running the tool	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* :gopher)	Err	bitreich.org	70
i+      (create-gopher-hole)))	Err	bitreich.org	70
i+	Err	bitreich.org	70
i (generate-site)	Err	bitreich.org	70
i+	Err	bitreich.org	70
1diff --git a/template/gopher_head.tpl b/template/gopher_head.tpl	/scm/cl-yag/file/template/gopher_head.tpl.gph	bitreich.org	70
i@@ -0,0 +1,5 @@	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+ -----------------------------------------------------------------	Err	bitreich.org	70
i+	Err	bitreich.org	70
.
Response: text/plain
Original URLgopher://bitreich.org/0/scm/cl-yag/commit/b70cc28e578b4ce...
Content-Typetext/plain; charset=utf-8