diff options
author | Arun Isaac | 2020-07-31 02:29:22 +0530 |
---|---|---|
committer | Arun Isaac | 2020-07-31 03:05:09 +0530 |
commit | cf2de46bdc76f895e51d5d247f544a473681c4a8 (patch) | |
tree | 6c80fc42874102cc4be911e7f3b979f9f0bca4fa /ennum-html.el | |
parent | dec62cff5d4bc05589361a53d5939ff2f032f231 (diff) | |
download | ennum-cf2de46bdc76f895e51d5d247f544a473681c4a8.tar.gz ennum-cf2de46bdc76f895e51d5d247f544a473681c4a8.tar.lz ennum-cf2de46bdc76f895e51d5d247f544a473681c4a8.zip |
Pass video posters through info.
* ennum.el (ennum-post): Add video-posters slot.
(ennum--read-post): Set video-posters slot when creating post object.
(ennum-publish-post, ennum--feed-entry): Pass video-posters in info
communication channel.
* ennum-html.el (ennum-html-link): Handle video links differently from
normal org links since they require access to the info communication
channel. Get poster from info instead of reading the source tree
directly.
(ennum-export-video): Delete function.
(org-link-parameters): Unregister ennum-export-video.
Diffstat (limited to 'ennum-html.el')
-rw-r--r-- | ennum-html.el | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/ennum-html.el b/ennum-html.el index 10a6e65..ee1b3d7 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 links - ;; differently. We cannot use the `:export' property of + ;; We override the html link transcoder to handle image 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,17 @@ (ennum-setting :images-directory)))) :type "file") desc info)))) + ("video" + (let ((video-directory (ennum-setting :video-directory))) + (message "%s" (plist-get info :ennum-video-posters)) + (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)) + :preload "none" + :controls "")))) ;; Pass other link types to org-html-link (_ (org-html-link link desc info))))) @@ -341,20 +352,6 @@ :export 'ennum-export-thumbnail :follow 'ennum-follow-image) -(defun ennum-export-video (path desc backend) - (pcase backend - ((or 'ennum-html 'html) - (let ((video-directory (ennum-setting :video-directory))) - (xmlgen - `(video :src ,(url-encode-url (expand-file-name* path video-directory)) - :poster ,(url-encode-url - (expand-file-name* (ennum-video-poster path) video-directory)) - :preload "none" - :controls "")))))) - -(org-link-set-parameters - "video" :export 'ennum-export-video) - (defun ennum-export-static (path desc backend) (pcase backend ((or 'ennum-html 'html) |