From 41980c4029edddea8bd97e091ec674f5a09f5db7 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 2 Sep 2019 01:04:24 +0530 Subject: Add slug slot to post structure. * ennu.el (ennu-post): Add slug slot. (ennu--read-post): Initialize slug slot. (ennu-publish-index): Get slug slot instead of recomputing it. --- ennu.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ennu.el b/ennu.el index 5ee6be5..6c1cf22 100644 --- a/ennu.el +++ b/ennu.el @@ -14,7 +14,7 @@ (cl-defstruct (ennu-post (:constructor ennu-make-post) (:copier nil)) - filename author date language links + filename slug author date language links summary tags thumbnail title translation-group) (cl-defstruct (ennu-operation (:constructor ennu-make-operation) @@ -55,6 +55,7 @@ (cons link-type (org-element-property :path link)))))))))) (ennu-make-post :filename filename + :slug (file-name-base filename) :author (funcall export (first (plist-get metadata :author))) :date (org-timestamp-to-time (first (plist-get metadata :date))) :language (plist-get metadata :language) @@ -158,7 +159,7 @@ last form in BODY." (insert (format "#+LANGUAGE: %s\n" tongue)) (insert "#+OPTIONS: num:nil toc:nil\n\n") (seq-do (lambda (post) - (insert (format "* [[post:%s]]\n" (file-name-base (ennu-post-filename post)))) + (insert (format "* [[post:%s]]\n" (ennu-post-slug post))) (insert (format-time-string "/%b %e, %Y/\n\n" (ennu-post-date post))) -- cgit v1.2.3