summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lang-dis.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-02-14 16:43:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-02-14 16:43:07 +0100
commit71e0f049996013abcbfd549b516e594e019fb744 (patch)
treee3197e97a576cbe2e5353e04132a5b28f6d8179e /tex/context/base/mkiv/lang-dis.lua
parente005748401471273a119724acf5e1567f2a04eee (diff)
downloadcontext-71e0f049996013abcbfd549b516e594e019fb744.tar.gz
2018-02-14 16:27:00
Diffstat (limited to 'tex/context/base/mkiv/lang-dis.lua')
-rw-r--r--tex/context/base/mkiv/lang-dis.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/lang-dis.lua b/tex/context/base/mkiv/lang-dis.lua
index df59359d2..65a53a702 100644
--- a/tex/context/base/mkiv/lang-dis.lua
+++ b/tex/context/base/mkiv/lang-dis.lua
@@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['lang-dis'] = {
local concat = table.concat
+local tex = tex
local nodes = nodes
local tasks = nodes.tasks
@@ -43,6 +44,8 @@ local traverse_id = nuts.traverse_id
local flush_list = nuts.flush_list
local flush_node = nuts.flush_node
+local new_disc = nuts.pool.disc
+
local nodecodes = nodes.nodecodes
local disccodes = nodes.disccodes
@@ -58,6 +61,8 @@ local a_visualize = attributes.private("visualizediscretionary")
local setattribute = tex.setattribute
local getlanguagedata = languages.getdata
+local prehyphenchar = lang.prehyphenchar
+local posthyphenchar = lang.posthyphenchar
local check_regular = true
@@ -200,3 +205,28 @@ directives.register("hyphenator.flatten",function(v)
setaction("processors","nodes.handlers.flatten",v)
setaction("contributers","nodes.handlers.flattenline",v)
end)
+
+-- moved here:
+
+function languages.explicithyphen(template)
+ local pre, post
+ local disc = new_disc()
+ if template then
+ local langdata = getlanguagedata(getlang(template))
+ local instance = langdata and langdata.instance
+ if instance then
+ local prechr = prehyphenchar(instance)
+ local postchr = posthyphenchar(instance)
+ if prechr >= 0 then
+ pre = copy_node(template)
+ setchar(pre,prechr)
+ end
+ if postchr >= 0 then
+ post = copy_node(template)
+ setchar(post,postchr)
+ end
+ end
+ end
+ setdisc(disc,pre,post,nil,explicit_code,tex.exhyphenpenalty)
+ return disc
+end