aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ennu.el90
1 files changed, 46 insertions, 44 deletions
diff --git a/ennu.el b/ennu.el
index 8481ebd..613f61a 100644
--- a/ennu.el
+++ b/ennu.el
@@ -112,10 +112,12 @@ last form in BODY."
(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)))))
+ (let ((system-time-locale (map-elt (ennu-setting :locale-alist)
+ (ennu-post-language post) nil 'string=)))
+ (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))))
(ennu--filter-map
@@ -183,44 +185,43 @@ last form in BODY."
page-numbers))
:publish
(lambda (home-page &rest output-files)
- (seq-mapn
- (lambda (posts page-number output-file)
- (with-temp-buffer
- (insert (format "#+TITLE: %s\n" title))
- (insert (format "#+LANGUAGE: %s\n" tongue))
- (insert "#+OPTIONS: num:nil toc:nil\n\n")
- (seq-do (lambda (post)
- (insert (format "* [[post:%s]]\n" (ennu-post-slug post)))
- (insert (format-time-string
- "/%b %e, %Y/\n\n"
- (ennu-post-date post)))
- (when-let ((thumbnail (ennu-post-thumbnail post)))
- (insert (format "[[thumbnail:%s]]\n\n" thumbnail)))
- (when-let ((summary (ennu-post-summary post)))
- (insert summary)
- (insert "\n\n"))
- (when-let ((tags (ennu-post-tags post)))
- (insert "Tags: ")
- (insert
- (string-join
- (seq-map (lambda (tag)
- (format "[[tag:%s][%s]]" (ennu-add-tongue-suffix tag tongue) tag))
- tags)
- ", "))
- (insert "\n\n")))
- posts)
- (unless (= page-number 1)
- (insert (format "[[./%s][Newer posts]]\n"
- (ennu-index-filename (file-name-nondirectory filename-prefix)
- tongue nil (1- page-number)))))
- (unless (= page-number number-of-pages)
- (insert (format "[[./%s][Older posts]]\n"
- (ennu-index-filename (file-name-nondirectory filename-prefix)
- tongue nil (1+ page-number)))))
- (org-export-to-file 'html output-file)))
- (seq-partition posts posts-per-page)
- page-numbers
- output-files)
+ (let ((system-time-locale (map-elt (ennu-setting :locale-alist) tongue nil 'string=)))
+ (seq-mapn
+ (lambda (posts page-number output-file)
+ (with-temp-buffer
+ (insert (format "#+TITLE: %s\n" title))
+ (insert (format "#+LANGUAGE: %s\n" tongue))
+ (insert "#+OPTIONS: num:nil toc:nil\n\n")
+ (seq-do (lambda (post)
+ (insert (format "* [[post:%s]]\n" (ennu-post-slug post)))
+ (insert (format-time-string "/%b %e, %Y/\n\n" (ennu-post-date post)))
+ (when-let ((thumbnail (ennu-post-thumbnail post)))
+ (insert (format "[[thumbnail:%s]]\n\n" thumbnail)))
+ (when-let ((summary (ennu-post-summary post)))
+ (insert summary)
+ (insert "\n\n"))
+ (when-let ((tags (ennu-post-tags post)))
+ (insert "Tags: ")
+ (insert
+ (string-join
+ (seq-map (lambda (tag)
+ (format "[[tag:%s][%s]]" (ennu-add-tongue-suffix tag tongue) tag))
+ tags)
+ ", "))
+ (insert "\n\n")))
+ posts)
+ (unless (= page-number 1)
+ (insert (format "[[./%s][Newer posts]]\n"
+ (ennu-index-filename (file-name-nondirectory filename-prefix)
+ tongue nil (1- page-number)))))
+ (unless (= page-number number-of-pages)
+ (insert (format "[[./%s][Older posts]]\n"
+ (ennu-index-filename (file-name-nondirectory filename-prefix)
+ tongue nil (1+ page-number)))))
+ (org-export-to-file 'html output-file)))
+ (seq-partition posts posts-per-page)
+ page-numbers
+ output-files))
(copy-file (first output-files) home-page)))))
(defun ennu--absolute-uri (path)
@@ -279,8 +280,8 @@ last form in BODY."
((or :atom-feed-number-of-posts :atom-feed-file
:blog-scheme :default-image-width
:image-link-width :index-posts-per-page
- :other-files-directory :tag-directory
- :thumbnail-image-width)
+ :locale-alist :other-files-directory
+ :tag-directory :thumbnail-image-width)
(plist-get (org-combine-plists
(list :atom-feed-number-of-posts 12
:atom-feed-file "blog.atom"
@@ -288,6 +289,7 @@ last form in BODY."
:default-image-width 640
:image-link-width 1024
:index-posts-per-page 12
+ :locale-alist '(("en" . "C"))
:tag-directory "tag"
:thumbnail-image-width 320)
ennu-blog)