mirror of https://github.com/yjwen/org-reveal.git
Add attr_html to images in single-file-export mode.
This commit is contained in:
parent
7874f0ee89
commit
a0cb668577
34
ox-reveal.el
34
ox-reveal.el
|
@ -750,22 +750,34 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
(defun org-reveal--format-image-data-uri (link path info)
|
(defun org-reveal--format-image-data-uri (link path info)
|
||||||
"Generate the data URI for the image referenced by LINK."
|
"Generate the data URI for the image referenced by LINK."
|
||||||
(let* ((ext (downcase (file-name-extension path))))
|
(let* ((ext (downcase (file-name-extension path))))
|
||||||
|
(message "link=%s" link)
|
||||||
(if (string= ext "svg")
|
(if (string= ext "svg")
|
||||||
(org-reveal-embedded-svg path)
|
(org-reveal-embedded-svg path)
|
||||||
(org-html-close-tag
|
(org-html-close-tag
|
||||||
"img"
|
"img"
|
||||||
(org-html--make-attribute-string
|
(org-html--make-attribute-string
|
||||||
(list :src
|
(org-combine-plists
|
||||||
(concat
|
(list :src
|
||||||
"data:image/"
|
(concat
|
||||||
;; Image type
|
"data:image/"
|
||||||
ext
|
;; Image type
|
||||||
";base64,"
|
ext
|
||||||
;; Base64 content
|
";base64,"
|
||||||
(with-temp-buffer
|
;; Base64 content
|
||||||
(insert-file-contents-literally path)
|
(with-temp-buffer
|
||||||
(base64-encode-region 1 (point-max))
|
(insert-file-contents-literally path)
|
||||||
(buffer-string)))))
|
(base64-encode-region 1 (point-max))
|
||||||
|
(buffer-string))))
|
||||||
|
;; Get attribute list from parent element
|
||||||
|
;; Copied from ox-html.el
|
||||||
|
(let* ((parent (org-export-get-parent-element link))
|
||||||
|
(link (let ((container (org-export-get-parent link)))
|
||||||
|
(if (and (eq (org-element-type container) 'link)
|
||||||
|
(org-html-inline-image-p link info))
|
||||||
|
container
|
||||||
|
link))))
|
||||||
|
(and (eq (org-element-map parent 'link 'identity info t) link)
|
||||||
|
(org-export-read-attribute :attr_html parent)))))
|
||||||
info))))
|
info))))
|
||||||
|
|
||||||
(defun org-reveal-link (link desc info)
|
(defun org-reveal-link (link desc info)
|
||||||
|
|
Loading…
Reference in New Issue