aboutsummaryrefslogtreecommitdiff
path: root/ennu.el
diff options
context:
space:
mode:
authorArun Isaac2019-09-02 23:02:20 +0530
committerArun Isaac2019-09-02 23:02:20 +0530
commit1d4816ac660583adf86c18e57694caa5501b00c2 (patch)
tree50d78f294f857329749282e8711b27301544899a /ennu.el
parent2d02cb5655718ffa1737c7f4b87d7702d31affdb (diff)
downloadennum-1d4816ac660583adf86c18e57694caa5501b00c2.tar.gz
ennum-1d4816ac660583adf86c18e57694caa5501b00c2.tar.lz
ennum-1d4816ac660583adf86c18e57694caa5501b00c2.zip
Tangle posts.
* ennu.el (ennu-publish-post): Tangle posts if they have src blocks marked for tangling.
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)