* searching in nodes
@ 2018-12-12 11:57 Hans van der Meer
2018-12-17 18:53 ` Hans Hagen
0 siblings, 1 reply; 2+ messages in thread
From: Hans van der Meer @ 2018-12-12 11:57 UTC (permalink / raw)
To: NTG ConTeXt
[-- Attachment #1.1: Type: text/plain, Size: 595 bytes --]
In a Lua function called from within an \startxmlsetups..\stopxmlsetups code block I would like to search through the current node and all below.
Using string.match("to-be-searched”,”pattern”).
The Lua function being called through \def\findmypattern#1#2{\ctxlua{tex.print(hvdm.findmypattern("#1","#2",))}
But I do not seem to get the node contents in the first argument #1. Using \xmlverbatim{#1} fails with Lua error "hexadecimal digit expected near '"\xm’”. \xmlflushpure{#1} fails with Lua error "invalid escape sequence near …”
Any help?
dr. Hans van der Meer
[-- Attachment #1.2: Type: text/html, Size: 1950 bytes --]
[-- Attachment #2: Type: text/plain, Size: 492 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: searching in nodes
2018-12-12 11:57 searching in nodes Hans van der Meer
@ 2018-12-17 18:53 ` Hans Hagen
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2018-12-17 18:53 UTC (permalink / raw)
To: mailing list for ConTeXt users, Hans van der Meer
On 12/12/2018 12:57 PM, Hans van der Meer wrote:
> In a Lua function called from within an \startxmlsetups..\stopxmlsetups
> code block I would like to search through the current node and all below.
> Using string.match("to-be-searched”,”pattern”).
> The Lua function being called through
> \def\findmypattern#1#2{\ctxlua{tex.print(hvdm.findmypattern("#1","#2",))}
>
> But I do not seem to get the node contents in the first argument #1.
> Using \xmlverbatim{#1} fails with Lua error "hexadecimal digit expected
> near '"\xm’”. \xmlflushpure{#1} fails with Lua error "invalid escape
> sequence near …”
you can use lua in your path expressions
[hvhm.findmypattern(text(),'whatever')]
and such
-----------------------------------------------------------------
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 / 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-17 18:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-12 11:57 searching in nodes Hans van der Meer
2018-12-17 18:53 ` Hans Hagen
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).