Title: Module:Documentation - freem URL Source: https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation Markdown Content: [Jump to content](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#bodyContent) - [x] Main menu Main menu move to sidebar hide Navigation * [Main page](https://freemwiki.com/wiki/Main_Page "Visit the main page [alt-shift-z]") * [Recent changes](https://freemwiki.com/wiki/Special:RecentChanges "A list of recent changes in the wiki [alt-shift-r]") * [Random page](https://freemwiki.com/wiki/Special:Random "Load a random page [alt-shift-x]") * [Help about MediaWiki](https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents) Legal * [Terms](https://freemwiki.com/wiki/Terms_of_Service) * [Privacy Policy](https://freemwiki.com/wiki/Privacy_Policy) * [About](https://freemwiki.com/wiki/About) * [Contact](https://freemwiki.com/wiki/Contact) [![Image 1](https://freemwiki.com/images/freem.svg)**freem**](https://freemwiki.com/wiki/Main_Page) [Search](https://freemwiki.com/wiki/Special:Search "Search freem [alt-shift-f]") Search - [x] Appearance * [Create account](https://freemwiki.com/index.php?title=Special:CreateAccount&returnto=Module%3ADocumentation&returntoquery=oldid%3D579600 "You are encouraged to create an account and log in; however, it is not mandatory") * [Log in](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3ADocumentation&returntoquery=oldid%3D579600 "You are encouraged to log in; however, it is not mandatory [alt-shift-o]") - [x] Personal tools * [Create account](https://freemwiki.com/index.php?title=Special:CreateAccount&returnto=Module%3ADocumentation&returntoquery=oldid%3D579600 "You are encouraged to create an account and log in; however, it is not mandatory") * [Log in](https://freemwiki.com/index.php?title=Special:UserLogin&returnto=Module%3ADocumentation&returntoquery=oldid%3D579600 "You are encouraged to log in; however, it is not mandatory [alt-shift-o]") Pages for logged out editors [learn more](https://freemwiki.com/wiki/Help:Introduction) * [Contributions](https://freemwiki.com/wiki/Special:MyContributions "A list of edits made from this IP address [alt-shift-y]") * [Talk](https://freemwiki.com/wiki/Special:MyTalk "Discussion about edits from this IP address [alt-shift-n]") # Module:Documentation - [x] Add languages * [Module](https://freemwiki.com/wiki/Module:Documentation "View the module page [alt-shift-c]") * [Discussion](https://freemwiki.com/index.php?title=Module_talk:Documentation&action=edit&redlink=1 "Discussion about the content page (page does not exist) [alt-shift-t]") - [x] English * [Read](https://freemwiki.com/wiki/Module:Documentation) * [Edit source](https://freemwiki.com/index.php?title=Module:Documentation&action=edit "Edit the source code of this page [alt-shift-e]") * [View history](https://freemwiki.com/index.php?title=Module:Documentation&action=history "Past revisions of this page [alt-shift-h]") - [x] Tools Tools move to sidebar hide Actions * [Read](https://freemwiki.com/wiki/Module:Documentation) * [Edit source](https://freemwiki.com/index.php?title=Module:Documentation&action=edit "Edit the source code of this page [alt-shift-e]") * [View history](https://freemwiki.com/index.php?title=Module:Documentation&action=history) General * [What links here](https://freemwiki.com/wiki/Special:WhatLinksHere/Module:Documentation "A list of all wiki pages that link here [alt-shift-j]") * [Related changes](https://freemwiki.com/wiki/Special:RecentChangesLinked/Module:Documentation "Recent changes in pages linked from this page [alt-shift-k]") * [Special pages](https://freemwiki.com/wiki/Special:SpecialPages "A list of all special pages [alt-shift-q]") * [Printable version](javascript:print(); "Printable version of this page [alt-shift-p]") * [Permanent link](https://freemwiki.com/index.php?title=Module:Documentation&oldid=579600 "Permanent link to this revision of this page") * [Page information](https://freemwiki.com/index.php?title=Module:Documentation&action=info "More information about this page") Appearance move to sidebar hide From freem Revision as of 06:18, 21 October 2025 by [Lukegao](https://freemwiki.com/index.php?title=User:Lukegao&action=edit&redlink=1 "User:Lukegao (page does not exist)")([talk](https://freemwiki.com/index.php?title=User_talk:Lukegao&action=edit&redlink=1 "User talk:Lukegao (page does not exist)") | [contribs](https://freemwiki.com/wiki/Special:Contributions/Lukegao "Special:Contributions/Lukegao"))(1 revision imported) ([diff](https://freemwiki.com/index.php?title=Module:Documentation&diff=prev&oldid=579600 "Module:Documentation")) [← Older revision](https://freemwiki.com/index.php?title=Module:Documentation&direction=prev&oldid=579600 "Module:Documentation") | Latest revision (diff) | Newer revision → (diff) _Documentation for this module may be created at [Module:Documentation/doc](https://freemwiki.com/index.php?title=Module:Documentation/doc&action=edit&redlink=1 "Module:Documentation/doc (page does not exist)")_ [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-1)-- This module implements {{[documentation](https://freemwiki.com/wiki/Template:Documentation "Template:Documentation")}}.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-2)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-3)-- Get required modules.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-4)local getArgs = require(['Module:Arguments'](https://freemwiki.com/wiki/Module:Arguments)).getArgs[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-5)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-6)-- Get the config table.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-7)local cfg = mw.loadData(['Module:Documentation/config'](https://freemwiki.com/wiki/Module:Documentation/config))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-8)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-9)local p = {}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-10)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-11)-- Often-used functions.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-12)local ugsub = mw.ustring.gsub[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-13)local format = mw.ustring.format[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-14)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-15)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-16)-- Helper functions[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-17)--[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-18)-- These are defined as local functions, but are made available in the p[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-19)-- table for testing purposes.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-20)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-21)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-22)local function message(cfgKey, valArray, expectType)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-23)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-24) -- Gets a message from the cfg table and formats it if appropriate.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-25) -- The function raises an error if the value from the cfg table is not[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-26) -- of the type expectType. The default type for expectType is 'string'.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-27) -- If the table valArray is present, strings such as $1, $2 etc. in the[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-28) -- message are substituted with values from the table keys [1], [2] etc.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-29) -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-30) -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-31) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-32)local msg = cfg[cfgKey][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-33)expectType = expectType or 'string'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-34)if type(msg) ~= expectType then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-35)error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-36)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-37)if not valArray then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-38)return msg[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-39)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-40)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-41)local function getMessageVal(match)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-42)match = tonumber(match)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-43)return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-44)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-45)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-46)return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-47)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-48)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-49)p.message = message[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-50)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-51)local function makeWikilink(page, display)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-52)if display then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-53)return format('[[%s|%s]]', page, display)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-54)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-55)return format('[[%s]]', page)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-56)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-57)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-58)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-59)p.makeWikilink = makeWikilink[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-60)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-61)local function makeCategoryLink(cat, sort)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-62)local catns = mw.site.namespaces[14].name[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-63)return makeWikilink(catns .. ':' .. cat, sort)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-64)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-65)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-66)p.makeCategoryLink = makeCategoryLink[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-67)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-68)local function makeUrlLink(url, display)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-69)return format('[%s %s]', url, display)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-70)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-71)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-72)p.makeUrlLink = makeUrlLink[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-73)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-74)local function makeToolbar(...)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-75)local ret = {}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-76)local lim = select('#', ...)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-77)if lim < 1 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-78)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-79)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-80)for i = 1, lim do[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-81)ret[#ret + 1] = select(i, ...)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-82)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-83)-- 'documentation-toolbar'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-84)return format([](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-85)'(%s)',[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-86)message('toolbar-class'),[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-87)table.concat(ret, ' | ')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-88))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-89)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-90)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-91)p.makeToolbar = makeToolbar[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-92)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-93)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-94)-- Argument processing[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-95)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-96)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-97)local function makeInvokeFunc(funcName)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-98)return function (frame)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-99)local args = getArgs(frame, {[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-100)valueFunc = function (key, value)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-101)if type(value) == 'string' then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-102)value = value:match('^%s*(.-)%s*$') -- Remove whitespace.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-103)if key == 'heading' or value ~= '' then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-104)return value[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-105)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-106)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-107)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-108)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-109)return value[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-110)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-111)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-112)})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-113)return p[funcName](args)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-114)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-115)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-116)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-117)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-118)-- Entry points[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-119)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-120)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-121)function p.nonexistent(frame)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-122)if mw.title.getCurrentTitle().subpageText == 'testcases' then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-123)return frame:expandTemplate{title = 'module test cases notice'}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-124)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-125)return p.main(frame)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-126)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-127)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-128)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-129)p.main = makeInvokeFunc('_main')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-130)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-131)function p._main(args)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-132)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-133) -- This function defines logic flow for the module.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-134) -- @args - table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-135) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-136)local env = p.getEnvironment(args)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-137)local root = mw.html.create()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-138)root[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-139):wikitext(p._getModuleWikitext(args, env))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-140):wikitext(p.protectionTemplate(env))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-141):wikitext(p.sandboxNotice(args, env))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-142):tag('div')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-143)-- 'documentation-container'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-144):addClass(message('container'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-145):attr('role', 'complementary')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-146):attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-147):attr('aria-label', args.heading == '' and 'Documentation' or nil)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-148):newline()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-149):tag('div')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-150)-- 'documentation'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-151):addClass(message('main-div-classes'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-152):newline()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-153):wikitext(p._startBox(args, env))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-154):wikitext(p._content(args, env))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-155):tag('div')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-156)-- 'documentation-clear'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-157):addClass(message('clear'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-158):done()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-159):newline()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-160):done()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-161):wikitext(p._endBox(args, env))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-162):done()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-163):wikitext(p.addTrackingCategories(env))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-164)-- 'Module:Documentation/styles.css'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-165)return mw.getCurrentFrame():extensionTag ([](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-166)'templatestyles', '', {src=cfg['templatestyles'][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-167)}) .. tostring(root)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-168)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-169)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-170)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-171)-- Environment settings[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-172)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-173)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-174)function p.getEnvironment(args)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-175)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-176) -- Returns a table with information about the environment, including title[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-177) -- objects and other namespace- or path-related data.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-178) -- @args - table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-179) --[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-180) -- Title objects include:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-181) -- env.title - the page we are making documentation for (usually the current title)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-182) -- env.templateTitle - the template (or module, file, etc.)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-183) -- env.docTitle - the /doc subpage.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-184) -- env.sandboxTitle - the /sandbox subpage.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-185) -- env.testcasesTitle - the /testcases subpage.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-186) --[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-187) -- Data includes:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-188) -- env.protectionLevels - the protection levels table of the title object.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-189) -- env.subjectSpace - the number of the title's subject namespace.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-190) -- env.docSpace - the number of the namespace the title puts its documentation in.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-191) -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-192) -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-193) -- [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-194) -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-195) -- returned will be nil.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-196) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-197)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-198)local env, envFuncs = {}, {}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-199)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-200)-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-201)-- returned by that function is memoized in the env table so that we don't call any of the functions[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-202)-- more than once. (Nils won't be memoized.)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-203)setmetatable(env, {[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-204)__index = function (t, key)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-205)local envFunc = envFuncs[key][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-206)if envFunc then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-207)local success, val = pcall(envFunc)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-208)if success then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-209)env[key] = val -- Memoise the value.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-210)return val[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-211)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-212)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-213)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-214)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-215)})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-216)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-217)function envFuncs.title()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-218)-- The title object for the current page, or a test page passed with args.page.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-219)local title[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-220)local titleArg = args.page[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-221)if titleArg then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-222)title = mw.title.new(titleArg)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-223)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-224)title = mw.title.getCurrentTitle()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-225)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-226)return title[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-227)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-228)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-229)function envFuncs.templateTitle()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-230)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-231) -- The template (or module, etc.) title object.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-232) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-233) -- 'sandbox-subpage' --> 'sandbox'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-234) -- 'testcases-subpage' --> 'testcases'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-235) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-236)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-237)local title = env.title[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-238)local subpage = title.subpageText[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-239)if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') or (subpage == message('doc-subpage') and mw.title.getCurrentTitle().namespace == env.docSpace) then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-240)return mw.title.makeTitle(subjectSpace, title.baseText)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-241)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-242)return mw.title.makeTitle(subjectSpace, title.text)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-243)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-244)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-245)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-246)function envFuncs.docTitle()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-247)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-248) -- Title object of the /doc subpage.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-249) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-250) -- 'doc-subpage' --> 'doc'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-251) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-252)local title = env.title[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-253)local docname = args[1] -- User-specified doc page.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-254)local docpage[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-255)if docname then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-256)docpage = docname[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-257)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-258)docpage = env.docpageBase .. '/' .. message('doc-subpage')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-259)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-260)return mw.title.new(docpage)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-261)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-262)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-263)function envFuncs.sandboxTitle()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-264)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-265) -- Title object for the /sandbox subpage.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-266) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-267) -- 'sandbox-subpage' --> 'sandbox'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-268) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-269)return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-270)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-271)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-272)function envFuncs.testcasesTitle()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-273)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-274) -- Title object for the /testcases subpage.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-275) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-276) -- 'testcases-subpage' --> 'testcases'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-277) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-278)return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-279)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-280)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-281)function envFuncs.protectionLevels()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-282)-- The protection levels table of the title object.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-283)return env.title.protectionLevels[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-284)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-285)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-286)function envFuncs.subjectSpace()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-287)-- The subject namespace number.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-288)return mw.site.namespaces[env.title.namespace].subject.id[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-289)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-290)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-291)function envFuncs.docSpace()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-292)-- The documentation namespace number. For most namespaces this is the[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-293)-- same as the subject namespace. However, pages in the Article, File,[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-294)-- MediaWiki or Category namespaces must have their /doc, /sandbox and[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-295)-- /testcases pages in talk space.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-296)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-297)if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-298)return subjectSpace + 1[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-299)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-300)return subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-301)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-302)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-303)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-304)function envFuncs.docpageBase()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-305)-- The base page of the /doc, /sandbox, and /testcases subpages.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-306)-- For some namespaces this is the talk page, rather than the template page.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-307)local templateTitle = env.templateTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-308)local docSpace = env.docSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-309)local docSpaceText = mw.site.namespaces[docSpace].name[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-310)-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-311)return docSpaceText .. ':' .. templateTitle.text[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-312)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-313)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-314)function envFuncs.compareUrl()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-315)-- Diff link between the sandbox and the main template using [[[Special:ComparePages]]](https://freemwiki.com/wiki/Special:ComparePages "Special:ComparePages").[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-316)local templateTitle = env.templateTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-317)local sandboxTitle = env.sandboxTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-318)if templateTitle.exists and sandboxTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-319)local compareUrl = mw.uri.canonicalUrl([](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-320)'Special:ComparePages',[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-321){ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-322))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-323)return tostring(compareUrl)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-324)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-325)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-326)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-327)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-328)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-329)return env[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-330)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-331)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-332)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-333)-- Auxiliary templates[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-334)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-335)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-336)p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-337)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-338)function p._getModuleWikitext(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-339)local currentTitle = mw.title.getCurrentTitle()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-340)if currentTitle.contentModel ~= 'Scribunto' then return end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-341)pcall(require, currentTitle.prefixedText) -- if it fails, we don't care[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-342)local moduleWikitext = package.loaded["Module:Module wikitext"][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-343)if moduleWikitext then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-344)return moduleWikitext.main()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-345)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-346)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-347)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-348)function p.sandboxNotice(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-349)--[=[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-350) -- Generates a sandbox notice for display above sandbox pages.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-351) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-352) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-353) -- [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-354) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-355) -- 'sandbox-notice-image' --> '[[[File:Sandbox.svg|50px|alt=|link=]]](https://freemwiki.com/wiki/File:Sandbox.svg "File:Sandbox.svg")'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-356) -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-357) -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-358) -- 'sandbox-notice-pagetype-template' --> '[[[Wikipedia:Template test cases|template sandbox]]](https://freemwiki.com/wiki/Wikipedia:Template_test_cases "Wikipedia:Template test cases") page'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-359) -- 'sandbox-notice-pagetype-module' --> '[[[Wikipedia:Template test cases|module sandbox]]](https://freemwiki.com/wiki/Wikipedia:Template_test_cases "Wikipedia:Template test cases") page'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-360) -- 'sandbox-notice-pagetype-other' --> 'sandbox page'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-361) -- 'sandbox-notice-compare-link-display' --> 'diff'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-362) -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-363) -- 'sandbox-notice-testcases-link-display' --> 'test cases'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-364) -- 'sandbox-category' --> 'Template sandboxes'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-365) -- 'module-sandbox-category' --> 'Module sandboxes'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-366) -- 'other-sandbox-category' --> 'Sandboxes outside of template or module namespace'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-367) --]=][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-368)local title = env.title[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-369)local sandboxTitle = env.sandboxTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-370)local templateTitle = env.templateTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-371)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-372)if not (subjectSpace and title and sandboxTitle and templateTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-373)and mw.title.equals(title, sandboxTitle)) then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-374)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-375)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-376)-- Build the table of arguments to pass to {{[ombox](https://freemwiki.com/wiki/Template:Ombox "Template:Ombox")}}. We need just two fields, "image" and "text".[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-377)local omargs = {}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-378)omargs.image = message('sandbox-notice-image')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-379)-- Get the text. We start with the opening blurb, which is something like[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-380)-- "This is the template sandbox for [[[Template:Foo]]](https://freemwiki.com/wiki/Template:Foo "Template:Foo") (diff)."[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-381)local text = '__EXPECTUNUSEDTEMPLATE__'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-382)local pagetype, sandboxCat[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-383)if subjectSpace == 10 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-384)pagetype = message('sandbox-notice-pagetype-template')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-385)sandboxCat = message('sandbox-category')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-386)elseif subjectSpace == 828 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-387)pagetype = message('sandbox-notice-pagetype-module')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-388)sandboxCat = message('module-sandbox-category')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-389)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-390)pagetype = message('sandbox-notice-pagetype-other')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-391)sandboxCat = message('other-sandbox-category')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-392)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-393)local templateLink = makeWikilink(templateTitle.prefixedText)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-394)local compareUrl = env.compareUrl[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-395)if compareUrl then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-396)local compareDisplay = message('sandbox-notice-compare-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-397)local compareLink = makeUrlLink(compareUrl, compareDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-398)text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-399)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-400)text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-401)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-402)-- Get the test cases page blurb if the page exists. This is something like[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-403)-- "See also the companion subpage for [[[Template:Foo/testcases|test cases]]](https://freemwiki.com/wiki/Template:Foo/testcases "Template:Foo/testcases")."[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-404)local testcasesTitle = env.testcasesTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-405)if testcasesTitle and testcasesTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-406)if testcasesTitle.contentModel == "Scribunto" then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-407)local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-408)local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-409)local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-410)local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-411)text = text .. '
' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-412)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-413)local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-414)local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-415)text = text .. '
' .. message('sandbox-notice-testcases-blurb', {testcasesLink})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-416)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-417)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-418)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-419)-- Add the sandbox to the sandbox category.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-420)omargs.text = text .. makeCategoryLink(sandboxCat)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-421)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-422)-- 'documentation-clear'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-423)return '
'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-424).. require(['Module:Message box'](https://freemwiki.com/wiki/Module:Message_box)).main('ombox', omargs)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-425)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-426)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-427)function p.protectionTemplate(env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-428)-- Generates the padlock icon in the top right.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-429)-- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-430)-- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-431)-- 'protection-template' --> 'pp-template'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-432)-- 'protection-template-args' --> {docusage = 'yes'}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-433)local protectionLevels = env.protectionLevels[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-434)if not protectionLevels then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-435)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-436)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-437)local editProt = protectionLevels.edit and protectionLevels.edit[1][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-438)local moveProt = protectionLevels.move and protectionLevels.move[1][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-439)if editProt then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-440)-- The page is edit-protected.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-441)return require(['Module:Protection banner'](https://freemwiki.com/wiki/Module:Protection_banner))._main{[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-442)message('protection-reason-edit'), small = true[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-443)}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-444)elseif moveProt and moveProt ~= 'autoconfirmed' then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-445)-- The page is move-protected but not edit-protected. Exclude move[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-446)-- protection with the level "autoconfirmed", as this is equivalent to[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-447)-- no move protection at all.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-448)return require(['Module:Protection banner'](https://freemwiki.com/wiki/Module:Protection_banner))._main{[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-449)action = 'move', small = true[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-450)}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-451)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-452)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-453)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-454)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-455)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-456)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-457)-- Start box[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-458)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-459)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-460)p.startBox = makeInvokeFunc('_startBox')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-461)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-462)function p._startBox(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-463)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-464) -- This function generates the start box.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-465) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-466) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-467) -- [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-468) -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-469) -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-470) -- which generate the box HTML.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-471) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-472)env = env or p.getEnvironment(args)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-473)local links[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-474)local content = args.content[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-475)if not content or args[1] then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-476)-- No need to include the links if the documentation is on the template page itself.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-477)local linksData = p.makeStartBoxLinksData(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-478)if linksData then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-479)links = p.renderStartBoxLinks(linksData)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-480)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-481)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-482)-- Generate the start box html.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-483)local data = p.makeStartBoxData(args, env, links)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-484)if data then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-485)return p.renderStartBox(data)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-486)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-487)-- User specified no heading.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-488)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-489)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-490)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-491)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-492)function p.makeStartBoxLinksData(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-493)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-494) -- Does initial processing of data to make the [view] [edit] [history] [purge] links.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-495) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-496) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-497) -- [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-498) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-499) -- 'view-link-display' --> 'view'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-500) -- 'edit-link-display' --> 'edit'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-501) -- 'history-link-display' --> 'history'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-502) -- 'purge-link-display' --> 'purge'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-503) -- 'module-preload' --> 'Template:Documentation/preload-module-doc'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-504) -- 'docpage-preload' --> 'Template:Documentation/preload'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-505) -- 'create-link-display' --> 'create'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-506) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-507)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-508)local title = env.title[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-509)local docTitle = env.docTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-510)if not title or not docTitle then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-511)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-512)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-513)if docTitle.isRedirect then [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-514)docTitle = docTitle.redirectTarget[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-515)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-516)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-517)-- Create link if /doc doesn't exist.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-518)local preload = args.preload[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-519)if not preload then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-520)if subjectSpace == 828 then -- Module namespace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-521)preload = message('module-preload')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-522)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-523)preload = message('docpage-preload')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-524)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-525)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-526)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-527)return {[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-528)title = title,[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-529)docTitle = docTitle,[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-530)-- View, display, edit, and purge links if /doc exists.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-531)viewLinkDisplay = message('view-link-display'),[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-532)editLinkDisplay = message('edit-link-display'),[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-533)historyLinkDisplay = message('history-link-display'),[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-534)purgeLinkDisplay = message('purge-link-display'),[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-535)preload = preload,[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-536)createLinkDisplay = message('create-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-537)}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-538)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-539)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-540)function p.renderStartBoxLinks(data)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-541)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-542) -- Generates the [view][edit][history][purge] or [create][purge] links from the data table.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-543) -- @data - a table of data generated by p.makeStartBoxLinksData[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-544) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-545)local docTitle = data.docTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-546)-- yes, we do intend to purge the template page on which the documentation appears[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-547)local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-548)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-549)if docTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-550)local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-551)local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-552)local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-553)return "[" .. viewLink .. "] [" .. editLink .. "] [" .. historyLink .. "] [" .. purgeLink .. "]"[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-554)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-555)local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-556)return "[" .. createLink .. "] [" .. purgeLink .. "]"[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-557)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-558)return ret[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-559)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-560)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-561)function p.makeStartBoxData(args, env, links)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-562)--[=[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-563) -- Does initial processing of data to pass to the start-box render function, p.renderStartBox.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-564) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-565) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-566) -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-567) --[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-568) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-569) -- 'documentation-icon-wikitext' --> '[[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]](https://freemwiki.com/wiki/File:Test_Template_Info-Icon_-_Version_(2).svg "File:Test Template Info-Icon - Version (2).svg")'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-570) -- 'template-namespace-heading' --> 'Template documentation'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-571) -- 'module-namespace-heading' --> 'Module documentation'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-572) -- 'file-namespace-heading' --> 'Summary'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-573) -- 'other-namespaces-heading' --> 'Documentation'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-574) -- 'testcases-create-link-display' --> 'create'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-575) --]=][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-576)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-577)if not subjectSpace then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-578)-- Default to an "other namespaces" namespace, so that we get at least some output[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-579)-- if an error occurs.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-580)subjectSpace = 2[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-581)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-582)local data = {}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-583)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-584)-- Heading[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-585)local heading = args.heading -- Blank values are not removed.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-586)if heading == '' then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-587)-- Don't display the start box if the heading arg is defined but blank.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-588)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-589)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-590)if heading then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-591)data.heading = heading[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-592)elseif subjectSpace == 10 then -- Template namespace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-593)data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-594)elseif subjectSpace == 828 then -- Module namespace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-595)data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-596)elseif subjectSpace == 6 then -- File namespace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-597)data.heading = message('file-namespace-heading')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-598)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-599)data.heading = message('other-namespaces-heading')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-600)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-601)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-602)-- Heading CSS[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-603)local headingStyle = args['heading-style'][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-604)if headingStyle then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-605)data.headingStyleText = headingStyle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-606)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-607)-- 'documentation-heading'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-608)data.headingClass = message('main-div-heading-class')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-609)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-610)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-611)-- Data for the [view][edit][history][purge] or [create] links.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-612)if links then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-613)-- 'mw-editsection-like plainlinks'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-614)data.linksClass = message('start-box-link-classes')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-615)data.links = links[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-616)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-617)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-618)return data[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-619)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-620)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-621)function p.renderStartBox(data)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-622)-- Renders the start box html.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-623)-- @data - a table of data generated by p.makeStartBoxData.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-624)local sbox = mw.html.create('div')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-625)sbox[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-626)-- 'documentation-startbox'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-627):addClass(message('start-box-class'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-628):newline()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-629):tag('span')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-630):addClass(data.headingClass)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-631):attr('id', 'documentation-heading')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-632):cssText(data.headingStyleText)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-633):wikitext(data.heading)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-634)local links = data.links[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-635)if links then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-636)sbox:tag('span')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-637):addClass(data.linksClass)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-638):attr('id', data.linksId)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-639):wikitext(links)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-640)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-641)return tostring(sbox)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-642)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-643)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-644)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-645)-- Documentation content[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-646)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-647)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-648)p.content = makeInvokeFunc('_content')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-649)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-650)function p._content(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-651)-- Displays the documentation contents[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-652)-- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-653)-- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-654)env = env or p.getEnvironment(args)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-655)local docTitle = env.docTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-656)local content = args.content[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-657)if not content and docTitle and docTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-658)content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-659)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-660)-- The line breaks below are necessary so that "=== Headings ===" at the start and end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-661)-- of docs are interpreted correctly.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-662)return '\n' .. (content or '') .. '\n' [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-663)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-664)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-665)p.contentTitle = makeInvokeFunc('_contentTitle')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-666)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-667)function p._contentTitle(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-668)env = env or p.getEnvironment(args)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-669)local docTitle = env.docTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-670)if not args.content and docTitle and docTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-671)return docTitle.prefixedText[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-672)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-673)return ''[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-674)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-675)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-676)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-677)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-678)-- End box[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-679)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-680)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-681)p.endBox = makeInvokeFunc('_endBox')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-682)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-683)function p._endBox(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-684)--[=[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-685) -- This function generates the end box (also known as the link box).[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-686) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-687) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-688) -- [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-689) --]=][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-690)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-691)-- Get environment data.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-692)env = env or p.getEnvironment(args)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-693)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-694)local docTitle = env.docTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-695)if not subjectSpace or not docTitle then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-696)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-697)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-698)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-699)-- Check whether we should output the end box at all. Add the end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-700)-- box by default if the documentation exists or if we are in the[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-701)-- user, module or template namespaces.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-702)local linkBox = args['link box'][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-703)if linkBox == 'off'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-704)or not ([](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-705)docTitle.exists[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-706)or subjectSpace == 2[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-707)or subjectSpace == 828[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-708)or subjectSpace == 10[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-709))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-710)then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-711)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-712)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-713)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-714)-- Assemble the link box.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-715)local text = ''[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-716)if linkBox then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-717)text = text .. linkBox[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-718)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-719)text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[[Foo]]](https://freemwiki.com/wiki/Foo "Foo")." [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-720)if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-721)-- We are in the user, template or module namespaces.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-722)-- Add sandbox and testcases links.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-723)-- "Editors can experiment in this template's sandbox and testcases pages."[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-724)text = text .. (p.makeExperimentBlurb(args, env) or '') .. '
'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-725)if not args.content and not args[1] then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-726)-- "Please add categories to the /doc subpage."[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-727)-- Don't show this message with inline docs or with an explicitly specified doc page,[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-728)-- as then it is unclear where to add the categories.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-729)text = text .. (p.makeCategoriesBlurb(args, env) or '')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-730)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-731)text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-732)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-733)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-734)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-735)local box = mw.html.create('div')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-736)-- 'documentation-metadata'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-737)box:attr('role', 'note')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-738):addClass(message('end-box-class'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-739)-- 'plainlinks'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-740):addClass(message('end-box-plainlinks'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-741):wikitext(text)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-742):done()[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-743)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-744)return '\n' .. tostring(box)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-745)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-746)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-747)function p.makeDocPageBlurb(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-748)--[=[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-749) -- Makes the blurb "This documentation is transcluded from [[[Template:Foo]]](https://freemwiki.com/wiki/Template:Foo "Template:Foo") (edit, history)".[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-750) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-751) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-752) -- [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-753) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-754) -- 'edit-link-display' --> 'edit'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-755) -- 'history-link-display' --> 'history'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-756) -- 'transcluded-from-blurb' --> [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-757) -- 'The above [[[Wikipedia:Template documentation|documentation]]](https://freemwiki.com/wiki/Wikipedia:Template_documentation "Wikipedia:Template documentation") [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-758) -- is [[[Help:Transclusion|transcluded]]](https://freemwiki.com/wiki/Help:Transclusion "Help:Transclusion") from $1.'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-759) -- 'module-preload' --> 'Template:Documentation/preload-module-doc'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-760) -- 'create-link-display' --> 'create'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-761) -- 'create-module-doc-blurb' -->[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-762) -- 'You might want to $1 a documentation page for this [[[Wikipedia:Lua|Scribunto module]]](https://freemwiki.com/wiki/Wikipedia:Lua "Wikipedia:Lua").'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-763) --]=][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-764)local docTitle = env.docTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-765)if not docTitle then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-766)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-767)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-768)if docTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-769)-- /doc exists; link to it.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-770)local docLink = makeWikilink(docTitle.prefixedText)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-771)local editDisplay = message('edit-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-772)local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-773)local historyDisplay = message('history-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-774)local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-775)return message('transcluded-from-blurb', {docLink})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-776).. ' '[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-777).. makeToolbar(editLink, historyLink)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-778).. '
'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-779)elseif env.subjectSpace == 828 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-780)-- /doc does not exist; ask to create it.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-781)local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-782)local createDisplay = message('create-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-783)local createLink = makeUrlLink(createUrl, createDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-784)return message('create-module-doc-blurb', {createLink})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-785).. '
'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-786)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-787)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-788)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-789)function p.makeExperimentBlurb(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-790)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-791) -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-792) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-793) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-794) -- [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-795) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-796) -- 'sandbox-link-display' --> 'sandbox'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-797) -- 'sandbox-edit-link-display' --> 'edit'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-798) -- 'compare-link-display' --> 'diff'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-799) -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-800) -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-801) -- 'sandbox-create-link-display' --> 'create'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-802) -- 'mirror-edit-summary' --> 'Create sandbox version of $1'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-803) -- 'mirror-link-display' --> 'mirror'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-804) -- 'mirror-link-preload' --> 'Template:Documentation/mirror'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-805) -- 'sandbox-link-display' --> 'sandbox'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-806) -- 'testcases-link-display' --> 'testcases'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-807) -- 'testcases-edit-link-display'--> 'edit'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-808) -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-809) -- 'testcases-create-link-display' --> 'create'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-810) -- 'testcases-link-display' --> 'testcases'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-811) -- 'testcases-edit-link-display' --> 'edit'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-812) -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-813) -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-814) -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-815) -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-816) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-817)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-818)local templateTitle = env.templateTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-819)local sandboxTitle = env.sandboxTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-820)local testcasesTitle = env.testcasesTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-821)local templatePage = templateTitle.prefixedText[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-822)if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-823)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-824)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-825)-- Make links.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-826)local sandboxLinks, testcasesLinks[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-827)if sandboxTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-828)local sandboxPage = sandboxTitle.prefixedText[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-829)local sandboxDisplay = message('sandbox-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-830)local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-831)local sandboxEditDisplay = message('sandbox-edit-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-832)local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-833)local compareUrl = env.compareUrl[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-834)local compareLink[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-835)if compareUrl then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-836)local compareDisplay = message('compare-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-837)compareLink = makeUrlLink(compareUrl, compareDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-838)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-839)sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-840)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-841)local sandboxPreload[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-842)if subjectSpace == 828 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-843)sandboxPreload = message('module-sandbox-preload')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-844)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-845)sandboxPreload = message('template-sandbox-preload')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-846)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-847)local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-848)local sandboxCreateDisplay = message('sandbox-create-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-849)local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-850)local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-851)local mirrorPreload = message('mirror-link-preload')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-852)local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-853)if subjectSpace == 828 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-854)mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-855)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-856)local mirrorDisplay = message('mirror-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-857)local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-858)sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-859)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-860)if testcasesTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-861)local testcasesPage = testcasesTitle.prefixedText[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-862)local testcasesDisplay = message('testcases-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-863)local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-864)local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-865)local testcasesEditDisplay = message('testcases-edit-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-866)local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-867)-- for Modules, add testcases run link if exists[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-868)if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-869)local testcasesRunLinkDisplay = message('testcases-run-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-870)local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-871)testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-872)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-873)testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-874)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-875)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-876)local testcasesPreload[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-877)if subjectSpace == 828 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-878)testcasesPreload = message('module-testcases-preload')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-879)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-880)testcasesPreload = message('template-testcases-preload')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-881)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-882)local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload}[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-883)local testcasesCreateDisplay = message('testcases-create-link-display')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-884)local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-885)testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-886)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-887)local messageName[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-888)if subjectSpace == 828 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-889)messageName = 'experiment-blurb-module'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-890)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-891)messageName = 'experiment-blurb-template'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-892)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-893)return message(messageName, {sandboxLinks, testcasesLinks})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-894)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-895)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-896)function p.makeCategoriesBlurb(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-897)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-898) -- Generates the text "Please add categories to the /doc subpage."[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-899) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-900) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-901) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-902) -- 'doc-link-display' --> '/doc'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-903) -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-904) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-905)local docTitle = env.docTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-906)if not docTitle then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-907)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-908)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-909)local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-910)return message('add-categories-blurb', {docPathLink})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-911)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-912)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-913)function p.makeSubpagesBlurb(args, env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-914)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-915) -- Generates the "Subpages of this template" link.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-916) -- @args - a table of arguments passed by the user[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-917) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-918)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-919) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-920) -- 'template-pagetype' --> 'template'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-921) -- 'module-pagetype' --> 'module'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-922) -- 'default-pagetype' --> 'page'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-923) -- 'subpages-link-display' --> 'Subpages of this $1'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-924) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-925)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-926)local templateTitle = env.templateTitle[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-927)if not subjectSpace or not templateTitle then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-928)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-929)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-930)local pagetype[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-931)if subjectSpace == 10 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-932)pagetype = message('template-pagetype')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-933)elseif subjectSpace == 828 then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-934)pagetype = message('module-pagetype')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-935)else[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-936)pagetype = message('default-pagetype')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-937)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-938)local subpagesLink = makeWikilink([](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-939)'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-940)message('subpages-link-display', {pagetype})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-941))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-942)return message('subpages-blurb', {subpagesLink})[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-943)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-944)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-945)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-946)-- Tracking categories[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-947)----------------------------------------------------------------------------[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-948)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-949)function p.addTrackingCategories(env)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-950)--[[[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-951) -- Check if {{[documentation](https://freemwiki.com/wiki/Template:Documentation "Template:Documentation")}} is transcluded on a /doc or /testcases page.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-952) -- @env - environment table containing title objects, etc., generated with p.getEnvironment[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-953)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-954) -- Messages:[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-955) -- 'display-strange-usage-category' --> true[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-956) -- 'doc-subpage' --> 'doc'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-957) -- 'testcases-subpage' --> 'testcases'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-958) -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-959) -- [](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-960) -- /testcases pages in the module namespace are not categorised, as they may have[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-961) -- {{[documentation](https://freemwiki.com/wiki/Template:Documentation "Template:Documentation")}} transcluded automatically.[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-962) --]][](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-963)local title = env.title[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-964)local subjectSpace = env.subjectSpace[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-965)if not title or not subjectSpace then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-966)return nil[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-967)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-968)local subpage = title.subpageText[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-969)if message('display-strange-usage-category', nil, 'boolean')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-970)and ([](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-971)subpage == message('doc-subpage')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-972)or subjectSpace ~= 828 and subpage == message('testcases-subpage')[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-973))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-974)then[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-975)return makeCategoryLink(message('strange-usage-category'))[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-976)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-977)return ''[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-978)end[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-979)[](https://freemwiki.com/index.php?oldid=579600&title=Module%3ADocumentation#L-980)return p Retrieved from "[https://freemwiki.com/index.php?title=Module:Documentation&oldid=579600](https://freemwiki.com/index.php?title=Module:Documentation&oldid=579600)" * This page was last edited on 21 October 2025, at 06:18. * Content is available under [Creative Commons Attribution-ShareAlike 4.0](https://creativecommons.org/licenses/by-sa/4.0/) unless otherwise noted. FreemWiki is operated by **FINGERPOWER DIGITAL TECHNOLOGY LLC** (Colorado, Entity ID 20221978727). * [Privacy Policy](https://freemwiki.com/wiki/Privacy_Policy) * [About](https://freemwiki.com/wiki/About) * [Terms of Service](https://freemwiki.com/wiki/Terms_of_Service) * [Mobile view](https://freemwiki.com/index.php?title=Module:Documentation&oldid=579600&mobileaction=toggle_view_mobile)