Recently Written · git

recentlywritten

my writings (done recently)

git clone https://github.com/equwal/recentlywritten

Log | Files | Refs


git/cl-yag/commit/a8dfa314e9911295a3c52318d4702e4761093e2f.html (4729 bytes)

1 <!DOCTYPE html>
2 <html lang="en"><head><meta charset="UTF-8" />
3 <meta name="viewport" content="width=device-width, initial-scale=1" />
4 <title>cl-yag a8dfa314 - Recently Written</title>
5 <link rel="stylesheet" href="../../stagit.css" />
6 </head><body>
7 <div id="top"><a href="../../../index.html">Recently Written</a> &middot; <a href="../../index.html">git</a></div>
8 <h1>cl-yag</h1><span class="desc">Mirror and rewrite of Solène Rapenne&#x27;s cl-yag SSG of renown</span><p class="url">git clone https://github.com/equwal/cl-yag</p><p><a href="../../cl-yag/index.html">Log</a> | <a href="../../cl-yag/files.html">Files</a> | <a href="../../cl-yag/refs.html">Refs</a></p><hr/>
9 <div id="content">
10 <pre>commit a8dfa314e9911295a3c52318d4702e4761093e2f
11 Solene Rapenne &lt;solene@perso.pw&gt;
12 2019-08-27 09:10:20 +0200
13 
14 Add support for differents converters
15 
16 </pre><pre> generator.lisp | 45 ++++++++++++++++++++++++---------------------
17  1 file changed, 24 insertions(+), 21 deletions(-)
18 </pre><pre>diff --git a/generator.lisp b/generator.lisp
19 index ca01c36..eb483aa 100644
20 --- a/generator.lisp
21 +++ b/generator.lisp
22 <span class="h">@@ -129,24 +129,27 @@</span>
23  
24  ;; generate the html file from the source file
25  ;; using the converter associated with the post
26 <span class="d">-(defun use-converter-to-html(article)</span>
27 <span class="d">-  (with-converter</span>
28 <span class="d">-   (let ((output (converter-command converter-object)))</span>
29 <span class="d">-     (let* ((src-file (format nil &quot;~a~a&quot; (article-id article) (converter-extension converter-object)))</span>
30 <span class="d">-	   (dst-file (format nil &quot;temp/data/~a.html&quot; (article-id article) ))</span>
31 <span class="d">-	   (full-src-file (format nil &quot;data/~a&quot; src-file)))</span>
32 <span class="d">-       ;; skip generating if the destination exists</span>
33 <span class="d">-       ;; and is more recent than source</span>
34 <span class="d">-       (unless (and</span>
35 <span class="d">-		(probe-file dst-file)</span>
36 <span class="d">-		(&gt;=</span>
37 <span class="d">-		 (file-write-date dst-file)</span>
38 <span class="d">-		 (file-write-date full-src-file)))</span>
39 <span class="d">-	 (ensure-directories-exist &quot;temp/data/&quot;)</span>
40 <span class="d">-	 (template &quot;%IN&quot; src-file)</span>
41 <span class="d">-	 (template &quot;%OUT&quot; dst-file)</span>
42 <span class="d">-	 (format t &quot;~a~%&quot; output)</span>
43 <span class="d">-	 (uiop:run-program output))))))</span>
44 <span class="a">+(defun use-converter-to-html(filename &amp;optional (converter-name nil))</span>
45 <span class="a">+  (let* ((converter-object (getf *converters*</span>
46 <span class="a">+                                 (or converter-name</span>
47 <span class="a">+			             converter-name</span>
48 <span class="a">+			             (getf *config* :default-converter))))</span>
49 <span class="a">+         (output           (converter-command converter-object))</span>
50 <span class="a">+         (src-file (format nil &quot;~a~a&quot; filename (converter-extension converter-object)))</span>
51 <span class="a">+         (dst-file (format nil &quot;temp/data/~a.html&quot; filename ))</span>
52 <span class="a">+         (full-src-file (format nil &quot;data/~a&quot; src-file)))</span>
53 <span class="a">+      ;; skip generating if the destination exists</span>
54 <span class="a">+      ;; and is more recent than source</span>
55 <span class="a">+      (unless (and</span>
56 <span class="a">+               (probe-file dst-file)</span>
57 <span class="a">+               (&gt;=</span>
58 <span class="a">+                (file-write-date dst-file)</span>
59 <span class="a">+                (file-write-date full-src-file)))</span>
60 <span class="a">+        (ensure-directories-exist &quot;temp/data/&quot;)</span>
61 <span class="a">+        (template &quot;%IN&quot; src-file)</span>
62 <span class="a">+        (template &quot;%OUT&quot; dst-file)</span>
63 <span class="a">+        (format t &quot;~a~%&quot; output)</span>
64 <span class="a">+        (uiop:run-program output))))</span>
65  
66  ;; format the date
67  (defun date-format(format date)
68 <span class="h">@@ -307,9 +310,9 @@</span>
69  
70    ;; produce each article file
71    (loop for article in *articles*
72 <span class="d">-	do</span>
73 <span class="d">-	;; use the article&#x27;s converter to get html code of it</span>
74 <span class="d">-	(use-converter-to-html article)</span>
75 <span class="a">+     do</span>
76 <span class="a">+     ;; use the article&#x27;s converter to get html code of it</span>
77 <span class="a">+       (use-converter-to-html (article-id article) (article-converter article))</span>
78  
79  	(generate  (format nil &quot;output/html/~d-~d.html&quot;
80  			   (date-format &quot;%Year-%MonthNumber-%DayNumber&quot;</pre>
81 </div></body></html>