summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2010-09-23 11:35:00 +0200
committerHans Hagen <pragma@wxs.nl>2010-09-23 11:35:00 +0200
commit43022156592c9bb4e359c03c283160de7f3b5b1c (patch)
treedfe854beb3d524ba0d560f9b946ab6622f2fd98f /tex
parentc1f0465c97636a4874e0d230c2e61cdf28ac3532 (diff)
downloadcontext-43022156592c9bb4e359c03c283160de7f3b5b1c.tar.gz
beta 2010.09.23 11:35
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.mkiv1
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/strc-lev.lua40
-rw-r--r--tex/context/base/strc-lev.mkiv78
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua2
6 files changed, 122 insertions, 3 deletions
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 982c3a257..9f8b62cc3 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2010.09.23 01:03}
+\newcontextversion{2010.09.23 11:35}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 3a285fc9d..03b56943a 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -181,6 +181,7 @@
\loadmarkfile{strc-def} % might happen later
\loadmarkfile{strc-ref}
\loadmarkfile{strc-reg}
+\loadmarkfile{strc-lev} % experiment
\loadmarkfile{spac-hor}
\loadmarkfile{spac-ver}
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 91806c685..08aa83d6b 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2010.09.23 01:03}
+\edef\contextversion{2010.09.23 11:35}
%D For those who want to use this:
diff --git a/tex/context/base/strc-lev.lua b/tex/context/base/strc-lev.lua
new file mode 100644
index 000000000..cacbc9788
--- /dev/null
+++ b/tex/context/base/strc-lev.lua
@@ -0,0 +1,40 @@
+if not modules then modules = { } end modules ['strc-lev'] = {
+ version = 1.001,
+ comment = "companion to strc-lev.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local format = string.format
+local insert, remove = table.insert, table.remove
+
+local sections = structures.sections
+
+local level, levels, categories = 0, { }, { }
+
+function sections.defineautolevels(category,list)
+ levels[category] = utilities.parsers.settings_to_array(list)
+end
+
+function sections.startautolevel(category)
+ level = level + 1
+ local lc = levels[category]
+ if not lc or level > #lc then
+ context.nostartstructurehead { format("%s:%s",category,level) }
+ else
+ context.dostartstructurehead { lc[level] }
+ end
+ insert(categories,category)
+end
+
+function sections.stopautolevel()
+ local category = remove(categories)
+ local lc = levels[category]
+ if not lc or level > #lc then
+ context.nostopstructurehead { format("%s:%s",category,level) }
+ else
+ context.dostopstructurehead { lc[level] }
+ end
+ level = level - 1
+end
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
+
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index d785622ec..de0d529c0 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 09/23/10 01:03:41
+-- merge date : 09/23/10 11:35:08
do -- begin closure to overcome local limits and interference