Module:Citation/CS1/Arguments
c = {};
exclude = { ['#'] = true, ['1'] = true, ['2'] = true, ['3'] = true, ['4'] = true, ['5'] = true, ['k'] = true, ['v'] = true, ['list'] = true };
function c.build_whitelist( frame )
local title = mw.title.new( "Module:Citation/CS1/sandbox" );
local source = title:getContent();
local result = "whitelist = {<br />\n<br />\n";
local list = {};
for w in source:gmatch( "args%[(.-)%]" ) do
w = w:gsub( "%s*%.%.%s*i%s*%.%.%s*", "#" );
w = w:gsub( "%s*%.%.%s*i", "#" );
w = w:gsub( "i%s*%.%.%s*", "#" );
w = w:gsub('"', '' );
w = w:gsub('1(%D)', '#%1');
w = w:gsub('1$', '#');
list[w] = true;
end
for w in source:gmatch( "args%.([%w%d_-]*)" ) do
w = w:gsub('1(%D)', '#%1');
w = w:gsub('1$', '#');
list[w] = true;
end
for s in source:gmatch( "selectone%(%s*args%s*,%s*{(.-)}" ) do
for w in s:gmatch( "%s*([^,]+)%s*" ) do
w = w:gsub( "%s*%.%.%s*i%s*%.%.%s*", "#" );
w = w:gsub( "%s*%.%.%s*i", "#" );
w = w:gsub( "i%s*%.%.%s*", "#" );
w = w:gsub( '"', '' );
w = w:gsub( "'", '' );
w = w:gsub('1(%D)', '#%1');
w = w:gsub('1$', '#');
w = w:match( "^%s*(.-)%s*$");
list[w] = true;
end
end
title = mw.title.new( "Module:Citation/CS1/Configuration/sandbox" );
source = title:getContent();
for s in source:gmatch( "%sparameters%s*=%s{(.-)}" ) do
for w in s:gmatch( "%s*([^,]+)%s*" ) do
w = w:gsub( "%s*%.%.%s*i%s*%.%.%s*", "#" );
w = w:gsub( "%s*%.%.%s*i", "#" );
w = w:gsub( "i%s*%.%.%s*", "#" );
w = w:gsub( '"', '' );
w = w:gsub( "'", '' );
w = w:gsub('1(%D)', '#%1');
w = w:gsub('1$', '#');
w = w:match( "^%s*(.-)%s*$");
list[w] = true;
end
end
cfg = require( "Module:Citation/CS1/Configuration/sandbox" );
for k, v in pairs( cfg.aliases ) do
if type( v ) == 'table' then
for k2, v2 in pairs( v ) do
list[v2] = true;
list[v2:gsub("#", "")] = true;
end
else
list[v] = true;
list[v:gsub("#", "")] = true;
end
end
local list2 = {};
for k in pairs( list ) do
if exclude[k] == nil then
table.insert( list2, k );
end
end
table.sort( list2 );
result = result .. "basic_arguments = {<br />\n";
for _, k in pairs( list2 ) do
if k:match( "#" ) == nil then
result = result .. " ['" .. k .. "'] = true," .. "<br />\n";
end
end
result = result .. "},<br /> \n<br /> \n";
result = result .. "numbered_arguments = {<br />\n";
for _, k in pairs( list2 ) do
if k:match( "#" ) ~= nil then
result = result .. " ['" .. k .. "'] = true," .. "<br />\n";
end
end
result = result .. "},<br /> \n";
result = result .. "};<br />\n<br />\nreturn whitelist;"
return result;
end
return c;
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.