diff options
author | Karl Berry <karl@freefriends.org> | 2013-04-08 00:43:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-04-08 00:43:40 +0000 |
commit | 824f7b0903de8ad7f6ee3d7656005e4c59155e06 (patch) | |
tree | abfc8673ef9916f3ab7074e811207384c301492b /Master/texmf-dist/tex/context/base/strc-doc.mkiv | |
parent | 689aefb0727676ed3cddf331337b4be226495e72 (diff) |
context import for TL13, from www.pragma-ade.com/context/beta/cont-tmf.zip
git-svn-id: svn://tug.org/texlive/trunk@29731 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.mkiv | 234 |
1 files changed, 2 insertions, 232 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-doc.mkiv b/Master/texmf-dist/tex/context/base/strc-doc.mkiv index 4e9dec32e57..c8dfae1e422 100644 --- a/Master/texmf-dist/tex/context/base/strc-doc.mkiv +++ b/Master/texmf-dist/tex/context/base/strc-doc.mkiv @@ -17,240 +17,10 @@ \unprotect -\def\c!xmlsetup{xmlsetup} +%D This will move: -% We operate in a \type {@@ns} namespace. All data is passed through -% variables. Of course we can built another interface on top of this -% that accepts multiple arguments. We might change this approach and -% remove this layer but it was needed for the transition. - -\installcorenamespace{structure} - -\installdirectcommandhandler \??structure {structure} % unchecked, so we need to initialize used parameters - -% \definesystemvariable{ns} -% \def\structureparameter#1{\csname\??ns#1\endcsname} -% \def\detokenizedstructureparameter#1{\detokenize\expandafter\expandafter\expandafter{\csname\??ns#1\endcsname}} - -\setupstructure % not a user command so we might need to change the name - [\c!number=, - \c!level=, - \c!name=, - \c!title=, - \c!bookmark=, - \c!marking=, - \c!list=, - \c!label=, - \c!coupling=, - \c!ownnumber=, - \c!sectionseparatorset=\s!default, - \c!sectionconversionset=\s!default, - \c!sectionstopper=, - \c!sectionstarter=, - \c!sectionsegments=, - \c!sectionresetset=, - \c!reference=, - \c!backreference=, - \c!expansion=\v!no, - \c!xmlsetup=, - \s!catcodes=, - \c!saveinlist=\v!yes, - \c!command=\showstructuredata] - -% maybe flags for list, bm, mark - -\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 - \setupstructure[#1]% - \xdef\currentstructurename {\structureparameter\c!name}% - \xdef\currentstructurecoupling {\structureparameter\c!coupling}% - \xdef\currentstructureownnumber {\structureparameter\c!ownnumber}% optional own number - \xdef\currentstructurelevel {\structureparameter\c!level}% - \edef\currentstructureexpansion {\structureparameter\c!expansion}% - \xdef\currentstructurexmlsetup {\structureparameter\c!xmlsetup}% - \xdef\currentstructurecatcodes {\structureparameter\s!catcodes}% - \xdef\currentstructurelabel {\structureparameter\c!label}% - \xdef\currentstructurereference {\structureparameter\c!reference}% - \xdef\currentstructurereferenceprefix{\structureparameter\c!referenceprefix}% - \xdef\currentstructurebackreference {\structureparameter\c!backreference}% - \xdef\currentstructureshownumber {\structureparameter\c!number}% - \xdef\currentstructuresaveinlist {\structureparameter\c!saveinlist}% - \xdef\currentstructureincrementnumber{\structureparameter\c!incrementnumber}% - \ifx\currentstructureexpansion\s!xml - \xmlstartraw - \xdef\currentstructuretitle {\structureparameter\c!title}% - \xdef\currentstructurebookmark{\structureparameter\c!bookmark}% - \xdef\currentstructuremarking {\structureparameter\c!marking}% - \xdef\currentstructurelist {\structureparameter\c!list}% - \xmlstopraw - \ifx\currentstructurelist\empty - \globallet\currentstructurelist\currentstructuretitle - \fi - \globallet\currentstructurecoding\s!xml - \else - \ifx\currentstructureexpansion\v!yes - \xdef\currentstructuretitle {\structureparameter\c!title}% - \xdef\currentstructurebookmark{\structureparameter\c!bookmark}% - \xdef\currentstructuremarking {\structureparameter\c!marking}% - \xdef\currentstructurelist {\structureparameter\c!list}% - \else - \xdef\currentstructuretitle {\detokenizedstructureparameter\c!title}% - \xdef\currentstructurebookmark{\detokenizedstructureparameter\c!bookmark}% - \xdef\currentstructuremarking {\detokenizedstructureparameter\c!marking}% - \xdef\currentstructurelist {\detokenizedstructureparameter\c!list}% - \iflocation \ifx\currentstructurebookmark\empty - \begingroup - \simplifycommands - \xdef\currentstructurebookmark{\detokenize\expandafter{\normalexpanded{\structureparameter\c!title}}}% - \endgroup - \fi \fi - \fi - \ifx\currentstructurelist\empty - \globallet\currentstructurelist\currentstructuretitle - \fi - \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 = "\currentsectionblock", - reference = "\currentstructurereference", - referenceprefix = "\currentstructurereferenceprefix", - backreference = "\currentstructurebackreference", - }, - directives = { - resetset = "\structureparameter\c!sectionresetset", - }, - metadata = { - kind = "section", - name = "\currentstructurename", - catcodes = \the\ifx\currentstructurecatcodes\empty\catcodetable\else\csname\currentstructurecatcodes\endcsname\fi, - coding = "\currentstructurecoding", - \ifx\currentstructurecoding\s!xml - xmlroot = "\xmldocument", - \fi - \ifx\currentstructurexmlsetup\empty \else - xmlsetup = "\currentstructurexmlsetup", - \fi - \ifx\currentstructuresaveinlist\v!no - nolist = true, - \fi - \ifx\currentstructureincrementnumber\v!yes - increment = "\currentstructureincrementnumber", - \fi - }, - titledata = { % we can add mark and reference - label = \!!bs\detokenize\expandafter{\currentstructurelabel }\!!es, - title = \!!bs\detokenize\expandafter{\currentstructuretitle }\!!es, - \ifx\currentstructurebookmark\currentstructuretitle \else - bookmark = \!!bs\detokenize\expandafter{\currentstructurebookmark }\!!es, - \fi - \ifx\currentstructuremarking\currentstructuretitle \else - marking = \!!bs\detokenize\expandafter{\currentstructuremarking }\!!es, - \fi - \ifx\currentstructuresaveinlist\v!no \else - \ifx\currentstructurelist\currentstructuretitle \else - list = \!!bs\detokenize\expandafter{\currentstructurelist}\!!es, - \fi - \fi - }, - numberdata = { - % needed ? - block = "\currentsectionblock", - hidenumber = \ifx\currentstructureshownumber\v!no true\else nil\fi, % titles - % so far - separatorset = "\structureparameter\c!sectionseparatorset", - conversion = "\structureparameter\c!sectionconversion", % for good old times sake - conversionset = "\structureparameter\c!sectionconversionset", - starter = \!!bs\structureparameter\c!sectionstarter\!!es, - stopper = \!!bs\structureparameter\c!sectionstopper\!!es, - set = "\structureparameter\c!sectionset", - segments = "\structureparameter\c!sectionsegments", - ownnumber = "\currentstructureownnumber", - }, - userdata = \!!bs\detokenize{#2}\!!es % will be converted to table at the lua end - } - }}% - \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\currentsectioncountervalue \!!zerocount % redefined later -\let\previoussectioncountervalue\!!zerocount % redefined later - -% todo: a direct flusher (needed when hidden) - -\def\setstructuresynchronization#1% todo: use ctxcontext +\unexpanded\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()}} - -% Beware: we need to flush the data to the list explicitly. This is because -% node in inserted and we may want control over when that happens. - -\def\showstructuredata - {\par - \dontleavehmode\begingroup - \currentstructuresynchronize - \currentstructureattribute - [\currentstructurename: \showstructurelevel: \currentstructuretitle] - \endgroup\par} - -% We can access the (stored) data with the following macros. -% -% \def\MyHeadCommand #1#2{\framed{#1}\framed{#2 / \structureuservariable{subtitle}}} -% \def\MyListCommand#1#2#3{\externalfigure[\structurelistuservariable{figure}][height=5mm]#2} -% -% \setuphead[chapter][command=\MyHeadCommand] -% \setuplist[chapter][alternative=command,command=\MyListCommand] -% -% \starttext -% \setupheadertexts[chapter] -% \setupinteraction[state=start] -% \placebookmarks[chapter] -% \placelist[chapter] -% \startchapter[ownnumber=10,title=Ton,list=Hans,marking=Kees,bookmark=Bram][figure=cow.pdf,subtitle=oeps] -% \stopchapter -% \stoptext - -% 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 |