summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/publ-ini.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-10-19 14:39:05 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-10-19 14:39:05 +0200
commitcb218b728af372a1ed6c9188765022dc057799ac (patch)
treee49fabd549e06c42d2f9e3e9e87ab57e6d2c34d0 /tex/context/base/mkiv/publ-ini.lua
parent4a7fb336e5a59645520c05690efe98c9c7270d37 (diff)
downloadcontext-cb218b728af372a1ed6c9188765022dc057799ac.tar.gz
2017-10-19 13:56:00
Diffstat (limited to 'tex/context/base/mkiv/publ-ini.lua')
-rw-r--r--tex/context/base/mkiv/publ-ini.lua47
1 files changed, 45 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua
index 5ff701c37..07160ec57 100644
--- a/tex/context/base/mkiv/publ-ini.lua
+++ b/tex/context/base/mkiv/publ-ini.lua
@@ -489,7 +489,7 @@ end
local findallused do
local reported = { }
- local finder = publications.finder
+ ----- finder = publications.finder
findallused = function(dataset,reference,internal,forcethem)
local current = datasets[dataset]
@@ -642,6 +642,29 @@ local findallused do
return okay, todo, tags
end
+ local firstoftwoarguments = context.firstoftwoarguments
+ local secondoftwoarguments = context.secondoftwoarguments
+
+ implement {
+ name = "btxdoifelsematches",
+ arguments = { "string", "string", "string" },
+ actions = function(dataset,tag,expression)
+ local find = publications.finder(dataset,expression)
+ local okay = false
+ if find then
+ local d = datasets[dataset]
+ if d then
+ local e = d.luadata[tag]
+ if e and find(e) then
+ firstoftwoarguments()
+ return
+ end
+ end
+ end
+ secondoftwoarguments()
+ end
+ }
+
end
local function unknowncite(reference)
@@ -1813,6 +1836,7 @@ do
end
local method = specification.method or v_none
local ignored = specification.ignored or ""
+ local filter = specification.filter or ""
rendering.method = method
rendering.ignored = ignored ~= "" and settings_to_set(ignored) or nil
rendering.list = { }
@@ -1837,6 +1861,24 @@ do
end
filtermethod(dataset,rendering,keyword)
local list = rendering.list
+ if list and filter ~= "" then
+ local find = publications.finder(dataset,filter)
+ if find then
+ local luadata = datasets[dataset].luadata
+ local matched = 0
+ for i=1,#list do
+ local found = list[i]
+ local entry = luadata[found[1]]
+ if find(entry) then
+ matched = matched + 1
+ list[matched] = found
+ end
+ end
+ for i=#list,matched + 1,-1 do
+ list[i] = nil
+ end
+ end
+ end
ctx_btxsetnoflistentries(list and #list or 0)
end
@@ -2265,6 +2307,7 @@ do
{ "repeated" },
{ "ignored" },
{ "group" },
+ { "filter" },
}
}
}
@@ -3343,7 +3386,7 @@ do
-- local lpegmatch = lpeg.match
local splitter = lpeg.tsplitat(":")
- interfaces.implement {
+ implement {
name = "checkinterfacechain",
arguments = { "string", "string" },
actions = function(str,command)