summaryrefslogtreecommitdiff
path: root/tex/context/base/syst-aux.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2014-07-09 11:15:05 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2014-07-09 11:15:05 +0200
commit3ce833aa5de4b2955ef00422bc3d1d77735116d5 (patch)
treeaf6f7a125090e3c9a1802c7fa69215da21cec587 /tex/context/base/syst-aux.lua
parent32a229eb318e40b0fc6368e270b2cf21b8d59549 (diff)
downloadcontext-3ce833aa5de4b2955ef00422bc3d1d77735116d5.tar.gz
2014-07-09 10:28:00
Diffstat (limited to 'tex/context/base/syst-aux.lua')
-rw-r--r--tex/context/base/syst-aux.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/tex/context/base/syst-aux.lua b/tex/context/base/syst-aux.lua
index de15428f9..e645bb3b9 100644
--- a/tex/context/base/syst-aux.lua
+++ b/tex/context/base/syst-aux.lua
@@ -13,15 +13,16 @@ if not modules then modules = { } end modules ['syst-aux'] = {
local commands, context = commands, context
+local tonumber = tonumber
local settings_to_array = utilities.parsers.settings_to_array
local format = string.format
local utfsub = utf.sub
-local P, S, C, Cc, Cs, Carg, lpegmatch, utf8char = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg, lpeg.match, lpeg.patterns.utf8char
-
+local P, S, C, Cc, Cs, Carg, lpegmatch, utf8character = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg, lpeg.match, lpeg.patterns.utf8character
+local todimen = number.todimen
local setvalue = context.setvalue
-local pattern = C(utf8char^-1) * C(P(1)^0)
+local pattern = C(utf8character^-1) * C(P(1)^0)
function commands.getfirstcharacter(str)
local first, rest = lpegmatch(pattern,str)
@@ -38,7 +39,7 @@ function commands.theremainingcharacters(str)
context(rest)
end
-local pattern = C(utf8char^-1)
+local pattern = C(utf8character^-1)
function commands.doiffirstcharelse(chr,str)
commands.doifelse(lpegmatch(pattern,str) == chr)
@@ -114,3 +115,5 @@ local upper, lower, strip = utf.upper, utf.lower, string.strip
function commands.upper(s) context(upper(s)) end
function commands.lower(s) context(lower(s)) end
function commands.strip(s) context(strip(s)) end
+
+function commands.converteddimen(dimen,unit) context(todimen(dimen,unit or "pt","%0.5f")) end -- no unit appended