+--------- Convenience functions for simple style configuration -----------------
+
+
+function module.set_prefilters(data)
+ PRE_DELETE = module.tag_match{keys = data.delete_keys, tags = data.delete_tags}
+ PRE_EXTRAS = module.tag_match{keys = data.extra_keys,
+ tags = data.extra_tags}
+ module.TAGINFO_MAIN.delete_tags = data.delete_tags
+end
+
+function module.set_main_tags(data)
+ MAIN_KEYS = data
+ local keys = {}
+ for k, _ in pairs(data) do
+ table.insert(keys, k)
+ end
+ module.TAGINFO_MAIN.keys = keys
+end
+
+function module.set_name_tags(data)
+ NAMES = module.tag_group(data)
+
+ for _, lst in pairs(data) do
+ for _, k in ipairs(lst) do
+ local key = process_key(k)
+ if key ~= nil then
+ module.TAGINFO_NAME_KEYS[key] = true
+ end
+ end
+ end
+end
+
+function module.set_address_tags(data)
+ if data.postcode_fallback ~= nil then
+ POSTCODE_FALLBACK = data.postcode_fallback
+ data.postcode_fallback = nil
+ end
+ ADDRESS_TAGS = module.tag_group(data)
+
+ for _, lst in pairs(data) do
+ if lst ~= nil then
+ for _, k in ipairs(lst) do
+ local key = process_key(k)
+ if key ~= nil then
+ module.TAGINFO_ADDRESS_KEYS[key] = true
+ end
+ end
+ end
+ end
+end
+
+function module.set_unused_handling(data)
+ 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
+ elseif data.delete_keys == nil and data.delete_tags == nil then
+ POST_DELETE = nil
+ SAVE_EXTRA_MAINS = module.tag_match{keys = data.extra_keys, tags = data.extra_tags}
+ else
+ error("unused handler can have only 'extra_keys' or 'delete_keys' set.")
+ end
+end
+
+function module.set_relation_types(data)
+ module.RELATION_TYPES = {}
+ for k, v in data do
+ if v == 'multipolygon' then
+ module.RELATION_TYPES[k] = module.relation_as_multipolygon
+ elseif v == 'multiline' then
+ module.RELATION_TYPES[k] = module.relation_as_multiline
+ end
+ end
+end