ElEditors, Interface administrators, Administrators
70,981
edits
No edit summary |
Tag: Undo |
||
(9 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
-- Main process | -- Main process | ||
function p.main(frame) | function p.main(frame, lang) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local named_list = {} | local named_list = {} | ||
local not_exist = {} | local not_exist = {} | ||
local chars = frame:preprocess('{{:MediaWiki:NavSidebar/Character}}') | lang = lang or args.lang | ||
if lang then lang = '/' .. lang else lang = '' end | |||
local chars = frame:preprocess('{{:MediaWiki:NavSidebar' .. lang .. '/Character}}') | |||
-- Get rid of link wikitext. | -- Get rid of link wikitext. | ||
:gsub('%[%[', ''):gsub('%]%]', '') | :gsub('%[%[', ''):gsub('%]%]', '') | ||
Line 35: | Line 37: | ||
end | end | ||
end | end | ||
local placeholder = '%#!%|' | |||
-- Shift the new table's indexes up after getting rid of the base name. | -- Shift the new table's indexes up after getting rid of the base name. | ||
Line 42: | Line 46: | ||
-- Remove link placeholders. | -- Remove link placeholders. | ||
for k2, v2 in ipairs(named_list[k][i]) do | for k2, v2 in ipairs(named_list[k][i]) do | ||
local name = named_list[k][i][k2]:gsub('</div>', ''):gsub("<div id='nav'>", '') | local name = trim(named_list[k][i][k2]:gsub('</div>', ''):gsub("<div id='nav'>", '')) | ||
named_list[k][i][k2] = | local name_replace = name:gsub(placeholder, ''); | ||
named_list[k][i][k2] = name_replace | |||
-- Create a table of characters with placeholders, marked as not released. | -- Create a table of characters with placeholders, marked as not released. | ||
if string.match(name, | if string.match(name, placeholder) then | ||
table.insert(not_exist, | table.insert(not_exist, name_replace); | ||
end | end | ||
end | end | ||
Line 63: | Line 68: | ||
base_order, named_list, not_exist | base_order, named_list, not_exist | ||
} | } | ||
if args.dump then return dump(char_list) end | |||
return char_list | return char_list |