Skip to content

Commit

Permalink
fix(typesetters): Obey blank lines in verbatim-like context
Browse files Browse the repository at this point in the history
  • Loading branch information
Omikhleia authored and Didier Willis committed Oct 10, 2024
1 parent fbe610c commit e9fd3b0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion typesetters/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,25 @@ function typesetter:typeset (text)
return
end
local pId = SILE.traceStack:pushText(text)
for token in SU.gtoke(text, SILE.settings:get("typesetter.parseppattern")) do
local parsepattern = SILE.settings:get("typesetter.parseppattern")
-- NOTE: Big assumption on how to guess were are in "obeylines" mode.
-- See https://github.com/sile-typesetter/sile/issues/2128
local obeylines = parsepattern == "\n"

local seenParaContent = true
for token in SU.gtoke(text, parsepattern) do
if token.separator then
if obeylines and not seenParaContent then
-- In obeylines mode, each standalone line must be kept.
-- The zerohbox is not discardable, so it will be kept in the output,
-- and the baseline skip will do the rest.
self:pushHorizontal(SILE.types.node.zerohbox())
else
seenParaContent = false
end
self:endline()
else
seenParaContent = true
if SILE.settings:get("typesetter.softHyphen") then
local warnedshy = false
for token2 in SU.gtoke(token.string, luautf8.char(0x00AD)) do
Expand Down

0 comments on commit e9fd3b0

Please sign in to comment.