[dev-context] \structurevariable

Wolfgang Schuster schuster.wolfgang at googlemail.com
Fri Feb 24 17:52:58 CET 2012


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

Example:

\setupheadertexts[chapter]

\define[2]\ChapterCommand
  {\vbox\bgroup\starttabulate
   \NC Title   \EQ \structurevariable{title}   \NC\NR
   \NC Marking \EQ \structurevariable{marking} \NC\NR
   \stoptabulate\egroup}

\setuphead[chapter][command=\ChapterCommand]

\starttext

\startchapter[title={Hello World},marking={A}]

\starttabulate
\NC Title   \EQ \namedstructurevariable{chapter}{title}   \NC\NR
\NC Marking \EQ \namedstructurevariable{chapter}{marking} \NC\NR
\stoptabulate

\stopchapter

\stoptext

Wolfgang


More information about the dev-context mailing list