diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/buff-par.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/buff-par.lua | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/buff-par.lua b/Master/texmf-dist/tex/context/base/mkiv/buff-par.lua index 58ea9ab9d06..9c75b90e730 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/buff-par.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/buff-par.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['buff-par'] = { license = "see context related readme files" } -local insert, remove, find, gmatch = table.insert, table.remove, string.find, string.gmatch +local insert, remove, find, gmatch, match = table.insert, table.remove, string.find, string.gmatch, string.match local fullstrip, formatters = string.fullstrip, string.formatters local trace_parallel = false trackers.register("buffers.parallel", function(v) trace_parallel = v end) @@ -90,18 +90,31 @@ function parallel.save(category,tag,content,frombuffer) -- use lpeg if find(content,"%s*%[") then local done = false - for label, content in gmatch(content,"%s*%[(.-)%]%s*([^%[]+)") do + + local function flush(content,label) if done then line = { } insert(lines,line) else done = true end + line.content = fullstrip(content) + line.label = label + end + + + local leading, rest = match(content,"^%s*([^%[]+)(.*)$") + if leading then + if leading ~= "" then + flush(leading) + end + content = rest + end + for label, content in gmatch(content,"%s*%[(.-)%]%s*([^%[]+)") do if trace_parallel and label ~= "" then report_parallel("reference found of category %a, tag %a, label %a",category,tag,label) end - line.content = fullstrip(content) - line.label = label + flush(content,label) end else line.content = fullstrip(content) |