diff options
Diffstat (limited to 'tex/context/base/util-dim.lua')
-rw-r--r-- | tex/context/base/util-dim.lua | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tex/context/base/util-dim.lua b/tex/context/base/util-dim.lua index 4bae2d099..47e43c386 100644 --- a/tex/context/base/util-dim.lua +++ b/tex/context/base/util-dim.lua @@ -16,7 +16,7 @@ table.</p> --ldx]]-- local format, match, gsub, type, setmetatable = string.format, string.match, string.gsub, type, setmetatable -local P, S, R, Cc, C, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.C, lpeg.match +local P, S, R, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.match local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex @@ -141,12 +141,6 @@ local dimenpair = amount/tonumber * (unit^1/dimenfactors + Cc(1)) -- tonumber is lpeg.patterns.dimenpair = dimenpair -local splitter = amount/tonumber * C(unit^1) - -function number.splitdimen(str) - return lpegmatch(splitter,str) -end - --[[ldx-- <p>We use a metatable to intercept errors. When no key is found in the table with factors, the metatable will be consulted for an @@ -436,12 +430,12 @@ probably use a hash instead of a one-element table.</p> <p>Goodie:s</p> --ldx]]-- -function number.percent(n,d) -- will be cleaned up once luatex 0.30 is out - d = d or tex.hsize - if type(d) == "string" then - d = stringtodimen(d) +function number.percent(n) -- will be cleaned up once luatex 0.30 is out + local hsize = tex.hsize + if type(hsize) == "string" then + hsize = stringtodimen(hsize) end - return (n/100) * d + return (n/100) * hsize end number["%"] = number.percent |