From 819271eee5eb512309c3020da949b73016f26cd2 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 27 Aug 2019 13:25:34 +0530 Subject: Infer index language from posts. * ennu.el (ennu-publish-index): Infer language from posts. (ennu-publish): Do not pass language to ennu-publish-index. --- ennu.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ennu.el b/ennu.el index 04017ba..a07a5b8 100644 --- a/ennu.el +++ b/ennu.el @@ -135,8 +135,9 @@ last form in BODY." (concat filename-prefix extension)) tongue))) -(defun ennu-publish-index (filename-prefix tongue title posts-per-page posts) - (let* ((number-of-pages (ceiling (length posts) posts-per-page)) +(defun ennu-publish-index (filename-prefix title posts-per-page posts) + (let* ((tongue (ennu-post-language (first posts))) + (number-of-pages (ceiling (length posts) posts-per-page)) (page-numbers (number-sequence 1 number-of-pages))) `(,(seq-map 'ennu-post-filename posts) ,(cons (ennu-add-tongue-suffix (format "%s.html" filename-prefix) tongue) @@ -398,7 +399,7 @@ as keys. Keys are compared using `equal'." ;; Publish indices (seq-map (pcase-lambda (`(,tongue . ,posts)) - (ennu-publish-index "index" tongue blog-title posts-per-page posts)) + (ennu-publish-index "index" blog-title posts-per-page posts)) (seq-group-by 'ennu-post-language posts)) (seq-mapcat (pcase-lambda (`(,tag . ,posts)) @@ -406,7 +407,7 @@ as keys. Keys are compared using `equal'." (pcase-lambda (`(,tongue . ,posts)) (ennu-publish-index (ennu--expand-relative tag (ennu-setting :tag-directory)) - tongue tag posts-per-page posts)) + tag posts-per-page posts)) (seq-group-by 'ennu-post-language posts))) (ennu-many-to-many-group-by 'ennu-post-tags posts)) ;; Publish links -- cgit v1.2.3