emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: gerard.vermeulen@posteo.net
Cc: emacs-orgmode@gnu.org, Timothy <orgmode@tec.tecosaur.net>,
	"Ihor Radchenko" <yantar92@gmail.com>
Subject: Re: [PATCH] ox-html.el: add option to embed SVG for CSS support in SVG
Date: Tue, 06 Jun 2023 20:54:08 +0200	[thread overview]
Message-ID: <87edmoifqn.fsf@christianmoe.com> (raw)
In-Reply-To: <65d386e8c274e9703b80f2a2fefbcb7f@posteo.net>


gerard.vermeulen@posteo.net writes:

> On 06.06.2023 11:57, Christian Moe wrote:
[...]
>> 1) Embedded SVG is not the only way to have active CSS etc. in SVG
>> images. Linking to an external SVG file with an OBJECT element instead
>> of IMG should work fine (tested in Firefox). You can test this by
>> exporting Gerard's mwe.org example and editing the mwe.html to replace
>> : img src="./doc8.svg"
>> with
>> : object type="image/svg+xml" data="./doc8.svg"
>
> Indeed, the flower works after the replacement but the caption
> disappears.
> I do not understand why, because the caption is still present in the
> HTML.

Oops, sorry, my example was incomplete. Closing the <object> tag with
</object> should help.

[...]
>> 2) You can actually embed an SVG island in Org HTML export simply by
>> using #+INCLUDE. To try this, add the following line to Gerard's
>> mwe.org:
>> : #+INCLUDE: "./doc8.svg" export html
>> The exported HTML should now show the black flower from Gerard's
>> minimal
>> non-working example plus a working flower.
>
> Indeed, the flower works, but the caption disappears because Org does
> not
> recognize the "#+INCLUDE ..." as a link, the caption does not show up
> in the
> HTML. Is there an easy solution for this issue.

Fair point! No, I don't think there is an easy, non-messy solution that
will make for generating proper figure captions using the Org #+CAPTION
keyword with this approach. The same goes for embedding the SVG in the
Org file itself in a =#+begin_export html= block.

That's obviously a major drawback. So for embedding an external SVG file
as an SVG island in HTML output with proper figure captioning, your
approach is superior to my #+INCLUDE hack.

That said, I still think the better solution to the issue you raised is
for Orgmode to go back to exporting SVG links as <object> not <img>, not
to extract SVG file contents and embed them as SVG islands.

(Though I may be a breaking change for some users. In particular,
because OBJECT does not have an ALT attribute, but uses several other
ways to provide alternative text for accessibility, users would need to
change their =#+attr_html :alt= to using :aria-label or :title
attributes, unless the Org implementation for SVG links were to handle
this smartly.)

Yours,
Christian


  reply	other threads:[~2023-06-06 18:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 13:23 [PATCH] ox-html.el: add option to embed SVG for CSS support in SVG gerard.vermeulen
2023-06-06  7:49 ` Ihor Radchenko
2023-06-06  9:57   ` Christian Moe
2023-06-06 13:37     ` gerard.vermeulen
2023-06-06 18:54       ` Christian Moe [this message]
2023-06-07  8:43         ` Ihor Radchenko
2023-06-07  8:41     ` Ihor Radchenko
2023-06-07 14:30       ` Christian Moe
2023-06-07 17:57         ` Ihor Radchenko
2023-06-15 13:09           ` gerard.vermeulen
2023-06-15 14:55             ` Max Nikulin
2023-06-15 20:42               ` Ihor Radchenko
2023-06-15 20:51             ` Ihor Radchenko
2023-06-16 18:39               ` gerard.vermeulen
2023-06-17 12:38                 ` Ihor Radchenko
2023-06-17 14:45                   ` gerard.vermeulen
2023-06-21 15:52               ` Max Nikulin
2023-06-21 16:02                 ` Ihor Radchenko
2023-06-21 16:27                   ` Max Nikulin
2023-06-21 16:38                     ` Ihor Radchenko
2023-06-22 16:25                       ` Max Nikulin
2023-06-23 11:02                         ` Ihor Radchenko
2023-06-06 12:58   ` gerard.vermeulen
2023-06-07  9:07     ` Ihor Radchenko
2023-06-06 14:14 ` Max Nikulin
2023-06-06 16:08   ` gerard.vermeulen
2023-06-07  9:10     ` Ihor Radchenko
2023-06-09 15:27     ` Max Nikulin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87edmoifqn.fsf@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gerard.vermeulen@posteo.net \
    --cc=orgmode@tec.tecosaur.net \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).