summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/org.texi1
-rw-r--r--etc/ORG-NEWS5
-rw-r--r--lisp/ox-html.el31
3 files changed, 25 insertions, 12 deletions
diff --git a/doc/org.texi b/doc/org.texi
index 3350ce0..853c75a 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -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
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 391e282..12db376 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -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.
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 6c5bfeb..5f02f25 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -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,21 +1629,27 @@ 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))))
- (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."))))
+ (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.