summaryrefslogtreecommitdiff
path: root/tex/context/base/x-mathml.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/x-mathml.lua')
-rw-r--r--tex/context/base/x-mathml.lua24
1 files changed, 14 insertions, 10 deletions
diff --git a/tex/context/base/x-mathml.lua b/tex/context/base/x-mathml.lua
index cc7238f94..30e770190 100644
--- a/tex/context/base/x-mathml.lua
+++ b/tex/context/base/x-mathml.lua
@@ -12,7 +12,7 @@ local type, next = type, next
local utf = unicode.utf8
local format, lower, find, gsub = string.format, string.lower, string.find, string.gsub
local strip = string.strip
-local utfchar = utf.char
+local utfchar, utffind, utfgmatch, utfgsub = utf.char, utf.find, utf.gmatch, utf.gsub
local xmlsprint, xmlcprint, xmltext, xmlcontent = xml.sprint, xml.cprint, xml.text, xml.content
local getid = lxml.getid
local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues
@@ -87,8 +87,6 @@ local o_replacements = { -- in main table
}
-local simpleoperatorremapper = utf.remapper(o_replacements)
-
--~ languages.data.labels.functions
local i_replacements = {
@@ -459,7 +457,8 @@ function xml.functions.remapopenmath(e)
end
function mathml.checked_operator(str)
- context(simpleoperatorremapper(str))
+ str = utfgsub(str,".",o_replacements)
+ context(str)
end
function mathml.stripped(str)
@@ -482,8 +481,10 @@ end
function mathml.mo(id)
local str = xmlcontent(getid(id)) or ""
- local rep = gsub(str,"&.-;","") -- todo
- context(simpleoperatorremapper(rep))
+ local rep = gsub(str,"&.-;","")
+ local rep = utfgsub(rep,".",o_replacements)
+ context(rep)
+ -- context.mo(rep) -- fails with \left etc
end
function mathml.mi(id)
@@ -523,7 +524,10 @@ function mathml.mfenced(id) -- multiple separators
elseif n == 1 then
xmlsprint(collected[1]) -- to be checked
else
- local t = utf.split(separators,true)
+ local t = { }
+ for s in utfgmatch(separators,"[^%s]") do
+ t[#t+1] = s
+ end
for i=1,n do
xmlsprint(collected[i]) -- to be checked
if i < n then
@@ -642,8 +646,8 @@ function mathml.mcolumn(root)
local tag = e.tg
if tag == "mi" or tag == "mn" or tag == "mo" or tag == "mtext" then
local str = xmltext(e)
- str = gsub(str,"&.-;","")
- for s in utfcharacters(str) do
+str = gsub(str,"&.-;","")
+ for s in utfcharacters(str) do -- utf.gmatch(str,".") btw, the gmatch was bugged
m[#m+1] = { tag, s }
end
if tag == "mn" then
@@ -654,7 +658,7 @@ function mathml.mcolumn(root)
end
elseif tag == "mspace" or tag == "mline" then
local str = e.at.spacing or ""
- for s in utfcharacters(str) do
+ for s in utfcharacters(str) do -- utf.gmatch(str,".") btw, the gmatch was bugged
m[#m+1] = { tag, s }
end
-- elseif tag == "mline" then