aboutsummaryrefslogtreecommitdiff
path: root/ennum-html.el
diff options
context:
space:
mode:
authorArun Isaac2020-08-02 01:15:38 +0530
committerArun Isaac2020-08-02 03:20:16 +0530
commit172a5413ba2e786b3b7d8e8d1793e6ff05eb96df (patch)
treee78d42c1af167ebd3cdb248945c151f0dae6039d /ennum-html.el
parent25f8a2086b299867bb0e27a645daa957fac15c92 (diff)
downloadennum-172a5413ba2e786b3b7d8e8d1793e6ff05eb96df.tar.gz
ennum-172a5413ba2e786b3b7d8e8d1793e6ff05eb96df.tar.lz
ennum-172a5413ba2e786b3b7d8e8d1793e6ff05eb96df.zip
Pass post object in info.
* ennum-html.el (ennum-html-inner-template): Use translations from post object. (ennum-html-find-link): New function. (ennum-html-link): Use post titles and video posters from post object. * ennum.el (ennum-export-post): Pass post object as :ennum-posts in info.
Diffstat (limited to 'ennum-html.el')
-rw-r--r--ennum-html.el21
1 files changed, 15 insertions, 6 deletions
diff --git a/ennum-html.el b/ennum-html.el
index 65c0455..ac3f0c3 100644
--- a/ennum-html.el
+++ b/ennum-html.el
@@ -230,7 +230,7 @@
:datetime ,(org-export-get-date info "%Y-%m-%d 12:00:00")
,(org-export-get-date info "%B %d, %Y"))))))))
;; Interlanguage language links
- (when-let (translations (plist-get info :ennum-translations))
+ (when-let (translations (ennum-post-translations (plist-get info :ennum-post)))
(format "<p>In other languages: %s</p>"
(mapconcat
(pcase-lambda (`(,lang . ,slug))
@@ -264,6 +264,14 @@
(org-html-footnote-section info)
"</article>"))
+(defun ennum-html-find-link (type path info)
+ "Find link of TYPE and PATH in post object stored in
+:ennum-posts of property list INFO."
+ (seq-find (lambda (link)
+ (and (eq (ennum-link-type link) type)
+ (string= (ennum-link-path link) path)))
+ (ennum-post-links (plist-get info :ennum-post))))
+
(defun ennum-html-link (link desc info)
;; We override the html link transcoder to handle image, post and
;; video links differently. We cannot use the `:export' property of
@@ -296,8 +304,8 @@
("post"
(ennum-html-export-post
path
- (or desc (map-elt (plist-get info :ennum-post-titles)
- path nil 'string=))
+ (or desc (ennum-post-link-target-title
+ (ennum-html-find-link 'post path info)))
(org-export-backend-name (plist-get info :back-end))))
("video"
(let ((video-directory (ennum-setting :video-directory)))
@@ -305,9 +313,10 @@
(xmlgen
`(video :src ,(url-encode-url (expand-file-name* path video-directory))
:poster ,(url-encode-url
- (expand-file-name* (map-elt (plist-get info :ennum-video-posters)
- path nil 'string=)
- video-directory))
+ (expand-file-name*
+ (ennum-video-link-poster
+ (ennum-html-find-link 'video path info))
+ video-directory))
:preload "none"
:controls ""))))
;; Pass other link types to org-html-link