[dev-context] \structurevariable

Wolfgang Schuster schuster.wolfgang at googlemail.com
Sat Mar 3 09:51:15 CET 2012


Am 02.03.2012 um 20:55 schrieb Hans Hagen:

> On 24-2-2012 17:52, Wolfgang Schuster wrote:
>> Hi Hans,
>> 
>> the \structurevariable command which can be used the access the value in the headings don’t show any text because context looks into the wrong table.
>> 
>> In strc-doc.lua something like this has to be changed (use the title data subtable):
>> 
>> function sections.structuredata(depth,key,default,honorcatcodetable) -- todo: spec table and then also depth
>>     if depth then
>>         depth = levelmap[depth] or tonumber(depth)
>>     end
>>     if not depth or depth == 0 then
>>         depth = data.depth
>>     end
>>     local data = data.status[depth]
>> --  local d = data
>>     local d = data.titledata
>>>> end
> 
> no, it's a wrong change from split to match ...
> 
>    for k in gmatch(key,"[^%.]+") do
> 
> and then
> 
> \startchapter[title={Hello World},marking={A}][mybla=whatever]
> 
> \starttabulate
> \NC Title    \EQ \namedstructurevariable{chapter}{titledata.title}   \NC\NR
> \NC Marking  \EQ \namedstructurevariable{chapter}{titledata.marking} \NC\NR
> \NC Whatever \EQ \namedstructurevariable{chapter}{userdata.mybla} \NC\NR
> \stoptabulate
> 
> \stopchapter

Writing “titledata.title” is not very convent and it would be better when
\strucuturevariable would always get titledata entries because for userdata
you already provided the \structureuservariable command.

%def\structurevariable           #1{\ctxcommand{structurevariable("#1")}}
\def\structurevariable           #1{\ctxcommand{structurevariable("titledata.#1")}}

Wolfgang


More information about the dev-context mailing list