~data/articles.lisp Improve readability. - cl-yag - Common Lisp Yet Another web… | |
git clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit 1c586b79e894959621e9c618a18974c2f34fa5d5 | |
parent e2d4f830fa5c7fa15180caa3f3bd58ed8c4c9dfc | |
Author: lambda <[email protected]> | |
Date: Wed, 22 Nov 2017 16:26:49 +0100 | |
~data/articles.lisp Improve readability. | |
+data/README.md | |
Cover the old lisp-application tradition and make cl-yag | |
self-documenting in another way: By displaying it's own README as a pos… | |
-data/2.md | |
Remove data/2.md | |
Use README as another example-entry: | |
Status of this commit: Suggestion | |
Diffstat: | |
D data/2.md | 1 - | |
A data/README.md | 108 +++++++++++++++++++++++++++++… | |
M data/articles.lisp | 49 ++++++++++++++++++-----------… | |
3 files changed, 137 insertions(+), 21 deletions(-) | |
--- | |
diff --git a/data/2.md b/data/2.md | |
@@ -1 +0,0 @@ | |
-**hello in bold** | |
diff --git a/data/README.md b/data/README.md | |
@@ -0,0 +1,108 @@ | |
+# Introduction | |
+ | |
+cl-yag stands for Common Lisp Yet Another Generator and obviously it's written… | |
+ | |
+**It needs a Common Lisp interpreter and a markdown-to-html export tool (like … | |
+It is regularly tested with sbcl, clisp and ecl which are free, open-source an… | |
+ | |
+**This comes with a minimalistic template**, don't expect something good looki… | |
+ | |
+As a "demo", there is [my website](https://dataswamp.org/~solene/) using cl-ya… | |
+ | |
+## The hierarchy | |
+ | |
+Here are the files and folder of cl-yag : | |
+ | |
++ **Makefile** : exists to simplify your life (updating, cleaning) | |
++ **generator.lisp** : contains all the code of the generator | |
++ **templates/** : contains .tpl files which are used as template for the html… | |
++ **static/** : contains the static files like images, css, js etc... that wil… | |
++ **data/** : | |
+ + **articles.lisp** : contains metadata about the website and the list of th… | |
+ + **${id}.md** : contains the article using markdown syntax that will be use… | |
++ **output/** : | |
+ + **gopher/** : contains the exported website for gopher | |
+ + **html/** : contains the exported website in html | |
+ | |
+# Usage | |
+ | |
+## Configuration | |
+ | |
+In data/articles.lisp there is a ***config*** variable with the following fiel… | |
+ | |
++ **:webmaster** : The name of the default author, this is the name used when … | |
++ **:title** : The title of the webpage | |
++ **:description** : This text is used in the *description* field of the Atom … | |
++ **:url** : This is the full url of the blog with the final slash. If the url… | |
++ **:rss-item-number** : This is the number of RSS items you want to published… | |
++ **html** : t to export html website / nil to disable | |
++ **gopher** : t to export gopher website / nil to disable | |
++ **gopher-path** : this is the full path of the directory to access your goph… | |
++ **gopher-server**: hostname of the gopher server because gopher doesn't have… | |
++ **gopher-port** : tcp port of the gopher server, 70 is the default port, it'… | |
+ | |
+## How to add an article | |
+ | |
+Edit data/articles.lisp and add a new line inside the *articles* variable like… | |
+ | |
+ (list :title "How do I use cl-yag" | |
+ :id "2" :date "29 April 2016" | |
+ :author "Solène" | |
+ :short "I will explain how to use the generator" | |
+ :tag "example help code") | |
+ | |
+The _:short_ field is used on the homepage. It it is defined, this is the text… | |
+ | |
+The _:id_ field will be part of the filename of the file and it's also the nam… | |
+ | |
+The _:author_ field is used to display who wrote the article. You can omitt it… | |
+ | |
+The _:tag_ field is used to create a page with all the articles with the same … | |
+ | |
+## How to publish | |
+ | |
+There is a makefile, all you need to do is to type "make" in the folder, this … | |
+ | |
+**/!\ Linux users /!\ ** you should use **bmake** (bsd make) because the Make… | |
+ | |
+If you want to use a different lisp interpreter (default is **sbcl**), you can… | |
+ | |
+Example with clisp : | |
+ | |
+`make LISP=clisp` | |
+ | |
+This way, you can easily use a git hook to type make after each change in the … | |
+ | |
+# Some hacks you can do | |
+ | |
+I tried to make it "hacking friendly", you can extend if easily. If you have a… | |
+ | |
+## Include some file in the template | |
+ | |
+Here is an example code if you want to include a page in the template | |
+ | |
++ Add a string for the replacement to occure, like %%Panel%% in **template/lay… | |
++ In **generator.lisp** modify the function *generate-layout* to add "**(templ… | |
++ Create **template/panel.tpl** with the html | |
+ | |
+(note : you can also directly add your text inside the layout template file in… | |
+ | |
+## Add a new specific page | |
+ | |
+You may want to have some dedicated page for some reason, reusing the website … | |
+ | |
+In **generate-site** function we can load a file, apply the template and save … | |
+ | |
+ (generate "somepage.html" (load-file "data/mypage.html")) | |
+ | |
+This will produce the file **somepage.html** in the output folder. | |
+ | |
+# Known limitations | |
+ | |
+## Use of ~ character | |
+ | |
+The application will crash if you use a single "**~**" caracter inside one dat… | |
+ | |
+## Article without tag | |
+ | |
+You can have a page without a tag associated but in the default template you w… | |
diff --git a/data/articles.lisp b/data/articles.lisp | |
@@ -1,30 +1,39 @@ | |
-;; WARNING caracter "~" must be escaped when used in this file | |
-;; you have to type ~~ for one ~ to escape it | |
+;; MIND: The tilde character "~" must be escaped like this '~~' to use it as a… | |
-;; define informations about your blog | |
-;; used for the RSS generation and some variables replacements in the layout | |
+;; Define Your Webpage | |
+ | |
(defvar *config* | |
(list | |
- :webmaster "Your author name here" | |
- :title "Your blog title here" | |
- :description "Yet another website on the net" | |
- :url "https://my.website/~~user/" ;; the trailing slash is mandatory, rss l… | |
- :rss-item-number 10 ;; we want 10 items in our RSS feed | |
- :html t ;; t to export html website / nil to disable | |
- :gopher t ;; t to export gopher website / nil to disable | |
- :gopher-path "/user" ;; the absolute path of your gopher directory | |
- :gopher-server "my.website" ;; hostname of the gopher server | |
- :gopher-port "70" ;; tcp port of the gopher server, 70 usually | |
+ :webmaster "Your autor name here" | |
+ :title "Put youre website's title here." | |
+ :description "Yet another website on the net" | |
+ :url "https://my.website/~~user/" ;; the trailing slash is … | |
+ :rss-item-number 10 ;; limit total amount of … | |
+ :html t ;; 't' to enable export t… | |
+ :gopher t ;; 't' to enable export t… | |
+ :gopher-path "/user" ;; absolute path of your … | |
+ :gopher-server "my.website" ;; hostname of the gopher… | |
+ :gopher-port "70" ;; tcp port of the gopher… | |
)) | |
-;; describes articles (ordered on the website as they are displayed here, the … | |
-;; exemple => (list :id "4" :date "2015-05-04" :title "The article title" :aut… | |
-;; :author can be omitted and will be replaced by webmaster value | |
-;; :tiny can be omitted and will be replaced by the full article text | |
+ | |
+ | |
+ | |
+ | |
+;; Define your articles and their display-order on the website in *articles* b… | |
+;; Display Order is 'lifo', i.e. the top entry in this list gets displayed as … | |
+;; | |
+;; An Example Of A Minimal Definition: | |
+;; (list :id "4" :date "2015-05-04" :title "The article title" :author "Me" :t… | |
+;; | |
+;; A Note On Keywords: | |
+;; :author can be omitted. If so, it's value gets replaced by the value of … | |
+;; :tiny can be omitted. If so, the article's full text gets displayed on… | |
+ | |
(defvar *articles* | |
(list | |
- (list :id "2" :date "30 April 2016" :tag "lisp" :title "Another message" :s… | |
- (list :id "1" :date "29 April 2016":tag "pony code" :title "My first messag… | |
+ (list :id "README" :date "20 May 2016" :tag "cl-yag" :title "README" :autho… | |
+ (list :id "1" :date "29 April 2016":tag "pony code" :title "My first messag… | |
)) | |