diff options
Diffstat (limited to 'tex/context/base/strc-doc.lua')
-rw-r--r-- | tex/context/base/strc-doc.lua | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua index 66b30fe3a..885e2de0b 100644 --- a/tex/context/base/strc-doc.lua +++ b/tex/context/base/strc-doc.lua @@ -240,26 +240,36 @@ function sections.setblock(name,settings) return block end +local jobvariables = job.variables local pushed_order = { } local pushed_done = { } -function sections.order() - return job.variables.collected.sectionblockorder or pushed_order -- so we have a first pass list too +jobvariables.tobesaved.sectionblockorder = pushed_order + +-- function sections.order() +-- return jobvariables.collected.sectionblockorder or pushed_order -- so we have a first pass list too +-- end + +function sections.setinitialblock(default) + local order = jobvariables.collected.sectionblockorder or pushed_order + local name = #order > 0 and order[1] or default or "bodypart" + context.setsectionblock { name } + -- interfaces.setmacro("currentsectionblock",name) + -- sections.setblock(name,{}) end function sections.pushblock(name,settings) counters.check(0) -- we assume sane usage of \page between blocks local block = name or data.block + insert(data.blocks,block) + data.block = block + sectionblockdata[block] = settings + documents.reset() if not pushed_done[name] then pushed_done[name] = true local nofpushed = #pushed_order + 1 pushed_order[nofpushed] = name - job.variables.tobesaved.sectionblockorder = pushed_order end - insert(data.blocks,block) - data.block = block - sectionblockdata[block] = settings - documents.reset() return block end @@ -1107,6 +1117,13 @@ implement { } implement { + name = "setinitialsectionblock", + actions = sections.setinitialblock, + arguments = "string", + -- onlyonce = true, +} + +implement { name = "pushsectionblock", actions = sections.pushblock, arguments = { "string", { { "bookmark" } } } @@ -1116,16 +1133,3 @@ implement { name = "popsectionblock", actions = sections.popblock, } - --- bah, i'll probably forget about this hack but it's needed for --- preamble list mess as used by some users for booksmarks - -implement { - name = "setinitialsectionblock", - onlyonce = true, - arguments = "string", - actions = function(default) - local name = sections.order()[1] - context.setsectionblock { name ~= "" and name or default } - end -} |