summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/strc-doc.mkiv
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2012-05-14 17:38:55 +0000
commit15995e10bfc68edf79970c4ea4fbb6678566c46e (patch)
tree2de7ca2a83f2d37ef043ad7429a5cb945bb79ddb /Master/texmf-dist/tex/context/base/strc-doc.mkiv
parentc9a39f716f1e5ec820ed3aab2c9aef25c5a9d730 (diff)
ConTeXt 2012.05.14 16:00
git-svn-id: svn://tug.org/texlive/trunk@26371 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-doc.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/strc-doc.mkiv84
1 files changed, 54 insertions, 30 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-doc.mkiv b/Master/texmf-dist/tex/context/base/strc-doc.mkiv
index 683d65d2f0f..4e9dec32e57 100644
--- a/Master/texmf-dist/tex/context/base/strc-doc.mkiv
+++ b/Master/texmf-dist/tex/context/base/strc-doc.mkiv
@@ -5,7 +5,7 @@
%D subtitle=Document Structure,
%D author=Hans Hagen,
%D date=\currentdate,
-%D copyright=PRAGMA-ADE / Hans Hagen]
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
@@ -24,18 +24,15 @@
% that accepts multiple arguments. We might change this approach and
% remove this layer but it was needed for the transition.
-\def\currentstructurecounter{0}
+\installcorenamespace{structure}
-\definesystemvariable {ns}
+\installdirectcommandhandler \??structure {structure} % unchecked, so we need to initialize used parameters
-\def\structureparameter#1{\csname\??ns#1\endcsname}
+% \definesystemvariable{ns}
+% \def\structureparameter#1{\csname\??ns#1\endcsname}
+% \def\detokenizedstructureparameter#1{\detokenize\expandafter\expandafter\expandafter{\csname\??ns#1\endcsname}}
-\def\detokenizedstructureparameter#1{\detokenize\expandafter\expandafter\expandafter{\csname\??ns#1\endcsname}}
-
-\def\structurecomponent{\dodoubleempty\dostructurecomponent}
-
-\getparameters % initialization, used not grouped anyway
- [\??ns]
+\setupstructure % not a user command so we might need to change the name
[\c!number=,
\c!level=,
\c!name=,
@@ -53,6 +50,7 @@
\c!sectionsegments=,
\c!sectionresetset=,
\c!reference=,
+ \c!backreference=,
\c!expansion=\v!no,
\c!xmlsetup=,
\s!catcodes=,
@@ -60,12 +58,30 @@
\c!command=\showstructuredata]
% maybe flags for list, bm, mark
-%
-% hm messed up
+
+\def\structurereferenceprefixon {+}
+\def\structurereferenceprefixoff{-}
+
+\def\setstructurereferenceprefix
+ {\ifx\currentstructurereferenceprefix\empty
+ % nothing
+ \else\ifx\currentstructurereferenceprefix\structurereferenceprefixon
+ \setupglobalreferenceprefix[\currentstructurereference]%
+ \else\ifx\currentstructurereferenceprefix\structurereferenceprefixoff
+ \setupglobalreferenceprefix[]%
+ \else
+ \setupglobalreferenceprefix[\currentstructurereferenceprefix]%
+ \fi\fi\fi
+ \let\currentstructurereferenceprefix\referenceprefix}
+
+% why xdef ?
+
+\unexpanded\def\structurecomponent
+ {\dodoubleempty\dostructurecomponent}
\def\dostructurecomponent[#1][#2]% #1=interfaced-settings, #2=optional user data (not yet supported)
{\begingroup
- \getparameters[\??ns][#1]%
+ \setupstructure[#1]%
\xdef\currentstructurename {\structureparameter\c!name}%
\xdef\currentstructurecoupling {\structureparameter\c!coupling}%
\xdef\currentstructureownnumber {\structureparameter\c!ownnumber}% optional own number
@@ -115,11 +131,12 @@
\globallet\currentstructurecoding\s!tex
\fi
\setnextinternalreference
+ \setstructurereferenceprefix
\xdef\currentstructurenumber{\ctxlua{ % todo: combine with next call, adapt marks accordingly
structures.sections.somelevel {
references = {
internal = \nextinternalreference,
- block = "\currentstructureblock",
+ block = "\currentsectionblock",
reference = "\currentstructurereference",
referenceprefix = "\currentstructurereferenceprefix",
backreference = "\currentstructurebackreference",
@@ -162,7 +179,7 @@
},
numberdata = {
% needed ?
- block = "\currentstructureblock",
+ block = "\currentsectionblock",
hidenumber = \ifx\currentstructureshownumber\v!no true\else nil\fi, % titles
% so far
separatorset = "\structureparameter\c!sectionseparatorset",
@@ -174,22 +191,24 @@
segments = "\structureparameter\c!sectionsegments",
ownnumber = "\currentstructureownnumber",
},
- userdata = structures.helpers.touserdata(\!!bs\detokenize{#2}\!!es)
+ userdata = \!!bs\detokenize{#2}\!!es % will be converted to table at the lua end
}
}}%
- \xdef\currentstructurelistnumber{\ctxlua{structures.lists.push(structures.sections.current())}}%
+ \xdef\currentstructurelistnumber{\ctxcommand{addtolist(structures.sections.current())}}%
% \currentstructuresynchronize has to be called someplace, since it introduces a node
\setstructuresynchronization\currentstructurelistnumber
\structureparameter\c!command
\endgroup}
-\let\currentstructurenumber \!!zerocount
-\let\currentstructurecounter \!!zerocount
-\let\previousstructurecounter\!!zerocount
+\let\currentstructurenumber \!!zerocount
+\let\currentsectioncountervalue \!!zerocount % redefined later
+\let\previoussectioncountervalue\!!zerocount % redefined later
+
+% todo: a direct flusher (needed when hidden)
-\def\setstructuresynchronization#1%
- {\xdef\currentstructureattribute {\ctxlua {tex.write(structures.references.setinternalreference("\currentstructurereferenceprefix","\currentstructurereference",\nextinternalreference,"\interactionparameter\c!focus"))}}%
- \xdef\currentstructuresynchronize{\ctxlatelua{structures.lists.enhance(#1)}}}
+\def\setstructuresynchronization#1% todo: use ctxcontext
+ {\xdef\currentstructureattribute {\ctxlua {tex.write(structures.references.setinternalreference("\currentstructurereferenceprefix","\currentstructurereference",\nextinternalreference,"\interactionparameter\c!focus"))}}%
+ \xdef\currentstructuresynchronize{\ctxlatecommand{enhancelist(#1)}}}
\def\reportcurrentstructure{\ctxlua{structures.sections.reportstructure()}}
@@ -221,12 +240,17 @@
% \stopchapter
% \stoptext
-\def\structurevariable #1{\ctxlua{structures.sections.structuredata(nil,"#1")}}
-\def\structureuservariable #1{\ctxlua{structures.sections.userdata(nil,"#1")}}
-\def\structurenumber {\ctxlua{structures.sections.fullnumber()}}
-\def\structuretitle {\ctxlua{structures.sections.title()}}
-\def\structurecatcodedget #1{\ctxlua{structures.sections.structuredata(nil,"#1",nil,true)}} % bad name
-\def\structuregivencatcodedget#1#2{\ctxlua{structures.sections.structuredata(nil,"#1",nil,\number#2)}} % bad name
-\def\structureautocatcodedget #1#2{\ctxlua{structures.sections.structuredata(nil,"#1",nil,"#2")}}
+% todo: #1 => "#1" ... adapt lua code for name and number
+
+\def\structurenumber {\ctxcommand{structurenumber()}}
+\def\structuretitle {\ctxcommand{structuretitle()}}
+\def\structurevariable #1{\ctxcommand{structurevariable("#1")}}
+\def\structureuservariable #1{\ctxcommand{structureuservariable("#1")}}
+\def\structurecatcodedget #1{\ctxcommand{structurecatcodedget("#1")}} % bad name
+\def\structuregivencatcodedget #1#2{\ctxcommand{structuregivencatcodedget("#1",\number#2)}} % bad name
+\def\structureautocatcodedget #1#2{\ctxcommand{structureautocatcodedget ("#1","#2")}}
+
+\def\namedstructurevariable #1#2{\ctxcommand{namedstructurevariable ("#1","#2")}}
+\def\namedstructureuservariable#1#2{\ctxcommand{namedstructureuservariable("#1","#2")}}
\protect \endinput