On 15.06.2023 22:51, Ihor Radchenko wrote:
gerard.vermeu...@posteo.net writes:
On 07.06.2023 19:57, Ihor Radchenko wrote:
I am not expert in html. Maybe someone else (Timothy?) can chime in.
That said, I do not see why we cannot offer <object> strategy as an
option regardless whether is can solve the problem with CSS.
;; For each SVG image during HTML export:
;; 1. It checks `svg-as-object' and "image in-lining" whether to
;; embed the SVG image in an <object> tag.
;; 2. If not, it checks `svg-inclusion' and "image in-lining"
;; whether to copy the SVG contents to the HTML output.
;; 3. If not, it falls back to checking "image in-lining" whether to
;; embed the SVG image in an <img> tag (as any other image type).
;; 4. It is possible to set `svg-as-object' and/or `svg-inclusion':
;; - For each SVG link by means of "#+ATTR_HTML: :svg-as-object t"
;; or "#+ATTR_HTML: :svg-inclusion t".
;; - Within file scope by means of "#+OPTIONS: svg-as-object:t" or
;; "#+OPTIONS: svg-inclusion:t".
;; - Within toplevel scope by means of the options
;; `org-html-svg-as-object' or `org-html-svg-inclusion'.
I think you missed `org-html-inline-image-rules' where users can
include/exclude svg images from inlining.
The term "image in-lining" is a very terse description of what my code
does.
In case of rules 1, 2, and 3 above: the code takes into account the two
relevant options `org-html-inline-image' and
`org-html-inline-image-rules'
to decide whether the image would be in-lined in an <img> tag.
For rule 1 above: in case `svg-as-object' is also true, the code
in-lines
the image in an <object> tag instead of an <img> tag and returns
the <object> tag. In case `svg-as-object' is nil, apply rule 2.
For rule 2 above: in case `svg-inclusion' is also true, return the SVG
contents as a result. In case `svg-inclusion' is nil, apply rule 3.
Rule 3 is applied by the normal "Image file" handling code from
org-html-link in ox-html which handles `org-html-image-inline-rules',
but my code for rules 1 and 2 do too.
My clone of org-html-link is a copy with the exception that I
added 4 lines of code (and 2 lines of comments) to implement
the rules 1 and 2 (but we should not implement rule 2).
Before going ahead with a patch to in-line images in <object> tags,
there remains the question of how to make those tags behave as
much as possible as <img> tags. My knowledge of HTML is very thin
and Javascript even worse.
Best regards -- Gerard