diff options
Diffstat (limited to 'tex/context/base/mkiv/mlib-pps.lua')
-rw-r--r-- | tex/context/base/mkiv/mlib-pps.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua index 8d200ac63..23091342f 100644 --- a/tex/context/base/mkiv/mlib-pps.lua +++ b/tex/context/base/mkiv/mlib-pps.lua @@ -971,6 +971,25 @@ local ctx_MPLIBsettext = context.MPLIBsettext -- we always create at least one instance (for dimensions) -- we make sure we don't do that when we use one (else counter issues with e.g. \definelabel) +local eol = S("\n\r")^1 +local cleaner = Cs((P("@@")/"@" + P("@")/"%%" + P(1))^0) +local splitter = Ct( + ( ( + P("s:") * C((1-eol)^1) + + P("n:") * ((1-eol)^1/tonumber) + + P("b:") * ((1-eol)^1/toboolean) + ) * eol^0 )^0) + +local function applyformat(s) + local t = lpegmatch(splitter,s) + if #t == 1 then + return s + else + local f = lpegmatch(cleaner,t[1]) + return formatters[f](unpack(t,2)) + end +end + local function tx_analyze(object,prescript) local data = top.texdata[metapost.properties.number] local tx_stage = prescript.tx_stage @@ -986,6 +1005,9 @@ local function tx_analyze(object,prescript) c = lpegmatch(pat,txc) end end + if prescript.tx_type == "format" then + s = applyformat(s) + end local a = tonumber(prescript.tr_alternative) local t = tonumber(prescript.tr_transparency) local h = fmt(tx_number,a or "-",t or "-",c or "-") |