మాడ్యూల్:Cs1 documentation support: కూర్పుల మధ్య తేడాలు

Content deleted Content added
దిద్దుబాటు సారాంశం లేదు
+script_lister();
పంక్తి 3:
adds code/name pair to code_list and name/code pair to name_list; code/name pairs in override_list replace those
taken from the MediaWiki list; these are marked with a superscripted dagger.
 
|script-<param>= lang codes always use override names so dagger is omitted
 
]]
 
local function add_to_list (code_list, name_list, override_list, code, name, dagger)
if false == dagger then
dagger = ''; -- no dagger for |script-<param>= codes and names
else
dagger = '<sup>†</sup>'; -- dagger for all other lists using override
end
 
if override_list[code] then -- look in the override table for this code
code_list[code] = override_list[code] .. '<sup>†</sup>'dagger; -- use the name from the override table; mark with dagger
name_list[override_list[code]] = code .. '<sup>†</sup>'dagger;
-- code_list[code] = override_list[code] .. '<sup>†</sup>'; -- use the name from the override table; mark with dagger
-- name_list[override_list[code]] = code .. '<sup>†</sup>';
else
code_list[code] = name; -- use the MediaWiki name and code
Line 37 ⟶ 47:
Crude documentation tool that returns one of several lists of language codes and names.
 
{{#invoke:cs1|lang_listercs1_lang_lister|lister|list=<selector>}}
 
where <selector> is one of the values:
Line 93 ⟶ 103:
return table.concat (out, '\n');
 
end
 
 
--[[--------------------------< S C R I P T _ L I S T E R >----------------------------------------------------
 
Module entry point
 
Crude documentation tool that returns list of language codes and names supported by the various |script-<param>= parameters.
 
{{#invoke:cs1_lang_lister|script_lister}}
 
]]
 
local function script_lister ()
local lang_code_src = mw.loadData ('Module:Citation/CS1/Configuration').script_lang_codes ; -- get list of allowed script language codes
local override = require ("Module:Citation/CS1/Configuration").lang_code_remap;
 
local code_list = {}; -- interim list of aliases
local name_list={}; -- not used; defined here so that we can reuse add_to_list()
local out = {}; -- final output (for now an unordered list)
for _, code in ipairs (lang_code_src) do -- loop throu the list of code
local name = mw.language.fetchLanguageName (code, 'en'); -- get the language name associated with this code
add_to_list (code_list, name_list, override, code, name, false); -- name_list{} not used but provided so that we can reuse add_to_list(); don't add superscript dagger
end
local result = {};
local out = {};
 
list_format (result, code_list);
 
table.sort (result);
table.insert (result, 1, '<div class="div-col columns column-width" style="column-width:20em">');
table.insert (out, table.concat (result, '\n*'));
table.insert (out, '</div>');
return table.concat (out, '\n');
end
 
Line 137 ⟶ 184:
alias_lister = alias_lister,
lister = lister,
script_lister = script_lister,
};
"https://te.wikipedia.org/wiki/మాడ్యూల్:Cs1_documentation_support" నుండి వెలికితీశారు