iadd documentation about hacking - 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 c31fd9ad38a23797997e15af455ddd1c89c7db1f /scm/cl-yag/commit/c31fd9ad38a23797997e15af455ddd1c89c7db1f.gph bitreich.org 70 1parent 2c4804f37255ff1359dcadc138a713684f9b8898 /scm/cl-yag/commit/2c4804f37255ff1359dcadc138a713684f9b8898.gph bitreich.org 70 hAuthor: Solene Rapenne URL:mailto:solene@dataswamp.org bitreich.org 70 iDate: Sat, 30 Apr 2016 18:12:55 +0200 Err bitreich.org 70 i Err bitreich.org 70 iadd documentation about hacking Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M README.md | 43 +++++++++++++++++++++---------- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 29 insertions(+), 14 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/README.md b/README.md /scm/cl-yag/file/README.md.gph bitreich.org 70 i@@ -1,18 +1,14 @@ Err bitreich.org 70 i # Introduction Err bitreich.org 70 i Err bitreich.org 70 i- Err bitreich.org 70 i-This blog is generated using cl-yag. It 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. Err bitreich.org 70 i Err bitreich.org 70 i It has only one dependency : a common lisp interpreter, I recommend both sbcl or clisp which are free, open-source and multi-platform. Err bitreich.org 70 i Err bitreich.org 70 i Err bitreich.org 70 i # The hierarchy Err bitreich.org 70 i Err bitreich.org 70 i+Here are the files and folder of cl-yag : Err bitreich.org 70 i Err bitreich.org 70 i-Here are the files and folder you can find in your project folder : Err bitreich.org 70 i- Err bitreich.org 70 i- Err bitreich.org 70 i- Err bitreich.org 70 i + **Makefile** : exists to simplify your life (updating, cleaning) Err bitreich.org 70 i + **generator.lisp** : contains all the code of the generator Err bitreich.org 70 i + **templates/** : contains .tpl files which are used as template for the html structure Err bitreich.org 70 i@@ -20,7 +16,7 @@ Here are the files and folder you can find in your project folder : Err bitreich.org 70 i + **data/** : contains what will make the content of your website different from another website (or not) Err bitreich.org 70 i + **articles.lisp** : contains metadata about the website and the list of the articles with their id/title/date/(author/short description) (aren't 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** : this is where the websites goes when your run *make*, and where it's cleaned when you run *make clean*; Err bitreich.org 70 i++ **output** : this is where the websites goes when your run *make*, and where it's cleaned when you run *make clean*; You can make it a symbolic link to the web server folder. Err bitreich.org 70 i Err bitreich.org 70 i Err bitreich.org 70 i # How to add an article Err bitreich.org 70 i@@ -34,18 +30,37 @@ The _:short_ field is used on the homepage. It it is defined, this is the text t Err bitreich.org 70 i Err bitreich.org 70 i The _:author_ field is used to display who wrote the article. You can omitt it, the generator will take the name from the *config* variable Err bitreich.org 70 i Err bitreich.org 70 i+# How to hack it Err bitreich.org 70 i+ Err bitreich.org 70 i+I tried to make it "hacking friendly" so it's very extensible. Err bitreich.org 70 i+ Err bitreich.org 70 i+## Include a template page in the layout Err bitreich.org 70 i+ Err bitreich.org 70 i+Here is an example code if you want to add something like a panel on the layout. Err bitreich.org 70 i+ Err bitreich.org 70 i++ Add a string for the replacement to occure, like %%Panel%% in **template/layout.tpl** (because we want the panel on every page) Err bitreich.org 70 i++ In **generator.lisp** modify the function *generate-layout* to add "**(template "%%Panel%%" (slurp-file "template/panel.tpl"))**" after one template function call Err bitreich.org 70 i++ Create **template/panel.tpl** with the html Err bitreich.org 70 i+ Err bitreich.org 70 i+## Add a new specific page Err bitreich.org 70 i+ Err bitreich.org 70 i+You may want to have some dedicated page for some reason, reusing the website layout, which is not the index nor an article. Err bitreich.org 70 i+ Err bitreich.org 70 i+In **generate-site** function we can load a file, apply the template and save it in the output. It may look like this Err bitreich.org 70 i+ Err bitreich.org 70 i+ (generate "somepage.html" (slurp-file "data/mypage.html")) 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- Err bitreich.org 70 i- Err bitreich.org 70 i- Err bitreich.org 70 i-1. edit the article file with emacs using ham-mode (which is html) 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 to html inside) Err bitreich.org 70 i-4. *make* to update your site 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 do not do it natively because I do not want it to have dependencies. You can use what you want to produces the html files. 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 .