* \setregisterentry levels with colon (keys:1, entries:1) in lua
@ 2020-10-10 18:52 Jano Kula
2020-10-10 19:32 ` Wolfgang Schuster
0 siblings, 1 reply; 2+ messages in thread
From: Jano Kula @ 2020-10-10 18:52 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 754 bytes --]
Greetings!
One can can set register levels with keys and entries
\setregisterentry[MyIndex]
[keys:1=Sorting Key Level 1,
entries:1=Entry Level 1,
keys:2=Sorting Key Level 2,
entries:2=Entry Level 2]
Rewriting the code in lua works until colon (:) is used.
\startluacode
context.setregisterentry({ "MyIndex" },
{ keys:1="C Level 1", entries:1="C Level 2"})
\stopluacode
which stops with error: <name> expected near '1'
Can the colon be escaped or underlying
\xdef\currentregisterkeysa{\registerparameter{\c!keys:1}}%
\xdef\currentregisterkeysb{\registerparameter{\c!keys:2}}%
\xdef\currentregisterkeysc{\registerparameter{\c!keys:3}}%
redefined? Tried without success.
MWE (mkiv, latest beta) attached.
Thank you,
Jano
[-- Attachment #1.2: Type: text/html, Size: 1381 bytes --]
[-- Attachment #2: index.tex --]
[-- Type: application/octet-stream, Size: 552 bytes --]
\defineregister[MyIndex]
\starttext
% ConTeXt way
A\expanded{\setregisterentry[MyIndex]
[keys:1=A Level 1,
entries:1=A Level 1,
keys:2=A Level 2,
entries:2=A Level 2]}
% Lua way
\startluacode
-- command without colon OK
context("B")
context.setregisterentry({ "MyIndex" },
{ keys="B", entries="B"})
-- command with colon NOK
-- context("C")
-- context.setregisterentry({ "MyIndex" },
-- { keys:1="C Level 1", entries:1="C Level 2"})
\stopluacode
\placeregister[MyIndex][criterium=all]
\stoptext
[-- Attachment #3: 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: \setregisterentry levels with colon (keys:1, entries:1) in lua
2020-10-10 18:52 \setregisterentry levels with colon (keys:1, entries:1) in lua Jano Kula
@ 2020-10-10 19:32 ` Wolfgang Schuster
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2020-10-10 19:32 UTC (permalink / raw)
To: mailing list for ConTeXt users
Jano Kula schrieb am 10.10.2020 um 20:52:
> Greetings!
>
> One can can set register levels with keys and entries
> \setregisterentry[MyIndex]
> [keys:1=Sorting Key Level 1,
> entries:1=Entry Level 1,
> keys:2=Sorting Key Level 2,
> entries:2=Entry Level 2]
>
> Rewriting the code in lua works until colon (:) is used.
> \startluacode
> context.setregisterentry({ "MyIndex" },
> { keys:1="C Level 1", entries:1="C Level 2"})
context.setregisterentry (
{ "MyIndex" },
{ ["keys:1"] = "...", ["entries:1"] = "..." }
)
Wolfgang
___________________________________________________________________________________
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:[~2020-10-10 19:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-10 18:52 \setregisterentry levels with colon (keys:1, entries:1) in lua Jano Kula
2020-10-10 19:32 ` Wolfgang Schuster
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).