summaryrefslogtreecommitdiff
path: root/ennu.el
diff options
context:
space:
mode:
Diffstat (limited to 'ennu.el')
-rw-r--r--ennu.el35
1 files changed, 18 insertions, 17 deletions
diff --git a/ennu.el b/ennu.el
index 3eadc82..977771c 100644
--- a/ennu.el
+++ b/ennu.el
@@ -120,16 +120,20 @@ last form in BODY."
output-files)))
link-publish-operations)))
-(defun ennu-publish-page (pages-directory page)
+(defun ennu-publish-generic (other-files-directory file)
(ennu-make-operation
- :inputs (list page)
- :outputs (list (ennu--org-output-filename
- (string-remove-prefix
- (file-name-as-directory pages-directory)
- page)))
+ :inputs (list file)
+ :outputs
+ (list (string-remove-prefix
+ (file-name-as-directory other-files-directory)
+ (pcase (file-name-extension file)
+ ("org" (ennu--org-output-filename file))
+ (_ file))))
:publish (lambda (output-file)
- (ennu-with-file-contents page
- (org-export-to-file 'html output-file)))))
+ (pcase (file-name-extension file)
+ ("org" (ennu-with-file-contents file
+ (org-export-to-file 'html output-file)))
+ (_ (ennu-copy file output-file))))))
(defun ennu-video-poster (video)
(pcase (directory-files (ennu-setting :images-directory) nil
@@ -280,7 +284,7 @@ last form in BODY."
:working-directory)
(or (plist-get ennu-blog property)
(user-error "Property %s not defined" property)))
- ((or :pages-directory :unattached-static-files)
+ (:other-files-directory
(plist-get ennu-blog property))
(_ (error "Unknown property %s" property))))
@@ -449,16 +453,13 @@ as keys. Keys are compared using `equal'."
(apply-partially 'ennu-publish-image (list (ennu-setting :thumbnail-image-width)))
(seq-map (lambda (image)
(ennu--expand-relative image (ennu-setting :images-directory)))
- (seq-uniq (seq-filter 'identity (seq-map 'ennu-post-thumbnail posts)))))))
- ;; Publish pages
- (when-let ((pages-directory (ennu-setting :pages-directory)))
- (seq-map (apply-partially 'ennu-publish-page pages-directory)
+ (seq-uniq (ennu--filter-map 'ennu-post-thumbnail posts))))))
+ ;; Publish other files
+ (when-let ((other-files-directory (ennu-setting :other-files-directory)))
+ (seq-map (apply-partially 'ennu-publish-generic other-files-directory)
(seq-map (apply-partially 'string-remove-prefix
(file-name-as-directory (expand-file-name default-directory)))
- (directory-files-recursively pages-directory "\\.org$"))))
- ;; Publish unattached static files
- (seq-map 'ennu-publish-static-file
- (ennu-setting :unattached-static-files))))
+ (directory-files-recursively other-files-directory "."))))))
;; Replace old output directory
(let ((output (ennu-setting :output-directory)))
(delete-directory output t)