Skip to content

Commit 94cfe06

Browse files
Omikhleiaalerque
authored andcommitted
fix(typesetters): Obey blank lines in verbatim-like context
1 parent 58f65d5 commit 94cfe06

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

typesetters/base.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,25 @@ function typesetter:typeset (text)
295295
return
296296
end
297297
local pId = SILE.traceStack:pushText(text)
298-
for token in SU.gtoke(text, SILE.settings:get("typesetter.parseppattern")) do
298+
local parsepattern = SILE.settings:get("typesetter.parseppattern")
299+
-- NOTE: Big assumption on how to guess were are in "obeylines" mode.
300+
-- See https://github.com/sile-typesetter/sile/issues/2128
301+
local obeylines = parsepattern == "\n"
302+
303+
local seenParaContent = true
304+
for token in SU.gtoke(text, parsepattern) do
299305
if token.separator then
306+
if obeylines and not seenParaContent then
307+
-- In obeylines mode, each standalone line must be kept.
308+
-- The zerohbox is not discardable, so it will be kept in the output,
309+
-- and the baseline skip will do the rest.
310+
self:pushHorizontal(SILE.types.node.zerohbox())
311+
else
312+
seenParaContent = false
313+
end
300314
self:endline()
301315
else
316+
seenParaContent = true
302317
if SILE.settings:get("typesetter.softHyphen") then
303318
local warnedshy = false
304319
for token2 in SU.gtoke(token.string, luautf8.char(0x00AD)) do

0 commit comments

Comments
 (0)