diff options
author | Arun Isaac | 2019-09-02 01:27:32 +0530 |
---|---|---|
committer | Arun Isaac | 2019-09-02 01:27:32 +0530 |
commit | 202a7ca2b2f33ee95b0ecf2bd6d01859f6930580 (patch) | |
tree | 21c0d260952a7e2d4ac4e51f26d3c0d0c09e5306 | |
parent | 7f7583457b9f5eb4fcffac569ecbc0e80cd05bc5 (diff) | |
download | ennum-202a7ca2b2f33ee95b0ecf2bd6d01859f6930580.tar.gz ennum-202a7ca2b2f33ee95b0ecf2bd6d01859f6930580.tar.lz ennum-202a7ca2b2f33ee95b0ecf2bd6d01859f6930580.zip |
Publish posts and their translations together.
* ennu.el (ennu-publish-post): Publish posts and their translations
together in a single operation.
(ennu-publish): Invoke ennu-publish-post with all posts of a single
translation group.
-rw-r--r-- | ennu.el | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -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 |