Module:UserLinks/shared

-- This module stores functions that are shared between Module:UserLinks -- and Module:UserLinks/extra.

local p = {}

function p.raiseError(message, section, level) if section then message = message .. '|' .. section end if not level or level == 0 then level = 0 else level = level + 1 end error(message, level) end

function p.makeWikitextError(encodedMessage, demo) local message, section = mw.ustring.match(encodedMessage, '^(.-)|(.*)$') message = message or encodedMessage if section then section = ' (help)' else section = '' end local category if not demo then category = '' mCategoryHandler = require('Module:Category handler') category = mCategoryHandler.main{ all = category -- Categorise all namespaces, but not blacklisted pages. }	end category = category or '' return string.format(		' User-multi error: %s%s. %s',		message, section, category	) end

function p.makeWikilink(page, display) if display then return string.format('%s', page, display) else return string.format('%s', page) end end

function p.makeUrlLink(page, query, display) query = query or {} local url = mw.uri.fullUrl(page, query) url = tostring(url) if display then return string.format('[%s %s]', url, display) else return string.format('[%s]', url) end end

return p