diff options
author | Marius <mariausol@gmail.com> | 2013-08-23 14:20:14 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2013-08-23 14:20:14 +0300 |
commit | 42b2755bce4c8ddfd6dc40ca11b11b3fa2e2f0b4 (patch) | |
tree | fe04b02c9c678e92ea04cd722cb6a356d80bbb36 /tex/generic | |
parent | 5e936f4803c46d1dfc6d75f137092e8d20320ffb (diff) | |
download | context-42b2755bce4c8ddfd6dc40ca11b11b3fa2e2f0b4.tar.gz |
beta 2013.08.23 13:16
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index eb4194713..9632faec5 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 08/22/13 15:28:35 +-- merge date : 08/23/13 13:16:33 do -- begin closure to overcome local limits and interference @@ -2621,6 +2621,7 @@ local tracedchar = string.tracedchar local autosingle = string.autosingle local autodouble = string.autodouble local sequenced = table.sequenced +local formattednumber = number.formatted ]] local template=[[ %s @@ -2817,6 +2818,39 @@ end local format_W=function(f) return format("nspaces[%s]",tonumber(f) or 0) end +local digit=patterns.digit +local period=patterns.period +local three=digit*digit*digit +local splitter=Cs ( + (((1-(three^1*period))^1+C(three))*(Carg(1)*three)^1+C((1-period)^1))*(P(1)/""*Carg(2))*C(2) +) +patterns.formattednumber=splitter +function number.formatted(n,sep1,sep2) + local s=type(s)=="string" and n or format("%0.2f",n) + if sep1==true then + return lpegmatch(splitter,s,1,".",",") + elseif sep1=="." then + return lpegmatch(splitter,s,1,sep1,sep2 or ",") + elseif sep1=="," then + return lpegmatch(splitter,s,1,sep1,sep2 or ".") + else + return lpegmatch(splitter,s,1,sep1 or ",",sep2 or ".") + end +end +local format_m=function(f) + n=n+1 + if not f or f=="" then + f="," + end + return format([[formattednumber(a%s,%q,".")]],n,f) +end +local format_M=function(f) + n=n+1 + if not f or f=="" then + f="." + end + return format([[formattednumber(a%s,%q,",")]],n,f) +end local format_rest=function(s) return format("%q",s) end @@ -2854,7 +2888,8 @@ local builder=Cs { "start", +V("w") +V("W") +V("a") -+V("A") ++V("A") ++V("m")+V("M") +V("*") )+V("*") )*(P(-1)+Carg(1)) @@ -2890,6 +2925,8 @@ local builder=Cs { "start", ["I"]=(prefix_any*P("I"))/format_I, ["w"]=(prefix_any*P("w"))/format_w, ["W"]=(prefix_any*P("W"))/format_W, + ["m"]=(prefix_tab*P("m"))/format_m, + ["M"]=(prefix_tab*P("M"))/format_M, ["a"]=(prefix_any*P("a"))/format_a, ["A"]=(prefix_any*P("A"))/format_A, ["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest, |