From 1e1e485b082db622cea23fdaf33728a436ab8ccb Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 2 Sep 2019 01:31:31 +0530 Subject: Publish links together with posts. * ennu.el (ennu-publish-post): Publish links together with posts and return a list of operations. (ennu-publish): Concatenate the lists of operations returned from ennu-publish-post. Do not invoke ennu-publish-link to publish links. --- ennu.el | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) (limited to 'ennu.el') diff --git a/ennu.el b/ennu.el index ccbe8ae..3eadc82 100644 --- a/ennu.el +++ b/ennu.el @@ -100,20 +100,25 @@ last form in BODY." ;; (expand-file-name (file-name-nondirectory tangled-file) ;; tangle-dir) ;; t))) - (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))))) + (let ((link-publish-operations + (seq-map '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))) + link-publish-operations))) (defun ennu-publish-page (pages-directory page) (ennu-make-operation @@ -417,9 +422,9 @@ as keys. Keys are compared using `equal'." (let ((posts (ennu-posts (ennu-setting :posts-directory)))) (append ;; Publish posts - (seq-map (pcase-lambda (`(,translation-group . ,posts)) - (ennu-publish-post posts)) - (seq-group-by 'ennu-post-translation-group posts)) + (seq-mapcat (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 @@ -439,9 +444,6 @@ as keys. Keys are compared using `equal'." tag posts-per-page posts)) (seq-group-by 'ennu-post-language posts))) (ennu-many-to-many-group-by 'ennu-post-tags posts)) - ;; Publish links - (seq-map 'ennu-publish-link - (seq-uniq (seq-mapcat 'ennu-post-links posts))) ;; Publish thumbnails (seq-map (apply-partially 'ennu-publish-image (list (ennu-setting :thumbnail-image-width))) -- cgit v1.2.3