Skip to content

Commit

Permalink
fix: [breaking] enable saner settings default values for the book class
Browse files Browse the repository at this point in the history
Breaking in the sense that it impacts how previous documents
appeared by default (esp. due to shaper.spaceenlargementfactor)
but the SILE defaults are utterly incorrect.
  • Loading branch information
Omikhleia authored and Didier Willis committed Feb 26, 2023
1 parent f4c674b commit b3dea57
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions classes/resilient/book.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,17 @@ function class:_init (options)
self:loadPackage("resilient.headers")
self:loadPackage("markdown")

-- override document.parindent default
-- Override document.parindent default:
SILE.settings:set("document.parindent", "1.25em")
-- Override with saner defaults:
-- prefer underfull lines over ugly overfull content
SILE.settings:set("linebreak.emergencyStretch", "25%lw")
-- This should never have been 1.2 by default
SILE.settings:set("shaper.spaceenlargementfactor", 1)

-- override the standard foliostyle hook to rely on styles
-- Override the standard foliostyle hook to rely on styles
-- TRICKY, TO REMEMBER: Such overrides cannot be done in registerCommands()
-- as packages are not loaded yet.
self:registerCommand("foliostyle", function (_, content)
SILE.call("noindent")
local styleName = SILE.documentState.documentClass:oddPage() and "folio-odd" or "folio-even"
Expand Down

0 comments on commit b3dea57

Please sign in to comment.