Skip to content

Commit

Permalink
Merge f8abea2 into 0c91cbc
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jan 23, 2024
2 parents 0c91cbc + f8abea2 commit 01b4caa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/hyphenator-liang.lua
Expand Up @@ -120,12 +120,18 @@ local hyphenateNode = function (node)
SU.error("No hyphenation segment should ever be empty", true)
end
if node.options.language == "tr" then
-- leading apostrophe (on next segment) cancels when hyphenated
local nextApostrophe = j < #segments and luautf8.match(segments[j+1], "^['’]")
if nextApostrophe then
segments[j+1] = luautf8.gsub(segments[j+1], "^['’]", "")
local replacement = SILE.shaper:createNnodes(nextApostrophe, node.options)
specificDiscretionary = SILE.nodefactory.discretionary({ replacement = replacement, prebreak = hyphen })
if SILE.settings:get("languages.tr.displayHyphenAtApostrophe") then
-- leading apostrophe (on next segment) cancels when hyphenated
specificDiscretionary = SILE.nodefactory.discretionary({ replacement = replacement, prebreak = hyphen })
else
-- hyphen character substituted for upcomming apostrophe
local kesme = SILE.shaper:createNnodes(nextApostrophe, node.options)
specificDiscretionary = SILE.nodefactory.discretionary({ replacement = replacement, prebreak = kesme })
end
end
elseif node.options.language == "ca" then
-- punt volat (middle dot) cancels when hyphenated
Expand Down
11 changes: 11 additions & 0 deletions languages/tr.lua
@@ -1,3 +1,14 @@
-- Different years of TDK and various publisher style guides differ on this point.
-- Current official guidance suggests dropping the hypenation mark if the break
-- occurs at an apostrophe (kesme işareti). Some older guidance and some publishers
-- suggest dropping the apostrophe instead.
SILE.settings:declare({
parameter = "languages.tr.displayHyphenAtApostrophe",
type = "boolean",
default = false,
help = "If enabled, substitute the apostophe for a hyphen at break points, otherwise keep the apostrophe and hide the hyphen."
})

-- Quotes may be part of a word in Turkish
SILE.nodeMakers.tr = pl.class(SILE.nodeMakers.unicode)
SILE.nodeMakers.tr.isWordType = { cm = true, qu = true }
Expand Down

0 comments on commit 01b4caa

Please sign in to comment.