Am 05.07.10 12:26, schrieb Taco Hoekwater:
On 07/05/2010 11:44 AM, Marius wrote:
On Fri, Jul 2, 2010 at 1:21 PM, Taco Hoekwater<t...@elvenkind.com> wrote:
I think this will be a wasted effort.  I predict that any future
version of context that will be able to do syntax checking is going
to be based on lua for the verification process, not tex macros.

The 'key' checker for \getparameters in mkiv is lua based.
There is already an example implementation of comments reading.

http://gitorious.org/context/context/blobs/master/scripts/context/lua/mtx-modules.lua

cd tex/context/base
mtxrun --script modules --process page-txt.mkiv

see the resulting page-txt-mkiv.ted and page-txt-mkiv.pdf files.
Yes, this functionality has been around for ages, and is the basis of
luigi's typeset source documentation project:

  http://foundry.supelec.fr/gf/project/modules
And a similar mechanism is available to document lua files but
it use xml markup rather than tex (and this since the beginning).
One possible extension would be:

%X <cd:command name="showbodyfont">
%X <cd:sequence>
%X <cd:string value="showbodyfont"/>
%X </cd:sequence>
%X <cd:arguments>
%X <cd:keywords n="1" optional="yes" list="yes">
%X <cd:inherit name="setupbodyfont" n="1"/>
%X </cd:keywords>
%X </cd:arguments>
%X </cd:command>

But that is rather verbose and needs processing to create useful
solution. Another possibility using actual lua could be:

%X showbodyfont = {
%X   seq = { string = "showbodyfont" },
%X   arg = { keywords = {
%X              n=1,list=true, optional=true,
%X              inherit={ name = "setupbodyfont", n = 1}}}}

Essentially the same information, but shorter, and it could
be loaded into lua directly using 'loadstring'. Or there could
be a more TeX-like approach looking like this:

%X \cmd{showbodyfont}([...,...,...])->#1:\inherited{setupbodyfont}

to be parsed by a bit of lua code.

It all depends on what Hans is most comfortable with in keying in,
because if Hans doesn't like it the chances of anything like this
remaining up-to-date are about zero.
I'm against storing the command definition in the relevant files because
the definitions are meant for documentation and it's nonsense in this way
because you need sometimes references to other commands and who should
you show a command for spacing which is written in a font file.

Another problem is that big macros like \section or \setuphead are split
over different files (strc-sec.mkiv, strc-doc.mkiv, strc-doc.lua and strc-ren.mkiv)
and when you store the \section definition now in strc-sec.mkiv but make
a change in strc-ren.mkiv you will forget to add the change in the definition
file are too high.

From your two different variants i prefer the lua solution because it's
closer to the current xml version and it's easier to add variants of
a command (e.g. \setupinterlinespace[small] and \setupinterlinespace[line=...])

Wolfgang

_______________________________________________
dev-context mailing list
dev-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/dev-context

Reply via email to