ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Thangalin via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Thangalin <thangalin@gmail.com>
Subject: Re: SVG style ignored after double semicolon
Date: Sun, 8 May 2022 12:06:08 -0700	[thread overview]
Message-ID: <CAANrE7pXeUx=Hf-0Vk2qFz-K2yXZCLc2-JR_TJ+sobtWHcWwsw@mail.gmail.com> (raw)
In-Reply-To: <CAANrE7p=q2ciAZQtS6UD0f+zv6PVWN2P00JG1-A_-SXKyEPF_A@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1659 bytes --]

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 .. ";"):gmatch("([^;]*);") do ...

Splitting 'w' afterwards on the colon within key:value pairs would still be
necessary, so maybe that approach is a wash.

Aside, when I made changes to the file, I couldn't get either a report() or
a print() statement to show up in the output, even when running with
--debug. Any hints on how to sprinkle debug info into the code? Or was I
barking up the wrong source file?

Cheers!

On Sun, May 8, 2022 at 1:33 AM Thangalin <thangalin@gmail.com> wrote:

> Hey hey,
>
> The following produces a filled square, rather than an empty one:
>
> \startbuffer[svg]
> <svg>
>   <rect width="100" height="100"
>         style="stroke:rgb(0,0,0);;fill:none" />
> </svg>
> \stopbuffer
>
> \starttext
>   \placefigure{}{\includesvgbuffer[svg][conversion=mp]}
> \stoptext
>
> Remove the extra semicolon to get the expected result:
>
> <svg>
>   <rect width="100" height="100"
>         style="stroke:rgb(0,0,0);fill:none" />
> </svg>
>
> It appears that a style immediately following two semicolons is ignored.
>
> The SVG was generated using the following R code:
>
> svg("filename.svg");
> plot(rnorm(200));
> dev.off()
>
> Arguably, R's SVG routines could be a bit tighter. Can the MP SVG parser
> code be relaxed to skip "empty" semicolons?
>
> $ context --version
> mtx-context     | current version: 2022.05.02 16:19
>
> Much appreciated.
>

[-- Attachment #1.2: Type: text/html, Size: 2616 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2022-05-08 19:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-08  8:33 Thangalin via ntg-context
2022-05-08 19:06 ` Thangalin via ntg-context [this message]
2022-05-09  6:10   ` Thangalin via ntg-context
2022-05-09  8:55     ` Heinrich Paeßens via ntg-context
2022-05-09 15:42       ` Thangalin via ntg-context
2022-05-09 17:01         ` Heinrich Paeßens via ntg-context
2022-05-09 20:03           ` Thangalin via ntg-context
2022-05-09 23:01           ` Heinrich Paeßens via ntg-context
2022-05-09 23:17             ` Thangalin via ntg-context

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='CAANrE7pXeUx=Hf-0Vk2qFz-K2yXZCLc2-JR_TJ+sobtWHcWwsw@mail.gmail.com' \
    --to=ntg-context@ntg.nl \
    --cc=thangalin@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.
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).