- if data.extra_keys == nil and data.extra_tags == nil then
- POST_DELETE = module.tag_match{keys = data.delete_keys, tags = data.delete_tags}
- SAVE_EXTRA_MAINS = function() return true end
+ if type(data) == 'function' then
+ EXTRATAGS_FILTER = data
+ elseif data == nil then
+ EXTRATAGS_FILTER = default_extratags_filter
+ elseif data.extra_keys == nil and data.extra_tags == nil then
+ local delfilter = module.tag_match{keys = data.delete_keys, tags = data.delete_tags}
+ EXTRATAGS_FILTER = function (p, k)
+ local extra = {}
+ for kin, vin in pairs(p.intags) do
+ if kin ~= k and not delfilter(kin, vin) then
+ extra[kin] = vin
+ end
+ end
+ if next(extra) == nil then
+ return p.extratags
+ end
+ for kextra, vextra in pairs(p.extratags) do
+ extra[kextra] = vextra
+ end
+ return extra
+ end