From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/114879 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thangalin via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: SVG style ignored after double semicolon Date: Sun, 8 May 2022 12:06:08 -0700 Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3766115810685284784==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20449"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Thangalin To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun May 08 21:07:12 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnmFL-00053c-MO for gctc-ntg-context-518@m.gmane-mx.org; Sun, 08 May 2022 21:07:11 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 661463606A3; Sun, 8 May 2022 21:06:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 10_fsMph1s2d; Sun, 8 May 2022 21:06:24 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 524173606A4; Sun, 8 May 2022 21:06:24 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 0AE3B3606A4 for ; Sun, 8 May 2022 21:06:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r1JeovXFrvjF for ; Sun, 8 May 2022 21:06:22 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.167.44; helo=mail-lf1-f44.google.com; envelope-from=thangalin@gmail.com; receiver= Original-Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 1D2C53606A3 for ; Sun, 8 May 2022 21:06:21 +0200 (CEST) Original-Received: by mail-lf1-f44.google.com with SMTP id bu29so20567746lfb.0 for ; Sun, 08 May 2022 12:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=9bjrs9eVnLEBGliT9lb5/VaIrpzdK4jIP0HQKbXD3Ww=; b=PM8k5R1HtehfxkLTx8HVukA3DvvR9mQbu+HVF9xkLEpQtKYY7ifOsQPTOeT6gJMGQj 8RhvDFgFnFeVAV1AOaZHbhOpD66v6aYaK2pfJ2YhxPBUYNdBkn1xnQkxUdJnnhjccGj8 tpu492LkcgGUCWcmFZO4+b/fQhHatN0EDwponFKBqCOO24XyN/ooGk4pP/kBttdxIGMf V9j0RBu1hm+eESr9TG+va8NkzyC6tx0Az/vyAfB/g0ZIoz8sCMdfpjJADviynix3UqCH D0ZS4ntOfLoM92ol1/WdUW18KFZz9uLe9b/N9YeVG3KEUY/e7TQRHCoEDwu3/2F4K4Ox AEMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=9bjrs9eVnLEBGliT9lb5/VaIrpzdK4jIP0HQKbXD3Ww=; b=gDFMnWgptRrK73uAKKihmwLqJ1/F82utRsxJ+zrVq/1F7i1Db1it1MZhrXOzGkgh21 sbKwsZwaUDorRYoW7qpZ2W483Mz0+iL5/npeYUOyPUq6Yzyu/sx8SLJmI4dIDTS9hh6F P9vAy9pz5h0bOcAqcr14Nsc/p4rEGv5UujFBsD8ofNqAhxCBPWO1dRhdHytprGSTBXba KHc67iXqRFZsxVmrJwUv7Yt6qqHgY8srJsazs2buN0/ZBrKpA2cZe7YWCdWimJFNN07Q mhxvnPcGgqcymXkDtidGLy3sXPARtN4kMciXrwuiUWuFeyZRYyKLXOrb+8lq7p4Ew1WZ JnVA== X-Gm-Message-State: AOAM5302FwIgnl7MuUZ9IP6CRudT3+dMnA17sw+uXPqLxRJpie20ehMk BKtHtZgNmofVmsll1gx1TxyO2VSitUctahxw8r9kgRtkLGM= X-Google-Smtp-Source: ABdhPJzz0OXtaffyrjQRH1drJdHBqVTQNYN0LqgJg2ck5uLtn5mODQXk4V2tovmAJFbF7yndzn5oGQQsCzXOP5Fa1ps= X-Received: by 2002:a05:6512:3e17:b0:473:205d:a3d5 with SMTP id i23-20020a0565123e1700b00473205da3d5mr10218425lfv.80.1652036780107; Sun, 08 May 2022 12:06:20 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:114879 Archived-At: --===============3766115810685284784== Content-Type: multipart/alternative; boundary="0000000000006f2c8505de84c9e0" --0000000000006f2c8505de84c9e0 Content-Type: text/plain; charset="UTF-8" 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 wrote: > Hey hey, > > The following produces a filled square, rather than an empty one: > > \startbuffer[svg] > > style="stroke:rgb(0,0,0);;fill:none" /> > > \stopbuffer > > \starttext > \placefigure{}{\includesvgbuffer[svg][conversion=mp]} > \stoptext > > Remove the extra semicolon to get the expected result: > > > style="stroke:rgb(0,0,0);fill:none" /> > > > 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. > --0000000000006f2c8505de84c9e0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi again,

I= n 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 t= o the end, allowing for:

for w in (VAR .. ";&= quot;):gmatch("([^;]*);") do ...

Spl= itting 'w' afterwards on the colon within key:value pairs would sti= ll be necessary, so maybe that approach is a wash.

=
Aside, when I made changes to the file, I couldn't get either a re= port() or a print() statement to show up in the output, even when running w= ith --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 a= n empty one:

\startbuffer[svg]
<svg><= br>=C2=A0 <rect width=3D"100" height=3D"100"
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 style=3D"stroke:rgb(0,0,0);;fill:none" /= >
</svg>
\stopbuffer

\starttext
=C2=A0 \placefigur= e{}{\includesvgbuffer[svg][conversion=3Dmp]}
\stoptext

Remove the extra semicolon to get the expected result:

<svg>
=C2=A0 <rect width=3D"100" hei= ght=3D"100"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 style=3D"stroke:r= gb(0,0,0);fill:none" />
</svg>

It appears th= at a style immediately following two semicolons is ignored.

<= /div>
The SVG was generated using the following R code:

<= /div>
svg("filename.svg");
plot(rnorm(200));
<= div>dev.off()

Arguably, R's SVG routines could= be a bit tighter. Can the MP SVG parser code be relaxed to skip "empt= y" semicolons?

$ context --ver= sion
mtx-context =C2=A0 =C2=A0 | current version: 2022.05.02 16:19
=

Much appreciated.
--0000000000006f2c8505de84c9e0-- --===============3766115810685284784== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============3766115810685284784==--