| Line 9: |
Line 9: |
| | local validation; -- functions in Module:Citation/CS1/Date_validation | | local validation; -- functions in Module:Citation/CS1/Date_validation |
| | | | |
| − | -- Load strict mode | + | local utilities; -- functions in Module:Citation/CS1/Utilities |
| − | require('strict')
| + | local z = {}; -- table of tables in Module:Citation/CS1/Utilities |
| | | | |
| − | -- load Utilities first so we can keep it in sync with the effective cfg | + | local identifiers; -- functions and tables in Module:Citation/CS1/Identifiers |
| − | local utilities = require('Module:Citation/CS1/Utilities')
| + | local metadata; -- functions in Module:Citation/CS1/COinS |
| − | local z = utilities.z
| + | local cfg = {}; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration |
| − | | + | local whitelist = {}; -- table of tables listing valid template parameter names; defined in Module:Citation/CS1/Whitelist |
| − | local validation = require('Module:Citation/CS1/Date_validation')
| |
| − | local identifiers = require('Module:Citation/CS1/Identifiers')
| |
| − | local metadata = require('Module:Citation/CS1/COinS') | |
| − | | |
| − | -- load configuration (read-only) and wrap it so we can provide safe defaults | |
| − | local raw_cfg = mw.loadData('Module:Citation/CS1/Configuration')
| |
| − | local cfg = setmetatable({}, { __index = raw_cfg }) | |
| − | | |
| − | -- MINIMUM safe defaults so fields are never nil | |
| − | cfg.basic_arguments = raw_cfg.basic_arguments or {}
| |
| − | cfg.presentation = raw_cfg.presentation or {}
| |
| − | cfg.error_conditions = raw_cfg.error_conditions or {}
| |
| − | cfg.messages = raw_cfg.messages or {}
| |
| − | cfg.maint_cats = raw_cfg.maint_cats or {}
| |
| − | cfg.prop_cats = raw_cfg.prop_cats or {}
| |
| − | | |
| − | -- whitelist stays read-only
| |
| − | local whitelist = mw.loadData('Module:Citation/CS1/Whitelist')
| |
| − | | |
| − | -- keep Utilities aligned with this effective cfg
| |
| − | utilities.set_selected_modules(cfg)
| |
| − | | |
| − | | |
| − | -- Synchronize Utilities with the same config CS1 uses
| |
| − | utilities.set_selected_modules(cfg)
| |
| − | | |
| − | -- Use Utilities’ state table
| |
| − | local z = utilities.z
| |
| | | | |
| | | | |