Skip to content

Commit

Permalink
fix(languages): Correct synchronisation between indexes in French wor…
Browse files Browse the repository at this point in the history
…d breaking
  • Loading branch information
Omikhleia authored and alerque committed Dec 16, 2021
1 parent c25d9d7 commit 94ca931
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 417 deletions.
15 changes: 6 additions & 9 deletions languages/fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -195,21 195,18 @@ SILE.nodeMakers.fr = pl.class({
if self:handleSpaceBefore(item) then return end
if self:handleSpaceAfter(item) then return end

-- Honor explicit hard line breaks, but ignore the soft ones, as we do
-- the paragraphing and have hyphenation patterns. Moreover ICU seems to
-- return soft breaks where it shouldn't !?
self:makeToken()
if (subtype == "hard") then
self:makePenalty(-1000)
end
self:addToken(item.text, item)
self._base.handleLineBreak(self, item, subtype)
end,

iterator = function (self, items)
-- We start by cleaning up the input once for all.
local cleanItems = {}
local removed = 0
for k = 1, #items do
if not self:mustRemove(k, items) then
if self:mustRemove(k, items) then
removed = removed 1
else
items[k].index = items[k].index - removed -- index has changed due to removals
table.insert(cleanItems, items[k])
end
end
Expand Down
Loading

0 comments on commit 94ca931

Please sign in to comment.