aboutsummaryrefslogtreecommitdiff
path: root/ennum-html.el
diff options
context:
space:
mode:
authorArun Isaac2020-08-02 00:48:39 +0530
committerArun Isaac2020-08-02 03:20:16 +0530
commit25f8a2086b299867bb0e27a645daa957fac15c92 (patch)
tree15691411ed4482bac086b0c026caadc9bddde44c /ennum-html.el
parent14d46e1aefa33f3ca2d14db6aa2e54623c7a069d (diff)
downloadennum-25f8a2086b299867bb0e27a645daa957fac15c92.tar.gz
ennum-25f8a2086b299867bb0e27a645daa957fac15c92.tar.lz
ennum-25f8a2086b299867bb0e27a645daa957fac15c92.zip
Pass post titles in info.
* ennum-html.el (ennum-html-link): Handle post links as a special case. (ennum-html-export-post): Use post link description received as argument. When description is nil, do not attempt to read source files to find the post title. * ennum.el (ennum-export-post): Pass post titles as :ennum-post-titles in info.
Diffstat (limited to 'ennum-html.el')
-rw-r--r--ennum-html.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/ennum-html.el b/ennum-html.el
index bfad18f..65c0455 100644
--- a/ennum-html.el
+++ b/ennum-html.el
@@ -265,8 +265,8 @@
"</article>"))
(defun ennum-html-link (link desc info)
- ;; We override the html link transcoder to handle image and video
- ;; links differently. We cannot use the `:export' property of
+ ;; We override the html link transcoder to handle image, post and
+ ;; video links differently. We cannot use the `:export' property of
;; `org-link-parameters' since those functions cannot access the
;; `info' communication channel.
(let ((path (org-element-property :path link)))
@@ -293,6 +293,12 @@
(ennum-setting :images-directory))))
:type "file")
desc info))))
+ ("post"
+ (ennum-html-export-post
+ path
+ (or desc (map-elt (plist-get info :ennum-post-titles)
+ path nil 'string=))
+ (org-export-backend-name (plist-get info :back-end))))
("video"
(let ((video-directory (ennum-setting :video-directory)))
(message "%s" (plist-get info :ennum-video-posters))
@@ -316,11 +322,9 @@
(defun ennum-html-export-post (path desc backend)
(pcase backend
((or 'ennum-html 'html)
- (let ((filename (concat (expand-file-name path (ennum-setting :posts-directory))
- ".org")))
- (xmlgen `(a :href ,(url-encode-url
- (expand-file-name* path (ennum-setting :posts-directory)))
- ,(or desc (ennum-post-title (ennum-read-post filename)))))))))
+ (xmlgen `(a :href ,(url-encode-url
+ (expand-file-name* path (ennum-setting :posts-directory)))
+ ,desc)))))
(defun ennum-html-follow-post (path)
(ennum-html-follow (expand-file-name (concat path ".org")