diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/buff-par.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/buff-par.lua | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/context/base/buff-par.lua b/Master/texmf-dist/tex/context/base/buff-par.lua index 2015b0bc0a4..2c1cd40e9d1 100644 --- a/Master/texmf-dist/tex/context/base/buff-par.lua +++ b/Master/texmf-dist/tex/context/base/buff-par.lua @@ -1,4 +1,4 @@ -if not modules then modules = { } end modules ['buff-ini'] = { +if not modules then modules = { } end modules ['buff-par'] = { version = 1.001, comment = "companion to buff-ini.mkiv", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", @@ -6,21 +6,26 @@ if not modules then modules = { } end modules ['buff-ini'] = { license = "see context related readme files" } -local trace_parallel = false trackers.register("buffers.parallel", function(v) trace_parallel = v end) - -local report_parallel = logs.reporter("buffers","parallel") +local context, commands = context, commands local insert, remove, find, gmatch = table.insert, table.remove, string.find, string.gmatch local strip, format = string.strip, string.format -local variables = interfaces.variables +local trace_parallel = false trackers.register("buffers.parallel", function(v) trace_parallel = v end) + +local report_parallel = logs.reporter("buffers","parallel") + +local variables = interfaces.variables + +local parallel = buffers.parallel or { } +buffers.parallel = parallel -buffers.parallel = { } local parallel = buffers.parallel +local settings_to_array = utilities.parsers.settings_to_array -local data = { } +local data = { } function parallel.define(category,tags) - local tags = utilities.parsers.settings_to_array(tags) + local tags = settings_to_array(tags) local entries = { } data[category] = { tags = tags, @@ -38,7 +43,7 @@ function parallel.reset(category,tags) if not tags or tags == "" or tags == variables.all then tags = table.keys(entries) else - tags = utilities.parsers.settings_to_array(tags) + tags = settings_to_array(tags) end for i=1,#tags do entries[tags[i]] = { @@ -76,7 +81,7 @@ function parallel.save(category,tag,content) end -- maybe no strip -- use lpeg - if find(content,"^%s*%[") then + if find(content,"%s*%[") then local done = false for label, content in gmatch(content,"%s*%[(.-)%]%s*([^%[]+)") do if done then @@ -86,7 +91,7 @@ function parallel.save(category,tag,content) done = true end if trace_parallel and label ~= "" then - report_parallel("reference found: category '%s', tag '%s', label '%s'",category,tag,label) + report_parallel("reference found of category %a, tag %a, label %a",category,tag,label) end line.label = label line.content = strip(content) @@ -175,5 +180,5 @@ commands.placeparallel = parallel.place commands.resetparallel = parallel.reset function commands.doifelseparallel(category,tags) - commands.testcase(parallel.hassomecontent(category,tags)) + commands.doifelse(parallel.hassomecontent(category,tags)) end |