File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments