Extension 2.10.0, study field, German "Abschnitt" for sections; rebuild

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
MatsuneMikuroiandClaude Opus 5.5 committed 2026-10-16 23:59:30 +02:00
1 parent f047b9c7ae
commit d74a2e90b4
88 files changed
+874 -437

No files matched your search

+30 -1
View File
@@ -512,6 +512,28 @@ local function chapter_label(n)
return nil
end
-- Quarto numbers appendices 1, 2, ... like chapters, while the book shows
-- them as A, B, ...: the files after the render list's "appendix" divider
-- are appendices, and their quizzes are A.1, A.2, ...
local function appendix_files(meta)
local set, after = {}, false
if meta.book == nil or meta.book.render == nil then return set end
for _, item in ipairs(meta.book.render) do
if str(item.type) == "appendix" then
after = true
elseif after and item.file ~= nil then
set[basename(str(item.file))] = true
end
end
return set
end
local function appendix_letter(n)
local k = tonumber(n)
if k == nil or k < 1 or k > 26 then return n end
return string.char(64 + math.floor(k))
end
-- HTML books render one chapter per run: its number comes from the book
local function book_number_of_input(meta)
if quarto == nil or quarto.doc == nil or quarto.doc.input_file == nil then return nil end
@@ -520,7 +542,10 @@ local function book_number_of_input(meta)
for _, item in ipairs(meta.book.render) do
local file = str(item.file)
if file ~= nil and (input == file or input:sub(-#file - 1) == "/" .. file) then
return item.number ~= nil and str(item.number) or nil
if item.number == nil then return nil end
local n = str(item.number)
if appendix_files(meta)[basename(file)] then n = appendix_letter(n) end
return n
end
end
return nil
@@ -529,6 +554,7 @@ end
local function walk(doc)
local is_latex, is_html = fmt_is("latex"), fmt_is("html")
local next_number = book_number_of_input(doc.meta)
local appendices = appendix_files(doc.meta)
local chapter, chapter_n, cnt = next_number, tonumber(next_number) or 0, 0
local pending = {}
local out = pandoc.Blocks({})
@@ -546,6 +572,9 @@ local function walk(doc)
if marker ~= nil then
if is_latex then flush() end
next_number = chapter_label(marker.bookItemNumber)
if next_number ~= nil and appendices[basename(marker.bookItemFile)] then
next_number = appendix_letter(next_number)
end
chapter, cnt = nil, 0
out:insert(b)
elseif b.t == "Header" and b.level == 1 then