summaryrefslogtreecommitdiff
path: root/ennu.el
diff options
context:
space:
mode:
Diffstat (limited to 'ennu.el')
-rw-r--r--ennu.el57
1 files changed, 30 insertions, 27 deletions
diff --git a/ennu.el b/ennu.el
index a8ac483..46b3f42 100644
--- a/ennu.el
+++ b/ennu.el
@@ -99,36 +99,39 @@ last form in BODY."
(concat (file-name-sans-extension filename) ".html"))
(defun ennu-publish-post (posts)
- ;; TODO: Tangle post
- ;; (when-let (tangle-dir (or (plist-get posts-plist :valai-tangle-directory)
- ;; valai-tangle-directory))
- ;; (dolist (tangled-file
- ;; (org-babel-tangle-file post-path))
- ;; (when (member (file-name-extension tangled-file) '("sh" "py"))
- ;; (chmod tangled-file (string-to-number "755" 8)))
- ;; (make-directory tangle-dir t)
- ;; (rename-file tangled-file
- ;; (expand-file-name (file-name-nondirectory tangled-file)
- ;; tangle-dir)
- ;; t)))
(let ((link-publish-operations
(seq-mapcat 'ennu-publish-link (seq-mapcat 'ennu-post-links posts)))
(input-post-files (seq-map 'ennu-post-filename posts)))
- (cons
- (ennu-make-operation
- :inputs (append input-post-files
- (seq-mapcat 'ennu-operation-inputs link-publish-operations))
- :outputs (seq-map 'ennu--org-output-filename input-post-files)
- :publish
- (lambda (&rest output-files)
- (seq-mapn
- (lambda (post output-file)
- (ennu-with-file-contents (ennu-post-filename post)
- (org-export-to-file
- 'ennu-html output-file nil nil nil nil
- (list :translations (seq-remove (apply-partially 'equal post) posts)))))
- posts
- output-files)))
+ (append
+ (list
+ (ennu-make-operation
+ :inputs (append input-post-files
+ (seq-mapcat 'ennu-operation-inputs link-publish-operations))
+ :outputs (seq-map 'ennu--org-output-filename input-post-files)
+ :publish
+ (lambda (&rest output-files)
+ (seq-mapn
+ (lambda (post output-file)
+ (ennu-with-file-contents (ennu-post-filename post)
+ (org-export-to-file
+ 'ennu-html output-file nil nil nil nil
+ (list :translations (seq-remove (apply-partially 'equal post) posts)))))
+ posts
+ output-files))))
+ (ennu--filter-map
+ (lambda (post)
+ (when (ennu-post-tangle post)
+ (ennu-make-operation
+ :inputs (list (ennu-post-filename post))
+ :outputs (seq-map (lambda (tangle-output)
+ (ennu--expand-relative tangle-output
+ (ennu-setting :static-directory)))
+ (ennu-post-tangle post))
+ :publish (lambda (&rest output-files)
+ (org-babel-tangle-publish
+ nil (ennu-post-filename post)
+ (file-name-directory (first output-files)))))))
+ posts)
link-publish-operations)))
(defun ennu-publish-generic (other-files-directory file)