diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-01-28 18:40:41 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-01-28 18:40:41 +0100 |
commit | 0ae14e7400b2e4a6cf76d7e185433f5f901b5592 (patch) | |
tree | fa53dfb22a1185f196e947a2c3a91e5fd7501f8b /tex/context/base/mkiv/phys-dim.lua | |
parent | 27e58283ca9fd418a9f49981712d8f957cafaa0c (diff) | |
download | context-0ae14e7400b2e4a6cf76d7e185433f5f901b5592.tar.gz |
2021-01-28 18:20:00
Diffstat (limited to 'tex/context/base/mkiv/phys-dim.lua')
-rw-r--r-- | tex/context/base/mkiv/phys-dim.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tex/context/base/mkiv/phys-dim.lua b/tex/context/base/mkiv/phys-dim.lua index faf458738..e0cea7bab 100644 --- a/tex/context/base/mkiv/phys-dim.lua +++ b/tex/context/base/mkiv/phys-dim.lua @@ -41,7 +41,7 @@ if not modules then modules = { } end modules ['phys-dim'] = { local rawset, next = rawset, next local V, P, S, R, C, Cc, Cs, matchlpeg = lpeg.V, lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.match -local format, lower = string.format, string.lower +local format, lower, gsub = string.format, string.lower, string.gsub local appendlpeg = lpeg.append local utfchartabletopattern = lpeg.utfchartabletopattern local mergetable, mergedtable, keys, loweredkeys = table.merge, table.merged, table.keys, table.loweredkeys @@ -1001,3 +1001,15 @@ implement { name = "digits_reverse", actions = makedigits, arguments = { "stri implement { name = "unit_normal", actions = makeunit, arguments = "string"} implement { name = "unit_reverse", actions = makeunit, arguments = { "string", true } } implement { name = "registerunit", actions = registerunit, arguments = "2 strings" } + +implement { + name = "hyphenateddigits", + public = true, + protected = true, + arguments = { "optional", "string" }, + actions = function(filler, digits) + digits = gsub(digits,"(%d)","%1\\digitsbreak") + digits = gsub(digits,"\\-$",filler) + context(digits) + end +} |