diff options
author | Hans Hagen <pragma@wxs.nl> | 2021-11-24 20:33:24 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2021-11-24 20:33:24 +0100 |
commit | 81b32baedc58b7485c16d29a09f4e97a279c98e8 (patch) | |
tree | 055e79acb7ac42a8d325c42c8c5d760df1a93c47 /tex/context/base/mkiv/page-flt.lua | |
parent | 4f3937859f3619e397cf38e220e59eb26ade73e2 (diff) | |
download | context-81b32baedc58b7485c16d29a09f4e97a279c98e8.tar.gz |
2021-11-24 19:47:00
Diffstat (limited to 'tex/context/base/mkiv/page-flt.lua')
-rw-r--r-- | tex/context/base/mkiv/page-flt.lua | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tex/context/base/mkiv/page-flt.lua b/tex/context/base/mkiv/page-flt.lua index b1f729f7a..7c2220840 100644 --- a/tex/context/base/mkiv/page-flt.lua +++ b/tex/context/base/mkiv/page-flt.lua @@ -12,7 +12,7 @@ if not modules then modules = { } end modules ['page-flt'] = { local next = next local tostring = tostring local insert, remove = table.insert, table.remove -local find = string.find +local find, topattern = string.find, string.topattern local abs = math.abs local trace_floats = false trackers.register("floats.caching", function(v) trace_floats = v end) @@ -21,7 +21,7 @@ local trace_collecting = false trackers.register("floats.collecting", function( local report_floats = logs.reporter("floats","caching") local report_collecting = logs.reporter("floats","collecting") -local C, S, P, lpegmatch = lpeg.C, lpeg.S, lpeg.P, lpeg.match +local C, Cc, S, P, lpegmatch = lpeg.C, lpeg.Cc, lpeg.S, lpeg.P, lpeg.match -- we use floatbox, floatwidth, floatheight -- text page leftpage rightpage (todo: top, bottom, margin, order) @@ -119,7 +119,7 @@ local function get(stack,n,bylabel) if bylabel then for i=1,#stack do local s = stack[i] - local n = string.topattern(tostring(n)) -- to be sure + local n = topattern(tostring(n)) -- to be sure if find(s.data.label,n) then return s, s.box, i end @@ -326,16 +326,18 @@ end -- todo: check for digits ! +local digits = lpeg.patterns.digits +local nothing = Cc("") local method = C((1-S(", :"))^1) -local position = P(":") * C((1-S("*,"))^1) * (P("*") * C((1-S(","))^1))^0 +local position = P(":") * C(digits^1) * (P("*") * C(digits^1) + nothing) local label = P(":") * C((1-S(",*: "))^0) local pattern = method * ( - label * position * C("") - + C("") * position * C("") - + label * C("") * C("") - + C("") * C("") * C("") -) + C("") * C("") * C("") * C("") + label * position + + nothing * position + + label * nothing * nothing + + nothing * nothing * nothing +) + nothing * nothing * nothing * nothing -- inspect { lpegmatch(pattern,"somewhere:blabla,crap") } -- inspect { lpegmatch(pattern,"somewhere:1*2") } |