Module:Hatnote: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(make makeWikitextError use Module:Yesno to parse the demo parameter, and remove underscores from all the function names, as that's normally done for private functions, whereas these are public)
(move formatLink back to the underscore - that one is necessary)
Line 113: Line 113:
return p.makeWikitextError('no link specified')
return p.makeWikitextError('no link specified')
end
end
return p.formatLink(link, display)
return p._formatLink(link, display)
end
end


function p.formatLink(link, display)
function p._formatLink(link, display)
-- Find whether we need to use the colon trick or not. We need to use the
-- Find whether we need to use the colon trick or not. We need to use the
-- colon trick for categories and files, as otherwise category links
-- colon trick for categories and files, as otherwise category links
-- categorise the page and file links display the file.
-- categorise the page and file links display the file.
checkType('formatLink', 1, link, 'string')
checkType('_formatLink', 1, link, 'string')
checkType('formatLink', 2, display, 'string', true)
checkType('_formatLink', 2, display, 'string', true)
link = removeInitialColon(link)
link = removeInitialColon(link)
local namespace = p.findNamespaceId(link, false)
local namespace = p.findNamespaceId(link, false)