That's another good idea Heinrich.
I certainly could invoke another application to sanitize the SVG, but that
brings with it a number of additional problems: Does the user have it
installed properly? Is it cross-platform? Additionally, the typesetting
code (in Java) would have to be updated to cal
ok, let’s get smarter.
how about sanitizing the svg-file from JFreeSVG with svgo or svgcleaner or nano
or else?
And as a side effect you’d have the file optimized, ie. a smaller size
(lossless I suppose) …
and are you sure that the ;;-issue is the only bug? After sanitizing you’ll
never know but
> gsed ’s/;;/;/g' in.svg > out.svg
If a user has an SVG text element where ";;" goes into the document, then
that'd make for an awfully awkward user experience and obscure bug to fix.
For example: plot(rnorm(5), xlab=";;")
Meaning, the document must be loaded, parsed, and all style/class elements
Yes, now I see, but isn’t there sth missing in the export from JFreeSVG, that
were supposed to fill in between the semicolons? If not, why don’t you just
post-process, if possible …
… sth like
> gsed ’s/;;/;/g' in.svg > out.svg
;-)
> On 9. May 2022, at 17:42, Thangalin wrote:
>
> Hi Hein
Hi Heinrich,
Use the SVG I provided. R and Renjin use two different SVG generators.
Renjin uses JFreeSVG when exporting as SVG. As you pointed out, there are
no issues with R because it will export an SVG file without any double
semicolons.
In other words, try this:
\startbuffer[svg]
\stopb
Hi thereI can compile your example without any tweaks, hence could not reproduce any error.cheersHeinrich———R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"Copyright (C) 2022 The R Foundation for Statistical ComputingPlatform: x86_64-apple-darwin17.0 (64-bit)[R.app GUI 1.78 (8075) x86_64-app
Here's a screenshot comparing ConTeXt's PDF output (left) with KeenWrite's
preview for the same SVG document:
https://i.ibb.co/68nqwrg/render-r-plot.png
I've filed a bug against Renjin's SVG exporter.
Any guidance on how to fix this is greatly appreciated.
___
Hi again,
In tex/texmf-context/tex/context/base/mkxl/mlib-svg.lmt the following regex
appears a few times (line 1502, 1556, and 1570):
gmatch(VAR,"%s*([^:]+):%s*([^;]+);?")
It may be helpful to first normalize the string by appending a semicolon to
the end, allowing for:
for w in (VAR .. ";"):g
Hey hey,
The following produces a filled square, rather than an empty one:
\startbuffer[svg]
\stopbuffer
\starttext
\placefigure{}{\includesvgbuffer[svg][conversion=mp]}
\stoptext
Remove the extra semicolon to get the expected result:
It appears that a style immediately following