summaryrefslogtreecommitdiff
path: root/tex/context/base/strc-lev.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/strc-lev.lua')
-rw-r--r--tex/context/base/strc-lev.lua102
1 files changed, 51 insertions, 51 deletions
diff --git a/tex/context/base/strc-lev.lua b/tex/context/base/strc-lev.lua
index 50a63c938..016aa2039 100644
--- a/tex/context/base/strc-lev.lua
+++ b/tex/context/base/strc-lev.lua
@@ -1,51 +1,51 @@
-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 insert, remove = table.insert, table.remove
-
-local sections = structures.sections
-local default = interfaces.variables.default
-
-sections.levels = sections.levels or { }
-
-local level, levels, categories = 0, sections.levels, { }
-
-storage.register("structures/sections/levels", levels, "structures.sections.levels")
-
-local f_two_colon = string.formatters["%s:%s"]
-
-function commands.definesectionlevels(category,list)
- levels[category] = utilities.parsers.settings_to_array(list)
-end
-
-function commands.startsectionlevel(category)
- category = category ~= "" and category or default
- level = level + 1
- local lc = levels[category]
- if not lc or level > #lc then
- context.nostarthead { f_two_colon(category,level) }
- else
- context.dostarthead { lc[level] }
- end
- insert(categories,category)
-end
-
-function commands.stopsectionlevel()
- local category = remove(categories)
- if category then
- local lc = levels[category]
- if not lc or level > #lc then
- context.nostophead { f_two_colon(category,level) }
- else
- context.dostophead { lc[level] }
- end
- level = level - 1
- else
- -- error
- end
-end
+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 insert, remove = table.insert, table.remove
+
+local sections = structures.sections
+local default = interfaces.variables.default
+
+sections.levels = sections.levels or { }
+
+local level, levels, categories = 0, sections.levels, { }
+
+storage.register("structures/sections/levels", levels, "structures.sections.levels")
+
+local f_two_colon = string.formatters["%s:%s"]
+
+function commands.definesectionlevels(category,list)
+ levels[category] = utilities.parsers.settings_to_array(list)
+end
+
+function commands.startsectionlevel(category)
+ category = category ~= "" and category or default
+ level = level + 1
+ local lc = levels[category]
+ if not lc or level > #lc then
+ context.nostarthead { f_two_colon(category,level) }
+ else
+ context.dostarthead { lc[level] }
+ end
+ insert(categories,category)
+end
+
+function commands.stopsectionlevel()
+ local category = remove(categories)
+ if category then
+ local lc = levels[category]
+ if not lc or level > #lc then
+ context.nostophead { f_two_colon(category,level) }
+ else
+ context.dostophead { lc[level] }
+ end
+ level = level - 1
+ else
+ -- error
+ end
+end