local p = {}
function p.noredirect(pagetitle, label)
if pagetitle == nil or pagetitle == '' then
return error('ページ名が指定されていません')
end
pagetitle = pagetitle:gsub('^%[*', ''):gsub('%]*$', '')
pagetitle = pagetitle:gsub('_', ' ')
pagetitle = pagetitle:gsub('^%s*', ''):gsub('%s*$', '')
if pagetitle == '' then
return error('ページ名が不正です')
elseif pagetitle:find('[<>[%]{}|]') then
return error('ページ名に使用できない記号が含まれています( < > [ ] { } | )')
end
local title = mw.title.new(pagetitle)
if label == nil or label == '' then
label = pagetitle