Module:Hatnote: Difference between revisions

trim colons in findNamespaceId by default
(split main, see also, further and details out into their own templates, make formatLink available from #invoke, make other helper functions available from other Lua modules, and add type checks)
(trim colons in findNamespaceId by default)
Line 31:
function p._findNamespaceId(link, removeColon)
-- Finds the namespace id (namespace number) of a link or a pagename. This
-- function will not work if the link is enclosed in double brackets. If theColons
-- are trimmed from the start of the link by default. To skip colon
-- removeColon parameter is set to true, the function will remove initial
-- colonstrimming, fromset the linkremoveColon parameter to true.
checkType('_findNamespaceId', 1, link, 'string')
checkType('_findNamespaceId', 2, removeColon, 'boolean', true)
if removeColon ~= false then
link = removeInitialColon(link)
end
Line 104:
checkType('_formatLink', 2, display, 'string', true)
link = removeInitialColon(link)
local namespace = p._findNamespaceId(link, false)
local colon
if namespace == 6 or namespace == 14 then
Anonymous user