ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jano Kula <jano.kula@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: \setregisterentry levels with colon (keys:1, entries:1) in lua
Date: Sat, 10 Oct 2020 20:52:18 +0200	[thread overview]
Message-ID: <CAPefzZ0L=-Ukxwp0Nt6euJVsfrSHMr9Et7GeCE5_0gTuG-cPsQ@mail.gmail.com> (raw)


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

             reply	other threads:[~2020-10-10 18:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10 18:52 Jano Kula [this message]
2020-10-10 19:32 ` Wolfgang Schuster

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='CAPefzZ0L=-Ukxwp0Nt6euJVsfrSHMr9Et7GeCE5_0gTuG-cPsQ@mail.gmail.com' \
    --to=jano.kula@gmail.com \
    --cc=ntg-context@ntg.nl \
    /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).