-------- Forwarded Message -------- Subject: Re: [NTG-context] Re: Replacing %20 with spaces in xml attributes Date: Fri, 21 Jul 2023 17:50:04 +0200 From: Hans Hagen <j.ha...@freedom.nl> To: denis.ma...@unibe.ch On 7/21/2023 5:27 PM, denis.ma...@unibe.ch wrote:
Thanks, but I'm still getting the same error. I'm thinking that it has something to do with the percent characters... This here works just fine: \startluacode function test(s) result = string.gsub(s, 'x20', 'MATCH') context(result) end \stopluacode \define[1]\test{\ctxlua{test("#1")}} \starttext \test{asdfx20} % -> asdfMATCH \stoptext But this here won't: \startluacode function test(s) result = string.gsub(s, '%%20', 'MATCH') context(result) end \stopluacode \define[1]\test{\ctxlua{test("#1")}} \starttext \test{asdf%20} % -> does not work \stoptext Any ideas?
\startluacode function xml.finalizers.tex.url(e,a) local u = #e > 0 and e[1].at[a] local s = u and lpeg.match(lpeg.patterns.urlunescaper,u) context(s) end \stopluacode \startxmlsetups xml:something \xmlatt{#1}{xlink:href}\par \xmlfilter{#1}{./url('xlink:href')} \stopxmlsetups i'll add this Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________