text:
Module:Template wrapper

require('strict');

local error_msg = ' missing or empty ';

--[[--< I S _ I N _ T A B L E >

scan through tbl looking for value; return true if found, false else

]]

local function is_in_table (tbl, value) for k, v in pairs (tbl) do       if v == value then return true end end return false; end

--[[--< A D D _ P A R A M E T E R >

adds parameter name and its value to args table according to the state of boolean list argument; kv pair for template execution; k=v string for template listing.

]]

local function add_parameter (k, v, args, list) if list then table.insert( args, table.concat ({k, '=', v}));						-- write parameter names and values to args table as string else args[k] = v;															-- copy parameters to args table end end

--[[--< A L I A S _ M A P _ G E T >

returns a table of local template (parent frame) parameter names and the target template names that match where in [key]= pairs where: [key] is local template parameter name (an alias) is target template parameter name (the canonical parameter name used in the working template)

The parameter |_alias-map= has the form: |_alias-map= where is a comma-separated list of alias / canonical parameter name pairs in the form :  where: is the local template's parameter name (alias)  is the target template's parameter name (canonical) for enumerated parameters place an octothorp (#) where the enumerator digits are placed in the parameter names:  :

]]

local function alias_map_get (_alias_map) local T = mw.text.split (_alias_map, '%s*,%s*');							-- convert the comma-separated list into a table of alias pairs local mapped_aliases = {};													-- mapped aliases will go here local l_name, t_name;														-- parameter names for _, alias_pair in ipairs (T) do											-- loop through the table of alias pairs l_name, t_name = alias_pair:match ('(.-)%s*:%s*(.+)');					-- from each pair, get local and target parameter names if l_name and t_name then												-- if both are set if tonumber (l_name) then l_name = tonumber (l_name);										-- convert number-as-text to a number end mapped_aliases[l_name] = t_name;									-- add them to the map table end end

return mapped_aliases; end

--[[--< F R A M E _ A R G S _ G E T >--

Fetch the wrapper template's 'default' and control parameters; adds default parameters to args

returns content of |_template= parameter (name of the working template); nil else

]]

local function frame_args_get (frame_args, args, list) local template;

for k, v in pairs (frame_args) do											-- here we get the wrapper template's 'default' parameters if 'string' == type (k) and (v and ('' ~= v)) then						-- do not pass along positional or empty parameters if '_template' == k then template = v;													-- save the name of template that we are wrapping elseif '_exclude' ~= k and '_reuse' ~= k and '_include-positional' ~= k and '_alias-map' ~= k then	-- these already handled so ignore here; add_parameter (k, v, args, list);								-- add all other parameters to args in the style dictated by list end end end

return template;															-- return contents of |_template= parameter end

--[=[--< P F R A M E _ A R G S _ G E T >

Fetches the wrapper template's 'live' parameters; adds live parameters that aren't members of the exclude table to args table; positional parameters may not be excluded

no return value

]=]

local function pframe_args_get (pframe_args, args, exclude, _include_positional, list) for k, v in pairs (pframe_args) do		if 'string' == type (k) and not is_in_table (exclude, k) then			-- do not pass along excluded parameters if v and ('' ~= v) then												-- pass along only those parameters that have assigned values if 'unset' == v:lower then									-- special keyword to unset 'default' parameters set in the wrapper template v = '';														-- unset the value in the args table end add_parameter (k, v, args, list)								-- add all other parameters to args in the style dictated by list; alias map only supported for local-template parameters end end end

if _include_positional then for i, v in ipairs (pframe_args) do										-- pass along positional parameters if 'unset' == v:lower then										-- special keyword to unset 'default' parameters set in the wrapper template v = '';															-- unset the value in the args table end add_parameter (i, v, args, list); end end end

--[[--< _ M A I N >

Collect the various default and live parameters into args styled according to boolean list.

returns name of the working or listed template or nil for an error message

]]

local function _main (frame, args, list) local template; local exclude = {};															-- table of parameter names for parameters that are not passed to the working template local reuse_list = {};														-- table of pframe parameter names whose values are modified before they are passed to the working template as the same name local alias_map = {};														-- table that maps parameter aliases to working template canonical parameter names local _include_positional; if frame.args._exclude and ('' ~= frame.args._exclude) then					-- if there is |_exclude= and it's not empty exclude = mw.text.split (frame.args._exclude, "%s*,%s*");				-- make a table from its contents end -- TODO: |_reuse= needs a better name (|_reuse=) if frame.args._reuse and ('' ~= frame.args._reuse) then					-- if there is |_reuse= and it's not empty reuse_list = mw.text.split (frame.args._reuse, "%s*,%s*");				-- make a table from its contents end

if frame.args['_alias-map'] and ('' ~= frame.args['_alias-map']) then		-- if there is |_alias-map= and it's not empty alias_map = alias_map_get (frame.args['_alias-map']);					-- make a table from its contents end

template = frame_args_get (frame.args, args, list);							-- get parameters provided in the if nil == template or '' == template then									-- this is the one parameter that is required by this module return nil;																-- not present, tell calling function to emit an error message end _include_positional = 'yes' == frame.args['_include-positional'];			-- when true pass all positional parameters along with non-excluded named parameters to ... -- ... the working template; positional parameters are not excludable local _pframe_args = frame:getParent.args;								-- here we get the wrapper template's 'live' parameters from pframe.args local pframe_args = {};														-- a local table that we can modify

for k, v in pairs (_pframe_args) do											-- make a copy that we can modify pframe_args[k] = v;	end -- here we look for pframe parameters that are aliases of canonical parameter names; when found -- we replace the alias with the canonical. We do this here because the reuse_list works on -- canonical parameter names so first we convert alias parameter names to canonical names and then -- we remove those canonical names from the pframe table that are reused (provided to the working -- template through the frame args table)

for k, v in pairs (alias_map) do											-- k is alias name, v is canonical name if pframe_args[k] then													-- if pframe_args has parameter with alias name pframe_args[v] = _pframe_args[k];									-- create new canonical name with alias' value pframe_args[k] = nil;												-- unset the alias end end

for k, v in pairs (pframe_args) do											-- do enumerated parameter alias -> canonical translation if 'string' == type (k) then											-- only named parameters can be enumerated if alias_map[k..'#'] then											-- non-enumerated alias matches enumerated parameter pattern? enumerator at end only pframe_args[alias_map[k..'#']:gsub('#', '')] = v;				-- remove '#' and copy parameter to pframe_args table pframe_args[k] = nil;											-- unset the alias elseif k:match ('%d+') then											-- if this parameter name contains digits local temp = k:gsub ('%d+', '#');								-- make a copy; digits replaced with single '#' local enum = k:match ('%d+');									-- get the enumerator if alias_map[temp] then											-- if this parameter is a recognized enumerated alias pframe_args[alias_map[temp]:gsub('#', enum)] = v;			-- use canonical name and replace '#' with enumerator and add to pframe_args pframe_args[k] = nil;										-- unset the alias end end end end

-- pframe parameters that are _reused are 'reused' have the form something like this: --	|chapter= -- where a parameter in the wrapping template is modified and then passed to the working template -- using the same parameter name (in this example |chapter=)

-- remove parameters that will be reused for k, v in ipairs (reuse_list) do											-- k is numerical index, v is canonical parameter name to ignore if pframe_args[v] then													-- if pframe_args has parameter that should be ignored pframe_args[v] = nil;												-- unset the ignored parameter end end

pframe_args_get (pframe_args, args, exclude, _include_positional, list);	-- add parameters and values to args that are not listed in the exclude table

return template;															-- args now has all default and live parameters, return working template name end

--[[--< W R A P >--

Template entry point. Call this function to 'execute' the working template

]]

local function wrap (frame) local args = {};															-- table of default and live parameters and their values to be passed to the wrapped template local template;																-- the name of the working template

template = _main (frame, args, false);										-- get default and live parameters and the name of the working template if not template then														-- template name is required return error_msg;														-- emit error message and abandon if template name not present end

return frame:expandTemplate {title=template, args=args};					-- render the working template end

--[[--< L I S T >--

Template entry point. Call this function to 'display' the source for the working template. This function added as a result of a TfD here: Wikipedia:Templates_for_discussion/Log/2018_April_28#Module:PassArguments

This function replaces a similarly named function which was used in and

Values in the args table are numerically indexed strings in the form 'name=value'

]]

local function list(frame, do_link) local args = {};						-- table of default and live parameters and their values to be passed to the listed template local template;							-- the name of the listed template

template = _main (frame, args, true);	-- get default and live parameters and the name of the listed template if not template then					-- template name is required return error_msg;					-- emit error message and abandon if template name not present end if do_link then template = ('%s'):format(frame:expandTemplate{ title='Transclude', args = {template} }, template) end table.sort(args) for i = 1, #args do local stripped = args[i]:match('^' .. i .. '=([^=]*)$') if stripped then args[i] = stripped else break end end return frame:preprocess(table.concat({ ' '}));	-- render the template end

local function link (frame) return list(frame, true) end

----< E X P O R T E D  F U N C T I O N S >--

return { link = link, list = list, wrap = wrap, };

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: Module:Template wrapper


text:
Module:Template wrapper/doc

This module is to be used in wrapper templates to allow those templates to provide default parameter values and allow editors to pass additional parameters to the underlying working template.

When writing a wrapper template, give this module all of the normally required default parameters necessary to use the wrapper template in its base form. Editors then use the wrapper template as-is or may supply additional wrapper and canonical parameters. Any of the canonical parameters supported by the working template may be added to the wrapper template or supplied by editors in article space. When an editor supplies a parameter that has a default value in the wrapper template, the editor-supplied value overrides the default. When it is necessary to remove a default parameter, editors may set the parameter value to the special keyword  which will cause this wrapper module to erase the wrapper template's default value for that parameter. This module discards empty named parameters.

Positional parameters are not normally passed on to the working template. Setting yes will pass all positional parameters to the working template. Positional parameters cannot be excluded; positional parameters may be.

Parameters that are used only by the wrapper should be either positional or listed in _exclude (a comma-separated list of named parameters). This module will not pass  parameters to the working template.

Usage

 * Control parameters
 * _template – (required) the name, without namespace, of the working template (the template that is wrapped); see §_template below
 * _exclude – comma-separated list of parameter names used by the wrapper template that are not to be passed to the working template; see §_exclude below
 * _reuse – comma-separated list of canonical names that have meaning to both the wrapper template and to the working template; see §_reuse below
 * _alias-map – comma-separated list of wrapper-template parameter names that are to be treated as aliases of specified working template canonical parameters; see §_alias-map below
 * _include-positional – pass all positional parameters to the working template; see §_include-positional below

 * Definitions
 * canonical parameter – a parameter supported and used by the working template
 * wrapper parameter – a parameter used by the wrapper template; may provide data for canonical parameters or control other aspects of the wrapper template
 * alias parameter – a wrapper parameter that is contextually meaningful to the wrapper template but must be renamed to a canonical parameter for use by the working template
 * reused parameter – a parameter that is shared by both wrapper and working templates and has been modified by wrapper template
 * default parameter – a canonical parameter given a default value in the wrapper template

_template
The only required parameter, _template supplies the name, without namespace, of the working template (the template that is wrapped). If this parameter is omitted, Module:Template wrapper will emit the error message:
 * missing or empty

_alias-map
_alias-map takes a comma-separated list of wrapper-template parameters that are to be treated as aliases of specified working template canonical parameters. Each mapping element of the list has the form:
 * – where:  is a wrapper parameter name and   is a canonical parameter name

In this example, it may be preferable for a wrapper template to use assessor which may be unknown to the working template but the working template may have an equivalent author so in the  we would write:
 * assessor:author

Positional parameters may also be mapped to canonical parameters:
 * 1:author, 2:title, 3:language

Enumerated wrapper parameters may be mapped to enumerated canonical parameters using the  enumerator specifier:
 * assessor#:author#

Given the above example, assessor2 will map to author2; also, assessor and assessor1 will map to author1

Multiple wrapper parameters can map to a single canonical parameter:
 * 1:author, assessor:author

Wrapper parameters listed in alias-map are not passed to the working template. Mapping positional parameters when yes may give undesirable results. 1:author and yes will cause all other positional parameters to be passed to the working template as is: wrapper template  becomes working template , etc; working template will not get   though it will get author.

_reuse
_reuse takes a comma-separated list of canonical parameters that have meaning to both the wrapper template and to the working template

In the simplest cases, a canonical parameter passed into the wrapper template overrides a default parameter provided in the wrapper template. Sometimes a wrapper parameter is the same as a canonical parameter and the wrapper template needs to modify the parameter value before it is passed to the working template. In this example, title is both a wrapper parameter and a canonical parameter that the wrapper template needs to modify before passing to the working template. To do this we first write:
 * title

then, in the wrapper template's  we write:
 * Modified

_reused parameters cannot be overridden.

_exclude
_exclude takes a comma-separated list of parameters used by the wrapper template that are not to be passed to the working template. This list applies to all wrapper and canonical parameters (including those canonical parameters that are renamed alias parameters) received from the wrapper template.

As an example, a wrapper template might use id to supply a portion of the value assigned to default parameter url so we would write:
 * id

then, in the wrapper template's  we write:
 * https://example.com/

The modified url value is passed on to working template but id and its value is not.

_reused and default parameters cannot be excluded.

_include-positional
_include-positional is a boolean parameter that takes only one value: ; the default (empty, missing) is   (positional parameters normally excluded). When set to, Module:Template wrapper will pass all positional parameters to the working template.

See also §_alias-map.

Overriding default parameters
Editors may override default parameters by simply setting the default parameter to the desired value in the wrapper template. This module ignores empty parameters (those parameters that are named but which do not have an assigned value). When it is desirable to override a default parameter to no value, use the special keyword. Default parameters with this value are passed to the working template as empty (no assigned value) parameters.

_reused parameters cannot be  or overridden.

Debugging/documentation mode
This module has two entry points. A wrapper template might use a module  written like this:

where the _debug wrapper parameter, set to any value, will cause the module to render the call to the working template without actually calling the working template.

As an example, is a wrapper template that uses  as its working template. accepts positional parameters but does not so the wrapper template must convert the positional parameters to named parameters which it does using the _alias-map parameter: This example uses positional parameters and sets yes to show that the template is correctly formed:

and, with _debug unset:

The _debug name is chosen here for convenience but may be anything so long as it matches the  in the.

You may also call the  function to get something like the left-hand side of Template:yy. This is essentially the  function with the template name turned into a link.

title: Module:Template wrapper/doc


text: Template:Used in system

title: Template:Used in system


text:
Module:Message box/ombox.css

/* */ .ombox { margin: 4px 0; border-collapse: collapse; border: 1px solid #a2a9b1;   /* Default "notice" gray */ background-color: #f8f9fa; color: #202122; box-sizing: border-box; }

/* For the "small=yes" option. */ .ombox.mbox-small { font-size: 88%; line-height: 1.25em; }

.ombox-speedy { border: 2px solid #b32424;   /* Red */ background-color: #fee7e6;   /* Pink */ color: #202122; }

.ombox-delete { border: 2px solid #b32424;   /* Red */ }

.ombox-content { border: 1px solid #f28500;   /* Orange */ }

.ombox-style { border: 1px solid #fc3;      /* Yellow */ }

.ombox-move { border: 1px solid #9932cc;   /* Purple */ }

.ombox-protection { border: 2px solid #a2a9b1;   /* Gray-gold */ }

.ombox .mbox-text { border: none; /* @noflip */ padding: 0.25em 0.9em; width: 100%; }

.ombox .mbox-image { border: none; /* @noflip */ padding: 2px 0 2px 0.9em; text-align: center; }

.ombox .mbox-imageright { border: none; /* @noflip */ padding: 2px 0.9em 2px 0; text-align: center; }

/* An empty narrow cell */ .ombox .mbox-empty-cell { border: none; padding: 0; width: 1px; }

.ombox .mbox-invalid-type { text-align: center; }

@media (min-width: 720px) { .ombox { margin: 4px 10%; }	.ombox.mbox-small { /* @noflip */ clear: right; /* @noflip */ float: right; /* @noflip */ margin: 4px 0 4px 1em; width: 238px; } }

title: Module:Message box/ombox.css


text:
Module:Purge/doc

This module produces a link to purge a page's cache. This is usually the current page, but can be another page.

From wiktext
From wikitext, this module should be accessed via Template:Purge. Please see the template page for documentation.

From Lua
From Lua, first you need to load the module:

Then you can create purge links with the  function:

args is a table of arguments, identical to the ones accepted by Template:Purge. Please see the template documentation for more details.

title: Module:Purge/doc


text:
Module:Infobox/styles.css

/* */ /* * This TemplateStyles sheet deliberately does NOT include the full set of * infobox styles. We are still working to migrate all of the manual * infoboxes. See MediaWiki talk:Common.css/to do * DO NOT ADD THEM HERE */ /* * not strictly certain these styles are necessary since the modules now * exclusively output infobox-subbox or infobox, not both * just replicating the module faithfully */ .infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; color: inherit; }

.infobox-3cols-child { margin: auto; }

.infobox .navbar { font-size: 100%; }

/* T281642 */ body.skin-minerva .infobox-header, body.skin-minerva .infobox-subheader, body.skin-minerva .infobox-above, body.skin-minerva .infobox-title, body.skin-minerva .infobox-image, body.skin-minerva .infobox-full-data, body.skin-minerva .infobox-below { text-align: center; }

title: Module:Infobox/styles.css


text: Template:High-use

title: Template:High-use


text:
Template:Category link with count

Category:

title: Template:Category link with count


text: Transwiki:Uses TemplateStyles

title: Transwiki:Uses TemplateStyles


text:
Module:Infobox/doc

Module:Infobox is a module that implements the Infobox template. Please see the template page for usage instructions.

title: Module:Infobox/doc


text:
Template:Plainlist/styles.css

/* */ .plainlist ol, .plainlist ul { line-height: inherit; list-style: none; margin: 0; padding: 0; /* Reset Minerva default */ }

.plainlist ol li, .plainlist ul li { margin-bottom: 0; }

title: Template:Plainlist/styles.css


text:
Template:Hlist/styles.css

/* */ /*  * hlist styles are defined in core and Minerva and differ in Minerva. The * current definitions here (2023-01-01) are sufficient to override Minerva * without use of the hlist-separated class. The most problematic styles were * related to margin, padding, and the bullet. Check files listed at * MediaWiki talk:Common.css/to do */ /* * TODO: When the majority of readership supports it (or some beautiful world * in which grade C support is above the minimum threshold), use :is */ .hlist dl, .hlist ol, .hlist ul { margin: 0; padding: 0; }

/* Display list items inline */ .hlist dd, .hlist dt, .hlist li { /*	 * don't trust the note that says margin doesn't work with inline * removing margin: 0 makes dds have margins again * We also want to reset margin-right in Minerva */	margin: 0; display: inline; }

/* Display requested top-level lists inline */ .hlist.inline, .hlist.inline dl, .hlist.inline ol, .hlist.inline ul, /* Display nested lists inline */ .hlist dl dl, .hlist dl ol, .hlist dl ul, .hlist ol dl, .hlist ol ol, .hlist ol ul, .hlist ul dl, .hlist ul ol, .hlist ul ul { display: inline; }

/* Hide empty list items */ .hlist .mw-empty-li { display: none; }

/* TODO: :not can maybe be used here to remove the later rule. naive test * seems to work. more testing needed. like so: *.hlist dt:not(:last-child)::after { *	content: ": "; *} *.hlist dd:not(:last-child)::after, *.hlist li:not(:last-child)::after { *	content: " · "; *	font-weight: bold; *} */ /* Generate interpuncts */ .hlist dt::after { content: ": "; }

.hlist dd::after, .hlist li::after { content: " · "; font-weight: bold; }

.hlist dd:last-child::after, .hlist dt:last-child::after, .hlist li:last-child::after { content: none; }

/* Add parentheses around nested lists */ .hlist dd dd:first-child::before, .hlist dd dt:first-child::before, .hlist dd li:first-child::before, .hlist dt dd:first-child::before, .hlist dt dt:first-child::before, .hlist dt li:first-child::before, .hlist li dd:first-child::before, .hlist li dt:first-child::before, .hlist li li:first-child::before { content: " (";	font-weight: normal; }

.hlist dd dd:last-child::after, .hlist dd dt:last-child::after, .hlist dd li:last-child::after, .hlist dt dd:last-child::after, .hlist dt dt:last-child::after, .hlist dt li:last-child::after, .hlist li dd:last-child::after, .hlist li dt:last-child::after, .hlist li li:last-child::after { content: ")";	font-weight: normal; }

/* Put ordinals in front of ordered list items */ .hlist ol { counter-reset: listitem; }

.hlist ol > li { counter-increment: listitem; }

.hlist ol > li::before { content: " " counter(listitem) "\a0"; }

.hlist dd ol > li:first-child::before, .hlist dt ol > li:first-child::before, .hlist li ol > li:first-child::before { content: " (" counter(listitem) "\a0"; }

title: Template:Hlist/styles.css


text:
Module:Cs1 documentation support/doc

This module provides support for cs1|2 documentation by fetching data from the various modules, most notably Module:Citation/CS1/Configuration and rendering that data in a reader-accessible format.

title: Module:Cs1 documentation support/doc


text:
Module:Citation/CS1/styles.css

/* Protection icon the following line controls the page-protection icon in the upper right corner it must remain within this comment

/* Overrides Some wikis do not override user agent default styles for HTML and , unlike en.wp. On en.wp, keep these the same as MediaWiki:Common.css.

The word-wrap and :target styles were moved here from Common.css. On en.wp, keep these the same as Template:Citation/styles.css. cite.citation { font-style: inherit; /* Remove italics for */ /* Break long urls, etc., rather than overflowing box */ word-wrap: break-word; }

.citation q { quotes: '"' '"' "'" "'"; /* Straight quote marks for */ }

/* Highlight linked elements (such as clicked references) in blue */ .citation:target { /* ignore the linter - all browsers of interest implement this */ background-color: rgba(0, 127, 255, 0.133); }

/* ID and URL access Both core and Common.css have selector .mw-parser-output a[href$=".pdf"].external for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need to have specificity equal to a[href$=".pdf"].external for locks to override PDF icon. That's essentially 2 classes and 1 element.

the .id-lock-... selectors are for use by non-citation templates like which do not have to handle PDF links .id-lock-free a, .citation .cs1-lock-free a { background: url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg) right 0.1em center/9px no-repeat; }

.id-lock-limited a, .id-lock-registration a, .citation .cs1-lock-limited a, .citation .cs1-lock-registration a { background: url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg) right 0.1em center/9px no-repeat; }

.id-lock-subscription a, .citation .cs1-lock-subscription a { background: url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg) right 0.1em center/9px no-repeat; }

/* Wikisource Wikisource icon when |chapter= or |title= is wikilinked to Wikisource as in cite wikisource .cs1-ws-icon a { background: url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg) right 0.1em center/12px no-repeat; }

/* Errors and maintenance */ .cs1-code { /*  style override: mediawiki's css definition is specified here: https://git.wikimedia.org/blob/mediawiki%2Fcore.git/ 69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199 */	color: inherit; background: inherit; border: none; padding: inherit; }

.cs1-hidden-error { display: none; color: #d33; }

.cs1-visible-error { color: #d33; }

.cs1-maint { display: none; color: #3a3; margin-left: 0.3em; }

/* Small text size Set small text size in one place. 0.95 (here) * 0.9 (from references list) is ~0.85, which is the lower bound for size for accessibility. Old styling for this was just 0.85. We could write the rule so that when this template is inside references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */ .cs1-format { font-size: 95%; }

/* kerning */ .cs1-kern-left { padding-left: 0.2em; }

.cs1-kern-right { padding-right: 0.2em; }

/* selflinks – avoid bold font style when cs1|2 template links to the current page */ .citation .mw-selflink { font-weight: inherit; }

title: Module:Citation/CS1/styles.css


text: Template:Plain link

title: Template:Plain link


text:
Template:Pipe

|

title: Template:Pipe


text:
Template:Cs1

Citation Style 1

title: Template:Cs1


text:
Template:Cs2

Citation Style 2

title: Template:Cs2


text:
Module:Citation/CS1/doc

This module and associated sub-modules support the and  citation templates. In general, it is not intended to be called directly, but is called by one of the core CS1 and CS2 templates.  These files comprise the module support for CS1|2 citation templates:

Other documentation: testcases
 * Module talk:Citation/CS1/Feature requests
 * Module talk:Citation/CS1/COinS
 * Module:Cs1 documentation support – a set of functions (some experimental) that extract information from the module suite for the purpose of documenting CS1|2
 * Module:Citation/CS1/doc/Category list – lists of category names taken directly from Module:Citation/CS1/Configuration and Module:Citation/CS1/Configuration/sandbox
 * Module:Citation/CS1/testcases (run)
 * Module:Citation/CS1/testcases/errors (run) – error and maintenance messaging
 * Module:Citation/CS1/testcases/dates (run) – date validation
 * Module:Citation/CS1/testcases/identifiers (run) – identifiers
 * Module:Citation/CS1/testcases/anchor (run) – CITEREF anchors

title: Module:Citation/CS1/doc


text: Template:Yesno

title: Template:Yesno


text: Template:Sidebar

title: Template:Sidebar


text:
Module:Navbar/styles.css

/* */ .navbar { display: inline; font-size: 88%; font-weight: normal; }

.navbar-collapse { float: left; text-align: left; }

.navbar-boxtext { word-spacing: 0; }

.navbar ul { display: inline-block; white-space: nowrap; line-height: inherit; }

.navbar-brackets::before { margin-right: -0.125em; content: '[ '; }

.navbar-brackets::after { margin-left: -0.125em; content: ' ]'; }

.navbar li { word-spacing: -0.125em; }

.navbar a > span, .navbar a > abbr { text-decoration: inherit; }

.navbar-mini abbr { font-variant: small-caps; border-bottom: none; text-decoration: none; cursor: inherit; }

.navbar-ct-full { font-size: 114%; margin: 0 7em; }

.navbar-ct-mini { font-size: 114%; margin: 0 4em; }

title: Module:Navbar/styles.css


text:
Module:Sidebar/styles.css

/* */ /* TODO: Invert width design to be "mobile first" */ .sidebar { /* TODO: Ask if we should have max-width 22em instead */ width: 22em; /* @noflip */ float: right; /* @noflip */ clear: right; /* @noflip */ margin: 0.5em 0 1em 1em; background: #f8f9fa; border: 1px solid #aaa; padding: 0.2em; text-align: center; line-height: 1.4em; font-size: 88%; border-collapse: collapse; /* Timeless has display: none on .nomobile at mobile resolutions, so we * unhide it with display: table and let precedence and proximity win. */	display: table; }

/* Unfortunately, so does Minerva desktop, except Minerva drops an * !important on the declaration. So we have to be mean for Minerva users. * Mobile removes the element entirely with `wgMFRemovableClasses` in * https://github.com/wikimedia/operations-mediawiki-config/blob/master/ wmf-config/InitialiseSettings.php#L16992 * which is why displaying it categorically with display: table works. * We don't really want to expose the generic user in the wild on mobile to have * to deal with sidebars. (Maybe the ones with collapsible lists, so that * might be an improvement. That is blocked on phab:T111565.) */ body.skin-minerva .sidebar { display: table !important; /* also, minerva is way too aggressive about other stylings on tables. * TODO remove when this template gets moved to a div. plans on talk page. * We always float right on Minerva because that's a lot of extra CSS * otherwise. */   float: right !important; margin: 0.5em 0 1em 1em !important; }

.sidebar-subgroup { width: 100%; margin: 0; border-spacing: 0; }

.sidebar-left { /* @noflip */ float: left; /* @noflip */ clear: left; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-none { float: none; clear: both; /* @noflip */ margin: 0.5em 1em 1em 0; }

.sidebar-outer-title { padding: 0 0.4em 0.2em; font-size: 125%; line-height: 1.2em; font-weight: bold; }

.sidebar-top-image { padding: 0.4em; }

.sidebar-top-caption, .sidebar-pretitle-with-top-image, .sidebar-caption { padding: 0.2em 0.4em 0; line-height: 1.2em; }

.sidebar-pretitle { padding: 0.4em 0.4em 0; line-height: 1.2em; }

.sidebar-title, .sidebar-title-with-pretitle { padding: 0.2em 0.8em; font-size: 145%; line-height: 1.2em; }

.sidebar-title-with-pretitle { padding: 0.1em 0.4em; }

.sidebar-image { padding: 0.2em 0.4em 0.4em; }

.sidebar-heading { padding: 0.1em 0.4em; }

.sidebar-content { padding: 0 0.5em 0.4em; }

.sidebar-content-with-subgroup { padding: 0.1em 0.4em 0.2em; }

.sidebar-above, .sidebar-below { padding: 0.3em 0.8em; font-weight: bold; }

.sidebar-collapse .sidebar-above, .sidebar-collapse .sidebar-below { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; }

.sidebar-navbar { text-align: right; font-size: 115%; padding: 0 0.4em 0.4em; }

.sidebar-list-title { padding: 0 0.4em; text-align: left; font-weight: bold; line-height: 1.6em; font-size: 105%; }

/* centered text with mw-collapsible headers is finicky */ .sidebar-list-title-c { padding: 0 0.4em; text-align: center; margin: 0 3.3em; }

@media (max-width: 720px) { /* users have wide latitude to set arbitrary width and margin :(	  "Super-specific" selector to prevent overriding this appearance by	   lower level sidebars too */	body.mediawiki .sidebar {		width: 100% !important;		clear: both;		float: none !important; /* Remove when we div based; Minerva is dumb */		margin-left: 0 !important;		margin-right: 0 !important;	}	/* TODO: We might consider making all links wrap at small resolutions and then	 * only introduce nowrap at higher resolutions. Do when we invert the media	 * query.	 */ }

title: Module:Sidebar/styles.css


text: Template:Template link code

title: Template:Template link code


text: Template:Language templates

title: Template:Language templates


text:
Module:Lang/doc

This module exists primarily to provide correct html markup for non–English language text where that text is used in the English Wikipedia. It has a secondary purpose of providing correct visual rendering for this non-English text. The module was developed to consolidate processing for, the (most), and  templates into a single source and to use a clearly defined data set extracted from international standards. It provides error checking and reporting to ensure that the html rendered is correct for browsers and screen readers.

Other templates that get language name support from this module are:

Data set
The data set is specified in Module:Lang/data and its included data modules:
 * language tag-and-name data
 * Module:Language/data/iana languages – from IANA language-subtag-registry file
 * language script data
 * Module:Language/data/iana scripts – from IANA language-subtag-registry file
 * language region data
 * Module:Language/data/iana regions – from IANA language-subtag-registry file
 * language variant data
 * Module:Language/data/iana variants – from IANA language-subtag-registry file
 * suppressed-script data
 * Module:Language/data/iana suppressed scripts – from IANA language-subtag-registry file

The data set also includes supplementary data modules:
 * override and other non-standard data
 * Module:Lang/ISO 639 synonyms – maps three character ISO 639-2, -2T, -3 codes to two character ISO 639-1 codes – from Codes for the Representation of Names of Languages
 * Module:Lang/tag from name – reversed language tag-and-name data so that the language name is the key and the language tag is the value

Testcases

 * Module:Lang/testcases (run)
 * category_from_tag
 * Module:Lang/testcases/ISO 639-1 category from tag (run)
 * Module:Lang/testcases/ISO 639-3-1 category from tag (A–H) (run)
 * Module:Lang/testcases/ISO 639-3-2 category from tag (I–N) (run)
 * Module:Lang/testcases/ISO 639-3-3 category from tag (O–Z) (run)
 * Module:Lang/testcases/ISO 639 deprecated and override category from tag (run)
 * name_from_tag
 * Module:Lang/testcases/ISO 639-1 name from tag (run)
 * Module:Lang/testcases/ISO 639-3-1 name from tag (A–H) (run)
 * Module:Lang/testcases/ISO 639-3-2 name from tag (I–N) (run)
 * Module:Lang/testcases/ISO 639-3-3 name from tag (O–Z) (run)
 * Module:Lang/testcases/ISO 639 deprecated and override name from tag (run)
 * tag_from_name
 * Module:Lang/testcases/ISO 639-1 tag from name (run)
 * Module:Lang/testcases/ISO 639-3-1 tag from name (A–H) (run)
 * Module:Lang/testcases/ISO 639-3-2 tag from name (I–N) (run)
 * Module:Lang/testcases/ISO 639-3-3 tag from name (O–Z) (run)
 * Module:Lang/testcases/ISO 639 deprecated and override tag from name (run)

title: Module:Lang/doc


text: Template:Mbox

title: Template:Mbox


text:
Module:Hatnote/styles.css

/* */ .hatnote { font-style: italic; }

/* Limit structure CSS to divs because of Module:Hatnote inline */ div.hatnote { /* @noflip */ padding-left: 1.6em; margin-bottom: 0.5em; }

.hatnote i { font-style: normal; }

/* The templatestyles element inserts a link element before hatnotes. * TODO: Remove link if/when WMF resolves T200206 */ .hatnote + link + .hatnote { margin-top: -0.5em; }

title: Module:Hatnote/styles.css


text: Template:Em

title: Template:Em


text: Template:For

title: Template:For


text: Template:Para

title: Template:Para


text: Template:Crossreference

title: Template:Crossreference


text:
Template:Crossreference/styles.css

/* */ /* This snippet just undoes the default "padding-left: 1.6em;" imposed by   div.hatnote, when Template:Crossreference is used in block (div) mode. Ignore the dumb CSS editor's "Element (div.crossreference) is overqualified" warning. It is wrong. We do not want to apply any CSS intended for block mode when it is not in block mode. While it's unlikely our "padding-left: 0;" does anything wrong in inline (span) mode, we can't guarantee it forever. */ div.crossreference { padding-left: 0; }

title: Template:Crossreference/styles.css


text: Template:Documentation

title: Template:Documentation


text: Template:Var

title: Template:Var


text: Template:Tag

title: Template:Tag


text: Template:Warning

title: Template:Warning


text: Template:Kbd

title: Template:Kbd


text:
Template:Hatnote inline/doc

The Hatnote inline meta-template formats text into a standardized style for an inline (not block-level) variant of a Hatnote, a short note placed at the point of insertion, to link to more information or otherwise cross-reference another Wikipedia page. like this:

The most common uses for this meta-template are:
 * Inline "(See also ...)"-type parenthetical Wikipedia crossreferences to other Wikipedia pages, provided by the template and its progeny.  These are unprintworthy Wikipedia self-references.
 * Hatnotes inside definitions in template-formatted glossaries, provided by the template. These are printworthy, as they refer to content on the same page.

Usage

 * Basic usage:

 * All parameters:

The meta-template does not automatically create links of any kind. Links and other desired formatting must be explicitly added, using normal Wikipedia markup.

Parameters
This template accepts the following parameters:
 * 1 or text or content – The inline hatnote's text (required). While the explicit naming of this parameter with 1, text, or content is not required, it is always safest to use it this way, since any = character in the input text will break the template if the parameter is unnamed.
 * class or extraclasses – Any extra CSS classes to be added. This should not normally be used.
 * no – If set to no (or n, false, 0, etc.) removes the default CSS class, used to denote unprintworthy self-references to Wikipedia .  This option should not be used to indicate a non-selfref on cross-article links, only links within the same article (and the derived shorthand templates  and  do this automatically). The parameter alias yes (or with any other value, like y, true, 1, etc.) has the same effect as no.  Note that attempting to manually supply a "this is a selfref" value with yes or no will not have the desired effect (which is the default anyway); , since most uses are self-references (only those within the same article as the template are not). This could actually be fixed by use of , but it's maybe more hassle than it's worth.
 * category – If set to no (or n, false, 0, etc.), suppresses the error-tracking category (Category:Hatnote templates with errors). This only has an effect if the first positional parameter (the hatnote text) is omitted. This should not normally be used.
 * inline – Defaults to yes; you never need to set that. If set to no (or n, false, 0, etc.), it is a special-use parameter, which turns off the conversion of the Hatnote module code's into a, so it becomes a  again.  By default, this will simply produce the same output as .  The only use for this is when a template using  as its meta-template (e.g.  has WP:TemplateStyles and a custom class that do something different with it in block mode than would happen if it were a regular hatnote (e.g., by removing the hatnote indentation).  So, obviously this is not normally used, and it requires setup to use it to do anything practical.

Technical details
The meta-template places an HTML container around the text entered as its first, required parameter, upon which it provides standardized formatting (italicized in most displays, and only stylistically, not as semantic emphasis); it also uses CSS classes to isolate the contained code to make sure that it is interpreted correctly and can be acted upon independently of true article content.

The HTML code produced by this template looks like this:

This is the same class used by the -based template, the block display of which is controlled by a separate   directive in Mediawiki:Common.css.

The output is produced by Module:Hatnote inline.

Templates based on this meta-template

 * Crossreference (a.k.a. Crossref, Xref) – Template for inline crossreferences to (usually) other Wikipedia pages (unprintworthy in most cases)
 * Ghat – Hatnote template for use in template-structured glossaries (printworthy)
 * See above and See below – some more specific templates than Crossreference for use on same page only (printworthy)

title: Template:Hatnote inline/doc


text:
Module:Citation/CS1/Configuration/doc

This configuration file contains various data that controls the functioning of Module:Citation/CS1 and hence the way that Lua-based citations are generated.

It has several sections among which are:
 * 1) translation tables that contain most of the literal strings that may be included in Lua-based citation.  If editors are copying this Module to another wiki using a language other than English, then they should translate each of these values into that language.
 * 2) a list of error conditions specifying what text to display, what category to include (if any), and what help page section to refer to when errors are detected
 * 3) a list of ID handlers specifying the recognized document IDs, such as ISBN, DOI, etc., and how to format them.

title: Module:Citation/CS1/Configuration/doc


text:
Module:Anchor/doc

This module implements anchor. Please see the Template:Anchor/doc page for documentation.

title: Module:Anchor/doc


text:
Template:Apostrophe

'

title: Template:Apostrophe


text:
Module:Distinguish/doc

Implements distinguish.

title: Module:Distinguish/doc


text:
Module:Distinguish

local mHatnote = require('Module:Hatnote') local mHatlist = require('Module:Hatnote list') local mArguments --initialize lazily local mTableTools --initialize lazily local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local p = {}

function p.distinguish(frame) mArguments = require('Module:Arguments') mTableTools = require('Module:TableTools') local args = mArguments.getArgs(frame) local selfref = args.selfref local text = args.text args = mTableTools.compressSparseArray(args) return p._distinguish(args, text, selfref) end

function p._distinguish(args, text, selfref) checkType("_distinguish", 1, args, 'table') if #args == 0 and not text then return '' end local text = string.format(		'Not to be confused with %s.',		text or mHatlist.orList(args, true)	) hnOptions = {selfref = selfref} return mHatnote._hatnote(text, hnOptions) end

return p

title: Module:Distinguish


text:
Module:Anchor

-- This module implements.

local getArgs = require('Module:Arguments').getArgs local tableTools = require('Module:TableTools')

local p = {}

function p.main(frame) -- Get the positional arguments from #invoke, remove any nil values, -- and pass them to p._main. local args = getArgs(frame) local argArray = tableTools.compressSparseArray(args) return p._main(unpack(argArray)) end

function p._main(...) -- Generate the list of anchors. local anchors = {...} local ret = {} for _, anchor in ipairs(anchors) do		ret[#ret + 1] = ' ' end return table.concat(ret) end

return p

title: Module:Anchor


text:
Module:Infobox

local p = {} local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false local lists = { plainlist_t = { patterns = { '^plainlist$', '%splainlist$', '^plainlist%s', '%splainlist%s' },		found = false, styles = 'Plainlist/styles.css' },	hlist_t = { patterns = { '^hlist$', '%shlist$', '^hlist%s', '%shlist%s' },		found = false, styles = 'Hlist/styles.css' } }

local function has_list_class(args_to_check) for _, list in pairs(lists) do		if not list.found then for _, arg in pairs(args_to_check) do				for _, pattern in ipairs(list.patterns) do					if mw.ustring.find(arg or '', pattern) then list.found = true break end end if list.found then break end end end end end

local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end if notempty(sval) then local marker = '' local s = sval -- start moving templatestyles and categories inside of table rows local slast = '' while slast ~= s do			slast = s			s = mw.ustring.gsub(s, '(%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '()', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '') s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = '' for k = 1, #subcells do				if k == 1 then s = s .. subcells[k] .. ' '				elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = ''	end s = s .. '<' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. ' <' .. tt .. ' colspan=2>\n' .. subcells[k] .. ' '					end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- Special:Diff/849054481 -- remove when phab:T191516 is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s	else return sval end end

-- Cleans empty tables local function cleanInfobox root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, ' ', '') end end

-- Returns the union of the values of two tables, as a sequence. local function union(t1, t2)

local vals = {} for k, v in pairs(t1) do		vals[v] = true end for k, v in pairs(t2) do		vals[v] = true end local ret = {} for k, v in pairs(vals) do		table.insert(ret, k)	end return ret end

-- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end

-- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs) if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass }) root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox- .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext(				''			) end elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class }) local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox- .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done end

local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox- .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or '') end end

local function renderTitle if not args.title then return end

has_rows = true has_list_class({args.titleclass}) root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox- .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end

local function renderAboveRow if not args.above then return end

has_rows = true has_list_class({ args.aboveclass }) root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox- .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end

local function renderBelowRow if not args.below then return end

has_rows = true has_list_class({ args.belowclass }) root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox- .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end

local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ subheaderArgs.rowclass, subheaderArgs.class }) local row = root:tag('tr') row:addClass(subheaderArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or '') end end

local function renderSubheaders if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do		addSubheaderRow({			data = args['subheader' .. tostring(num)],			-- @deprecated next; target .infobox- .infobox-subheader			datastyle = args.subheaderstyle,			rowcellstyle = args['subheaderstyle' .. tostring(num)],			class = args.subheaderclass,			rowclass = args['subheaderrowclass' .. tostring(num)]		}) end end

local function addImageRow(imageArgs)

if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then

has_rows = true has_list_class({ imageArgs.rowclass, imageArgs.class }) local row = root:tag('tr') row:addClass(imageArgs.rowclass)

local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or '') end end

local function renderImages if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create:wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox- .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({			data = tostring(data),			-- @deprecated next; target .infobox- .infobox-image			datastyle = args.imagestyle,			class = args.imageclass,			rowclass = args['imagerowclass' .. tostring(num)]		}) end end

-- When autoheaders are turned on, preprocesses the rows local function preprocessRows if not args.autoheaders then return end local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub(				category_in_empty_row_pattern, ''			):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ''):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end

-- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows

local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do		addRow({			header = args['header' .. tostring(num)],			label = args['label' .. tostring(num)],			data = args['data' .. tostring(num)],			datastyle = args.datastyle,			class = args['class' .. tostring(num)],			rowclass = args['rowclass' .. tostring(num)],			-- @deprecated next; target .infobox- rowclass			rowstyle = args['rowstyle' .. tostring(num)],			rowcellstyle = args['rowcellstyle' .. tostring(num)]		}) end end

local function renderNavBar if not args.name then return end

has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{					args.name,					mini = 1,				}) end

local function renderItalicTitle local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(require('Module:Italic title')._main({})) end end

-- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories for _, s in ipairs(empty_row_categories) do		root:wikitext(s) end end

-- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext(				''			) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle.namespace == 0 then root:wikitext('') end end

--[=[ Loads the templatestyles for the infobox.

TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See Mediawiki_talk:Common.css/to_do and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar.

]=] local function loadTemplateStyles local frame = mw.getCurrentFrame local hlist_templatestyles = '' if lists.hlist_t.found then hlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.hlist_t.styles } }	end local plainlist_templatestyles = '' if lists.plainlist_t.found then plainlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.plainlist_t.styles } }	end -- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } }

local templatestyles = '' if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } }	end local child_templatestyles = '' if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } }	end local grandchild_templatestyles = '' if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } }	end return table.concat({		-- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering.		-- this ordering is not a guarantee because the rows of interest invoking		-- each class may not be on a specific page		hlist_templatestyles,		plainlist_templatestyles,		base_templatestyles,		templatestyles,		child_templatestyles,		grandchild_templatestyles	}) end

-- common functions between the child and non child cases local function structure_infobox_common renderSubheaders renderImages preprocessRows renderRows renderBelowRow renderNavBar renderItalicTitle renderEmptyRowCategories renderTrackingCategories cleanInfobox end

-- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox if args.child ~= 'yes' then root = mw.html.create('table')

root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox- :cssText(args.bodystyle) has_list_class({ args.bodyclass })

renderTitle renderAboveRow else root = mw.html.create

root :wikitext(args.title) end structure_infobox_common return loadTemplateStyles .. root end

-- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= '' then args[argName] = origArgs[argName] end end

-- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end

-- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do		if type(v) ~= 'table' or type(v.prefix) ~= "string" or			(v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do				if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end

-- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do		moreArgumentsExist = false for i = a, a + step - 1 do			for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end

-- Parse the data parameters in the same order that the old did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters

preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({		{prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}}	}, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({		{prefix = 'image', depend = {'caption', 'imagerowclass'}}	}, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({		{prefix = 'header'},		{prefix = 'data', depend = {'label'}},		{prefix = 'rowclass'},		{prefix = 'rowstyle'},		{prefix = 'rowcellstyle'},		{prefix = 'class'}	}, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end

-- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame then origArgs = frame:getParent.args else origArgs = frame end parseDataParameters return _infobox end

-- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end parseDataParameters return _infobox end return p

title: Module:Infobox


text: Template:Uses TemplateStyles

title: Template:Uses TemplateStyles