diff options
author | Marius <mariausol@gmail.com> | 2010-09-23 14:14:06 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-09-23 14:14:06 +0300 |
commit | a49b33bed6bfefa523e1a79d6064e589cc877f3a (patch) | |
tree | f899cf7380f350cf32cd1a0d55b5c97d70b0efcf /tex | |
parent | 67de007ca8a495a935865f960bd5e44d57b090ec (diff) | |
download | context-a49b33bed6bfefa523e1a79d6064e589cc877f3a.tar.gz |
beta 2010.09.23 11:35
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.tex | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 1 | ||||
-rw-r--r-- | tex/context/base/context.tex | 2 | ||||
-rw-r--r-- | tex/context/base/strc-lev.lua | 40 | ||||
-rw-r--r-- | tex/context/base/strc-lev.mkiv | 78 | ||||
-rw-r--r-- | tex/generic/context/luatex-fonts-merged.lua | 2 |
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 |