about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2019-09-02 01:31:31 +0530
committerArun Isaac2019-09-02 01:31:31 +0530
commit1e1e485b082db622cea23fdaf33728a436ab8ccb (patch)
treef014de45f69d3d93329ef6db8a7f0b1cf1646709
parent202a7ca2b2f33ee95b0ecf2bd6d01859f6930580 (diff)
downloadennum-1e1e485b082db622cea23fdaf33728a436ab8ccb.tar.gz
ennum-1e1e485b082db622cea23fdaf33728a436ab8ccb.tar.lz
ennum-1e1e485b082db622cea23fdaf33728a436ab8ccb.zip
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.
-rw-r--r--ennu.el42
1 files changed, 22 insertions, 20 deletions
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)))