summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/strc-lev.mkvi
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/strc-lev.mkvi')
-rw-r--r--tex/context/base/mkiv/strc-lev.mkvi96
1 files changed, 96 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/strc-lev.mkvi b/tex/context/base/mkiv/strc-lev.mkvi
new file mode 100644
index 000000000..dae3f28e3
--- /dev/null
+++ b/tex/context/base/mkiv/strc-lev.mkvi
@@ -0,0 +1,96 @@
+%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 \& \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
+%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\definesectionlevels{\dodoubleargument\strc_levels_define}
+\unexpanded\def\startsectionlevel {\dosingleempty \strc_levels_start }
+
+\unexpanded\def\strc_levels_define[#category][#list]{\clf_definesectionlevels{#category}{#list}}
+\unexpanded\def\strc_levels_start [#category]{\clf_startsectionlevel{#category}}
+\unexpanded\def\stopsectionlevel {\clf_stopsectionlevel}
+
+\unexpanded\def\nostarthead{\dotripleargument\strc_levels_start_nop} % used at the lua end
+\unexpanded\def\nostophead {\dosingleargument\strc_levels_stop_nop } % used at the lua end
+
+\unexpanded\def\strc_levels_start[#category]%
+ {\doifelseassignment{#category}
+ {\clf_startsectionlevel{\v!default}[#category]}
+ {\clf_startsectionlevel{#category}}}
+
+\unexpanded\def\strc_levels_start_nop[#category][#settings][#userdata]%
+ {\blank
+ \noindentation{\tttf[start missing section level #category]}
+ \blank}
+
+\unexpanded\def\strc_levels_stop_nop[#category]%
+ {\blank
+ \noindentation{\tttf[stop missing section level #category]}
+ \blank}
+
+\definesectionlevels
+ [\v!default]
+ [\v!chapter,
+ \v!section,
+ \v!subsection,
+ \v!subsubsection,
+ \v!subsubsubsection,
+ \v!subsubsubsubsection]
+
+
+\let\definestructurelevels\definesectionlevels
+\let\startstructurelevel \startsectionlevel
+\let\stopstructurelevel \stopsectionlevel
+
+\protect \endinput
+
+% \starttext
+%
+% \definehead[xxxxxxsection][subsubsection]
+% \setuphead [xxxxxxsection][color=red]
+%
+% \definesectionlevels[main][chapter,section,subsection,subsubsection]
+% \definesectionlevels[next][chapter,section,subsection,xxxxxxsection]
+%
+% \startsectionlevel [main] [title=first top level]
+%
+% \startsectionlevel [main] [title=first lower level]
+% \startsectionlevel [main] [title=second lower level]
+% \startsectionlevel [main] [title=third lower level]
+% test
+% \stopsectionlevel
+% \stopsectionlevel
+% \stopsectionlevel
+%
+% \startsectionlevel [main] [title=first lower level]
+% \startsectionlevel [main] [title=second lower level]
+% \startsectionlevel [next] [title=third lower level]
+% test
+% \stopsectionlevel
+% \stopsectionlevel
+% \stopsectionlevel
+%
+% \stopsectionlevel
+%
+% \stoptext
+