Revert "ox-html: Use <img> tags for svgs, not <object>"
This reverts commit d96e897579
.
See https://orgmode.org/list/87r0dy3u91.fsf@localhost
This commit is contained in:
parent
895a367a67
commit
302bc6393a
|
@ -1772,18 +1772,43 @@ SOURCE is a string specifying the location of the image.
|
|||
ATTRIBUTES is a plist, as returned by
|
||||
`org-export-read-attribute'. INFO is a plist used as
|
||||
a communication channel."
|
||||
(org-html-close-tag
|
||||
"img"
|
||||
(org-html--make-attribute-string
|
||||
(org-combine-plists
|
||||
(list :src source
|
||||
:alt (if (string-match-p
|
||||
(concat "^" org-preview-latex-image-directory) source)
|
||||
(org-html-encode-plain-text
|
||||
(org-find-text-property-in-string 'org-latex-src source))
|
||||
(file-name-nondirectory source)))
|
||||
attributes))
|
||||
info))
|
||||
(if (string= "svg" (file-name-extension source))
|
||||
(org-html--svg-image source attributes info)
|
||||
(org-html-close-tag
|
||||
"img"
|
||||
(org-html--make-attribute-string
|
||||
(org-combine-plists
|
||||
(list :src source
|
||||
:alt (if (string-match-p
|
||||
(concat "^" org-preview-latex-image-directory) source)
|
||||
(org-html-encode-plain-text
|
||||
(org-find-text-property-in-string 'org-latex-src source))
|
||||
(file-name-nondirectory source)))
|
||||
attributes))
|
||||
info)))
|
||||
|
||||
(defun org-html--svg-image (source attributes info)
|
||||
"Return \"object\" embedding svg file SOURCE with given ATTRIBUTES.
|
||||
INFO is a plist used as a communication channel.
|
||||
|
||||
The special attribute \"fallback\" can be used to specify a
|
||||
fallback image file to use if the object embedding is not
|
||||
supported. CSS class \"org-svg\" is assigned as the class of the
|
||||
object unless a different class is specified with an attribute."
|
||||
(let ((fallback (plist-get attributes :fallback))
|
||||
(attrs (org-html--make-attribute-string
|
||||
(org-combine-plists
|
||||
;; Remove fallback attribute, which is not meant to
|
||||
;; appear directly in the attributes string, and
|
||||
;; provide a default class if none is set.
|
||||
'(:class "org-svg") attributes '(:fallback nil)))))
|
||||
(format "<object type=\"image/svg+xml\" data=\"%s\" %s>\n%s</object>"
|
||||
source
|
||||
attrs
|
||||
(if fallback
|
||||
(org-html-close-tag
|
||||
"img" (format "src=\"%s\" %s" fallback attrs) info)
|
||||
"Sorry, your browser does not support SVG."))))
|
||||
|
||||
(defun org-html--textarea-block (element)
|
||||
"Transcode ELEMENT into a textarea block.
|
||||
|
|
Loading…
Reference in New Issue