Skip to content

Commit

Permalink
Merge 6c6ce6f into 6ad9b76
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jun 7, 2024
2 parents 6ad9b76 + 6c6ce6f commit 2388993
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 84 deletions.
19 changes: 11 additions & 8 deletions classes/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -696,16 +696,18 @@ end

-- WARNING: not called as class method
function class.endPar (typesetter)
-- If we're already explicitly out of hmode don't do anything special in the way of skips or indents. Assume the user
-- has handled that how they want, e.g. with a skip.
local queue = typesetter.state.outputQueue
local last_vbox = queue and queue[#queue]
local last_is_vglue = last_vbox and last_vbox.is_vglue
local last_is_vpenalty = last_vbox and last_vbox.is_penalty
if typesetter:vmode() and (last_is_vglue or last_is_vpenalty) then
return
end
SILE.settings:set("current.parindent", nil)
typesetter:leaveHmode()
typesetter:pushVglue(SILE.settings:get("document.parskip"))
if SILE.settings:get("current.hangIndent") then
SILE.settings:set("current.hangIndent", nil)
SILE.settings:set("linebreak.hangIndent", nil)
end
if SILE.settings:get("current.hangAfter") then
SILE.settings:set("current.hangAfter", nil)
SILE.settings:set("linebreak.hangAfter", nil)
end
end

function class:newPage ()
Expand All @@ -725,6 +727,7 @@ end

function class:finish ()
SILE.inputter:postamble()
SILE.typesetter:endline()
SILE.call("vfill")
while not SILE.typesetter:isQueueEmpty() do
SILE.call("supereject")
Expand Down
13 changes: 9 additions & 4 deletions classes/book.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,19 @@ function class:registerCommands ()
if SILE.Commands[postcmd .. ":" .. lang] then
postcmd = postcmd .. ":" .. lang
end
SILE.call("nofoliothispage")
SILE.call(postcmd)
SILE.call("book:chapterfont", {}, content)
SILE.call("left-running-head", {}, function ()
SILE.settings:temporarily(function ()
SILE.call("book:left-running-head-font", {}, content)
end)
end)
SILE.call("novbreak")
SILE.call("par")
SILE.call("novbreak")
SILE.call("bigskip")
SILE.call("nofoliothispage")
SILE.call("novbreak")
-- English typography (notably) expects the first paragraph under a section
-- not to be indented. Frenchies, don't use this class :)
SILE.call("noindent")
Expand Down Expand Up @@ -215,12 +219,13 @@ function class:registerCommands ()
end)
end
SILE.call("novbreak")
SILE.call("par")
SILE.call("novbreak")
SILE.call("bigskip")
SILE.call("novbreak")
-- English typography (notably) expects the first paragraph under a section
-- not to be indented. Frenchies, don't use this class :)
SILE.call("noindent")
SILE.typesetter:inhibitLeading()
end, "Begin a new section")

self:registerCommand("subsection", function (options, content)
Expand All @@ -242,14 +247,14 @@ function class:registerCommands ()
SILE.call(postcmd)
SILE.process(content)
end)
SILE.typesetter:leaveHmode()
SILE.call("novbreak")
SILE.call("par")
SILE.call("novbreak")
SILE.call("medskip")
SILE.call("novbreak")
-- English typography (notably) expects the first paragraph under a section
-- not to be indented. Frenchies, don't use this class :)
SILE.call("noindent")
SILE.typesetter:inhibitLeading()
end, "Begin a new subsection")

self:registerCommand("book:chapterfont", function (_, content)
Expand Down
12 changes: 10 additions & 2 deletions classes/plain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,16 @@ function class:registerCommands ()

self:registerCommand("noindent", function (_, content)
if #SILE.typesetter.state.nodes ~= 0 then
SU.warn(
"\\noindent called after nodes already received in a paragraph, the setting will have no effect because the parindent (if any) has already been output"
SU.warn([[\noindent was called after paragraph content has already been procesed.
This will not result in avoiding the current paragraph being indented.
This function must be called before any content belonging to the
paragraph is processed. If the intent was to suppress indentation of a
following paragraph, first explicitly close the current paragraph. From
an input document this is typically done with an empty line between
paragraphs, but calling the \par command explicitly or from Lua code
running SILE.call("par") will end the current paragraph.
]]
)
end
SILE.settings:set("current.parindent", SILE.types.node.glue())
Expand Down
26 changes: 13 additions & 13 deletions tests/alignment.expected
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Mx 4.4700
Mx 5.4200
T 72 a=5.0000 86 a=5.3100 67 a=4.9300 70 a=4.4700 83 a=3.7200 72 a=5.0000 83 a=3.7200 70 a=4.4700 79 a=5.4200 (gubergren)
Mx 26.8819
My 95.9564
My 85.9564
Set font Libertinus Serif;10;400;Italic;normal;;;LTR
Mx 5.8700
Mx 4.5700
Expand Down Expand Up @@ -200,7 +200,7 @@ T 68 80 79 84 70 85 70 85 86 83 w=42.9300 (consetetur)
Mx 239.8919
T 84 66 69 74 81 84 68 74 79 72 w=42.7400 (sadipscing)
Mx 14.8819
My 107.9564
My 97.9564
T 70 77 74 85 83 w=16.7000 (elitr)
Mx 33.8353
Mx 3.9000
Expand Down Expand Up @@ -250,7 +250,7 @@ Mx 3.6400
Mx 4.4700
T 69 a=5.0600 80 a=5.0400 77 a=2.6400 80 a=5.0400 83 a=3.7200 70 a=4.4700 (dolore)
Mx 14.8819
My 119.9564
My 109.9564
T 78 66 72 79 66 w=27.4600 (magna)
Mx 44.8368
T 66 77 74 82 86 90 66 78 w=37.8800 (aliquyam)
Expand Down Expand Up @@ -293,7 +293,7 @@ T 66 68 68 86 84 66 78 w=34.8100 (accusam)
Mx 275.1259
T 70 85 w=7.6300 (et)
Mx 14.8819
My 131.9564
My 121.9564
T 75 86 84 85 80 w=20.1300 (justo)
Mx 37.5119
T 69 86 80 w=15.4100 (duo)
Expand Down Expand Up @@ -335,7 +335,7 @@ Mx 4.4700
Mx 5.4200
T 72 a=5.0000 86 a=5.3100 67 a=4.9300 70 a=4.4700 83 a=3.7200 72 a=5.0000 83 a=3.7200 70 a=4.4700 79 a=5.4200 (gubergren)
Mx 18.9889
My 163.9564
My 143.9564
Set font Libertinus Serif;10;400;Italic;normal;;;LTR
Mx 6.4600
Mx 4.4700
Expand Down Expand Up @@ -369,7 +369,7 @@ T 84 66 69 74 81 84 68 74 79 72 w=42.7400 (sadipscing)
Mx 261.9489
T 70 77 74 85 83 w=16.7000 (elitr)
Mx 23.2489
My 175.9564
My 155.9564
Mx 3.9000
Mx 4.5400
Mx 5.0600
Expand Down Expand Up @@ -417,7 +417,7 @@ Mx 3.6400
Mx 4.4700
T 69 a=5.0600 80 a=5.0400 77 a=2.6400 80 a=5.0400 83 a=3.7200 70 a=4.4700 (dolore)
Mx 14.8819
My 187.9564
My 167.9564
T 78 66 72 79 66 w=27.4600 (magna)
Mx 44.8368
T 66 77 74 82 86 90 66 78 w=37.8800 (aliquyam)
Expand Down Expand Up @@ -460,7 +460,7 @@ T 66 68 68 86 84 66 78 w=34.8100 (accusam)
Mx 275.1259
T 70 85 w=7.6300 (et)
Mx 37.0639
My 199.9564
My 179.9564
T 75 86 84 85 80 w=20.1300 (justo)
Mx 59.6939
T 69 86 80 w=15.4100 (duo)
Expand Down Expand Up @@ -502,7 +502,7 @@ Mx 4.4700
Mx 5.4200
T 72 a=5.0000 86 a=5.3100 67 a=4.9300 70 a=4.4700 83 a=3.7200 72 a=5.0000 83 a=3.7200 70 a=4.4700 79 a=5.4200 (gubergren)
Mx 26.8819
My 231.9564
My 201.9564
Set font Libertinus Serif;10;400;Italic;normal;;;LTR
Mx 3.2200
Mx 5.3100
Expand Down Expand Up @@ -536,7 +536,7 @@ T 84 66 69 74 81 84 68 74 79 72 w=42.7400 (sadipscing)
Mx 266.0559
T 70 77 74 85 83 w=16.7000 (elitr)
Mx 14.8819
My 243.9564
My 213.9564
Mx 3.9000
Mx 4.5400
Mx 5.0600
Expand Down Expand Up @@ -588,7 +588,7 @@ T 78 66 w=12.4700 (ma)
Mx 279.3759
T 14 w=3.3800 (-)
Mx 14.8819
My 255.9564
My 225.9564
T 72 79 66 w=14.9900 (gna)
Mx 33.5004
T 66 77 74 82 86 90 66 78 w=37.8800 (aliquyam)
Expand Down Expand Up @@ -631,7 +631,7 @@ T 66 68 68 86 84 66 78 w=34.8100 (accusam)
Mx 275.1259
T 70 85 w=7.6300 (et)
Mx 14.8819
My 267.9564
My 237.9564
T 75 86 84 85 80 w=20.1300 (justo)
Mx 37.5174
T 69 86 80 w=15.4100 (duo)
Expand Down Expand Up @@ -673,7 +673,7 @@ Mx 4.4700
Mx 5.4200
T 72 a=5.0000 86 a=5.3100 67 a=4.9300 70 a=4.4700 83 a=3.7200 72 a=5.0000 83 a=3.7200 70 a=4.4700 79 a=5.4200 (gubergren)
Mx 138.2259
My 299.9564
My 259.9564
Set font Libertinus Serif;10;400;Italic;normal;;;LTR
T 51 74 72 73 85 w=22.1200 (Right)
Mx 162.8459
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1647.sil
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
This paragraph is at the page top.

This paragraph has a big parskip before it.

\vfill
This paragraph must be at the page bottom.
\par
Expand Down
16 changes: 5 additions & 11 deletions tests/bug-262.expected
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,13 @@ T 72 87 w=8.0615 (et)
Mx 252.9827
My 43.4739
T 55 75 76 86 w=17.5977 (This)
Mx 273.2242
Mx 273.2254
T 76 86 w=6.5723 (is)
Mx 282.4402
Mx 282.4427
T 68 81 w=10.1074 (an)
Mx 295.1915
Mx 295.1952
T 76 81 71 72 81 87 72 71 w=36.8262 (indented)
Mx 334.6615
T 72 81 w=10.1367 (en)
Mx 344.7982
T 89 76 w=7.6416 (vi)
Mx 352.4398
T 85 82 81 w=14.5068 (ron)
Mx 366.9466
T 80 72 81 87 w=21.6113 (ment)
Mx 334.6664
T 72 81 89 76 85 82 81 80 72 81 87 w=53.8965 (environment)
End page
Finish
12 changes: 6 additions & 6 deletions tests/bug-301.expected
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ T 45 82 75 81 w=18.1604 (John)
Mx 146.8685
T 43 68 81 70 82 70 78 w=33.5283 (Hancock)
Mx 37.4104
My 225.7379
My 224.7379
T 36 w=5.6545 (A)
Mx 47.0753
T 79 76 81 72 w=14.7788 (line)
Expand All @@ -76,7 +76,7 @@ T 83 68 85 68 74 85 68 83 75 w=40.5466 (paragraph)
Mx 164.2543
T 87 75 68 87 w=16.1426 (that)
Mx 17.4104
My 242.7423
My 241.7423
T 90 85 68 83 86 w=23.5320 (wraps)
Mx 44.9637
T 82 81 w=10.0195 (on)
Expand All @@ -101,14 +101,14 @@ T 82 81 w=10.0195 (on)
Mx 69.5699
T 17 w=2.1755 (.)
Mx 123.9924
My 59.7203
My 58.2203
T 55 75 72 w=14.8623 (The)
Mx 141.3651
T 88 81 71 72 85 86 76 74 81 72 71 w=48.8127 (undersigned)
Mx 190.1779
T 15 w=2.1755 (,)
Mx 138.1542
My 78.7247
My 74.7247
T 45 82 75 81 w=18.1604 (John)
Mx 158.8251
T 43 68 81 70 82 70 78 w=33.5283 (Hancock)
Expand All @@ -129,7 +129,7 @@ T 87 75 72 w=12.9001 (the)
Mx 162.7189
T 81 72 91 87 w=17.6780 (next)
Mx 17.4104
My 58.5609
My 58.6971
T 83 68 74 72 w=18.4155 (page)
Mx 39.0274
T 71 82 72 86 81 10 87 w=28.6624 (doesn't)
Expand All @@ -150,7 +150,7 @@ T 76 87 w=5.8447 (it)
Mx 170.3773
T 82 81 w=10.0195 (on)
Mx 17.4104
My 75.4058
My 75.6783
T 87 75 76 86 w=14.7556 (this)
Mx 34.6895
T 83 68 74 72 w=18.4155 (page)
Expand Down
2 changes: 1 addition & 1 deletion tests/bug-301.sil
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A line of stuff in a paragraph that wraps on the page following the one it start

\raggedleft{John Hancock}

\skip[height=16em]
\vfill

The problem with hfills on the next page doesn't repro if you try to do it on this page.

Expand Down
4 changes: 2 additions & 2 deletions tests/bug-344.expected
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ T 80 68 81 w=18.1396 (man)
Mx 108.8377
T 17 w=2.2900 (.)
Mx 54.8208
My 459.2688
My 458.2688
T 50 81 72 w=16.1377 (One)
Mx 70.9585
T 15 w=2.2900 (,)
Expand All @@ -28,7 +28,7 @@ T 86 75 82 72 w=19.0283 (shoe)
Mx 161.0933
T 17 w=2.2900 (.)
Mx 54.8208
My 483.9172
My 482.9172
T 50 81 72 w=16.1377 (One)
Mx 70.9585
T 15 w=2.2900 (,)
Expand Down
2 changes: 1 addition & 1 deletion tests/disappearing-skip.expected
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ T 20 w=4.6924 (1)
Mx 64.0185
T 17 w=2.2900 (.)
Mx 38.2835
My 488.4344
My 487.7319
T 51 68 85 68 w=18.3691 (Para)
Mx 59.3261
T 21 w=4.6924 (2)
Expand Down
Loading

0 comments on commit 2388993

Please sign in to comment.