Modulo:Sandbox/trappist the monk/parameter match test: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
←Nuova pagina: --[[--------------------------< P A R A M E T E R M A T C H T E S T >-------------------------------------- this module is a hack intended to be run from the debug console. The module assembles and then compares lists of cs1|2 parameters extracted from the cs1|2 whitelist module and from the cs1|2 configuration module. In general, these lists should match. the module returns one of five tables. In the debug console the commands are: =p.aliases – return... |
+sandbox; |
||
Riga 11:
=p.alias_params_not_in_whitelist – returns a list of parameters found in the ~/Configuration module but not found in the ~/Whitelist module
=p.wh_params_not_in_aliases – returns a list of parameters found in the ~/Whitelist module but not found in the ~/Configuration module
set <use_sandboxen> to true to run the above comparisons against the module suite's sandboxen. if sandboxen don't exist, <use_sandboxen> is ignored
copies of this module are located at:
Riga 25 ⟶ 27:
local lang_code = mw.language.getContentLanguage():getCode(); -- so that this can be used at multiple wikis
--lang_code = '
local use_sandboxen = false; -- set to true to evaluate the modules suite's sandboxen
local module; -- name of module to be loaded is assembled here
local modules = {
da = {whitelist = 'Modul:Citation/CS1/Whitelist', configuration = 'Modul:Citation/CS1/Configuration'},
en = {whitelist = 'Module:Citation/CS1/Whitelist', configuration = 'Module:Citation/CS1/Configuration'},
es = {whitelist = 'Módulo:Citas/Whitelist', configuration = 'Módulo:Citas/Configuración'},
ES = {whitelist = 'Module:Sandbox/trappist_the_monk/parameter_match_test/Whitelist/es', configuration = 'Module:Sandbox/trappist_the_monk/parameter_match_test/Configuration/es'}, -- use local copies▼
it = {whitelist = 'Modulo:Citazione/Whitelist', configuration = 'Modulo:Citazione/Configurazione'},
nb = {whitelist = 'Modul:Citation/CS1/Whitelist', configuration = 'Modul:Citation/CS1/Configuration'},
tr = {whitelist = 'Modül:Kaynak/KB1/Beyazliste', configuration = 'Modül:Kaynak/KB1/Yapılandırma'},
-- local copies for when I can't create this module at xx.wiki
TR = {whitelist = 'Module:Sandbox/trappist_the_monk/parameter_match_test/Whitelist/tr', configuration = 'Module:Sandbox/trappist_the_monk/parameter_match_test/Configuration/tr'}, -- use local copies▼
▲ ES = {whitelist = 'Module:Sandbox/trappist_the_monk/parameter_match_test/Whitelist/es', configuration = 'Module:Sandbox/trappist_the_monk/parameter_match_test/Configuration/es'},
▲ TR = {whitelist = 'Module:Sandbox/trappist_the_monk/parameter_match_test/Whitelist/tr', configuration = 'Module:Sandbox/trappist_the_monk/parameter_match_test/Configuration/tr'},
}
local sandboxen = {
da = '/sandkasse',
en = '/sandbox',
es = nil, -- apparently '/zona de pruebas' but as of 2021-08-30 only Módulo:Citas/zona de pruebas exists
it = '/sandbox',
nb = '/sandkasse',
tr = nil, -- apparently '/deneme' or possibly '/sandbox'; as of 2021-08-30 none exist
}
local whitelist_m = mw.loadData (table.concat ({modules[lang_code].whitelist, use_sandboxen and sandboxen[lang_code] or ''}));
local whitelist_t = {}; -- a master list of all whitelist parameters
Riga 53 ⟶ 68:
local special_sections = {'preprint_arguments', 'unique_arguments'};
local configuration_m = mw.loadData (table.concat ({modules[lang_code].configuration, use_sandboxen and sandboxen[lang_code] or ''}));
local aliases_t = {}; -- a master k/v table of all parameter aliases
local aliases_dups_t = {}; -- a sequence table of parameter aliases that are used in multiple metaparameters
Riga 72 ⟶ 87:
for k1, v1_t in pairs (whitelist_m[section]) do
for k, v in pairs (whitelist_m[section][k1]) do
whitelist_t[k] = table.concat ({section
end
end
Riga 109 ⟶ 124:
elseif 'number' == type (params_t) then -- here when <params_t> is a number
local param = params_t;
param = table.concat ({'error: alias '
aliases_t[param] = meta; -- add this <param> with its error message to <aliases_t>
end
Riga 127 ⟶ 142:
table.insert (aliases_dups_t, table.concat ({param, ' in: id_handlers.', 'custom_access', ' duplicated in: ', aliases_t[param]})); -- make a note
elseif param then
aliases_t[param] = table.concat ({'id_handlers.'
end
end
Riga 147 ⟶ 162:
table.sort (aliases_dups_t);
table.insert (wh_params_not_in_aliases_t, 1,
table.concat ({
table.insert (alias_params_not_in_whitelist_t, 1, '~/Configuration alias parameters not found in ~/Whitelist:');▼
'~/Whitelist',
table.insert (aliases_dups_t, 1, 'parameters found in multiple ~/Configuration metaparameters:');▼
use_sandboxen and sandboxen[lang_code] or '',
' parameters not found in ~/Configuration',
use_sandboxen and sandboxen[lang_code] or ''
, ' aliases list:'
}));
▲table.insert (alias_params_not_in_whitelist_t, 1,
table.concat ({
'~/Configuration',
use_sandboxen and sandboxen[lang_code] or '',
' alias parameters not found in ~/Whitelist',
use_sandboxen and sandboxen[lang_code] or '',
':'
}));
table.insert (aliases_dups_t, 1,
table.concat({
use_sandboxen and sandboxen[lang_code] or '',
' metaparameters:'
}));
local aliases = mw.dumpObject (aliases_t);
|