emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Request: change SVG embedding in exported HTML


From: Jarmo Hurri
Subject: Re: [O] Request: change SVG embedding in exported HTML
Date: Sun, 24 Jul 2016 17:42:34 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> Jarmo Hurri <address@hidden> writes:
>
>> Request: An SVG file embedded in exported HTML should be embedded using
>> the <img> tag instead of <object>.
>
> Would you like to provide a patch to this effect? It probably boils down
> to modifying `org-html--svg-image'.

Yes indeed. Please find, at the end of this message, a patch and a test
file. The test file assumes you have Asymptote installed, along with
dvisvgm and probably also convert from ImageMagick; the last two are
needed by Asymptote to produce SVG and JPG output.

I have tested that

- if the browser has SVG support (as almost all do)
  1. the default behaviour works (embedding an SVG file)
  2. the fallback works if the SVG file is missing (you can test this by
     first exporting the test file as HTML, and then removing the SVG file)

- if the browser is missing SVG support (this test was done
  with the text-based browser 'links')
  - if no fallback is set, the browser will display the text "Sorry,
    your browser does not support SVG." as before (and as expected)

Now the case I have _not_ been able to test is the one where the browser
is missing SVG support, and the fallback is set. Unfortunately in this
case the 'links' browser displays nothing in the place of the SVG image,
and I don't know of another browser I could use to test the behaviour.

The first line of the test file can be used to verify that the embedded
SVG file now 'responds' to CSS settings.

I also added the new CSS class to the manual.

If this patch is ok, then what is missing are the default CSS settings
for the new class org-svg in constant org-html-style-default. I simply
did not know what to put there. The manual says that this constant has
basic settings for _all_ defined CSS entities. Either defaults need to
be set for the new class, or the text in the manual needs to be
changed. Or we have to accept that the manual is not logically
coherent. :-)

Jarmo

Attachment: 0001-lisp-ox-html.el-Embed-SVG-images-with-tag-img-instea.patch
Description: patch

Attachment: svg-test.org
Description: test file


reply via email to

[Prev in Thread] Current Thread [Next in Thread]