forked from mirrors/org-mode
ox-html: Provide a default CSS class for embedded SVG images
* lisp/ox-html.el (org-html--svg-image): Set CSS class of embedded SVG images to be org-svg if no other class is set in attributes. org-html-style-default: Provide default properties for new CSS class. * doc/org.texi (CSS support): Documentation of default CSS class org-svg for SVG images embedded into exported HTML.
This commit is contained in:
parent
096f4287a6
commit
04e0bc0b00
|
@ -11750,6 +11750,7 @@ div.footnotes @r{footnote section headline}
|
|||
p.footnote @r{footnote definition paragraph, containing a footnote}
|
||||
.footref @r{a footnote reference number (always a <sup>)}
|
||||
.footnum @r{footnote number in footnote definition (always <sup>)}
|
||||
.org-svg @r{default class for a linked @file{.svg} image}
|
||||
@end example
|
||||
|
||||
@vindex org-html-style-default
|
||||
|
|
|
@ -208,6 +208,11 @@ point for the SRC/EXAMPLE block.
|
|||
With the global variable ~org-latex-images-centered~ or the local
|
||||
attribute ~:center~ it is now possible to center an image in LaTeX
|
||||
export.
|
||||
**** Default CSS class ~org-svg~ for SVG images in HTML export
|
||||
SVG images exported in HTML are now by default assigned a CSS class
|
||||
~org-svg~ if no CSS class is specified with the ~:class~ attribute. By
|
||||
default, the CSS styling of class ~org-svg~ specifies an image width
|
||||
of 90\thinsp{}% of the container the image.
|
||||
*** Babel
|
||||
**** Support for SLY in Lisp blocks
|
||||
See ~org-babel-lisp-eval-fn~ to activate it.
|
||||
|
|
|
@ -440,6 +440,7 @@ for the JavaScript code in this tag.
|
|||
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
||||
.org-info-js_search-highlight
|
||||
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
||||
.org-svg { width: 90%; }
|
||||
/*]]>*/-->
|
||||
</style>"
|
||||
"The default style specification for exported HTML files.
|
||||
|
@ -1628,17 +1629,23 @@ a communication channel."
|
|||
info)))
|
||||
|
||||
(defun org-html--svg-image (source attributes info)
|
||||
"Return \"object\" appropriate for embedding svg file SOURCE
|
||||
with assoicated ATTRIBUTES. INFO is a plist used as a
|
||||
communication channel.
|
||||
"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."
|
||||
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
|
||||
(plist-put attributes :fallback nil))))
|
||||
(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
|
||||
source
|
||||
attrs
|
||||
(if fallback
|
||||
(org-html-close-tag
|
||||
"img" (format "src=\"%s\" %s" fallback attrs) info)
|
||||
|
|
Loading…
Reference in a new issue