aboutsummaryrefslogtreecommitdiff
path: root/ennu.el
diff options
context:
space:
mode:
Diffstat (limited to 'ennu.el')
-rw-r--r--ennu.el26
1 files changed, 18 insertions, 8 deletions
diff --git a/ennu.el b/ennu.el
index 5a72979..ccbe8ae 100644
--- a/ennu.el
+++ b/ennu.el
@@ -87,7 +87,7 @@ last form in BODY."
(defun ennu--org-output-filename (filename)
(concat (file-name-sans-extension filename) ".html"))
-(defun ennu-publish-post (post)
+(defun ennu-publish-post (posts)
;; TODO: Tangle post
;; (when-let (tangle-dir (or (plist-get posts-plist :valai-tangle-directory)
;; valai-tangle-directory))
@@ -100,12 +100,20 @@ last form in BODY."
;; (expand-file-name (file-name-nondirectory tangled-file)
;; tangle-dir)
;; t)))
- (ennu-make-operation
- :inputs (list (ennu-post-filename post))
- :outputs (list (ennu--org-output-filename (ennu-post-filename post)))
- :publish (lambda (output-file)
- (ennu-with-file-contents (ennu-post-filename post)
- (org-export-to-file 'ennu-html output-file)))))
+ (let ((input-post-files (seq-map 'ennu-post-filename posts)))
+ (ennu-make-operation
+ :inputs input-post-files
+ :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)))))
(defun ennu-publish-page (pages-directory page)
(ennu-make-operation
@@ -409,7 +417,9 @@ as keys. Keys are compared using `equal'."
(let ((posts (ennu-posts (ennu-setting :posts-directory))))
(append
;; Publish posts
- (seq-map 'ennu-publish-post posts)
+ (seq-map (pcase-lambda (`(,translation-group . ,posts))
+ (ennu-publish-post posts))
+ (seq-group-by 'ennu-post-translation-group posts))
;; Publish feed
(list (ennu-publish-feed (ennu-setting :atom-feed-file)
blog-title