Module:Citation/CS1/Configuration
< Module:Citation | CS1
Documentation for this module may be created at Module:Citation/CS1/Configuration/doc
-- =============================
-- Module:Citation/CS1/Configuration
-- Patched Safe Version
-- =============================
local p = {}
-- Initialize z table and all category tables
local z = {}
z.message_tail = z.message_tail or {}
z.maintenance_cats = z.maintenance_cats or {}
z.error_categories = z.error_categories or {}
z.properties_cats = z.properties_cats or {}
local render = {}
local no_tracking_cats = false -- or set according to module logic
-- Append categories safely if tracking is enabled
if not no_tracking_cats then
-- Error categories
for _, v in ipairs(z.error_categories) do
table.insert(render, utilities.substitute(cfg.messages['cat wikilink'], {v}))
end
-- Maintenance categories
for _, v in ipairs(z.maintenance_cats) do
table.insert(render, utilities.substitute(cfg.messages['cat wikilink'], {v}))
end
-- Properties categories
for _, v in ipairs(z.properties_cats) do
table.insert(render, utilities.substitute(cfg.messages['cat wikilink'], {v}))
end
end
-- Identifier limits loading
local id_limits_data_t = id_limits_data_t or {}
local id_limits_data_load_fail = false
local tab_data_t = mw.ext.data.get('CS1/Identifier limits.tab')
if not tab_data_t or tab_data_t == false then
id_limits_data_load_fail = true
else
local data_table = tab_data_t.data or {}
for _, limit_t in ipairs(data_table) do
id_limits_data_t[limit_t[1]] = limit_t[2]
end
end
-- Safe validate function
local function validate(name, cite_class, empty)
local name = tostring(name)
local enum_name
local state
-- Example: put actual validation logic here
state = true
return state
end
-- Function to render all categories
p.render_categories = function()
return table.concat(render)
end
-- Example function to access identifier limits safely
p.get_id_limit = function(identifier)
if id_limits_data_load_fail then
return nil
end
return id_limits_data_t[identifier]
end
return p