diff options
author | Marius <mariausol@gmail.com> | 2012-07-10 01:40:15 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-07-10 01:40:15 +0300 |
commit | 6f124794f7dc253f8b83f2517c26ce17e50d66ff (patch) | |
tree | b60c4965f6564da448d06ccc7333fc9275c09d42 /tex/context/base/util-dim.lua | |
parent | f7f5e6779a6e1db630c21151d30858a2c8c97cbd (diff) | |
download | context-6f124794f7dc253f8b83f2517c26ce17e50d66ff.tar.gz |
beta 2012.07.10 00:14
Diffstat (limited to 'tex/context/base/util-dim.lua')
-rw-r--r-- | tex/context/base/util-dim.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tex/context/base/util-dim.lua b/tex/context/base/util-dim.lua index 47e43c386..4668326df 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, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.match +local P, S, R, Cc, C, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.Cc, lpeg.C, lpeg.match local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex @@ -141,6 +141,12 @@ 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 |