summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/x-calcmath.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/x-calcmath.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/x-calcmath.lua19
1 files changed, 8 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/context/base/x-calcmath.lua b/Master/texmf-dist/tex/context/base/x-calcmath.lua
index e4d5da139f9..bcf72f26f6e 100644
--- a/Master/texmf-dist/tex/context/base/x-calcmath.lua
+++ b/Master/texmf-dist/tex/context/base/x-calcmath.lua
@@ -9,11 +9,9 @@ if not modules then modules = { } end modules ['x-calcmath'] = {
local format, lower, upper, gsub, sub = string.format, string.lower, string.upper, string.gsub, string.sub
local lpegmatch = lpeg.match
-tex = tex or { }
-
-texsprint = tex.sprint or function(catcodes,str) print(str) end
-
-calcmath = { }
+local calcmath = { }
+local moduledata = moduledata or { }
+moduledata.calcmath = calcmath
local list_1 = {
"median", "min", "max", "round", "ln", "log",
@@ -77,7 +75,7 @@ local function nsub(str,tag,pre,post)
end))
end
-function calcmath.totex(str,mode)
+local function totex(str,mode)
if not frozen then freeze() end
local n = 0
-- crap
@@ -162,19 +160,18 @@ function calcmath.totex(str,mode)
end
-- csnames
str = gsub(str,"(\\[A-Z]+)", lower)
- -- trace
---~ print(str)
-- report
return str
end
+calcmath.totex = totex
+
function calcmath.tex(str,mode)
- texsprint(tex.texcatcodes,calcmath.totex(str))
+ context(totex(str))
end
function calcmath.xml(id,mode)
- local str = lxml.id(id).dt[1]
- texsprint(tex.texcatcodes,calcmath.totex(str,mode))
+ context(totex(lxml.id(id).dt[1],mode))
end
-- work in progress ... lpeg variant