diff options
author | Marius <mariausol@gmail.com> | 2012-10-19 01:20:13 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-10-19 01:20:13 +0300 |
commit | 69d2352af4b60929b37fc49f3bdb263977016244 (patch) | |
tree | db5eb11398e345dfa23b4c4500fb93575d2afb7c /tex/context/base/util-dim.lua | |
parent | c18f7cbe51449a611ea1819fedd9a4ff18529b7d (diff) | |
download | context-69d2352af4b60929b37fc49f3bdb263977016244.tar.gz |
stable 2012.05.30 11:26
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 |