diff options
author | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-08-19 01:38:26 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-08-19 01:38:26 +0200 |
commit | ed42bd4c79946716033bf5dbedbd54bbe81f49e8 (patch) | |
tree | a3d63d74f0e07f799c538eb04096195b6b6d4631 /tex/context/base/mkiv/mlib-pps.lua | |
parent | 30b3a925bfc1857a31e23d9b17b8da0be572d02a (diff) | |
download | context-ed42bd4c79946716033bf5dbedbd54bbe81f49e8.tar.gz |
2016-08-19 00:35:00
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 "-") |