Anonymous user
Module:Navbar: Difference between revisions
return error for non-existent page
m (Protected Module:Navbar: Highly visible template: Used on a significant number of pages, but also still in testing. ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only autoconfirmed users] (indefinite))) |
(return error for non-existent page) |
||
Line 5:
function trim(s)
return mw.ustring.match( s, "^%s*(.-)%s*$" )
end
function error(s)
local span = HtmlBuilder.create('span')
end
function _navbar( args )
if not args[1] then
▲ span
▲ .addClass('error')
▲ .css('float', 'left')
▲ .css('white-space', 'nowrap')
▲ .wikitext('Error: No name provided')
▲ return span
end
Line 26 ⟶ 30:
else
title = mw.title.new( pageName, 'Template' );
end
if not title then
return error('Page does not exist')
end
local mainpage = title.fullText;
|