From 81cb2f254ad8b0e19088b51908d3469cec99fc3e Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 17 Aug 2022 00:21:24 +0530 Subject: Pass tongue argument to ennum-publish-index. Pass tongue argument to ennum-publish-index and ennum-publish-index-page instead of letting them discover it themselves. * ennum.el (ennum-publish): Pass tongue argument to ennum-publish-index. (ennum-publish-index): Accept tongue argument. Pass tongue argument to ennum-publish-index-page. (ennum-publish-index-page): Accept tongue argument. --- ennum.el | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'ennum.el') diff --git a/ennum.el b/ennum.el index 7e75dc5..c0556d2 100644 --- a/ennum.el +++ b/ennum.el @@ -422,11 +422,10 @@ result as a string." (concat filename-prefix extension)) tongue))) -(defun ennum-publish-index-page (filename-prefix title last-page posts page-number output-file) +(defun ennum-publish-index-page (filename-prefix title last-page posts page-number tongue output-file) (ennum-exp - (let* ((tongue (ennum-post-language (first posts))) - (system-time-locale - (map-elt (ennum-setting :locale-alist) tongue))) + (let ((system-time-locale + (map-elt (ennum-setting :locale-alist) tongue))) (when (file-name-directory output-file) (ennum-mkdir-p (file-name-directory output-file))) (with-temp-buffer @@ -468,9 +467,8 @@ result as a string." (ennum-index-filename filename-prefix tongue "html" 1)) (ennum-add-tongue-suffix (format "%s.html" filename-prefix) tongue)))) -(defun ennum-publish-index (filename-prefix title posts-per-page posts) - (let* ((tongue (ennum-post-language (first posts))) - (number-of-pages (ceiling (length posts) posts-per-page)) +(defun ennum-publish-index (filename-prefix title posts-per-page tongue posts) + (let* ((number-of-pages (ceiling (length posts) posts-per-page)) (page-numbers (number-sequence 1 number-of-pages)) (output-files (seq-map (apply-partially 'ennum-index-filename filename-prefix tongue "html") @@ -479,7 +477,7 @@ result as a string." (ennum-publish-index-page filename-prefix title (= page-number number-of-pages) - post page-number output-file)) + post page-number tongue output-file)) (seq-partition posts posts-per-page) page-numbers output-files))) @@ -709,7 +707,7 @@ as keys. Keys are compared using `equal'." ;; Publish indices (seq-mapcat (pcase-lambda (`(,tongue . ,posts)) - (ennum-publish-index "index" blog-title posts-per-page posts)) + (ennum-publish-index "index" blog-title posts-per-page tongue posts)) (seq-group-by 'ennum-post-language posts)) ;; Publish tag indices (seq-mapcat @@ -718,7 +716,7 @@ as keys. Keys are compared using `equal'." (pcase-lambda (`(,tongue . ,posts)) (ennum-publish-index (ennum--file-join (ennum-setting :tag-directory) tag) - tag posts-per-page posts)) + tag posts-per-page tongue posts)) (seq-group-by 'ennum-post-language posts))) (ennum-many-to-many-group-by 'ennum-post-tags posts)) ;; Publish thumbnails -- cgit v1.2.3