Only generate html if the source is newer
This commit is contained in:
parent
4fd8a06766
commit
d4170d2472
|
@ -132,13 +132,26 @@
|
||||||
(let ((converter-object (getf *converters* converter-name)))
|
(let ((converter-object (getf *converters* converter-name)))
|
||||||
,@code))))
|
,@code))))
|
||||||
|
|
||||||
|
;; generate the html file from the source file
|
||||||
|
;; using the converter associated with the post
|
||||||
(defun use-converter-to-html(article)
|
(defun use-converter-to-html(article)
|
||||||
(with-converter
|
(with-converter
|
||||||
(let ((output (converter-command converter-object)))
|
(let ((output (converter-command converter-object)))
|
||||||
(ensure-directories-exist "temp/data/")
|
(let* ((src-file (format nil "~a~a" (article-id article) (converter-extension converter-object)))
|
||||||
(template "%IN" (concatenate 'string (article-id article) (converter-extension converter-object)))
|
(dst-file (format nil "temp/data/~a.html" (article-id article) ))
|
||||||
(template "%OUT" (concatenate 'string "temp/data/" (article-id article) ".html"))
|
(full-src-file (format nil "data/~a" src-file)))
|
||||||
(uiop:run-program output))))
|
;; 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
|
;; format the date
|
||||||
(defun date-format(format date)
|
(defun date-format(format date)
|
||||||
|
@ -342,5 +355,4 @@
|
||||||
|
|
||||||
(generate-site)
|
(generate-site)
|
||||||
|
|
||||||
|
|
||||||
(quit)
|
(quit)
|
||||||
|
|
Loading…
Reference in New Issue