summaryrefslogtreecommitdiff
path: root/tex/context/base/strc-lev.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/strc-lev.mkiv')
-rw-r--r--tex/context/base/strc-lev.mkiv78
1 files changed, 78 insertions, 0 deletions
diff --git a/tex/context/base/strc-lev.mkiv b/tex/context/base/strc-lev.mkiv
new file mode 100644
index 000000000..4f4745e9b
--- /dev/null
+++ b/tex/context/base/strc-lev.mkiv
@@ -0,0 +1,78 @@
+%D \module
+%D [ file=strc-lev,
+%D version=2010.09.23,
+%D title=\CONTEXT\ Structure Macros,
+%D subtitle=Automatic Levels,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=PRAGMA-ADE / Hans Hagen]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Structure Macros / Automatic Levels}
+
+%D This module is the result of a discussion between Alan Braslau and
+%D me. I used to have a private (\MKII) module for this but the new
+%D structure code in \MKIV\ is more suitable for this so now we have
+%D it as core functionality. For the moment this an experiment that
+%D Alan and I conduct so it might evolve.
+
+\registerctxluafile{strc-lev}{1.001}
+
+\unprotect
+
+\unexpanded\def\definestructurelevels{\dodoubleargument\dodefinestructurelevels}
+\unexpanded\def\startstructurelevel {\dosingleargument\dostartstructurelevel}
+
+\unexpanded\def\dodefinestructurelevels[#1][#2]{\ctxlua{structures.sections.defineautolevels("#1","#2")}}
+\unexpanded\def\dostartstructurelevel [#1]{\ctxlua{structures.sections.startautolevel("#1")}}
+\unexpanded\def\stopstructurelevel {\ctxlua{structures.sections.stopautolevel()}}
+
+\unexpanded\def\nostartstructurehead{\dotripleargument\nonostartstructurehead}
+\unexpanded\def\nostopstructurehead {\dosingleargument\nonostopstructurehead }
+
+\unexpanded\def\nonostartstructurehead[#1][#2][#3]%
+ {\blank
+ \noindentation{\tttf[start missing structure level #1]}
+ \blank}
+
+\unexpanded\def\nonostopstructurehead[#1]%
+ {\blank
+ \noindentation{\tttf[stop missing structure level #1]}
+ \blank}
+
+\protect \endinput
+
+% \starttext
+
+% \definehead[xxxxxxsection][subsubsection]
+% \setuphead [xxxxxxsection][color=red]
+
+% \definestructurelevels[main][chapter,section,subsection,subsubsection]
+% \definestructurelevels[next][chapter,section,subsection,xxxxxxsection]
+
+% \startstructurelevel [main] [title=first top level]
+
+% \startstructurelevel [main] [title=first lower level]
+% \startstructurelevel [main] [title=second lower level]
+% \startstructurelevel [main] [title=third lower level]
+% test
+% \stopstructurelevel
+% \stopstructurelevel
+% \stopstructurelevel
+
+% \startstructurelevel [main] [title=first lower level]
+% \startstructurelevel [main] [title=second lower level]
+% \startstructurelevel [next] [title=third lower level]
+% test
+% \stopstructurelevel
+% \stopstructurelevel
+% \stopstructurelevel
+
+% \stopstructurelevel
+
+
+% \stoptext
+