ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Gerion Entrup <gerion.entrup@flump.de>
To: ntg-context@ntg.nl
Subject: [NTG-context] LMTX: Command handling, Interface between TeX and Lua
Date: Wed, 13 Dec 2023 18:13:59 +0100	[thread overview]
Message-ID: <3270809.44csPzL39Z@falbala> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1201 bytes --]

Hi,

I'd like to understand more of the inner workings of LMTX.
When I understand it right, most of the code is now processed in Lua but
I was not able to find it.

For example, I tried to find out how setupitemgroup is handled (just as
an example of a more complex command). The wiki has a (kind of)
autogenerated description:
https://wiki.contextgarden.net/Command/setupitemgroup
I found the data for this (at least this is my guess) here:
tex/texmf-context/tex/context/interface/mkiv/i-itemgroup.xml

Are these xml files created by hand or somehow generated? Now, when I
use `\setupitemgroup[itemize:1][symbol=3,itemalign=middle]`: How are the
arguments handled and is this a generic process or specific to each
command?

Is there a simple way to define a new command/environment and handle
the keyword arguments in Lua? For example defining a frontend command
like this:

\startsomething[firstword={Some},secondword={Text}]
	Body
\stopsomething


which I can handle in some lua code like this:

function something(firstword, secondword, body)
	tex.print(firstword)
	tex.print(secondword)
	tex.print(body)
end

Are there any resources beside the context code itself where I can learn
that?

Gerion

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2023-12-13 17:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 17:13 Gerion Entrup [this message]
2023-12-13 20:57 ` [NTG-context] " Bruce Horrocks
2023-12-14 13:10   ` Gerion Entrup

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=3270809.44csPzL39Z@falbala \
    --to=gerion.entrup@flump.de \
    --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).