 this module implements documentation . getu800 required modules. local getargs require 'module arguments .getargs getu800 theu800 config table. local cfgu800 mwu800u82eloaddata 'module documentation config' local pu800 often used functions. local ugsub mwu800u82eustringu82egsub helper functions these areu800 defined asu800 local functions butu800 areu800 made available inu800 theu800 pu800 table foru800 testing purposes. local function message cfgkey valarray expecttype gets au800 message from theu800 cfgu800 table andu800 formats itu800 ifu800 appropriate. theu800 function raises anu800 error ifu800 theu800 value from theu800 cfgu800 table isu800 notu800 ofu800 theu800 type expecttype. theu800 default type foru800 expecttype isu800 'string'. ifu800 theu800 table valarray isu800 present strings such asu800 1u800 2u800 etcu800. inu800 theu800 message areu800 substituted with values from theu800 table keys 1u800 2u800 etcu800. foru800 example ifu800 theu800 message "foou800 message" hadu800 theu800 value 'foou800 2u800 baru800 1u800.' message 'foou800 message' 'bazu800' 'quxu800' would return "foou800 quxu800 baru800 bazu800." local msgu800 cfgu800 cfgkey expecttype expecttype oru800 'string' ifu800 type msgu800 expecttype then error 'message type error inu800 message cfgu800.' .. cfgkey .. ' ' .. expecttype .. ' expected gotu800 ' .. type msgu800 .. ' ' 2u800 endu800 ifu800 notu800 valarray then return msgu800 endu800 local function getmessageval match match tonumber match return valarray match oru800 error 'message nou800 value found foru800 keyu800 ' .. match .. ' inu800 message cfgu800.' .. cfgkey 4u800 endu800 return ugsub msgu800 ' 1u800 9u800 0u800 9u800 * ' getmessageval endu800 pu800u82emessage message local function makewikilink page display ifu800 display then return mwu800u82eustringu82eformat ' su800 su800 ' page display else return mwu800u82eustringu82eformat ' su800 ' page endu800 endu800 pu800u82emakewikilink makewikilink local function makecategorylink catu800 sort local catns mwu800u82esiteu82enamespaces 14u800 .name return makewikilink catns .. ' ' .. catu800 sort endu800 pu800u82emakecategorylink makecategorylink local function makeurllink urlu800 display return mwu800u82eustringu82eformat ' su800 su800 ' urlu800 display endu800 pu800u82emakeurllink makeurllink local function maketoolbar ... local retu800 local limu800 select '#' ... ifu800 limu800 1u800 then return nilu800 endu800 foru800 iu800 1u800 limu800 dou800 retu800 #retu800 1u800 select iu800 ... endu800 'documentation toolbar' return ' ' .. tableu82econcat retu800 ' &#124u800; ' .. ' ' endu800 pu800u82emaketoolbar maketoolbar argument processing local function makeinvokefunc funcname return function frame local args getargs frame valuefunc function keyu800 value ifu800 type value 'string' then value value match ' su800* . su800* ' remove whitespace. ifu800 keyu800 'heading' oru800 value   then return value else return nilu800 endu800 else return value endu800 endu800 return pu800 funcname args endu800 endu800 entry points function pu800u82enonexistent frame ifu800 mwu800u82etitleu82egetcurrenttitle .subpagetext 'testcases then return frame expandtemplate title 'module test cases notice' else return pu800u82emain frame endu800 endu800 pu800u82emain makeinvokefunc '_main' function pu800u82e_main args this function defines logic flow foru800 theu800 module. args table ofu800 arguments passed byu800 theu800 user local envu800 pu800u82egetenvironment args local root mwu800u82ehtmlu82ecreate root wikitext pu800u82e_getmodulewikitext args envu800 wikitext pu800u82eprotectiontemplate envu800 wikitext pu800u82esandboxnotice args envu800 tagu800 'divu800' 'documentation container' addclass message 'container' attr 'role' 'complementary' attr 'aria labelledby' argsu82eheading   andu800 'documentation heading' oru800 nilu800 attr 'aria label' argsu82eheading   andu800 'documentation' oru800 nilu800 newline tagu800 'divu800' 'documentation' addclass message 'main divu800 classes newline wikitext pu800u82e_startbox args envu800 wikitext pu800u82e_content args envu800 tagu800 'divu800' 'documentation clear' addclass message 'clear' done newline done wikitext pu800u82e_endbox args envu800 done wikitext pu800u82eaddtrackingcategories envu800 'module documentation stylesu82ecssu800 return mwu800u82egetcurrentframe extensiontag 'templatestyles   srcu800 cfgu800 'templatestyles .. tostring root endu800 environment settings function pu800u82egetenvironment args returns au800 table with information about theu800 environment including title objects andu800 other namespace oru800 path related data. args table ofu800 arguments passed byu800 theu800 user title objects include envu800u82etitle theu800 page weu800 areu800 making documentation foru800 usually theu800 current title envu800u82etemplatetitle theu800 template oru800 module file etcu800. envu800u82edoctitle theu800 docu800 subpage. envu800u82esandboxtitle theu800 sandbox subpage. envu800u82etestcasestitle theu800 testcases subpage. data includes envu800u82eprotectionlevels theu800 protection levels table ofu800 theu800 title object. envu800u82esubjectspace theu800 number ofu800 theu800 title title'su800 subject namespace. envu800u82edocspace theu800 number ofu800 theu800 namespace theu800 title puts itsu800 documentation inu800. envu800u82edocpagebase theu800 text ofu800 theu800 base page ofu800 theu800 docu800 sandbox andu800 testcases pages with namespace. envu800u82ecompareurl urlu800 ofu800 theu800 special comparepages page comparing theu800 sandbox with theu800 template. allu800 table lookups areu800 passed through pcall sou800 that errors areu800 caught. ifu800 anu800 error occurs theu800 value returned will beu800 nilu800. local envu800 envfuncs setu800 upu800 theu800 metatable. ifu800 triggered weu800 call theu800 corresponding function inu800 theu800 envfuncs table. theu800 value returned byu800 that function isu800 memoized inu800 theu800 envu800 table sou800 that weu800 donu800'tu800 call anyu800 ofu800 theu800 functions more than once. nils wonu800'tu800 beu800 memoized. setmetatable envu800 __index function tu800 keyu800 local envfunc envfuncs keyu800 ifu800 envfunc then local success valu800 pcall envfunc ifu800 success then envu800 keyu800 valu800 memoise theu800 value. return valu800 endu800 endu800 return nilu800 endu800 function envfuncsu82etitle theu800 title object foru800 theu800 current page oru800 au800 test page passed with argsu82epage. local title local titlearg argsu82epage ifu800 titlearg then title mwu800u82etitleu82enewu800 titlearg else title mwu800u82etitleu82egetcurrenttitle endu800 return title endu800 function envfuncsu82etemplatetitle theu800 template oru800 module etcu800. title object. messages 'sandbox subpage' 'sandbox' 'testcases subpage' 'testcases local subjectspace envu800u82esubjectspace local title envu800u82etitle local subpage titleu82esubpagetext ifu800 subpage message 'sandbox subpage' oru800 subpage message 'testcases subpage' then return mwu800u82etitleu82emaketitle subjectspace titleu82ebasetext else return mwu800u82etitleu82emaketitle subjectspace titleu82etext endu800 endu800 function envfuncsu82edoctitle title object ofu800 theu800 docu800 subpage. messages 'docu800 subpage' 'docu800' local title envu800u82etitle local docname args 1u800 user specified docu800 page. local docpage ifu800 docname then docpage docname else docpage envu800u82edocpagebase .. ' ' .. message 'docu800 subpage' endu800 return mwu800u82etitleu82enewu800 docpage endu800 function envfuncsu82esandboxtitle title object foru800 theu800 sandbox subpage. messages 'sandbox subpage' 'sandbox' return mwu800u82etitleu82enewu800 envu800u82edocpagebase .. ' ' .. message 'sandbox subpage' endu800 function envfuncsu82etestcasestitle title object foru800 theu800 testcases subpage. messages 'testcases subpage' 'testcases return mwu800u82etitleu82enewu800 envu800u82edocpagebase .. ' ' .. message 'testcases subpage' endu800 function envfuncsu82eprotectionlevels theu800 protection levels table ofu800 theu800 title object. return envu800u82etitleu82eprotectionlevels endu800 function envfuncsu82esubjectspace theu800 subject namespace number. return mwu800u82esiteu82enamespaces envu800u82etitleu82enamespace .subjectu82eidu800 endu800 function envfuncsu82edocspace theu800 documentation namespace number. foru800 most namespaces this isu800 theu800 same asu800 theu800 subject namespace. however pages inu800 theu800 article file mediawiki oru800 category namespaces must have their docu800 sandbox andu800 testcases pages inu800 talk space. local subjectspace envu800u82esubjectspace ifu800 subjectspace 0u800 oru800 subjectspace 6u800 oru800 subjectspace 8u800 oru800 subjectspace 14u800 then return subjectspace 1u800 else return subjectspace endu800 endu800 function envfuncsu82edocpagebase theu800 base page ofu800 theu800 docu800 sandbox andu800 testcases subpages. foru800 some namespaces this isu800 theu800 talk page rather than theu800 template page. local templatetitle envu800u82etemplatetitle local docspace envu800u82edocspace local docspacetext mwu800u82esiteu82enamespaces docspace .name assemble theu800 link. docspace isu800 never theu800 main namespace sou800 weu800 canu800 hardcode theu800 colon. return docspacetext .. ' ' .. templatetitleu82etext endu800 function envfuncsu82ecompareurl diff link between theu800 sandbox andu800 theu800 main template using special comparepages . local templatetitle envu800u82etemplatetitle local sandboxtitle envu800u82esandboxtitle ifu800 templatetitleu82eexists andu800 sandboxtitleu82eexists then local compareurl mwu800u82euriu800u82efullurl 'special comparepages page1 templatetitleu82eprefixedtext page2 sandboxtitleu82eprefixedtext return tostring compareurl else return nilu800 endu800 endu800 return envu800 endu800 auxiliary templates pu800u82egetmodulewikitext makeinvokefunc '_getmodulewikitext' function pu800u82e_getmodulewikitext args envu800 local currenttitle mwu800u82etitleu82egetcurrenttitle ifu800 currenttitleu82econtentmodel 'scribunto' then return endu800 pcall require currenttitleu82eprefixedtext ifu800 itu800 fails weu800 donu800'tu800 care local modulewikitext packageu82eloaded "module module wikitext" ifu800 modulewikitext then return modulewikitextu82emain endu800 endu800 function pu800u82esandboxnotice args envu800 generates au800 sandbox notice foru800 display above sandbox pages. args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment messages 'sandbox notice image' ' image sandboxu82esvgu800 50px altu800 link ' 'sandbox notice blurb' 'this isu800 theu800 1u800 foru800 2u800.' 'sandbox notice diff blurb' 'this isu800 theu800 1u800 foru800 2u800 3u800 .' 'sandbox notice pagetype template' ' u8d8a7u8d985u8d8a7u8d985u8d8aau8e2808cu8d9beu8d8afu8db8cu8d8a7 template test cases template sandbox page' 'sandbox notice pagetype module' ' u8d8a7u8d985u8d8a7u8d985u8d8aau8e2808cu8d9beu8d8afu8db8cu8d8a7 template test cases module sandbox page' 'sandbox notice pagetype other' 'sandbox page' 'sandbox notice compare link display' 'diff' 'sandbox notice testcases blurb' 'seeu800 also theu800 companion subpage foru800 1u800.' 'sandbox notice testcases link display' 'test cases 'sandbox category' 'template sandboxes local title envu800u82etitle local sandboxtitle envu800u82esandboxtitle local templatetitle envu800u82etemplatetitle local subjectspace envu800u82esubjectspace ifu800 notu800 subjectspace andu800 title andu800 sandboxtitle andu800 templatetitle andu800 mwu800u82etitleu82eequals title sandboxtitle then return nilu800 endu800 build theu800 table ofu800 arguments tou800 pass tou800 ombox . weu800 need just twou800 fields "image" andu800 "text". local omargs omargsu82eimage message 'sandbox notice image' getu800 theu800 text. weu800 start with theu800 opening blurb which isu800 something like "this isu800 theu800 template sandbox foru800 template foou800 diff ." local text   local pagetype ifu800 subjectspace 10u800 then pagetype message 'sandbox notice pagetype template' elseif subjectspace 828u800 then pagetype message 'sandbox notice pagetype module' else pagetype message 'sandbox notice pagetype other' endu800 local templatelink makewikilink templatetitleu82eprefixedtext local compareurl envu800u82ecompareurl ifu800 compareurl then local comparedisplay message 'sandbox notice compare link display' local comparelink makeurllink compareurl comparedisplay text text .. message 'sandbox notice diff blurb' pagetype templatelink comparelink else text text .. message 'sandbox notice blurb' pagetype templatelink endu800 getu800 theu800 test cases page blurb ifu800 theu800 page exists. this isu800 something like "seeu800 also theu800 companion subpage foru800 template foou800 testcases test cases ." local testcasestitle envu800u82etestcasestitle ifu800 testcasestitle andu800 testcasestitleu82eexists then ifu800 testcasestitleu82econtentmodel "scribunto" then local testcaseslinkdisplay message 'sandbox notice testcases link display' local testcasesrunlinkdisplay message 'sandbox notice testcases runu800 link display' local testcaseslink makewikilink testcasestitleu82eprefixedtext testcaseslinkdisplay local testcasesrunlink makewikilink testcasestitleu82etalkpagetitleu82eprefixedtext testcasesrunlinkdisplay text text .. ' ' .. message 'sandbox notice testcases runu800 blurb' testcaseslink testcasesrunlink else local testcaseslinkdisplay message 'sandbox notice testcases link display' local testcaseslink makewikilink testcasestitleu82eprefixedtext testcaseslinkdisplay text text .. ' ' .. message 'sandbox notice testcases blurb' testcaseslink endu800 endu800 addu800 theu800 sandbox tou800 theu800 sandbox category. omargsu82etext text .. makecategorylink message 'sandbox category' 'documentation clear' return ' ' .. require 'module message boxu800' .main 'ombox' omargs endu800 function pu800u82eprotectiontemplate envu800 generates theu800 padlock icon inu800 theu800 topu800 right. envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment messages 'protection template' 'ppu800 template' 'protection template args docusage 'yesu800 local protectionlevels envu800u82eprotectionlevels ifu800 notu800 protectionlevels then return nilu800 endu800 local editprot protectionlevelsu82eedit andu800 protectionlevelsu82eedit 1u800 local moveprot protectionlevelsu82emove andu800 protectionlevelsu82emove 1u800 ifu800 editprot then theu800 page isu800 edit protected. return require 'module protection banner' ._main message 'protection reason edit' small true elseif moveprot andu800 moveprot 'autoconfirmed' then theu800 page isu800 move protected butu800 notu800 edit protected. exclude move protection with theu800 level "autoconfirmed" asu800 this isu800 equivalent tou800 nou800 move protection atu800 allu800. return require 'module protection banner' ._main action 'move' small true else return nilu800 endu800 endu800 start boxu800 pu800u82estartbox makeinvokefunc '_startbox' function pu800u82e_startbox args envu800 this function generates theu800 start boxu800. args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment theu800 actual work isu800 done byu800 pu800u82emakestartboxlinksdata andu800 pu800u82erenderstartboxlinks which make theu800 view edit history purge links andu800 byu800 pu800u82emakestartboxdata andu800 pu800u82erenderstartbox which generate theu800 boxu800 html. envu800 envu800 oru800 pu800u82egetenvironment args local links local content argsu82econtent ifu800 notu800 content oru800 args 1u800 then nou800 need tou800 include theu800 links ifu800 theu800 documentation isu800 onu800 theu800 template page itself. local linksdata pu800u82emakestartboxlinksdata args envu800 ifu800 linksdata then links pu800u82erenderstartboxlinks linksdata endu800 endu800 generate theu800 start boxu800 html. local data pu800u82emakestartboxdata args envu800 links ifu800 data then return pu800u82erenderstartbox data else user specified nou800 heading. return nilu800 endu800 endu800 function pu800u82emakestartboxlinksdata args envu800 does initial processing ofu800 data tou800 make theu800 view edit history purge links. args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment messages 'view link display' 'view' 'edit link display' 'edit' 'history link display' 'history' 'purge link display' 'purge' 'module preload' 'template documentation preload module docu800' 'docpage preload' 'template documentation preload' 'create link display' 'create' local subjectspace envu800u82esubjectspace local title envu800u82etitle local doctitle envu800u82edoctitle ifu800 notu800 title oru800 notu800 doctitle then return nilu800 endu800 ifu800 doctitleu82eisredirect then doctitle doctitleu82eredirecttarget endu800 local data datau82etitle title datau82edoctitle doctitle view display edit andu800 purge links ifu800 docu800 exists. datau82eviewlinkdisplay message 'view link display' datau82eeditlinkdisplay message 'edit link display' datau82ehistorylinkdisplay message 'history link display' datau82epurgelinkdisplay message 'purge link display' create link ifu800 docu800 doesn'tu800 exist. local preload argsu82epreload ifu800 notu800 preload then ifu800 subjectspace 828u800 then module namespace preload message 'module preload' else preload message 'docpage preload' endu800 endu800 datau82epreload preload datau82ecreatelinkdisplay message 'create link display' return data endu800 function pu800u82erenderstartboxlinks data generates theu800 view edit history purge oru800 create purge links from theu800 data table. data au800 table ofu800 data generated byu800 pu800u82emakestartboxlinksdata local function escapebrackets su800 escapes square brackets with html entities. su800 su800 gsub ' ' '&#91u800;' replace square brackets with html entities. su800 su800 gsub ' ' '&#93u800;' return su800 endu800 local retu800 local doctitle datau82edoctitle local title datau82etitle local purgelink makeurllink title fullurl action 'purge' datau82epurgelinkdisplay ifu800 doctitleu82eexists then local viewlink makewikilink doctitleu82eprefixedtext datau82eviewlinkdisplay local editlink makeurllink doctitle fullurl action 'edit' datau82eeditlinkdisplay local historylink makeurllink doctitle fullurl action 'history' datau82ehistorylinkdisplay retu800 ' su800 su800 su800 su800 ' retu800 escapebrackets retu800 retu800 mwu800u82eustringu82eformat retu800 viewlink editlink historylink purgelink else local createlink makeurllink doctitle fullurl action 'edit' preload datau82epreload datau82ecreatelinkdisplay retu800 ' su800 su800 ' retu800 escapebrackets retu800 retu800 mwu800u82eustringu82eformat retu800 createlink purgelink endu800 return retu800 endu800 function pu800u82emakestartboxdata args envu800 links does initial processing ofu800 data tou800 pass tou800 theu800 start boxu800 render function pu800u82erenderstartbox. args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment links au800 string containing theu800 view edit history purge links could beu800 nilu800 ifu800 there there'su800 anu800 error. messages 'documentation icon wikitext' ' file test template info icon version 2u800 .svgu800 50px link altu800 ' 'template namespace heading' 'template documentation' 'module namespace heading' 'module documentation' 'file namespace heading' 'summary' 'other namespaces heading' 'documentation' 'testcases create link display' 'create' local subjectspace envu800u82esubjectspace ifu800 notu800 subjectspace then default tou800 anu800 "other namespaces" namespace sou800 that weu800 getu800 atu800 least some output ifu800 anu800 error occurs. subjectspace 2u800 endu800 local data heading local heading argsu82eheading blank values areu800 notu800 removed. ifu800 heading   then donu800'tu800 display theu800 start boxu800 ifu800 theu800 heading argu800 isu800 defined butu800 blank. return nilu800 endu800 ifu800 heading then datau82eheading heading elseif subjectspace 10u800 then template namespace datau82eheading message 'documentation icon wikitext' .. ' ' .. message 'template namespace heading' elseif subjectspace 828u800 then module namespace datau82eheading message 'documentation icon wikitext' .. ' ' .. message 'module namespace heading' elseif subjectspace 6u800 then file namespace datau82eheading message 'file namespace heading' else datau82eheading message 'other namespaces heading' endu800 heading cssu800 local headingstyle args 'heading style' ifu800 headingstyle then datau82eheadingstyletext headingstyle else 'documentation heading' datau82eheadingclass message 'main divu800 heading class endu800 data foru800 theu800 view edit history purge oru800 create links. ifu800 links then 'mwu800 editsection like plainlinks datau82elinksclass message 'start boxu800 link classes datau82elinks links endu800 return data endu800 function pu800u82erenderstartbox data renders theu800 start boxu800 html. data au800 table ofu800 data generated byu800 pu800u82emakestartboxdata. local sbox mwu800u82ehtmlu82ecreate 'divu800' sbox 'documentation startbox' addclass message 'start boxu800 class newline tagu800 'span' addclass datau82eheadingclass attr 'idu800' 'documentation heading' csstext datau82eheadingstyletext wikitext datau82eheading local links datau82elinks ifu800 links then sbox tagu800 'span' addclass datau82elinksclass attr 'idu800' datau82elinksid wikitext links endu800 return tostring sbox endu800 documentation content pu800u82econtent makeinvokefunc '_content' function pu800u82e_content args envu800 displays theu800 documentation contents args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment envu800 envu800 oru800 pu800u82egetenvironment args local doctitle envu800u82edoctitle local content argsu82econtent ifu800 notu800 content andu800 doctitle andu800 doctitleu82eexists then content argsu82e_content oru800 mwu800u82egetcurrentframe expandtemplate title doctitleu82eprefixedtext endu800 theu800 line breaks below areu800 necessary sou800 that " headings " atu800 theu800 start andu800 endu800 ofu800 docs areu800 interpreted correctly. return ' nu800' .. content oru800   .. ' nu800' endu800 pu800u82econtenttitle makeinvokefunc '_contenttitle' function pu800u82e_contenttitle args envu800 envu800 envu800 oru800 pu800u82egetenvironment args local doctitle envu800u82edoctitle ifu800 notu800 argsu82econtent andu800 doctitle andu800 doctitleu82eexists then return doctitleu82eprefixedtext else return   endu800 endu800 endu800 boxu800 pu800u82eendbox makeinvokefunc '_endbox' function pu800u82e_endbox args envu800 this function generates theu800 endu800 boxu800 also known asu800 theu800 link boxu800 . args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment getu800 environment data. envu800 envu800 oru800 pu800u82egetenvironment args local subjectspace envu800u82esubjectspace local doctitle envu800u82edoctitle ifu800 notu800 subjectspace oru800 notu800 doctitle then return nilu800 endu800 check whether weu800 should output theu800 endu800 boxu800 atu800 allu800. addu800 theu800 endu800 boxu800 byu800 default ifu800 theu800 documentation exists oru800 ifu800 weu800 areu800 inu800 theu800 user module oru800 template namespaces. local linkbox args 'link boxu800' ifu800 linkbox 'offu800' oru800 notu800 doctitleu82eexists oru800 subjectspace 2u800 oru800 subjectspace 828u800 oru800 subjectspace 10u800 then return nilu800 endu800 assemble theu800 link boxu800. local text   ifu800 linkbox then text text .. linkbox else text text .. pu800u82emakedocpageblurb args envu800 oru800   "this documentation isu800 transcluded from foou800 ." ifu800 subjectspace 2u800 oru800 subjectspace 10u800 oru800 subjectspace 828u800 then weu800 areu800 inu800 theu800 user template oru800 module namespaces. addu800 sandbox andu800 testcases links. "editors canu800 experiment inu800 this template template'su800 sandbox andu800 testcases pages." text text .. pu800u82emakeexperimentblurb args envu800 oru800   .. ' ' ifu800 notu800 argsu82econtent andu800 notu800 args 1u800 then "please addu800 categories tou800 theu800 docu800 subpage." donu800'tu800 show this message with inline docs oru800 with anu800 explicitly specified docu800 page asu800 then itu800 isu800 unclear where tou800 addu800 theu800 categories. text text .. pu800u82emakecategoriesblurb args envu800 oru800   endu800 text text .. ' ' .. pu800u82emakesubpagesblurb args envu800 oru800   "subpages ofu800 this template" endu800 endu800 local boxu800 mwu800u82ehtmlu82ecreate 'divu800' 'documentation metadata' boxu800 attr 'role' 'note' addclass message 'endu800 boxu800 class 'plainlinks addclass message 'endu800 boxu800 plainlinks wikitext text done return ' nu800' .. tostring boxu800 endu800 function pu800u82emakedocpageblurb args envu800 makes theu800 blurb "this documentation isu800 transcluded from template foou800 edit history ". args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment messages 'edit link display' 'edit' 'history link display' 'history' 'transcluded from blurb' 'theu800 above u8d8a7u8d985u8d8a7u8d985u8d8aau8e2808cu8d9beu8d8afu8db8cu8d8a7 template documentation documentation isu800 help transclusion transcluded from 1u800.' 'module preload' 'template documentation preload module docu800' 'create link display' 'create' 'create module docu800 blurb' 'youu800 might want tou800 1u800 au800 documentation page foru800 this u8d8a7u8d985u8d8a7u8d985u8d8aau8e2808cu8d9beu8d8afu8db8cu8d8a7 luau800 scribunto module .' local doctitle envu800u82edoctitle ifu800 notu800 doctitle then return nilu800 endu800 local retu800 ifu800 doctitleu82eexists then docu800 exists; link tou800 itu800. local doclink makewikilink doctitleu82eprefixedtext local editurl doctitle fullurl action 'edit' local editdisplay message 'edit link display' local editlink makeurllink editurl editdisplay local historyurl doctitle fullurl action 'history' local historydisplay message 'history link display' local historylink makeurllink historyurl historydisplay retu800 message 'transcluded from blurb' doclink .. ' ' .. maketoolbar editlink historylink .. ' ' elseif envu800u82esubjectspace 828u800 then docu800 does notu800 exist; asku800 tou800 create itu800. local createurl doctitle fullurl action 'edit' preload message 'module preload' local createdisplay message 'create link display' local createlink makeurllink createurl createdisplay retu800 message 'create module docu800 blurb' createlink .. ' ' endu800 return retu800 endu800 function pu800u82emakeexperimentblurb args envu800 renders theu800 text "editors canu800 experiment inu800 this template template'su800 sandbox edit diff andu800 testcases edit pages." args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment messages 'sandbox link display' 'sandbox' 'sandbox edit link display' 'edit' 'compare link display' 'diff' 'module sandbox preload' 'template documentation preload module sandbox' 'template sandbox preload' 'template documentation preload sandbox' 'sandbox create link display' 'create' 'mirror edit summary' 'create sandbox version ofu800 1u800' 'mirror link display' 'mirror' 'mirror link preload' 'template documentation mirror' 'sandbox link display' 'sandbox' 'testcases link display' 'testcases 'testcases edit link display' 'edit' 'template sandbox preload' 'template documentation preload sandbox' 'testcases create link display' 'create' 'testcases link display' 'testcases 'testcases edit link display' 'edit' 'module testcases preload' 'template documentation preload module testcases 'template testcases preload' 'template documentation preload testcases 'experiment blurb module' 'editors canu800 experiment inu800 this module module'su800 1u800 andu800 2u800 pages.' 'experiment blurb template' 'editors canu800 experiment inu800 this template template'su800 1u800 andu800 2u800 pages.' local subjectspace envu800u82esubjectspace local templatetitle envu800u82etemplatetitle local sandboxtitle envu800u82esandboxtitle local testcasestitle envu800u82etestcasestitle local templatepage templatetitleu82eprefixedtext ifu800 notu800 subjectspace oru800 notu800 templatetitle oru800 notu800 sandboxtitle oru800 notu800 testcasestitle then return nilu800 endu800 make links. local sandboxlinks testcaseslinks ifu800 sandboxtitleu82eexists then local sandboxpage sandboxtitleu82eprefixedtext local sandboxdisplay message 'sandbox link display' local sandboxlink makewikilink sandboxpage sandboxdisplay local sandboxediturl sandboxtitle fullurl action 'edit' local sandboxeditdisplay message 'sandbox edit link display' local sandboxeditlink makeurllink sandboxediturl sandboxeditdisplay local compareurl envu800u82ecompareurl local comparelink ifu800 compareurl then local comparedisplay message 'compare link display' comparelink makeurllink compareurl comparedisplay endu800 sandboxlinks sandboxlink .. ' ' .. maketoolbar sandboxeditlink comparelink else local sandboxpreload ifu800 subjectspace 828u800 then sandboxpreload message 'module sandbox preload' else sandboxpreload message 'template sandbox preload' endu800 local sandboxcreateurl sandboxtitle fullurl action 'edit' preload sandboxpreload local sandboxcreatedisplay message 'sandbox create link display' local sandboxcreatelink makeurllink sandboxcreateurl sandboxcreatedisplay local mirrorsummary message 'mirror edit summary' makewikilink templatepage local mirrorpreload message 'mirror link preload' local mirrorurl sandboxtitle fullurl action 'edit' preload mirrorpreload summary mirrorsummary ifu800 subjectspace 828u800 then mirrorurl sandboxtitle fullurl action 'edit' preload templatetitleu82eprefixedtext summary mirrorsummary endu800 local mirrordisplay message 'mirror link display' local mirrorlink makeurllink mirrorurl mirrordisplay sandboxlinks message 'sandbox link display' .. ' ' .. maketoolbar sandboxcreatelink mirrorlink endu800 ifu800 testcasestitleu82eexists then local testcasespage testcasestitleu82eprefixedtext local testcasesdisplay message 'testcases link display' local testcaseslink makewikilink testcasespage testcasesdisplay local testcasesediturl testcasestitle fullurl action 'edit' local testcaseseditdisplay message 'testcases edit link display' local testcaseseditlink makeurllink testcasesediturl testcaseseditdisplay foru800 modules addu800 testcases runu800 link ifu800 exists ifu800 testcasestitleu82econtentmodel "scribunto" andu800 testcasestitleu82etalkpagetitle andu800 testcasestitleu82etalkpagetitleu82eexists then local testcasesrunlinkdisplay message 'testcases runu800 link display' local testcasesrunlink makewikilink testcasestitleu82etalkpagetitleu82eprefixedtext testcasesrunlinkdisplay testcaseslinks testcaseslink .. ' ' .. maketoolbar testcaseseditlink testcasesrunlink else testcaseslinks testcaseslink .. ' ' .. maketoolbar testcaseseditlink endu800 else local testcasespreload ifu800 subjectspace 828u800 then testcasespreload message 'module testcases preload' else testcasespreload message 'template testcases preload' endu800 local testcasescreateurl testcasestitle fullurl action 'edit' preload testcasespreload local testcasescreatedisplay message 'testcases create link display' local testcasescreatelink makeurllink testcasescreateurl testcasescreatedisplay testcaseslinks message 'testcases link display' .. ' ' .. maketoolbar testcasescreatelink endu800 local messagename ifu800 subjectspace 828u800 then messagename 'experiment blurb module' else messagename 'experiment blurb template' endu800 return message messagename sandboxlinks testcaseslinks endu800 function pu800u82emakecategoriesblurb args envu800 generates theu800 text "please addu800 categories tou800 theu800 docu800 subpage." args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment messages 'docu800 link display' ' docu800' 'addu800 categories blurb' 'please addu800 categories tou800 theu800 1u800 subpage.' local doctitle envu800u82edoctitle ifu800 notu800 doctitle then return nilu800 endu800 local docpathlink makewikilink doctitleu82eprefixedtext message 'docu800 link display' return message 'addu800 categories blurb' docpathlink endu800 function pu800u82emakesubpagesblurb args envu800 generates theu800 "subpages ofu800 this template" link. args au800 table ofu800 arguments passed byu800 theu800 user envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment messages 'template pagetype' 'template' 'module pagetype' 'module' 'default pagetype' 'page' 'subpages link display' 'subpages ofu800 this 1u800' local subjectspace envu800u82esubjectspace local templatetitle envu800u82etemplatetitle ifu800 notu800 subjectspace oru800 notu800 templatetitle then return nilu800 endu800 local pagetype ifu800 subjectspace 10u800 then pagetype message 'template pagetype' elseif subjectspace 828u800 then pagetype message 'module pagetype' else pagetype message 'default pagetype' endu800 local subpageslink makewikilink 'special prefixindex ' .. templatetitleu82eprefixedtext .. ' ' message 'subpages link display' pagetype return message 'subpages blurb' subpageslink endu800 tracking categories function pu800u82eaddtrackingcategories envu800 check ifu800 documentation isu800 transcluded onu800 au800 docu800 oru800 testcases page. envu800 environment table containing title objects etcu800. generated with pu800u82egetenvironment messages 'display strange usage category' true 'docu800 subpage' 'docu800' 'testcases subpage' 'testcases 'strange usage category' 'u8d8a7u8d985u8d8a7u8d985u8d8aau8e2808cu8d9beu8d8afu8db8cu8d8a7 pages with strange documentation usage' testcases pages inu800 theu800 module namespace areu800 notu800 categorised asu800 they mayu800 have documentation transcluded automatically. local title envu800u82etitle local subjectspace envu800u82esubjectspace ifu800 notu800 title oru800 notu800 subjectspace then return nilu800 endu800 local subpage titleu82esubpagetext local retu800   ifu800 message 'display strange usage category' nilu800 'boolean' andu800 subpage message 'docu800 subpage' oru800 subjectspace 828u800 andu800 subpage message 'testcases subpage' then retu800 retu800 .. makecategorylink message 'strange usage category' endu800 return retu800 endu800 return pu800 