summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lang-hyp.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-06-05 17:19:50 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-06-05 17:19:50 +0200
commit7a761c8aebf67ee022aa4857247518ad6997d5c1 (patch)
tree3295b12a1cc69ea5c61bce9c7c71172831f89d28 /tex/context/base/mkiv/lang-hyp.lua
parent2bca80bc96d0182956e57c51b5d4977f714bed5c (diff)
downloadcontext-7a761c8aebf67ee022aa4857247518ad6997d5c1.tar.gz
2016-06-05 16:31:00
Diffstat (limited to 'tex/context/base/mkiv/lang-hyp.lua')
-rw-r--r--tex/context/base/mkiv/lang-hyp.lua32
1 files changed, 13 insertions, 19 deletions
diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua
index 7864220e3..b797f85e1 100644
--- a/tex/context/base/mkiv/lang-hyp.lua
+++ b/tex/context/base/mkiv/lang-hyp.lua
@@ -605,8 +605,8 @@ if context then
local discretionary_code = disccodes.discretionary
local explicit_code = disccodes.explicit
+ local automatic_code = disccodes.automatic
----- regular_code = disccodes.regular
- ----- automatic_code = disccodes.automatic
local nuts = nodes.nuts
local tonut = nodes.tonut
@@ -658,6 +658,9 @@ if context then
local a_hyphenation = attributes.private("hyphenation")
+ local expand_explicit = languages.expanders[explicit_code]
+ local expand_automatic = languages.expanders[automatic_code]
+
local interwordpenalty = 5000
function traditional.loadpatterns(language)
@@ -1281,20 +1284,15 @@ if context then
setcolor(glyph,"darkred") -- these get checked
setcolor(disc,"darkgreen") -- in the colorizer
end
- local pre = mil
+ local pre = nil
local post = nil
local replace = glyph
- if not leftchar then
- leftchar = code
- end
- if rightchar then
- pre = copy_node(glyph)
- setchar(pre,rightchar)
- end
- if leftchar then
+ if leftchar and leftchar > 0 then
post = copy_node(glyph)
setchar(post,leftchar)
end
+ pre = copy_node(glyph)
+ setchar(pre,rightchar and rightchar > 0 and rightchar or code)
setdisc(disc,pre,post,replace,discretionary_code,hyphenpenalty)
if attributes then
setfield(disc,"attr",attributes)
@@ -1425,16 +1423,12 @@ if context then
current = getnext(current)
elseif subtype == explicit_code then -- \- => only here
size = 0
+ expand_explicit(current)
+ current = getnext(current)
+ elseif subtype == automatic_code then -- - => only here
+ size = 0
+ expand_automatic(current)
current = getnext(current)
- while current do
- local id = getid(current)
- if id == glyph_code or id == disc_code then
- current = getnext(current)
- else
- break
- end
- end
- -- todo: change to discretionary_code
else
-- automatic (-) : the hyphenator turns an exhyphen into glyph+disc
-- first : done by the hyphenator