aboutsummaryrefslogtreecommitdiff
path: root/ennu.el
diff options
context:
space:
mode:
authorArun Isaac2019-09-02 01:04:24 +0530
committerArun Isaac2019-09-02 01:04:24 +0530
commit41980c4029edddea8bd97e091ec674f5a09f5db7 (patch)
tree74f65b3390d9e0e5ee99aa90aa3c7592c7b3b163 /ennu.el
parentb11a04a4958f613d6159a0004addbeeadd516102 (diff)
downloadennum-41980c4029edddea8bd97e091ec674f5a09f5db7.tar.gz
ennum-41980c4029edddea8bd97e091ec674f5a09f5db7.tar.lz
ennum-41980c4029edddea8bd97e091ec674f5a09f5db7.zip
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.
Diffstat (limited to 'ennu.el')
-rw-r--r--ennu.el5
1 files 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)))