Introduction
Introduction Statistics Contact Development Disclaimer Help
Add support for differents converters - cl-yag - Common Lisp Yet Another websit…
git clone git://bitreich.org/cl-yag/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws…
Log
Files
Refs
Tags
README
LICENSE
---
commit a8dfa314e9911295a3c52318d4702e4761093e2f
parent 5e3abb608d7259d1c4acdd5be13a711fe4b49160
Author: Solene Rapenne <[email protected]>
Date: Tue, 27 Aug 2019 09:10:20 +0200
Add support for differents converters
Diffstat:
M generator.lisp | 45 +++++++++++++++++------------…
1 file changed, 24 insertions(+), 21 deletions(-)
---
diff --git a/generator.lisp b/generator.lisp
@@ -129,24 +129,27 @@
;; generate the html file from the source file
;; using the converter associated with the post
-(defun use-converter-to-html(article)
- (with-converter
- (let ((output (converter-command converter-object)))
- (let* ((src-file (format nil "~a~a" (article-id article) (converter-exten…
- (dst-file (format nil "temp/data/~a.html" (article-id article) ))
- (full-src-file (format nil "data/~a" src-file)))
- ;; skip generating if the destination exists
- ;; and is more recent than source
- (unless (and
- (probe-file dst-file)
- (>=
- (file-write-date dst-file)
- (file-write-date full-src-file)))
- (ensure-directories-exist "temp/data/")
- (template "%IN" src-file)
- (template "%OUT" dst-file)
- (format t "~a~%" output)
- (uiop:run-program output))))))
+(defun use-converter-to-html(filename &optional (converter-name nil))
+ (let* ((converter-object (getf *converters*
+ (or converter-name
+ converter-name
+ (getf *config* :default-converter))))
+ (output (converter-command converter-object))
+ (src-file (format nil "~a~a" filename (converter-extension converter-…
+ (dst-file (format nil "temp/data/~a.html" filename ))
+ (full-src-file (format nil "data/~a" src-file)))
+ ;; skip generating if the destination exists
+ ;; and is more recent than source
+ (unless (and
+ (probe-file dst-file)
+ (>=
+ (file-write-date dst-file)
+ (file-write-date full-src-file)))
+ (ensure-directories-exist "temp/data/")
+ (template "%IN" src-file)
+ (template "%OUT" dst-file)
+ (format t "~a~%" output)
+ (uiop:run-program output))))
;; format the date
(defun date-format(format date)
@@ -307,9 +310,9 @@
;; produce each article file
(loop for article in *articles*
- do
- ;; use the article's converter to get html code of it
- (use-converter-to-html article)
+ do
+ ;; use the article's converter to get html code of it
+ (use-converter-to-html (article-id article) (article-converter article))
(generate (format nil "output/html/~d-~d.html"
(date-format "%Year-%MonthNumber-%DayNumber"
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.