summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lang-dis.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-10-01 16:40:17 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-10-01 16:40:17 +0200
commit80743fc19190334d3a0d4c86538663b98695a573 (patch)
tree7a94f73a318e0362bacc2596ac8fc6201ed1d1b6 /tex/context/base/mkiv/lang-dis.lua
parent164a98ac4e58ae88de0a83d1eb60583827f4fbab (diff)
downloadcontext-80743fc19190334d3a0d4c86538663b98695a573.tar.gz
2017-10-01 14:38:00
Diffstat (limited to 'tex/context/base/mkiv/lang-dis.lua')
-rw-r--r--tex/context/base/mkiv/lang-dis.lua28
1 files changed, 19 insertions, 9 deletions
diff --git a/tex/context/base/mkiv/lang-dis.lua b/tex/context/base/mkiv/lang-dis.lua
index 0dfb1ce08..ec470234f 100644
--- a/tex/context/base/mkiv/lang-dis.lua
+++ b/tex/context/base/mkiv/lang-dis.lua
@@ -251,15 +251,25 @@ interfaces.implement {
actions = languages.showdiscretionaries
}
-local toutf = nodes.listtoutf
-
-function languages.serializediscretionary(d) -- will move to tracer
- local pre, post, replace = getdisc(d)
- return string.formatters["{%s}{%s}{%s}"](
- pre and toutf(pre) or "",
- post and toutf(post) or "",
- replace and toutf(replace) or ""
- )
+do
+
+ local toutf = nodes.listtoutf
+ local utfchar = utf.char
+ local f_disc = string.formatters["{%s}{%s}{%s}"]
+ local replace = lpeg.replacer( {
+ [utfchar(0x200C)] = "|",
+ [utfchar(0x200D)] = "|",
+ }, nil, true)
+
+ local function convert(list)
+ return list and replace(toutf(list)) or ""
+ end
+
+ function languages.serializediscretionary(d) -- will move to tracer
+ local pre, post, replace = getdisc(d)
+ return f_disc(convert(pre),convert(post),convert(replace))
+ end
+
end
-- --