[dev-context] context commands in lua-files

Hans Hagen pragma at wxs.nl
Sun Jul 18 12:18:31 CEST 2010

On 18-7-2010 8:09, Taco Hoekwater wrote:
> On 07/17/2010 09:32 PM, Peter Münster wrote:
>> On Sat, Jul 17 2010, luigi scarso wrote:
>>> Why don't put them into a table as is in
>>> http://www.lua.org/pil/10.1.html
>> Ok, now one file defines exactly one "command" table.
>> I added also other minor enhancements.
> If you start your files like this:
> command = command or {}
> command['placefloat'] = {
> comment = "Insert a floating element.",
> ...
> }
> then they could easily all be merged into a single command table
> during loading or even via 'cat'.

I'd rather go for this (see lfg file for examples):

return {
     name = "placefloat",
     version = "1.00",
     comment = "Insert a floating element.",

and give the files names like placefloat.cid (context interface 
definition) and then load them using a lua script (this also permits us 
to load several definitions named placefloat e.g. for comparison of 

Another aspect is shared definitions. Settings like style and align are 
often shared so there we need a way to refer to that like

align = interfaces.resolve("align"),

and so. In a similar way inheritance can be dealt with.

I'm not sure what the final purpose of this exercise is (intended usage 
and so), but if it's to be integrated (or loaded in context) it has to 
fit in the general way such data is stored. In that case I have to make 
a loader (in the interfaces namespace), one that probably drops not 
needed data, and caches relevant info for runtime usage. Also, as I 
cannot drop the xml counterpart now so I need to be able to generate 
that file from it as I don't want to keep that (also mkii) downward 
compatibility aspect (once the lua format is known I can do the reverse 
as exercise), so we need at least the level of detail from the xml file, 
including value types and (this cd:number tagging).

So, given this thread .. can we summarize the state of a couple of 
commands? Say:

- setupframed (inherited)
- framed (inherits, resolving)
- setupheadertexts (several arg configurations)
- externalfigure (several arg configurations)
- itemize (start command)


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl

More information about the dev-context mailing list