From: Pip Cet <pipcet@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: Inline Images Export Bug
Date: Wed, 26 Aug 2015 19:39:37 +0000 [thread overview]
Message-ID: <CAOqdjBesHwjd4H4p_to=Fu6BrueyXW_aA-roJ2DThu8XtFBSSw@mail.gmail.com> (raw)
In-Reply-To: <876141apq4.fsf@gmx.us>
[-- Attachment #1: Type: text/plain, Size: 2920 bytes --]
I've used interactive SVGs with ox-html output quite a lot, and I found it
necessary to add the following horrible code; I'm not sure it's still
required:
----
let svgdoc = object.contentDocument;
let svgid = object.id;
if (!svgdoc) {
if (object.parentNode /* XXX why is this necessary */)
object.parentNode.innerHTML = "";
return;
}
let found = false;
for (let el of svgdoc.getElementsByTagName("svg")) {
let width = el.getAttribute("width");
let height = el.getAttribute("height");
let width_pt = width.match(/^([0-9]*)pt$/)[1];
let height_pt = height.match(/^([0-9]*)pt$/)[1];
let width_px = 5/4 * width_pt;
let height_px = 5/4 * height_pt;
object.setAttribute("width", width_px + "px");
object.setAttribute("height", height_px + "px");
found = true;
}
----
In my case, the SVG was produced by graphviz, so it always has the width
and height attributes.
This is a minor issue, but I also think the fallback message ("Sorry, your
browser does not support SVG.") is really horrible and misleading. It's
very unlikely to be a browser issue today, and much more likely to be a
missing file or a user deliberately disabling SVG. In that case, software
shouldn't say it's sorry :-)
"Cannot load SVG file." would be a better message, I think.
On Wed, Aug 26, 2015 at 6:06 PM, Rasmus <rasmus@gmx.us> wrote:
> Hi Scott,
>
> Thanks for your bug report.
>
> Scott Randby <srandby@gmail.com> writes:
>
> > When did Org start using the <object> tag for inline image HTML
> > export?
>
> You should use git-blame to find out if you care.
>
>
> > The problems with the second bit of exported code is that it doesn't
> > scale the image to fit the block with 50% width (only a small part of
> > the image is visible), and you when you right click on the image, you
> > can't view it, save it or anything.
> >
> > [...]
> >
> > Clearly, Org 8.3 is not using an <img> tag when exporting SVG images
> > to HTML, something which is a major issue for me. It essentially makes
> > Org unusable for HTML export. I really would appreciate a fix for this
> > bug.
>
> I'm not sure it's a bug. It's IS clearly a quite complicated issue, e.g.:
>
>
> http://stackoverflow.com/questions/4476526/do-i-use-img-object-or-embed-for-svg-files
>
> Perhaps it should be configurable, perhaps even as a default and a
> per-image basis (via #+attr_html).
>
> If you can provide a (html) solution that takes into consideration the
> issues mentioned on SO that would of course be great. In the age of d3.js
> interactivity COULD be an issue (I would always load "interactive svgs"
> via JS, but I'm a pretty naïve svg user so I don't know what's possible).
>
> Rasmus
>
> --
> Together we'll stand, divided we'll fall
>
>
>
[-- Attachment #2: Type: text/html, Size: 4079 bytes --]
next prev parent reply other threads:[~2015-08-26 19:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 17:51 Inline Images Export Bug Scott Randby
2015-08-26 18:06 ` Rasmus
2015-08-26 19:26 ` Scott Randby
2015-08-26 22:35 ` Rasmus
2015-08-26 23:06 ` Scott Randby
2015-08-26 19:39 ` Pip Cet [this message]
2015-08-26 21:56 ` Rasmus
2015-08-26 22:40 ` Pip Cet
2015-08-26 23:13 ` Scott Randby
2015-08-26 19:50 ` Scott Randby
2015-08-27 1:35 ` Nick Dokos
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOqdjBesHwjd4H4p_to=Fu6BrueyXW_aA-roJ2DThu8XtFBSSw@mail.gmail.com' \
--to=pipcet@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=rasmus@gmx.us \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.