Template:Jct



-

-

Wikipedia

enwiki

http://en.wikipedia.org/wiki/Main_Page

MediaWiki 1.25wmf13

first-letter

-

Media

Special



Talk

User

User talk

Wikipedia

Wikipedia talk

File

File talk

MediaWiki

MediaWiki talk

Template

Template talk

<namespace case="first-letter" key="12">Help

<namespace case="first-letter" key="13">Help talk

<namespace case="first-letter" key="14">Category

<namespace case="first-letter" key="15">Category talk

<namespace case="first-letter" key="100">Portal

<namespace case="first-letter" key="101">Portal talk

<namespace case="first-letter" key="108">Book

<namespace case="first-letter" key="109">Book talk

<namespace case="first-letter" key="118">Draft

<namespace case="first-letter" key="119">Draft talk

<namespace case="first-letter" key="446">Education Program

<namespace case="first-letter" key="447">Education Program talk

<namespace case="first-letter" key="710">TimedText

<namespace case="first-letter" key="711">TimedText talk

<namespace case="first-letter" key="828">Module

<namespace case="first-letter" key="829">Module talk

<namespace case="first-letter" key="2600">Topic

-

Template:Jct

<ns>10</ns>

<id>9731674</id>

-

<id>611617402</id>

579223290

2014-06-05T02:16:35Z

-

Happy5214

<id>3653754</id>

Deployment of Lua version

wikitext

text/x-wiki

<text bytes="88" xml:space="preserve">

ayj6c09of4gqvx495l5ftay9wzkbav0

-

Template:Documentation

<ns>10</ns>

<id>13529042</id>

-

<id>615383778</id>

615383581

2014-07-03T04:12:19Z

-

Mr. Stradivarius

<id>4708675</id>

Changed protection level of Template:Documentation: Edit warring / content dispute: making this indef so that the template won't become unprotected accidentally ([Edit=Allow only administrators] (indefinite) [Move=Allow only adm

wikitext

text/x-wiki

<text bytes="182" xml:space="preserve">

o4ddn701tao1ufdnkxe1wdgz5b5ga84

-

Template:Documentation subpage

<ns>10</ns>

<id>7890381</id>

-

<id>617432645</id>

608599904

2014-07-18T09:37:22Z

-

Sardanaphalus

<id>427947</id>

Added 1.0em margin so template looks less a part of subsequent content and amended code layout -- hope neither of these too controversial

wikitext

text/x-wiki

<text bytes="1667" xml:space="preserve">

iwoex9r4jjje2jlwm8eygcyef0s6hzx

-

Template:High-use

<ns>10</ns>

<id>17406187</id>

-

<id>621573891</id>

612772700

2014-08-17T03:29:24Z

-

Chmarkine

<id>15398482</id>

Since the server(s) support HTTPS, use protocol relative URL(s) (i.e. without http:) for these website(s): tools.wmflabs.org/templatecount/

wikitext

text/x-wiki

<text bytes="1169" xml:space="preserve">

e12udmrgqepsj4u4pzg8tpw2onbbzez

-

Template:Jct/doc

<ns>10</ns>

<id>12529357</id>

-

<id>636166883</id>

624990124

2014-12-01T13:25:13Z

-

Philroc

<id>19549021</id>

wikitext

text/x-wiki

<text bytes="7853" xml:space="preserve">    This is the basic syntax you need to get a junction listing for a highway article's exit list or interchange list, just place this in the appropriate place in the exit list table and fill in the variables. Note that this is a complete list of every variable that can be used with and that many are unnecessary in most cases. Variables that are empty can be omitted. ==Usage== <pre width=“100%"> For the above parameters here's what you should fill in: *country: the ISO 3166-1 alpha-3 code of the country that the route is in. Use this list to find the correct code for the country. These countries have had the necessary subtemplates set up; see that page for instructions on how to set up new countries. If the route is located in the United States or Canada and the route is located within one state or province then it is possible to use state without setting the country. Accepted values for state are as follows: **U.S. state: the two-letter postal abbreviation of the state. **Canadian province: the two-letter postal abbreviation of the province. **Mexican state: the three-letter postal abbreviation of the state. * state: or province: two-to-three-letter abbreviation, state/province/territory (USA, MEX, CAN, & AUS only) that the article route is located in * 1, 3, 5, 7: the type of route, this parameter replaces the number, i.e. it should not be 1=I, just simply I ::For American routes, see this page. ::For Australian routes, see this page. ::For Canadian routes, the following designations are supported: ::*AB (Alberta) - Hwy (primary and secondary provincial highways) ::*ON (Ontario) - Highway (provincial highway, all types), RR (Regional Road, must supply a county argument for region) ::*QC (Quebec) - Route (standard route), A (Autoroute) ::*MB (Manitoba) - Hwy (primary provincial highway), PR (secondary provincial highway), Winnipeg (Winnipeg city route) ::*NB (New Brunswick) - Route (NOTE: Not all routes have shield graphics at present.) ::*NS (Nova Scotia) - Trunk (trunk route), Hwy (highway), Route (other route) ::*All provinces - TCH (Trans-Canada Highway) ::For United Kingdom routes: ::* M = Motorway ::* A = A roads :::For A roads that have a motorway segment, example: A1(M), use M as the route type and the A1 as the number :::''Not all A roads have an svg shield. Use a lowercase a to show a png shield. * 2, 4, 6, 8: the route number for the preceding route type, this parameter replaces the number, i.e. it should not be 2=10, just simply 10 * dir1, dir2, dir3, dir4: road direction if the exit only leads to a particular direction rather than both, for example Interstate 10 east * to1, to2, to3, to4: inputs a To before a route. toroad does the same for the road parameter * name1, name2, name3, name4: road name if the highway has a common name as well as a route number * road: adds road names, separate multiple roads by a forward slash(/). * city1, city2, city3, city4: the cities listed on the exit's guide signs, i.e. control cities. The template will automatically put the city in the following format: city1. In the event a destination city is located outside of the state the route is in, or the city needs additional disambiguation by area or county, use the location parameter(s). * location1, location2, location3, location4: other locations listed on the exit's guide signs, i.e. control cities. These parameters are mutually exclusive with their corresponding city# parameters. In other words, do not use city1 and location1; use city1 and location2. The template will display the input at the appropriate location in the list, using whatever formatting is used in the parmeter. *Other parameters include county1-4, for disambiguating county routes, noshield1-4, for not showing a shield, nolink1-4, for not linking to a minor route that will never have an article, and dab1-4, for disambiguating a route (like Minnesota State Highway 62 (east) or an Interstate business route; business routes that need separate banners on top are currently supported in all U.S. states where the banners are actually used in the field. *There are also noshield and nolink params to hide all shields or all links. *extra: currently supports adding a single MUTCD intermodal icon for an airport, bus terminal, car ferry, passenger rail or light rail station appear after any and all route markers but before the rest of the output using airport, bus, ferry, rail or light-rail respectively. For Australia, the local version of the airport and hospital icons are available. Graphics and types for additional countries can be added to jct/extra. ==Examples== * : *  : *  : *  : *  : *  : *  : *  : *  : The list of countries that are set up limits the set of examples. For a list of all current defined sub-templates, see: ==See also== *Roadlink, a similar template that produces road links without route marker images *Jctname, a similar template that transposes the road name and route number

k24xcn754tns5zr2sberwc62ds6std0

-

Template:Look from

<ns>10</ns>

<id>3258658</id>

-

<id>499482518</id>

388698203

2012-06-26T18:18:32Z

-

David Levy

<id>197557</id>

David Levy moved page Template:Lookfrom to Template:Look from over redirect: clearer; consistent with Template:In title

wikitext

text/x-wiki

<text bytes="363" xml:space="preserve"> Special:PrefixIndex/

fdlqlldfktybjm0gtfgiigszurlle7z

-

Template:Lookfrom

<ns>10</ns>

<id>36255737</id>

<redirect title="Template:Look from"/>

-

<id>499482520</id>

2012-06-26T18:18:32Z

-

David Levy

<id>197557</id>

David Levy moved page Template:Lookfrom to Template:Look from over redirect: clearer; consistent with Template:In title

wikitext

text/x-wiki

<text bytes="32" xml:space="preserve">#REDIRECT Template:Look from

pqo2djv5763pde6fdn1cdk4u2a5tktx

-

Template:Lua

<ns>10</ns>

<id>38752725</id>

-

<id>611364175</id>

611345521

2014-06-03T10:54:44Z

-

MSGJ

<id>42630</id>

show output on template?

wikitext

text/x-wiki

<text bytes="196" xml:space="preserve">

pnmjp3f3fl321yf2jpg5syebi412n7b

-

Template:Ombox

<ns>10</ns>

<id>17522403</id>

-

<id>577969039</id>

463278061

2013-10-20T12:45:08Z

-

Mr. Stradivarius

<id>4708675</id>

switch to Lua version

wikitext

text/x-wiki

<text bytes="146" xml:space="preserve">

1o93yrjvq6v2ylug2k0uaaltljurje2

-

Template:Tl

<ns>10</ns>

<id>1487430</id>

move=sysop:edit=sysop

-

<id>622723682</id>

388327745

2014-08-25T10:26:35Z

-

Anomie

<id>301903</id>

Literal braces to entities, per talk request

wikitext

text/x-wiki

<text bytes="168" xml:space="preserve">&#123;&#123;Template:&#125;&#125;

h0vr3yvr9jdyd17x82vnav21ngwmxuk

-

Module:Arguments

<ns>828</ns>

<id>41298065</id>

-

<id>637578165</id>

615651707

2014-12-11T04:32:27Z

-

Mr. Stradivarius

<id>4708675</id>

fix bug where explicitly deleted args were still appearing when iterated over with pairs or ipairs - code courtesy of User:Jackmcbarn

Scribunto

text/plain

<text bytes="8643" xml:space="preserve">-- This module provides easy processing of arguments passed to Scribunto from -- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly. local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local arguments = {} -- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it. local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val ==  then return nil else return val end else return val end end local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end local function tidyValNoChange(key, val) return val end function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {} -- -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). -- local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then -- -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the local parent = frame:getParent if not parent then fargs = frame.args else local title = parent:getTitle:gsub('/sandbox$', ) local found = false if type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if v == title then found = true break end end elseif options.wrappers == title then found = true end -- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end -- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs -- -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. -- local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end -- -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. -- local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable) local function mergeArgs(iterator, tables) -- -- Accepts multiple tables as input and merges their keys and values -- into one table using the specified iterator. If a value is already -- present it is not overwritten; tables listed earlier have precedence. -- We are also memoizing nil values, which can be overwritten if they -- are 's' (soft). -- for _, t in ipairs(tables) do for key, val in iterator(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end -- -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. -- metatable.__index = function (t, key) -- -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. -- local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then -- -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. -- metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end metatable.__pairs = function -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(pairs, argTables) metatable.donePairs = true metatable.doneIpairs = true end return pairs(metaArgs) end metatable.__ipairs = function -- Called when ipairs is run on the args table. if not metatable.doneIpairs then mergeArgs(ipairs, argTables) metatable.doneIpairs = true end return ipairs(metaArgs) end return args end return arguments

7d4ocur2hyywy6ph59tc89jv97up2wi

-

Module:Category handler

<ns>828</ns>

<id>39772274</id>

-

<id>617942873</id>

616811662

2014-07-22T05:08:26Z

-

Mr. Stradivarius

<id>4708675</id>

allow invocations specifying the page parameter to use the mw.loadData optimisations, and don't call mw.title.new every time

Scribunto

text/plain

<text bytes="7871" xml:space="preserve"> -- -- -- CATEGORY HANDLER -- -- -- -- This module implements the template in Lua, -- -- with a few improvements: all namespaces and all namespace aliases -- -- are supported, and namespace names are detected automatically for -- -- the local wiki. This module requires Module:Namespace detect -- -- and Module:Yesno to be available on the local wiki. It can be -- -- configured for different wikis by altering the values in -- -- Module:Category handler/config, and pages can be blacklisted -- -- from categorisation by using Module:Category handler/blacklist. -- -- -- -- Load required modules local yesno = require('Module:Yesno') -- Lazily load things we don't always need local mShared, mappings local p = {}  -- Helper functions  local function trimWhitespace(s, removeBlanks) if type(s) ~= 'string' then return s end s = s:match('^%s*(.-)%s*$') if removeBlanks then if s ~= '' then return s else return nil end else return s end end  -- CategoryHandler class  local CategoryHandler = {} CategoryHandler.__index = CategoryHandler function CategoryHandler.new(data, args) local obj = setmetatable({ _data = data, _args = args }, CategoryHandler) -- Set the title object do local pagename = obj:parameter('demopage') local success, titleObj if pagename then success, titleObj = pcall(mw.title.new, pagename) end if success and titleObj then obj.title = titleObj if titleObj == mw.title.getCurrentTitle then obj._usesCurrentTitle = true end else obj.title = mw.title.getCurrentTitle obj._usesCurrentTitle = true end end -- Set suppression parameter values for _, key in ipairs{'nocat', 'categories'} do local value = obj:parameter(key) value = trimWhitespace(value, true) obj['_' .. key] = yesno(value) end do local subpage = obj:parameter('subpage') local category2 = obj:parameter('category2') if type(subpage) == 'string' then subpage = mw.ustring.lower(subpage) end if type(category2) == 'string' then subpage = mw.ustring.lower(category2) end obj._subpage = trimWhitespace(subpage, true) obj._category2 = trimWhitespace(category2) -- don't remove blank values end return obj end function CategoryHandler:parameter(key) local parameterNames = self._data.parameters[key] local pntype = type(parameterNames) if pntype == 'string' or pntype == 'number' then return self._args[parameterNames] elseif pntype == 'table' then for _, name in ipairs(parameterNames) do local value = self._args[name] if value ~= nil then return value end end return nil else error(string.format( 'invalid config key "%s"', tostring(key) ), 2) end end function CategoryHandler:isSuppressedByArguments return -- See if a category suppression argument has been set. self._nocat == true or self._categories == false or ( self._category2 and self._category2 ~= self._data.category2Yes and self._category2 ~= self._data.category2Negative ) -- Check whether we are on a subpage, and see if categories are -- suppressed based on our subpage status. or self._subpage == self._data.subpageNo and self.title.isSubpage or self._subpage == self._data.subpageOnly and not self.title.isSubpage end function CategoryHandler:shouldSkipBlacklistCheck -- Check whether the category suppression arguments indicate we -- should skip the blacklist check. return self._nocat == false or self._categories == true or self._category2 == self._data.category2Yes end function CategoryHandler:matchesBlacklist if self._usesCurrentTitle then return self._data.currentTitleMatchesBlacklist else mShared = mShared or require('Module:Category handler/shared') return mShared.matchesBlacklist( self.title.prefixedText, mw.loadData('Module:Category handler/blacklist') ) end end function CategoryHandler:isSuppressed -- Find if categories are suppressed by either the arguments or by -- matching the blacklist. return self:isSuppressedByArguments or not self:shouldSkipBlacklistCheck and self:matchesBlacklist end function CategoryHandler:getNamespaceParameters if self._usesCurrentTitle then return self._data.currentTitleNamespaceParameters else if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end return mShared.getNamespaceParameters( self.title, mappings ) end end function CategoryHandler:namespaceParametersExist -- Find whether any namespace parameters have been specified. -- We use the order "all" --> namespace params --> "other" as this is what -- the old template did. if self:parameter('all') then return true end if not mappings then mShared = mShared or require('Module:Category handler/shared') mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData end for ns, params in pairs(mappings) do for i, param in ipairs(params) do if self._args[param] then return true end end end if self:parameter('other') then return true end return false end function CategoryHandler:getCategories local params = self:getNamespaceParameters local nsCategory for i, param in ipairs(params) do local value = self._args[param] if value ~= nil then nsCategory = value break end end if nsCategory ~= nil or self:namespaceParametersExist then -- Namespace parameters exist - advanced usage. if nsCategory == nil then nsCategory = self:parameter('other') end local ret = {self:parameter('all')} local numParam = tonumber(nsCategory) if numParam and numParam >= 1 and math.floor(numParam) == numParam then -- nsCategory is an integer ret[#ret + 1] = self._args[numParam] else ret[#ret + 1] = nsCategory end if #ret < 1 then return nil else return table.concat(ret) end elseif self._data.defaultNamespaces[self.title.namespace] then -- Namespace parameters don't exist, simple usage. return self._args[1] end return nil end -- Exports  local p = {} function p._exportClasses -- Used for testing purposes. return { CategoryHandler = CategoryHandler } end function p._main(args, data) data = data or mw.loadData('Module:Category handler/data') local handler = CategoryHandler.new(data, args) if handler:isSuppressed then return nil end return handler:getCategories end function p.main(frame, data) data = data or mw.loadData('Module:Category handler/data') local args = require('Module:Arguments').getArgs(frame, { wrappers = data.wrappers, valueFunc = function (k, v) v = trimWhitespace(v) if type(k) == 'number' then if v ~= '' then return v else return nil end else return v end end }) return p._main(args, data) end return p

letwavu3yvlayfzew66uuwixmwebq5b

-

Module:Category handler/blacklist

<ns>828</ns>

<id>43232926</id>

-

<id>616764246</id>

616071213

2014-07-13T09:07:09Z

-

Mr. Stradivarius

<id>4708675</id>

Protected Module:Category handler/blacklist: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))

Scribunto

text/plain

<text bytes="732" xml:space="preserve">-- This module contains the blacklist used by Module:Category handler. -- Pages that match Lua patterns in this list will not be categorised unless -- categorisation is explicitly requested. return { '^Main Page$', -- don't categorise the main page. -- Don't categorise the following pages or their subpages. -- "%f[/\0]" matches if the next character is "/" or the end of the string. '^Wikipedia:Cascade%-protected items%f[/\0]', '^User:UBX%f[/\0]', -- The userbox "template" space. '^User talk:UBX%f[/\0]', -- Don't categorise subpages of these pages, but allow -- categorisation of the base page. '^Wikipedia:Template messages/.*$', '/[aA]rchive' -- Don't categorise archives. }

ne8sdldor304iu81gnqa05p401j3exc

-

Module:Category handler/config

<ns>828</ns>

<id>42291997</id>

-

<id>616764079</id>

616045566

2014-07-13T09:05:36Z

-

Mr. Stradivarius

<id>4708675</id>

Protected Module:Category handler/config: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))

Scribunto

text/plain

<text bytes="5755" xml:space="preserve"> -- Module:Category handler configuration data -- -- Language-specific parameter names and values can be set here. -- -- For blacklist config, see Module:Category handler/blacklist. -- local cfg = {} -- Don't edit this line. -- Start configuration data --  -- Parameter names -- -- These configuration items specify custom parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- foo = 'parameter name', -- -- -- -- To add multiple names, you can use this format: -- -- -- -- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, -- cfg.parameters = { -- The nocat and categories parameter suppress -- categorisation. They are used with Module:Yesno, and work as follows: -- -- cfg.nocat: -- Result of yesno Effect -- true Categorisation is suppressed -- false Categorisation is allowed, and -- the blacklist check is skipped -- nil Categorisation is allowed -- -- cfg.categories: -- Result of yesno Effect -- true Categorisation is allowed, and -- the blacklist check is skipped -- false Categorisation is suppressed -- nil Categorisation is allowed nocat = 'nocat', categories = 'categories', -- The parameter name for the legacy "category2" parameter. This skips the -- blacklist if set to the cfg.category2Yes value, and suppresses -- categorisation if present but equal to anything other than -- cfg.category2Yes or cfg.category2Negative. category2 = 'category2', -- cfg.subpage is the parameter name to specify how to behave on subpages. subpage = 'subpage', -- The parameter for data to return in all namespaces. all = 'all', -- The parameter name for data to return if no data is specified for the -- namespace that is detected. other = 'other', -- The parameter name used to specify a page other than the current page; -- used for testing and demonstration. demopage = 'page', } -- Parameter values -- -- These are set values that can be used with certain parameters. Only one -- -- value can be specified, like this: -- -- -- -- cfg.foo = 'value name' -- -- -- The following settings are used with the cfg.category2 parameter. Setting -- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2 -- is present but equal to anything other than cfg.category2Yes or -- cfg.category2Negative then it supresses cateogrisation. cfg.category2Yes = 'yes' cfg.category2Negative = '¬' -- The following settings are used with the cfg.subpage parameter. -- cfg.subpageNo is the value to specify to not categorise on subpages; -- cfg.subpageOnly is the value to specify to only categorise on subpages. cfg.subpageNo = 'no' cfg.subpageOnly = 'only' -- Default namespaces -- -- This is a table of namespaces to categorise by default. The keys are the -- -- namespace numbers. -- cfg.defaultNamespaces = { [ 0] = true, -- main [ 6] = true, -- file [ 12] = true, -- help [ 14] = true, -- category [100] = true, -- portal [108] = true, -- book }  -- Wrappers -- -- This is a wrapper template or a list of wrapper templates to be passed to -- -- Module:Arguments. -- cfg.wrappers = 'Template:Category handler'  -- End configuration data --  return cfg -- Don't edit this line.

6ga9hbq2pdwalsvx68i53dmbr421rq5

-

Module:Category handler/data

<ns>828</ns>

<id>43233647</id>

-

<id>616764105</id>

616020360

2014-07-13T09:05:55Z

-

Mr. Stradivarius

<id>4708675</id>

Protected Module:Category handler/data: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))

Scribunto

text/plain

<text bytes="631" xml:space="preserve">-- This module assembles data to be passed to Module:Category handler using -- mw.loadData. This includes the configuration data and whether the current -- page matches the title blacklist. local data = require('Module:Category handler/config') local mShared = require('Module:Category handler/shared') local blacklist = require('Module:Category handler/blacklist') local title = mw.title.getCurrentTitle data.currentTitleMatchesBlacklist = mShared.matchesBlacklist( title.prefixedText, blacklist ) data.currentTitleNamespaceParameters = mShared.getNamespaceParameters( title, mShared.getParamMappings ) return data

k26mwixuaeijisfddb0sxkg82iux8v4

-

Module:Category handler/shared

<ns>828</ns>

<id>43232937</id>

-

<id>616764145</id>

616020201

2014-07-13T09:06:15Z

-

Mr. Stradivarius

<id>4708675</id>

Protected Module:Category handler/shared: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))

Scribunto

text/plain

<text bytes="888" xml:space="preserve">-- This module contains shared functions used by Module:Category handler -- and its submodules. local p = {} function p.matchesBlacklist(page, blacklist) for i, pattern in ipairs(blacklist) do local match = mw.ustring.match(page, pattern) if match then return true end end return false end function p.getParamMappings(useLoadData) local dataPage = 'Module:Namespace detect/data' if useLoadData then return mw.loadData(dataPage).mappings else return require(dataPage).mappings end end function p.getNamespaceParameters(titleObj, mappings) -- We don't use title.nsText for the namespace name because it adds -- underscores. local mappingsKey if titleObj.isTalkPage then mappingsKey = 'talk' else mappingsKey = mw.site.namespaces[titleObj.namespace].name end mappingsKey = mw.ustring.lower(mappingsKey) return mappings[mappingsKey] or {} end return p

omlsnhudxz6juptvtxz7ns97jutbzc5

-

Module:Documentation

<ns>828</ns>

<id>40256557</id>

-

<id>631812653</id>

627376982

2014-10-30T22:34:27Z

-

WOSlinker

<id>3138265</id>

use mw.html

Scribunto

text/plain

<text bytes="36405" xml:space="preserve">-- This module implements. -- Get required modules. local getArgs = require('Module:Arguments').getArgs local messageBox = require('Module:Message box') -- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local p = {} -- Often-used functions. local ugsub = mw.ustring.gsub -- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes. local function message(cfgKey, valArray, expectType) -- -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." -- local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4) end local ret = ugsub(msg, '$([1-9][0-9]*)', getMessageVal) return ret end p.message = message local function makeWikilink(page, display) if display then return mw.ustring.format('%s', page, display) else return mw.ustring.format('%s', page) end end p.makeWikilink = makeWikilink local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end p.makeCategoryLink = makeCategoryLink local function makeUrlLink(url, display) return mw.ustring.format('[%s %s]', url, display) end p.makeUrlLink = makeUrlLink local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end return '<small style="font-style: normal;">(' .. table.concat(ret, ' &#124; ') .. ') ' end p.makeToolbar = makeToolbar -- Argument processing  local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= '' then return value else return nil end else return value end end }) return p[funcName](args) end end -- Main function  p.main = makeInvokeFunc('_main') function p._main(args) -- -- This function defines logic flow for the module. -- @args - table of arguments passed by the user -- -- Messages: -- 'main-div-id' --> 'template-documentation' -- 'main-div-classes' --> 'template-documentation iezoomfix' -- local env = p.getEnvironment(args) local root = mw.html.create root :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) -- This div tag is from, but moving it here -- so that we don't have to worry about unclosed tags. :tag('div') :attr('id', message('main-div-id')) :addClass(message('main-div-classes')) :newline :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. :newline :done :done :wikitext(p._endBox(args, env)) :wikitext(p.addTrackingCategories(env)) return tostring(root) end -- Environment settings  function p.getEnvironment(args) -- -- Returns a table with information about the environment, including title objects and other namespace- or -- path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- env.printTitle - the print version of the template, located at the /Print subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. -- local env, envFuncs = {}, {} -- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end }) function envFuncs.title -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle end return title end function envFuncs.templateTitle -- -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' -- local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end function envFuncs.docTitle -- -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' -- local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end function envFuncs.sandboxTitle -- -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end function envFuncs.testcasesTitle -- -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' -- return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end function envFuncs.printTitle -- -- Title object for the /Print subpage. -- Messages: -- 'print-subpage' --> 'Print' -- return env.templateTitle:subPageTitle(message('print-subpage')) end function envFuncs.protectionLevels -- The protection levels table of the title object. return env.title.protectionLevels end function envFuncs.subjectSpace -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end function envFuncs.docSpace -- The documentation namespace number. For most namespaces this is the same as the -- subject namespace. However, pages in the Article, File, MediaWiki or Category -- namespaces must have their /doc, /sandbox and /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end function envFuncs.docpageBase -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end function envFuncs.compareUrl -- Diff link between the sandbox and the main template using Special:ComparePages. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.fullUrl( 'Special:ComparePages', {page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end return env end -- Auxiliary templates  function p.sandboxNotice(args, env) -- local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to. We need just two fields, "image" and "text". local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for Template:Foo (diff)." local text =  local frame = mw.getCurrentFrame local isPreviewing = frame:preprocess() == '' -- True if the page is being previewed. local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if isPreviewing or not compareUrl then text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) else local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for test cases." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.namespace == mw.site.namespaces.Module.id then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. ' ' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. ' ' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. text = text .. makeCategoryLink(message('sandbox-category')) omargs.text = text local ret = ' ' ret = ret .. messageBox.main('ombox', omargs) return ret end function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local protectionLevels, mProtectionBanner local title = env.title if title.namespace ~= 10 and title.namespace ~= 828 then -- Don't display the protection template if we are not in the template or module namespaces. return nil end protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. mProtectionBanner = require('Module:Protection banner') local reason = message('protection-reason-edit') return mProtectionBanner._main{reason, small = true} elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. mProtectionBanner = require('Module:Protection banner') return mProtectionBanner._main{action = 'move', small = true} else return nil end end -- Start box  p.startBox = makeInvokeFunc('_startBox') function p._startBox(args, env) -- -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. -- env = env or p.getEnvironment(args) local links local content = args.content if not content then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end function p.makeStartBoxLinksData(args, env) -- -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' -- local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end local data = {} data.title = title data.docTitle = docTitle -- View, display, edit, and purge links if /doc exists. data.viewLinkDisplay = message('view-link-display') data.editLinkDisplay = message('edit-link-display') data.historyLinkDisplay = message('history-link-display') data.purgeLinkDisplay = message('purge-link-display') -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 6 then -- File namespace preload = message('file-docpage-preload') elseif subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end data.preload = preload data.createLinkDisplay = message('create-link-display') return data end function p.renderStartBoxLinks(data) -- -- Generates the [view][edit][history][purge] or [create] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData -- local function escapeBrackets(s) -- Escapes square brackets with HTML entities. s = s:gsub('%[', '&#91;') -- Replace square brackets with HTML entities. s = s:gsub('%]', '&#93;') return s end local ret local docTitle = data.docTitle local title = data.title if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay) local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay) local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay) ret = '[%s] [%s] [%s] [%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, viewLink, editLink, historyLink, purgeLink) else local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) ret = '[%s]' ret = escapeBrackets(ret) ret = mw.ustring.format(ret, createLink) end return ret end function p.makeStartBoxData(args, env, links) -- local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {} -- Heading local heading = args.heading -- Blank values are not removed. if heading == '' then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end -- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle elseif subjectSpace == 10 then -- We are in the template or template talk namespaces. data.headingFontWeight = 'bold' data.headingFontSize = '125%' else data.headingFontSize = '150%' end -- Data for the [view][edit][history][purge] or [create] links. if links then data.linksClass = message('start-box-linkclasses') data.linksId = message('start-box-link-id') data.links = links end return data end function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox :css('padding-bottom', '3px') :css('border-bottom', '1px solid #aaa') :css('margin-bottom', '1ex') :newline :tag('span') :cssText(data.headingStyleText) :css('font-weight', data.headingFontWeight) :css('font-size', data.headingFontSize) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end -- Documentation content  p.content = makeInvokeFunc('_content') function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame:expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. return '\n' .. (content or '') .. '\n' end p.contentTitle = makeInvokeFunc('_contentTitle') function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return '' end end -- End box  p.endBox = makeInvokeFunc('_endBox') function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'fmbox-id' --> 'documentation-meta-data' -- 'fmbox-style' --> 'background-color: #ecfcf4' -- 'fmbox-textstyle' --> 'font-style: italic' -- -- The HTML is generated by the template, courtesy of Module:Message box. --]=] -- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end -- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end -- Assemble the arguments for. local fmargs = {} fmargs.id = message('fmbox-id') -- Sets 'documentation-meta-data' fmargs.image = 'none' fmargs.style = message('fmbox-style') -- Sets 'background-color: #ecfcf4' fmargs.textstyle = message('fmbox-textstyle') -- 'font-style: italic;' -- Assemble the fmbox text field. local text = '' if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from Foo." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or '') text = text .. ' ' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or '') end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template" local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates. if printBlurb then text = text .. ' ' .. printBlurb end end end fmargs.text = text return messageBox.main('fmbox', fmargs) end function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from Template:Foo (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above documentation -- is transcluded from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this Scribunto module.' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) 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) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. ' ' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:fullUrl{action = 'edit', preload = message('module-preload')} local createDisplay = message('create-link-display') local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. ' ' end return ret end function p.makeExperimentBlurb(args, env) -- diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- 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 of $1' -- 'mirror-link-display' --> 'mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- '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 can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' -- local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText 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 = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end 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 mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, summary = mirrorSummary} local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText 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) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end 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) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end function p.makeCategoriesBlurb(args, env) -- -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' -- local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end function p.makeSubpagesBlurb(args, env) -- -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' -- local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end function p.makePrintBlurb(args, env) --[=[ -- Generates the blurb displayed when there is a print version of the template available. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'print-link-display' --> '/Print' -- 'print-blurb' --> 'A print version' -- .. ' of this template exists at $1.' -- .. ' If you make a change to this template, please update the print version as well.' -- 'display-print-category' --> true -- 'print-category' --> 'Templates with print versions' --]=] local printTitle = env.printTitle if not printTitle then return nil end local ret if printTitle.exists then local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display')) ret = message('print-blurb', {printLink}) local displayPrintCategory = message('display-print-category', nil, 'boolean') if displayPrintCategory then ret = ret .. makeCategoryLink(message('print-category')) end end return ret end -- Tracking categories  function p.addTrackingCategories(env) -- -- Check if  is transcluded on a /doc or /testcases page. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have --  transcluded automatically. -- local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = '' if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end return p

05ocn06why89ic143ng489c9qt6zvi4

-

Module:Documentation/config

<ns>828</ns>

<id>41520829</id>

-

<id>627377056</id>

627376301

2014-09-28T05:23:32Z

-

Mr. Stradivarius

<id>4708675</id>

remove two deprecated config values

Scribunto

text/plain

<text bytes="18320" xml:space="preserve"> -- -- Configuration for Module:Documentation -- -- Here you can set the values of the parameters and messages used in Module:Documentation to -- localise it to your wiki and your language. Unless specified otherwise, values given here -- should be string values. local cfg = {} -- Do not edit this line. -- Protection template configuration -- cfg['protection-reason-edit'] -- The protection reason for edit-protected templates to pass to -- Module:Protection banner. cfg['protection-reason-edit'] = 'template' -- -- Sandbox notice configuration -- -- On sandbox pages the module can display a template notifying users that the current page is a -- sandbox, and the location of test cases pages, etc. The module decides whether the page is a -- sandbox or not based on the value of cfg['sandbox-subpage']. The following settings configure the -- messages that the notices contains.  -- -- cfg['sandbox-notice-image'] -- The image displayed in the sandbox notice. cfg['sandbox-notice-image'] = '' -- -- cfg['sandbox-notice-pagetype-template'] -- cfg['sandbox-notice-pagetype-module'] -- cfg['sandbox-notice-pagetype-other'] -- The page type of the sandbox page. The message that is displayed depends on the current subject -- namespace. This message is used in either cfg['sandbox-notice-blurb'] or -- cfg['sandbox-notice-diff-blurb']. -- cfg['sandbox-notice-pagetype-template'] = 'template sandbox page' cfg['sandbox-notice-pagetype-module'] = 'module sandbox page' cfg['sandbox-notice-pagetype-other'] = 'sandbox page' -- -- cfg['sandbox-notice-blurb'] -- cfg['sandbox-notice-diff-blurb'] -- cfg['sandbox-notice-diff-display'] -- Either cfg['sandbox-notice-blurb'] or cfg['sandbox-notice-diff-blurb'] is the opening sentence -- of the sandbox notice. The latter has a diff link, but the former does not. $1 is the page -- type, which is either cfg['sandbox-notice-pagetype-template'], -- cfg['sandbox-notice-pagetype-module'] or cfg['sandbox-notice-pagetype-other'] depending what -- namespace we are in. $2 is a link to the main template page, and $3 is a diff link between -- the sandbox and the main template. The display value of the diff link is set by -- cfg['sandbox-notice-compare-link-display']. -- cfg['sandbox-notice-blurb'] = 'This is the $1 for $2.' cfg['sandbox-notice-diff-blurb'] = 'This is the $1 for $2 ($3).' cfg['sandbox-notice-compare-link-display'] = 'diff' -- -- cfg['sandbox-notice-testcases-blurb'] -- cfg['sandbox-notice-testcases-link-display'] -- cfg['sandbox-notice-testcases-run-blurb'] -- cfg['sandbox-notice-testcases-run-link-display'] -- cfg['sandbox-notice-testcases-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit. $1 is a link to the test cases page. -- cfg['sandbox-notice-testcases-link-display'] is the display value for that link. -- cfg['sandbox-notice-testcases-run-blurb'] is a sentence notifying the user that there is a test cases page -- corresponding to this sandbox that they can edit, along with a link to run it. $1 is a link to the test -- cases page, and $2 is a link to the page to run it. -- cfg['sandbox-notice-testcases-run-link-display'] is the display value for the link to run the test -- cases. -- cfg['sandbox-notice-testcases-blurb'] = 'See also the companion subpage for $1.' cfg['sandbox-notice-testcases-link-display'] = 'test cases' cfg['sandbox-notice-testcases-run-blurb'] = 'See also the companion subpage for $1 ($2).' cfg['sandbox-notice-testcases-run-link-display'] = 'run' -- cfg['sandbox-category'] -- A category to add to all template sandboxes. cfg['sandbox-category'] = 'Template sandboxes' -- Start box configuration  -- cfg['documentation-icon-wikitext'] -- The wikitext for the icon shown at the top of the template. cfg['documentation-icon-wikitext'] = '' -- cfg['template-namespace-heading'] -- The heading shown in the template namespace. cfg['template-namespace-heading'] = 'Template documentation' -- cfg['module-namespace-heading'] -- The heading shown in the module namespace. cfg['module-namespace-heading'] = 'Module documentation' -- cfg['file-namespace-heading'] -- The heading shown in the file namespace. cfg['file-namespace-heading'] = 'Summary' -- cfg['other-namespaces-heading'] -- The heading shown in other namespaces. cfg['other-namespaces-heading'] = 'Documentation' -- cfg['view-link-display'] -- The text to display for "view" links. cfg['view-link-display'] = 'view' -- cfg['edit-link-display'] -- The text to display for "edit" links. cfg['edit-link-display'] = 'edit' -- cfg['history-link-display'] -- The text to display for "history" links. cfg['history-link-display'] = 'history' -- cfg['purge-link-display'] -- The text to display for "purge" links. cfg['purge-link-display'] = 'purge' -- cfg['create-link-display'] -- The text to display for "create" links. cfg['create-link-display'] = 'create' -- Link box (end box) configuration  -- cfg['transcluded-from-blurb'] -- Notice displayed when the docs are transcluded from another page. $1 is a wikilink to that page. cfg['transcluded-from-blurb'] = 'The above documentation is transcluded from $1.' -- -- cfg['create-module-doc-blurb'] -- Notice displayed in the module namespace when the documentation subpage does not exist. -- $1 is a link to create the documentation page with the preload cfg['module-preload'] and the -- display cfg['create-link-display']. -- cfg['create-module-doc-blurb'] = 'You might want to $1 a documentation page for this Scribunto module.' -- Experiment blurb configuration  --[[ -- cfg['experiment-blurb-template'] -- cfg['experiment-blurb-module'] -- The experiment blurb is the text inviting editors to experiment in sandbox and test cases pages. -- It is only shown in the template and module namespaces. With the default English settings, it -- might look like this: -- -- Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages. -- -- In this example, "sandbox", "edit", "diff", "testcases", and "edit" would all be links. -- -- There are two versions, cfg['experiment-blurb-template'] and cfg['experiment-blurb-module'], depending -- on what namespace we are in. -- -- Parameters: -- -- $1 is a link to the sandbox page. If the sandbox exists, it is in the following format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-edit-link-display'] | cfg['compare-link-display']) -- -- If the sandbox doesn't exist, it is in the format: -- -- cfg['sandbox-link-display'] (cfg['sandbox-create-link-display'] | cfg['mirror-link-display']) -- -- The link for cfg['sandbox-create-link-display'] link preloads the page with cfg['template-sandbox-preload'] -- or cfg['module-sandbox-preload'], depending on the current namespace. The link for cfg['mirror-link-display'] -- loads a default edit summary of cfg['mirror-edit-summary']. -- -- $2 is a link to the test cases page. If the test cases page exists, it is in the following format: -- -- cfg['testcases-link-display'] (cfg['testcases-edit-link-display']) -- -- If the test cases page doesn't exist, it is in the format: -- -- cfg['testcases-link-display'] (cfg['testcases-create-link-display']) -- -- If the test cases page doesn't exist, the link for cfg['testcases-create-link-display'] preloads the -- page with cfg['template-testcases-preload'] or cfg['module-testcases-preload'], depending on the current -- namespace. --]] cfg['experiment-blurb-template'] = "Editors can experiment in this template's $1 and $2 pages." cfg['experiment-blurb-module'] = "Editors can experiment in this module's $1 and $2 pages." -- Sandbox link configuration -- cfg['sandbox-subpage'] -- The name of the template subpage typically used for sandboxes. cfg['sandbox-subpage'] = 'sandbox' -- cfg['template-sandbox-preload'] -- Preload file for template sandbox pages. cfg['template-sandbox-preload'] = 'Template:Documentation/preload-sandbox' -- cfg['module-sandbox-preload'] -- Preload file for Lua module sandbox pages. cfg['module-sandbox-preload'] = 'Template:Documentation/preload-module-sandbox' -- cfg['sandbox-link-display'] -- The text to display for "sandbox" links. cfg['sandbox-link-display'] = 'sandbox' -- cfg['sandbox-edit-link-display'] -- The text to display for sandbox "edit" links. cfg['sandbox-edit-link-display'] = 'edit' -- cfg['sandbox-create-link-display'] -- The text to display for sandbox "create" links. cfg['sandbox-create-link-display'] = 'create' -- cfg['compare-link-display'] -- The text to display for "compare" links. cfg['compare-link-display'] = 'diff' -- cfg['mirror-edit-summary'] -- The default edit summary to use when a user clicks the "mirror" link. $1 is a wikilink to the -- template page. cfg['mirror-edit-summary'] = 'Create sandbox version of $1' -- cfg['mirror-link-display'] -- The text to display for "mirror" links. cfg['mirror-link-display'] = 'mirror' -- Test cases link configuration  -- cfg['testcases-subpage'] -- The name of the template subpage typically used for test cases. cfg['testcases-subpage'] = 'testcases' -- cfg['template-testcases-preload'] -- Preload file for template test cases pages. cfg['template-testcases-preload'] = 'Template:Documentation/preload-testcases' -- cfg['module-testcases-preload'] -- Preload file for Lua module test cases pages. cfg['module-testcases-preload'] = 'Template:Documentation/preload-module-testcases' -- cfg['testcases-link-display'] -- The text to display for "testcases" links. cfg['testcases-link-display'] = 'testcases' -- cfg['testcases-edit-link-display'] -- The text to display for test cases "edit" links. cfg['testcases-edit-link-display'] = 'edit' -- cfg['testcases-create-link-display'] -- The text to display for test cases "create" links. cfg['testcases-create-link-display'] = 'create' -- Add categories blurb configuration  -- -- cfg['add-categories-blurb'] -- Text to direct users to add categories to the /doc subpage. Not used if the "content" or -- "docname fed" arguments are set, as then it is not clear where to add the categories. $1 is a -- link to the /doc subpage with a display value of cfg['doc-link-display']. -- cfg['add-categories-blurb'] = 'Please add categories to the $1 subpage.' -- cfg['doc-link-display'] -- The text to display when linking to the /doc subpage. cfg['doc-link-display'] = '/doc' -- Subpages link configuration  -- -- cfg['subpages-blurb'] -- The "Subpages of this template" blurb. $1 is a link to the main template's subpages with a -- display value of cfg['subpages-link-display']. In the English version this blurb is simply -- the link followed by a period, and the link display provides the actual text. -- cfg['subpages-blurb'] = '$1.' -- -- cfg['subpages-link-display'] -- The text to display for the "subpages of this page" link. $1 is cfg['template-pagetype'], -- cfg['module-pagetype'] or cfg['default-pagetype'], depending on whether the current page is in -- the template namespace, the module namespace, or another namespace. -- cfg['subpages-link-display'] = 'Subpages of this $1' -- cfg['template-pagetype'] -- The pagetype to display for template pages. cfg['template-pagetype'] = 'template' -- cfg['module-pagetype'] -- The pagetype to display for Lua module pages. cfg['module-pagetype'] = 'module' -- cfg['default-pagetype'] -- The pagetype to display for pages other than templates or Lua modules. cfg['default-pagetype'] = 'page' -- Doc link configuration  -- cfg['doc-subpage'] -- The name of the subpage typically used for documentation pages. cfg['doc-subpage'] = 'doc' -- cfg['file-docpage-preload'] -- Preload file for documentation page in the file namespace. cfg['file-docpage-preload'] = 'Template:Documentation/preload-filespace' -- cfg['docpage-preload'] -- Preload file for template documentation pages in all namespaces. cfg['docpage-preload'] = 'Template:Documentation/preload' -- cfg['module-preload'] -- Preload file for Lua module documentation pages. cfg['module-preload'] = 'Template:Documentation/preload-module-doc' -- Print version configuration  -- cfg['print-subpage'] -- The name of the template subpage used for print versions. cfg['print-subpage'] = 'Print' -- cfg['print-link-display'] -- The text to display when linking to the /Print subpage. cfg['print-link-display'] = '/Print' -- cfg['print-blurb'] -- Text to display if a /Print subpage exists. $1 is a link to the subpage with a display value of cfg['print-link-display']. cfg['print-blurb'] = 'A print version of this template exists at $1.' .. ' If you make a change to this template, please update the print version as well.' -- cfg['display-print-category'] -- Set to true to enable output of cfg['print-category'] if a /Print subpage exists. -- This should be a boolean value (either true or false). cfg['display-print-category'] = true -- cfg['print-category'] -- Category to output if cfg['display-print-category'] is set to true, and a /Print subpage exists. cfg['print-category'] = 'Templates with print versions' -- HTML and CSS configuration  -- cfg['main-div-id'] -- The "id" attribute of the main HTML "div" tag. cfg['main-div-id'] = 'template-documentation' -- cfg['main-div-classes'] -- The CSS classes added to the main HTML "div" tag. cfg['main-div-classes'] = 'template-documentation iezoomfix' -- cfg['start-box-linkclasses'] -- The CSS classes used for the [view][edit][history] or [create] links in the start box. cfg['start-box-linkclasses'] = 'mw-editsection-like plainlinks' -- cfg['start-box-link-id'] -- The HTML "id" attribute for the links in the start box. cfg['start-box-link-id'] = 'doc_editlinks' --  template configuration  -- cfg['fmbox-id'] -- The id sent to the "id" parameter of the  template. cfg['fmbox-id'] = 'documentation-meta-data' -- cfg['fmbox-style'] -- The value sent to the style parameter of. cfg['fmbox-style'] = 'background-color: #ecfcf4' -- cfg['fmbox-textstyle'] -- The value sent to the "textstyle parameter of . cfg['fmbox-textstyle'] = 'font-style: italic' -- Tracking category configuration  -- cfg['display-strange-usage-category'] -- Set to true to enable output of cfg['strange-usage-category'] if the module is used on a /doc subpage -- or a /testcases subpage. This should be a boolean value (either true or false). cfg['display-strange-usage-category'] = true -- cfg['strange-usage-category'] -- Category to output if cfg['display-strange-usage-category'] is set to true and the module is used on a -- /doc subpage or a /testcases subpage. cfg['strange-usage-category'] = 'Wikipedia pages with strange ((documentation)) usage' --  -- End configuration -- -- Don't edit anything below this line.  -- return cfg

5ji8xq555zsax7grq5tkt5xioninrsd

-

Module:Effective protection level

<ns>828</ns>

<id>41617327</id>

-

<id>641310538</id>

639072983

2015-01-06T22:18:44Z

-

Jackmcbarn

<id>19285809</id>

Accountcreators can't override the titleblacklist anymore

Scribunto

text/plain

<text bytes="2829" xml:space="preserve">local p = {} -- Returns the permission required to perform a given action on a given title. -- If no title is specified, the title of the page being displayed is used. function p._main(action, pagename) local title if type(pagename) == 'table' and pagename.prefixedText then title = pagename elseif pagename then title = mw.title.new(pagename) else title = mw.title.getCurrentTitle end pagename = title.prefixedText if action == 'autoreview' then local level = mw.getCurrentFrame:callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= '' then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 ) end if title.namespace == 8 then -- MediaWiki namespace return 'sysop' elseif title.namespace == 2 and title.isSubpage and ( title.contentModel == 'javascript' or title.contentModel == 'css' ) then -- user JS or CSS page return 'sysop' end local level = title.protectionLevels[action] and title.protectionLevels[action][1] if level == 'sysop' or level == 'editprotected' then return 'sysop' elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page return 'sysop' elseif level == 'templateeditor' then return 'templateeditor' elseif action == 'move' then local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. if blacklistentry and not blacklistentry.params.autoconfirmed then return 'templateeditor' elseif title.namespace == 6 then return 'filemover' else return 'autoconfirmed' end end local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename) if blacklistentry then return blacklistentry.params.autoconfirmed and 'autoconfirmed' or 'templateeditor' elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason return 'autoconfirmed' elseif level then return level elseif action == 'upload' then return 'autoconfirmed' elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts return 'user' else return '*' end end setmetatable(p, { __index = function(t, k) return function(frame) return t._main(k, frame.args[1]) end end }) return p

62ke3jtyvqo1ao12by30imlmbffjw8f

-

Module:File link

<ns>828</ns>

<id>42903140</id>

-

<id>638642222</id>

638639021

2014-12-18T14:05:07Z

-

Mr. Stradivarius

<id>4708675</id>

when calling this from wikitext use a more readable error message for missing file parameters

Scribunto

text/plain

<text bytes="2544" xml:space="preserve">-- This module provides a library for formatting file wikilinks. local yesno = require('Module:Yesno') local checkType = require('libraryUtil').checkType local p = {} function p._main(args) checkType('_main', 1, args, 'table') -- This is basically libraryUtil.checkTypeForNamedArg, but we are rolling our -- own function to get the right error level. local function checkArg(key, val, level) if type(val) ~= 'string' then error(string.format( "type error in '%s' parameter of '_main' (expected string, got %s)", key, type(val) ), level) end end local ret = {} -- Adds a positional parameter to the buffer. local function addPositional(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = val end -- Adds a named parameter to the buffer. We assume that the parameter name -- is the same as the argument key. local function addNamed(key) local val = args[key] if not val then return nil end checkArg(key, val, 4) ret[#ret + 1] = key .. '=' .. val end -- Filename checkArg('file', args.file, 3) ret[#ret + 1] = 'File:' .. args.file -- Format if args.format then checkArg('format', args.format) if args.formatfile then checkArg('formatfile', args.formatfile) ret[#ret + 1] = args.format .. '=' .. args.formatfile else ret[#ret + 1] = args.format end end -- Border if yesno(args.border) then ret[#ret + 1] = 'border' end addPositional('location') addPositional('alignment') addPositional('size') addNamed('upright') addNamed('link') addNamed('alt') addNamed('page') addNamed('class') addNamed('lang') addNamed('start') addNamed('end') addNamed('thumbtime') addPositional('caption') return string.format('%s', table.concat(ret, '|')) end function p.main(frame) local origArgs = require('Module:Arguments').getArgs(frame, { wrappers = 'Template:File link' }) if not origArgs.file then error("'file' parameter missing from Template:File link", 0) end -- Copy the arguments that were passed to a new table to avoid looking up -- every possible parameter in the frame object. local args = {} for k, v in pairs(origArgs) do -- Make _BLANK a special argument to add a blank parameter. For use in -- conditional templates etc. it is useful for blank arguments to be -- ignored, but we still need a way to specify them so that we can do -- things like. if v == '_BLANK' then v = '' end args[k] = v end return p._main(args) end return p

bzc22v133v9z5yc4aisazripn6l94p8

-

Module:Jct

<ns>828</ns>

<id>41870645</id>

-

<id>631657140</id>

631546327

2014-10-29T20:24:41Z

-

Fredddie

<id>221304</id>

add ON

Scribunto

text/plain

<text bytes="11168" xml:space="preserve">local p = {} local concat = table.concat local insert = table.insert local getArgs = require('Module:Arguments').getArgs -- Import module function to work with passed arguments local parserModule = require "Module:Road data/parser" local parser = parserModule.parser -- Shields local rdt local function size(args) local state = args.state or args.province or  local type = args.type if rdt then return 'x17' elseif state == 'FL' then if type == 'Toll' or type == 'FLTP' or type == 'HEFT' then return '20' elseif type == 'Both' then return '20', 'x20' end elseif state == 'NY' then if type == 'NY 1927' or type == 'NY 1948' or (type == 'Parkway' and args.route == "Robert Moses") or (type == 'CR' and args.county == 'Erie') then return '20' end elseif state == 'AB' then if type == 'AB' or type == 'Hwy' or type == '2ndHwy' or type == 'TCH' then return '18' end elseif state == 'NS' and type == 'Hwy' or type == 'TCH' then return '18' elseif state == 'ON' then if type == 'ON' or type == 'Hwy' or type == 'Highway' or type == 'QEW' then return '24x22' elseif type == 'KLR' then return '21' else local countyTypes = {CH = true, RH = true, District = true, Regional = true, County = true, Municipal = true} if countyTypes[type] then return '19' end end elseif state == 'QC' then if type == 'QC' or type == 'Route' or type == 'A' or type == 'Autoroute' or type == 'TCH' or type == 'ON' then return '18' end elseif state == 'SK' then if type == 'Hwy' or type == 'SK' then return 'x25' end end return 'x20' end local function shield(args, frame) if args.noshield then return  end local firstSize, secondSize = size(args) local shield, second = parser(args, 'shield') if not shield or shield ==  then return  end local function render(shield, size) if frame:callParserFunction('#ifexist', 'Media:' .. shield, '1') ~=  then return string.format("", shield, size) else args.shielderr = true local page = mw.title.getCurrentTitle.prefixedText -- Get transcluding page's title return mw.ustring.format("", page) end end local rendered = render(shield, firstSize) if second then local size = secondSize or firstSize rendered = rendered .. render(second, size) end return rendered end -- Links/abbreviations local function link(args) local nolink = args.nolink local abbr = parser(args, 'abbr') if nolink then return abbr else local link = parser(args, 'link') if not link or link ==  then return abbr else return mw.ustring.format("<span class=\"nowrap\">%s ", link, abbr) end end end local function completeLink(args, num) local actualLink = link(args) if not actualLink then local page = mw.title.getCurrentTitle.prefixedText -- Get transcluding page's title actualLink = string.format("<span class=\"error\">Invalid type: %s ", args.type, page) end local isTo = args.to local prefix if num == 1 then if isTo then prefix = "To " else prefix = '' end else if isTo then prefix = " to " else prefix = " / " end end local suffix = {} local dir = args.dir if dir then insert(suffix, ' ' .. string.lower(dir)) end local name = args.name if name then insert(suffix, mw.ustring.format(' (%s)', name)) end return prefix .. actualLink .. concat(suffix) end local function namedLink(args, num) local actualLink = link(args) local name = args.name or  local isTo = args.to local prefix if num == 1 then if isTo then prefix = "To " else prefix =  end else if isTo then prefix = " to " else prefix = " / " end end local suffix = {} local dir = args.dir if name ~= '' then if dir then insert(suffix, mw.ustring.format(' (%s %s)', actualLink, dir)) else insert(suffix, mw.ustring.format(' (%s)', actualLink)) end else insert(suffix, actualLink) if dir then insert(suffix, ' ' .. string.lower(dir)) end end return prefix .. name .. concat(suffix) end local function banners(routes) local format = string.format local firstRun = {} local hasBanner = false for k,v in ipairs(routes) do local banner if v.shield ==  or v.shielderr then banner = false else banner = parser(v, 'banner') or  if banner and banner ~=  then hasBanner = true end end insert(firstRun, banner) end if not hasBanner then return  end local secondRun = {} for k,v in ipairs(routes) do local bannerFile = firstRun[k] if not bannerFile then elseif bannerFile == '' then local widthCode = parser(v, 'width') or 'square' if type(widthCode) == 'number' then insert(secondRun, "") elseif widthCode == 'square' then insert(secondRun, "") elseif widthCode == 'expand' then local route = v.route local width = (#route >= 3) and '25' or '20' insert(secondRun, format("", width)) elseif widthCode == 'wide' then insert(secondRun, "") elseif widthCode == 'US1926' then insert(secondRun, "") elseif widthCode == 'SD' then local route = v.route local width = (#route >= 3) and '23' or '20' insert(secondRun, format("", width)) elseif (v.state == 'CA') or (v.type == 'CA') then local route = v.route local widths = {default = {'20', '25'}, I = {'20', '24'}, US = {'20', '23'}, SR = {'19', '22'}} local width = widths[widthCode] or widths.default local pixels = (#route >= 3) and width[2] or width[1] insert(secondRun, format("", pixels)) end else local widthCode = parser(v, 'width') or 'square' if widthCode == 'square' then insert(secondRun, format("", bannerFile)) elseif widthCode == 'expand' then local route = v.route if #route >= 3 then insert(secondRun, format("", bannerFile)) else insert(secondRun, format("", bannerFile)) end elseif widthCode == 'wide' then insert(secondRun, format("", bannerFile)) elseif widthCode == 'SD' then local route = v.route if #route >= 3 then insert(secondRun, format("", bannerFile)) else insert(secondRun, format("", bannerFile)) end elseif widthCode == 'MOSupp' then local route = v.route if #route >= 2 then insert(secondRun, format("", bannerFile)) else insert(secondRun, format("", bannerFile)) end elseif widthCode == 'US1926' then insert(secondRun, format("", bannerFile)) elseif v.state == 'CA' then local route = v.route local type = v.type if type == 'US-Bus' then if #route >= 3 then insert(secondRun, format("", bannerFile)) else insert(secondRun, format("", bannerFile)) end elseif type == 'CA-Bus' or type == 'SR-Bus' then if #route >= 3 then insert(secondRun, format("", bannerFile)) else insert(secondRun, format("", bannerFile)) end end end end end return concat(secondRun) .. ' ' end local function extra(args) local extraTypes = {rail = "", ["light-rail"] = "", bus = "", ferry = "", hospital = {default = "", AUS = ""}, airport = {default = "", AUS = "", GBR = "", TWN = ""}} local extraIcon = extraTypes[string.lower(args.extra or )] if not extraIcon then return  elseif type(extraIcon) == 'table' then return extraIcon[args.country] or extraIcon.default else return extraIcon end end local function parseArgs(args) local state = args.state or args.province local country if args.country then country = string.upper(args.country) else local countryModule = mw.loadData("Module:Road data/countrymask") country = countryModule[state] or 'UNK' args.country = country end local params = {'denom', 'county', 'township', 'dab', 'nolink', 'noshield', 'to', 'dir', 'name'} local routeArgs = {} local routeCount = 1 while true do local routeType = args[routeCount * 2 - 1] if not routeType then break end local route = {type = routeType, route = args[routeCount * 2]} for _,v in pairs(params) do route[v] = args[v .. routeCount] end route.country = country route.state = state insert(routeArgs, route) routeCount = routeCount + 1 end return routeArgs end function p._jct(args, frame) rdt = args.rdt local routes = parseArgs(args) local extra = extra(args) local shields = {} local links = {} frame = frame or mw.getCurrentFrame for num,route in ipairs(routes) do local routeShield = shield(route, frame) insert(shields, routeShield) route.shield = routeShield if args.jctname then insert(links, namedLink(route, num)) else insert(links, completeLink(route, num)) end end local bannerText = banners(routes) local shieldText = concat(shields) local linkText = concat(links) local graphics = (not(args.noshield) and (bannerText .. shieldText) or '') .. extra .. ' ' local cities =  if args.city1 or args.location1 then local cityModule = require "Module:Jct/city" cities = cityModule.city(args) end local roadStr =  local road = args.road if road then if args.toroad then roadStr = ' to ' .. road else roadStr = ' / ' .. road end end local output = graphics .. linkText .. roadStr .. cities return mw.text.trim(output) end function p.jct(frame) local args = getArgs(frame) return p._jct(args, frame) end return p

76qfxlu4jjsb4fnrtramnw5j7auykqd

-

Module:Jct/city

<ns>828</ns>

<id>40781457</id>

-

<id>615398553</id>

611617345

2014-07-03T07:53:03Z

-

Happy5214

<id>3653754</id>

July update: Use local variables for table.concat and table.insert; rename table for AUS state abbreviations; use reformatted data module for state names

Scribunto

text/plain

<text bytes="1390" xml:space="preserve">local p = {} local concat = table.concat local insert = table.insert local state local function stateName(args) local AUSabbrs = {NT = "Northern Territory", WA = "Western Australia"} local data = mw.loadData("Module:Jct/statename") local abbr = args.state or args.province local country = args.country if country == 'AUS' then return AUSabbrs[abbr] or data[abbr] else return data[abbr] end end local function location(args, num) local city = args["city" .. num] local location = args["location" .. num] local areadab = args["areadab" .. num] local countydab = args["countydab" .. num] if not(city or location) then return  end local parts if num == 1 then parts = {" – "} else parts = {", "} end if location then insert(parts, location) return concat(parts) end insert(parts, "" .. city .. "") return concat(parts) end function p.city(args) state = stateName(args) local cities = {} local locationCount = 1 repeat local location = location(args, locationCount) insert(cities, location) local empty = (location == ) locationCount = locationCount + 1 until empty return concat(cities) end return p

13nbmcopdolkln1mpvtpi50te33o4ot

-

Module:Jct/statename

<ns>828</ns>

<id>40780041</id>

-

<id>615396833</id>

613540524

2014-07-03T07:26:20Z

-

Happy5214

<id>3653754</id>

Exporting data directly

Scribunto

text/plain

<text bytes="2651" xml:space="preserve">local p = {AL = "Alabama", AK = "Alaska", AZ = "Arizona", AR = "Arkansas", CA = "California", CO = "Colorado", CT = "Connecticut", DE = "Delaware", DC = "District of Columbia", FL = "Florida", GA = "Georgia", HI = "Hawaii", ID = "Idaho", IL = "Illinois", IN = "Indiana", IA = "Iowa", KS = "Kansas", KY = "Kentucky", LA = "Louisiana", ME = "Maine", MD = "Maryland", MA = "Massachusetts", MI = "Michigan", MN = "Minnesota", MS = "Mississippi", MO = "Missouri", MT = "Montana", NE = "Nebraska", NV = "Nevada", NH = "New Hampshire", NJ = "New Jersey", NM = "New Mexico", NY = "New York", NC = "North Carolina", ND = "North Dakota", OH = "Ohio", OK = "Oklahoma", OR = "Oregon", PA = "Pennsylvania", RI = "Rhode Island", SC = "South Carolina", SD = "South Dakota", TN = "Tennessee", TX = "Texas", UT = "Utah", VT = "Vermont", VA = "Virginia", WA = "Washington", WV = "West Virginia", WI = "Wisconsin", WY = "Wyoming", PR = "Puerto Rico", VI = "U.S. Virgin Islands", AB = "Alberta", BC = "British Columbia", MB = "Manitoba", NB = "New Brunswick", NL = "Newfoundland and Labrador", NS = "Nova Scotia", NT = "Northwest Territories", NU = "Nunavut", ON = "Ontario", PE = "Prince Edward Island", QC = "Quebec", SK = "Saskatchewan", YT = "Yukon", AS = "American Samoa", GU = "Guam", MP = "Northern Marianas", ACT = "Australian Capital Territory", NSW = "New South Wales", QLD = "Queensland", SA = "South Australia", TAS = "Tasmania", VIC = "Victoria", fr = "France", de = "Germany", gb = "United Kingdom", es = "Spain", ie = "Ireland", it = "Italy", se = "Sweden", no = "Norway", fi = "Finland", dk = "Denmark", nl = "Netherlands", be = "Belgium", lu = "Luxembourg", pt = "Portugal", } return p

mog5mr8b9ud6yx67nt6dmwn97zupfr0

-

Module:List

<ns>828</ns>

<id>41068627</id>

-

<id>612610900</id>

612489459

2014-06-12T09:21:46Z

-

Mr. Stradivarius

<id>4708675</id>

remove li_style, ul_style and ol_style parameters, allow itemn_style and itemn_value parameters, and add a tracking category for item_stylen and item_valuen parameters

Scribunto

text/plain

<text bytes="5138" xml:space="preserve">-- This module outputs different kinds of lists. At the moment, bulleted, -- unbulleted, horizontal, ordered, and horizontal ordered lists are supported. local libUtil = require('libraryUtil') local checkType = libUtil.checkType local mTableTools = require('Module:TableTools') local p = {} local listTypes = { ['bulleted'] = true, ['unbulleted'] = true, ['horizontal'] = true, ['ordered'] = true, ['horizontal_ordered'] = true } function p.makeListData(listType, args) -- Constructs a data table to be passed to p.renderList. local data = {} -- Classes data.classes = {} if listType == 'horizontal' or listType == 'horizontal_ordered' then table.insert(data.classes, 'hlist') elseif listType == 'unbulleted' then table.insert(data.classes, 'plainlist') end table.insert(data.classes, args.class) -- Main div style data.style = args.style -- Indent for horizontal lists if listType == 'horizontal' or listType == 'horizontal_ordered' then local indent = tonumber(args.indent) indent = indent and indent * 1.6 or 0 if indent > 0 then data.marginLeft = indent .. 'em' end end -- List style types for ordered lists -- This could be "1, 2, 3", "a, b, c", or a number of others. The list style -- type is either set by the "type" attribute or the "list-style-type" CSS -- property. if listType == 'ordered' or listType == 'horizontal_ordered' then data.listStyleType = args.list_style_type or args['list-style-type'] data.type = args['type'] -- Detect invalid type attributes and attempt to convert them to -- list-style-type CSS properties. if data.type and not data.listStyleType and not tostring(data.type):find('^%s*[1AaIi]%s*$') then data.listStyleType = data.type data.type = nil end end -- List tag type if listType == 'ordered' or listType == 'horizontal_ordered' then data.listTag = 'ol' else data.listTag = 'ul' end -- Start number for ordered lists data.start = args.start if listType == 'horizontal_ordered' then -- Apply fix to get start numbers working with horizontal ordered lists. local startNum = tonumber(data.start) if startNum then data.counterReset = 'listitem ' .. tostring(startNum - 1) end end -- List style -- ul_style and ol_style are included for backwards compatibility. No -- distinction is made for ordered or unordered lists. data.listStyle = args.list_style -- List items -- li_style is included for backwards compatibility. item_style was included -- to be easier to understand for non-coders. data.itemStyle = args.item_style or args.li_style data.items = {} for i, num in ipairs(mTableTools.numKeys(args)) do local item = {} item.content = args[num] item.style = args['item' .. tostring(num) .. '_style'] or args['item_style' .. tostring(num)] item.value = args['item' .. tostring(num) .. '_value'] or args['item_value' .. tostring(num)] table.insert(data.items, item) end return data end function p.renderList(data) -- Renders the list HTML. -- Return the blank string if there are no list items. if type(data.items) ~= 'table' or #data.items < 1 then return '' end -- Render the main div tag. local root = mw.html.create('div') for i, class in ipairs(data.classes or {}) do root:addClass(class) end root:css{['margin-left'] = data.marginLeft} if data.style then root:cssText(data.style) end -- Render the list tag. local list = root:tag(data.listTag or 'ul') list :attr{start = data.start, type = data.type} :css{ ['counter-reset'] = data.counterReset, ['list-style-type'] = data.listStyleType } if data.listStyle then list:cssText(data.listStyle) end -- Render the list items for i, t in ipairs(data.items or {}) do local item = list:tag('li') if data.itemStyle then item:cssText(data.itemStyle) end if t.style then item:cssText(t.style) end item :attr{value = t.value} :wikitext(t.content) end return tostring(root) end function p.renderTrackingCategories(args) local isDeprecated = false -- Tracks deprecated parameters. for k, v in pairs(args) do k = tostring(k) if k:find('^item_style%d+$') or k:find('^item_value%d+$') then isDeprecated = true break end end local ret = '' if isDeprecated then ret = ret .. '' end return ret end function p.makeList(listType, args) if not listType or not listTypes[listType] then error(string.format( "bad argument #1 to 'makeList' ('%s' is not a valid list type)", tostring(listType) ), 2) end checkType('makeList', 2, args, 'table') local data = p.makeListData(listType, args) local list = p.renderList(data) local trackingCategories = p.renderTrackingCategories(args) return list .. trackingCategories end for listType in pairs(listTypes) do p[listType] = function (frame) local mArguments = require('Module:Arguments') local origArgs = mArguments.getArgs(frame) -- Copy all the arguments to a new table, for faster indexing. local args = {} for k, v in pairs(origArgs) do args[k] = v end return p.makeList(listType, args) end end return p

gys728jf7k7k0tacxur7d4u3ykwd6zh

-

Module:Lua banner

<ns>828</ns>

<id>42951651</id>

-

<id>611366942</id>

611345357

2014-06-03T11:28:49Z

-

Mr. Stradivarius

<id>4708675</id>

p.renderTrackingCategories fix - titleObj is already local

Scribunto

text/plain

<text bytes="2421" xml:space="preserve">-- This module implements the template. local yesno = require('Module:Yesno') local mList = require('Module:List') local mTableTools = require('Module:TableTools') local mMessageBox = require('Module:Message box') local p = {} function p.main(frame) local origArgs = frame:getParent.args local args = {} for k, v in pairs(origArgs) do v = v:match('^%s*(.-)%s*$') if v ~= '' then args[k] = v end end return p._main(args) end function p._main(args) local modules = mTableTools.compressSparseArray(args) local box = p.renderBox(modules) local trackingCategories = p.renderTrackingCategories(args, modules) return box .. trackingCategories end function p.renderBox(modules) local boxArgs = {} if #modules < 1 then boxArgs.text = ' Error: no modules specified ' else local moduleLinks = {} for i, module in ipairs(modules) do moduleLinks[i] = string.format('%s', module) end local moduleList = mList.makeList('bulleted', moduleLinks) boxArgs.text = 'Uses Lua:\n' .. moduleList end boxArgs.type = 'notice' boxArgs.small = true boxArgs.image =  return mMessageBox.main('mbox', boxArgs) end function p.renderTrackingCategories(args, modules, titleObj) if yesno(args.nocat) then return  end local cats = {} -- Error category if #modules < 1 then cats[#cats + 1] = 'Lua templates with errors' end -- Lua templates category titleObj = titleObj or mw.title.getCurrentTitle local subpageBlacklist = { doc = true, sandbox = true, sandbox2 = true, testcases = true } if titleObj.namespace == 10 and not subpageBlacklist[titleObj.subpageText] then local category = args.category if not category then local categories = { ['Module:String'] = 'Lua String-based templates', ['Module:Math'] = 'Templates based on the Math Lua module', ['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module', ['Module:Citation'] = 'Lua-based citation templates' } categories['Module:Citation/CS1'] = categories['Module:Citation'] category = modules[1] and categories[modules[1]] category = category or 'Lua-based templates' end cats[#cats + 1] = category end for i, cat in ipairs(cats) do cats[i] = string.format('', cat) end return table.concat(cats) end return p

l8oeyvtrxsbtfip6xi5evqh3yk40lu5

-

Module:Message box

<ns>828</ns>

<id>40574910</id>

-

<id>635919593</id>

603256010

2014-11-29T17:56:21Z

-

Jackmcbarn

<id>19285809</id>

bring in changes from sandbox

Scribunto

text/plain

<text bytes="16506" xml:space="preserve">-- This is a meta-module for producing message box templates, including --, , , , , and. -- Load necessary modules. require('Module:No globals') local getArgs local categoryHandler = require('Module:Category handler')._main local yesno = require('Module:Yesno') -- Get a language object for formatDate and ucfirst. local lang = mw.language.getContentLanguage -- Helper functions  local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end -- Box class definition  local MessageBox = {} MessageBox.__index = MessageBox function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {} -- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle -- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end -- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= '' then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end -- Define internal data structure. obj.categories = {} obj.classes = {} return setmetatable(obj, MessageBox) end function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format(, cat, sort) else cat = string.format(, cat) end self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end function MessageBox:setParameters local args = self.args local cfg = self.cfg -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image -- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST' -- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) ) -- Add attributes, classes and styles. if cfg.allowId then self.id = args.id end self:addClass( cfg.usePlainlinksParam and yesno(args.plainlinks or true) and 'plainlinks' ) for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs -- Set text style. self.textstyle = args.textstyle -- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then self.name = args.name if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end -- Process data for collapsible text fields. At the moment these are only -- used in. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == '' then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= '' and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end -- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk ==  and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk ==  then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s %s.', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the talk page.', talkText, talkTitle.prefixedText, talk ) end self.talk = talkText end end -- Get other values. self.fix = args.fix ~=  and args.fix or nil local date if args.date and args.date ~=  then date = args.date elseif args.date ==  and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" (%s)'' ", date) end self.info = args.info end -- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end -- Set the below row. self.below = cfg.below and args.below -- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell if cfg.imageEmptyCellStyle then self.imageEmptyCellStyle = 'border:none;padding:0px;width:1px' end -- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('', self.typeImage or 'Imbox notice.png', imageSize) end end -- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end end function MessageBox:setMainspaceCategories local args = self.args local cfg = self.cfg if not cfg.allowMainspaceCategories then return nil end local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end -- The following is roughly equivalent to the old. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~=  then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == ) then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end function MessageBox:setTemplateCategories local args = self.args local cfg = self.cfg -- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end -- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end function MessageBox:setAllNamespaceCategories -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end function MessageBox:setCategories if self.title.namespace == 0 then self:setMainspaceCategories elseif self.title.namespace == 10 then self:setTemplateCategories end self:setAllNamespaceCategories end function MessageBox:renderCategories -- Convert category tables to strings and pass them through -- Module:Category handler. return categoryHandler{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end function MessageBox:export local root = mw.html.create -- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template  has been incorrectly substituted.', mw.text.nowiki('') )) end -- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation') if self.attrs then boxTable:attr(self.attrs) end -- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):css('width', '52px') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') :cssText(self.imageEmptyCellStyle or nil) end -- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellSpan = textCell:tag('span') textCellSpan :addClass('mbox-text-span') :wikitext(self.issue or nil) if not self.isSmall then textCellSpan:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellSpan:wikitext(self.date and (' ' .. self.date) or nil) if not self.isSmall then textCellSpan :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end -- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):css('width', '52px') end imageRightCell :wikitext(self.imageRight or nil) end -- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end -- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :css('text-align', 'center') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or '' )) end -- Add categories. root:wikitext(self:renderCategories or nil) return tostring(root) end -- Exports  local p, mt = {}, {} function p._exportClasses -- For testing. return { MessageBox = MessageBox } end function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData('Module:Message box/configuration')) box:setParameters box:setCategories return box:export end function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end return setmetatable(p, mt)

8eno95s85119aay9jy5w6tl7a8yzlxx

-

Module:Message box/configuration

<ns>828</ns>

<id>40627038</id>

-

<id>635919831</id>

635432730

2014-11-29T17:58:41Z

-

Jackmcbarn

<id>19285809</id>

bring in changes from sandbox

Scribunto

text/plain

<text bytes="6132" xml:space="preserve"> -- Message box configuration -- -- -- -- This module contains configuration data for Module:Message box. -- return { ambox = { types = { speedy = { class = 'ambox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ambox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ambox-content', image = 'Ambox important.svg' }, style = { class = 'ambox-style', image = 'Edit-clear.svg' }, move = { class = 'ambox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ambox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ambox-notice', image = 'Information icon4.svg' } }, default = 'notice', allowBlankParams = {'talk', 'sect', 'date', 'issue', 'fix', 'subst', 'hidden'}, allowSmall = true, smallParam = 'left', smallClass = 'mbox-small-left', substCheck = true, classes = {'metadata', 'plainlinks', 'ambox'}, imageEmptyCell = true, imageCheckBlank = true, imageSmallSize = '20x20px', imageCellDiv = true, useCollapsibleTextFields = true, imageRightNone = true, sectionDefault = 'article', allowMainspaceCategories = true, templateCategory = 'Article message templates', templateCategoryRequireName = true, templateErrorCategory = 'Article message templates with missing parameters', templateErrorParamsToCheck = {'issue', 'fix', 'subst'} }, cmbox = { types = { speedy = { class = 'cmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'cmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'cmbox-content', image = 'Ambox important.svg' }, style = { class = 'cmbox-style', image = 'Edit-clear.svg' }, move = { class = 'cmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'cmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'cmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'cmbox'}, imageEmptyCell = true }, fmbox = { types = { warning = { class = 'fmbox-warning', image = 'Ambox warning pn.svg' }, editnotice = { class = 'fmbox-editnotice', image = 'Information icon4.svg' }, system = { class = 'fmbox-system', image = 'Information icon4.svg' } }, default = 'system', showInvalidTypeError = true, allowId = true, classes = {'plainlinks', 'fmbox'}, imageEmptyCell = false, imageRightNone = false }, imbox = { types = { speedy = { class = 'imbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'imbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'imbox-content', image = 'Ambox important.svg' }, style = { class = 'imbox-style', image = 'Edit-clear.svg' }, move = { class = 'imbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'imbox-protection', image = 'Padlock-silver-medium.svg' }, license = { class = 'imbox-license licensetpl', image = 'Imbox license.png' -- @todo We need an SVG version of this }, featured = { class = 'imbox-featured', image = 'Cscr-featured.svg' }, notice = { class = 'imbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'imbox'}, usePlainlinksParam = true, imageEmptyCell = true, below = true, templateCategory = 'File message boxes' }, ombox = { types = { speedy = { class = 'ombox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'ombox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'ombox-content', image = 'Ambox important.svg' }, style = { class = 'ombox-style', image = 'Edit-clear.svg' }, move = { class = 'ombox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'ombox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'ombox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'ombox'}, allowSmall = true, imageEmptyCell = true, imageRightNone = true }, tmbox = { types = { speedy = { class = 'tmbox-speedy', image = 'Ambox warning pn.svg' }, delete = { class = 'tmbox-delete', image = 'Ambox warning pn.svg' }, content = { class = 'tmbox-content', image = 'Ambox important.svg' }, style = { class = 'tmbox-style', image = 'Edit-clear.svg' }, move = { class = 'tmbox-move', image = 'Merge-split-transwiki default.svg' }, protection = { class = 'tmbox-protection', image = 'Padlock-silver-medium.svg' }, notice = { class = 'tmbox-notice', image = 'Information icon4.svg' } }, default = 'notice', showInvalidTypeError = true, classes = {'plainlinks', 'tmbox'}, allowId = true, allowSmall = true, imageRightNone = true, imageEmptyCell = true, imageEmptyCellStyle = true, templateCategory = 'Talk message boxes' } }

ap6rn0f8a21ktjv9ymkn8pylh7n42ci

-

Module:Namespace detect/config

<ns>828</ns>

<id>42256703</id>

-

<id>602886681</id>

602823531

2014-04-05T17:03:49Z

-

Mr. Stradivarius

<id>4708675</id>

use cfg.demopage rather than cfg.page now that the default parameter has been changed on the /data page

Scribunto

text/plain

<text bytes="3545" xml:space="preserve"> -- Namespace detect configuration data -- -- -- -- This module stores configuration data for Module:Namespace detect. Here -- -- you can localise the module to your wiki's language. -- -- -- -- To activate a configuration item, you need to uncomment it. This means -- -- that you need to remove the text "-- " at the start of the line. -- local cfg = {} -- Don't edit this line. -- Parameter names -- -- These configuration items specify custom parameter names. Values added -- -- here will work in addition to the default English parameter names. -- -- To add one extra name, you can use this format: -- -- -- -- cfg.foo = 'parameter name' -- -- -- -- To add multiple names, you can use this format: -- -- -- -- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --  This parameter displays content for the main namespace: -- cfg.main = 'main'  This parameter displays in talk namespaces: -- cfg.talk = 'talk'  This parameter displays content for "other" namespaces (namespaces for which  parameters have not been specified): -- cfg.other = 'other'  This parameter makes talk pages behave as though they are the corresponding  subject namespace. Note that this parameter is used with Module:Yesno. Edit that module to change the default values of "yes", "no", etc. -- cfg.subjectns = 'subjectns' This parameter sets a demonstration namespace: -- cfg.demospace = 'demospace'  This parameter sets a specific page to compare: cfg.demopage = 'page'  -- Table configuration -- -- These configuration items allow customisation of the "table" function, -- -- used to generate a table of possible parameters in the module -- -- documentation. --  The header for the namespace column in the wikitable containing the list of  possible subject-space parameters. -- cfg.wikitableNamespaceHeader = 'Namespace' The header for the wikitable containing the list of possible subject-space  parameters. -- cfg.wikitableAliasesHeader = 'Aliases' -- End of configuration data --  return cfg -- Don't edit this line.

1o6ozz56i8q0xgyl6xa41n2v7kelhli

-

Module:Namespace detect/data

<ns>828</ns>

<id>42257476</id>

-

<id>602886511</id>

602823622

2014-04-05T17:02:16Z

-

Mr. Stradivarius

<id>4708675</id>

bug fix - use the demospace parameter as both key and value in the argKeys table

Scribunto

text/plain

<text bytes="2569" xml:space="preserve"> -- Namespace detect data -- -- This module holds data for Module:Namespace detect to be loaded per -- -- page, rather than per #invoke, for performance reasons. -- local cfg = require('Module:Namespace detect/config') local function addKey(t, key, defaultKey) if key ~= defaultKey then t[#t + 1] = key end end -- Get a table of parameters to query for each default parameter name. -- This allows wikis to customise parameter names in the cfg table while -- ensuring that default parameter names will always work. The cfg table -- values can be added as a string, or as an array of strings. local defaultKeys = { 'main', 'talk', 'other', 'subjectns', 'demospace', 'demopage' } local argKeys = {} for i, defaultKey in ipairs(defaultKeys) do argKeys[defaultKey] = {defaultKey} end for defaultKey, t in pairs(argKeys) do local cfgValue = cfg[defaultKey] local cfgValueType = type(cfgValue) if cfgValueType == 'string' then addKey(t, cfgValue, defaultKey) elseif cfgValueType == 'table' then for i, key in ipairs(cfgValue) do addKey(t, key, defaultKey) end end cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more. end local function getParamMappings -- -- Returns a table of how parameter names map to namespace names. The keys -- are the actual namespace names, in lower case, and the values are the -- possible parameter names for that namespace, also in lower case. The -- table entries are structured like this: -- { -- [''] = {'main'}, -- ['wikipedia'] = {'wikipedia', 'project', 'wp'}, -- ... -- } -- local mappings = {} local mainNsName = mw.site.subjectNamespaces[0].name mainNsName = mw.ustring.lower(mainNsName) mappings[mainNsName] = mw.clone(argKeys.main) mappings['talk'] = mw.clone(argKeys.talk) for nsid, ns in pairs(mw.site.subjectNamespaces) do if nsid ~= 0 then -- Exclude main namespace. local nsname = mw.ustring.lower(ns.name) local canonicalName = mw.ustring.lower(ns.canonicalName) mappings[nsname] = {nsname} if canonicalName ~= nsname then table.insert(mappings[nsname], canonicalName) end for _, alias in ipairs(ns.aliases) do table.insert(mappings[nsname], mw.ustring.lower(alias)) end end end return mappings end return { argKeys = argKeys, cfg = cfg, mappings = getParamMappings }

ojp6d3pc8mql5nufaqdg576c9so3479

-

Module:No globals

<ns>828</ns>

<id>42567026</id>

-

<id>606781024</id>

605595284

2014-05-02T15:35:56Z

-

Jackmcbarn

<id>19285809</id>

rm name exception

Scribunto

text/plain

<text bytes="307" xml:space="preserve">local mt = getmetatable(_G) or {} function mt.__index (t, k) if k ~= 'arg' then error('Tried to read nil global ' .. tostring(k), 2) end return nil end function mt.__newindex(t, k, v) if k ~= 'arg' then error('Tried to write global ' .. tostring(k), 2) end rawset(t, k, v) end setmetatable(_G, mt)

gggsv54pq7f94l3up48hr91qtxnskdm

-

Module:Protection banner

<ns>828</ns>

<id>42040984</id>

-

<id>641310725</id>

638635015

2015-01-06T22:20:10Z

-

Jackmcbarn

<id>19285809</id>

accountcreator level is gone

Scribunto

text/plain

<text bytes="26042" xml:space="preserve">-- This module implements and its daughter templates such as --,  and. -- Initialise necessary modules. require('Module:No globals') local makeFileLink = require('Module:File link')._main local effectiveProtectionLevel = require('Module:Effective protection level')._main local yesno = require('Module:Yesno') -- Lazily initialise modules and objects we don't always need. local getArgs, makeMessageBox, lang -- Set constants. local CONFIG_MODULE = 'Module:Protection banner/config' -- Helper functions  local function makeCategoryLink(cat, sort) local nsText = mw.site.namespaces[14].name if cat and sort then return string.format( '%s', nsText, cat, sort ) elseif cat then return string.format( '%s:%s', nsText, cat ) else return '' end end -- Validation function for the expiry and the protection date local function validateDate(dateString, dateType) lang = lang or mw.language.getContentLanguage local success, result = pcall(lang.formatDate, lang, 'U', dateString) if success then result = tonumber(result) if result then return result end end error(string.format( 'invalid %s ("%s")', dateType, tostring(dateString) ), 4) end local function makeFullUrl(page, query, display) return string.format( '[%s %s]', tostring(mw.uri.fullUrl(page, query)), display ) end local function toTableEnd(t, pos) -- Sends the value at position pos to the end of array t, and shifts the -- other items down accordingly. return table.insert(t, table.remove(t, pos)) end local function walkHierarchy(hierarchy, start) local toWalk, retval = {[start] = true}, {} while true do -- Can't use pairs since we're adding and removing things as we're iterating local k = next(toWalk) if k == nil then break end toWalk[k] = nil retval[k] = true for _,v in ipairs(hierarchy[k]) do if not retval[v] then toWalk[v] = true end end end return retval end -- Protection class  local Protection = {} Protection.__index = Protection Protection.supportedActions = { edit = true, move = true, autoreview = true } Protection.bannerConfigFields = { 'text', 'explanation', 'tooltip', 'alt', 'link', 'image' } function Protection.new(args, cfg, title) local obj = {} obj._cfg = cfg obj.title = title or mw.title.getCurrentTitle -- Set action if not args.action then obj.action = 'edit' elseif Protection.supportedActions[args.action] then obj.action = args.action else error(string.format( 'invalid action ("%s")', tostring(args.action) ), 3) end -- Set level obj.level = args.demolevel or effectiveProtectionLevel(obj.action, obj.title) if not obj.level or (obj.action == 'move' and obj.level == 'autoconfirmed') then -- Users need to be autoconfirmed to move pages anyway, so treat -- semi-move-protected pages as unprotected. obj.level = '*' end -- Set expiry if args.expiry then if cfg.indefStrings[args.expiry] then obj.expiry = 'indef' elseif type(args.expiry) == 'number' then obj.expiry = args.expiry else obj.expiry = validateDate(args.expiry, 'expiry date') end end -- Set reason if args[1] then obj.reason = mw.ustring.lower(args[1]) if obj.reason:find('|') then error('reasons cannot contain the pipe character ("|")', 3) end end -- Set protection date if args.date then obj.protectionDate = validateDate(args.date, 'protection date') end -- Set banner config do obj.bannerConfig = {} local configTables = {} if cfg.banners[obj.action] then configTables[#configTables + 1] = cfg.banners[obj.action][obj.reason] end if cfg.defaultBanners[obj.action] then configTables[#configTables + 1] = cfg.defaultBanners[obj.action][obj.level] configTables[#configTables + 1] = cfg.defaultBanners[obj.action].default end configTables[#configTables + 1] = cfg.masterBanner for i, field in ipairs(Protection.bannerConfigFields) do for j, t in ipairs(configTables) do if t[field] then obj.bannerConfig[field] = t[field] break end end end end return setmetatable(obj, Protection) end function Protection:isProtected return self.level ~= '*' end function Protection:isTemporary return type(self.expiry) == 'number' end function Protection:makeProtectionCategory local cfg = self._cfg local title = self.title -- Exit if the page is not protected. if not self:isProtected then return '' end -- Get the expiry key fragment. local expiryFragment if self.expiry == 'indef' then expiryFragment = self.expiry elseif type(self.expiry) == 'number' then expiryFragment = 'temp' end -- Get the namespace key fragment. local namespaceFragment do namespaceFragment = cfg.categoryNamespaceKeys[title.namespace] if not namespaceFragment and title.namespace % 2 == 1 then namespaceFragment = 'talk' end end -- Define the order that key fragments are tested in. This is done with an -- array of tables containing the value to be tested, along with its -- position in the cfg.protectionCategories table. local order = { {val = expiryFragment, keypos = 1}, {val = namespaceFragment, keypos = 2}, {val = self.reason, keypos = 3}, {val = self.level, keypos = 4}, {val = self.action, keypos = 5} } -- -- The old protection templates used an ad-hoc protection category system, -- with some templates prioritising namespaces in their categories, and -- others prioritising the protection reason. To emulate this in this module -- we use the config table cfg.reasonsWithNamespacePriority to set the -- reasons for which namespaces have priority over protection reason. -- If we are dealing with one of those reasons, move the namespace table to -- the end of the order table, i.e. give it highest priority. If not, the -- reason should have highest priority, so move that to the end of the table -- instead. -- if self.reason and cfg.reasonsWithNamespacePriority[self.reason] then -- table.insert(order, 3, table.remove(order, 2)) toTableEnd(order, 2) else toTableEnd(order, 3) end -- -- Define the attempt order. Inactive subtables (subtables with nil "value" -- fields) are moved to the end, where they will later be given the key -- "all". This is to cut down on the number of table lookups in -- cfg.protectionCategories, which grows exponentially with the number of -- non-nil keys. We keep track of the number of active subtables with the -- noActive parameter. -- local noActive, attemptOrder do local active, inactive = {}, {} for i, t in ipairs(order) do if t.val then active[#active + 1] = t else inactive[#inactive + 1] = t end end noActive = #active attemptOrder = active for i, t in ipairs(inactive) do attemptOrder[#attemptOrder + 1] = t end end -- -- Check increasingly generic key combinations until we find a match. If a -- specific category exists for the combination of key fragments we are -- given, that match will be found first. If not, we keep trying different -- key fragment combinations until we match using the key -- "all-all-all-all-all". -- -- To generate the keys, we index the key subtables using a binary matrix -- with indexes i and j. j is only calculated up to the number of active -- subtables. For example, if there were three active subtables, the matrix -- would look like this, with 0 corresponding to the key fragment "all", and -- 1 corresponding to other key fragments. -- -- j 1 2 3 -- i -- 1 1 1 1 -- 2 0 1 1 -- 3 1 0 1 -- 4 0 0 1 -- 5 1 1 0 -- 6 0 1 0 -- 7 1 0 0 -- 8 0 0 0 -- -- Values of j higher than the number of active subtables are set -- to the string "all". -- -- A key for cfg.protectionCategories is constructed for each value of i. -- The position of the value in the key is determined by the keypos field in -- each subtable. -- local cats = cfg.protectionCategories for i = 1, 2^noActive do local key = {} for j, t in ipairs(attemptOrder) do if j > noActive then key[t.keypos] = 'all' else local quotient = i / 2 ^ (j - 1) quotient = math.ceil(quotient) if quotient % 2 == 1 then key[t.keypos] = t.val else key[t.keypos] = 'all' end end end key = table.concat(key, '|') local attempt = cats[key] if attempt then return makeCategoryLink(attempt, title.text) end end return '' end function Protection:needsExpiry local cfg = self._cfg local actionNeedsCheck = cfg.expiryCheckActions[self.action] return not self.expiry and ( actionNeedsCheck or ( actionNeedsCheck == nil and self.reason -- the old didn't check for expiry and not cfg.reasonsWithoutExpiryCheck[self.reason] ) ) end function Protection:isIncorrect local expiry = self.expiry return not self:isProtected or type(expiry) == 'number' and expiry < os.time end function Protection:isTemplateProtectedNonTemplate local action, namespace = self.action, self.title.namespace return self.level == 'templateeditor' and ( (action ~= 'edit' and action ~= 'move') or (namespace ~= 10 and namespace ~= 828) ) end function Protection:makeCategoryLinks local msg = self._cfg.msg local ret = { self:makeProtectionCategory } if self:needsExpiry then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-expiry'], self.title.text ) end if self:isIncorrect then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-incorrect'], self.title.text ) end if self:isTemplateProtectedNonTemplate then ret[#ret + 1] = makeCategoryLink( msg['tracking-category-template'], self.title.text ) end return table.concat(ret) end  -- Blurb class  local Blurb = {} Blurb.__index = Blurb Blurb.bannerTextFields = { text = true, explanation = true, tooltip = true, alt = true, link = true } function Blurb.new(protectionObj, args, cfg) return setmetatable({ _cfg = cfg, _protectionObj = protectionObj, _args = args }, Blurb) end -- Private methods -- function Blurb:_formatDate(num) -- Formats a Unix timestamp into dd Month, YYYY format. lang = lang or mw.language.getContentLanguage local success, date = pcall( lang.formatDate, lang, self._cfg.msg['expiry-date-format'] or 'j F Y', '@' .. tostring(num) ) if success then return date end end function Blurb:_getExpandedMessage(msgKey) return self:_substituteParameters(self._cfg.msg[msgKey]) end function Blurb:_substituteParameters(msg) if not self._params then local parameterFuncs = {} parameterFuncs.CURRENTVERSION = self._makeCurrentVersionParameter parameterFuncs.EDITREQUEST = self._makeEditRequestParameter parameterFuncs.EXPIRY = self._makeExpiryParameter parameterFuncs.EXPLANATIONBLURB = self._makeExplanationBlurbParameter parameterFuncs.IMAGELINK = self._makeImageLinkParameter parameterFuncs.INTROBLURB = self._makeIntroBlurbParameter parameterFuncs.INTROFRAGMENT = self._makeIntroFragmentParameter parameterFuncs.PAGETYPE = self._makePagetypeParameter parameterFuncs.PROTECTIONBLURB = self._makeProtectionBlurbParameter parameterFuncs.PROTECTIONDATE = self._makeProtectionDateParameter parameterFuncs.PROTECTIONLEVEL = self._makeProtectionLevelParameter parameterFuncs.PROTECTIONLOG = self._makeProtectionLogParameter parameterFuncs.TALKPAGE = self._makeTalkPageParameter parameterFuncs.TOOLTIPBLURB = self._makeTooltipBlurbParameter parameterFuncs.TOOLTIPFRAGMENT = self._makeTooltipFragmentParameter parameterFuncs.VANDAL = self._makeVandalTemplateParameter self._params = setmetatable({}, { __index = function (t, k) local param if parameterFuncs[k] then param = parameterFuncs[k](self) end param = param or '' t[k] = param return param end }) end msg = msg:gsub('${(%u+)}', self._params) return msg end function Blurb:_makeCurrentVersionParameter -- A link to the page history or the move log, depending on the kind of -- protection. local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'move' then -- We need the move log link. return makeFullUrl( 'Special:Log', {type = 'move', page = pagename}, self:_getExpandedMessage('current-version-move-display') ) else -- We need the history link. return makeFullUrl( pagename, {action = 'history'}, self:_getExpandedMessage('current-version-edit-display') ) end end function Blurb:_makeEditRequestParameter local mEditRequest = require('Module:Submit an edit request') local action = self._protectionObj.action local level = self._protectionObj.level -- Get the edit request type. local requestType if action == 'edit' then if level == 'autoconfirmed' then requestType = 'semi' elseif level == 'templateeditor' then requestType = 'template' end end requestType = requestType or 'full' -- Get the display value. local display = self:_getExpandedMessage('edit-request-display') return mEditRequest._link{type = requestType, display = display} end function Blurb:_makeExpiryParameter local expiry = self._protectionObj.expiry if type(expiry) == 'number' then return self:_formatDate(expiry) else return expiry end end function Blurb:_makeExplanationBlurbParameter -- Cover special cases first. if self._protectionObj.title.namespace == 8 then -- MediaWiki namespace return self:_getExpandedMessage('explanation-blurb-nounprotect') end -- Get explanation blurb table keys local action = self._protectionObj.action local level = self._protectionObj.level local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject' -- Find the message in the explanation blurb table and substitute any -- parameters. local explanations = self._cfg.explanationBlurbs local msg if explanations[action][level] and explanations[action][level][talkKey] then msg = explanations[action][level][talkKey] elseif explanations[action][level] and explanations[action][level].default then msg = explanations[action][level].default elseif explanations[action].default and explanations[action].default[talkKey] then msg = explanations[action].default[talkKey] elseif explanations[action].default and explanations[action].default.default then msg = explanations[action].default.default else error(string.format( 'could not find explanation blurb for action "%s", level "%s" and talk key "%s"', action, level, talkKey ), 8) end return self:_substituteParameters(msg) end function Blurb:_makeImageLinkParameter local imageLinks = self._cfg.imageLinks local action = self._protectionObj.action local level = self._protectionObj.level local msg if imageLinks[action][level] then msg = imageLinks[action][level] elseif imageLinks[action].default then msg = imageLinks[action].default else msg = imageLinks.edit.default end return self:_substituteParameters(msg) end function Blurb:_makeIntroBlurbParameter if self._protectionObj:isTemporary then return self:_getExpandedMessage('intro-blurb-expiry') else return self:_getExpandedMessage('intro-blurb-noexpiry') end end function Blurb:_makeIntroFragmentParameter if self._protectionObj:isTemporary then return self:_getExpandedMessage('intro-fragment-expiry') else return self:_getExpandedMessage('intro-fragment-noexpiry') end end function Blurb:_makePagetypeParameter local pagetypes = self._cfg.pagetypes return pagetypes[self._protectionObj.title.namespace] or pagetypes.default or error('no default pagetype defined', 8) end function Blurb:_makeProtectionBlurbParameter local protectionBlurbs = self._cfg.protectionBlurbs local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionBlurbs[action][level] then msg = protectionBlurbs[action][level] elseif protectionBlurbs[action].default then msg = protectionBlurbs[action].default elseif protectionBlurbs.edit.default then msg = protectionBlurbs.edit.default else error('no protection blurb defined for protectionBlurbs.edit.default', 8) end return self:_substituteParameters(msg) end function Blurb:_makeProtectionDateParameter local protectionDate = self._protectionObj.protectionDate if type(protectionDate) == 'number' then return self:_formatDate(protectionDate) else return protectionDate end end function Blurb:_makeProtectionLevelParameter local protectionLevels = self._cfg.protectionLevels local action = self._protectionObj.action local level = self._protectionObj.level local msg if protectionLevels[action][level] then msg = protectionLevels[action][level] elseif protectionLevels[action].default then msg = protectionLevels[action].default elseif protectionLevels.edit.default then msg = protectionLevels.edit.default else error('no protection level defined for protectionLevels.edit.default', 8) end return self:_substituteParameters(msg) end function Blurb:_makeProtectionLogParameter local pagename = self._protectionObj.title.prefixedText if self._protectionObj.action == 'autoreview' then -- We need the pending changes log. return makeFullUrl( 'Special:Log', {type = 'stable', page = pagename}, self:_getExpandedMessage('pc-log-display') ) else -- We need the protection log. return makeFullUrl( 'Special:Log', {type = 'protect', page = pagename}, self:_getExpandedMessage('protection-log-display') ) end end function Blurb:_makeTalkPageParameter return string.format( '%s', mw.site.namespaces[self._protectionObj.title.namespace].talk.name, self._protectionObj.title.text, self._args.section or 'top', self:_getExpandedMessage('talk-page-link-display') ) end function Blurb:_makeTooltipBlurbParameter if self._protectionObj:isTemporary then return self:_getExpandedMessage('tooltip-blurb-expiry') else return self:_getExpandedMessage('tooltip-blurb-noexpiry') end end function Blurb:_makeTooltipFragmentParameter if self._protectionObj:isTemporary then return self:_getExpandedMessage('tooltip-fragment-expiry') else return self:_getExpandedMessage('tooltip-fragment-noexpiry') end end function Blurb:_makeVandalTemplateParameter return require('Module:Vandal-m')._main{ self._args.user or self._protectionObj.title.baseText } end -- Public methods -- function Blurb:makeBannerText(key) -- Validate input. if not key or not Blurb.bannerTextFields[key] then error(string.format( '"%s" is not a valid banner config field', tostring(key) ), 2) end -- Generate the text. local msg = self._protectionObj.bannerConfig[key] if type(msg) == 'string' then return self:_substituteParameters(msg) elseif type(msg) == 'function' then msg = msg(self._protectionObj, self._args) if type(msg) ~= 'string' then error(string.format( 'bad output from banner config function with key "%s"' .. ' (expected string, got %s)', tostring(key), type(msg) ), 4) end return self:_substituteParameters(msg) end end -- BannerTemplate class  local BannerTemplate = {} BannerTemplate.__index = BannerTemplate function BannerTemplate.new(protectionObj, cfg) local obj = {} obj._cfg = cfg -- Set the image filename. local imageFilename = protectionObj.bannerConfig.image if imageFilename then obj._imageFilename = imageFilename else -- If an image filename isn't specified explicitly in the banner config, -- generate it from the protection status and the namespace. local action = protectionObj.action local level = protectionObj.level local namespace = protectionObj.title.namespace local reason = protectionObj.reason -- Deal with special cases first. if ( namespace == 10 or namespace == 828 or reason and obj._cfg.indefImageReasons[reason] ) and action == 'edit' and level == 'sysop' and not protectionObj:isTemporary then -- Fully protected modules and templates get the special red "indef" -- padlock. obj._imageFilename = obj._cfg.msg['image-filename-indef'] else -- Deal with regular protection types. local images = obj._cfg.images if images[action] then if images[action][level] then obj._imageFilename = images[action][level] elseif images[action].default then obj._imageFilename = images[action].default end end end end return setmetatable(obj, BannerTemplate) end function BannerTemplate:setImageWidth(width) self._imageWidth = width end function BannerTemplate:setImageTooltip(tooltip) self._imageCaption = tooltip end function BannerTemplate:renderImage local filename = self._imageFilename or self._cfg.msg['image-filename-default'] or 'Transparent.gif' return makeFileLink{ file = filename, size = (self._imageWidth or 20) .. 'px', alt = self._imageAlt, link = self._imageLink, caption = self._imageCaption } end -- Banner class  local Banner = setmetatable({}, BannerTemplate) Banner.__index = Banner function Banner.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(40) obj:setImageTooltip(blurbObj:makeBannerText('alt')) -- Large banners use the alt text for the tooltip. obj._reasonText = blurbObj:makeBannerText('text') obj._explanationText = blurbObj:makeBannerText('explanation') obj._page = protectionObj.title.prefixedText -- Only makes a difference in testing. return setmetatable(obj, Banner) end function Banner:__tostring -- Renders the banner. makeMessageBox = makeMessageBox or require('Module:Message box').main local reasonText = self._reasonText or error('no reason text set', 2) local explanationText = self._explanationText local mbargs = { page = self._page, type = 'protection', image = self:renderImage, text = string.format( "%s%s", reasonText, explanationText and ' ' .. explanationText or '' ) } return makeMessageBox('mbox', mbargs) end -- Padlock class  local Padlock = setmetatable({}, BannerTemplate) Padlock.__index = Padlock function Padlock.new(protectionObj, blurbObj, cfg) local obj = BannerTemplate.new(protectionObj, cfg) -- This doesn't need the blurb. obj:setImageWidth(20) obj:setImageTooltip(blurbObj:makeBannerText('tooltip')) obj._imageAlt = blurbObj:makeBannerText('alt') obj._imageLink = blurbObj:makeBannerText('link') obj._right = cfg.padlockPositions[protectionObj.action] or cfg.padlockPositions.default or '55px' return setmetatable(obj, Padlock) end function Padlock:__tostring local root = mw.html.create('div') root :addClass('metadata topicon nopopups') :attr('id', 'protected-icon') :css{display = 'none', right = self._right} :wikitext(self:renderImage) return tostring(root) end -- Exports  local p = {} function p._exportClasses -- This is used for testing purposes. return { Protection = Protection, Blurb = Blurb, BannerTemplate = BannerTemplate, Banner = Banner, Padlock = Padlock, } end function p._main(args, cfg, title) args = args or {} cfg = cfg or require(CONFIG_MODULE) local protectionObj = Protection.new(args, cfg, title) local ret = {} -- If a page's edit protection is equally or more restrictive than its protection from some other action, -- then don't bother displaying anything for the other action (except categories). if protectionObj.action == 'edit' or args.demolevel or not walkHierarchy(cfg.hierarchy, protectionObj.level)[effectiveProtectionLevel('edit', protectionObj.title)] then -- Initialise the blurb object local blurbObj = Blurb.new(protectionObj, args, cfg) -- Render the banner if protectionObj:isProtected then ret[#ret + 1] = tostring( (yesno(args.small) and Padlock or Banner) .new(protectionObj, blurbObj, cfg) ) end end -- Render the categories if yesno(args.category) ~= false then ret[#ret + 1] = protectionObj:makeCategoryLinks end return table.concat(ret) end function p.main(frame, cfg) cfg = cfg or require(CONFIG_MODULE) -- Find default args, if any. local parent = frame.getParent and frame:getParent local defaultArgs = parent and cfg.wrappers[parent:getTitle:gsub('/sandbox$', '')] -- Find user args, and use the parent frame if we are being called from a -- wrapper template. getArgs = getArgs or require('Module:Arguments').getArgs local userArgs = getArgs(frame, { parentOnly = defaultArgs, frameOnly = not defaultArgs }) -- Build the args table. User-specified args overwrite default args. local args = {} for k, v in pairs(defaultArgs or {}) do args[k] = v end for k, v in pairs(userArgs) do args[k] = v end return p._main(args, cfg) end return p

ftb9ninr5wguj33vszyec49fjcv1kwv

-

Module:Protection banner/config

<ns>828</ns>

<id>42982788</id>

-

<id>641310827</id>

633561150

2015-01-06T22:21:00Z

-

Jackmcbarn

<id>19285809</id>

- accountcreator

Scribunto

text/plain

<text bytes="43878" xml:space="preserve">-- This module provides configuration data for Module:Protection banner. return { -- -- BANNER DATA --  --[[ -- Banner data consists of six fields: -- * text - the main protection text that appears at the top of protection -- banners. -- * explanation - the text that appears below the main protection text, used -- to explain the details of the protection. -- * tooltip - the tooltip text you see when you move the mouse over a small -- padlock icon. -- * link - the page that the small padlock icon links to. -- * alt - the alt text for the small padlock icon. This is also used as tooltip -- text for the large protection banners. -- * image - the padlock image used in both protection banners and small padlock -- icons. -- -- The module checks in three separate tables to find a value for each field. -- First it checks the banners table, which has values specific to the reason -- for the page being protected. Then the module checks the defaultBanners -- table, which has values specific to each protection level. Finally, the -- module checks the masterBanner table, which holds data for protection -- templates to use if no data has been found in the previous two tables. -- -- The values in the banner data can take parameters. These are specified -- using ${TEXTLIKETHIS} (a dollar sign preceding a parameter name -- enclosed in curly braces). -- -- Available parameters: -- -- ${CURRENTVERSION} - a link to the page history or the move log, with the -- display message "current-version-edit-display" or -- "current-version-move-display". -- -- ${EDITREQUEST} - a link to create an edit request for the current page. -- -- ${EXPIRY} - the protection expiry date in the format DD Month YYYY. If -- protection is indefinite or is not set, this is the blank string. -- -- ${EXPLANATIONBLURB} - an explanation blurb, e.g. "Please discuss any changes -- on the talk page; you may submit a request to ask an administrator to make -- an edit if it is minor or supported by consensus." -- -- ${IMAGELINK} - a link to set the image to, depending on the protection -- action and protection level. -- -- ${INTROBLURB} - the PROTECTIONBLURB parameter, plus the expiry if an expiry -- is set. E.g. "Editing of this page by new or unregistered users is currently -- disabled until dd Month YYYY." -- -- ${INTROFRAGMENT} - the same as ${INTROBLURB}, but without final punctuation -- so that it can be used in run-on sentences. -- -- ${PAGETYPE} - the type of the page, e.g. "article" or "template". -- Defined in the cfg.pagetypes table. -- -- ${PROTECTIONBLURB} - a blurb explaining the protection level of the page, e.g. -- "Editing of this page by new or unregistered users is currently disabled" -- -- ${PROTECTIONDATE} - the protection date, if it has been supplied to the -- template. -- -- ${PROTECTIONLEVEL} - the protection level, e.g. "fully protected" or -- "semi-protected". -- -- ${PROTECTIONLOG} - a link to the protection log or the pending changes log, -- depending on the protection action. -- -- ${TALKPAGE} - a link to the talk page. If a section is specified, links -- straight to that talk page section. -- -- ${TOOLTIPBLURB} - uses the PAGETYPE, PROTECTIONTYPE and EXPIRY parameters to -- create a blurb like "This template is semi-protected", or "This article is -- move-protected until DD Month YYYY". -- -- ${VANDAL} - links for the specified username (or the root page name) -- using Module:Vandal-m. -- -- Functions -- -- For advanced users, it is possible to use Lua functions instead of strings -- in the banner config tables. Using functions gives flexibility that is not -- possible just by using parameters. Functions take two arguments, the -- protection object and the template arguments, and they must output a string. -- -- For example: -- -- text = function (protectionObj, args) -- if protectionObj.level == 'autoconfirmed' then -- return 'foo' -- else -- return 'bar' -- end -- end -- -- Some protection object properties and methods that may be useful: -- protectionObj.action - the protection action -- protectionObj.level - the protection level -- protectionObj.reason - the protection reason -- protectionObj.expiry - the expiry. Nil if unset, the string "indef" if set -- to indefinite, and the protection time in unix time if temporary. -- protectionObj.protectionDate - the protection date in unix time, or nil if -- unspecified. -- protectionObj.bannerConfig - the banner config found by the module. Beware -- of editing the config field used by the function, as it could create an -- infinite loop. -- protectionObj:isProtected - returns a boolean showing whether the page is -- protected. -- protectionObj:isTemporary - returns a boolean showing whether the expiry is -- temporary. -- protectionObj:isIncorrect - returns a boolean showing whether the protection -- template is incorrect. --]] -- The master banner data, used if no values have been found in banners or -- defaultBanners. masterBanner = { text = '${INTROBLURB}', explanation = '${EXPLANATIONBLURB}', tooltip = '${TOOLTIPBLURB}', link = '${IMAGELINK}', alt = 'Page ${PROTECTIONLEVEL}' }, -- The default banner data. This holds banner data for different protection -- levels. -- *required* - this table needs edit, move, and autoreview subtables. defaultBanners = { edit = {}, move = {}, autoreview = { autoconfirmed = { alt = 'Page protected with pending changes level 1', tooltip = 'All edits by unregistered and new users are subject to review', image = 'Padlock-silver-light.svg' }, default = { alt = 'Page protected with pending changes level 2', tooltip = 'All edits by users who are not reviewers or administrators are' .. ' subject to review', } } }, -- The banner data. This holds banner data for different protection reasons. -- In fact, the reasons specified in this table control which reasons are -- valid inputs to the first positional parameter. -- -- There is also a non-standard "description" field that can be used for items -- in this table. This is a description of the protection reason for use in the -- module documentation. -- -- *required* - this table needs edit, move, and autoreview subtables. banners = { edit = { blp = { description = 'For pages protected to promote compliance with the' .. ' biographies of living persons policy.', text = '${INTROFRAGMENT} to promote compliance with' .. ' Wikipedia's policy on the biographies" .. ' of living people.', tooltip = '${TOOLTIPFRAGMENT} to promote compliance with the policy on' .. ' biographies of living people', }, dmca = { description = 'For pages protected by the Wikimedia Foundation' .. ' due to Digital Millennium Copyright Act takedown requests.', explanation = function (protectionObj, args) local ret = 'Pursuant to a rights owner notice under the Digital' .. ' Millennium Copyright Act (DMCA) regarding some content' .. ' in this article, the Wikimedia Foundation acted under' .. ' applicable law and took down and restricted the content' .. ' in question.' if args.notice then ret = ret .. ' A copy of the received notice can be found here: ' .. args.notice .. '.' end ret = ret .. ' For more information, including websites discussing' .. ' how to file a counter-notice, please see' .. " Office actions and the article's ${TALKPAGE}." .. "'''Do not remove this template from the article until the" .. " restrictions are withdrawn'''." return ret end, image = 'Padlock-black.svg', }, dispute = { description = 'For pages protected due to editing disputes.', text = function (protectionObj, args) -- Find the value of "disputes". local display = 'disputes' local disputes if args.section then disputes = string.format( '%s', mw.site.namespaces[protectionObj.title.namespace].talk.name, protectionObj.title.text, args.section, display ) else disputes = display end -- Make the blurb, depending on the expiry. local msg if type(protectionObj.expiry) == 'number' then msg = '${INTROFRAGMENT} or until editing %s have been resolved.' else msg = '${INTROFRAGMENT} until editing %s have been resolved.' end return string.format(msg, disputes) end, explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', tooltip = '${TOOLTIPFRAGMENT} due to editing disputes', }, mainpage = { description = 'For pages protected for being displayed on the Main Page.', text = 'This file is currently' .. ' protected from' .. ' editing because it is currently or will soon be displayed' .. ' on the Main Page.', explanation = 'Images on the Main Page are protected due to their high' .. ' visibility. Please discuss any necessary changes on the ${TALKPAGE}.' .. ' ' .. "Administrators: Once this image is definitely off the Main Page," .. ' please unprotect this file, or reduce to semi-protection,' .. ' as appropriate. ', }, office = { description = 'For pages protected by the Wikimedia Foundation.', text = function (protectionObj, args) local ret = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.' if protectionObj.protectionDate then ret = ret .. ' It has been protected since ${PROTECTIONDATE}.' end return ret end, explanation = "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. '''Do not remove protection from this" .. " page unless you are authorized by the Wikimedia Foundation to do" .. " so.'''", image = 'Padlock-black.svg', }, reset = { description = 'For pages protected by the Wikimedia Foundation and' .. ' "reset" to a bare-bones version.', text = 'This ${PAGETYPE} is currently under the' .. ' scrutiny of the' .. ' Wikimedia Foundation Office' .. ' and is protected.', explanation = function (protectionObj, args) local ret = '' if protectionObj.protectionDate then ret = ret .. 'On ${PROTECTIONDATE} this ${PAGETYPE} was' else ret = ret .. 'This ${PAGETYPE} has been' end ret = ret .. ' reduced to a' .. ' simplified, "bare bones" version so that it may be completely' .. ' rewritten to ensure it meets the policies of' .. ' Neutral Point of View and Verifiability.' .. ' Standard Wikipedia policies will apply to its rewriting—which' .. ' will eventually be open to all editors—and will be strictly' .. ' enforced. The ${PAGETYPE} has been ${PROTECTIONLEVEL} while' .. ' it is being rebuilt.\n\n' .. 'Any insertion of material directly from' .. ' pre-protection revisions of the ${PAGETYPE} will be removed, as' .. ' will any material added to the ${PAGETYPE} that is not properly' .. ' sourced. The associated talk page(s) were also cleared on the' .. " same date.\n\n" .. "If you can edit this page, please discuss all changes and" .. " additions on the ${TALKPAGE} first. '''Do not override" .. " this action, and do not remove protection from this page," .. " unless you are authorized by the Wikimedia Foundation" .. " to do so. No editor may remove this notice.'''" return ret end, image = 'Padlock-black.svg', }, sock = { description = 'For pages protected due to' .. ' sock puppetry.', text = '${INTROFRAGMENT} to prevent sock puppets of' .. ' blocked or' .. ' banned users' .. ' from editing it.', tooltip = '${TOOLTIPFRAGMENT} to prevent sock puppets of blocked or banned users from' .. ' editing it', }, template = { description = 'For high-risk' .. ' templates and Lua modules.', text = 'This is a permanently protected ${PAGETYPE},' .. ' as it is high-risk.', explanation = 'Please discuss any changes on the ${TALKPAGE}; you may' .. ' ${EDITREQUEST} to ask an' .. ' administrator or' .. ' template editor to make an edit if' .. ' it is uncontroversial or supported by' .. ' consensus. You can also' .. ' request that the page be' .. ' unprotected.', tooltip = 'This high-risk ${PAGETYPE} is permanently ${PROTECTIONLEVEL}' .. ' to prevent vandalism', alt = 'Permanently protected ${PAGETYPE}', }, usertalk = { description = 'For pages protected against disruptive edits by a' .. ' particular user.', text = '${INTROFRAGMENT} to prevent ${VANDAL} from using it to make disruptive edits,' .. ' such as abusing the' .. ' &#123;&#123;unblock&#125;&#125; template.', explanation = 'If you cannot edit this user talk page and you need to' .. ' make a change or leave a message, you can' .. ' request an edit,' .. ' request unprotection,' .. ' log in,' .. ' or create an account.', }, vandalism = { description = 'For pages protected against' .. ' vandalism.', text = '${INTROFRAGMENT} due to vandalism.', explanation = function (protectionObj, args) local ret = '' if protectionObj.level == 'sysop' then ret = ret .. "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ' end return ret .. '${EXPLANATIONBLURB}' end, tooltip = '${TOOLTIPFRAGMENT} due to vandalism', } }, move = { dispute = { description = 'For pages protected against page moves due to' .. ' disputes over the page title.', explanation = "This protection is not an endorsement of the" .. ' ${CURRENTVERSION}. ${EXPLANATIONBLURB}', image = 'Padlock-olive.svg' }, vandalism = { description = 'For pages protected against' .. ' page-move vandalism.' } }, autoreview = {} }, -- -- GENERAL DATA TABLES --   -- Protection blurbs  -- This table produces the protection blurbs available with the -- ${PROTECTIONBLURB} parameter. It is sorted by protection action and -- protection level, and is checked by the module in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionBlurbs = { edit = { default = 'This ${PAGETYPE} is currently ' .. 'protected from editing', autoconfirmed = 'Editing of this ${PAGETYPE} by new or unregistered users is currently disabled' }, move = { default = 'This ${PAGETYPE} is currently protected' .. ' from page moves' }, autoreview = { autoconfirmed = 'All edits made to this ${PAGETYPE} by' .. ' new or' .. ' unregistered' .. ' users are currently' .. ' subject to review', default = 'All edits made to this ${PAGETYPE} by users who are not' .. ' reviewers or' .. ' administrators are currently' .. ' subject to review' } }, -- Explanation blurbs  -- This table produces the explanation blurbs available with the -- ${EXPLANATIONBLURB} parameter. It is sorted by protection action, -- protection level, and whether the page is a talk page or not. If the page is -- a talk page it will have a talk key of "talk"; otherwise it will have a talk -- key of "subject". The table is checked in the following order: -- 1. page's protection action, page's protection level, page's talk key -- 2. page's protection action, page's protection level, default talk key -- 3. page's protection action, default protection level, page's talk key -- 4. page's protection action, default protection level, default talk key -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. explanationBlurbs = { edit = { autoconfirmed = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' ${EDITREQUEST}, discuss changes on the ${TALKPAGE},' .. ' request unprotection, log in, or' .. ' create an account.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details. If you' .. ' cannot edit this ${PAGETYPE} and you wish to make a change, you can' .. ' request unprotection, log in, or' .. ' create an account.', }, default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is uncontroversial or supported by consensus. You may also request that this page be unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' You may request an' .. ' edit to this page, or ask for it to be unprotected.' } }, move = { default = { subject = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves on the' .. ' ${TALKPAGE} or at Requested moves. You can also' .. ' request that the page be' .. ' unprotected.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' The page may still be edited but cannot be moved' .. ' until unprotected. Please discuss any suggested moves at' .. ' Requested moves. You can also' .. ' request that the page be' .. ' unprotected.' } }, autoreview = { default = { reviewer = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} will not be visible to readers' .. ' until they are accepted by a reviewer or an administrator.' .. ' To avoid the need for your edits to be reviewed, you may' .. ' request unprotection. Experienced editors may also' .. ' request the reviewer user right.', default = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Edits to this ${PAGETYPE} by new and unregistered users' .. ' will not be visible to readers until they are accepted by' .. ' a reviewer. To avoid the need for your edits to be' .. ' reviewed, you may' .. ' request unprotection, log in, or' .. ' create an account.' }, } }, -- Protection levels  -- This table provides the data for the ${PROTECTIONLEVEL} parameter, which -- produces a short label for different protection levels. It is sorted by -- protection action and proteciton level, and is checked in the following -- order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. protectionLevels = { edit = { default = 'protected', templateeditor = 'template-protected', autoconfirmed = 'semi-protected', }, move = { default = 'move-protected' }, autoreview = { } }, -- Images  -- This table lists different padlock images for each protection action and -- protection level. It is used if an image is not specified in any of the -- banner data tables, and if the page does not satisfy the conditions for using -- the ['image-filename-indef'] image. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level images = { edit = { default = 'Padlock.svg', templateeditor = 'Padlock-pink.svg', autoconfirmed = 'Padlock-silver.svg' }, move = { default = 'Padlock-olive.svg', }, autoreview = { autoconfirmed = 'Padlock-silver-light.svg', default = 'Padlock-orange.svg' } }, -- Pages with a reason specified in this table will show the special "indef" -- padlock, defined in the 'image-filename-indef' message, if no expiry is set. indefImageReasons = { template = true }, -- Image links  -- This table provides the data for the ${IMAGELINK} parameter, which gets -- the image link for small padlock icons based on the page's protection action -- and protection level. It is checked in the following order: -- 1. page's protection action, page's protection level -- 2. page's protection action, default protection level -- 3. "edit" protection action, default protection level -- -- It is possible to use banner parameters inside this table. -- *required* - this table needs edit, move, and autoreview subtables. imageLinks = { edit = { default = 'Wikipedia:Protection policy#full', templateeditor = 'Wikipedia:Protection policy#template', autoconfirmed = 'Wikipedia:Protection policy#semi' }, move = { default = 'Wikipedia:Protection policy#move' }, autoreview = { autoconfirmed = 'Wikipedia:Protection policy#pc1', reviewer = 'Wikipedia:Protection policy#pc2' } }, -- Padlock positions  -- This table provides the data for the "right" CSS property for small padlock -- icons, which determines where the icon appears on the top bar among the other -- top icons. The data is stored by protection action. If no value is found for -- the action, the default field is used. padlockPositions = { autoreview = '85px', default = '55px' }, -- Protection categories  --[[ -- The protection categories are stored in the protectionCategories table. -- Keys to this table are made up of the following strings: -- -- 1. the expiry date -- 2. the namespace -- 3. the protection reason (e.g. "dispute" or "vandalism") -- 4. the protection level (e.g. "sysop" or "autoconfirmed") -- 5. the action (e.g. "edit" or "move") -- -- When the module looks up a category in the table, first it will will check to -- see a key exists that corresponds to all five parameters. For example, a -- user page semi-protected from vandalism for two weeks would have the key -- "temp-user-vandalism-autoconfirmed-edit". If no match is found, the module -- changes the first part of the key to "all" and checks the table again. It -- keeps checking increasingly generic key combinations until it finds the -- field, or until it reaches the key "all-all-all-all-all". -- -- The module uses a binary matrix to determine the order in which to search. -- This is best demonstrated by a table. In this table, the "0" values -- represent "all", and the "1" values represent the original data (e.g. -- "indef" or "file" or "vandalism"). -- -- expiry namespace reason level action -- order -- 1 1 1 1 1 1 -- 2 0 1 1 1 1 -- 3 1 0 1 1 1 -- 4 0 0 1 1 1 -- 5 1 1 0 1 1 -- 6 0 1 0 1 1 -- 7 1 0 0 1 1 -- 8 0 0 0 1 1 -- 9 1 1 1 0 1 -- 10 0 1 1 0 1 -- 11 1 0 1 0 1 -- 12 0 0 1 0 1 -- 13 1 1 0 0 1 -- 14 0 1 0 0 1 -- 15 1 0 0 0 1 -- 16 0 0 0 0 1 -- 17 1 1 1 1 0 -- 18 0 1 1 1 0 -- 19 1 0 1 1 0 -- 20 0 0 1 1 0 -- 21 1 1 0 1 0 -- 22 0 1 0 1 0 -- 23 1 0 0 1 0 -- 24 0 0 0 1 0 -- 25 1 1 1 0 0 -- 26 0 1 1 0 0 -- 27 1 0 1 0 0 -- 28 0 0 1 0 0 -- 29 1 1 0 0 0 -- 30 0 1 0 0 0 -- 31 1 0 0 0 0 -- 32 0 0 0 0 0 -- -- In this scheme the action has the highest priority, as it is the last -- to change, and the expiry has the least priority, as it changes the most. -- The priorities of the expiry, the protection level and the action are -- fixed, but the priorities of the reason and the namespace can be swapped -- through the use of the cfg.bannerDataNamespaceHasPriority table. --]] -- If the reason specified to the template is listed in this table, -- namespace data will take priority over reason data in the protectionCategories -- table. reasonsWithNamespacePriority = { vandalism = true, }, -- The string to use as a namespace key for the protectionCategories table for each -- namespace number. categoryNamespaceKeys = { [ 2] = 'user', [ 3] = 'user', [ 4] = 'project', [ 6] = 'file', [ 8] = 'mediawiki', [ 10] = 'template', [ 12] = 'project', [ 14] = 'category', [100] = 'portal', [828] = 'module', }, protectionCategories = { ['all|all|all|all|all'] = 'Wikipedia protected pages', ['all|all|office|all|all'] = 'Wikipedia Office-protected pages', ['all|all|reset|all|all'] = 'Wikipedia Office-protected pages', ['all|all|dmca|all|all'] = 'Wikipedia Office-protected pages', ['all|all|mainpage|all|all'] = 'Protected main page images', ['all|template|all|all|edit'] = 'Wikipedia protected templates', ['all|all|all|autoconfirmed|edit'] = 'Wikipedia semi-protected pages', ['indef|all|all|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected pages', ['all|all|blp|autoconfirmed|edit'] = 'Wikipedia indefinitely semi-protected biographies of living people', ['temp|all|blp|autoconfirmed|edit'] = 'Wikipedia temporarily semi-protected biographies of living people', ['all|all|dispute|autoconfirmed|edit'] = 'Wikipedia pages semi-protected due to dispute', ['all|all|sock|autoconfirmed|edit'] = 'Wikipedia pages semi-protected from banned users', ['all|all|vandalism|autoconfirmed|edit'] = 'Wikipedia pages semi-protected against vandalism', ['all|category|all|autoconfirmed|edit'] = 'Wikipedia semi-protected categories', ['all|file|all|autoconfirmed|edit'] = 'Semi-protected images', ['all|portal|all|autoconfirmed|edit'] = 'Semi-protected portals', ['all|project|all|autoconfirmed|edit'] = 'Semi-protected project pages', ['all|talk|all|autoconfirmed|edit'] = 'Semi-protected talk pages', ['all|template|all|autoconfirmed|edit'] = 'Wikipedia semi-protected templates', ['all|user|all|autoconfirmed|edit'] = 'Wikipedia semi-protected user and user talk pages', ['all|all|blp|sysop|edit'] = 'Wikipedia indefinitely protected biographies of living people', ['temp|all|blp|sysop|edit'] = 'Wikipedia temporarily protected biographies of living people', ['all|all|dispute|sysop|edit'] = 'Wikipedia pages protected due to dispute', ['all|all|sock|sysop|edit'] = 'Wikipedia pages protected from banned users', ['all|all|vandalism|sysop|edit'] = 'Wikipedia pages protected against vandalism', ['all|category|all|sysop|edit'] = 'Wikipedia protected categories', ['all|file|all|sysop|edit'] = 'Protected images', ['all|project|all|sysop|edit'] = 'Protected project pages', ['all|talk|all|sysop|edit'] = 'Protected talk pages', ['all|template|all|sysop|edit'] = 'Wikipedia protected templates', ['all|user|all|sysop|edit'] = 'Wikipedia protected user and user talk pages', ['all|module|all|all|edit'] = 'Wikipedia protected modules', ['all|module|all|autoconfirmed|edit'] = 'Wikipedia semi-protected modules', ['all|all|all|sysop|move'] = 'Wikipedia move-protected pages', ['indef|all|all|sysop|move'] = 'Wikipedia indefinitely move-protected pages', ['all|all|dispute|sysop|move'] = 'Wikipedia pages move-protected due to dispute', ['all|all|vandalism|sysop|move'] = 'Wikipedia pages move-protected due to vandalism', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|portal|all|sysop|move'] = 'Wikipedia move-protected portals', ['all|project|all|sysop|move'] = 'Wikipedia move-protected project pages', ['all|talk|all|sysop|move'] = 'Wikipedia move-protected talk pages', ['all|template|all|sysop|move'] = 'Wikipedia move-protected templates', ['all|user|all|sysop|move'] = 'Wikipedia move-protected user and user talk pages', ['all|all|all|autoconfirmed|autoreview'] = 'Wikipedia pending changes protected pages (level 1)', ['all|all|all|reviewer|autoreview'] = 'Wikipedia pending changes protected pages (level 2)', }, -- Expiry category config  -- This table configures the expiry category behaviour for each protection -- action. -- * If set to true, setting that action will always categorise the page if -- an expiry parameter is not set. -- * If set to false, setting that action will never categorise the page. -- * If set to nil, the module will categorise the page if: -- 1) an expiry parameter is not set, and -- 2) a reason is provided, and -- 3) the specified reason is not blacklisted in the reasonsWithoutExpiryCheck -- table. expiryCheckActions = { edit = nil, move = false, autoreview = true }, reasonsWithoutExpiryCheck = { blp = true, template = true, }, -- Pagetypes  -- This table produces the page types available with the ${PAGETYPE} parameter. -- Keys are namespace numbers, or the string "default" for the default value. pagetypes = { [0] = 'article', [6] = 'file', [10] = 'template', [14] = 'category', [828] = 'module', default = 'page' },  -- Strings marking indefinite protection  -- This table contains values passed to the expiry parameter that mean the page -- is protected indefinitely. indefStrings = { ['indef'] = true, ['indefinite'] = true, ['indefinitely'] = true, ['infinite'] = true, },  -- Group hierarchy  -- This table maps each group to all groups that have a superset of the original -- group's page editing permissions. hierarchy = { sysop = {}, reviewer = {'sysop'}, filemover = {'sysop'}, templateeditor = {'sysop'}, autoconfirmed = {'reviewer', 'filemover', 'templateeditor'}, user = {'autoconfirmed'}, ['*'] = {'user'} }, -- Wrapper templates and their default arguments  -- This table contains wrapper templates used with the module, and their -- default arguments. Templates specified in this table should contain the -- following invocation, and no other template content: -- -- -- -- If other content is desired, it can be added between -- ... tags. -- -- When a user calls one of these wrapper templates, they will use the -- default arguments automatically. The arguments cannot be overwritten by the -- user. wrappers = { ['Template:Pp'] = {}, ['Template:Pp-blp'] = {'blp'}, -- we don't need Template:Pp-create ['Template:Pp-dispute'] = {'dispute'}, ['Template:Pp-main-page'] = {'mainpage'}, ['Template:Pp-move'] = {action = 'move'}, ['Template:Pp-move-dispute'] = {'dispute', action = 'move'}, -- we don't need Template:Pp-move-indef ['Template:Pp-move-vandalism'] = {'vandalism', action = 'move'}, ['Template:Pp-office'] = {'office'}, ['Template:Pp-office-dmca'] = {'dmca'}, ['Template:Pp-pc1'] = {action = 'autoreview', small = true}, ['Template:Pp-pc2'] = {action = 'autoreview', small = true}, ['Template:Pp-reset'] = {'reset'}, ['Template:Pp-semi-indef'] = {expiry = 'indef', small = true}, ['Template:Pp-sock'] = {'sock'}, ['Template:Pp-template'] = {'template', small = true}, ['Template:Pp-usertalk'] = {'usertalk'}, ['Template:Pp-vandalism'] = {'vandalism'}, }, -- -- MESSAGES --  msg = {  -- Intro blurb and intro fragment  -- These messages specify what is produced by the ${INTROBLURB} and -- ${INTROFRAGMENT} parameters. If the protection is temporary they use the -- intro-blurb-expiry or intro-fragment-expiry, and if not they use -- intro-blurb-noexpiry or intro-fragment-noexpiry. -- It is possible to use banner parameters in these messages. ['intro-blurb-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY}.', ['intro-blurb-noexpiry'] = '${PROTECTIONBLURB}.', ['intro-fragment-expiry'] = '${PROTECTIONBLURB} until ${EXPIRY},', ['intro-fragment-noexpiry'] = '${PROTECTIONBLURB}', -- Tooltip blurb  -- These messages specify what is produced by the ${TOOLTIPBLURB} parameter. -- If the protection is temporary the tooltip-blurb-expiry message is used, and -- if not the tooltip-blurb-noexpiry message is used. -- It is possible to use banner parameters in these messages. ['tooltip-blurb-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY}.', ['tooltip-blurb-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}.', ['tooltip-fragment-expiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL} until ${EXPIRY},', ['tooltip-fragment-noexpiry'] = 'This ${PAGETYPE} is ${PROTECTIONLEVEL}', -- Special explanation blurb  -- An explanation blurb for pages that cannot be unprotected, e.g. for pages -- in the MediaWiki namespace. -- It is possible to use banner parameters in this message. ['explanation-blurb-nounprotect'] = 'See the ' .. 'protection policy and ${PROTECTIONLOG} for more details.' .. ' Please discuss any changes on the ${TALKPAGE}; you' .. ' may ${EDITREQUEST} to ask an' .. ' administrator to make an edit if it' .. ' is uncontroversial or supported by consensus.', -- Protection log display values  -- These messages determine the display values for the protection log link -- or the pending changes log link produced by the ${PROTECTIONLOG} parameter. -- It is possible to use banner parameters in these messages. ['protection-log-display'] = 'protection log', ['pc-log-display'] = 'pending changes log', -- Current version display values  -- These messages determine the display values for the page history link -- or the move log link produced by the ${CURRENTVERSION} parameter. -- It is possible to use banner parameters in these messages. ['current-version-move-display'] = 'current title', ['current-version-edit-display'] = 'current version', -- Talk page  -- This message determines the display value of the talk page link produced -- with the ${TALKPAGE} parameter. -- It is possible to use banner parameters in this message. ['talk-page-link-display'] = 'talk page', -- Edit requests  -- This message determines the display value of the edit request link produced -- with the ${EDITREQUEST} parameter. -- It is possible to use banner parameters in this message. ['edit-request-display'] = 'submit an edit request', -- Expiry date format  -- This is the format for the blurb expiry date. It should be valid input for -- the first parameter of the #time parser function. ['expiry-date-format'] = 'F j, Y', -- Tracking categories  -- These messages determine which tracking categories the module outputs. ['tracking-category-incorrect'] = 'Wikipedia pages with incorrect protection templates', ['tracking-category-expiry'] = 'Wikipedia protected pages without expiry', ['tracking-category-template'] = 'Wikipedia template-protected pages other than templates and modules', -- Images  -- These are images that are not defined by their protection action and protection level. ['image-filename-indef'] = 'Padlock-red.svg', ['image-filename-default'] = 'Transparent.gif', -- End messages  }  -- End configuration  }

tnw80riyb1pljsdzsta8zbb65qd461k

-

Module:Road data/countrymask

<ns>828</ns>

<id>40834805</id>

-

<id>612169255</id>

611298903

2014-06-09T05:02:57Z

-

Happy5214

<id>3653754</id>

Adding SH (Shanghai)

Scribunto

text/plain

<text bytes="2937" xml:space="preserve">local p = {AL = "USA", AK = "USA", AZ = "USA", AR = "USA", CA = "USA", CO = "USA", -- United States CT = "USA", DE = "USA", FL = "USA", GA = "USA", HI = "USA", ID = "USA", IL = "USA", IN = "USA", IA = "USA", KS = "USA", KY = "USA", LA = "USA", ME = "USA", MD = "USA", MA = "USA", MI = "USA", MN = "USA", MS = "USA", MO = "USA", MT = "USA", NE = "USA", NV = "USA", NH = "USA", NJ = "USA", NM = "USA", NY = "USA", NC = "USA", ND = "USA", OH = "USA", OK = "USA", OR = "USA", PA = "USA", RI = "USA", SC = "USA", SD = "USA", TN = "USA", TX = "USA", UT = "USA", VA = "USA", VT = "USA", WA = "USA", WV = "USA", WI = "USA", WY = "USA", DC = "USA", AS = "USA", GU = "USA", MP = "USA", PR = "USA", UM = "USA", VI = "USA", AB = "CAN", BC = "CAN", MB = "CAN", NB = "CAN", NL = "CAN", NS = "CAN", -- Canada NT = "CAN", NU = "CAN", ON = "CAN", PE = "CAN", QC = "CAN", SK = "CAN", YT = "CAN", AH = "CHN", BJ = "CHN", CQ = "CHN", FJ = "CHN", GD = "CHN", GS = "CHN", -- China GX = "CHN", GZ = "CHN", HA = "CHN", HB = "CHN", HE = "CHN", HK = "CHN", HL = "CHN", JL = "CHN", JS = "CHN", JX = "CHN", LN = "CHN", MC = "CHN", NX = "CHN", QH = "CHN", SH = "CHN", SN = "CHN", SX = "CHN", TJ = "CHN", TW = "CHN", XJ = "CHN", XZ = "CHN", YN = "CHN", ZJ = "CHN", AICHI = "JPN", AKITA = "JPN", AOMORI = "JPN", CHIBA = "JPN", EHIME = "JPN", -- Japan FUKUI = "JPN", FUKUOKA = "JPN", FUKUSHIMA = "JPN", GIFU = "JPN", GUNMA = "JPN", HIROSHIMA = "JPN", HOKKAIDO = "JPN", HYOGO = "JPN", IBARAKI = "JPN", ISHIKAWA = "JPN", IWATE = "JPN", KAGAWA = "JPN", KAGOSHIMA = "JPN", KANAGAWA = "JPN", KOCHI = "JPN", KUMAMOTO = "JPN", KYOTO = "JPN", MIE = "JPN", MIYAGI = "JPN", MIYAZAKI = "JPN", NAGANO = "JPN", NAGASAKI = "JPN", NARA = "JPN", NIIGATA = "JPN", OITA = "JPN", OKAYAMA = "JPN", OKINAWA = "JPN", OSAKA = "JPN", SAGA = "JPN", SAITAMA = "JPN", SHIGA = "JPN", SHIMANE = "JPN", SHIZUOKA = "JPN", TOCHIGI = "JPN", TOKUSHIMA = "JPN", TOKYO = "JPN", TOTTORI = "JPN", TOYAMA = "JPN", WAKAYAMA = "JPN", YAMAGATA = "JPN", YAMAGUCHI = "JPN", YAMANASHI = "JPN", AGU = "MEX", BCN = "MEX", BCS = "MEX", CAM = "MEX", CHP = "MEX", -- Mexico CHH = "MEX", COA = "MEX", COL = "MEX", DIF = "MEX", DUR = "MEX", GUA = "MEX", GRO = "MEX", HID = "MEX", JAL = "MEX", MEX = "MEX", MIC = "MEX", MOR = "MEX", NAY = "MEX", NLE = "MEX", OAX = "MEX", PUE = "MEX", QUE = "MEX", ROO = "MEX", SLP = "MEX", SIN = "MEX", SON = "MEX", TAB = "MEX", TAM = "MEX", TLA = "MEX", VER = "MEX", YUC = "MEX", ZAC = "MEX", NSW = "AUS", QLD = "AUS", SA = "AUS", TAS = "AUS", VIC = "AUS" -- Australia } return p

qoi7rg4mka26n2e28kz2bg8u8hypbcz

-

Module:Road data/parser

<ns>828</ns>

<id>40969508</id>

-

<id>619757981</id>

611297686

2014-08-04T02:49:14Z

-

Happy5214

<id>3653754</id>

August update: Add multiple shield support; use empty string type as fallback for non-existent types

Scribunto

text/plain

<text bytes="3737" xml:space="preserve">local p = {} local format = string.format local gsub = mw.ustring.gsub local trim = mw.text.trim local upper = mw.ustring.upper local prepattern = "%[(%w+)%|(.*)%|(.*)%|(.*)%]" local pattern = "%%(%w+)%%" local function parser(formatStr, args, form) local function ifexists(name) if name ==  then return false end local title if form == 'shield' then title = mw.title.new(name, 'Media') else title = mw.title.new(name, 0) end return title.exists end local function testArgs(test, equals, ifexists, ifnot) if equals ~=  then if args[test] == equals then return ifexists else return ifnot end else if args[test] and args[test] ~= '' then return ifexists else return ifnot end end end local formatTable = {} -- Recursively dig into tables that could be parser hooks or argument tables. local function formatStrInTable(formatStr) if type(formatStr) ~= "table" then return formatStr end formatTable = formatStr local hook = formatStr.hook local both = formatStr[2] if both then local first = formatStrInTable(formatStr[1]) local second = formatStrInTable(both) return {first, second} elseif hook then local hooksModule = require "Module:Road data/parser/hooks" local hookFunction = hooksModule[hook] or error("Hook '" .. hook .. "' does not exist", 0) return formatStrInTable(hookFunction(formatStr, args)) else local arg = args[formatStr.arg or "route"] return formatStrInTable(formatStr[arg] or formatStr.default) end end local function parse(formatStr) local preprocessed = gsub(formatStr, prepattern, testArgs) local parsedStr = gsub(preprocessed, pattern, args) local final = trim(parsedStr) if formatTable.ifexists then local exists = ifexists(final) if exists then return final else return parser(formatTable.otherwise, args, form) end end return final end formatStr = formatStrInTable(formatStr) if not formatStr or formatStr ==  then return  end if type(formatStr) == 'table' then local first = parse(formatStr[1]) local second = parse(formatStr[2]) return first, second else return parse(formatStr) end end local function formatString(args, form) local function getTypeData(module, type) local success, moduleData = pcall(mw.loadData, module) if not success then return  end local typeTable = moduleData[type] or moduleData[] local defaultTable = moduleData[''] or {} if typeTable then local alias = typeTable.alias if alias then local aliasedModule = "Module:Road data/strings/" .. alias.module local aliasedType = alias.type return getTypeData(aliasedModule, aliasedType) end return typeTable[form] or defaultTable[form] or  else return  end end local stateCountries = {USA = true, CAN = true} local state = upper(args.state or ) local country if args.country then country = upper(args.country) else local countryModule = mw.loadData("Module:Road data/countrymask") country = countryModule[state] or 'UNK' end local typeArg = args.type local module if stateCountries[country] and state ~=  then module = format("Module:Road data/strings/%s/%s", country, state) else module = format("Module:Road data/strings/%s", country) end return getTypeData(module, typeArg) end function p.parser(passedArgs, form) local args = {state = passedArgs.state, type = passedArgs.type, route = passedArgs.route, denom = passedArgs.denom, county = passedArgs.county, dab = passedArgs.dab, country = passedArgs.country, township = passedArgs.township} local formatStr = formatString(args, form) if not formatStr or formatStr == '' then return nil end return parser(formatStr, args, form) end return p

rqi64jh27bwoie0i9oe8ug2qthltclx

-

Module:Road data/strings/CAN/BC

<ns>828</ns>

<id>42192534</id>

-

<id>611299062</id>

610940721

2014-06-02T22:50:57Z

-

Mitchazenia

<id>548527</id>

Protected Module:Road data/strings/CAN/BC: Adjust per request, highly visible template. ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))

Scribunto

text/plain

<text bytes="310" xml:space="preserve">-- British Columbia local BC = {} BC.Hwy = {shield = {["1"] = "TCH-1 (BC).svg", ["16"] = "TCH-16 (BC).svg", default = "BC-%route%.svg"}, link = "British Columbia Highway %route%", abbr = "BC %route%"} BC.BC = BC.Hwy BC.TCH = BC.Hwy return BC

is8xn5u4vgqzcrsgp8l9aa29qe38q7h

-

Module:Road data/strings/CHN

<ns>828</ns>

<id>42146398</id>

-

<id>612457917</id>

611299347

2014-06-11T05:42:45Z

-

Bloonstdfan360

<id>18779350</id>

Asian Highways!

Scribunto

text/plain

<text bytes="17464" xml:space="preserve">-- China local CHN = {} CHN.AH = {shield = {ifexists = true, default = "Tabliczka AH%route%.svg"}, link = "AH%route%", abbr = "AH%route%"} CHN.G = {shield = {ifexists = true, default = "Kokudou %route%(China).svg"}, link = "China National Highway %route%", abbr = "G%route%"} CHN.Guodao = CHN.G CHN.X = {shield = {ifexists = true, default = "China County Road X%route%.svg"}, link = "", abbr = "X%route%"} CHN.Expwy = {shield = {ifexists = true, default = "China Expwy G%route% sign no name.svg"}, link = {["1"] = "G1 Beijing–Harbin Expressway", ["2"] = "G2 Beijing–Shanghai Expressway", ["3"] = "G3 Beijing–Taipei Expressway", ["4"] = "G4 Beijing–Hong Kong–Macau Expressway", ["5"] = "G5 Beijing–Kunming Expressway", ["6"] = "G6 Beijing–Lhasa Expressway", ["7"] = "G7 Beijing–Ürümqi Expressway", ["1W"] = "G1W Beijing–Qinhuangdao Expressway", ["3W"] = "G3W Dezhou–Shangrao Expressway", ["4E"] = "G4E Wuhan–Shenzhen Expressway", ["4W"] = "G4W Guangzhou–Macau Expressway", ["4W2"] = "G4W2 Xuchang–Guangzhou Expressway", ["4W3"] = "G4W3 Lechang–Guangzhou Expressway", ["0111"] = "G0111 Qinhuangdao–Binzhou Expressway", ["0211"] = "G0211 Tianjin–Shijiazhuang Expressway", ["0511"] = "G0511 Deyang–Dujiangyan Expressway", ["0512"] = "G0512 Chengdu–Leshan Expressway", ["0611"] = "G0611 Zhangye–Wenchuan Expressway", ["0612"] = "G0612 Xining–Hotan Expressway", ["0613"] = "G0613 Xining–Lijiang Expressway", ["0615"] = "G0615 Delhi–Barkam Expressway", ["0711"] = "G0711 Ürümqi–Ruoqiang Expressway", ["11"] = "G11 Hegang–Dalian Expressway", ["15"] = "G15 Shenyang–Haikou Expressway", ["25"] = "G25 Changchun–Shenzhen Expressway", ["35"] = "G35 Jinan–Guangzhou Expressway", ["45"] = "G45 Daqing–Guangzhou Expressway", ["55"] = "G55 Erenhot–Guangzhou Expressway", ["59"] = "G59 Hohhot–Beihai Expressway", ["65"] = "G65 Baotou–Maoming Expressway", ["69"] = "G69 Yinchuan–Baise Expressway", ["75"] = "G75 Lanzhou–Haikou Expressway", ["85"] = "G85 Yinchuan–Kunming Expressway", ["15W"] = "G15W Changshu–Taizhou Expressway", ["15W2"] = "G15W2 Changshu–Jiashan Expressway", ["15W3"] = "G15W3 Ningbo–Dongguan Expressway", ["65E"] = "G65E Yulin–Lantian Expressway", ["1111"] = "G1111 Hegang–Harbin Expressway", ["1112"] = "G1112 Ji'an–Shuangliao Expressway", ["1113"] = "G1113 Dandong–Fuxin Expressway", ["1511"] = "G1511 Rizhao–Lankao Expressway", ["1512"] = "G1512 Ningbo–Jinhua Expressway", ["1513"] = "G1513 Wenzhou–Lishui Expressway", ["1514"] = "G1514 Ningde–Shangrao Expressway", ["1515"] = "G1515 Yancheng–Jingjiang Expressway", ["1516"] = "G1516 Yancheng–Luoyang Expressway", ["1517"] = "G1517 Putian–Yanling Expressway", ["2511"] = "G2511 Xinmin–Lubei Expressway", ["2512"] = "G2512 Fuxin–Jinzhou Expressway", ["2513"] = "G2513 Huai'an–Xuzhou Expressway", ["2515"] = "G2515 Lubei–Holingol Expressway", ["2516"] = "G2516 Dongying–Lüliang Expressway", ["2517"] = "G2517 Sha County–Xiamen Expressway", ["2518"] = "G2518 Shenzhen–Cenxi Expressway", ["3511"] = "G3511 Heze–Baoji Expressway", ["4511"] = "G4511 Longnan–Heyuan Expressway", ["4512"] = "G4512 Shuangliao–Nenjiang Expressway", ["4513"] = "G4513 Naiman–Yingkou Expressway", ["4515"] = "G4515 Chifeng–Suizhong Expressway", ["5511"] = "G5511 Jining–Arun Expressway", ["5512"] = "G5512 Jincheng–Xinxiang Expressway", ["5513"] = "G5513 Changsha–Zhangjiajie Expressway", ["5515"] = "G5515 Zhangjiajie–Nanchong Expressway", ["5516"] = "G5516 Sonid–Zhangjiakou Expressway", ["6511"] = "G6511 Wuzhou–Liuzhou Expressway", ["6911"] = "G6911 Ankang–Laifeng Expressway", ["7511"] = "G7511 Qinzhou–Dongxing Expressway", ["8511"] = "G8511 Kunming–Mohan Expressway", ["8512"] = "G8512 Jinghong–Daluo Expressway", ["8513"] = "G8513 Pingliang–Mianyang Expressway", ["8515"] = "G8515 Guang'an–Luzhou Expressway", ["10"] = "G10 Suifenhe–Manzhouli Expressway", ["12"] = "G12 Hunchun–Ulanhot Expressway", ["16"] = "G16 Dandong–Xilinhot Expressway", ["18"] = "G18 Rongcheng–Wuhai Expressway", ["20"] = "G20 Qingdao–Yinchuan Expressway", ["22"] = "G22 Qingdao–Lanzhou Expressway", ["30"] = "G30 Lianyungang–Khorgas Expressway", ["36"] = "G36 Nanjing–Luoyang Expressway", ["40"] = "G40 Shanghai–Xi'an Expressway", ["42"] = "G42 Shanghai–Chengdu Expressway", ["50"] = "G50 Shanghai–Chongqing Expressway", ["56"] = "G56 Hangzhou–Ruili Expressway", ["60"] = "G60 Shanghai–Kunming Expressway", ["70"] = "G70 Fuzhou–Yinchuan Expressway", ["72"] = "G72 Quanzhou–Nanning Expressway", ["76"] = "G76 Xiamen–Chengdu Expressway", ["78"] = "G78 Shantou–Kunming Expressway", ["80"] = "G80 Guangzhou–Kunming Expressway", ["12S"] = "G12S Yanji–Changchun Expressway", ["30N"] = "G30N Lintong–Xingping Expressway", ["42S"] = "G42S Shanghai–Wuhan Expressway", ["50S"] = "G50S Shizhu–Chongqing Expressway", ["60N"] = "G60N Hangzhou–Changsha Expressway", ["1011"] = "G1011 Harbin–Tongjiang Expressway", ["1012"] = "G1012 Jiansanjiang–Heixiazi Expressway", ["1013"] = "G1013 Hailar–Zhangjiakou Expressway", ["1015"] = "G1015 Tieli–Horqin Expressway", ["1211"] = "G1211 Jilin–Heihe Expressway", ["1212"] = "G1212 Shenyang–Jilin Expressway", ["1213"] = "G1213 Bei'an–Mohe Expressway", ["1215"] = "G1215 Songjiang–Changbaishan Expressway", ["1216"] = "G1216 Ulanhot–Alide'er Expressway", ["1611"] = "G1611 Hexigten–Chengde Expressway", ["1811"] = "G1811 Huanghua–Shijiazhuang Expressway", ["1812"] = "G1812 Cangzhou–Yulin Expressway", ["1813"] = "G1813 Weihai–Qingdao Expressway", ["1815"] = "G1815 Weifang–Rizhao Expressway", ["1816"] = "G1816 Wuhai–Maqên Expressway", ["1817"] = "G1817 Wuhai–Yinchuan Expressway", ["2011"] = "G2011 Qingdao–Xinhe Expressway", ["2012"] = "G2012 Dingbian–Wuwei Expressway", ["2211"] = "G2211 Changzhi–Yan'an Expressway", ["3011"] = "G3011 Liuyuan–Golmud Expressway", ["3012"] = "G3012 Turpan–Hotan Expressway", ["3013"] = "G3013 Kashgar–Irkeshtam Expressway", ["3014"] = "G3014 Kuytun–Altay Expressway", ["3015"] = "G3015 Kuytun–Tacheng Expressway", ["3016"] = "G3016 Qingshuihe–Yining Expressway", ["3017"] = "G3017 Wuwei–Jinchang Expressway", ["3018"] = "G3018 Jinghe–Alashankou Expressway", ["3019"] = "G3019 Bole–Alashankou Expressway", ["4011"] = "G4011 Yangzhou–Liyang Expressway", ["4012"] = "G4012 Liyang–Ningde Expressway", ["4211"] = "G4211 Nanjing–Wuhu Expressway", ["4212"] = "G4212 Hefei–Anqing Expressway", ["4213"] = "G4213 Macheng–Ankang Expressway", ["4215"] = "G4215 Chengdu–Zunyi Expressway", ["4216"] = "G4216 Chengdu–Lijiang Expressway", ["4217"] = "G4217 Chengdu–Qamdo Expressway", ["4218"] = "G4218 Ya'an–Kargilik Expressway", ["4219"] = "G4219 Qüxü–Nêdong Expressway", ["5011"] = "G5011 Wuhu–Hefei Expressway", ["5012"] = "G5012 Enshi–Guangyuan Expressway", ["5013"] = "G5013 Chongqing–Chengdu Expressway", ["5611"] = "G5611 Dali–Lijiang Expressway", ["5612"] = "G5612 Dali–Lincang Expressway", ["5613"] = "G5613 Baoshan–Lushui Expressway", ["5615"] = "G5615 Tianbao–Houqiao Expressway", ["6011"] = "G6011 Nanchang–Shaoguan Expressway", ["7011"] = "G7011 Shiyan–Tianshui Expressway", ["7211"] = "G7211 Nanning–Youyiguan Expressway", ["7212"] = "G7212 Liuzhou–Beihai Expressway", ["7611"] = "G7611 Duyun–Shangri-La Expressway", ["7612"] = "G7612 Nayong–Xingyi Expressway", ["8011"] = "G8011 Kaiyuan–Hekou Expressway", ["8012"] = "G8012 Mi'le–Chuxiong Expressway", ["8013"] = "G8013 Yanshan–Wenshan Expressway", ["91"] = "G91 Liaozhong Ring Expressway", ["92"] = "G92 Hangzhou Bay Ring Expressway", ["93"] = "G93 Chengdu–Chongqing Ring Expressway", ["94"] = "G94 Pearl River Delta Ring Expressway", ["95"] = "G95 Capital Region Ring Expressway", ["98"] = "G98 Hainan Ring Expressway", ["99"] = "G99 Taiwan Ring Expressway", ["92N"] = "G92N Hangzhou–Ningbo Expressway", ["9111"] = "G9111 Benxi–Ji'an Expressway", ["9211"] = "G9211 Ningbo–Zhoushan Expressway", ["9411"] = "G9411 Dongguan–Foshan Expressway", ["9511"] = "G9511 Laishui–Laiyuan Expressway", ["9811"] = "G9811 Haikou–Sanya Expressway", ["9812"] = "G9812 Haikou–Qionghai Expressway", ["9813"] = "G9813 Wanning–Yangpu Expressway", ["0401"] = "G0401 %dab% Ring Expressway", ["0601"] = "G0601 %dab% Ring Expressway", ["1501"] = "G1501 %dab% Ring Expressway", ["2001"] = "G2001 %dab% Ring Expressway", ["2501"] = "G2501 %dab% Ring Expressway", ["3001"] = "G3001 %dab% Ring Expressway", ["4201"] = "G4201 %dab% Ring Expressway", ["6001"] = "G6001 %dab% Ring Expressway", ["0102"] = "G0102 Changchun Ring Expressway", ["1001"] = "G1001 Harbin Ring Expressway", ["1101"] = "G1101 Dalian Ring Expressway", ["1502"] = "G1502 Quanzhou Ring Expressway", ["1503"] = "G1503 Xiamen Ring Expressway", ["2201"] = "G2201 Changzhi Ring Expressway", ["4001"] = "G4001 Hefei Ring Expressway", ["4202"] = "G4202 Chengdu Second Ring Expressway", ["4501"] = "G4501 Beijing Ring Expressway", ["5001"] = "G5001 Chongqing Ring Expressway", ["5501"] = "G5501 Datong Ring Expressway", ["5503"] = "G5503 Jincheng Ring Expressway", ["5601"] = "G5601 Kunming Ring Expressway", ["7201"] = "G7201 Nanning Ring Expressway"}, abbr = "G%route%"} CHN.Ex = CHN.Expwy CHN.S = {shield = {hook = "mask", mask = "Road data/masks/CHN", base = "state", masked = "province", default = {ifexists = true, default = "[province||%province% Expwy S%route% sign no name.svg|Shoudou %route%(China).svg]", otherwise = {ifexists = true, default = "Shoudou %route%(China).svg"}}}, link = {arg = "state", ["SH"] = {["1"] = "S1 Yingbin Expressway", ["2"] = "S2 Shanghai–Luchaogang Expressway", ["3"] = "S3 Shanghai–Fengxian Expressway", ["4"] = "S4 Shanghai–Jinshan Expressway", ["5"] = "S5 Shanghai–Jiading Expressway", ["6"] = "S6 Shanghai–Nanxiang Expressway", ["19"] = "S19 Xinnong–Jinshanwei Expressway", ["20"] = "S20 Outer Ring Expressway", ["26"] = "Shanghai–Changzhou Expressway", ["32"] = "Shanghai–Jiaxing–Huzhou Expressway", ["36"] = "S36 Tinglin–Fengjing Expressway"}, ["JS"] = {["5"] = "S5 Changshu–Jiashan Expressway", ["9"] = "S9 Suzhou–Shaoxing Expressway", ["19"] = "S19 Nantong–Wuxi Expressway", ["29"] = "S29 Yancheng–Jingjiang Expressway", ["35"] = "S35 Taizhou–Zhenjiang Expressway", ["39"] = "S39 Jiangdu–Yixing Expressway", ["45"] = "S45 Yixing–Hangzhou Expressway", ["49"] = "S49 Xinyi–Yangzhou Expressway", ["51"] = "S51 Liyang–Huangshan Expressway", ["55"] = "S55 Nanjing–Xuancheng Expressway", ["59"] = "S59 Nanjing–Hexian Expressway", ["65"] = "S65 Xuzhou–Mingguang Expressway", ["69"] = "S69 Jinan–Xuzhou Expressway", ["8"] = "S8 Siyang–Suzhou Expressway", ["18"] = "S18 Yancheng–Huai'an Expressway", ["22"] = "S22 Yizheng–Nanjing Expressway", ["28"] = "S28 Qidong–Yangzhou Expressway", ["32"] = "S32 Chongming–Haimen Expressway", ["38"] = "S38 Changshu–Hefei Expressway", ["48"] = "S48 Shanghai–Yixing Expressway", ["58"] = "Shanghai–Changzhou Expressway", ["68"] = "S68 Liyang–Wuhu Expressway", ["72"] = "S72 Port of Lianyungang North Port Expressway", ["73"] = "S73 Port of Lianyungang East Port Expressway", ["75"] = "S75 Funing–Xinghua–Taizhou Branch Expressway", ["79"] = "S79 Nantong Branch Expressway", ["80"] = "S80 Port of Taicang North Port Expressway", ["81"] = "S81 Port of Taicang South Port Expressway", ["82"] = "S82 Port of Zhangjiagang Port Expressway", ["83"] = "S83 Wuxi Branch Expressway", ["85"] = "S85 Liyang Branch Expressway", ["86"] = "S86 Zhenjiang Branch Expressway", ["87"] = "S87 Nanjing Branch Expressway", ["88"] = "S88 Nanjing Lukou International Airport Expressway", ["92"] = "S92 Jinhu Branch Expressway", ["96"] = "S96 Suqian Branch Expressway"}}, abbr = {hook = "mask", mask = "Road data/masks/CHN", base = "state", masked = "province", default = "[province||%province%|] S%route%"}} return CHN

gc588f2w7rvh7kenwbc90eebrg9mh1b

-

Module:Road data/strings/DEU

<ns>828</ns>

<id>42091643</id>

-

<id>638545974</id>

637095668

2014-12-17T20:47:00Z

-

TheWombatGuru

<id>18656920</id>

L doesn't need its own pages, but it should be inserted using Jct imo

Scribunto

text/plain

<text bytes="492" xml:space="preserve">-- Germany local DEU = {} DEU.E = {shield = "European_Road_%route%_number_DE.svg", link = "European route E%route% in Germany", abbr = "E %route%"} DEU.A = {shield = "Bundesautobahn %route% number.svg", link = "Bundesautobahn %route%", abbr = "A %route%"} DEU.B = {shield = "Bundesstraße %route% number.svg", link = "Bundesstraße %route%", abbr = "B %route%"} DEU.L = {abbr = "L %route%"} return DEU

tn4nle1d2u6dim30jzcoq0scgx17mgd

-

Module:Road data/strings/GBR

<ns>828</ns>

<id>42137583</id>

-

<id>611885385</id>

611885197

2014-06-06T23:35:41Z

-

Fredddie

<id>221304</id>

try this

Scribunto

text/plain

<text bytes="933" xml:space="preserve">-- United Kingdom local GBR = {} GBR.E = {shield = "Tabliczka E%route%.svg", link = "European route E%route%", abbr = "E%route%"} GBR.A = {shield = {ifexists = true, default = "UK road A%route%.svg", otherwise = "UK road A%route%.PNG"}, link = "A%route% road ([state|NI|Northern Ireland|Great Britain])", abbr = "A%route%"} GBR.B = {shield = {ifexists = true, default = "UK road B%route%.svg", otherwise = {ifexists = true, default = "UK road B%route%.png"}}, link = "", abbr = "B%route%"} GBR.M = {shield = "UK-Motorway-M%route%.svg", link = "M%route% motorway [state|NI|(Northern Ireland)|][state|SCO|(Scotland)|]", abbr = "M%route%"} GBR.AM = {shield = "UK-Motorway-A%route% (M).svg", link = "A%route%(M) motorway", abbr = "A%route%(M)"} return GBR

pvfcqulycgaxic95idyntjfcwx9qzy6

-

Module:Road data/strings/HRV

<ns>828</ns>

<id>42136252</id>

-

<id>611299472</id>

598520293

2014-06-02T22:55:06Z

-

Mitchazenia

<id>548527</id>

Protected Module:Road data/strings/HRV: Adjust per request, highly visible template. ([Edit=Allow only autoconfirmed users] (indefinite) [Move=Allow only administrators] (indefinite))

Scribunto

text/plain

<text bytes="752" xml:space="preserve">-- Croatia local HRV = {} HRV.E = {shield = "E%route%-HR.svg", link = "European route E%route%", abbr = "E%route%"} HRV.A = {shield = "Autocesta A%route%.svg", link = "A%route% (Croatia)", abbr = "A%route%"} HRV.B = {shield = "Brza cesta B%route%.svg", link = "B%route% (Croatia)", abbr = "B%route%"} HRV.D = {shield = "Državna cesta D%route%.svg", link = "D%route% road (Croatia)", abbr = "D%route%"} HRV.L = {shield = "L%route%-HR.svg", link = "", abbr = "L%route%"} HRV.Z = {shield = "Z%route%-HR.svg", link = {ifexists = true, default = "Ž%route% road (Croatia)"}, abbr = "Ž%route%"} HRV["Ž"] = HRV.Z return HRV

g6qa42iicw1azk0o3kh5p7ucj4hnyjb

-

Module:Road data/strings/USA/FL

<ns>828</ns>

<id>41534816</id>

-

<id>636987702</id>

636987648

2014-12-07T06:37:10Z

-

Imzadi1979

<id>488581</id>

fix

Scribunto

text/plain

<text bytes="3954" xml:space="preserve">--Florida local FL = {} FL.I = {shield = "I-%route%.svg", link = "Interstate %route% (Florida)", abbr = "I&#8209;%route%", width = "expand"} FL.US = {shield = "US %route%.svg", link = "U.S. Route %route% in Florida", abbr = "US %route%", width = "expand"} FL["US-Alt"] = {shield = FL.US.shield, link = "U.S. Route %route% Alternate ([dab||%dab%, |]Florida)", abbr = "US %route% Alt.", banner = "Alt plate.svg", width = "expand"} FL["US-Bus"] = {shield = FL.US.shield, link = "U.S. Route %route% Business ([dab||%dab%, |]Florida)", abbr = "US %route% Bus.", banner = "Business plate.svg", width = "expand"} FL["US-Truck"] = {shield = FL.US.shield, link = "U.S. Route %route% Truck ([dab||%dab%, |]Florida)", abbr = "US %route% Truck", banner = "Truck plate.svg", width = "expand"} FL.SR = {shield = "Florida %route%.svg", link = "Florida State Road %route% [dab||(%dab%)|]", abbr = "SR %route%", width = "expand"} FL.FL = FL.SR FL.Both = {shield = {"Toll Florida %route%.svg", "Florida %route%.svg"}, link = FL.SR.link, abbr = FL.SR.abbr, width = 45} FL.Dual = FL.Both FL.CR = {shield = "CR %route% jct.svg", link = "County Road %route% ([county||%county% County, |]Florida)", abbr = "CR %route%"} FL["CR-Alt"] = {shield = "CR %route% jct.svg", link = "County Road %route% Alternate ([county||%county% County, |]Florida)", abbr = "CR %route% Alt.", banner = "Alt plate county.svg"} FL["CR-Old"] = {shield = "CR %route% jct.svg", link = "Old County Road %route% ([county||%county% County, |]Florida)", abbr = "Old CR %route%", banner = "Old plate county.svg"} FL["CR-Truck"] = {shield = "CR %route% jct.svg", link = "County Road %route% Truck ([county||%county% County, |]Florida)", abbr = "CR %route% Truck", banner = "Truck plate county.svg"} FL["City"] = {shield = "", link = "City Road %route% (%dab%, Florida)", abbr = "City Road %route%"} FL.FLTP = {shield = "Florida's Turnpike shield.png", link = "Florida's Turnpike", abbr = "Turnpike"} FL.HEFT = {shield = "Florida's Turnpike shield.png", link = "Homestead Extension of Florida's Turnpike", abbr = "Turnpike Extension"} FL.Toll = {shield = "Toll Florida %route%.svg", link = "Florida State Road %route% [dab||(%dab%)|]", abbr = "SR %route%"} FL["SR-Alt"] = {shield = "Florida %route%.svg", link = "Florida State Road %route% Alternate [dab||(%dab%)|]", abbr = "SR %route% Alt.", banner = "Alt plate.svg", width = "expand"} FL["SR-Bus"] = {shield = "Florida %route%.svg", link = "Florida State Road %route% Business [dab||(%dab%)|]", abbr = "SR %route% Bus.", banner = "Business plate.svg", width = "expand"} FL["SR-Truck"] = {shield = "Florida %route%.svg", link = "Florida State Road %route% Truck", abbr = "SR %route% Truck", banner = "Truck plate.svg", width = "expand"} FL.FH = {shield = "Forest Route %route%.svg", link = "", abbr = "FH-%route%"} FL.FR = {shield = "", link = "", abbr = "FR %route%"} FL.GA = {alias = {module = "USA/GA", type = "SR"}} FL.null = {shield = "No image.svg", link = "%route% [dab||(%dab%)|]", abbr = "%route%"} return FL

ipazj5r3hv4u7wqezuqaf9lbs8nvmo8

-

Module:Road data/strings/USA/IL

<ns>828</ns>

<id>41543355</id>

-

<id>635227971</id>

614237691

2014-11-24T12:06:07Z

-

NE2

<id>1757249</id>

I-Bus

Scribunto

text/plain

<text bytes="4891" xml:space="preserve">--Illinois local IL = {} IL.I = {shield = "I-%route%.svg", link = "Interstate %route% (Illinois)", abbr = "I-%route%", width = "expand"} IL.BL = {shield = "Business Loop %route%.svg", link = "Interstate %route% Business ([dab||%dab%, |]Illinois)", abbr = "I-%route% Bus.", width = "expand"} IL["I-Bus"]=IL.BL IL.US = {shield = "US %route%.svg", link = "U.S. Route %route% in Illinois", abbr = "US %route%", width = "expand"} IL["US-Alt"] = {shield = IL.US.shield, link = "U.S. Route %route% Alternate ([dab||%dab%, |]Illinois)", abbr = "US %route% Alt.", banner = "Alt plate.svg", width = "expand"} IL["US-Bus"] = {shield = IL.US.shield, link = "U.S. Route %route% Business ([dab||%dab%, |]Illinois)", abbr = "US %route% Bus.", banner = "Business plate.svg", width = "expand"} IL["US-Hist"] = {shield = {["66"] = "US 66 (historic).svg", default = ""}, link = "U.S. Route %route% in Illinois", abbr = "Historic US %route%[dab|| (%dab%)|]", width = 16} IL["US 1926"] = {shield = "US %route% Illinois 1926.svg", link = IL.US.link, abbr = IL.US.abbr, width = "US1926"} IL.IL = {shield = "Illinois %route%.svg", link = "Illinois Route %route%", abbr = "IL %route%", width = "expand"} IL["IL 1926"] = {shield = "Illinois %route% (1926).svg", link = IL.IL.link, abbr = IL.IL.abbr} IL.Toll = {shield = "Indiana Toll Road logo 1968.svg", link = "Indiana Toll Road", abbr = "Indiana Toll Road"} IL.Skyway = {shield = "Chicago Skyway logo.svg", link = "Chicago Skyway", abbr = "Chicago Skyway"} IL.Tour = {shield = {default = "Great Lakes Circle Tour.svg", LSCT = "Lake Superior Circle Tour.svg", LMCT = "Lake Michigan Circle Tour.svg", LHCT = "Lake Huron Circle Tour.svg", LECT = "Lake Erie Circle Tour.svg", ["LSCT-Spur"] = "Lake Superior Circle Tour brown.svg", ["LMCT-Spur"] = "Lake Michigan Circle Tour brown.svg", ["LHCT-Spur"] = "Lake Huron Circle Tour brown.svg"}, link = {default = "Great Lakes Circle Tour", LSCT = "Lake Superior Circle Tour", LMCT = "Lake Michigan Circle Tour", LHCT = "Lake Huron Circle Tour", LECT = "Lake Erie Circle Tour", ["LSCT-Spur"] = "Lake Superior Circle Tour", ["LMCT-Spur"] = "Lake Michigan Circle Tour", ["LHCT-Spur"] = "Lake Huron Circle Tour"}, abbr = {default = "GLCT", LSCT = "LSCT", LMCT = "LMCT", LHCT = "LHCT", LECT = "LECT", ["LSCT-Spur"] = "LSCT Spur", ["LMCT-Spur"] = "LMCT Spur", ["LHCT-Spur"] = "LHCT Spur"} } IL.Lincoln = {shield = "LincolnHighwayMarker.svg", link = "Lincoln Highway in Illinois", abbr = "Lincoln Highway", width = 14} IL.National = {shield = "National Road Sign cropped.JPG", --should be improved link = "National Road", abbr = "Historic National Road"} IL.GRR = {shield = "GreatRiverRoad.svg", link = "Great River Road", abbr = "Great River Road [route||(%route% Route)|]", banner = {arg = "route", default = "", National = "National Route plate.svg", ["Alternate National"] = "Alternate plate.svg", Alternate = "Alternate plate.svg"}} IL["GRR-Spur"] = {shield = "GreatRiverRoad brown.svg", link = "Great River Road", abbr = "Great River Road spur", banner = "Spur plate brown.svg"} IL.LHT = {shield = "Lincoln Heritage Trail.png", link = "Lincoln Heritage Trail", abbr = "Lincoln Heritage Trail [route||(%route%)|]"} IL.MGR = {shield = "", link = "Meeting of the Great Rivers Scenic Route", abbr = "Meeting of the Great Rivers"} IL.IRR = {shield = "", link = "Illinois River Road", abbr = "Illinois River Road"} IL.CR = {shield = "CR %route% jct.svg", link = "", abbr = "CR %route%"} IL.CKC = {shield = "Illinois 110.svg", link = "Chicago–Kansas City Expressway", abbr = "IL 110 (CKC)", banner = "CKC plate.svg", width = "wide"} return IL

n5nw6oa67tu36245dqo884yepfm1g52

-

Module:Road data/strings/USA/MI

<ns>828</ns>

<id>41558662</id>

-

<id>634922942</id>

634922904

2014-11-22T04:41:12Z

-

Imzadi1979

<id>488581</id>

fix

Scribunto

text/plain

<text bytes="12567" xml:space="preserve">--Michigan local MI = {} MI.I = {shield = "I-%route%.svg", link = {["96"] = "Interstate 96", ["196"] = "Interstate 196", ["296"] = "Interstate 296", ["496"] = "Interstate 496", ["696"] = "Interstate 696", default = {hook = "split", split = 100, above = "Interstate %route% (Michigan)", below = "Interstate %route% in Michigan"}}, abbr = "I‑%route%", width = "expand"} MI["I 1957"] = {shield = "I-%route% (MI 1957).svg", link = MI.I.link, abbr = MI.I.abbr} MI.BL = {shield = "Business Loop %route%.svg", link = "Interstate %route% Business ([dab||%dab%, |]Michigan)", abbr = "BL I‑%route%", width = "expand"} MI.BS = {shield = "Business Spur %route%.svg", link = "Interstate %route% Business ([dab||%dab%, |]Michigan)", abbr = "BS I‑%route%", width = "expand"} MI["BL 1957"] = {shield = "Business Loop %route% (1957).svg", link = MI.BL.link, abbr = MI.BL.abbr} MI["BS 1957"] = {shield = "Business Spur %route% (1957).svg", link = MI.BS.link, abbr = MI.BS.abbr} MI.US = {shield = "US %route%.svg", link = {["8"] = "U.S. Route 8", ["102"] = "U.S. Route 102", ["112"] = "U.S. Route 112", ["131"] = "U.S. Route 131", ["141"] = "U.S. Route 141", ["223"] = "U.S. Route 223", default ="U.S. Route %route% in Michigan"}, abbr = "US %route%", width = "expand"} MI["US 1926"] = {shield = "US %route% Michigan 1926.svg", link = MI.US.link, abbr = MI.US.abbr, width = "US1926"} MI["US 1948"] = {shield = "US %route% Michigan 1948.svg", link = MI.US.link, abbr = MI.US.abbr, width = "US1926"} MI["US 1961"] = MI["US 1948"] -- MI did not use the 1961 version and continued to use the 1948 MI.M = {shield = {["185"] = "M-185 (MISPC).svg", ["331"] = "", ["554"] = "", default ="M-%route%.svg"}, link = "M-%route% ([dab||%dab% |]Michigan highway)", abbr = "M‑%route%"} MI.MI = MI.M MI["M 1919"] = {shield = "M-%route% 1919.svg", link = MI.M.link, abbr = MI.M.abbr} MI["M 1926"] = {shield = "M-%route% 1926.svg", link = MI.M.link, abbr = MI.M.abbr} MI["M 1948"] = {shield = "M-%route% 1948.svg", link = MI.M.link, abbr = MI.M.abbr} MI.CDH = {shield ="County %route%.svg", link = "%route% (Michigan county highway)", abbr = "%route%"} MI.CR = {shield = "Michigan %route% %county% County.svg", link = {ifexists = true, default = "County Road %route% (%county% County, Michigan)"}, abbr = "CR %route%"} MI.FFH = {shield = "Forest Route %route%.svg", link = "Forest Highway %route%", abbr = "FFH %route%"} MI.Tour = {shield = {default = "Great Lakes Circle Tour.svg", LSCT = "Lake Superior Circle Tour.svg", LMCT = "Lake Michigan Circle Tour.svg", LHCT = "Lake Huron Circle Tour.svg", LECT = "Lake Erie Circle Tour.svg", ["LSCT-Spur"] = "Lake Superior Circle Tour brown.svg", ["LMCT-Spur"] = "Lake Michigan Circle Tour brown.svg", ["LHCT-Spur"] = "Lake Huron Circle Tour brown.svg"}, link = {default = "Great Lakes Circle Tour", LSCT = "Lake Superior Circle Tour", LMCT = "Lake Michigan Circle Tour", LHCT = "Lake Huron Circle Tour", LECT = "Lake Erie Circle Tour", ["LSCT-Spur"] = "Lake Superior Circle Tour", ["LMCT-Spur"] = "Lake Michigan Circle Tour", ["LHCT-Spur"] = "Lake Huron Circle Tour"}, abbr = {default = "GLCT", LSCT = "LSCT", LMCT = "LMCT", LHCT = "LHCT", LECT = "LECT", ["LSCT-Spur"] = "LSCT Spur", ["LMCT-Spur"] = "LMCT Spur", ["LHCT-Spur"] = "LHCT Spur"} } MI["Capitol Loop"] = {shield = "CapitolLoop.svg", link = "Capitol Loop", abbr = "Capitol Loop"} MI["US-Alt"] = {shield = MI.US.shield, link = "U.S. Route %route% Alternate ([dab||%dab%, |]Michigan)", abbr = "ALT US %route%", banner = "Alt plate.svg", width = "expand"} MI["US-Bus"] = {shield = MI.US.shield, link = "U.S. Route %route% Business ([dab||%dab%, |]Michigan)", abbr = "BUS US %route%", banner = "Business plate.svg", width = "expand"} MI["US-Byp"] = {shield = MI.US.shield, link = "U.S. Route %route% Bypass ([dab||%dab%, |]Michigan)", abbr = "BYP US %route%", banner = "By-pass plate.svg", width = "expand"} MI["US-Conn"] = {shield = MI.US.shield, link = "U.S. Route %route% Connector ([dab||%dab%, |]Michigan)", abbr = "CONN US %route%", banner = "Connector plate.svg", width = "expand"} MI["US-Emerg"] = {shield = MI.US.shield, link = "U.S. Route %route% Emergency ([dab||%dab%, |]Michigan)", abbr = "Emergency US %route%", banner = "Emergency plate.svg", width = "expand"} MI["US-Truck"] = {shield = MI.US.shield, link = "U.S. Route %route% Truck ([dab||%dab%, |]Michigan)", abbr = "TRUCK US%route%", banner = "Truck plate.svg", width = "expand"} MI["US 1926-Alt"] = {shield = MI["US 1926"].shield, link = MI["US-Alt"].link, abbr = MI["US-Alt"].abbr, banner = MI["US-Alt"].banner, width = 'US1926'} MI["US 1926-Bus"] = {shield = MI["US 1926"].shield, link = MI["US-Bus"].link, abbr = MI["US-Bus"].abbr, banner = "Business plate old.svg", width = 'US1926'} MI["US 1926-Byp"] = {shield = MI["US 1926"].shield, link = MI["US-Byp"].link, abbr = MI["US-Byp"].abbr, banner = MI["US-Byp"].banner, width = 'US1926'} MI["US 1926-Conn"] = {shield = MI["US 1926"].shield, link = MI["US-Byp"].link, abbr = MI["US-Byp"].abbr, banner = MI["US-Conn"].banner, width = 'US1926'} MI["US 1926-Truck"] = {shield = MI["US 1926"].shield, link = MI["US-Truck"].link, abbr = MI["US-Truck"].abbr, banner = MI["US-Truck"].banner, width = 'US1926'} MI["US 1948-Alt"] = {shield = MI["US 1948"].shield, link = MI["US-Alt"].link, abbr = MI["US-Alt"].abbr, banner = MI["US-Alt"].banner, width = 'US1926'} MI["US 1948-Bus"] = {shield = MI["US 1948"].shield, link = MI["US-Bus"].link, abbr = MI["US-Bus"].abbr, banner = MI["US-Bus"].banner, width = 'US1926'} MI["US 1948-Byp"] = {shield = MI["US 1948"].shield, link = MI["US-Byp"].link, abbr = MI["US-Byp"].abbr, banner = MI["US-Byp"].banner, width = 'US1926'} MI["US 1948-Conn"] = {shield = MI["US 1948"].shield, link = MI["US-Byp"].link, abbr = MI["US-Byp"].abbr, banner = MI["US-Conn"].banner, width = 'US1926'} MI["US 1948-Truck"] = {shield = MI["US 1948"].shield, link = MI["US-Truck"].link, abbr = MI["US-Truck"].abbr, banner = MI["US-Truck"].banner, width = 'US1926'} MI["US 1961-Alt"] = MI["US 1948-Alt"] MI["US 1961-Bus"] = MI["US 1948-Bus"] MI["US 1961-Byp"] = MI["US 1948-Byp"] MI["US 1961-Conn"] = MI["US 1948-Conn"] MI["US 1961-Truck"] = MI["US 1948-Truck"] MI["M-Alt"] = {shield = MI.M.shield, link = "M-%route% Alternate ([dab||%dab%, Michigan|Michigan highway])", abbr = "ALT M‑%route%", banner = "Alt plate.svg"} MI["MI-Alt"] = MI["M-Alt"] MI["M-Bus"] = {shield = MI.M.shield, link = "M-%route% Business ([dab||%dab%, Michigan|Michigan highway])", abbr = "BUS M‑%route%", banner = "Business plate.svg"} MI["MI-Bus"] = MI["M-Bus"] MI["M-Byp"] = {shield = MI.M.shield, link = "M-%route% Bypass ([dab||%dab%, Michigan|Michigan highway])", abbr = "BYP M‑%route%", banner = "By-pass plate.svg"} MI["MI-Byp"] = MI["M-Byp"] MI["M-Conn"] = {shield = MI.M.shield, link = "M-%route% Connector (Michigan highway)", abbr = "CONN M‑%route%", banner = "Connector plate.svg"} MI["MI-Conn"] = MI["M-Conn"] MI["M-Truck"] = {shield = MI.M.shield, link = "M-%route% Truck ([dab||%dab%, Michigan|Michigan highway])", abbr = "TRUCK M‑%route%", banner = "Truck plate.svg"} MI["MI-Truck"] = MI["M-Truck"] MI["M 1926-Alt"] = {shield = MI["M 1926"].shield, link = MI["M-Alt"].link, abbr = MI["M-Alt"].abbr, banner = "Alt plate.svg"} MI["M 1926-Bus"] = {shield = MI["M 1926"].shield, link = MI["M-Bus"].link, abbr = MI["M-Bus"].abbr, banner = "Business plate.svg"} MI["M 1926-Byp"] = {shield = MI["M 1926"].shield, link = MI["M-Byp"].link, abbr = MI["M-Byp"].abbr, banner = "By-pass plate.svg"} MI["M 1926-Conn"] = {shield = MI["M 1926"].shield, link = MI["M-Byp"].link, abbr = MI["M-Byp"].abbr, banner = "Connector plate.svg"} MI["M 1926-Truck"] = {shield = MI["M 1926"].shield, link = MI["M-Truck"].link, abbr = MI["M-Truck"].abbr, banner = "Truck plate.svg"} MI["M 1948-Alt"] = {shield = MI["M 1948"].shield, link = MI["M-Alt"].link, abbr = MI["M-Alt"].abbr, banner = "Alt plate.svg"} MI["M 1948-Bus"] = {shield = MI["M 1948"].shield, link = MI["M-Bus"].link, abbr = MI["M-Bus"].abbr, banner = "Business plate.svg"} MI["M 1948-Byp"] = {shield = MI["M 1948"].shield, link = MI["M-Byp"].link, abbr = MI["M-Byp"].abbr, banner = "By-pass plate.svg"} MI["M 1948-Conn"] = {shield = MI["M 1948"].shield, link = MI["M-Conn"].link, abbr = MI["M-Conn"].abbr, banner = "Connector plate.svg"} MI["M 1948-Truck"] = {shield = MI["M 1948"].shield, link = MI["M-Truck"].link, abbr = MI["M-Truck"].abbr, banner = "Truck plate.svg"} MI.WI = {alias = {module = "USA/WI", type = "WI"}} MI["US-WI"] = {alias = {module = "USA/WI", type = "US"}} MI.IN = {alias = {module = "USA/IN", type = "IN"}} MI["US-IN"] = {alias = {module = "USA/IN", type = "US"}} MI.OH = {alias = {module = "USA/OH", type = "OH"}} MI["US-OH"] = {alias = {module = "USA/OH", type = "US"}} MI.ON = {alias = {module = "CAN/ON", type = "ON"}} MI.BlankM = {shield = "No image.svg", link = MI.M.link, abbr = MI.M.abbr} MI["BlankM-Conn"] = {shield = MI.BlankM.shield, link = MI["M-Conn"].link, abbr = MI["M-Conn"].abbr} return MI

8ujhgtc4vh6lexw4cjogfmlqw2tqbmh

-

Module:Road data/strings/USA/NY

<ns>828</ns>

<id>41559309</id>

-

<id>628876678</id>

628873694

2014-10-09T03:37:14Z

-

C16sh

<id>11899613</id>

thruway abbreviation based on logo

Scribunto

text/plain

<text bytes="10943" xml:space="preserve">--New York local NY = {} NY.I = {shield = "I-%route%.svg", link = "Interstate %route% (New York)", abbr = "I-%route%", width = "expand"} NY["I-Future"] = {shield = "I-%route% (Future).svg", link = NY.I.link, abbr = "Future I-%route%", width = "expand"} NY.Future=NY["I-Future"] NY["I 1957"] = {shield = "I-%route% (NY 1957).svg", link = NY.I.link, abbr = NY.I.abbr} NY.BL = {shield = "Business Loop %route%.svg", link = "Interstate %route% Business ([dab||%dab%, |]New York)", abbr = "I-%route% Bus.", width = "expand"} NY.US = {shield = "US %route%.svg", link = "U.S. Route %route% in New York", abbr = "US %route%", width = "expand"} NY["US 1926"] = {shield = "US %route% New York 1926.svg", link = NY.US.link, abbr = NY.US.abbr} NY["US 1948"] = {shield = "US %route% (1948).svg", link = NY.US.link, abbr = NY.US.abbr} NY["US 1961"] = {shield = "US %route% (1961).svg", link = NY.US.link, abbr = NY.US.abbr} NY["US-Bus"] = {shield = NY.US.shield, link = "U.S. Route %route% Business ([dab||%dab%, |]New York)", abbr = "US %route% Bus.", banner = "Business plate.svg", width = "expand"} NY["US-Truck"] = {shield = NY.US.shield, link = "U.S. Route %route% Truck ([dab||%dab%, |]New York)", abbr = "US %route% Truck", banner = "Truck plate.svg", width = "expand"} NY.NY = {shield = "NY-%route%.svg", link = "New York State Route %route% [dab||(%dab%)|]", abbr = "NY %route%", width = "expand"} NY.SR = NY.NY NY["NY 1927"] = {shield = "NY-%route% (1927).svg", link = NY.NY.link, abbr = NY.NY.abbr} NY["NY 1948"] = {shield = "NY-%route% (1948).svg", link = NY.NY.link, abbr = NY.NY.abbr} NY["NY 1955"] = {shield = "NY-%route% (1955).svg", link = NY.NY.link, abbr = NY.NY.abbr} NY["NY 1960"] = {shield = "NY-%route% (1960).svg", link = NY.NY.link, abbr = NY.NY.abbr} NY["NY-Alt"] = {shield = NY.NY.shield, link = "New York State Route %route% Alternate [dab||(%dab%)|]", abbr = "NY %route% Alt.", banner = "Alt plate.svg", width = "expand"} NY["NY-Bus"] = {shield = NY.NY.shield, link = "New York State Route %route% Business [dab||(%dab%)|]", abbr = "NY %route% Bus.", banner = "Business plate.svg", width = "expand"} NY["NY-Spur"] = {shield = NY.NY.shield, link = "New York State Route %route% Spur [dab||(%dab%)|]", abbr = "NY %route% Spur", banner = "Spur plate.svg", width = "expand"} NY["NY-Truck"] = {shield = NY.NY.shield, link = "New York State Route %route% Truck [dab||(%dab%)|]", abbr = "NY %route% Truck", banner = "Truck plate.svg", width = "expand"} NY.NYST = {shield = "NYS Thruway Sign.svg", link = "New York State Thruway", abbr = "New York Thruway"} NY.NYBC = {shield = "NYS Thruway Sign.svg", link = "Berkshire Connector", abbr = "Berkshire Connector"} NY.CR = {shield = {ifexists = true, arg = "county", -- default = "CR %route% jct.svg", Albany = "CR %route% jct wide.svg", Cayuga = "", Columbia = {["21C"] = "CR 21C jct wide.svg", default = "CR %route% jct.svg"}, Clinton = "", Cortland = "", Dutchess = "Dutchess County %route%.svg", Erie = "Erie County %route% NY.svg", Franklin = "Franklin County %route% NY.svg", Fulton = "CR %route% jct wide.svg", Genesee = "", Herkimer = "", Monroe = "", Montgomery = "", Nassau = "", Niagara = "", Onandaga = {["57"] = "CR 57 jct.svg", default = ""}, Oneida = {["840"] = "CR 840 jct wide.svg", default = "CR %route% jct.svg"}, Ontario = "", Orange = "CR %route% jct.svg", Orleans = "", Schenectady = "", Seneca = "", Steuben = {["333"] = "CR 333 jct wide.svg", default = "CR %route% jct.svg"}, Suffolk = "CR %route% jct.svg", Ulster = "CR %route% jct.svg", Wayne = "", Westcheser = "", Wyoming = "", Yates = ""}, link = "County Route %route% (%county% County, New York)", --ifexist abbr = "CR %route%", width = {ifexists = true, arg = "county", default = "square", Albany = "wide", Columbia = {["21C"] = "wide", default = "square"}, Erie = "16", Fulton = "wide", Oneida = {["840"] = "wide", default = "square"}, Steuben = {["333"] = "wide", default = "square"}} } NY.ILR = {shield = "Rochester Inner Loop.svg", link = "Inner Loop (Rochester)", abbr = "Inner Loop", width = "wide"} NY.LSEX = {shield = "LaSalle Expy.svg", link = "LaSalle Expressway", abbr = "LaSalle Expressway"} NY.STE = {shield = "Southern Tier Expressway.svg", link = "Southern Tier Expressway", abbr = "Southern Tier Expressway"} NY.Parkway = {shield = {default = "%route% Pkwy Shield.svg", Bay = "", ["Long Mountain"] = ""}, link = {default = "%route% Parkway [dab||(%dab%)|]", ["Arden Valley"] = "Arden Valley Road", ["Tiorati Brook"] = "Tiorati Brook Road", Northern = "Northern State Parkway", Southern = "Southern State Parkway", Taconic = "Taconic State Parkway", ["Bear Mountain"] = "Bear Mountain State Parkway", ["Lake Ontario"] = "Lake Ontario State Parkway", Sagtikos = "Sagtikos State Parkway", Meadowbrook = "Meadowbrook State Parkway", Bethpage = "Bethpage State Parkway", Wantagh = "Wantagh State Parkway", Heckscher = "Heckscher State Parkway", ["Sunken Meadow"] = "Sunken Meadow State Parkway", Caumsett = "Caumsett State Parkway", ["Robert Moses"] = "Robert Moses State Parkway", FDR = "Franklin D. Roosevelt East River Drive", ["Harlem River"] = "Harlem River Drive", ["Seven Lakes"] = "Seven Lakes Drive", Palisades = "Palisades Interstate Parkway", ["Saw Mill"] = "Saw Mill River Parkway", ["Robert Moses Cswy"] = "Robert Moses Causeway"}, abbr = {default = "%route% Parkway", ["Arden Valley"] = "Arden Valley Road", ["Tiorati Brook"] = "Tiorati Brook Road", Northern = "Northern State Parkway", Southern = "Southern State Parkway", FDR = "FDR Drive", Taconic = "Taconic State Parkway", ["Harlem River"] = "Harlem River Drive", ["Seven Lakes"] = "Seven Lakes Drive", ["Saw Mill"] = "Saw Mill River Parkway", ["Robert Moses Cswy"] = "Robert Moses Causeway"}, width = {default = 'wide', ["Arden Valley"] = 'square', Bethpage = 'square', Caumsett = 'square', Heckscher = 'square', ["Lake Ontario"] = 'square', ["Lake Welch"] = 'square', Loop = 'square', Meadowbrook = 'square', Northern = 'square', Ocean = 'square', Palisades = 'square', Ponquogue = 'square', ["Robert Moses"] = 'square', ["Robert Moses Cswy"] = 'square', Sagtikos = 'square', ["Seven Lakes"] = 'square', ["Sound Shore"] = 'square', Southern = 'square', ["Sunken Meadow"] = 'square', ["Tiorati Brook"] = 'square', Wantagh = 'square'} } NY.NJ = {alias = {module = "USA/NJ", type = "NJ"}} NY.CT = {alias = {module = "USA/CT", type = "CT"}} NY.Tour = {shield = {default = "Great Lakes Circle Tour.svg", LSCT = "Lake Superior Circle Tour.svg", LMCT = "Lake Michigan Circle Tour.svg", LHCT = "Lake Huron Circle Tour.svg", LECT = "Lake Erie Circle Tour.svg", ["LSCT-Spur"] = "Lake Superior Circle Tour brown.svg", ["LMCT-Spur"] = "Lake Michigan Circle Tour brown.svg", ["LHCT-Spur"] = "Lake Huron Circle Tour brown.svg"}, link = {default = "Great Lakes Circle Tour", LSCT = "Lake Superior Circle Tour", LMCT = "Lake Michigan Circle Tour", LHCT = "Lake Huron Circle Tour", LECT = "Lake Erie Circle Tour", ["LSCT-Spur"] = "Lake Superior Circle Tour", ["LMCT-Spur"] = "Lake Michigan Circle Tour", ["LHCT-Spur"] = "Lake Huron Circle Tour"}, abbr = {default = "GLCT", LSCT = "LSCT", LMCT = "LMCT", LHCT = "LHCT", LECT = "LECT", ["LSCT-Spur"] = "LSCT Spur", ["LMCT-Spur"] = "LMCT Spur", ["LHCT-Spur"] = "LHCT Spur"} } NY.PA = {alias = {module = "USA/PA", type = "PA"}} return NY

5wzrpprdq64q39vduesqljxsjppmttr

-

Module:Road data/strings/USA/TX

<ns>828</ns>

<id>41559923</id>

-

<id>640216682</id>

640208895

2014-12-30T09:58:45Z

-

NE2

<id>1757249</id>

RR

Scribunto

text/plain

<text bytes="10085" xml:space="preserve">-- Texas local TX = {} -- Interstate types TX.I = {shield = "I-%route%.svg", link = "Interstate %route% (Texas)", abbr = "I-%route%", width = "expand"} TX.IH = TX.I TX.BL = {shield = "Business Loop %route%.svg", link = "Interstate %route% Business ([dab||%dab%, |]Texas)", abbr = "BL I-%route%", width = "expand"} TX["I-Bus"]=TX.BL TX.BS = {shield = "Business Spur %route%.svg", link = "Interstate %route% Business ([dab||%dab%, |]Texas)", abbr = "BS I-%route%", width = "expand"} TX["I-Toll"] = {shield = "Toll Texas Interstate Highway %route%.svg", link = "Interstate %route% Toll ([dab||%dab%, |]Texas)", abbr = "I-%route% Toll"} TX["I-Express"] = {shield = TX.I.shield, --actually has a special variant of the toll shield http://maps.google.com/maps?ll=32.83914,-97.295909&spn=0.025853,0.049567&t=m&z=15&layer=c&cbll=32.839137,-97.304007&panoid=3j1OLRU7u7dq5nlTROvtZQ&cbp=12,49.41,,1,-4.66 link = "Interstate %route% Express ([dab||%dab%, |]Texas)", abbr = "I-%route% Express", banner = "Express plate blue.svg", width = "expand"} -- US types TX.US = {shield = "US %route%.svg", link = "U.S. Route %route% in Texas", abbr = "US %route%", width = "expand"} TX["US-Alt"] = {shield = TX.US.shield, link = "U.S. Route %route% Alternate ([dab||%dab%, |]Texas)", abbr = "Alt. US %route%", banner = "Alt plate.svg", width = "expand"} TX.UA = TX["US-Alt"] TX["US-Bus"] = {shield = TX.US.shield, link = "U.S. Route %route% Business ([dab||%dab%, |]Texas)", abbr = "Bus. US %route%", banner = "Business plate.svg", width = "expand"} TX.BU = TX["US-Bus"] TX["US-Hist"] = {shield = "US %route% (historic).svg", link = TX.US.link, abbr = "Historic US %route%", width = 16} TX["US-Spur"] = {shield = TX.US.shield, link = "U.S. Route %route% Spur ([dab||%dab%, |]Texas)", abbr = "US %route% Spur", banner = "Spur plate.svg", width = "expand"} TX["US-Truck"] = {shield = TX.US.shield, link = "U.S. Route %route% Truck ([dab||%dab%, |]Texas)", abbr = "US %route% Truck", banner = "Truck plate.svg", width = "expand"} TX["US 1926"] = {shield = "US %route% Texas 1926.svg", link = TX.US.link, abbr = TX.US.abbr, width = "US1926"} TX["US 1948"] = {shield = "US %route% (1948).svg", link = TX.US.link, abbr = TX.US.abbr} -- SH (main) types TX.SH = {shield = "Texas %route%.svg", link = "Texas State Highway %route% [dab||(%dab%)|]", abbr = "SH %route%"} TX.TX = TX.SH TX["SH-Bus"] = {shield = TX.SH.shield, link = "Texas State Highway %route% Business [dab||(%dab%)|]", abbr = "Bus. SH %route%", banner = "Business plate.svg"} TX["TX-Bus"] = TX["SH-Bus"] TX["SH-Truck"] = {shield = TX.SH.shield, link = "Texas State Highway %route% Truck [dab||(%dab%)|]", abbr = "SH %route% Truck", banner = "Truck plate.svg"} TX["SH-old"] = {shield = "Old Texas %route%.svg", link = TX.SH.link, abbr = TX.SH.abbr} TX["TX-old"] = TX["SH-old"] -- Other SH types TX.Beltway = {shield = "Texas Beltway %route%.svg", link = "Texas State Highway Beltway %route%", abbr = "Beltway %route%"} TX.BW = TX.Beltway TX.Loop = {shield = "Texas Loop %route%.svg", link = {default = "Texas State Highway Loop %route%", ["1910"] = "Andrews Loop 1910"}, abbr = "Loop %route%"} TX.SL = TX.Loop TX.Spur = {shield = "Texas Spur %route%.svg", link = "Texas State Highway Spur %route% [dab||(%dab%)|]", abbr = "Spur %route%"} TX.SS = TX.Spur TX.Park = {shield = "Texas Park Road %route%.svg", link = "Texas Park Road %route%", abbr = "PR %route%"} TX.PR = TX.Park TX.NASA = {shield = "Texas NASA Road %route%.svg", link = "NASA Road %route%", abbr = "NASA %route%"} TX.INTL = {shield = "", link = "International Parkway", abbr = "International Parkway"} -- Toll types TX.Toll = {shield = {default = "Toll Texas %route% new.svg", ["Sam Houston"] = "Sam Houston Tollway.svg", SHT = "Sam Houston Tollway.svg", Westpark = "Westpark Tollway.svg", WPT = "Westpark Tollway.svg", Hardy = "Hardy Toll Road.svg", HTR = "Hardy Toll Road.svg", FBT = "Fort Bend Toll Road.svg", --needs to be updated - current signs say FT. BEND / TOLLWAY with a rotated logo FBPTR = "", FBWPT = "", KFML= "Toll Texas Interstate Highway 10.svg", ["Fort Bend Westpark"] = "", ["183A"] = "183A Toll Road free.svg", ["290"] = "290 Toll Road free.svg"}, link = {default = TX.SH.link, ["Sam Houston"] = "Sam Houston Tollway", SHT = "Sam Houston Tollway", Westpark = "Westpark Tollway", WPT = "Westpark Tollway", Hardy = "Hardy Toll Road", HTR = "Hardy Toll Road", CTP = "Chisholm Trail Parkway", DNT = "Dallas North Tollway", PGBT = "President George Bush Turnpike", SRT = "Sam Rayburn Tollway", FBT = "Fort Bend Tollway", FBPTR = "Fort Bend Parkway Toll Road", FBWPT = "Fort Bend Westpark Tollway", ["Fort Bend Westpark"] = "Fort Bend Westpark Tollway", KFML = "Katy Tollway", ["1"] = TX.Loop.link, ["49"] = TX.Loop.link, ["183A"] = "183A Toll Road", ["290"] = "290 Toll Road"}, abbr = {default = "SH %route% Toll", ["Sam Houston"] = "Sam Houston Tollway", SHT = "Sam Houston Tollway", Westpark = "Westpark Tollway", WPT = "Westpark Tollway", Hardy = "Hardy Toll Road", HTR = "Hardy Toll Road", CTP = "Chisholm Trail Parkway", DNT = "Dallas North Tollway", PGBT = "President George Bush Turnpike", SRT = "Sam Rayburn Tollway", FBT = "Fort Bend Tollway", FBPTR = "Fort Bend Parkway Toll Road", --is Tollroad one word as signed on SH 6? FBWPT = "Fort Bend Westpark Tollway", KFML = "I-10 Toll (Katy Tollway)", ["Fort Bend Westpark"] = "Fort Bend Westpark Tollway", ["1"] = "Loop %route% Toll", ["49"] = "Loop %route% Toll", ["183A"] = "183A Toll Road", ["290"] = "290 Toll Road"} } TX.Both = {shield = {"Texas %route%.svg", "Toll Texas %route% new.svg"}, link = "Texas State Highway %route%", abbr = "SH %route%", width = 40} TX.AATT = {shield = "", link = "Addison Airport Toll Tunnel", abbr = "Addison Airport Toll Tunnel"} TX.IP = {shield = "", link = "International Parkway", abbr = "International Parkway"} TX.LLTB = {shield = "", link = "Lewisville Lake Toll Bridge", abbr = "Lewisville Lake Toll Bridge"} TX.MCLB = {shield = "", link = "Mountain Creek Lake Bridge", abbr = "Mountain Creek Lake Bridge"} TX["SH-Express"] = {shield = TX.SH.shield, --actually has a special variant of the toll shield http://maps.google.com/maps?ll=32.820965,-97.201688&spn=0.012929,0.024784&t=m&z=16&layer=c&cbll=32.820896,-97.205511&panoid=coL0_PX6xfY9Ia3Rkrr8cA&cbp=12,353.63,,1,-8.72 link = "Texas State Highway %route% Express [dab||(%dab%)|]", abbr = "SH %route% Express", banner = "Express plate.svg"} -- FM/RM types TX.FM = {shield = "Texas FM %route%.svg", link = "Farm to Market Road %route%", abbr = "FM %route%"} TX.Farm = TX.FM TX["FM-Bus"] = {shield = "Texas Business FM %route%.svg", link = "Farm to Market Road %route% Business", abbr = "Bus. FM %route%"} TX.BF = TX["FM-Bus"] TX["FM-Loop"] = {shield = TX.Loop.shield, link = "Farm to Market Road %route% Loop", abbr = "FM Loop %route%"} TX["FM-Spur"] = {shield = TX.Spur.shield, link = "Farm to Market Road %route% Spur", abbr = "FM Spur %route%"} TX.RM = {shield = "Texas RM %route%.svg", link = "Ranch to Market Road %route%", abbr = "RM %route%"} TX.Ranch = TX.RM TX.RR = TX.RM TX["RM-Spur"] = {shield = TX.Spur.shield, link = "Ranch to Market Road %route% Spur", abbr = "RM Spur %route%"} TX.RE = {shield = "Texas Recreational Road %route%.svg", link = "Texas Recreational Road %route%", abbr = "RE %route%"} TX.CR = {shield = {arg = "county", default = "", Brazoria = "Generic green square county %route%.svg"}, link = "", abbr = "CR %route%"} TX.AR = {alias = {module = "USA/AR", type = "AR"}} TX["I-AR"] = {alias = {module = "USA/AR", type = "I"}} TX["US-AR"] = {alias = {module = "USA/AR", type = "US"}} return TX

g18tc4xlhutyxzhevmyhjphhf0as2mm

-

Module:TableTools

<ns>828</ns>

<id>41371028</id>

-

<id>610073853</id>

587870113

2014-05-25T14:11:02Z

-

Mr. Stradivarius

<id>4708675</id>

fix cleanPattern function - some of the character classes were still being magic even when they were inside the set, so escape them all

Scribunto

text/plain

<text bytes="8030" xml:space="preserve">-- -- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should -- -- not be called directly from  local libraryUtil = require('libraryUtil') local p = {} -- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType -- -- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table.  -- function p.isPositiveInteger(v) if type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity then return true else return false end end --  -- isNan -- -- This function returns true if the given number is a NaN value, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a value can be a valid table key. Lua will -- generate an error if a NaN is used as a table key.  -- function p.isNan(v) if type(v) == 'number' and tostring(v) == '-nan' then return true else return false end end --  -- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own.  -- function p.shallowClone(t) local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end --  -- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged.  -- function p.removeDuplicates(t) checkType('removeDuplicates', 1, t, 'table') local isNan = p.isNan local ret, exists = {}, {} for i, v in ipairs(t) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v else if not exists[v] then ret[#ret + 1] = v exists[v] = true end end end return ret end -- -- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order.  -- function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k, v in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end --  -- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will -- return {1, 3, 6}.  -- function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true) local function cleanPattern(s) -- Cleans a pattern so that the magic characters %.[]*+-?^$ are interpreted literally. s = s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') return s end prefix = prefix or  suffix = suffix or  prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$' local nums = {} for k, v in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end -- -- numData -- -- Given a table with keys like ("foo1", "bar1", "foo2", "baz2"), returns a table -- of subtables in the format -- { [1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'} } -- Keys that don't end with an integer are stored in a subtable named "other". -- The compress option compresses the table so that it can be iterated over with -- ipairs.  -- function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == '' then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end -- -- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs.  -- function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end --  -- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values.  -- function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function  i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end --  -- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the  function p.size(t) checkType('size', 1, t, 'table') local i = 0 for k in pairs(t) do i = i + 1 end return i end return p

k1omc17qij757n8hd68yihcqxo4biqi

-

Module:Yesno

<ns>828</ns>

<id>38665046</id>

-

<id>604718900</id>

582180209

2014-04-18T10:35:42Z

-

Mr. Stradivarius

<id>4708675</id>

use the Lua string.lower function instead of mw.ustring.lower; this makes the function around 25x faster

Scribunto

text/plain

<text bytes="678" xml:space="preserve">-- Function allowing for consistent treatment of boolean-like wikitext input. -- It works similarly to the template. return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or tonumber(val) == 0 then return false else return default end end

ew4l88ll7bbgr20npia5rfyblzqhgyg