iOnly generate html if the source is newer - 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 d4170d2472d54844ce90cf4e2e68eb816f8d8bab /scm/cl-yag/commit/d4170d2472d54844ce90cf4e2e68eb816f8d8bab.gph bitreich.org 70 1parent 4fd8a06766051afce42b6eeec8f182ccb36b87f3 /scm/cl-yag/commit/4fd8a06766051afce42b6eeec8f182ccb36b87f3.gph bitreich.org 70 hAuthor: solene rapenne URL:mailto:solene@dataswamp.org bitreich.org 70 iDate: Sun, 17 Dec 2017 02:56:47 +0100 Err bitreich.org 70 i Err bitreich.org 70 iOnly generate html if the source is newer Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M generator.lisp | 22 +++++++++++++++++----- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 17 insertions(+), 5 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/generator.lisp b/generator.lisp /scm/cl-yag/file/generator.lisp.gph bitreich.org 70 i@@ -132,13 +132,26 @@ Err bitreich.org 70 i (let ((converter-object (getf *converters* converter-name))) Err bitreich.org 70 i ,@code)))) Err bitreich.org 70 i Err bitreich.org 70 i+;; generate the html file from the source file Err bitreich.org 70 i+;; using the converter associated with the post Err bitreich.org 70 i (defun use-converter-to-html(article) Err bitreich.org 70 i (with-converter Err bitreich.org 70 i (let ((output (converter-command converter-object))) Err bitreich.org 70 i- (ensure-directories-exist "temp/data/") Err bitreich.org 70 i- (template "%IN" (concatenate 'string (article-id article) (converter-extension converter-object))) Err bitreich.org 70 i- (template "%OUT" (concatenate 'string "temp/data/" (article-id article) ".html")) Err bitreich.org 70 i- (uiop:run-program output)))) Err bitreich.org 70 i+ (let* ((src-file (format nil "~a~a" (article-id article) (converter-extension converter-object))) Err bitreich.org 70 i+ (dst-file (format nil "temp/data/~a.html" (article-id article) )) Err bitreich.org 70 i+ (full-src-file (format nil "data/~a" src-file))) Err bitreich.org 70 i+ ;; skip generating if the destination exists Err bitreich.org 70 i+ ;; and is more recent than source Err bitreich.org 70 i+ (unless (and Err bitreich.org 70 i+ (probe-file dst-file) Err bitreich.org 70 i+ (>= Err bitreich.org 70 i+ (file-write-date dst-file) Err bitreich.org 70 i+ (file-write-date full-src-file))) Err bitreich.org 70 i+ (ensure-directories-exist "temp/data/") Err bitreich.org 70 i+ (template "%IN" src-file) Err bitreich.org 70 i+ (template "%OUT" dst-file) Err bitreich.org 70 i+ (format t "~a~%" output) Err bitreich.org 70 i+ (uiop:run-program output)))))) Err bitreich.org 70 i Err bitreich.org 70 i ;; format the date Err bitreich.org 70 i (defun date-format(format date) Err bitreich.org 70 i@@ -342,5 +355,4 @@ Err bitreich.org 70 i Err bitreich.org 70 i (generate-site) Err bitreich.org 70 i Err bitreich.org 70 i- Err bitreich.org 70 i (quit) Err bitreich.org 70 .