Changes

Jump to navigation Jump to search

Module:Hatnote

120 bytes added, 09:43, 16 April 2014
prevent categories escaped with the colon trick being displayed as "article"
--------------------------------------------------------------------------------
local function 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 or if. If the -- removeColon parameter is set to true, the function will remove initial -- colons from the link has been escaped with the colon trick. if removeColon then link = link:match('^:?(.*)') end
local namespace = link:match('^(.-):')
if namespace then
-- colon trick for categories and files, as otherwise category links
-- categorise the page and file links display the file.
link = link:match('^:?(.*)') or link -- Remove initial colon if specified.
local namespace = findNamespaceId(link)
local colon
-- Find the pagetype.
local firstPageNs = findNamespaceId(firstPage, true)
local pagetype = firstPageNs == 0 and 'article' or 'page'
Anonymous user

Navigation menu