summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/strc-lev.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-lev.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/strc-lev.lua24
1 files changed, 14 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-lev.lua b/Master/texmf-dist/tex/context/base/strc-lev.lua
index ff30c3f91ad..4ca049d7a20 100644
--- a/Master/texmf-dist/tex/context/base/strc-lev.lua
+++ b/Master/texmf-dist/tex/context/base/strc-lev.lua
@@ -18,29 +18,33 @@ local level, levels, categories = 0, sections.levels, { }
storage.register("structures/sections/levels", levels, "structures.sections.levels")
-function sections.defineautolevels(category,list)
+function commands.definesectionlevels(category,list)
levels[category] = utilities.parsers.settings_to_array(list)
end
-function sections.startautolevel(category)
+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.nostartstructurehead { format("%s:%s",category,level) }
+ context.nostarthead { format("%s:%s",category,level) }
else
- context.dostartstructurehead { lc[level] }
+ context.dostarthead { lc[level] }
end
insert(categories,category)
end
-function sections.stopautolevel()
+function commands.stopsectionlevel()
local category = remove(categories)
- local lc = levels[category]
- if not lc or level > #lc then
- context.nostopstructurehead { format("%s:%s",category,level) }
+ if category then
+ local lc = levels[category]
+ if not lc or level > #lc then
+ context.nostophead { format("%s:%s",category,level) }
+ else
+ context.dostophead { lc[level] }
+ end
+ level = level - 1
else
- context.dostopstructurehead { lc[level] }
+ -- error
end
- level = level - 1
end