Title: Module:Namespace detect - freem
URL Source: https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect
Markdown Content:
From freem
_Documentation for this module may be created at [Module:Namespace detect/doc](https://freemwiki.com/index.php?title=Module:Namespace\_detect/doc&action=edit&redlink=1 "Module:Namespace detect/doc (page does not exist)")_
[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-1)--[[[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-2)--------------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-3)-- --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-4)-- NAMESPACE DETECT --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-5)-- --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-6)-- This module implements the {{namespace detect}} template in Lua, with a --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-7)-- few improvements: all namespaces and all namespace aliases are supported, --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-8)-- and namespace names are detected automatically for the local wiki. The --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-9)-- module can also use the corresponding subject namespace value if it is --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-10)-- used on a talk page. Parameter names can be configured for different wikis --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-11)-- by altering the values in the "cfg" table in --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-12)-- Module:Namespace detect/config. --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-13)-- --[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-14)--------------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-15)--]][](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-16)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-17)local data = mw.loadData('Module:Namespace detect/data')[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-18)local argKeys = data.argKeys[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-19)local cfg = data.cfg[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-20)local mappings = data.mappings[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-21)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-22)local yesno = require('Module:Yesno')[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-23)local mArguments -- Lazily initialise Module:Arguments[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-24)local mTableTools -- Lazily initilalise Module:TableTools[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-25)local ustringLower = mw.ustring.lower[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-26)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-27)local p = {}[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-28)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-29)local function fetchValue(t1, t2)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-30)-- Fetches a value from the table t1 for the first key in array t2 where[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-31)-- a non-nil value of t1 exists.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-32)for i, key in ipairs(t2) do[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-33)local value = t1[key][](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-34)if value ~= nil then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-35)return value[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-36)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-37)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-38)return nil[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-39)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-40)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-41)local function equalsArrayValue(t, value)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-42)-- Returns true if value equals a value in the array t. Otherwise[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-43)-- returns false.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-44)for i, arrayValue in ipairs(t) do[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-45)if value == arrayValue then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-46)return true[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-47)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-48)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-49)return false[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-50)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-51)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-52)function p.getPageObject(page)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-53)-- Get the page object, passing the function through pcall in case of[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-54)-- errors, e.g. being over the expensive function count limit.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-55)if page then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-56)local success, pageObject = pcall(mw.title.new, page)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-57)if success then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-58)return pageObject[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-59)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-60)return nil[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-61)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-62)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-63)return mw.title.getCurrentTitle()[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-64)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-65)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-66)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-67)-- Provided for backward compatibility with other modules[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-68)function p.getParamMappings()[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-69)return mappings[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-70)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-71)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-72)local function getNamespace(args)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-73)-- This function gets the namespace name from the page object.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-74)local page = fetchValue(args, argKeys.demopage)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-75)if page == '' then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-76)page = nil[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-77)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-78)local demospace = fetchValue(args, argKeys.demospace)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-79)if demospace == '' then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-80)demospace = nil[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-81)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-82)local subjectns = fetchValue(args, argKeys.subjectns)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-83)local ret[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-84)if demospace then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-85)-- Handle "demospace = main" properly.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-86)if equalsArrayValue(argKeys.main, ustringLower(demospace)) then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-87)ret = mw.site.namespaces[0].name[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-88)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-89)ret = demospace[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-90)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-91)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-92)local pageObject = p.getPageObject(page)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-93)if pageObject then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-94)if pageObject.isTalkPage then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-95)-- Get the subject namespace if the option is set,[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-96)-- otherwise use "talk".[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-97)if yesno(subjectns) then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-98)ret = mw.site.namespaces[pageObject.namespace].subject.name[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-99)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-100)ret = 'talk'[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-101)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-102)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-103)ret = pageObject.nsText[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-104)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-105)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-106)return nil -- return nil if the page object doesn't exist.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-107)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-108)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-109)ret = ret:gsub('_', ' ')[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-110)return ustringLower(ret)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-111)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-112)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-113)function p._main(args)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-114)-- Check the parameters stored in the mappings table for any matches.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-115)local namespace = getNamespace(args) or 'other' -- "other" avoids nil table keys[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-116)local params = mappings[namespace] or {}[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-117)local ret = fetchValue(args, params)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-118)--[[[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-119) -- If there were no matches, return parameters for other namespaces.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-120) -- This happens if there was no text specified for the namespace that[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-121) -- was detected or if the demospace parameter is not a valid[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-122) -- namespace. Note that the parameter for the detected namespace must be[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-123) -- completely absent for this to happen, not merely blank.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-124) --]][](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-125)if ret == nil then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-126)ret = fetchValue(args, argKeys.other)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-127)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-128)return ret[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-129)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-130)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-131)function p.main(frame)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-132)mArguments = require('Module:Arguments')[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-133)local args = mArguments.getArgs(frame, {removeBlanks = false})[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-134)local ret = p._main(args)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-135)return ret or ''[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-136)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-137)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-138)function p.table(frame)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-139)--[[[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-140) -- Create a wikitable of all subject namespace parameters, for[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-141) -- documentation purposes. The talk parameter is optional, in case it[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-142) -- needs to be excluded in the documentation.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-143) --]][](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-144)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-145)-- Load modules and initialise variables.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-146)mTableTools = require('Module:TableTools')[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-147)local namespaces = mw.site.namespaces[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-148)local cfg = data.cfg[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-149)local useTalk = type(frame) == 'table' [](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-150)and type(frame.args) == 'table' [](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-151)and yesno(frame.args.talk) -- Whether to use the talk parameter.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-152)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-153)-- Get the header names.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-154)local function checkValue(value, default)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-155)if type(value) == 'string' then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-156)return value[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-157)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-158)return default[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-159)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-160)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-161)local nsHeader = checkValue(cfg.wikitableNamespaceHeader, 'Namespace')[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-162)local aliasesHeader = checkValue(cfg.wikitableAliasesHeader, 'Aliases')[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-163)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-164)-- Put the namespaces in order.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-165)local mappingsOrdered = {}[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-166)for nsname, params in pairs(mappings) do[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-167)if useTalk or nsname ~= 'talk' then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-168)local nsid = namespaces[nsname].id[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-169)-- Add 1, as the array must start with 1; nsid 0 would be lost otherwise.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-170)nsid = nsid + 1 [](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-171)mappingsOrdered[nsid] = params[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-172)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-173)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-174)mappingsOrdered = mTableTools.compressSparseArray(mappingsOrdered)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-175)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-176)-- Build the table.[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-177)local ret = '{| class="wikitable"'[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-178).. '\n|-'[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-179).. '\n! ' .. nsHeader[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-180).. '\n! ' .. aliasesHeader[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-181)for i, params in ipairs(mappingsOrdered) do[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-182)for j, param in ipairs(params) do[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-183)if j == 1 then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-184)ret = ret .. '\n|-'[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-185).. '\n| ' .. param .. ''[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-186).. '\n| '[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-187)elseif j == 2 then[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-188)ret = ret .. '' .. param .. ''[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-189)else[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-190)ret = ret .. ', ' .. param .. ''[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-191)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-192)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-193)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-194)ret = ret .. '\n|-'[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-195).. '\n|}'[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-196)return ret[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-197)end[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-198)[](https://freemwiki.com/index.php?oldid=579563&title=Module%3ANamespace_detect#L-199)return p