Skip to content

Commit

Permalink
Merge pull request #87 from Omikhleia/fix-bible-tei
Browse files Browse the repository at this point in the history
fix: Lost headers and leaking styles in bible.tei package
  • Loading branch information
Omikhleia authored Oct 7, 2024
2 parents 3ff6c3d + a432d1d commit e95db43
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions packages/resilient/bible/tei/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ end

function package.outputCollatedNotes (_)
SILE.typesetNaturally(SILE.getFrame("margins"), function ()
local refs = SILE.scratch.info.thispage.witnesses
if not refs then return end

SILE.settings:pushState()
SILE.settings:toplevelState()
SILE.settings:set("current.parindent", SILE.types.node.glue())
Expand All @@ -47,9 +50,6 @@ function package.outputCollatedNotes (_)
"linebreak.hangIndent" }) do
SILE.settings:set(v, SILE.settings.defaults[v])
end
-- SILE.settings:set("typesetter.parfillskip", SILE.types.node.glue())
local refs = SILE.scratch.info.thispage.witnesses
if not refs then return end

local resource
local mainbook = refs[1].book and string.lower(refs[1].book)
Expand Down Expand Up @@ -736,11 +736,16 @@ function package:registerCommands ()
end)

self:registerCommand("body", function (_, content)
-- Ensure headers and folios are enabled.
-- They might have been cancelled by some external front material.
SILE.call("headers")
SILE.call("folios")
-- Register our own headers
SILE.call("running-headers", {}, {
createCommand("font", { family = "Ulfilas" }), {
createCommand("range-reference")
}
})
})
processAsStructure(content)
end)

Expand Down Expand Up @@ -825,7 +830,7 @@ function package:registerCommands ()

SILE.call("save-verse-number", {}, { options.n })
if tonumber(options.n) ~= 1 then
SILE.call("color", { color = "#74101c" }, function()
SILE.call("color", { color = "#74101c" }, function ()
SILE.call("textsuperscript", { fake = true }, { options.n })
end)
SILE.call("kern", { width = "1spc" })
Expand All @@ -838,7 +843,7 @@ function package:registerCommands ()
--if caseNeeded then SILE.typesetter:typeset("¤") end
SILE.call("save-verse-witness", {}, { options.wit })
if options._selected_secondary_ then
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Symbola" }, { "" }) -- FIXME EXPLAIN + Absent from Libertinus
end)
end
Expand Down Expand Up @@ -890,7 +895,7 @@ function package:registerCommands ()
if options._link_ then
SILE.call("increment-counter", { id = "variant" })
local count = self.class.packages.counters:formatCounter(SILE.scratch.counters.variant)
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Libertinus Serif" }, function ()
SILE.call("textsuperscript", { fake = true }, { count })
end)
Expand All @@ -902,7 +907,7 @@ function package:registerCommands ()
ref = "¤"
end
SILE.call("collated-variant", { ref = ref }, function ()
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Libertinus Serif" }, function ()
SILE.call("textsuperscript", { fake = true }, { count })
SILE.call("kern", { width = "0.5en" })
Expand Down Expand Up @@ -932,7 +937,7 @@ function package:registerCommands ()
if emended and not insideLinkingNote then
SILE.call("increment-counter", { id = "emendation" })
count = self.class.packages.counters:formatCounter(SILE.scratch.counters.emendation)
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Libertinus Serif", style = "italic" }, function ()
SILE.call("textsuperscript", { fake = true }, { count })
SILE.call("kern", { width = "0.1em" }) -- pseudo italic correction
Expand Down Expand Up @@ -960,7 +965,7 @@ function package:registerCommands ()
ref = "¤"
end
SILE.call("collated-note", { ref = ref }, function ()
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Libertinus Serif", style = "italic" }, function ()
SILE.call("textsuperscript", { fake = true }, { count })
SILE.call("kern", { width = "0.5en" })
Expand Down Expand Up @@ -1042,15 +1047,15 @@ function package:registerCommands ()
end
SILE.call("increment-counter", { id = "emendation" })
local count = self.class.packages.counters:formatCounter(SILE.scratch.counters.emendation)
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Libertinus Serif", style = "italic" }, function ()
SILE.call("textsuperscript", { fake = true }, { ""..count })
SILE.call("kern", { width = "0.1em" }) -- pseudo italic correction
end)
end)
local ref = lastRef.chapter .. ", " .. lastRef.verse
SILE.call("collated-note", { ref = ref }, function ()
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Libertinus Serif", style = "italic" }, function ()
SILE.call("textsuperscript", { fake = true }, { count })
SILE.call("kern", { width = "0.5en" })
Expand All @@ -1072,15 +1077,15 @@ function package:registerCommands ()
if options._pos_ and options._pos_ > 1 then
SILE.typesetter:typeset(" ")
end
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Libertinus Serif" }, { "" })
end)
if isStructure(content) then
processAsStructure(content)
else
SILE.process(trimSubContent(content))
end
SILE.call("color", { color = "#4682B4" }, function()
SILE.call("color", { color = "#4682B4" }, function ()
SILE.call("font", { family = "Libertinus Serif" }, { "" })
end)
end)
Expand Down Expand Up @@ -1108,7 +1113,7 @@ function package:registerCommands ()
self:registerCommand("opener", function (_, content)
SILE.call("par")
SILE.call("centered-text-block", {}, function ()
SILE.call("color", { color = "#74101c" }, function()
SILE.call("color", { color = "#74101c" }, function ()
SILE.call("font", { size = 13 }, function ()
-- FIXME tracking opener/closer witness is broken
SILE.call("save-chapter-number", {}, {})
Expand All @@ -1126,7 +1131,7 @@ function package:registerCommands ()
SILE.call("novbreak")
SILE.call("centered-text-block", {}, function ()
SILE.call("novbreak")
SILE.call("color", { color = "#74101c" }, function()
SILE.call("color", { color = "#74101c" }, function ()
SILE.call("font", { size = 13 }, function ()
-- FIXME tracking opener/closer witness is broken
SILE.call("save-chapter-number", {}, {})
Expand Down

0 comments on commit e95db43

Please sign in to comment.