From: Thangalin <thangalin@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: SVG images inside XML setups
Date: Mon, 8 Mar 2021 22:29:31 -0800 [thread overview]
Message-ID: <CAANrE7pxkdUHxEbnJdPMRZyCb_x2whTmEem1tGRw0ozvHh+EBg@mail.gmail.com> (raw)
Here's a fairly minimal example showing an issue, using ConTeXt LMTX.
Save the following as "main.tex":
% SOF
\startbuffer[document]
<body><img src="circle.svg"/></body>
\stopbuffer
\startbuffer[csvg]
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<g><circle cx="50" cy="50" r="20"/></g>
</svg>
\stopbuffer
\startxmlsetups xml:xhtml
\xmlsetsetup{\xmldocument}{body|img}{xml:*}
\stopxmlsetups
\startxmlsetups xml:body
\xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:img
\placefigure{}{\externalfigure[\xmlatt{#1}{src}][conversion=mp]}
\placefigure{}{\externalfigure[circle.svg][conversion=mp]}
\placefigure{}{\includesvgbuffer[csvg][conversion=mp]}
\stopxmlsetups
\xmlregistersetup{xml:xhtml}
\starttext
\xmlprocessbuffer{xhtml}{document}{}
\placefigure{}{\externalfigure[circle.svg][conversion=mp]}
\placefigure{}{\externalfigure[diagram.svg][conversion=mp]}
\stoptext
% EOF
Save the contents of "\startbuffer[csvg]" to a file named
"circle.svg", to create a valid, external SVG file.
Copy "circle.svg" to a file named "diagram.svg" to create a second
valid, external SVG file.
Run: context main.tex
Expected
All the SVG images appear.
Actual
Figures 1, 2, and 4 show only the following text:
\includesvgfile[circle.svg]\resetbuffer[svg-circle-inclusion]
In contrast, consider the following document:
% SOF
\startbuffer[csvg]
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<g><circle cx="50" cy="50" r="20"/></g>
</svg>
\stopbuffer
\starttext
\placefigure{}{\includesvgbuffer[csvg][conversion=mp]}
\placefigure{}{\externalfigure[circle.svg][conversion=mp]}
\placefigure{}{\externalfigure[diagram.svg][conversion=mp]}
\stoptext
% EOF
All the images appear as expected.
Any idea why using XML setups appears to affect the behaviour of
rendering SVG documents using MetaPost?
Thank you!
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next reply other threads:[~2021-03-09 6:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 6:29 Thangalin [this message]
2021-03-09 8:58 ` Hans Hagen
2021-03-09 16:15 ` Thangalin
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=CAANrE7pxkdUHxEbnJdPMRZyCb_x2whTmEem1tGRw0ozvHh+EBg@mail.gmail.com \
--to=thangalin@gmail.com \
--cc=ntg-context@ntg.nl \
/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.
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 NNTP newsgroup(s).