diff options
-rw-r--r-- | ennum-html.el | 21 | ||||
-rw-r--r-- | ennum.el | 17 |
2 files changed, 16 insertions, 22 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 @@ -326,22 +326,7 @@ result as a string." (ennum-mkdir-p (file-name-directory output-file)) (let ((system-time-locale (map-elt (ennum-setting :locale-alist) (ennum-post-language post) nil 'string=)) - (ext-plist (list :ennum-post-titles - (ennum--filter-map - (lambda (link) - (when (and (ennum-post-link-p link) - (not (eq (ennum-post-link-target-title link) - 'not-required))) - (cons (ennum-post-link-path link) - (ennum-post-link-target-title link)))) - (ennum-post-links post)) - :ennum-translations (ennum-post-translations post) - :ennum-video-posters - (ennum--filter-map (lambda (link) - (when (eq (ennum-link-type link) 'video) - (cons (ennum-link-path link) - (ennum-video-link-poster link)))) - (ennum-post-links post))))) + (ext-plist (list :ennum-post post))) (ennum-with-file-contents interned-org-file (if output-html-file (org-export-to-file 'ennum-html output-file nil nil nil body-only ext-plist) |