モジュール:サンドボックス/BadEditor
ナビゲーションに移動
検索に移動
local p = {}
function p.main ( frame )
local args = require( 'Module:Arguments' ).getArgs( frame, { wrappers = 'Template:タグ', removeBlanks = false } )
local name_space = {}
local article = {}
local tag_name = {}
local n_flag = -1;
local temp = '';
local max = 0;
for i = 1, 10 do
article[i] = args[i] or '';
if article[i] == '' then
break
else
max = i;
end
temp = 'タグ名' ..i;
tag_name[i] = args[temp] or '';
if tag_name[i] == '' then
tag_name[i] = article[i];
end
end
temp = '名前空間';
name_space[99] = args[temp] or '';
if name_space[99] ~= '' then
n_flag = 1;
end
for i = 1, max do
temp = '名前空間' ..i;
name_space[i] = args[temp] or '';
if name_space[i] == '' then
if n_flag == 1 then
if name_space[99] == '記事' then
name_space[i] = '';
elseif name_space[99] == 'カテゴリ' then
name_space[i] = ':カテゴリ:' ..article[i] ..'|';
else
name_space[i] = name_space[99] ..':' ..article[i] ..'|';
end
end
elseif name_space[i] == '記事' then
name_space[i] = '';
elseif name_space[i] == 'カテゴリ' then
name_space[i] = ':カテゴリ:' ..article[i] ..'|';
else
name_space[i] = name_space[i] ..':' ..article[i] ..'|';
end
end
local text = '<div style="border: 1px solid #aaa; background: #f9f9f9; margin-top: 1em; padding: 2px;"><span style="background: #cfc; padding: 5px; font-weight: bold;">タグ:</span> ';
for i = 1, max do
text = text ..'[[' ..name_space[i] ..tag_name[i] ..']]'
if max ~= i then
text = text.. ' / ';
end
end
-- +{{PAGENAME}}
text = text ..' 【[{{fullurl:特別:リンク元/' ..frame:preprocess('{{PAGENAME}}') ..'|namespace=0&hideredirs=1}} ' ..frame:preprocess('{{PAGENAME}}') ..'へリンクしているページ]】</div>'
return text
end
return p