SILE = require("core.sile")
SILE.backend = "debug"
SILE.init()
describe("Hyphenation module", function ()
local hyphenate = SILE.showHyphenationPoints
SILE.call("language", { main = "fr" })
describe("minWord with UTF8 in input text", function ()
hyphenate("série", "fr")
SILE._hyphenators["fr"].leftmin = 2
SILE._hyphenators["fr"].rightmin = 2
it("should hyphenate words longer than minWord", function ()
SILE._hyphenators["fr"].minWord = 5 assert.is.equal("sé-rie", hyphenate("série", "fr"))
assert.is.equal("Lé-gè-re-ment", hyphenate("Légèrement", "fr"))
end)
it("should not hyphenate words shorter than minWord", function ()
SILE._hyphenators["fr"].minWord = 6
assert.is.equal("série", hyphenate("série", "fr"))
SILE._hyphenators["fr"].minWord = 5 end)
end)
describe("exceptions with UTF8 in input text", function ()
SILE.call("hyphenator:add-exceptions", {}, { "légè-rement" })
it("should hyphenate with exception rule", function ()
assert.is.equal("légè-rement", hyphenate("légèrement", "fr"))
assert.is.equal("Légè-rement", hyphenate("Légèrement", "fr"))
end)
end)
end)