Wikipedia
tetwiki
https://tet.wikipedia.org/wiki/P%C3%A1jina_Mahuluk
MediaWiki 1.47.0-wmf.16
first-letter
Media
Espesiál
Diskusaun
Uza-na'in
Diskusaun Uza-na'in
Wikipedia
Diskusaun Wikipedia
Imajen
Diskusaun Imajen
MediaWiki
Diskusaun MediaWiki
Template
Diskusaun Template
Ajuda
Diskusaun Ajuda
Kategoria
Diskusaun Kategoria
TimedText
TimedText talk
Módulo
Módulo Discussão
Evento
Evento Discussão
Uza-na'in:J. Patrick Fischer
2
1875
75060
74742
2026-08-24T08:10:36Z
J. Patrick Fischer
73
/* Things */
75060
wikitext
text/x-wiki
[[Imajen:Flag of Bavaria (lozengy).svg|138px]][[Imajen:Flag of Germany.svg|138px]][[Imajen:Flag of Portugal.svg|125px]][[Imajen:Flag of the People's Republic of China.svg|125px]][[Imajen:Flag of East Timor.svg|165px]][[Imajen:Flag of Japan.svg|125px]]
<table style="float: right; margin-left: 1em; margin-bottom: 0.5em; width: 242px; border: #99B3FF solid 1px">
<tr><td><center>'''Personal'''</center></td></tr>
<tr><td>[[Imajen:Coat of arms of Bavaria.svg|50px]] Ami hosi '''[[Baviera]]'''
</td></tr>
</table>
{{#babel:de|en-2|fr-1|pt-1|tet-0}}
Olá,
I was born 1973. I am a Chemical engineer and working in a lab for proteine analysis. Vexillology, ethnology and geography have been my hobbies since I was a kid. I travelled with my backpack, when I was a student and visited 50 countries in all five continents. I posted some comments and images at [http://fotw.vexillum.com/flags/ Flags of the world]. I am at the [http://www.osttimor.org/ Osttimorforum e.V.] [[Imajen:Flag of East Timor.svg|25px]] since 2006, who wants to make [[Timor-Leste]] more popular and help for connections between German speaking countries and Timor-Leste.
I want to '''help building up Tetun Wikipedia''' for Timorese people and I want to '''help Timorese editors'''. If you need suport, you can ask me. If you are needing datas or sources about Timor-Leste, just have a look to the articles at [[:de:Portal:Osttimor]] in German Wikipedia. There are a lot of sources in English, Portuguese and even Tetun.
'''I am very interested on informations about East Timor. If you have some new sources or find mistakes in my articles, please tell me! ;-)'''
'''If you want to contact me''', you can use my German account, too, which is checked frequently: [[:de:Benutzer:J. Patrick Fischer]] or '''send me an eMail''' via Wikipedia (look to the left).
== Artigu ==
{|
|style="background:#008B00; color:#FFFFFF; border: 1px solid #000000; text-align:center; padding:0.5em; width:100%;"|
'''Artigu sira ne'ebé ha'u hakerek ona'''
|-
|style="border: 1px solid #4F4F4F;"|
[[Ai-kameli]], [[Átomu]], [[Baviera]], [[Baviera Leten]], [[Baviera Kraik]], [[Dengue]], [[Eleisaun parlamentar, Timór Lorosa'e 2017]], [[Eleisaun parlamentar, Timór Lorosa'e 2018]], [[Elementu kímiku]], [[Emília Pires]], [[FC Bayern München]], [[Funu Rúsia-Ukránia]], [[Halo Solar]], [[Ikthyosaurus]], [[Iktiosauru]], [[Jesus Cristo]], [[João Felgueiras]], [[Kloru]], [[Konrad Adenauer]], [[Lesululi]], [[Liña ekuadór]], [[Loron-mate]], [[Ludwig II. (Baviera)]], [[Nipah]], [[Pterosauru]], [[Rama dama]], [[Raiva]], [[Same]], [[Sódiu]], [[Stille Nacht]], [[Yohan Goutt Goncalves]], ''artigu oioin Eskritóriu administrativu sira Timór-Leste nian''.
|}
== Things ==
* [[Uza-na'in:J. Patrick Fischer/suku|suku model article]]
* [[:Template:Halakon]] (Delete)
* [[:Template:Disambig]] (Begriffsklärungsseite)
* [[:Template:Artigu seluk]] (Begriffsklärungshinweis)
* [[Uza-na'in:J. Patrick Fischer/Reptilia hosi Timor]]
* [[Utilizador:J. Patrick Fischer/Istória Timor Leste nian]]
* [[Utilizador:J. Patrick Fischer/Be'e Manas Marobo]]
* [[Template:Infobox mountain/Berg]]
[[de:Benutzer:J. Patrick Fischer]]
[[ca:Usuari:J. Patrick Fischer]]
[[en:User:J. Patrick Fischer]]
[[pt:Usuário:J. Patrick Fischer]]
8utwoeg8x2cdho7z086byjtiqt37d4z
Template:Flatlist
10
6016
74768
72158
2026-08-20T02:43:39Z
en>Wbm1058
0
notify protected page of requested move
74768
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Flat list|2=Template talk:Hlist#Requested move 3 August 2026}}
</noinclude><templatestyles src="Hlist/styles.css"/><div class="hlist {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|
{{{1}}}
</div>}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using flatlist with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Flatlist]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | indent | style }}<noinclude></div><!-- Needed to prevent Linter errors here; when Flatlist without parameters is used to start a list, Endflatlist provides the closing /div tag. -->
{{documentation}}
</noinclude>
ahdzwtj48lbvqiseivd08z3ozk637ls
74769
74768
2026-08-24T00:15:08Z
Robertsky
10424
1 versaun husi [[:en:Template:Flatlist]]
74768
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Flat list|2=Template talk:Hlist#Requested move 3 August 2026}}
</noinclude><templatestyles src="Hlist/styles.css"/><div class="hlist {{{class|}}}" {{#if:{{{style|}}}{{{indent|}}}|style="{{#if:{{{indent|}}}|margin-left: {{#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{#if:{{{1|}}}|
{{{1}}}
</div>}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using flatlist with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Flatlist]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | indent | style }}<noinclude></div><!-- Needed to prevent Linter errors here; when Flatlist without parameters is used to start a list, Endflatlist provides the closing /div tag. -->
{{documentation}}
</noinclude>
ahdzwtj48lbvqiseivd08z3ozk637ls
Módulo:Color contrast
828
6639
75004
71496
2026-07-27T16:10:39Z
en>Jonesey95
0
Undid revision [[Special:Diff/1366336997|1366336997]] by [[Special:Contributions/Aidan9382|Aidan9382]] ([[User talk:Aidan9382|talk]]). Appears to have broken the layout of Template:basketballbox. See [[Template:Basketballbox/testcases]]
71495
Scribunto
text/plain
--
-- This module implements
-- {{Color contrast ratio}}
-- {{Greater color contrast ratio}}
-- {{ColorToLum}}
-- {{RGBColorToLum}}
--
local p = {}
local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' )
local function sRGB (v)
if (v <= 0.03928) then
v = v / 12.92
else
v = math.pow((v+0.055)/1.055, 2.4)
end
return v
end
local function rgbdec2lum(R, G, B)
if ( 0 <= R and R < 256 and 0 <= G and G < 256 and 0 <= B and B < 256 ) then
return 0.2126 * sRGB(R/255) + 0.7152 * sRGB(G/255) + 0.0722 * sRGB(B/255)
else
return ''
end
end
local function hsl2lum(h, s, l)
if ( 0 <= h and h < 360 and 0 <= s and s <= 1 and 0 <= l and l <= 1 ) then
local c = (1 - math.abs(2*l - 1))*s
local x = c*(1 - math.abs( math.fmod(h/60, 2) - 1) )
local m = l - c/2
local r, g, b = m, m, m
if( 0 <= h and h < 60 ) then
r = r + c
g = g + x
elseif( 60 <= h and h < 120 ) then
r = r + x
g = g + c
elseif( 120 <= h and h < 180 ) then
g = g + c
b = b + x
elseif( 180 <= h and h < 240 ) then
g = g + x
b = b + c
elseif( 240 <= h and h < 300 ) then
r = r + x
b = b + c
elseif( 300 <= h and h < 360 ) then
r = r + c
b = b + x
end
return rgbdec2lum(255*r, 255*g, 255*b)
else
return ''
end
end
local function color2lum(c)
if (c == nil) then
return ''
end
-- html '#' entity
c = c:gsub("#", "#")
-- whitespace
c = c:match( '^%s*(.-)[%s;]*$' )
-- unstrip nowiki strip markers
c = mw.text.unstripNoWiki(c)
-- lowercase
c = c:lower()
-- first try to look it up
local L = HTMLcolor[c]
if (L ~= nil) then
return L
end
-- convert from hsl
if mw.ustring.match(c,'^hsl%([%s]*[0-9][0-9%.]*[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local h, s, l = mw.ustring.match(c,'^hsl%([%s]*([0-9][0-9%.]*)[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return hsl2lum(tonumber(h), tonumber(s)/100, tonumber(l)/100)
end
-- convert from rgb
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*%)$')
return rgbdec2lum(tonumber(R), tonumber(G), tonumber(B))
end
-- convert from rgb percent
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return rgbdec2lum(255*tonumber(R)/100, 255*tonumber(G)/100, 255*tonumber(B)/100)
end
-- remove leading # (if there is one) and whitespace
c = mw.ustring.match(c, '^[%s#]*([a-f0-9]*)[%s]*$')
-- split into rgb
local cs = mw.text.split(c or '', '')
if( #cs == 6 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[2])
local G = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[4])
local B = 16*tonumber('0x' .. cs[5]) + tonumber('0x' .. cs[6])
return rgbdec2lum(R, G, B)
elseif ( #cs == 3 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[1])
local G = 16*tonumber('0x' .. cs[2]) + tonumber('0x' .. cs[2])
local B = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[3])
return rgbdec2lum(R, G, B)
end
-- failure, return blank
return ''
end
-- This exports the function for use in other modules.
-- The colour is passed as a string.
function p._lum(color)
return color2lum(color)
end
function p._greatercontrast(args)
local bias = tonumber(args['bias'] or '0') or 0
local css = (args['css'] and args['css'] ~= '') and true or false
local v1 = color2lum(args[1] or '')
local c2 = args[2] or 'white'
local v2 = color2lum(c2)
local c3 = args[3] or 'black'
local v3 = color2lum(c3)
local ratio1 = -1;
local ratio2 = -1;
if (type(v1) == 'number' and type(v2) == 'number') then
ratio1 = (v2 + 0.05)/(v1 + 0.05)
ratio1 = (ratio1 < 1) and 1/ratio1 or ratio1
end
if (type(v1) == 'number' and type(v3) == 'number') then
ratio2 = (v3 + 0.05)/(v1 + 0.05)
ratio2 = (ratio2 < 1) and 1/ratio2 or ratio2
end
if css then
local c1 = args[1] or ''
if mw.ustring.match(c1, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(c1, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c1 = '#' .. c1
end
if mw.ustring.match(c2, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(c2, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c2 = '#' .. c2
end
if mw.ustring.match(v3, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(v3, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c3 = '#' .. c3
end
return 'background-color:' .. c1 .. '; color:' .. ((ratio1 > 0) and (ratio2 > 0) and ((ratio1 + bias > ratio2) and c2 or c3) or '') .. ';'
end
return (ratio1 > 0) and (ratio2 > 0) and ((ratio1 + bias > ratio2) and c2 or c3) or ''
end
function p._ratio(args)
local v1 = color2lum(args[1])
local v2 = color2lum(args[2])
if (type(v1) == 'number' and type(v2) == 'number') then
-- v1 should be the brighter of the two.
if v2 > v1 then
v1, v2 = v2, v1
end
return (v1 + 0.05)/(v2 + 0.05)
else
return args['error'] or '?'
end
end
function p._styleratio(args)
local style = (args[1] or ''):lower()
local bg, fg = 'white', 'black'
local lum_bg, lum_fg = 1, 0
if args[2] then
local lum = color2lum(args[2])
if lum ~= '' then bg, lum_bg = args[2], lum end
end
if args[3] then
local lum = color2lum(args[3])
if lum ~= '' then fg, lum_fg = args[3], lum end
end
local slist = mw.text.split(mw.ustring.gsub(mw.ustring.gsub(style or '', '&#[Xx]23;', '#'), '#', '#'), ';')
for k = 1,#slist do
local s = slist[k]
local k,v = s:match( '^[%s]*([^:]-):([^:]-)[%s;]*$' )
k = k or ''
v = v or ''
if (k:match('^[%s]*(background)[%s]*$') or k:match('^[%s]*(background%-color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_bg = v, lum end
elseif (k:match('^[%s]*(color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_fg = v, lum end
end
end
if lum_bg > lum_fg then
return (lum_bg + 0.05)/(lum_fg + 0.05)
else
return (lum_fg + 0.05)/(lum_bg + 0.05)
end
end
--[[
Use {{#invoke:Color contrast|somecolor}} directly or
{{#invoke:Color contrast}} from a wrapper template.
Parameters:
-- |1= — required; A color to check.
--]]
function p.lum(frame)
local color = frame.args[1] or frame:getParent().args[1]
return p._lum(color)
end
function p.ratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._ratio(args)
end
function p.styleratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._styleratio(args)
end
function p.greatercontrast(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._greatercontrast(args)
end
return p
bx0blwcv5isqzm2jrxnp01lj4148n73
75005
75004
2026-08-24T00:44:40Z
Robertsky
10424
1 versaun husi [[:en:Module:Color_contrast]]
71495
Scribunto
text/plain
--
-- This module implements
-- {{Color contrast ratio}}
-- {{Greater color contrast ratio}}
-- {{ColorToLum}}
-- {{RGBColorToLum}}
--
local p = {}
local HTMLcolor = mw.loadData( 'Module:Color contrast/colors' )
local function sRGB (v)
if (v <= 0.03928) then
v = v / 12.92
else
v = math.pow((v+0.055)/1.055, 2.4)
end
return v
end
local function rgbdec2lum(R, G, B)
if ( 0 <= R and R < 256 and 0 <= G and G < 256 and 0 <= B and B < 256 ) then
return 0.2126 * sRGB(R/255) + 0.7152 * sRGB(G/255) + 0.0722 * sRGB(B/255)
else
return ''
end
end
local function hsl2lum(h, s, l)
if ( 0 <= h and h < 360 and 0 <= s and s <= 1 and 0 <= l and l <= 1 ) then
local c = (1 - math.abs(2*l - 1))*s
local x = c*(1 - math.abs( math.fmod(h/60, 2) - 1) )
local m = l - c/2
local r, g, b = m, m, m
if( 0 <= h and h < 60 ) then
r = r + c
g = g + x
elseif( 60 <= h and h < 120 ) then
r = r + x
g = g + c
elseif( 120 <= h and h < 180 ) then
g = g + c
b = b + x
elseif( 180 <= h and h < 240 ) then
g = g + x
b = b + c
elseif( 240 <= h and h < 300 ) then
r = r + x
b = b + c
elseif( 300 <= h and h < 360 ) then
r = r + c
b = b + x
end
return rgbdec2lum(255*r, 255*g, 255*b)
else
return ''
end
end
local function color2lum(c)
if (c == nil) then
return ''
end
-- html '#' entity
c = c:gsub("#", "#")
-- whitespace
c = c:match( '^%s*(.-)[%s;]*$' )
-- unstrip nowiki strip markers
c = mw.text.unstripNoWiki(c)
-- lowercase
c = c:lower()
-- first try to look it up
local L = HTMLcolor[c]
if (L ~= nil) then
return L
end
-- convert from hsl
if mw.ustring.match(c,'^hsl%([%s]*[0-9][0-9%.]*[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local h, s, l = mw.ustring.match(c,'^hsl%([%s]*([0-9][0-9%.]*)[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return hsl2lum(tonumber(h), tonumber(s)/100, tonumber(l)/100)
end
-- convert from rgb
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*,[%s]*[0-9][0-9]*[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*,[%s]*([0-9][0-9]*)[%s]*%)$')
return rgbdec2lum(tonumber(R), tonumber(G), tonumber(B))
end
-- convert from rgb percent
if mw.ustring.match(c,'^rgb%([%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*,[%s]*[0-9][0-9%.]*%%[%s]*%)$') then
local R, G, B = mw.ustring.match(c,'^rgb%([%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*,[%s]*([0-9][0-9%.]*)%%[%s]*%)$')
return rgbdec2lum(255*tonumber(R)/100, 255*tonumber(G)/100, 255*tonumber(B)/100)
end
-- remove leading # (if there is one) and whitespace
c = mw.ustring.match(c, '^[%s#]*([a-f0-9]*)[%s]*$')
-- split into rgb
local cs = mw.text.split(c or '', '')
if( #cs == 6 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[2])
local G = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[4])
local B = 16*tonumber('0x' .. cs[5]) + tonumber('0x' .. cs[6])
return rgbdec2lum(R, G, B)
elseif ( #cs == 3 ) then
local R = 16*tonumber('0x' .. cs[1]) + tonumber('0x' .. cs[1])
local G = 16*tonumber('0x' .. cs[2]) + tonumber('0x' .. cs[2])
local B = 16*tonumber('0x' .. cs[3]) + tonumber('0x' .. cs[3])
return rgbdec2lum(R, G, B)
end
-- failure, return blank
return ''
end
-- This exports the function for use in other modules.
-- The colour is passed as a string.
function p._lum(color)
return color2lum(color)
end
function p._greatercontrast(args)
local bias = tonumber(args['bias'] or '0') or 0
local css = (args['css'] and args['css'] ~= '') and true or false
local v1 = color2lum(args[1] or '')
local c2 = args[2] or 'white'
local v2 = color2lum(c2)
local c3 = args[3] or 'black'
local v3 = color2lum(c3)
local ratio1 = -1;
local ratio2 = -1;
if (type(v1) == 'number' and type(v2) == 'number') then
ratio1 = (v2 + 0.05)/(v1 + 0.05)
ratio1 = (ratio1 < 1) and 1/ratio1 or ratio1
end
if (type(v1) == 'number' and type(v3) == 'number') then
ratio2 = (v3 + 0.05)/(v1 + 0.05)
ratio2 = (ratio2 < 1) and 1/ratio2 or ratio2
end
if css then
local c1 = args[1] or ''
if mw.ustring.match(c1, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(c1, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c1 = '#' .. c1
end
if mw.ustring.match(c2, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(c2, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c2 = '#' .. c2
end
if mw.ustring.match(v3, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') or
mw.ustring.match(v3, '^[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]$') then
c3 = '#' .. c3
end
return 'background-color:' .. c1 .. '; color:' .. ((ratio1 > 0) and (ratio2 > 0) and ((ratio1 + bias > ratio2) and c2 or c3) or '') .. ';'
end
return (ratio1 > 0) and (ratio2 > 0) and ((ratio1 + bias > ratio2) and c2 or c3) or ''
end
function p._ratio(args)
local v1 = color2lum(args[1])
local v2 = color2lum(args[2])
if (type(v1) == 'number' and type(v2) == 'number') then
-- v1 should be the brighter of the two.
if v2 > v1 then
v1, v2 = v2, v1
end
return (v1 + 0.05)/(v2 + 0.05)
else
return args['error'] or '?'
end
end
function p._styleratio(args)
local style = (args[1] or ''):lower()
local bg, fg = 'white', 'black'
local lum_bg, lum_fg = 1, 0
if args[2] then
local lum = color2lum(args[2])
if lum ~= '' then bg, lum_bg = args[2], lum end
end
if args[3] then
local lum = color2lum(args[3])
if lum ~= '' then fg, lum_fg = args[3], lum end
end
local slist = mw.text.split(mw.ustring.gsub(mw.ustring.gsub(style or '', '&#[Xx]23;', '#'), '#', '#'), ';')
for k = 1,#slist do
local s = slist[k]
local k,v = s:match( '^[%s]*([^:]-):([^:]-)[%s;]*$' )
k = k or ''
v = v or ''
if (k:match('^[%s]*(background)[%s]*$') or k:match('^[%s]*(background%-color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_bg = v, lum end
elseif (k:match('^[%s]*(color)[%s]*$')) then
local lum = color2lum(v)
if( lum ~= '' ) then bg, lum_fg = v, lum end
end
end
if lum_bg > lum_fg then
return (lum_bg + 0.05)/(lum_fg + 0.05)
else
return (lum_fg + 0.05)/(lum_bg + 0.05)
end
end
--[[
Use {{#invoke:Color contrast|somecolor}} directly or
{{#invoke:Color contrast}} from a wrapper template.
Parameters:
-- |1= — required; A color to check.
--]]
function p.lum(frame)
local color = frame.args[1] or frame:getParent().args[1]
return p._lum(color)
end
function p.ratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._ratio(args)
end
function p.styleratio(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._styleratio(args)
end
function p.greatercontrast(frame)
local args = frame.args[1] and frame.args or frame:getParent().args
return p._greatercontrast(args)
end
return p
bx0blwcv5isqzm2jrxnp01lj4148n73
Template:Large
10
6654
74948
64621
2023-01-16T01:12:34Z
en>Jonesey95
0
use this template's own documentation
74948
wikitext
text/x-wiki
<span style="font-size:120%">{{{1}}}</span><noinclude>
{{Documentation}}
</noinclude>
gb9jg7srxpcm0n8wv0k3unldj3qzdrc
74949
74948
2026-08-24T00:44:19Z
Robertsky
10424
1 versaun husi [[:en:Template:Large]]
74948
wikitext
text/x-wiki
<span style="font-size:120%">{{{1}}}</span><noinclude>
{{Documentation}}
</noinclude>
gb9jg7srxpcm0n8wv0k3unldj3qzdrc
Wikipedia:Kafé/Kaixa-Mensajen Globál
4
7117
75050
74670
2026-08-24T01:25:15Z
MediaWiki message delivery
3558
/* The Signpost: 24 August 2026 */ nova secção
75050
wikitext
text/x-wiki
__NEWSECTIONLINK__<templatestyles src="Template:Kafé/Kaixa-Mensajen Globál/style.css" />
<div class="warta-main">
<span style="font-size:450%;"><center>𝕶𝖆𝖓𝖙𝖚 𝕹𝖔𝖙𝖎𝖘𝖎𝖆</center></span>
<div class="warta-body">
<div class="warta-body-align to-left">'''<span style="white-space: nowrap;">Edisaun</span> [[Wikipédia:Angkringan Warta/Arsip {{#time:Y}}|<span class="warta-link">'{{#time:y}}</span>]]'''</div>
<div class="warta-body-align to-right">'''<span style="white-space: nowrap;">Dalan:</span> [[WP:KMG|<span class="warta-link"><span style="white-space: nowrap;">WP:</span><span style="white-space: nowrap;">KMG</span></span>]]'''</div>
<span class="warta-tagline">''Notísia Projetu Wikimédia''</span>
</div>
</div>
{{clear}}
== ''This Month in GLAM'': December 2025 ==
{| style="width:100%;"
| valign="top" align="center" style="border:1px gray solid; padding:1em;" |
{| align="center"
|-
| style="text-align: center;" | [[File:This Month in GLAM logo 2018.png|350px|center|link=outreach:GLAM/Newsletter]]<br />
<hr />
<div style="font-size:12pt; font-family:Times New Roman; text-align:center;">[[outreach:GLAM/Newsletter/December 2025|<span style="color:darkslategray;">This Month in GLAM – Volume XV, Issue XII, December 2025</span>]]</div>
<hr /><br />
|- style="text-align: center;"
| <span style="font-size:12pt; font-family:Times New Roman;"> '''<u>Headlines</u>'''</span>
|- style="font-size:10pt; font-family:Times New Roman; text-align:center;"
| <div style="text-align:left; column-count:2; column-width:28em; vertical-align:top;">
* [[outreach:GLAM/Newsletter/December 2025/Contents/From the team|From the team]]: Global GLAM Calls Continue in 2026
* [[outreach:GLAM/Newsletter/December 2025/Contents/Albania report|Albania report]]: Wikimedian in Residence, 2025, in Elbasan Albania
* [[outreach:GLAM/Newsletter/December 2025/Contents/Argentina report|Argentina report]]: Resume of the year
* [[outreach:GLAM/Newsletter/December 2025/Contents/Australia report|Australia report]]: AMaGA partnership, signing the Open Heritage Statement and South Australian Museum Partner Project
* [[outreach:GLAM/Newsletter/December 2025/Contents/Belgium report|Belgium report]]: Public Domain Day 2026, Circus Heritage and Fosdem
* [[outreach:GLAM/Newsletter/December 2025/Contents/Colombia report|Colombia report]]: Preparándonos para celebrar el día del dominio público - Getting ready for the Public Domain Day celebration
* [[outreach:GLAM/Newsletter/December 2025/Contents/Italy report|Italy report]]: Exploring Italy and Unlocking Its Heritage: Touring Club Italiano and GLAM Call 2026–2028
* [[outreach:GLAM/Newsletter/December 2025/Contents/New Zealand report|New Zealand report]]: ASBS 2025 Conference follow-up Wiki webinar & Auckland Museum student update
* [[outreach:GLAM/Newsletter/December 2025/Contents/Poland report|Poland report]]: Public Domain, Conferences, and Conversations on Open Culture
* [[outreach:GLAM/Newsletter/December 2025/Contents/Switzerland report|Switzerland report]]: GLAM on Tour Bellinzona, Xmas Event, GLAM Wiki Group
* [[outreach:GLAM/Newsletter/December 2025/Contents/UK report|UK report]]: 2025 in review
* [[outreach:GLAM/Newsletter/December 2025/Contents/USA report|USA report]]: December meetings
* [[outreach:GLAM/Newsletter/December 2025/Contents/Public Domain Day report|Public Domain Day report]]: Public Domain Day 2026
* [[outreach:GLAM/Newsletter/December 2025/Contents/Biodiversity Heritage Library report|Biodiversity Heritage Library report]]: Updates on work by BHLWiki Working Group members
* [[outreach:GLAM/Newsletter/December 2025/Contents/Memory of the World report|Memory of the World report]]: 2025 in review
* [[outreach:GLAM/Newsletter/December 2025/Contents/Events|Calendar]]: January's GLAM events
</div>
|-
| style="font-family:Times New Roman; text-align:center; font-size:85%;" | [[outreach:GLAM/Newsletter|Read this edition in full]] • [[outreach:GLAM/Newsletter/December 2025/Single|Single-page]]
|-
| valign="top" colspan="2" style="padding:0.5em; font-family:Times New Roman;text-align:center; font-size:85%;" |
To assist with preparing the newsletter, please visit the [[outreach:GLAM/Newsletter/Newsroom|newsroom]]. Past editions may be viewed [[outreach:GLAM/Newsletter/Archives|here]].
|-
|}
|}
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[m:GLAM/Newsletter/About|About ''This Month in GLAM'']] · [[m:Global message delivery/Targets/GLAM|Subscribe/Unsubscribe]] · [[m:MassMessage|Global message delivery]] · [[:m:User:Romaine|Romaine]] 12h58min de 12 de Janeiru de 2026 (UTC)</div>
<!-- Mensagem enviada por User:Romaine@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/GLAM&oldid=29895284 -->
== ''The Signpost'': 15 January 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/News and notes|Wikipedia's 25th anniversary is here!]]
* Special report: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/Special report|Wikipedia at 25: A Wake-Up Call]]
* Serendipity: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/Serendipity|The WMF wants to buy you books!]]
* WikiProject report: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/WikiProject report|Time for a health check: the Vital Signs 2026 campaign]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/In the media|Fake Acting President Trump and a Wikipedia infobox]]
* Community view: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/Community view|The inbox behind Wikipedia]]
* Recent research: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/Recent research|Art museums on Wikidata; comparing three comparisons of Grokipedia and Wikipedia]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/Traffic report|Tonight I'm gonna rock you]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-15/Comix|Oh come on man.]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 15h19min de 15 de Janeiru de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:JPxG@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=29899914 -->
== Thank You for Last Year – Join Wiki Loves Ramadan 2026 ==
Dear Wikimedia communities,
We hope you are doing well, and we wish you a happy New Year.
''Last year, we captured light. This year, we’ll capture legacy.''
In 2025, communities around the world shared the glow of Ramadan nights and the warmth of collective iftars. In 2026, ''Wiki Loves Ramadan'' is expanding, bringing more stories, more cultures, and deeper global connections across Wikimedia projects.
We invite you to explore the ''Wiki Loves Ramadan 2026'' [[m:Special:MyLanguage/Wiki Loves Ramadan 2026|Meta page]] to learn how you can participate and [[m:Special:MyLanguage/Wiki Loves Ramadan 2026/Participating communities|sign up]] your community.
📷 ''Photo campaign on '' [[c:Special:MyLanguage/Commons:Wiki Loves Ramadan 2026|Wikimedia Commons]]
If you have questions about the project, please refer to the FAQs:
* [[m:Special:MyLanguage/Wiki Loves Ramadan/FAQ/|Meta-Wiki]]
* [[c:Special:MyLanguage/Commons:Wiki Loves Ramadan/FAQ|Wikimedia Commons]]
''Early registration for updates is now open via the '''[[m:Special:RegisterForEvent/2710|Event page]]'''''
''Stay connected and receive updates:''
* [https://t.me/WikiLovesRamadan Telegram channel]
* [https://lists.wikimedia.org/postorius/lists/wikilovesramadan.lists.wikimedia.org/ Mailing list]
We look forward to collaborating with you and your community.
'''The Wiki Loves Ramadan 2026 Organizing Team''' 19h45min de 16 de Janeiru de 2026 (UTC)
<!-- Mensagem enviada por User:ZI Jony@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Distribution_list/Non-Technical_Village_Pumps_distribution_list&oldid=29879549 -->
== <span lang="pt" dir="ltr">Revisão anual do Código de Conduta Universal e das Diretrizes de Aplicação</span> ==
<div lang="pt" dir="ltr">
<section begin="announcement-content" />
Esta mensagem é para lhe informar que o período de revisão anual do Código de Conduta Universal (UCoC) e das Diretrizes de Aplicação acabou de abrir. Será possível fazer suas sugestões sobre o que deve mudar até 9 de fevereiro de 2026. Esta é a primeira de várias etapas que comporão a revisão anual. [[m:Special:MyLanguage/Universal Code of Conduct/Annual review/2026|Saiba mais e junte-se à conversa na página do UCoC no Meta]].
O [[m:Special:MyLanguage/Universal Code of Conduct/Coordinating Committee|Comitê de Coordenação do Código de Conduta Universal]] (U4C) é um grupo global dedicado a entregar uma implementação equitativa e consistente do UCoC. Essa revisão anual foi planejada e implementada pelo U4C. Para mais informações sobre as responsabilidades do U4C, [[m:Special:MyLanguage/Universal Code of Conduct/Coordinating Committee/Charter|confira a Carta do U4C]].
Por favor, ajude-nos compartilhando essas informações com outros membros da sua comunidade nos lugares apropriados.
-- Em cooperação com o U4C, [[m:User:Keegan (WMF)|Keegan (WMF)]] ([[m:User talk:Keegan (WMF)|discussão]])<section end="announcement-content" />
</div>
21h02min de 19 de Janeiru de 2026 (UTC)
<!-- Mensagem enviada por User:Keegan (WMF)@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Distribution_list/Global_message_delivery&oldid=29905753 -->
== ''The Signpost'': 29 January 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-29/Traffic report|The most viewed articles of 2025]]
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-29/News and notes|Good news... but also bad news for the Public Domain]]
* News from Diff: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-29/News from Diff|Solving puzzles together]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-29/In the media|Every view on the 25th anniversary of everything]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-01-29/Comix|Perspectives]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 06h31min de 29 de Janeiru de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:JPxG@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=29988053 -->
== ''This Month in GLAM'': January 2026 ==
{| style="width:100%;"
| valign="top" align="center" style="border:1px gray solid; padding:1em;" |
{| align="center"
|-
| style="text-align: center;" | [[File:This Month in GLAM logo 2018.png|350px|center|link=outreach:GLAM/Newsletter]]<br />
<hr />
<div style="font-size:12pt; font-family:Times New Roman; text-align:center;">[[outreach:GLAM/Newsletter/January 2026|<span style="color:darkslategray;">This Month in GLAM – Volume XVI, Issue I, January 2026</span>]]</div>
<hr /><br />
|- style="text-align: center;"
| <span style="font-size:12pt; font-family:Times New Roman;"> '''<u>Headlines</u>'''</span>
|- style="font-size:10pt; font-family:Times New Roman; text-align:center;"
| <div style="text-align:left; column-count:2; column-width:28em; vertical-align:top;">
* [[outreach:GLAM/Newsletter/January 2026/Contents/From the team|From the team]]: Wikipedia at 25
* [[outreach:GLAM/Newsletter/January 2026/Contents/Aruba report|Aruba report]]: Pap-Wikipedia Turns 20: A Milestone for Papiamento/u Knowledge
* [[outreach:GLAM/Newsletter/January 2026/Contents/Colombia report|Colombia report]]: Celebrando el día del dominio público 2026/Celebrating the public domain day 2026
* [[outreach:GLAM/Newsletter/January 2026/Contents/France report|France report]]: Wikipedia's Birthday in France
* [[outreach:GLAM/Newsletter/January 2026/Contents/Germany report|Germany report]]: Gifted by our friends: Loads of presents for Wikipedia25 by German and Austrian GLAMs
* [[outreach:GLAM/Newsletter/January 2026/Contents/Indonesia report|Indonesia report]]: Activities in December-January
* [[outreach:GLAM/Newsletter/January 2026/Contents/Italy report|Italy report]]: Knowledge in action: Barindelli collection and Wikipedia 25
* [[outreach:GLAM/Newsletter/January 2026/Contents/Netherlands report|Netherlands report]]: Image donation Dutch Book History
* [[outreach:GLAM/Newsletter/January 2026/Contents/New Zealand report|New Zealand report]]: Auckland Museum Student Edit-a-thon, the NZBSI Wikimedian in Residence project, and other residencies
* [[outreach:GLAM/Newsletter/January 2026/Contents/Macedonia report|North Macedonia report]]: GLAM Program of Wikimedia MKD – 2026 Overview
* [[outreach:GLAM/Newsletter/January 2026/Contents/Poland report|Poland report]]: Explore Historic Portraits from the Museum of Photography in Kraków
* [[outreach:GLAM/Newsletter/January 2026/Contents/Serbia report|Serbia report]]: January in Wikimedia Serbia
* [[outreach:GLAM/Newsletter/January 2026/Contents/Switzerland report|Switzerland report]]: Museum in Chiasso, Alpine Museum, Women Monuments
* [[outreach:GLAM/Newsletter/January 2026/Contents/UK report|UK report]]: Sharing more of the Enamels of the World
* [[outreach:GLAM/Newsletter/January 2026/Contents/Biodiversity Heritage Library report|Biodiversity Heritage Library report]]: Updates on work by BHLWiki Working Group members
* [[outreach:GLAM/Newsletter/January 2026/Contents/Map the GLAM report|Map the GLAM report]]: Wiki and GLAM: Harnessing Knowledge to Foster Gender Equality
* [[outreach:GLAM/Newsletter/January 2026/Contents/Memory of the World report|Memory of the World report]]: Manuscripts on Arabic Wikipedia
* [[outreach:GLAM/Newsletter/January 2026/Contents/Wikidata report|Wikidata report]]: Two key Wikidata Requests for Comments, relevant for future GLAM-Wiki work
* [[outreach:GLAM/Newsletter/January 2026/Contents/Events|Calendar]]: February's GLAM events
</div>
|-
| style="font-family:Times New Roman; text-align:center; font-size:85%;" | [[outreach:GLAM/Newsletter|Read this edition in full]] • [[outreach:GLAM/Newsletter/January 2026/Single|Single-page]]
|-
| valign="top" colspan="2" style="padding:0.5em; font-family:Times New Roman;text-align:center; font-size:85%;" |
To assist with preparing the newsletter, please visit the [[outreach:GLAM/Newsletter/Newsroom|newsroom]]. Past editions may be viewed [[outreach:GLAM/Newsletter/Archives|here]].
|-
|}
|}
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[m:GLAM/Newsletter/About|About ''This Month in GLAM'']] · [[m:Global message delivery/Targets/GLAM|Subscribe/Unsubscribe]] · [[m:MassMessage|Global message delivery]] · [[:m:User:Romaine|Romaine]] 08h34min de 11 de Fevereiru de 2026 (UTC)</div>
<!-- Mensagem enviada por User:Romaine@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/GLAM&oldid=30055818 -->
== ''The Signpost'': 17 February 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/In the media|Global powers see Wikipedia as fundamental target for manipulation]]
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/News and notes|Discussions open for the next WMF Annual Plan]]
* Serendipity: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/Serendipity|Maintenance crews continue to slog through Wikipedia's oldest Featured Articles]]
* Disinformation report: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/Disinformation report|Epstein's obsessions]]
* Technology report: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/Technology report|Wikidata Graph Split and how we address major challenges]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/Traffic report|Deaths, killings, films, and the Olympics]]
* Opinion: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/Opinion|Incoming Incurables]]
* Crossword: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/Crossword|Pop quiz]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-02-17/Comix|herculean]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 08h03min de 17 de Fevereiru de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:JPxG@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30039447 -->
== ''The Signpost'': 10 March 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* Interview: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Interview|Bernadette Meehan, new Wikimedia Foundation CEO]]
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/News and notes|Security testing unleashes computer worm on Meta-wiki]]
* Special report: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Special report|What actually happened during the Wikimedia security incident?]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/In the media|Indonesian government blocks Wikimedia logins; archive site scoured from Wikipedia after owner runs malware]]
* Recent research: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Recent research|To wiki, perchance to groki]]
* Obituary: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Obituary|Madhav Gadgil, Fredrick Brennan, Mark Miller, Chip Berlet]]
* Opinion: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Opinion|Interface administrators and trusting trust]]
* Technology report: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Technology report|English Wikipedia deprecates archive.today after DDoS against blog, altered content]]
* Op-ed: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Op-ed|Why is "Trypsin-sensitive photosynthetic activities in chloroplast membranes" cited in "List of tallest buildings in Chicago"?]]
* Essay: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Essay|The pursuit of a button click]]
* In focus: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/In focus|Short descriptions: One year later]]
* WikiProject report: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/WikiProject report|Unreferenced articles backlog drive]]
* Community view: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Community view|Speaking of planning ...]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Traffic report|Over the mountain, kissing silver inlaid clouds]]
* Crossword: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Crossword|"It will never happen"]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-10/Comix|BRIEn't]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 04h15min de 10 de Marsu de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:JPxG@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30121359 -->
== ''This Month in GLAM'': February 2026 ==
{| style="width:100%;"
| valign="top" align="center" style="border:1px gray solid; padding:1em;" |
{| align="center"
|-
| style="text-align: center;" | [[File:This Month in GLAM logo 2018.png|350px|center|link=outreach:GLAM/Newsletter]]<br />
<hr />
<div style="font-size:12pt; font-family:Times New Roman; text-align:center;">[[outreach:GLAM/Newsletter/February 2026|<span style="color:darkslategray;">This Month in GLAM – Volume XVI, Issue II, February 2026</span>]]</div>
<hr /><br />
|- style="text-align: center;"
| <span style="font-size:12pt; font-family:Times New Roman;"> '''<u>Headlines</u>'''</span>
|- style="font-size:10pt; font-family:Times New Roman; text-align:center;"
| <div style="text-align:left; column-count:2; column-width:28em; vertical-align:top;">
* [[outreach:GLAM/Newsletter/February 2026/Contents/From the team|From the team]]: GLAM in 2026 is calling to action!
* [[outreach:GLAM/Newsletter/February 2026/Contents/Belgium report|Belgium report]]: A photo safari through Wiki Loves Fashion & a rescue mission with Mission Gourmande!
* [[outreach:GLAM/Newsletter/February 2026/Contents/Czech Republic report|Czech Republic report]]: National Library overview of 2025
* [[outreach:GLAM/Newsletter/February 2026/Contents/Italy report|Italy report]]: Cultural Heritage and Memory: 2026 GLAM Call and Executed Renaissance Edit-a-thon
* [[outreach:GLAM/Newsletter/February 2026/Contents/New Zealand report|New Zealand report]]: Farewelling the Auckland Museum Summer Students and an update on the NZBSI WiR
* [[outreach:GLAM/Newsletter/February 2026/Contents/Poland report|Poland report]]: Wikipedia in Cultural Marketing at Crash Mondays Warsaw
* [[outreach:GLAM/Newsletter/February 2026/Contents/Serbia report|Serbia report]]: February in Wikimedia Serbia
* [[outreach:GLAM/Newsletter/February 2026/Contents/Spain report|Spain report]]: Wikidata in the GLAM context II
* [[outreach:GLAM/Newsletter/February 2026/Contents/Switzerland report|Switzerland report]]: Neocomensia, SAPA, Atelier Winterthur, GLAM-on-Tour Disentis
* [[outreach:GLAM/Newsletter/February 2026/Contents/UK report|UK report]]: New content in African and Asian languages
* [[outreach:GLAM/Newsletter/February 2026/Contents/Biodiversity Heritage Library report|Biodiversity Heritage Library report]]: Updates on work by BHLWiki Working Group members
* [[outreach:GLAM/Newsletter/February 2026/Contents/Memory of the World report|Memory of the World report]]: Focus on Indigenous issues
* [[outreach:GLAM/Newsletter/February 2026/Contents/Events|Calendar]]: March's GLAM events
</div>
|-
| style="font-family:Times New Roman; text-align:center; font-size:85%;" | [[outreach:GLAM/Newsletter|Read this edition in full]] • [[outreach:GLAM/Newsletter/February 2026/Single|Single-page]]
|-
| valign="top" colspan="2" style="padding:0.5em; font-family:Times New Roman;text-align:center; font-size:85%;" |
To assist with preparing the newsletter, please visit the [[outreach:GLAM/Newsletter/Newsroom|newsroom]]. Past editions may be viewed [[outreach:GLAM/Newsletter/Archives|here]].
|-
|}
|}
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[m:GLAM/Newsletter/About|About ''This Month in GLAM'']] · [[m:Global message delivery/Targets/GLAM|Subscribe/Unsubscribe]] · [[m:MassMessage|Global message delivery]] · [[:m:User:Romaine|Romaine]] 00h52min de 12 de Marsu de 2026 (UTC)</div>
<!-- Mensagem enviada por User:Romaine@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/GLAM&oldid=30232291 -->
== Request for Comment: VisualEditor automatic reference names ==
<div lang="en" dir="ltr">
Hi, I’m Johannes from [[:m:Wikimedia Deutschland|Wikimedia Deutschland]]’s [[:m:WMDE Technical Wishes|Technical Wishes team]]. Apologies for writing in English. {{Int:Please-translate}}! We are considering to work on [[:m:Community Wishlist/W17|Community Wishlist/W17: Improve VE references' automatic names and reuse]]. This has been a long-term issue for wikitext editors (see e.g. [[:en:WP:VisualEditor/Named references]]) which has been among the top-voted wishes in several [[:m:Community Wishlist Survey|Community Wishlist Surveys]], e.g. [[:m:Community Wishlist Survey 2017/Editing/VisualEditor: Allow editing of auto-generated references before adding them|2017]], [[:m:Community Wishlist Survey 2019/Citations/VisualEditor: Allow references to be named|2019]], [[:m:Community Wishlist Survey 2022/Editing/VisualEditor should use human-like names for references|2022]] or [[:m:Community Wishlist Survey 2023/Editing/VisualEditor should use proper names for references|2023]].
We would like your input on the [[:m:WMDE Technical Wishes/References/VisualEditor automatic reference names#Proposed solutions|solutions]] proposed on our project page: '''[[:m:WMDE Technical Wishes/References/VisualEditor automatic reference names]]'''. We are considering several options, which can be combined if desired by the community.
* Changing the default pattern for automatically generated reference names (currently <code>":n"</code>, e.g. <code>":0"</code>, <code>":1"</code>...) to use the [[:mw:Help:Reference Previews#Exposed reference types|reference type]] instead (e.g. <code>"book_reference-1"</code>).
* Providing a simple mechanism for communities to configure a different default name.
* Generating automatic reference names based on the [[:en:domain name|domain name]] (if it’s a web citation).
* Generating automatic reference names based on template parameters (e.g. "title" or "last"+"first") – defined by the community.
=== Feedback ===
[[:m:WMDE Technical Wishes/References/VisualEditor automatic reference names|Visit our project page]] to read about our proposal in detail and share your thoughts [[:m:Talk:WMDE Technical Wishes/References/VisualEditor automatic reference names#Request for comment|on metawiki]].
'''Please note''': We will only implement a solution if there’s clear consensus among the global community. Our intention is not to build the perfect solution, but to find a simple and lean one that alleviates the pain caused by auto generated names. We are aware that some experienced VisualEditor users might prefer an option to manually change reference names in VisualEditor, but such a UX intervention is difficult to achieve across reference types and thus out of scope for our team, we can only improve the auto-naming mechanism.
We are happy about suggestions for improving certain details of the proposed solutions. Any other feedback and alternative proposals are also welcome – even though it’s out of scope for us, it might still be relevant for future work on this topic.
Please support us interpreting consensus by clearly indicating your opinion (e.g. by using support/neutral/oppose templates). We are aware of [[:en:WP:NOTVOTE]], but given that we are facilitating this discussion with users from different wikis, potentially commenting in their native language, clearly indicating your position helps us avoid misunderstandings.
Thank you for participating!</div> <bdi lang="en" dir="ltr">[[User:Johannes Richter (WMDE)|Johannes Richter (WMDE)]] ([[User talk:Johannes Richter (WMDE)|diskusaun]])</bdi> 11h15min de 19 de Marsu de 2026 (UTC)
<!-- Mensagem enviada por User:Johannes Richter (WMDE)@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=User:Johannes_Richter_(WMDE)/MassMessageRecipients&oldid=30281362 -->
== ''The Signpost'': 31 March 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/News and notes|Entirety of Wikinews to be shut down]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/In the media|AI ban, newspapers disrupt archiving; and antisemitism complaints]]
* Community view: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/Community view|Videos from WikiConference North America 2025 in NYC]]
* Disinformation report: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/Disinformation report|Cleaning up after Jeffrey Epstein, Peter Nygard, and Mohamed Al-Fayed]]
* WikiConference report: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/WikiConference report|WikiConference North America 2025 in NYC review]]
* Obituary: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/Obituary|Dr. Subas Chandra Rout]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/Traffic report|Call in the dogs of war, soldier of fortune]]
* Gallery: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/Gallery|Canadian Rangers participate in Operation ''Enduring Encyclopedia'']]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-03-31/Comix|n00bsitting]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 10h08min de 31 de Marsu de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:JPxG@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30329870 -->
== Action Required: Update templates/modules for electoral maps (Migrating from P1846 to P14226) ==
Hello everyone,
This is a notice regarding an ongoing data migration on Wikidata that may affect your election-related templates and Lua modules (such as <code>Module:Itemgroup/list</code>).
'''The Change:'''<br />
Currently, many templates pull electoral maps from Wikidata using the property [[:d:Property:P1846|P1846]], combined with the qualifier [[:d:Property:P180|P180]]: [[:d:Q19571328|Q19571328]].
We are migrating this data (across roughly 4,000 items) to a newly created, dedicated property: '''[[:d:Property:P14226|P14226]]'''.
'''What You Need To Do:'''<br />
To ensure your templates and infoboxes do not break or lose their maps, please update your local code to fetch data from [[:d:Property:P14226|P14226]] instead of the old [[:d:Property:P1846|P1846]] + [[:d:Property:P180|P180]] structure. A [[m:Wikidata/Property Migration: P1846 to P14226/List|list of pages]] was generated using Wikimedia Global Search.
'''Deadline:'''<br />
We are temporarily retaining the old data on [[:d:Property:P1846|P1846]] to allow for a smooth transition. However, to complete the data cleanup on Wikidata, the old [[:d:Property:P1846|P1846]] statements will be removed after '''May 1, 2026'''. Please update your modules and templates before this date to prevent any disruption to your wiki's election articles.
Let us know if you have any questions or need assistance with the query logic. Thank you for your help! [[User:ZI Jony|ZI Jony]] using [[Uza-na'in:MediaWiki message delivery|MediaWiki message delivery]] ([[Diskusaun Uza-na'in:MediaWiki message delivery|discussão]]) 17h09min de 3 de Abríl de 2026 (UTC)
<!-- Mensagem enviada por User:ZI Jony@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Distribution_list/Technical_Village_Pumps_distribution_list&oldid=29905755 -->
== ''This Month in GLAM'': March 2026 ==
{| style="width:100%;"
| valign="top" align="center" style="border:1px gray solid; padding:1em;" |
{| align="center"
|-
| style="text-align: center;" | [[File:This Month in GLAM logo 2018.png|350px|center|link=outreach:GLAM/Newsletter]]<br />
<hr />
<div style="font-size:12pt; font-family:Times New Roman; text-align:center;">[[outreach:GLAM/Newsletter/March 2026|<span style="color:darkslategray;">This Month in GLAM – Volume XVI, Issue III, March 2026</span>]]</div>
<hr /><br />
|- style="text-align: center;"
| <span style="font-size:12pt; font-family:Times New Roman;"> '''<u>Headlines</u>'''</span>
|- style="font-size:10pt; font-family:Times New Roman; text-align:center;"
| <div style="text-align:left; column-count:2; column-width:28em; vertical-align:top;">
* [[outreach:GLAM/Newsletter/March 2026/Contents/From the team|From the team]]: GLAM in Equinox
* [[outreach:GLAM/Newsletter/March 2026/Contents/Albania report|Albania report]]: Wikigap 2026 in Tirana, Albania
* [[outreach:GLAM/Newsletter/March 2026/Contents/Aruba report|Aruba report]]: Celebrating 20 Years of Papiamentu/o Wikipedia
* [[outreach:GLAM/Newsletter/March 2026/Contents/Bolivia report|Bolivia report]]: The Family Treasures Project Returns, with New GLAM Partners
* [[outreach:GLAM/Newsletter/March 2026/Contents/Brazil report|Brazil report]]: Wiki Loves Folklore Brazil defines six categories to represent Brazilian culture on Commons
* [[outreach:GLAM/Newsletter/March 2026/Contents/Colombia report|Colombia report]]: Architecture in the public domain in libraries in Nariño/Arquitectura en dominio público en bibliotecas nariñenses
* [[outreach:GLAM/Newsletter/March 2026/Contents/Czech Republic report|Czech Republic report]]: Main Wikimedian in Residence report for 2025 is here
* [[outreach:GLAM/Newsletter/March 2026/Contents/Germany report|Germany report]]: Art History Loves Wiki 2026 – digital/local. collection loves wiki
* [[outreach:GLAM/Newsletter/March 2026/Contents/India report|India report]]: Collaboration resumes with the British Library for Bangla Wikisource
* [[outreach:GLAM/Newsletter/March 2026/Contents/Italy report|Italy report]]: 2026 winners projects
* [[outreach:GLAM/Newsletter/March 2026/Contents/New Zealand report|New Zealand report]]: New Zealand Bioeconomy Science Institute Wikimedian in Residence update, a letter published in Nature & Architecture + Women NZ
* [[outreach:GLAM/Newsletter/March 2026/Contents/Macedonia report|North Macedonia report]]: Wikimedia MKD's GLAM Highlights: Botany and Beyond
* [[outreach:GLAM/Newsletter/March 2026/Contents/Portugal report|Portugal report]]: March in Portugal
* [[outreach:GLAM/Newsletter/March 2026/Contents/Serbia report|Serbia report]]: March in Wikimedia Serbia
* [[outreach:GLAM/Newsletter/March 2026/Contents/Sweden report|Sweden report]]: Looking for similar images
* [[outreach:GLAM/Newsletter/March 2026/Contents/Switzerland report|Switzerland report]]: GLAM Wiki Group, Donna, CoCreation PTT-Archive
* [[outreach:GLAM/Newsletter/March 2026/Contents/UK report|UK report]]: CILIP MDG 2026 Conference, Library meetups and the World's Enamels
* [[outreach:GLAM/Newsletter/March 2026/Contents/Ukraine report|Ukraine report]]: Spring 2026 news from Ukraine – Wiki Loves Folklore & more #1Lib1Ref
* [[outreach:GLAM/Newsletter/March 2026/Contents/USA report|USA report]]: MoMA's International Traveling Exhibitions and Wikidata on the LD4 Arts Affinity Group April Community Call
* [[outreach:GLAM/Newsletter/March 2026/Contents/Biodiversity Heritage Library report|Biodiversity Heritage Library report]]: Updates on work by BHL-Wiki Working Group members
* [[outreach:GLAM/Newsletter/March 2026/Contents/AvoinGLAM report|AvoinGLAM report]]: Oulu Löyly
* [[outreach:GLAM/Newsletter/March 2026/Contents/Memory of the World report|Memory of the World report]]: Indigenous languages on the Main Page
* [[outreach:GLAM/Newsletter/March 2026/Contents/Events|Calendar]]: April's GLAM events
</div>
|-
| style="font-family:Times New Roman; text-align:center; font-size:85%;" | [[outreach:GLAM/Newsletter|Read this edition in full]] • [[outreach:GLAM/Newsletter/March 2026/Single|Single-page]]
|-
| valign="top" colspan="2" style="padding:0.5em; font-family:Times New Roman;text-align:center; font-size:85%;" |
To assist with preparing the newsletter, please visit the [[outreach:GLAM/Newsletter/Newsroom|newsroom]]. Past editions may be viewed [[outreach:GLAM/Newsletter/Archives|here]].
|-
|}
|}
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[m:GLAM/Newsletter/About|About ''This Month in GLAM'']] · [[m:Global message delivery/Targets/GLAM|Subscribe/Unsubscribe]] · [[m:MassMessage|Global message delivery]] · [[:m:User:Romaine|Romaine]] 18h19min de 9 de Abríl de 2026 (UTC)</div>
<!-- Mensagem enviada por User:Romaine@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/GLAM&oldid=30344683 -->
== ''The Signpost'': 21 April 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-04-21/News and notes|Six Serbian Wikipedia editors banned following controversy about political bias]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-04-21/In the media|Could Wikipedia be involved in Massachusetts' proposed social media ban for minors?]]
* Gallery: [[w:en:Wikipedia:Wikipedia Signpost/2026-04-21/Gallery|March equinox]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-04-21/Traffic report|Time to change my galaxy in case, we outta space!]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-04-21/Comix|Of skirts and articles]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 06h50min de 21 de Abríl de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:JPxG@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30434643 -->
== Request for comment (global AI policy) ==
<bdi lang="en" dir="ltr" class="mw-content-ltr">
Apologies for writing in English. {{int:Please-translate}}
A [[:m:Requests for comment/Artificial intelligence policy|request for comment]] is currently being held to decide on a global AI policy. {{int:Feedback-thanks-title}}
[[Uza-na'in:MediaWiki message delivery|MediaWiki message delivery]] ([[Diskusaun Uza-na'in:MediaWiki message delivery|discussão]]) 00h58min de 26 de Abríl de 2026 (UTC)
</bdi>
<!-- Mensagem enviada por User:Codename Noreste@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Distribution_list/Global_message_delivery&oldid=30424282 -->
== ''This Month in GLAM'': April 2026 ==
{| style="width:100%;"
| valign="top" align="center" style="border:1px gray solid; padding:1em;" |
{| align="center"
|-
| style="text-align: center;" | [[File:This Month in GLAM logo 2018.png|350px|center|link=outreach:GLAM/Newsletter]]<br />
<hr />
<div style="font-size:12pt; font-family:Times New Roman; text-align:center;">[[outreach:GLAM/Newsletter/April 2026|<span style="color:darkslategray;">This Month in GLAM – Volume XVI, Issue IV, April 2026</span>]]</div>
<hr /><br />
|- style="text-align: center;"
| <span style="font-size:12pt; font-family:Times New Roman;"> '''<u>Headlines</u>'''</span>
|- style="font-size:10pt; font-family:Times New Roman; text-align:center;"
| <div style="text-align:left; column-count:2; column-width:28em; vertical-align:top;">
* [[outreach:GLAM/Newsletter/April 2026/Contents/From the team|From the team]]: How the GLAM Community Can Shine in the 2026–27 Annual Plan
* [[outreach:GLAM/Newsletter/April 2026/Contents/Albania report|Albania report]]: International Roma Day 2026 in Tirana, Albania
* [[outreach:GLAM/Newsletter/April 2026/Contents/Argentina report|Argentina report]]: WikiConf Argentina and GLAM projects
* [[outreach:GLAM/Newsletter/April 2026/Contents/Asia report|Asia report]]: Documenting and citing oral knowledge in audio and video
* [[outreach:GLAM/Newsletter/April 2026/Contents/Australia report|Australia report]]: WikiCon Australia, ICIP, Orphan works and Trans-Tasman partnerships
* [[outreach:GLAM/Newsletter/April 2026/Contents/Brazil report|Brazil report]]: Wikimedia Brasil publishes book on the power and challenges of free knowledge
* [[outreach:GLAM/Newsletter/April 2026/Contents/Colombia report|Colombia report]]: We celebrate Public Domain Day with an expert panel / Celebramos el día del dominio público con un Panel de expertas
* [[outreach:GLAM/Newsletter/April 2026/Contents/Italy report|Italy report]]: Ongoing and New GLAM-Wiki Projects
* [[outreach:GLAM/Newsletter/April 2026/Contents/New Zealand report|New Zealand report]]: Women in Wartime event at Auckland Museum & an update for WiR NZBSI
* [[outreach:GLAM/Newsletter/April 2026/Contents/Nigeria report|Nigeria report]]: Wikimedia Commons Upload Campaign
* [[outreach:GLAM/Newsletter/April 2026/Contents/Macedonia report|North Macedonia report]]: Wikimedia MKD in Action: Digitization, Wikisource and Educational Workshops
* [[outreach:GLAM/Newsletter/April 2026/Contents/Poland report|Poland report]]: GLAM-Wiki Developments: Residencies, Partnerships and Audiovisual Heritage
* [[outreach:GLAM/Newsletter/April 2026/Contents/Serbia report|Serbia report]]: April in Wikimedia Serbia
* [[outreach:GLAM/Newsletter/April 2026/Contents/Switzerland report|Switzerland report]]: Le Donne di Villa Massimo
* [[outreach:GLAM/Newsletter/April 2026/Contents/UK report|UK report]]: A tenth-century Quran and Islamic Art in Urdu
* [[outreach:GLAM/Newsletter/April 2026/Contents/USA report|USA report]]: Wiki MIT launches and US meetups
* [[outreach:GLAM/Newsletter/April 2026/Contents/Biodiversity Heritage Library report|Biodiversity Heritage Library report]]: Update on the BHL Annual Meeting 27 April - 1 May & BHL Day
* [[outreach:GLAM/Newsletter/April 2026/Contents/Memory of the World report|Memory of the World report]]: Eight new articles on MoW inscriptions
* [[outreach:GLAM/Newsletter/April 2026/Contents/Events|Calendar]]: May's GLAM events
</div>
|-
| style="font-family:Times New Roman; text-align:center; font-size:85%;" | [[outreach:GLAM/Newsletter|Read this edition in full]] • [[outreach:GLAM/Newsletter/April 2026/Single|Single-page]]
|-
| valign="top" colspan="2" style="padding:0.5em; font-family:Times New Roman;text-align:center; font-size:85%;" |
To assist with preparing the newsletter, please visit the [[outreach:GLAM/Newsletter/Newsroom|newsroom]]. Past editions may be viewed [[outreach:GLAM/Newsletter/Archives|here]].
|-
|}
|}
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[m:GLAM/Newsletter/About|About ''This Month in GLAM'']] · [[m:Global message delivery/Targets/GLAM|Subscribe/Unsubscribe]] · [[m:MassMessage|Global message delivery]] · [[:m:User:Romaine|Romaine]] 13h50min de 11 de Maiu de 2026 (UTC)</div>
<!-- Mensagem enviada por User:Romaine@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/GLAM&oldid=30513880 -->
== ''The Signpost'': 22 May 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/News and notes|Offline: Osama Khalid still in prison]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/In the media|Indonesian editors, you shall return!]]
* Disinformation report: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Disinformation report|Who is a typical paid editor? Who are their typical clients?]]
* Recent research: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Recent research|WikiLambda the Ultimate]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Traffic report|This is where I'll be, so heavenly, so come and dance with me Michael!]]
* Forum: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Forum|WikiAnnotate: help us build a dataset of article quality evaluations]]
* In focus: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/In focus|Demystifying the 2026-27 Annual Plan]]
* Opinion: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Opinion|Wikipedia isn't a battleground. So why does it feel like one?]]
* Serendipity: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Serendipity|Wikinews: Into the Wikiverse]]
* Special report: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Special report|Wikimedia Foundation closes Wikinews after 21 years]]
* Community view: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Community view|Wikipedia's traffic drop: more on languages and freshness]]
* Gallery: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Gallery|Earth Day and Mother's Day]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-05-22/Comix|Brother, can you spare a page?]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 05h19min de 22 de Maiu de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:Bri@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30513885 -->
== <span lang="en" dir="ltr">Vote now in the 2026 U4C election</span> ==
<div lang="en" dir="ltr">
<section begin="announcement-content" />
Eligible voters are asked to participate in the 2026 [[m:Special:MyLanguage/Universal_Code_of_Conduct/Coordinating_Committee|Universal Code of Conduct Coordinating Committee]] election. More information–including an eligibility check, voting process information, candidate information, and a link to the vote–are available on Meta at the [[m:Special:MyLanguage/Universal_Code_of_Conduct/Coordinating_Committee/Election/2026|2026 Election information page]]. The vote closes on 2 June 2026 at [https://zonestamp.toolforge.org/1780358400 00:00 UTC].
Please vote if your account is eligible. Results will be available by 14 June 2026. -- In cooperation with the U4C,<section end="announcement-content" />
</div>
[[m:User:Keegan (WMF)|Keegan (WMF)]] ([[m:User talk:Keegan (WMF)|talk]]) 17h15min de 27 de Maiu de 2026 (UTC)
<!-- Mensagem enviada por User:Keegan (WMF)@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Distribution_list/Global_message_delivery&oldid=30513860 -->
<bdi lang="en" dir="ltr" class="mw-content-ltr">
== Survey (proposed direction for Wishlist) ==
Apologies if this has not yet been translated into your wiki's language. {{int:Please-translate}}.
You are invited to voice your opinion on a new [[m:Talk:Community Wishlist#Proposed direction for Wishlist|community-proposed direction]] for the [[m:Community Wishlist|Community Wishlist]]. {{Int:Feedback-thanks-title}} [[Uza-na'in:MediaWiki message delivery|MediaWiki message delivery]] ([[Diskusaun Uza-na'in:MediaWiki message delivery|discussão]]) 03h07min de 29 de Maiu de 2026 (UTC)
</bdi>
<!-- Mensagem enviada por User:기나ㅏㄴ@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=User:%EA%B8%B0%EB%82%98%E3%85%8F%E3%84%B4/MassMessage&oldid=30604233 -->
== ''This Month in GLAM'': May 2026 ==
{| style="width:100%;"
| valign="top" align="center" style="border:1px gray solid; padding:1em;" |
{| align="center"
|-
| style="text-align: center;" | [[File:This Month in GLAM logo 2018.png|350px|center|link=outreach:GLAM/Newsletter]]<br />
<hr />
<div style="font-size:12pt; font-family:Times New Roman; text-align:center;">[[outreach:GLAM/Newsletter/May 2026|<span style="color:darkslategray;">This Month in GLAM – Volume XVI, Issue V, May 2026</span>]]</div>
<hr /><br />
|- style="text-align: center;"
| <span style="font-size:12pt; font-family:Times New Roman;"> '''<u>Headlines</u>'''</span>
|- style="font-size:10pt; font-family:Times New Roman; text-align:center;"
| <div style="text-align:left; column-count:2; column-width:28em; vertical-align:top;">
* [[outreach:GLAM/Newsletter/May 2026/Contents/From the team|From the team]]: May Global GLAM Call Recording and June Call Announcement
* [[outreach:GLAM/Newsletter/May 2026/Contents/Australia report|Australia report]]: Celebrating #1Lib1Ref Australasia
* [[outreach:GLAM/Newsletter/May 2026/Contents/Brazil report|Brazil report]]: GLAM Connection: Fashion, History, and Biodiversity in May
* [[outreach:GLAM/Newsletter/May 2026/Contents/France report|France report]]: New Wikimedian in Residence
* [[outreach:GLAM/Newsletter/May 2026/Contents/Italy report|Italy report]]: Connecting the Arctic and Sicily through Wikimedia Projects
* [[outreach:GLAM/Newsletter/May 2026/Contents/Mexico report|Mexico report]]: How the cultural, governmental, educational, and museum sectors contributed in unison to Wikimedia projects
* [[outreach:GLAM/Newsletter/May 2026/Contents/Netherlands report|Netherlands report]]: Setting up your own platform (part 1): from wish to the creation of a wiki
* [[outreach:GLAM/Newsletter/May 2026/Contents/New Zealand report|New Zealand report]]: ESEAP Conference 2026 and the NZBSI WiR update
* [[outreach:GLAM/Newsletter/May 2026/Contents/Macedonia report|North Macedonia report]]: Wikimedia MKD Shares GLAM Experience at International Conferences
* [[outreach:GLAM/Newsletter/May 2026/Contents/Poland report|Poland report]]: Partnerships, Participation, and Open Knowledge
* [[outreach:GLAM/Newsletter/May 2026/Contents/Serbia report|Serbia report]]: May in Wikimedia Serbia
* [[outreach:GLAM/Newsletter/May 2026/Contents/Spain report|Spain report]]: El Prado en femenino III
* [[outreach:GLAM/Newsletter/May 2026/Contents/Switzerland report|Switzerland report]]: Museum for Communication, Panel IMD, Wikipedia Day
* [[outreach:GLAM/Newsletter/May 2026/Contents/UK report|UK report]]: Early Qurans on the front page of Wikipedia
* [[outreach:GLAM/Newsletter/May 2026/Contents/Biodiversity Heritage Library report|Biodiversity Heritage Library report]]: Updates on work by BHLWiki Working Group members
* [[outreach:GLAM/Newsletter/May 2026/Contents/Special story|Special story]]: New tools for multilingual audio, video and metadata
* [[outreach:GLAM/Newsletter/May 2026/Contents/Memory of the World report|Memory of the World report]]: New articles in Urdu
* [[outreach:GLAM/Newsletter/May 2026/Contents/Events|Calendar]]: June's GLAM events
</div>
|-
| style="font-family:Times New Roman; text-align:center; font-size:85%;" | [[outreach:GLAM/Newsletter|Read this edition in full]] • [[outreach:GLAM/Newsletter/May 2026/Single|Single-page]]
|-
| valign="top" colspan="2" style="padding:0.5em; font-family:Times New Roman;text-align:center; font-size:85%;" |
To assist with preparing the newsletter, please visit the [[outreach:GLAM/Newsletter/Newsroom|newsroom]]. Past editions may be viewed [[outreach:GLAM/Newsletter/Archives|here]].
|-
|}
|}
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[m:GLAM/Newsletter/About|About ''This Month in GLAM'']] · [[m:Global message delivery/Targets/GLAM|Subscribe/Unsubscribe]] · [[m:MassMessage|Global message delivery]] · [[:m:User:Romaine|Romaine]] 21h21min de 12 de Juñu de 2026 (UTC)</div>
<!-- Mensagem enviada por User:Romaine@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/GLAM&oldid=30636889 -->
== ''The Signpost'': 21 June 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* From the editors: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/From the editors|Ways for beginners to support ''The Signpost'' community journalism]]
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/News and notes|Community Tech development team disbanded]]
* Disinformation report: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Disinformation report|PR for the people?]]
* Recent research: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Recent research|Proposed tagging system for AI involvement; successful and unsuccessful AI tools for contributors]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/In the media|Who won a 14th century battle and who won the 2026 Iran war?]]
* Community view: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Community view|Putting the Wish into the Wishlist]]
* In focus: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/In focus|A global standard for Neutral Point of View]]
* On the bright side: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/On the bright side|Flowers, blue helmets, reefs, pride, and Juneteenth]]
* Op-ed: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Op-ed|Breathe, Don’t Panic, there is a different story about Wikimedia + AI futures]]
* Opinion: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Opinion|Wikimedia Foundation staff develop union and Wikimedia user community reacts]]
* Technology report: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Technology report|Community Tech team is disbanded, controversy erupts]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Traffic report|'Cause this is thriller, thriller night]]
* WikiConference report: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/WikiConference report|Report of Volunteer Supporters Network Annual Meeting 2026]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Comix|Take your turn]]
* Humour: [[w:en:Wikipedia:Wikipedia Signpost/2026-06-21/Humour|Group of banned T-shirt makers comes out of hiding to sell new Wikipedia-themed merchandise]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 03h21min de 21 de Juñu de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:Bri@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30604303 -->
== RFC about AI-generated content in Wikimedia Commons ==
<bdi lang="en" dir="ltr">Apologies for writing in English, please help translate this message to your language. You are invited to participate in a [[c:Commons:Requests for comment/Policy update for AI content|request for comment on Wikimedia Commons about a policy update for AI content]]. This may affect files that are uploaded to Wikimedia Commons for use on this project. Thank you. [[m:User:Codename Noreste|Codename Noreste]] ([[m:User talk:Codename Noreste|diskusaun]])</bdi> 17h11min de 23 de Juñu de 2026 (UTC)
<!-- Mensagem enviada por User:Codename Noreste@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Distribution_list/Global_message_delivery&oldid=30513860 -->
== <span lang="pt" dir="ltr">Implementação do link para contactos jurídicos e de segurança no rodapé do seu Wiki</span> ==
<div lang="pt" dir="ltr">
<section begin="Message"/>
'''Contactos jurídicos e de segurança'''
Olá, comunidade. A Fundação Wikimedia disponibilizou uma [[wmf:Special:MyLanguage/Legal:Wikimedia Foundation Legal and Safety Contact Information|página única de contacto jurídico e de segurança]], que deve ser incluída no rodapé da vossa wiki, para garantir o acesso a informações jurídicas precisas. Trata-se de um requisito regulamentar. Já implementámos ligações para as wikis em inglês, alemão, italiano, espanhol e outras Wikipedias, e iremos implementá-las na vossa wiki em breve. [[m:Special:MyLanguage/Wikimedia_Foundation_Legal_and_Safety_Contacts_FAQ|Por favor, leiam mais na página do projeto]] e deixem os vossos comentários neste tópico ou na [[m:Special:MyLanguage/Talk:Wikimedia Foundation Legal and Safety Contacts FAQ|página de discussão]].
<section end="Message"/>
</div>
-- [[User:Sannita (WMF)|User:Sannita (WMF)]] ([[User talk:Sannita (WMF)|talk]]) 13h30min de 25 de Juñu de 2026 (UTC)
<!-- Mensagem enviada por User:Sannita (WMF)@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=User:Sannita_(WMF)/Mass_sending_test&oldid=30731267 -->
== ''This Month in GLAM'': June 2026 ==
{| style="width:100%;"
| valign="top" align="center" style="border:1px gray solid; padding:1em;" |
{| align="center"
|-
| style="text-align: center;" | [[File:This Month in GLAM logo 2018.png|350px|center|link=outreach:GLAM/Newsletter]]<br />
<hr />
<div style="font-size:12pt; font-family:Times New Roman; text-align:center;">[[outreach:GLAM/Newsletter/June 2026|<span style="color:darkslategray;">This Month in GLAM – Volume XVI, Issue VI, June 2026</span>]]</div>
<hr /><br />
|- style="text-align: center;"
| <span style="font-size:12pt; font-family:Times New Roman;"> '''<u>Headlines</u>'''</span>
|- style="font-size:10pt; font-family:Times New Roman; text-align:center;"
| <div style="text-align:left; column-count:2; column-width:28em; vertical-align:top;">
* [[outreach:GLAM/Newsletter/June 2026/Contents/From the team|From the team]]: Tools, tech, and Wikimania
* [[outreach:GLAM/Newsletter/June 2026/Contents/Argentina report|Argentina report]]: New digitization partner
* [[outreach:GLAM/Newsletter/June 2026/Contents/Bangladesh report|Bangladesh report]]: International Museum Day Edit-a-thon and Workshop held in Dinajpur, Bangladesh
* [[outreach:GLAM/Newsletter/June 2026/Contents/Belgium report|Belgium report]]: Postal Mission on Wikimedia
* [[outreach:GLAM/Newsletter/June 2026/Contents/Brazil report|Brazil report]]: Empowering Institutions through Wikisource Education and GLAM Capacity Building
* [[outreach:GLAM/Newsletter/June 2026/Contents/Czech Republic report|Czech Republic report]]: Bridging the gap between labs and Wikipedia: continuing cooperation with FZU
* [[outreach:GLAM/Newsletter/June 2026/Contents/Egypt report|Egypt report]]: From Museum Celebrations to Archival Documentation
* [[outreach:GLAM/Newsletter/June 2026/Contents/Finland report|Finland report]]: Northern Wikimedist meetup in Oulu
* [[outreach:GLAM/Newsletter/June 2026/Contents/France report|France report]]: #1lib1ref Recap and International Archives Week
* [[outreach:GLAM/Newsletter/June 2026/Contents/Italy report|Italy report]]: Heritage and Community Action
* [[outreach:GLAM/Newsletter/June 2026/Contents/Mexico report|Mexico report]]: Open GLAM in Puebla
* [[outreach:GLAM/Newsletter/June 2026/Contents/Netherlands report|Netherlands report]]: Interview with Olaf Janssen, Wikimedia coordinator of the KB, National library of the Netherlands
* [[outreach:GLAM/Newsletter/June 2026/Contents/New Zealand report|New Zealand report]]: BAU at Auckland Museum, Otago Uni Library Life and the NZBSI WiR is complete
* [[outreach:GLAM/Newsletter/June 2026/Contents/Macedonia report|North Macedonia report]]: Collaboration with the Botanical garden at the Faculty of Natural Sciences and Mathematics in Skopje
* [[outreach:GLAM/Newsletter/June 2026/Contents/Poland report|Poland report]]: Poland Report: New Partnerships, Conferences, and Wikimedians in Residence
* [[outreach:GLAM/Newsletter/June 2026/Contents/Serbia report|Serbia report]]: Opening the Doors of Serbian Heritage: Wikimedia Serbia’s Recent GLAM and Wikidata Successes
* [[outreach:GLAM/Newsletter/June 2026/Contents/Spain report|Spain report]]: GLAM Labs Futures 2026
* [[outreach:GLAM/Newsletter/June 2026/Contents/Sweden report|Sweden report]]: Finnish-Swedish cooperation
* [[outreach:GLAM/Newsletter/June 2026/Contents/Switzerland report|Switzerland report]]: Exhibition, International Archives Week Panel
* [[outreach:GLAM/Newsletter/June 2026/Contents/UK report|UK report]]: Ninth Good Article from Khalili partnership
* [[outreach:GLAM/Newsletter/June 2026/Contents/USA report|USA report]]: Philadelphia WikiSalon
* [[outreach:GLAM/Newsletter/June 2026/Contents/Biodiversity Heritage Library report|Biodiversity Heritage Library report]]: Updates on work by BHLWiki Working Group members
* [[outreach:GLAM/Newsletter/June 2026/Contents/AvoinGLAM report|AvoinGLAM report]]: Is the sauna still hot?
* [[outreach:GLAM/Newsletter/June 2026/Contents/Memory of the World report|Memory of the World report]]: New articles
* [[outreach:GLAM/Newsletter/June 2026/Contents/Events|Calendar]]: July's GLAM events
</div>
|-
| style="font-family:Times New Roman; text-align:center; font-size:85%;" | [[outreach:GLAM/Newsletter|Read this edition in full]] • [[outreach:GLAM/Newsletter/June 2026/Single|Single-page]]
|-
| valign="top" colspan="2" style="padding:0.5em; font-family:Times New Roman;text-align:center; font-size:85%;" |
To assist with preparing the newsletter, please visit the [[outreach:GLAM/Newsletter/Newsroom|newsroom]]. Past editions may be viewed [[outreach:GLAM/Newsletter/Archives|here]].
|-
|}
|}
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[m:GLAM/Newsletter/About|About ''This Month in GLAM'']] · [[m:Global message delivery/Targets/GLAM|Subscribe/Unsubscribe]] · [[m:MassMessage|Global message delivery]] · [[:m:User:Romaine|Romaine]] 22h35min de 11 de Jullu de 2026 (UTC)</div>
<!-- Mensagem enviada por User:Romaine@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/GLAM&oldid=30773577 -->
== ''The Signpost'': 13 July 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/News and notes|An exclusive club]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/In the media|Battle for a soul - who won?]]
* Opinion: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/Opinion|We need to innovate with Wikimedia decision-making]]
* Recent research: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/Recent research|LLMs and NPOV, 20 years of user blocks, Esperanto and Volapük Wikipedias]]
* News from Diff: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/News from Diff|How to host Wikicurious in your own community]]
* Community view: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/Community view|CUNY Newmark Wikimedian-in-Residence Quarterly Brief – April to June 2026]]
* Special report: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/Special report|Wikipedia escapes Category 1 designation under the UK Online Safety Act - for now]]
* On the bright side: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/On the bright side|Fatherhood, weather, and diplomacy]]
* Op-ed: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/Op-ed|A Layup Easy Proposal for Wikimedia at 25: Spend 25% of Donations on the Community]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/Traffic report|The grass was greener, the light was brighter]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-07-13/Comix|schnozzed]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 07h27min de 13 de Jullu de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:JPxG@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30775662 -->
== Request for comment (the future of Abstract Wikipedia) ==
<bdi lang="en" dir="ltr" class="mw-content-ltr">
Apologies if this has not yet been translated into your wiki's language. {{int:Please-translate}}
You are invited to voice your opinions in a [[:m:Requests for comment/The future of Abstract Wikipedia|request for comment about the future of Abstract Wikipedia]]. {{Int:Feedback-thanks-title}}
[[:m:User:Kowal2701|Kowal2701]] ([[:m:User talk:Kowal2701|talk]]) 12h25min de 24 de Jullu de 2026 (UTC)
</bdi>
<!-- Mensagem enviada por User:DreamRimmer@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Distribution_list/Global_message_delivery&oldid=30513860 -->
== ''The Signpost'': 2 August 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/In the media|Union drive, most prolific editor make headlines]]
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/News and notes|Foundation rejects voluntary recognition of union, proposed board eligibility rules sharply restrict candidates]]
* WikiConference: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/WikiConference|"Kurier, Signpost, wikipress: You can be a Wikimedia journalist" - Wikimania presentation by User:Noé Recap]]
* In focus: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/In focus|Is Larry Sanger the co-founder of Wikipedia?]]
* Arbitration report: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/Arbitration report|Think, and not just about content]]
* News from Diff: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/News from Diff|Meet the Wikimedians of the Year 2026!]]
* On the bright side: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/On the bright side|The beautiful game]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/Traffic report|Odyssey and Oyarzabal]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-02/Comix|Well-spotted]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 10h18min de 2 de Agostu de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:JPxG@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30775662 -->
== ''This Month in GLAM'': July 2026 ==
{| style="width:100%;"
| valign="top" align="center" style="border:1px gray solid; padding:1em;" |
{| align="center"
|-
| style="text-align: center;" | [[File:This Month in GLAM logo 2018.png|350px|center|link=outreach:GLAM/Newsletter]]<br />
<hr />
<div style="font-size:12pt; font-family:Times New Roman; text-align:center;">[[outreach:GLAM/Newsletter/July 2026|<span style="color:darkslategray;">This Month in GLAM – Volume XVI, Issue VII, July 2026</span>]]</div>
<hr /><br />
|- style="text-align: center;"
| <span style="font-size:12pt; font-family:Times New Roman;"> '''<u>Headlines</u>'''</span>
|- style="font-size:10pt; font-family:Times New Roman; text-align:center;"
| <div style="text-align:left; column-count:2; column-width:28em; vertical-align:top;">
* [[outreach:GLAM/Newsletter/July 2026/Contents/From the team|From the team]]: July and Wikimania Have Come and Gone
* [[outreach:GLAM/Newsletter/July 2026/Contents/Brazil report|Brazil report]]: Strategic Workshops, Academic Publications, and Bidding Farewell to NeuroMat
* [[outreach:GLAM/Newsletter/July 2026/Contents/Colombia report|Colombia report]]: Colombia at Wikimania 2026: panel on how the far-right affects open knowledge institutions
* [[outreach:GLAM/Newsletter/July 2026/Contents/Egypt report|Egypt report]]: From Al-Ahram to Zamalek: Exploring Archives and Art Galleries
* [[outreach:GLAM/Newsletter/July 2026/Contents/France report|France report]]: GLAM Presentations at Wikimania 2026 + Wiki Fashion Show
* [[outreach:GLAM/Newsletter/July 2026/Contents/New Zealand report|New Zealand report]]: Launch of Wikifying a Conference handbook; Wikipedia Workshop at Te Toi Uku
* [[outreach:GLAM/Newsletter/July 2026/Contents/Poland report|Poland report]]: GLAM-Wiki partnerships continue opening collections
* [[outreach:GLAM/Newsletter/July 2026/Contents/Sweden report|Sweden report]]: At Wikimania and copyright process
* [[outreach:GLAM/Newsletter/July 2026/Contents/Switzerland report|Switzerland report]]: Faces and Masks - the interwoven relation, Wikimania Paris
* [[outreach:GLAM/Newsletter/July 2026/Contents/UK report|UK report]]: Wikimania report + New articles in Hindi
* [[outreach:GLAM/Newsletter/July 2026/Contents/USA report|USA report]]: GLAM USA Report (Past & Upcoming)
* [[outreach:GLAM/Newsletter/July 2026/Contents/Biodiversity Heritage Library report|Biodiversity Heritage Library report]]: Updates on work by BHLWiki Working Group members
* [[outreach:GLAM/Newsletter/July 2026/Contents/Memory of the World report|Memory of the World report]]: Academic paper in preparation
* [[outreach:GLAM/Newsletter/July 2026/Contents/Wiki Knowledge Park report|Wiki Knowledge Park report]]: Preserving Islamic Cultural Heritage: The GLAM and Metadata Impact of Wiki Loves Ramadan 2026
* [[outreach:GLAM/Newsletter/July 2026/Contents/Events|Calendar]]: August's GLAM events
</div>
|-
| style="font-family:Times New Roman; text-align:center; font-size:85%;" | [[outreach:GLAM/Newsletter|Read this edition in full]] • [[outreach:GLAM/Newsletter/July 2026/Single|Single-page]]
|-
| valign="top" colspan="2" style="padding:0.5em; font-family:Times New Roman;text-align:center; font-size:85%;" |
To assist with preparing the newsletter, please visit the [[outreach:GLAM/Newsletter/Newsroom|newsroom]]. Past editions may be viewed [[outreach:GLAM/Newsletter/Archives|here]].
|-
|}
|}
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[m:GLAM/Newsletter/About|About ''This Month in GLAM'']] · [[m:Global message delivery/Targets/GLAM|Subscribe/Unsubscribe]] · [[m:MassMessage|Global message delivery]] · [[:m:User:Romaine|Romaine]] 00h03min de 12 de Agostu de 2026 (UTC)</div>
<!-- Mensagem enviada por User:Romaine@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/GLAM&oldid=30901934 -->
== ''The Signpost'': 24 August 2026 ==
<div lang="en" dir="ltr" class="mw-content-ltr" style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">[[File:WikipediaSignpostIcon.svg|40px|right]] ''News, reports and features from the English Wikipedia's newspaper''</div>
<div style="column-count:2;">
* News and notes: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/News and notes|Union process progresses, unanswered questions about Littler Mendelson remain]]
* In the media: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/In the media|Wikipedia editors save Sam Altman's life]]
* Recent research: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/Recent research|Women in blue? Wikipedia's gender gap reverses in some areas]]
* Discussion report: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/Discussion report|Again and Again]]
* Traffic report: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/Traffic report|Look out, here comes the Spider-Man!]]
* Humour: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/Humour|Her tastes, her Wikimania, her upcoming tour... Baby Globe reveals everything]]
* On the bright side: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/On the bright side|The great outdoors]]
* Opinion: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/Opinion|Are we embarrassed yet?]]
* Special report: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/Special report|Paris Syndrome: Labor Strife, AI Anxiety, and a Leadership Test at Wikimania 2026]]
* Comix: [[w:en:Wikipedia:Wikipedia Signpost/2026-08-24/Comix|WP:FAOWN]]
</div>
<div style="margin-top:10px; font-size:90%; padding-left:5px; font-family:Georgia, Palatino, Palatino Linotype, Times, Times New Roman, serif;">'''[[w:en:Wikipedia:Wikipedia Signpost|Read this Signpost in full]]''' · [[w:en:Wikipedia:Signpost/Single|Single-page]] · [[m:Global message delivery/Targets/Signpost|Unsubscribe]] · [[m:Global message delivery|Global message delivery]] 01h25min de 24 de Agostu de 2026 (UTC)
<!-- Sent via script ([[w:en:User:JPxG/SPS]]) --></div>
<!-- Mensagem enviada por User:Bri@metawiki utilizando a lista em https://meta.wikimedia.org/w/index.php?title=Global_message_delivery/Targets/Signpost&oldid=30889666 -->
5ah0xhtes4y6l9yanklpshyl5iei48l
Módulo:Wikidata
828
7137
75052
72600
2026-08-24T02:11:06Z
Robertsky
10424
copied from enwiki
75052
Scribunto
text/plain
-- vim: set noexpandtab ft=lua ts=4 sw=4:
require('strict')
local p = {}
local debug = false
------------------------------------------------------------------------------
-- module local variables and functions
local wiki =
{
langcode = mw.language.getContentLanguage().code
}
-- internationalisation
local i18n =
{
["errors"] =
{
["property-not-found"] = "Property not found.",
["entity-not-found"] = "Wikidata entity not found.",
["unknown-claim-type"] = "Unknown claim type.",
["unknown-entity-type"] = "Unknown entity type.",
["qualifier-not-found"] = "Qualifier not found.",
["site-not-found"] = "Wikimedia project not found.",
["unknown-datetime-format"] = "Unknown datetime format.",
["local-article-not-found"] = "Article is not yet available in this wiki."
},
["datetime"] =
{
-- $1 is a placeholder for the actual number
[0] = "$1 billion years", -- precision: billion years
[1] = "$100 million years", -- precision: hundred million years
[2] = "$10 million years", -- precision: ten million years
[3] = "$1 million years", -- precision: million years
[4] = "$100,000 years", -- precision: hundred thousand years
[5] = "$10,000 years", -- precision: ten thousand years
[6] = "$1 millennium", -- precision: millennium
[7] = "$1 century", -- precision: century
[8] = "$1s", -- precision: decade
-- the following use the format of #time parser function
[9] = "Y", -- precision: year,
[10] = "F Y", -- precision: month
[11] = "F j, Y", -- precision: day
[12] = "F j, Y ga", -- precision: hour
[13] = "F j, Y g:ia", -- precision: minute
[14] = "F j, Y g:i:sa", -- precision: second
["beforenow"] = "$1 BCE", -- how to format negative numbers for precisions 0 to 5
["afternow"] = "$1 CE", -- how to format positive numbers for precisions 0 to 5
["bc"] = '$1 "BCE"', -- how print negative years
["ad"] = "$1", -- how print positive years
-- the following are for function getDateValue() and getQualifierDateValue()
["default-format"] = "dmy", -- default value of the #3 (getDateValue) or
-- #4 (getQualifierDateValue) argument
["default-addon"] = "BC", -- default value of the #4 (getDateValue) or
-- #5 (getQualifierDateValue) argument
["prefix-addon"] = false, -- set to true for languages put "BC" in front of the
-- datetime string; or the addon will be suffixed
["addon-sep"] = " ", -- separator between datetime string and addon (or inverse)
["format"] = -- options of the 3rd argument
{
["mdy"] = "F j, Y",
["my"] = "F Y",
["y"] = "Y",
["dmy"] = "j F Y",
["ymd"] = "Y-m-d",
["ym"] = "Y-m"
}
},
["monolingualtext"] = '<span lang="%language">%text</span>',
["warnDump"] = "[[Category:Called function 'Dump' from module Wikidata]]",
["ordinal"] =
{
[1] = "st",
[2] = "nd",
[3] = "rd",
["default"] = "th"
}
}
if wiki.langcode ~= "en" then
--require("Module:i18n").loadI18n("Module:Wikidata/i18n", i18n)
-- got idea from [[:w:Module:Wd]]
local module_title; if ... == nil then
module_title = mw.getCurrentFrame():getTitle()
else
module_title = ...
end
require('Module:i18n').loadI18n(module_title..'/i18n', i18n)
end
-- this function needs to be internationalised along with the above:
-- takes cardinal numer as a numeric and returns the ordinal as a string
-- we need three exceptions in English for 1st, 2nd, 3rd, 21st, .. 31st, etc.
local function makeOrdinal (cardinal)
local ordsuffix = i18n.ordinal.default
if cardinal % 10 == 1 then
ordsuffix = i18n.ordinal[1]
elseif cardinal % 10 == 2 then
ordsuffix = i18n.ordinal[2]
elseif cardinal % 10 == 3 then
ordsuffix = i18n.ordinal[3]
end
-- In English, 1, 21, 31, etc. use 'st', but 11, 111, etc. use 'th'
-- similarly for 12 and 13, etc.
if (cardinal % 100 == 11) or (cardinal % 100 == 12) or (cardinal % 100 == 13) then
ordsuffix = i18n.ordinal.default
end
return tostring(cardinal) .. ordsuffix
end
local function printError(code)
return '<span class="error">' .. (i18n.errors[code] or code) .. '</span>'
end
local function parseDateFormat(f, timestamp, addon, prefix_addon, addon_sep)
local year_suffix
local tstr = ""
local lang_obj = mw.language.new(wiki.langcode)
local f_parts = mw.text.split(f, 'Y', true)
for idx, f_part in pairs(f_parts) do
year_suffix = ''
if string.match(f_part, "x[mijkot]$") then
-- for non-Gregorian year
f_part = f_part .. 'Y'
elseif idx < #f_parts then
-- supress leading zeros in year
year_suffix = lang_obj:formatDate('Y', timestamp)
year_suffix = string.gsub(year_suffix, '^0+', '', 1)
end
tstr = tstr .. lang_obj:formatDate(f_part, timestamp) .. year_suffix
end
if addon ~= "" and prefix_addon then
return addon .. addon_sep .. tstr
elseif addon ~= "" then
return tstr .. addon_sep .. addon
else
return tstr
end
end
local function parseDateValue(timestamp, date_format, date_addon)
local prefix_addon = i18n["datetime"]["prefix-addon"]
local addon_sep = i18n["datetime"]["addon-sep"]
local addon = ""
-- check for negative date
if string.sub(timestamp, 1, 1) == '-' then
timestamp = '+' .. string.sub(timestamp, 2)
addon = date_addon
end
local _date_format = i18n["datetime"]["format"][date_format]
if _date_format ~= nil then
return parseDateFormat(_date_format, timestamp, addon, prefix_addon, addon_sep)
else
return printError("unknown-datetime-format")
end
end
-- This local function combines the year/month/day/BC/BCE handling of parseDateValue{}
-- with the millennium/century/decade handling of formatDate()
local function parseDateFull(timestamp, precision, date_format, date_addon)
local prefix_addon = i18n["datetime"]["prefix-addon"]
local addon_sep = i18n["datetime"]["addon-sep"]
local addon = ""
-- check for negative date
if string.sub(timestamp, 1, 1) == '-' then
timestamp = '+' .. string.sub(timestamp, 2)
addon = date_addon
end
-- get the next four characters after the + (should be the year now in all cases)
-- ok, so this is dirty, but let's get it working first
local intyear = tonumber(string.sub(timestamp, 2, 5))
if intyear == 0 and precision <= 9 then
return ""
end
-- precision is 10000 years or more
if precision <= 5 then
local factor = 10 ^ ((5 - precision) + 4)
local y2 = math.ceil(math.abs(intyear) / factor)
local relative = mw.ustring.gsub(i18n.datetime[precision], "$1", tostring(y2))
if addon ~= "" then
-- negative date
relative = mw.ustring.gsub(i18n.datetime.beforenow, "$1", relative)
else
relative = mw.ustring.gsub(i18n.datetime.afternow, "$1", relative)
end
return relative
end
-- precision is decades (8), centuries (7) and millennia (6)
local era, card
if precision == 6 then
card = math.floor((intyear - 1) / 1000) + 1
era = mw.ustring.gsub(i18n.datetime[6], "$1", makeOrdinal(card))
end
if precision == 7 then
card = math.floor((intyear - 1) / 100) + 1
era = mw.ustring.gsub(i18n.datetime[7], "$1", makeOrdinal(card))
end
if precision == 8 then
era = mw.ustring.gsub(i18n.datetime[8], "$1", tostring(math.floor(math.abs(intyear) / 10) * 10))
end
if era then
if addon ~= "" then
era = mw.ustring.gsub(mw.ustring.gsub(i18n.datetime.bc, '"', ""), "$1", era)
else
era = mw.ustring.gsub(mw.ustring.gsub(i18n.datetime.ad, '"', ""), "$1", era)
end
return era
end
local _date_format = i18n["datetime"]["format"][date_format]
if _date_format ~= nil then
-- check for precision is year and override supplied date_format
if precision == 9 then
_date_format = i18n["datetime"][9]
end
return parseDateFormat(_date_format, timestamp, addon, prefix_addon, addon_sep)
else
return printError("unknown-datetime-format")
end
end
-- the "qualifiers" and "snaks" field have a respective "qualifiers-order" and "snaks-order" field
-- use these as the second parameter and this function instead of the built-in "pairs" function
-- to iterate over all qualifiers and snaks in the intended order.
local function orderedpairs(array, order)
if not order then return pairs(array) end
-- return iterator function
local i = 0
return function()
i = i + 1
if order[i] then
return order[i], array[order[i]]
end
end
end
-- precision: 0 - billion years, 1 - hundred million years, ..., 6 - millennia, 7 - century, 8 - decade, 9 - year, 10 - month, 11 - day, 12 - hour, 13 - minute, 14 - second
local function normalizeDate(date)
date = mw.text.trim(date, "+")
-- extract year
local yearstr = mw.ustring.match(date, "^\-?%d+")
local year = tonumber(yearstr)
-- remove leading zeros of year
return year .. mw.ustring.sub(date, #yearstr + 1), year
end
local function formatDate(date, precision, timezone)
precision = precision or 11
local date, year = normalizeDate(date)
if year == 0 and precision <= 9 then return "" end
-- precision is 10000 years or more
if precision <= 5 then
local factor = 10 ^ ((5 - precision) + 4)
local y2 = math.ceil(math.abs(year) / factor)
local relative = mw.ustring.gsub(i18n.datetime[precision], "$1", tostring(y2))
if year < 0 then
relative = mw.ustring.gsub(i18n.datetime.beforenow, "$1", relative)
else
relative = mw.ustring.gsub(i18n.datetime.afternow, "$1", relative)
end
return relative
end
-- precision is decades, centuries and millennia
local era
if precision == 6 then era = mw.ustring.gsub(i18n.datetime[6], "$1", tostring(math.floor((math.abs(year) - 1) / 1000) + 1)) end
if precision == 7 then era = mw.ustring.gsub(i18n.datetime[7], "$1", tostring(math.floor((math.abs(year) - 1) / 100) + 1)) end
if precision == 8 then era = mw.ustring.gsub(i18n.datetime[8], "$1", tostring(math.floor(math.abs(year) / 10) * 10)) end
if era then
if year < 0 then era = mw.ustring.gsub(mw.ustring.gsub(i18n.datetime.bc, '"', ""), "$1", era)
elseif year > 0 then era = mw.ustring.gsub(mw.ustring.gsub(i18n.datetime.ad, '"', ""), "$1", era) end
return era
end
-- precision is year
if precision == 9 then
return year
end
-- precision is less than years
if precision > 9 then
--[[ the following code replaces the UTC suffix with the given negated timezone to convert the global time to the given local time
timezone = tonumber(timezone)
if timezone and timezone ~= 0 then
timezone = -timezone
timezone = string.format("%.2d%.2d", timezone / 60, timezone % 60)
if timezone[1] ~= '-' then timezone = "+" .. timezone end
date = mw.text.trim(date, "Z") .. " " .. timezone
end
]]--
local formatstr = i18n.datetime[precision]
if year == 0 then formatstr = mw.ustring.gsub(formatstr, i18n.datetime[9], "")
elseif year < 0 then
-- Mediawiki formatDate doesn't support negative years
date = mw.ustring.sub(date, 2)
formatstr = mw.ustring.gsub(formatstr, i18n.datetime[9], mw.ustring.gsub(i18n.datetime.bc, "$1", i18n.datetime[9]))
elseif year > 0 and i18n.datetime.ad ~= "$1" then
formatstr = mw.ustring.gsub(formatstr, i18n.datetime[9], mw.ustring.gsub(i18n.datetime.ad, "$1", i18n.datetime[9]))
end
return mw.language.new(wiki.langcode):formatDate(formatstr, date)
end
end
local function printDatavalueEntity(data, parameter)
-- data fields: entity-type [string], numeric-id [int, Wikidata id]
local id
if data["entity-type"] == "item" then id = "Q" .. data["numeric-id"]
elseif data["entity-type"] == "property" then id = "P" .. data["numeric-id"]
else return printError("unknown-entity-type")
end
if parameter then
if parameter == "link" then
local linkTarget = mw.wikibase.getSitelink(id)
local linkName = mw.wikibase.getLabel(id)
if linkTarget then
-- if there is a local Wikipedia article link to it using the label or the article title
return "[[" .. linkTarget .. "|" .. (linkName or linkTarget) .. "]]"
else
-- if there is no local Wikipedia article output the label or link to the Wikidata object to let the user input a proper label
if linkName then return linkName else return "[[:d:" .. id .. "|" .. id .. "]]" end
end
else
return data[parameter]
end
else
return mw.wikibase.getLabel(id) or id
end
end
local function printDatavalueTime(data, parameter)
-- data fields: time [ISO 8601 time], timezone [int in minutes], before [int], after [int], precision [int], calendarmodel [wikidata URI]
-- precision: 0 - billion years, 1 - hundred million years, ..., 6 - millennia, 7 - century, 8 - decade, 9 - year, 10 - month, 11 - day, 12 - hour, 13 - minute, 14 - second
-- calendarmodel: e.g. http://www.wikidata.org/entity/Q1985727 for the proleptic Gregorian calendar or http://www.wikidata.org/wiki/Q11184 for the Julian calendar]
if parameter then
if parameter == "calendarmodel" then data.calendarmodel = mw.ustring.match(data.calendarmodel, "Q%d+") -- extract entity id from the calendar model URI
elseif parameter == "time" then data.time = normalizeDate(data.time) end
return data[parameter]
else
return formatDate(data.time, data.precision, data.timezone)
end
end
local function printDatavalueMonolingualText(data, parameter)
-- data fields: language [string], text [string]
if parameter then
return data[parameter]
else
local result = mw.ustring.gsub(mw.ustring.gsub(i18n.monolingualtext, "%%language", data["language"]), "%%text", data["text"])
return result
end
end
local function findClaims(entity, property)
if not property or not entity or not entity.claims then return end
if mw.ustring.match(property, "^P%d+$") then
-- if the property is given by an id (P..) access the claim list by this id
return entity.claims[property]
else
property = mw.wikibase.resolvePropertyId(property)
if not property then return end
return entity.claims[property]
end
end
local function getSnakValue(snak, parameter)
if snak.snaktype == "value" then
-- call the respective snak parser
if snak.datavalue.type == "string" then return snak.datavalue.value
elseif snak.datavalue.type == "globecoordinate" then return printDatavalueCoordinate(snak.datavalue.value, parameter)
elseif snak.datavalue.type == "quantity" then return printDatavalueQuantity(snak.datavalue.value, parameter)
elseif snak.datavalue.type == "time" then return printDatavalueTime(snak.datavalue.value, parameter)
elseif snak.datavalue.type == "wikibase-entityid" then return printDatavalueEntity(snak.datavalue.value, parameter)
elseif snak.datavalue.type == "monolingualtext" then return printDatavalueMonolingualText(snak.datavalue.value, parameter)
end
end
return mw.wikibase.renderSnak(snak)
end
local function getQualifierSnak(claim, qualifierId)
-- a "snak" is Wikidata terminology for a typed key/value pair
-- a claim consists of a main snak holding the main information of this claim,
-- as well as a list of attribute snaks and a list of references snaks
if qualifierId then
-- search the attribute snak with the given qualifier as key
if claim.qualifiers then
local qualifier = claim.qualifiers[qualifierId]
if qualifier then return qualifier[1] end
end
return nil, printError("qualifier-not-found")
else
-- otherwise return the main snak
return claim.mainsnak
end
end
local function getValueOfClaim(claim, qualifierId, parameter)
local error
local snak
snak, error = getQualifierSnak(claim, qualifierId)
if snak then
return getSnakValue(snak, parameter)
else
return nil, error
end
end
local function getReferences(frame, claim)
local result = ""
-- traverse through all references
for ref in pairs(claim.references or {}) do
local refparts
-- traverse through all parts of the current reference
for snakkey, snakval in orderedpairs(claim.references[ref].snaks or {}, claim.references[ref]["snaks-order"]) do
if refparts then refparts = refparts .. ", " else refparts = "" end
-- output the label of the property of the reference part, e.g. "imported from" for P143
refparts = refparts .. tostring(mw.wikibase.getLabel(snakkey)) .. ": "
-- output all values of this reference part, e.g. "German Wikipedia" and "English Wikipedia" if the referenced claim was imported from both sites
for snakidx = 1, #snakval do
if snakidx > 1 then refparts = refparts .. ", " end
refparts = refparts .. getSnakValue(snakval[snakidx])
end
end
if refparts then result = result .. frame:extensionTag("ref", refparts) end
end
return result
end
local function parseInput(frame)
local qid = frame.args.qid
if qid and (#qid == 0) then qid = nil end
local propertyID = mw.text.trim(frame.args[1] or "")
local input_parm = mw.text.trim(frame.args[2] or "")
if input_parm ~= "FETCH_WIKIDATA" then
return false, input_parm, nil, nil
end
local entity = mw.wikibase.getEntity(qid)
local claims
if entity and entity.claims then
claims = entity.claims[propertyID]
if not claims then
return false, "", nil, nil
end
else
return false, "", nil, nil
end
return true, entity, claims, propertyID
end
local function isType(claims, type)
return claims[1] and claims[1].mainsnak.snaktype == "value" and claims[1].mainsnak.datavalue.type == type
end
local function getValue(entity, claims, propertyID, delim, labelHook)
if labelHook == nil then
labelHook = function (qnumber)
return nil;
end
end
if isType(claims, "wikibase-entityid") then
local out = {}
for k, v in pairs(claims) do
local qnumber = "Q" .. v.mainsnak.datavalue.value["numeric-id"]
local sitelink = mw.wikibase.getSitelink(qnumber)
local label = labelHook(qnumber) or mw.wikibase.getLabel(qnumber) or qnumber
if sitelink then
out[#out + 1] = "[[" .. sitelink .. "|" .. label .. "]]"
else
out[#out + 1] = "[[:d:" .. qnumber .. "|" .. label .. "]]<abbr title='" .. i18n["errors"]["local-article-not-found"] .. "'>[*]</abbr>"
end
end
return table.concat(out, delim)
else
-- just return best values
return entity:formatPropertyValues(propertyID).value
end
end
------------------------------------------------------------------------------
-- module global functions
if debug then
function p.inspectI18n(frame)
local val = i18n
for _, key in pairs(frame.args) do
key = mw.text.trim(key)
val = val[key]
end
return val
end
end
function p.descriptionIn(frame)
local langcode = frame.args[1]
local id = frame.args[2]
-- return description of a Wikidata entity in the given language or the default language of this Wikipedia site
return mw.wikibase.getEntity(id):getDescription(langcode or wiki.langcode)
end
function p.labelIn(frame)
local langcode = frame.args[1]
local id = frame.args[2]
-- return label of a Wikidata entity in the given language or the default language of this Wikipedia site
return mw.wikibase.getEntity(id):getLabel(langcode or wiki.langcode)
end
-- This is used to get a value, or a comma separated list of them if multiple values exist
p.getValue = function(frame)
local delimdefault = ", " -- **internationalise later**
local delim = frame.args.delimiter or ""
delim = string.gsub(delim, '"', '')
if #delim == 0 then
delim = delimdefault
end
local go, errorOrentity, claims, propertyID = parseInput(frame)
if not go then
return errorOrentity
end
return getValue(errorOrentity, claims, propertyID, delim)
end
-- Same as above, but uses the short name property for label if available.
p.getValueShortName = function(frame)
local go, errorOrentity, claims, propertyID = parseInput(frame)
if not go then
return errorOrentity
end
local entity = errorOrentity
-- if wiki-linked value output as link if possible
local function labelHook (qnumber)
local label
local claimEntity = mw.wikibase.getEntity(qnumber)
if claimEntity ~= nil then
if claimEntity.claims.P1813 then
for k2, v2 in pairs(claimEntity.claims.P1813) do
if v2.mainsnak.datavalue.value.language == "en" then
label = v2.mainsnak.datavalue.value.text
end
end
end
end
if label == nil or label == "" then return nil end
return label
end
return getValue(errorOrentity, claims, propertyID, ", ", labelHook);
end
-- This is used to get a value, or a comma separated list of them if multiple values exist
-- from an arbitrary entry by using its QID.
-- Use : {{#invoke:Wikidata|getValueFromID|<ID>|<Property>|FETCH_WIKIDATA}}
-- E.g.: {{#invoke:Wikidata|getValueFromID|Q151973|P26|FETCH_WIKIDATA}} - to fetch value of 'spouse' (P26) from 'Richard Burton' (Q151973)
-- Please use sparingly - this is an *expensive call*.
p.getValueFromID = function(frame)
local itemID = mw.text.trim(frame.args[1] or "")
local propertyID = mw.text.trim(frame.args[2] or "")
local input_parm = mw.text.trim(frame.args[3] or "")
if input_parm == "FETCH_WIKIDATA" then
local entity = mw.wikibase.getEntity(itemID)
local claims
if entity and entity.claims then
claims = entity.claims[propertyID]
end
if claims then
return getValue(entity, claims, propertyID, ", ")
else
return ""
end
else
return input_parm
end
end
local function getQualifier(frame, outputHook)
local propertyID = mw.text.trim(frame.args[1] or "")
local qualifierID = mw.text.trim(frame.args[2] or "")
local input_parm = mw.text.trim(frame.args[3] or "")
if input_parm == "FETCH_WIKIDATA" then
local entity = mw.wikibase.getEntity()
if entity.claims[propertyID] ~= nil then
local out = {}
for k, v in pairs(entity.claims[propertyID]) do
for k2, v2 in pairs(v.qualifiers[qualifierID]) do
if v2.snaktype == 'value' then
out[#out + 1] = outputHook(v2);
end
end
end
return table.concat(out, ", "), true
else
return "", false
end
else
return input_parm, false
end
end
p.getQualifierValue = function(frame)
local function outputValue(value)
local qnumber = "Q" .. value.datavalue.value["numeric-id"]
if (mw.wikibase.getSitelink(qnumber)) then
return "[[" .. mw.wikibase.getSitelink(qnumber) .. "]]"
else
return "[[:d:" .. qnumber .. "|" ..qnumber .. "]]<abbr title='" .. i18n["errors"]["local-article-not-found"] .. "'>[*]</abbr>"
end
end
return (getQualifier(frame, outputValue))
end
-- This is used to get a value like 'male' (for property p21) which won't be linked and numbers without the thousand separators
p.getRawValue = function(frame)
local go, errorOrentity, claims, propertyID = parseInput(frame)
if not go then
return errorOrentity
end
local entity = errorOrentity
local result = entity:formatPropertyValues(propertyID, mw.wikibase.entity.claimRanks).value
-- if number type: remove thousand separators, bounds and units
if isType(claims, "quantity") then
result = mw.ustring.gsub(result, "(%d),(%d)", "%1%2")
result = mw.ustring.gsub(result, "(%d)±.*", "%1")
end
return result
end
-- This is used to get the unit name for the numeric value returned by getRawValue
p.getUnits = function(frame)
local go, errorOrentity, claims, propertyID = parseInput(frame)
if not go then
return errorOrentity
end
local entity = errorOrentity
local result = entity:formatPropertyValues(propertyID, mw.wikibase.entity.claimRanks).value
if isType(claims, "quantity") then
result = mw.ustring.sub(result, mw.ustring.find(result, " ")+1, -1)
end
return result
end
-- This is used to get the unit's QID to use with the numeric value returned by getRawValue
p.getUnitID = function(frame)
local go, errorOrentity, claims = parseInput(frame)
if not go then
return errorOrentity
end
local entity = errorOrentity
local result
if isType(claims, "quantity") then
-- get the url for the unit entry on Wikidata:
result = claims[1].mainsnak.datavalue.value.unit
-- and just reurn the last bit from "Q" to the end (which is the QID):
result = mw.ustring.sub(result, mw.ustring.find(result, "Q"), -1)
end
return result
end
p.getRawQualifierValue = function(frame)
local function outputHook(value)
if value.datavalue.value["numeric-id"] then
return mw.wikibase.getLabel("Q" .. value.datavalue.value["numeric-id"])
else
return value.datavalue.value
end
end
local ret, gotData = getQualifier(frame, outputHook)
if gotData then
ret = string.upper(string.sub(ret, 1, 1)) .. string.sub(ret, 2)
end
return ret
end
-- This is used to get a date value for date_of_birth (P569), etc. which won't be linked
-- Dates and times are stored in ISO 8601 format (sort of).
-- At present the local formatDate(date, precision, timezone) function doesn't handle timezone
-- So I'll just supply "Z" in the call to formatDate below:
p.getDateValue = function(frame)
local date_format = mw.text.trim(frame.args[3] or i18n["datetime"]["default-format"])
local date_addon = mw.text.trim(frame.args[4] or i18n["datetime"]["default-addon"])
local go, errorOrentity, claims = parseInput(frame)
if not go then
return errorOrentity
end
local entity = errorOrentity
local out = {}
for k, v in pairs(claims) do
if v.mainsnak.datavalue.type == 'time' then
local timestamp = v.mainsnak.datavalue.value.time
local dateprecision = v.mainsnak.datavalue.value.precision
-- A year can be stored like this: "+1872-00-00T00:00:00Z",
-- which is processed here as if it were the day before "+1872-01-01T00:00:00Z",
-- and that's the last day of 1871, so the year is wrong.
-- So fix the month 0, day 0 timestamp to become 1 January instead:
timestamp = timestamp:gsub("%-00%-00T", "-01-01T")
out[#out + 1] = parseDateFull(timestamp, dateprecision, date_format, date_addon)
end
end
return table.concat(out, ", ")
end
p.getQualifierDateValue = function(frame)
local date_format = mw.text.trim(frame.args[4] or i18n["datetime"]["default-format"])
local date_addon = mw.text.trim(frame.args[5] or i18n["datetime"]["default-addon"])
local function outputHook(value)
local timestamp = value.datavalue.value.time
return parseDateValue(timestamp, date_format, date_addon)
end
return (getQualifier(frame, outputHook))
end
-- This is used to fetch all of the images with a particular property, e.g. image (P18), Gene Atlas Image (P692), etc.
-- Parameters are | propertyID | value / FETCH_WIKIDATA / nil | separator (default=space) | size (default=frameless)
-- It will return a standard wiki-markup [[File:Filename | size]] for each image with a selectable size and separator (which may be html)
-- e.g. {{#invoke:Wikidata|getImages|P18|FETCH_WIKIDATA}}
-- e.g. {{#invoke:Wikidata|getImages|P18|FETCH_WIKIDATA|<br>|250px}}
-- If a property is chosen that is not of type "commonsMedia", it will return empty text.
p.getImages = function(frame)
local sep = mw.text.trim(frame.args[3] or " ")
local imgsize = mw.text.trim(frame.args[4] or "frameless")
local go, errorOrentity, claims = parseInput(frame)
if not go then
return errorOrentity
end
local entity = errorOrentity
if (claims[1] and claims[1].mainsnak.datatype == "commonsMedia") then
local out = {}
for k, v in pairs(claims) do
local filename = v.mainsnak.datavalue.value
out[#out + 1] = "[[File:" .. filename .. "|" .. imgsize .. "]]"
end
return table.concat(out, sep)
else
return ""
end
end
-- This is used to get the TA98 (Terminologia Anatomica first edition 1998) values like 'A01.1.00.005' (property P1323)
-- which are then linked to https://ifaa.unifr.ch/Public/EntryPage/TA98%20Tree/Entity%20TA98%20EN/01.1.00.005%20Entity%20TA98%20EN.htm
-- uses the newer mw.wikibase calls instead of directly using the snaks
-- formatPropertyValues returns a table with the P1323 values concatenated with ", " so we have to split them out into a table in order to construct the return string
p.getTAValue = function(frame)
local ent = mw.wikibase.getEntity()
local props = ent:formatPropertyValues('P1323')
local out = {}
local t = {}
for k, v in pairs(props) do
if k == 'value' then
t = mw.text.split( v, ", ")
for k2, v2 in pairs(t) do
out[#out + 1] = "[https://ifaa.unifr.ch/Public/EntryPage/TA98%20Tree/Entity%20TA98%20EN/" .. string.sub(v2, 2) .. "%20Entity%20TA98%20EN.htm " .. v2 .. "]"
end
end
end
local ret = table.concat(out, "<br> ")
if #ret == 0 then
ret = "Invalid TA"
end
return ret
end
--[[
This is used to return an image legend from Wikidata
image is property P18
image legend is property P2096
Call as {{#invoke:Wikidata |getImageLegend | <PARAMETER> | lang=<ISO-639code> |id=<QID>}}
Returns PARAMETER, unless it is equal to "FETCH_WIKIDATA", from Item QID (expensive call)
If QID is omitted or blank, the current article is used (not an expensive call)
If lang is omitted, it uses the local wiki language, otherwise it uses the provided ISO-639 language code
ISO-639: https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html#wp1252447
Ranks are: 'preferred' > 'normal'
This returns the label from the first image with 'preferred' rank
Or the label from the first image with 'normal' rank if preferred returns nothing
Ranks: https://www.mediawiki.org/wiki/Extension:Wikibase_Client/Lua
]]
p.getImageLegend = function(frame)
-- look for named parameter id; if it's blank make it nil
local id = frame.args.id
if id and (#id == 0) then
id = nil
end
-- look for named parameter lang
-- it should contain a two-character ISO-639 language code
-- if it's blank fetch the language of the local wiki
local lang = frame.args.lang
if (not lang) or (#lang < 2) then
lang = mw.language.getContentLanguage().code
end
-- first unnamed parameter is the local parameter, if supplied
local input_parm = mw.text.trim(frame.args[1] or "")
if input_parm == "FETCH_WIKIDATA" then
local ent = mw.wikibase.getEntity(id)
local imgs
if ent and ent.claims then
imgs = ent.claims.P18
end
local imglbl
if imgs then
-- look for an image with 'preferred' rank
for k1, v1 in pairs(imgs) do
if v1.rank == "preferred" and v1.qualifiers and v1.qualifiers.P2096 then
local imglbls = v1.qualifiers.P2096
for k2, v2 in pairs(imglbls) do
if v2.datavalue.value.language == lang then
imglbl = v2.datavalue.value.text
break
end
end
end
end
-- if we don't find one, look for an image with 'normal' rank
if (not imglbl) then
for k1, v1 in pairs(imgs) do
if v1.rank == "normal" and v1.qualifiers and v1.qualifiers.P2096 then
local imglbls = v1.qualifiers.P2096
for k2, v2 in pairs(imglbls) do
if v2.datavalue.value.language == lang then
imglbl = v2.datavalue.value.text
break
end
end
end
end
end
end
return imglbl
else
return input_parm
end
end
-- This is used to get the QIDs of all of the values of a property, as a comma separated list if multiple values exist
-- Usage: {{#invoke:Wikidata |getPropertyIDs |<PropertyID> |FETCH_WIKIDATA}}
-- Usage: {{#invoke:Wikidata |getPropertyIDs |<PropertyID> |<InputParameter> |qid=<QID>}}
p.getPropertyIDs = function(frame)
local go, errorOrentity, propclaims = parseInput(frame)
if not go then
return errorOrentity
end
local entity = errorOrentity
-- if wiki-linked value collect the QID in a table
if (propclaims[1] and propclaims[1].mainsnak.snaktype == "value" and propclaims[1].mainsnak.datavalue.type == "wikibase-entityid") then
local out = {}
for k, v in pairs(propclaims) do
out[#out + 1] = "Q" .. v.mainsnak.datavalue.value["numeric-id"]
end
return table.concat(out, ", ")
else
-- not a wikibase-entityid, so return empty
return ""
end
end
-- returns the page id (Q...) of the current page or nothing of the page is not connected to Wikidata
function p.pageId(frame)
return mw.wikibase.getEntityIdForCurrentPage()
end
function p.claim(frame)
local property = frame.args[1] or ""
local id = frame.args["id"]
local qualifierId = frame.args["qualifier"]
local parameter = frame.args["parameter"]
local list = frame.args["list"]
local references = frame.args["references"]
local showerrors = frame.args["showerrors"]
local default = frame.args["default"]
if default then showerrors = nil end
-- get wikidata entity
local entity = mw.wikibase.getEntity(id)
if not entity then
if showerrors then return printError("entity-not-found") else return default end
end
-- fetch the first claim of satisfying the given property
local claims = findClaims(entity, property)
if not claims or not claims[1] then
if showerrors then return printError("property-not-found") else return default end
end
-- get initial sort indices
local sortindices = {}
for idx in pairs(claims) do
sortindices[#sortindices + 1] = idx
end
-- sort by claim rank
local comparator = function(a, b)
local rankmap = { deprecated = 2, normal = 1, preferred = 0 }
local ranka = rankmap[claims[a].rank or "normal"] .. string.format("%08d", a)
local rankb = rankmap[claims[b].rank or "normal"] .. string.format("%08d", b)
return ranka < rankb
end
table.sort(sortindices, comparator)
local result
local error
if list then
local value
-- iterate over all elements and return their value (if existing)
result = {}
for idx in pairs(claims) do
local claim = claims[sortindices[idx]]
value, error = getValueOfClaim(claim, qualifierId, parameter)
if not value and showerrors then value = error end
if value and references then value = value .. getReferences(frame, claim) end
result[#result + 1] = value
end
result = table.concat(result, list)
else
-- return first element
local claim = claims[sortindices[1]]
result, error = getValueOfClaim(claim, qualifierId, parameter)
if result and references then result = result .. getReferences(frame, claim) end
end
if result then return result else
if showerrors then return error else return default end
end
end
-- look into entity object
function p.ViewSomething(frame)
local f = (frame.args[1] or frame.args.id) and frame or frame:getParent()
local id = f.args.id
if id and (#id == 0) then
id = nil
end
local data = mw.wikibase.getEntity(id)
if not data then
return nil
end
local i = 1
while true do
local index = f.args[i]
if not index then
if type(data) == "table" then
return mw.text.jsonEncode(data, mw.text.JSON_PRESERVE_KEYS + mw.text.JSON_PRETTY)
else
return tostring(data)
end
end
data = data[index] or data[tonumber(index)]
if not data then
return
end
i = i + 1
end
end
-- getting sitelink of a given wiki
-- get sitelink of current item if qid not supplied
function p.getSiteLink(frame)
local qid = frame.args.qid
if qid == "" then qid = nil end
local f = mw.text.trim( frame.args[1] or "")
local entity = mw.wikibase.getEntity(qid)
if not entity then
return
end
local link = entity:getSitelink( f )
if not link then
return
end
return link
end
function p.Dump(frame)
local f = (frame.args[1] or frame.args.id) and frame or frame:getParent()
local data = mw.wikibase.getEntity(f.args.id)
if not data then
return i18n.warnDump
end
local i = 1
while true do
local index = f.args[i]
if not index then
return "<pre>"..mw.dumpObject(data).."</pre>".. i18n.warnDump
end
data = data[index] or data[tonumber(index)]
if not data then
return i18n.warnDump
end
i = i + 1
end
end
return p
0ut9ea611aebtqxr1j5hmyqvjdhhyh8
Template:Wikidata image
10
7160
75055
73889
2026-08-24T02:31:21Z
Robertsky
10424
restore
75055
wikitext
text/x-wiki
{{#if:{{#if:{{{qid|}}}||{{NAMESPACE}}}}{{{1|}}}{{{2|}}}||{{#if:{{#property:P18|from={{{qid|}}}}}|[[Category:{{if empty|{{{cat|}}}|No local image but image on Wikidata}}]]}}}}<noinclude>
{{doc}}
</noinclude>
j4r2yjlq7u6k84f6tg284tlgziaz4wx
Módulo:WikidataIB
828
7164
74879
72332
2026-08-24T00:42:18Z
Robertsky
10424
revert to imported latest version
74879
Scribunto
text/plain
-- Version: 2023-07-10
-- Module to implement use of a blacklist and whitelist for infobox fields
-- Can take a named parameter |qid which is the Wikidata ID for the article
-- if not supplied, it will use the Wikidata ID associated with the current page.
-- Fields in blacklist are never to be displayed, i.e. module must return nil in all circumstances
-- Fields in whitelist return local value if it exists or the Wikidata value otherwise
-- The name of the field that this function is called from is passed in named parameter |name
-- The name is compulsory when blacklist or whitelist is used,
-- so the module returns nil if it is not supplied.
-- blacklist is passed in named parameter |suppressfields (or |spf)
-- whitelist is passed in named parameter |fetchwikidata (or |fwd)
require("strict")
local p = {}
local cdate -- initialise as nil and only load _complex_date function if needed
-- Module:Complex date is loaded lazily and has the following dependencies:
-- Module:Calendar
-- Module:ISOdate
-- Module:DateI18n
-- Module:I18n/complex date
-- Module:Ordinal
-- Module:I18n/ordinal
-- Module:Yesno
-- Module:Formatnum
-- Module:Linguistic
--
-- The following, taken from https://www.mediawiki.org/wiki/Wikibase/DataModel#Dates_and_times,
-- is needed to use Module:Complex date which seemingly requires date precision as a string.
-- It would work better if only the authors of the mediawiki page could spell 'millennium'.
local dp = {
[6] = "millennium",
[7] = "century",
[8] = "decade",
[9] = "year",
[10] = "month",
[11] = "day",
}
local i18n =
{
["errors"] =
{
["property-not-found"] = "Property not found.",
["No property supplied"] = "No property supplied",
["entity-not-found"] = "Wikidata entity not found.",
["unknown-claim-type"] = "Unknown claim type.",
["unknown-entity-type"] = "Unknown entity type.",
["qualifier-not-found"] = "Qualifier not found.",
["site-not-found"] = "Wikimedia project not found.",
["labels-not-found"] = "No labels found.",
["descriptions-not-found"] = "No descriptions found.",
["aliases-not-found"] = "No aliases found.",
["unknown-datetime-format"] = "Unknown datetime format.",
["local-article-not-found"] = "Article is available on Wikidata, but not on Wikipedia",
["dab-page"] = " (dab)",
},
["months"] =
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
},
["century"] = "century",
["BC"] = "BC",
["BCE"] = "BCE",
["ordinal"] =
{
[1] = "st",
[2] = "nd",
[3] = "rd",
["default"] = "th"
},
["filespace"] = "File",
["Unknown"] = "Unknown",
["NaN"] = "Not a number",
-- set the following to the name of a tracking category,
-- e.g. "[[Category:Articles with missing Wikidata information]]", or "" to disable:
["missinginfocat"] = "[[Category:Articles with missing Wikidata information]]",
["editonwikidata"] = "Edit this on Wikidata",
["latestdatequalifier"] = function (date) return "before " .. date end,
-- some languages, e.g. Bosnian use a period as a suffix after each number in a date
["datenumbersuffix"] = "",
["list separator"] = ", ",
["multipliers"] = {
[0] = "",
[3] = " thousand",
[6] = " million",
[9] = " billion",
[12] = " trillion",
}
}
-- This allows an internationisation module to override the above table
if 'en' ~= mw.getContentLanguage():getCode() then
require("Module:i18n").loadI18n("Module:WikidataIB/i18n", i18n)
end
-- This piece of html implements a collapsible container. Check the classes exist on your wiki.
local collapsediv = '<div class="mw-collapsible mw-collapsed" style="width:100%; overflow:auto;" data-expandtext="{{int:show}}" data-collapsetext="{{int:hide}}">'
-- Some items should not be linked.
-- Each wiki can create a list of those in Module:WikidataIB/nolinks
-- It should return a table called itemsindex, containing true for each item not to be linked
local donotlink = {}
local nolinks_exists, nolinks = pcall(mw.loadData, "Module:WikidataIB/nolinks")
if nolinks_exists then
donotlink = nolinks.itemsindex
end
-- To satisfy Wikipedia:Manual of Style/Titles, certain types of items are italicised, and others are quoted.
-- The submodule [[Module:WikidataIB/titleformats]] lists the entity-ids used in 'instance of' (P31),
-- which allows this module to identify the values that should be formatted.
-- WikidataIB/titleformats exports a table p.formats, which is indexed by entity-id, and contains the value " or ''
local formats = {}
local titleformats_exists, titleformats = pcall(mw.loadData, "Module:WikidataIB/titleformats")
if titleformats_exists then
formats = titleformats.formats
end
-------------------------------------------------------------------------------
-- Private functions
-------------------------------------------------------------------------------
--
-------------------------------------------------------------------------------
-- makeOrdinal needs to be internationalised along with the above:
-- takes cardinal number as a numeric and returns the ordinal as a string
-- we need three exceptions in English for 1st, 2nd, 3rd, 21st, .. 31st, etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local makeOrdinal = function(cardinal)
local ordsuffix = i18n.ordinal.default
if cardinal % 10 == 1 then
ordsuffix = i18n.ordinal[1]
elseif cardinal % 10 == 2 then
ordsuffix = i18n.ordinal[2]
elseif cardinal % 10 == 3 then
ordsuffix = i18n.ordinal[3]
end
-- In English, 1, 21, 31, etc. use 'st', but 11, 111, etc. use 'th'
-- similarly for 12 and 13, etc.
if (cardinal % 100 == 11) or (cardinal % 100 == 12) or (cardinal % 100 == 13) then
ordsuffix = i18n.ordinal.default
end
return tostring(cardinal) .. ordsuffix
end
-------------------------------------------------------------------------------
-- findLang takes a "langcode" parameter if supplied and valid
-- otherwise it tries to create it from the user's set language ({{int:lang}})
-- failing that it uses the wiki's content language.
-- It returns a language object
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local findLang = function(langcode)
local langobj
langcode = mw.text.trim(langcode or "")
if mw.language.isKnownLanguageTag(langcode) then
langobj = mw.language.new( langcode )
else
langcode = mw.getCurrentFrame():callParserFunction('int', {'lang'})
if mw.language.isKnownLanguageTag(langcode) then
langobj = mw.language.new( langcode )
else
langobj = mw.language.getContentLanguage()
end
end
return langobj
end
-------------------------------------------------------------------------------
-- _getItemLangCode takes a qid parameter (using the current page's qid if blank)
-- If the item for that qid has property country (P17) it looks at the first preferred value
-- If the country has an official language (P37), it looks at the first preferred value
-- If that official language has a language code (P424), it returns the first preferred value
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local _getItemLangCode = function(qid)
qid = mw.text.trim(qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return end
local prop17 = mw.wikibase.getBestStatements(qid, "P17")[1]
if not prop17 or prop17.mainsnak.snaktype ~= "value" then return end
local qid17 = prop17.mainsnak.datavalue.value.id
local prop37 = mw.wikibase.getBestStatements(qid17, "P37")[1]
if not prop37 or prop37.mainsnak.snaktype ~= "value" then return end
local qid37 = prop37.mainsnak.datavalue.value.id
local prop424 = mw.wikibase.getBestStatements(qid37, "P424")[1]
if not prop424 or prop424.mainsnak.snaktype ~= "value" then return end
return prop424.mainsnak.datavalue.value
end
-------------------------------------------------------------------------------
-- roundto takes a number (x)
-- and returns it rounded to (sf) significant figures
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local roundto = function(x, sf)
if x == 0 then return 0 end
local s = 1
if x < 0 then
x = -x
s = -1
end
if sf < 1 then sf = 1 end
local p = 10 ^ (math.floor(math.log10(x)) - sf + 1)
x = math.floor(x / p + 0.5) * p * s
-- if it's integral, cast to an integer:
if x == math.floor(x) then x = math.floor(x) end
return x
end
-------------------------------------------------------------------------------
-- decimalToDMS takes a decimal degrees (x) with precision (p)
-- and returns degrees/minutes/seconds according to the precision
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local decimalToDMS = function(x, p)
-- if p is not supplied, use a precision around 0.1 seconds
if not tonumber(p) then p = 1e-4 end
local d = math.floor(x)
local ms = (x - d) * 60
if p > 0.5 then -- precision is > 1/2 a degree
if ms > 30 then d = d + 1 end
ms = 0
end
local m = math.floor(ms)
local s = (ms - m) * 60
if p > 0.008 then -- precision is > 1/2 a minute
if s > 30 then m = m +1 end
s = 0
elseif p > 0.00014 then -- precision is > 1/2 a second
s = math.floor(s + 0.5)
elseif p > 0.000014 then -- precision is > 1/20 second
s = math.floor(10 * s + 0.5) / 10
elseif p > 0.0000014 then -- precision is > 1/200 second
s = math.floor(100 * s + 0.5) / 100
else -- cap it at 3 dec places for now
s = math.floor(1000 * s + 0.5) / 1000
end
return d, m, s
end
-------------------------------------------------------------------------------
-- decimalPrecision takes a decimal (x) with precision (p)
-- and returns x rounded approximately to the given precision
-- precision should be between 1 and 1e-6, preferably a power of 10.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local decimalPrecision = function(x, p)
local s = 1
if x < 0 then
x = -x
s = -1
end
-- if p is not supplied, pick an arbitrary precision
if not tonumber(p) then p = 1e-4
elseif p > 1 then p = 1
elseif p < 1e-6 then p = 1e-6
else p = 10 ^ math.floor(math.log10(p))
end
x = math.floor(x / p + 0.5) * p * s
-- if it's integral, cast to an integer:
if x == math.floor(x) then x = math.floor(x) end
-- if it's less than 1e-4, it will be in exponent form, so return a string with 6dp
-- 9e-5 becomes 0.000090
if math.abs(x) < 1e-4 then x = string.format("%f", x) end
return x
end
-------------------------------------------------------------------------------
-- formatDate takes a datetime of the usual format from mw.wikibase.entity:formatPropertyValues
-- like "1 August 30 BCE" as parameter 1
-- and formats it according to the df (date format) and bc parameters
-- df = ["dmy" / "mdy" / "y"] default will be "dmy"
-- bc = ["BC" / "BCE"] default will be "BCE"
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local format_Date = function(datetime, dateformat, bc)
local datetime = datetime or "1 August 30 BCE" -- in case of nil value
-- chop off multiple vales and/or any hours, mins, etc.
-- keep anything before punctuation - we just want a single date:
local dateval = string.match( datetime, "[%w ]+")
local dateformat = string.lower(dateformat or "dmy") -- default to dmy
local bc = string.upper(bc or "") -- can't use nil for bc
-- we only want to accept two possibilities: BC or default to BCE
if bc == "BC" then
bc = " " .. i18n["BC"] -- prepend a non-breaking space.
else
bc = " " .. i18n["BCE"]
end
local postchrist = true -- start by assuming no BCE
local dateparts = {}
for word in string.gmatch(dateval, "%w+") do
if word == "BCE" or word == "BC" then -- *** internationalise later ***
postchrist = false
else
-- we'll keep the parts that are not 'BCE' in a table
dateparts[#dateparts + 1] = word
end
end
if postchrist then bc = "" end -- set AD dates to no suffix *** internationalise later ***
local sep = " " -- separator is nbsp
local fdate = table.concat(dateparts, sep) -- set formatted date to same order as input
-- if we have day month year, check dateformat
if #dateparts == 3 then
if dateformat == "y" then
fdate = dateparts[3]
elseif dateformat == "mdy" then
fdate = dateparts[2] .. sep .. dateparts[1] .. "," .. sep .. dateparts[3]
end
elseif #dateparts == 2 and dateformat == "y" then
fdate = dateparts[2]
end
return fdate .. bc
end
-------------------------------------------------------------------------------
-- dateFormat is the handler for properties that are of type "time"
-- It takes timestamp, precision (6 to 11 per mediawiki), dateformat (y/dmy/mdy), BC format (BC/BCE),
-- a plaindate switch (yes/no/adj) to en/disable "sourcing circumstances"/use adjectival form,
-- any qualifiers for the property, the language, and any adjective to use like 'before'.
-- It passes the date through the "complex date" function
-- and returns a string with the internatonalised date formatted according to preferences.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); cdate(); dp[]
-------------------------------------------------------------------------------
local dateFormat = function(timestamp, dprec, df, bcf, pd, qualifiers, lang, adj, model)
-- output formatting according to preferences (y/dmy/mdy/ymd)
df = (df or ""):lower()
-- if ymd is required, return the part of the timestamp in YYYY-MM-DD form
-- but apply Year zero#Astronomers fix: 1 BC = 0000; 2 BC = -0001; etc.
if df == "ymd" then
if timestamp:sub(1,1) == "+" then
return timestamp:sub(2,11)
else
local yr = tonumber(timestamp:sub(2,5)) - 1
yr = ("000" .. yr):sub(-4)
if yr ~= "0000" then yr = "-" .. yr end
return yr .. timestamp:sub(6,11)
end
end
-- A year can be stored like this: "+1872-00-00T00:00:00Z",
-- which is processed here as if it were the day before "+1872-01-01T00:00:00Z",
-- and that's the last day of 1871, so the year is wrong.
-- So fix the month 0, day 0 timestamp to become 1 January instead:
timestamp = timestamp:gsub("%-00%-00T", "-01-01T")
-- just in case date precision is missing
dprec = dprec or 11
-- override more precise dates if required dateformat is year alone:
if df == "y" and dprec > 9 then dprec = 9 end
-- complex date only deals with precisions from 6 to 11, so clip range
dprec = dprec>11 and 11 or dprec
dprec = dprec<6 and 6 or dprec
-- BC format is "BC" or "BCE"
bcf = (bcf or ""):upper()
-- plaindate only needs the first letter (y/n/a)
pd = (pd or ""):sub(1,1):lower()
if pd == "" or pd == "n" or pd == "f" or pd == "0" then pd = false end
-- in case language isn't passed
lang = lang or findLang().code
-- set adj as empty if nil
adj = adj or ""
-- extract the day, month, year from the timestamp
local bc = timestamp:sub(1, 1)=="-" and "BC" or ""
local year, month, day = timestamp:match("[+-](%d*)-(%d*)-(%d*)T")
local iso = tonumber(year) -- if year is missing, let it throw an error
-- this will adjust the date format to be compatible with cdate
-- possible formats are Y, YY, YYY0, YYYY, YYYY-MM, YYYY-MM-DD
if dprec == 6 then iso = math.floor( (iso - 1) / 1000 ) + 1 end
if dprec == 7 then iso = math.floor( (iso - 1) / 100 ) + 1 end
if dprec == 8 then iso = math.floor( iso / 10 ) .. "0" end
if dprec == 10 then iso = year .. "-" .. month end
if dprec == 11 then iso = year .. "-" .. month .. "-" .. day end
-- add "circa" (Q5727902) from "sourcing circumstances" (P1480)
local sc = not pd and qualifiers and qualifiers.P1480
if sc then
for k1, v1 in pairs(sc) do
if v1.datavalue and v1.datavalue.value.id == "Q5727902" then
adj = "circa"
break
end
end
end
-- deal with Julian dates:
-- no point in saying that dates before 1582 are Julian - they are by default
-- doesn't make sense for dates less precise than year
-- we can suppress it by setting |plaindate, e.g. for use in constructing categories.
local calendarmodel = ""
if tonumber(year) > 1582
and dprec > 8
and not pd
and model == "http://www.wikidata.org/entity/Q1985786" then
calendarmodel = "julian"
end
if not cdate then
cdate = require("Module:Complex date")._complex_date
end
local fdate = cdate(calendarmodel, adj, tostring(iso), dp[dprec], bc, "", "", "", "", lang, 1)
-- this may have QuickStatements info appended to it in a div, so remove that
fdate = fdate:gsub(' <div style="display: none;">[^<]*</div>', '')
-- it may also be returned wrapped in a microformat, so remove that
fdate = fdate:gsub("<[^>]*>", "")
-- there may be leading zeros that we should remove
fdate = fdate:gsub("^0*", "")
-- if a plain date is required, then remove any links (like BC linked)
if pd then
fdate = fdate:gsub("%[%[.*|", ""):gsub("]]", "")
end
-- if 'circa', use the abbreviated form *** internationalise later ***
fdate = fdate:gsub('circa ', '<abbr title="circa">c.</abbr> ')
-- deal with BC/BCE
if bcf == "BCE" then
fdate = fdate:gsub('BC', 'BCE')
end
-- deal with mdy format
if df == "mdy" then
fdate = fdate:gsub("(%d+) (%w+) (%d+)", "%2 %1, %3")
end
-- deal with adjectival form *** internationalise later ***
if pd == "a" then
fdate = fdate:gsub(' century', '-century')
end
return fdate
end
-------------------------------------------------------------------------------
-- parseParam takes a (string) parameter, e.g. from the list of frame arguments,
-- and makes "false", "no", and "0" into the (boolean) false
-- it makes the empty string and nil into the (boolean) value passed as default
-- allowing the parameter to be true or false by default.
-- It returns a boolean.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local parseParam = function(param, default)
if type(param) == "boolean" then param = tostring(param) end
if param and param ~= "" then
param = param:lower()
if (param == "false") or (param:sub(1,1) == "n") or (param == "0") then
return false
else
return true
end
else
return default
end
end
-------------------------------------------------------------------------------
-- _getSitelink takes the qid of a Wikidata entity passed as |qid=
-- It takes an optional parameter |wiki= to determine which wiki is to be checked for a sitelink
-- If the parameter is blank, then it uses the local wiki.
-- If there is a sitelink to an article available, it returns the plain text link to the article
-- If there is no sitelink, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local _getSitelink = function(qid, wiki)
qid = (qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
wiki = wiki or ""
local sitelink
if wiki == "" then
sitelink = mw.wikibase.getSitelink(qid)
else
sitelink = mw.wikibase.getSitelink(qid, wiki)
end
return sitelink
end
-------------------------------------------------------------------------------
-- _getCommonslink takes an optional qid of a Wikidata entity passed as |qid=
-- It returns one of the following in order of preference:
-- the Commons sitelink of the Wikidata entity - but not if onlycat=true and it's not a category;
-- the Commons sitelink of the topic's main category of the Wikidata entity;
-- the Commons category of the Wikidata entity - unless fallback=false.
-------------------------------------------------------------------------------
-- Dependencies: _getSitelink(); parseParam()
-------------------------------------------------------------------------------
local _getCommonslink = function(qid, onlycat, fallback)
qid = (qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
onlycat = parseParam(onlycat, false)
if fallback == "" then fallback = nil end
local sitelink = _getSitelink(qid, "commonswiki")
if onlycat and sitelink and sitelink:sub(1,9) ~= "Category:" then sitelink = nil end
if not sitelink then
-- check for topic's main category
local prop910 = mw.wikibase.getBestStatements(qid, "P910")[1]
if prop910 then
local tmcid = prop910.mainsnak.datavalue and prop910.mainsnak.datavalue.value.id
sitelink = _getSitelink(tmcid, "commonswiki")
end
if not sitelink then
-- check for list's main category
local prop1754 = mw.wikibase.getBestStatements(qid, "P1754")[1]
if prop1754 then
local tmcid = prop1754.mainsnak.datavalue and prop1754.mainsnak.datavalue.value.id
sitelink = _getSitelink(tmcid, "commonswiki")
end
end
end
if not sitelink and fallback then
-- check for Commons category (string value)
local prop373 = mw.wikibase.getBestStatements(qid, "P373")[1]
if prop373 then
sitelink = prop373.mainsnak.datavalue and prop373.mainsnak.datavalue.value
if sitelink then sitelink = "Category:" .. sitelink end
end
end
return sitelink
end
-------------------------------------------------------------------------------
-- The label in a Wikidata item is subject to vulnerabilities
-- that an attacker might try to exploit.
-- It needs to be 'sanitised' by removing any wikitext before use.
-- If it doesn't exist, return the id for the item
-- a second (boolean) value is also returned, value is true when the label exists
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local labelOrId = function(id, lang)
if lang == "default" then lang = findLang().code end
local label
if lang then
label = mw.wikibase.getLabelByLang(id, lang)
else
label = mw.wikibase.getLabel(id)
end
if label then
return mw.text.nowiki(label), true
else
return id, false
end
end
-------------------------------------------------------------------------------
-- linkedItem takes an entity-id and returns a string, linked if possible.
-- This is the handler for "wikibase-item". Preferences:
-- 1. Display linked disambiguated sitelink if it exists
-- 2. Display linked label if it is a redirect
-- 3. TBA: Display an inter-language link for the label if it exists other than in default language
-- 4. Display unlinked label if it exists
-- 5. Display entity-id for now to indicate a label could be provided
-- dtxt is text to be used instead of label, or nil.
-- shortname is boolean switch to use P1813 (short name) instead of label if true.
-- lang is the current language code.
-- uselbl is boolean switch to force display of the label instead of the sitelink (default: false)
-- linkredir is boolean switch to allow linking to a redirect (default: false)
-- formatvalue is boolean switch to allow formatting as italics or quoted (default: false)
-------------------------------------------------------------------------------
-- Dependencies: labelOrId(); donotlink[]
-------------------------------------------------------------------------------
local linkedItem = function(id, args)
local lprefix = (args.lp or args.lprefix or args.linkprefix or ""):gsub('"', '') -- toughen against nil values passed
local lpostfix = (args.lpostfix or ""):gsub('"', '')
local prefix = (args.prefix or ""):gsub('"', '')
local postfix = (args.postfix or ""):gsub('"', '')
local dtxt = args.dtxt
local shortname = args.shortname or args.sn
local lang = args.lang or "en" -- fallback to default if missing
local uselbl = args.uselabel or args.uselbl
uselbl = parseParam(uselbl, false)
local linkredir = args.linkredir
linkredir = parseParam(linkredir, false)
local formatvalue = args.formatvalue or args.fv
formatvalue = parseParam(formatvalue, false)
-- see if item might need italics or quotes
local fmt = ""
if next(formats) and formatvalue then
for k, v in ipairs( mw.wikibase.getBestStatements(id, "P31") ) do
if v.mainsnak.datavalue and formats[v.mainsnak.datavalue.value.id] then
fmt = formats[v.mainsnak.datavalue.value.id]
break -- pick the first match
end
end
end
local disp
local sitelink = mw.wikibase.getSitelink(id)
local label, islabel
if dtxt then
label, islabel = dtxt, true
elseif shortname then
-- see if there is a shortname in our language, and set label to it
for k, v in ipairs( mw.wikibase.getBestStatements(id, "P1813") ) do
if v.mainsnak.datavalue.value.language == lang then
label, islabel = v.mainsnak.datavalue.value.text, true
break
end -- test for language match
end -- loop through values of short name
-- if we have no label set, then there was no shortname available
if not islabel then
label, islabel = labelOrId(id)
shortname = false
end
else
label, islabel = labelOrId(id)
end
if mw.site.siteName ~= "Wikimedia Commons" then
if sitelink then
if not (dtxt or shortname) then
-- if sitelink and label are the same except for case, no need to process further
if sitelink:lower() ~= label:lower() then
-- strip any namespace or dab from the sitelink
local pos = sitelink:find(":") or 0
local slink = sitelink
if pos > 0 then
local pfx = sitelink:sub(1,pos-1)
if mw.site.namespaces[pfx] then -- that prefix is a valid namespace, so remove it
slink = sitelink:sub(pos+1)
end
end
-- remove stuff after commas or inside parentheses - ie. dabs
slink = slink:gsub("%s%(.+%)$", ""):gsub(",.+$", "")
-- if uselbl is false, use sitelink instead of label
if not uselbl then
-- use slink as display, preserving label case - find("^%u") is true for 1st char uppercase
if label:find("^%u") then
label = slink:gsub("^(%l)", string.upper)
else
label = slink:gsub("^(%u)", string.lower)
end
end
end
end
if donotlink[label] then
disp = prefix .. fmt .. label .. fmt .. postfix
else
disp = "[[" .. lprefix .. sitelink .. lpostfix .. "|" .. prefix .. fmt .. label .. fmt .. postfix .. "]]"
end
elseif islabel then
-- no sitelink, label exists, so check if a redirect with that title exists, if linkredir is true
-- display plain label by default
disp = prefix .. fmt .. label .. fmt .. postfix
if linkredir then
local artitle = mw.title.new(label, 0) -- only nil if label has invalid chars
if not donotlink[label] and artitle and artitle.redirectTarget then
-- there's a redirect with the same title as the label, so let's link to that
disp = "[[".. lprefix .. label .. lpostfix .. "|" .. prefix .. fmt .. label .. fmt .. postfix .. "]]"
end
end -- test if article title exists as redirect on current Wiki
else
-- no sitelink and no label, so return whatever was returned from labelOrId for now
-- add tracking category [[Category:Articles with missing Wikidata information]]
-- for enwiki, just return the tracking category
if mw.wikibase.getGlobalSiteId() == "enwiki" then
disp = i18n.missinginfocat
else
disp = prefix .. label .. postfix .. i18n.missinginfocat
end
end
else
local ccat = mw.wikibase.getBestStatements(id, "P373")[1]
if ccat and ccat.mainsnak.datavalue then
ccat = ccat.mainsnak.datavalue.value
disp = "[[" .. lprefix .. "Category:" .. ccat .. lpostfix .. "|" .. prefix .. label .. postfix .. "]]"
elseif sitelink then
-- this asumes that if a sitelink exists, then a label also exists
disp = "[[" .. lprefix .. sitelink .. lpostfix .. "|" .. prefix .. label .. postfix .. "]]"
else
-- no sitelink and no Commons cat, so return label from labelOrId for now
disp = prefix .. label .. postfix
end
end
return disp
end
-------------------------------------------------------------------------------
-- sourced takes a table representing a statement that may or may not have references
-- it looks for a reference sourced to something not containing the word "wikipedia"
-- it returns a boolean = true if it finds a sourced reference.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local sourced = function(claim)
if claim.references then
for kr, vr in pairs(claim.references) do
local ref = mw.wikibase.renderSnaks(vr.snaks)
if not ref:find("Wiki") then
return true
end
end
end
end
-------------------------------------------------------------------------------
-- setRanks takes a flag (parameter passed) that requests the values to return
-- "b[est]" returns preferred if available, otherwise normal
-- "p[referred]" returns preferred
-- "n[ormal]" returns normal
-- "d[eprecated]" returns deprecated
-- multiple values are allowed, e.g. "preferred normal" (which is the default)
-- "best" will override the other flags, and set p and n
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local setRanks = function(rank)
rank = (rank or ""):lower()
-- if nothing passed, return preferred and normal
-- if rank == "" then rank = "p n" end
local ranks = {}
for w in string.gmatch(rank, "%a+") do
w = w:sub(1,1)
if w == "b" or w == "p" or w == "n" or w == "d" then
ranks[w] = true
end
end
-- check if "best" is requested or no ranks requested; and if so, set preferred and normal
if ranks.b or not next(ranks) then
ranks.p = true
ranks.n = true
end
return ranks
end
-------------------------------------------------------------------------------
-- parseInput processes the Q-id , the blacklist and the whitelist
-- if an input parameter is supplied, it returns that and ends the call.
-- it returns (1) either the qid or nil indicating whether or not the call should continue
-- and (2) a table containing all of the statements for the propertyID and relevant Qid
-- if "best" ranks are requested, it returns those instead of all non-deprecated ranks
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local parseInput = function(frame, input_parm, property_id)
-- There may be a local parameter supplied, if it's blank, set it to nil
input_parm = mw.text.trim(input_parm or "")
if input_parm == "" then input_parm = nil end
-- return nil if Wikidata is not available
if not mw.wikibase then return false, input_parm end
local args = frame.args
-- can take a named parameter |qid which is the Wikidata ID for the article.
-- if it's not supplied, use the id for the current page
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
-- if there's no Wikidata item for the current page return nil
if not qid then return false, input_parm end
-- The blacklist is passed in named parameter |suppressfields
local blacklist = args.suppressfields or args.spf or ""
-- The whitelist is passed in named parameter |fetchwikidata
local whitelist = args.fetchwikidata or args.fwd or ""
if whitelist == "" then whitelist = "NONE" end
-- The name of the field that this function is called from is passed in named parameter |name
local fieldname = args.name or ""
if blacklist ~= "" then
-- The name is compulsory when blacklist is used, so return nil if it is not supplied
if fieldname == "" then return false, nil end
-- If this field is on the blacklist, then return nil
if blacklist:find(fieldname) then return false, nil end
end
-- If we got this far then we're not on the blacklist
-- The blacklist overrides any locally supplied parameter as well
-- If a non-blank input parameter was supplied return it
if input_parm then return false, input_parm end
-- We can filter out non-valid properties
if property_id:sub(1,1):upper() ~="P" or property_id == "P0" then return false, nil end
-- Otherwise see if this field is on the whitelist:
-- needs a bit more logic because find will return its second value = 0 if fieldname is ""
-- but nil if fieldname not found on whitelist
local _, found = whitelist:find(fieldname)
found = ((found or 0) > 0)
if whitelist ~= 'ALL' and (whitelist:upper() == "NONE" or not found) then
return false, nil
end
-- See what's on Wikidata (the call always returns a table, but it may be empty):
local props = {}
if args.reqranks.b then
props = mw.wikibase.getBestStatements(qid, property_id)
else
props = mw.wikibase.getAllStatements(qid, property_id)
end
if props[1] then
return qid, props
end
-- no property on Wikidata
return false, nil
end
-------------------------------------------------------------------------------
-- createicon assembles the "Edit at Wikidata" pen icon.
-- It returns a wikitext string inside a span class="penicon"
-- if entityID is nil or empty, the ID associated with current page is used
-- langcode and propertyID may be nil or empty
-------------------------------------------------------------------------------
-- Dependencies: i18n[];
-------------------------------------------------------------------------------
local createicon = function(langcode, entityID, propertyID)
langcode = langcode or ""
if not entityID or entityID == "" then entityID= mw.wikibase.getEntityIdForCurrentPage() end
propertyID = propertyID or ""
local icon = " <span class='penicon autoconfirmed-show'>[["
-- " <span data-bridge-edit-flow='overwrite' class='penicon'>[[" -> enable Wikidata Bridge
.. i18n["filespace"]
.. ":OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt="
.. i18n["editonwikidata"]
.. "|link=https://www.wikidata.org/wiki/" .. entityID
if langcode ~= "" then icon = icon .. "?uselang=" .. langcode end
if propertyID ~= "" then icon = icon .. "#" .. propertyID end
icon = icon .. "|" .. i18n["editonwikidata"] .. "]]</span>"
return icon
end
-------------------------------------------------------------------------------
-- assembleoutput takes the sequence table containing the property values
-- and formats it according to switches given. It returns a string or nil.
-- It uses the entityID (and optionally propertyID) to create a link in the pen icon.
-------------------------------------------------------------------------------
-- Dependencies: parseParam();
-------------------------------------------------------------------------------
local assembleoutput = function(out, args, entityID, propertyID)
-- sorted is a boolean passed to enable sorting of the values returned
-- if nothing or an empty string is passed set it false
-- if "false" or "no" or "0" is passed set it false
local sorted = parseParam(args.sorted, false)
-- noicon is a boolean passed to suppress the trailing "edit at Wikidata" icon
-- for use when the value is processed further by the infobox
-- if nothing or an empty string is passed set it false
-- if "false" or "no" or "0" is passed set it false
local noic = parseParam(args.noicon, false)
-- list is the name of a template that a list of multiple values is passed through
-- examples include "hlist" and "ubl"
-- setting it to "prose" produces something like "1, 2, 3, and 4"
local list = args.list or ""
-- sep is a string that is used to separate multiple returned values
-- if nothing or an empty string is passed set it to the default
-- any double-quotes " are stripped out, so that spaces may be passed
-- e.g. |sep=" - "
local sepdefault = i18n["list separator"]
local separator = args.sep or ""
separator = string.gsub(separator, '"', '')
if separator == "" then
separator = sepdefault
end
-- collapse is a number that determines the maximum number of returned values
-- before the output is collapsed.
-- Zero or not a number result in no collapsing (default becomes 0).
local collapse = tonumber(args.collapse) or 0
-- replacetext (rt) is a string that is returned instead of any non-empty Wikidata value
-- this is useful for tracking and debugging
local replacetext = mw.text.trim(args.rt or args.replacetext or "")
-- if there's anything to return, then return a list
-- comma-separated by default, but may be specified by the sep parameter
-- optionally specify a hlist or ubl or a prose list, etc.
local strout
if #out > 0 then
if sorted then table.sort(out) end
-- if there's something to display and a pen icon is wanted, add it the end of the last value
local hasdisplay = false
for i, v in ipairs(out) do
if v ~= i18n.missinginfocat then
hasdisplay = true
break
end
end
if not noic and hasdisplay then
out[#out] = out[#out] .. createicon(args.langobj.code, entityID, propertyID)
end
if list == "" then
strout = table.concat(out, separator)
elseif list:lower() == "prose" then
strout = mw.text.listToText( out )
else
strout = mw.getCurrentFrame():expandTemplate{title = list, args = out}
end
if collapse >0 and #out > collapse then
strout = collapsediv .. strout .. "</div>"
end
else
strout = nil -- no items had valid reference
end
if replacetext ~= "" and strout then strout = replacetext end
return strout
end
-------------------------------------------------------------------------------
-- rendersnak takes a table (propval) containing the information stored on one property value
-- and returns the value as a string and its language if monolingual text.
-- It handles data of type:
-- wikibase-item
-- time
-- string, url, commonsMedia, external-id
-- quantity
-- globe-coordinate
-- monolingualtext
-- It also requires linked, the link/pre/postfixes, uabbr, and the arguments passed from frame.
-- The optional filter parameter allows quantities to be be filtered by unit Qid.
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); labelOrId(); i18n[]; dateFormat();
-- roundto(); decimalPrecision(); decimalToDMS(); linkedItem();
-------------------------------------------------------------------------------
local rendersnak = function(propval, args, linked, lpre, lpost, pre, post, uabbr, filter)
lpre = lpre or ""
lpost = lpost or ""
pre = pre or ""
post = post or ""
args.lang = args.lang or findLang().code
-- allow values to display a fixed text instead of label
local dtxt = args.displaytext or args.dt
if dtxt == "" then dtxt = nil end
-- switch to use display of short name (P1813) instead of label
local shortname = args.shortname or args.sn
shortname = parseParam(shortname, false)
local snak = propval.mainsnak or propval
local dtype = snak.datatype
local dv = snak.datavalue
dv = dv and dv.value
-- value and monolingual text language code returned
local val, mlt
if propval.rank and not args.reqranks[propval.rank:sub(1, 1)] then
-- val is nil: value has a rank that isn't requested
------------------------------------
elseif snak.snaktype == "somevalue" then -- value is unknown
val = i18n["Unknown"]
------------------------------------
elseif snak.snaktype == "novalue" then -- value is none
-- val = "No value" -- don't return anything
------------------------------------
elseif dtype == "wikibase-item" then -- data type is a wikibase item:
-- it's wiki-linked value, so output as link if enabled and possible
local qnumber = dv.id
if linked then
val = linkedItem(qnumber, args)
else -- no link wanted so check for display-text, otherwise test for lang code
local label, islabel
if dtxt then
label = dtxt
else
label, islabel = labelOrId(qnumber)
local langlabel = mw.wikibase.getLabelByLang(qnumber, args.lang)
if langlabel then
label = mw.text.nowiki( langlabel )
end
end
val = pre .. label .. post
end -- test for link required
------------------------------------
elseif dtype == "time" then -- data type is time:
-- time is in timestamp format
-- date precision is integer per mediawiki
-- output formatting according to preferences (y/dmy/mdy)
-- BC format as BC or BCE
-- plaindate is passed to disable looking for "sourcing cirumstances"
-- or to set the adjectival form
-- qualifiers (if any) is a nested table or nil
-- lang is given, or user language, or site language
--
-- Here we can check whether args.df has a value
-- If not, use code from Module:Sandbox/RexxS/Getdateformat to set it from templates like {{Use mdy dates}}
val = dateFormat(dv.time, dv.precision, args.df, args.bc, args.pd, propval.qualifiers, args.lang, "", dv.calendarmodel)
------------------------------------
-- data types which are strings:
elseif dtype == "commonsMedia" or dtype == "external-id" or dtype == "string" or dtype == "url" then
-- commonsMedia or external-id or string or url
-- all have mainsnak.datavalue.value as string
if (lpre == "" or lpre == ":") and lpost == "" then
-- don't link if no linkpre/postfix or linkprefix is just ":"
val = pre .. dv .. post
elseif dtype == "external-id" then
val = "[" .. lpre .. dv .. lpost .. " " .. pre .. dv .. post .. "]"
else
val = "[[" .. lpre .. dv .. lpost .. "|" .. pre .. dv .. post .. "]]"
end -- check for link requested (i.e. either linkprefix or linkpostfix exists)
------------------------------------
-- data types which are quantities:
elseif dtype == "quantity" then
-- quantities have mainsnak.datavalue.value.amount and mainsnak.datavalue.value.unit
-- the unit is of the form http://www.wikidata.org/entity/Q829073
--
-- implement a switch to turn on/off numerical formatting later
local fnum = true
--
-- a switch to turn on/off conversions - only for en-wiki
local conv = parseParam(args.conv or args.convert, false)
-- if we have conversions, we won't have formatted numbers or scales
if conv then
uabbr = true
fnum = false
args.scale = "0"
end
--
-- a switch to turn on/off showing units, default is true
local showunits = parseParam(args.su or args.showunits, true)
--
-- convert amount to a number
local amount = tonumber(dv.amount) or i18n["NaN"]
--
-- scale factor for millions, billions, etc.
local sc = tostring(args.scale or ""):sub(1,1):lower()
local scale
if sc == "a" then
-- automatic scaling
if amount > 1e15 then
scale = 12
elseif amount > 1e12 then
scale = 9
elseif amount > 1e9 then
scale = 6
elseif amount > 1e6 then
scale = 3
else
scale = 0
end
else
scale = tonumber(args.scale) or 0
if scale < 0 or scale > 12 then scale = 0 end
scale = math.floor(scale/3) * 3
end
local factor = 10^scale
amount = amount / factor
-- ranges:
local range = ""
-- check if upper and/or lower bounds are given and significant
local upb = tonumber(dv.upperBound)
local lowb = tonumber(dv.lowerBound)
if upb and lowb then
-- differences rounded to 2 sig fig:
local posdif = roundto(upb - amount, 2) / factor
local negdif = roundto(amount - lowb, 2) / factor
upb, lowb = amount + posdif, amount - negdif
-- round scaled numbers to integers or 4 sig fig
if (scale > 0 or sc == "a") then
if amount < 1e4 then
amount = roundto(amount, 4)
else
amount = math.floor(amount + 0.5)
end
end
if fnum then amount = args.langobj:formatNum( amount ) end
if posdif ~= negdif then
-- non-symmetrical
range = " +" .. posdif .. " -" .. negdif
elseif posdif ~= 0 then
-- symmetrical and non-zero
range = " ±" .. posdif
else
-- otherwise range is zero, so leave it as ""
end
else
-- round scaled numbers to integers or 4 sig fig
if (scale > 0 or sc == "a") then
if amount < 1e4 then
amount = roundto(amount, 4)
else
amount = math.floor(amount + 0.5)
end
end
if fnum then amount = args.langobj:formatNum( amount ) end
end
-- unit names and symbols:
-- extract the qid in the form 'Qnnn' from the value.unit url
-- and then fetch the label from that - or symbol if unitabbr is true
local unit = ""
local usep = ""
local usym = ""
local unitqid = string.match( dv.unit, "(Q%d+)" )
if filter and unitqid ~= filter then return nil end
if unitqid and showunits then
local uname = mw.wikibase.getLabelByLang(unitqid, args.lang) or ""
if uname ~= "" then usep, unit = " ", uname end
if uabbr then
-- see if there's a unit symbol (P5061)
local unitsymbols = mw.wikibase.getBestStatements(unitqid, "P5061")
-- construct fallback table, add local lang and multiple languages
local fbtbl = mw.language.getFallbacksFor( args.lang, mw.language.FALLBACK_STRICT )
table.insert( fbtbl, 1, args.lang )
table.insert( fbtbl, "mul" )
table.insert( fbtbl, "en" )
local found = false
for idx1, us in ipairs(unitsymbols) do
for idx2, fblang in ipairs(fbtbl) do
if us.mainsnak.datavalue.value.language == fblang then
usym = us.mainsnak.datavalue.value.text
found = true
break
end
end -- loop through fallback table
if found then break end
end -- loop through values of P5061
if found then usep, unit = " ", usym end
end
end
-- format display:
if conv then
if range == "" then
val = mw.getCurrentFrame():expandTemplate{title = "cvt", args = {amount, unit}}
else
val = mw.getCurrentFrame():expandTemplate{title = "cvt", args = {lowb, "to", upb, unit}}
end
elseif unit == "$" or unit == "£" then
val = unit .. amount .. range .. i18n.multipliers[scale]
else
val = amount .. range .. i18n.multipliers[scale] .. usep .. unit
end
------------------------------------
-- datatypes which are global coordinates:
elseif dtype == "globe-coordinate" then
-- 'display' parameter defaults to "inline, title" *** unused for now ***
-- local disp = args.display or ""
-- if disp == "" then disp = "inline, title" end
--
-- format parameter switches from deg/min/sec to decimal degrees
-- default is deg/min/sec -- decimal degrees needs |format = dec
local form = (args.format or ""):lower():sub(1,3)
if form ~= "dec" then form = "dms" end -- not needed for now
--
-- show parameter allows just the latitude, or just the longitude, or both
-- to be returned as a signed decimal, ignoring the format parameter.
local show = (args.show or ""):lower()
if show ~= "longlat" then show = show:sub(1,3) end
--
local lat, long, prec = dv.latitude, dv.longitude, dv.precision
if show == "lat" then
val = decimalPrecision(lat, prec)
elseif show == "lon" then
val = decimalPrecision(long, prec)
elseif show == "longlat" then
val = decimalPrecision(long, prec) .. ", " .. decimalPrecision(lat, prec)
else
local ns = "N"
local ew = "E"
if lat < 0 then
ns = "S"
lat = - lat
end
if long < 0 then
ew = "W"
long = - long
end
if form == "dec" then
lat = decimalPrecision(lat, prec)
long = decimalPrecision(long, prec)
val = lat .. "°" .. ns .. " " .. long .. "°" .. ew
else
local latdeg, latmin, latsec = decimalToDMS(lat, prec)
local longdeg, longmin, longsec = decimalToDMS(long, prec)
if latsec == 0 and longsec == 0 then
if latmin == 0 and longmin == 0 then
val = latdeg .. "°" .. ns .. " " .. longdeg .. "°" .. ew
else
val = latdeg .. "°" .. latmin .. "′" .. ns .. " "
val = val .. longdeg .. "°".. longmin .. "′" .. ew
end
else
val = latdeg .. "°" .. latmin .. "′" .. latsec .. "″" .. ns .. " "
val = val .. longdeg .. "°" .. longmin .. "′" .. longsec .. "″" .. ew
end
end
end
------------------------------------
elseif dtype == "monolingualtext" then -- data type is Monolingual text:
-- has mainsnak.datavalue.value as a table containing language/text pairs
-- collect all the values in 'out' and languages in 'mlt' and process them later
val = pre .. dv.text .. post
mlt = dv.language
------------------------------------
else
-- some other data type so write a specific handler
val = "unknown data type: " .. dtype
end -- of datatype/unknown value/sourced check
return val, mlt
end
-------------------------------------------------------------------------------
-- propertyvalueandquals takes a property object, the arguments passed from frame,
-- and a qualifier propertyID.
-- It returns a sequence (table) of values representing the values of that property
-- and qualifiers that match the qualifierID if supplied.
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); sourced(); labelOrId(); i18n.latestdatequalifier(); format_Date();
-- makeOrdinal(); roundto(); decimalPrecision(); decimalToDMS(); assembleoutput();
-------------------------------------------------------------------------------
local function propertyvalueandquals(objproperty, args, qualID)
-- needs this style of declaration because it's re-entrant
-- onlysourced is a boolean passed to return only values sourced to other than Wikipedia
-- if nothing or an empty string is passed set it true
local onlysrc = parseParam(args.onlysourced or args.osd, true)
-- linked is a a boolean that enables the link to a local page via sitelink
-- if nothing or an empty string is passed set it true
local linked = parseParam(args.linked, true)
-- prefix is a string that may be nil, empty (""), or a string of characters
-- this is prefixed to each value
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local prefix = (args.prefix or ""):gsub('"', '')
-- postfix is a string that may be nil, empty (""), or a string of characters
-- this is postfixed to each value
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local postfix = (args.postfix or ""):gsub('"', '')
-- linkprefix is a string that may be nil, empty (""), or a string of characters
-- this creates a link and is then prefixed to each value
-- useful when when multiple values are returned and indirect links are needed
-- any double-quotes " are stripped out, so that spaces may be passed
local lprefix = (args.linkprefix or args.lp or ""):gsub('"', '')
-- linkpostfix is a string that may be nil, empty (""), or a string of characters
-- this is postfixed to each value when linking is enabled with lprefix
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local lpostfix = (args.linkpostfix or ""):gsub('"', '')
-- wdlinks is a boolean passed to enable links to Wikidata when no article exists
-- if nothing or an empty string is passed set it false
local wdl = parseParam(args.wdlinks or args.wdl, false)
-- unitabbr is a boolean passed to enable unit abbreviations for common units
-- if nothing or an empty string is passed set it false
local uabbr = parseParam(args.unitabbr or args.uabbr, false)
-- qualsonly is a boolean passed to return just the qualifiers
-- if nothing or an empty string is passed set it false
local qualsonly = parseParam(args.qualsonly or args.qo, false)
-- maxvals is a string that may be nil, empty (""), or a number
-- this determines how many items may be returned when multiple values are available
-- setting it = 1 is useful where the returned string is used within another call, e.g. image
local maxvals = tonumber(args.maxvals) or 0
-- pd (plain date) is a string: yes/true/1 | no/false/0 | adj
-- to disable/enable "sourcing cirumstances" or use adjectival form for the plain date
local pd = args.plaindate or args.pd or "no"
args.pd = pd
-- allow qualifiers to have a different date format; default to year unless qualsonly is set
args.qdf = args.qdf or args.qualifierdateformat or args.df or (not qualsonly and "y")
local lang = args.lang or findLang().code
-- qualID is a string list of wanted qualifiers or "ALL"
qualID = qualID or ""
-- capitalise list of wanted qualifiers and substitute "DATES"
qualID = qualID:upper():gsub("DATES", "P580, P582")
local allflag = (qualID == "ALL")
-- create table of wanted qualifiers as key
local qwanted = {}
-- create sequence of wanted qualifiers
local qorder = {}
for q in mw.text.gsplit(qualID, "%p") do -- split at punctuation and iterate
local qtrim = mw.text.trim(q)
if qtrim ~= "" then
qwanted[mw.text.trim(q)] = true
qorder[#qorder+1] = qtrim
end
end
-- qsep is the output separator for rendering qualifier list
local qsep = (args.qsep or ""):gsub('"', '')
-- qargs are the arguments to supply to assembleoutput()
local qargs = {
["osd"] = "false",
["linked"] = tostring(linked),
["prefix"] = args.qprefix,
["postfix"] = args.qpostfix,
["linkprefix"] = args.qlinkprefix or args.qlp,
["linkpostfix"] = args.qlinkpostfix,
["wdl"] = "false",
["unitabbr"] = tostring(uabbr),
["maxvals"] = 0,
["sorted"] = tostring(args.qsorted),
["noicon"] = "true",
["list"] = args.qlist,
["sep"] = qsep,
["langobj"] = args.langobj,
["lang"] = args.langobj.code,
["df"] = args.qdf,
["sn"] = parseParam(args.qsn or args.qshortname, false),
}
-- all proper values of a Wikidata property will be the same type as the first
-- qualifiers don't have a mainsnak, properties do
local datatype = objproperty[1].datatype or objproperty[1].mainsnak.datatype
-- out[] holds the a list of returned values for this property
-- mlt[] holds the language code if the datatype is monolingual text
local out = {}
local mlt = {}
for k, v in ipairs(objproperty) do
local hasvalue = true
if (onlysrc and not sourced(v)) then
-- no value: it isn't sourced when onlysourced=true
hasvalue = false
else
local val, lcode = rendersnak(v, args, linked, lprefix, lpostfix, prefix, postfix, uabbr)
if not val then
hasvalue = false -- rank doesn't match
elseif qualsonly and qualID then
-- suppress value returned: only qualifiers are requested
else
out[#out+1], mlt[#out+1] = val, lcode
end
end
-- See if qualifiers are to be returned:
local snak = v.mainsnak or v
if hasvalue and v.qualifiers and qualID ~= "" and snak.snaktype~="novalue" then
-- collect all wanted qualifier values returned in qlist, indexed by propertyID
local qlist = {}
local timestart, timeend = "", ""
-- loop through qualifiers
for k1, v1 in pairs(v.qualifiers) do
if allflag or qwanted[k1] then
if k1 == "P1326" then
local ts = v1[1].datavalue.value.time
local dp = v1[1].datavalue.value.precision
qlist[k1] = dateFormat(ts, dp, args.qdf, args.bc, pd, "", lang, "before")
elseif k1 == "P1319" then
local ts = v1[1].datavalue.value.time
local dp = v1[1].datavalue.value.precision
qlist[k1] = dateFormat(ts, dp, args.qdf, args.bc, pd, "", lang, "after")
elseif k1 == "P580" then
timestart = propertyvalueandquals(v1, qargs)[1] or "" -- treat only one start time as valid
elseif k1 == "P582" then
timeend = propertyvalueandquals(v1, qargs)[1] or "" -- treat only one end time as valid
else
local q = assembleoutput(propertyvalueandquals(v1, qargs), qargs)
-- we already deal with circa via 'sourcing circumstances' if the datatype was time
-- circa may be either linked or unlinked *** internationalise later ***
if datatype ~= "time" or q ~= "circa" and not (type(q) == "string" and q:find("circa]]")) then
qlist[k1] = q
end
end
end -- of test for wanted
end -- of loop through qualifiers
-- set date separator
local t = timestart .. timeend
-- *** internationalise date separators later ***
local dsep = "–"
if t:find("%s") or t:find(" ") then dsep = " – " end
-- set the order for the list of qualifiers returned; start time and end time go last
if next(qlist) then
local qlistout = {}
if allflag then
for k2, v2 in pairs(qlist) do
qlistout[#qlistout+1] = v2
end
else
for i2, v2 in ipairs(qorder) do
qlistout[#qlistout+1] = qlist[v2]
end
end
if t ~= "" then
qlistout[#qlistout+1] = timestart .. dsep .. timeend
end
local qstr = assembleoutput(qlistout, qargs)
if qualsonly then
out[#out+1] = qstr
else
out[#out] = out[#out] .. " (" .. qstr .. ")"
end
elseif t ~= "" then
if qualsonly then
if timestart == "" then
out[#out+1] = timeend
elseif timeend == "" then
out[#out+1] = timestart
else
out[#out+1] = timestart .. dsep .. timeend
end
else
out[#out] = out[#out] .. " (" .. timestart .. dsep .. timeend .. ")"
end
end
end -- of test for qualifiers wanted
if maxvals > 0 and #out >= maxvals then break end
end -- of for each value loop
-- we need to pick one value to return if the datatype was "monolingualtext"
-- if there's only one value, use that
-- otherwise look through the fallback languages for a match
if datatype == "monolingualtext" and #out >1 then
lang = mw.text.split( lang, '-', true )[1]
local fbtbl = mw.language.getFallbacksFor( lang )
table.insert( fbtbl, 1, lang )
local bestval = ""
local found = false
for idx1, lang1 in ipairs(fbtbl) do
for idx2, lang2 in ipairs(mlt) do
if (lang1 == lang2) and not found then
bestval = out[idx2]
found = true
break
end
end -- loop through values of property
end -- loop through fallback languages
if found then
-- replace output table with a table containing the best value
out = { bestval }
else
-- more than one value and none of them on the list of fallback languages
-- sod it, just give them the first one
out = { out[1] }
end
end
return out
end
-------------------------------------------------------------------------------
-- Common code for p.getValueByQual and p.getValueByLang
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
local _getvaluebyqual = function(frame, qualID, checkvalue)
-- The property ID that will have a qualifier is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or "")
if propertyID == "" then return "no property supplied" end
if qualID == "" then return "no qualifier supplied" end
-- onlysourced is a boolean passed to return property values
-- only when property values are sourced to something other than Wikipedia
-- if nothing or an empty string is passed set it true
-- if "false" or "no" or 0 is passed set it false
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- set a language object and code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
-- check for locally supplied parameter in second unnamed parameter
-- success means no local parameter and the property exists
local qid, props = parseInput(frame, args[2], propertyID)
local linked = parseParam(args.linked, true)
local lpre = (args.linkprefix or args.lp or ""):gsub('"', '')
local lpost = (args.linkpostfix or ""):gsub('"', '')
local pre = (args.prefix or ""):gsub('"', '')
local post = (args.postfix or ""):gsub('"', '')
local uabbr = parseParam(args.unitabbr or args.uabbr, false)
local filter = (args.unit or ""):upper()
local maxvals = tonumber(args.maxvals) or 0
if filter == "" then filter = nil end
if qid then
local out = {}
-- Scan through the values of the property
-- we want something like property is "pronunciation audio (P443)" in propertyID
-- with a qualifier like "language of work or name (P407)" in qualID
-- whose value has the required ID, like "British English (Q7979)", in qval
for k1, v1 in ipairs(props) do
if v1.mainsnak.snaktype == "value" then
-- check if it has the right qualifier
local v1q = v1.qualifiers
if v1q and v1q[qualID] then
if onlysrc == false or sourced(v1) then
-- if we've got this far, we have a (sourced) claim with qualifiers
-- so see if matches the required value
-- We'll only deal with wikibase-items and strings for now
if v1q[qualID][1].datatype == "wikibase-item" then
if checkvalue(v1q[qualID][1].datavalue.value.id) then
out[#out + 1] = rendersnak(v1, args, linked, lpre, lpost, pre, post, uabbr, filter)
end
elseif v1q[qualID][1].datatype == "string" then
if checkvalue(v1q[qualID][1].datavalue.value) then
out[#out + 1] = rendersnak(v1, args, linked, lpre, lpost, pre, post, uabbr, filter)
end
end
end -- of check for sourced
end -- of check for matching required value and has qualifiers
else
return nil
end -- of check for string
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of propertyID
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- either local parameter or nothing
end -- of test for success
return nil
end
-------------------------------------------------------------------------------
-- _location takes Q-id and follows P276 (location)
-- or P131 (located in the administrative territorial entity) or P706 (located on terrain feature)
-- from the initial item to higher level territories/locations until it reaches the highest.
-- An optional boolean, 'first', determines whether the first item is returned (default: false).
-- An optional boolean 'skip' toggles the display to skip to the last item (default: false).
-- It returns a table containing the locations - linked where possible, except for the highest.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); labelOrId(); linkedItem
-------------------------------------------------------------------------------
local _location = function(qid, first, skip)
first = parseParam(first, false)
skip = parseParam(skip, false)
local locs = {"P276", "P131", "P706"}
local out = {}
local langcode = findLang():getCode()
local finished = false
local count = 0
local prevqid = "Q0"
repeat
local prop
for i1, v1 in ipairs(locs) do
local proptbl = mw.wikibase.getBestStatements(qid, v1)
if #proptbl > 1 then
-- there is more than one higher location
local prevP131, prevP131id
if prevqid ~= "Q0" then
prevP131 = mw.wikibase.getBestStatements(prevqid, "P131")[1]
prevP131id = prevP131
and prevP131.mainsnak.datavalue
and prevP131.mainsnak.datavalue.value.id
end
for i2, v2 in ipairs(proptbl) do
local parttbl = v2.qualifiers and v2.qualifiers.P518
if parttbl then
-- this higher location has qualifier 'applies to part' (P518)
for i3, v3 in ipairs(parttbl) do
if v3.snaktype == "value" and v3.datavalue.value.id == prevqid then
-- it has a value equal to the previous location
prop = proptbl[i2]
break
end -- of test for matching last location
end -- of loop through values of 'applies to part'
else
-- there's no qualifier 'applies to part' (P518)
-- so check if the previous location had a P131 that matches this alternate
if qid == prevP131id then
prop = proptbl[i2]
break
end -- of test for matching previous P131
end
end -- of loop through parent locations
-- fallback to second value if match not found
prop = prop or proptbl[2]
elseif #proptbl > 0 then
prop = proptbl[1]
end
if prop then break end
end
-- check if it's an instance of (P31) a country (Q6256) or sovereign state (Q3624078)
-- and terminate the chain if it is
local inst = mw.wikibase.getAllStatements(qid, "P31")
if #inst > 0 then
for k, v in ipairs(inst) do
local instid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
-- stop if it's a country (or a country within the United Kingdom if skip is true)
if instid == "Q6256" or instid == "Q3624078" or (skip and instid == "Q3336843") then
prop = nil -- this will ensure this is treated as top-level location
break
end
end
end
-- get the name of this location and update qid to point to the parent location
if prop and prop.mainsnak.datavalue then
if not skip or count == 0 then
local args = { lprefix = ":" }
out[#out+1] = linkedItem(qid, args) -- get a linked value if we can
end
qid, prevqid = prop.mainsnak.datavalue.value.id, qid
else
-- This is top-level location, so get short name except when this is the first item
-- Use full label if there's no short name or this is the first item
local prop1813 = mw.wikibase.getAllStatements(qid, "P1813")
-- if there's a short name and this isn't the only item
if prop1813[1] and (#out > 0)then
local shortname
-- short name is monolingual text, so look for match to the local language
-- choose the shortest 'short name' in that language
for k, v in pairs(prop1813) do
if v.mainsnak.datavalue.value.language == langcode then
local name = v.mainsnak.datavalue.value.text
if (not shortname) or (#name < #shortname) then
shortname = name
end
end
end
-- add the shortname if one is found, fallback to the label
-- but skip it if it's "USA"
if shortname ~= "USA" then
out[#out+1] = shortname or labelOrId(qid)
else
if skip then out[#out+1] = "US" end
end
else
-- no shortname, so just add the label
local loc = labelOrId(qid)
-- exceptions go here:
if loc == "United States of America" then
out[#out+1] = "United States"
else
out[#out+1] = loc
end
end
finished = true
end
count = count + 1
until finished or count >= 10 -- limit to 10 levels to avoid infinite loops
-- remove the first location if not required
if not first then table.remove(out, 1) end
-- we might have duplicate text for consecutive locations, so remove them
if #out > 2 then
local plain = {}
for i, v in ipairs(out) do
-- strip any links
plain[i] = v:gsub("^%[%[[^|]*|", ""):gsub("]]$", "")
end
local idx = 2
repeat
if plain[idx] == plain[idx-1] then
-- duplicate found
local removeidx = 0
if (plain[idx] ~= out[idx]) and (plain[idx-1] == out[idx-1]) then
-- only second one is linked, so drop the first
removeidx = idx - 1
elseif (plain[idx] == out[idx]) and (plain[idx-1] ~= out[idx-1]) then
-- only first one is linked, so drop the second
removeidx = idx
else
-- pick one
removeidx = idx - (os.time()%2)
end
table.remove(out, removeidx)
table.remove(plain, removeidx)
else
idx = idx +1
end
until idx >= #out
end
return out
end
-------------------------------------------------------------------------------
-- _getsumofparts scans the property 'has part' (P527) for values matching a list.
-- The list (args.vlist) consists of a string of Qids separated by spaces or any usual punctuation.
-- If the matched values have a qualifer 'quantity' (P1114), those quantites are summed.
-- The sum is returned as a number (i.e. 0 if none)
-- a table of arguments is supplied implementing the usual parameters.
-------------------------------------------------------------------------------
-- Dependencies: setRanks; parseParam; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
local _getsumofparts = function(args)
local vallist = (args.vlist or ""):upper()
if vallist == "" then return end
args.reqranks = setRanks(args.rank)
local f = {}
f.args = args
local qid, props = parseInput(f, "", "P527")
if not qid then return 0 end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local sum = 0
for k1, v1 in ipairs(props) do
if (onlysrc == false or sourced(v1))
and v1.mainsnak.snaktype == "value"
and v1.mainsnak.datavalue.type == "wikibase-entityid"
and vallist:match( v1.mainsnak.datavalue.value.id )
and v1.qualifiers
then
local quals = v1.qualifiers["P1114"]
if quals then
for k2, v2 in ipairs(quals) do
sum = sum + v2.datavalue.value.amount
end
end
end
end
return sum
end
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Public functions
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- _getValue makes the functionality of getValue available to other modules
-------------------------------------------------------------------------------
-- Dependencies: setRanks; parseInput; propertyvalueandquals; assembleoutput; parseParam; sourced;
-- labelOrId; i18n.latestdatequalifier; format_Date; makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p._getValue = function(args)
-- parameter sets for commonly used groups of parameters
local paraset = tonumber(args.ps or args.parameterset or 0)
if paraset == 1 then
-- a common setting, not usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
elseif paraset == 2 then
-- equivalent to raw, not usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
args.linked = "no"
args.pd = "true"
elseif paraset == 3 then
-- parameterset 1, but usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "yes"
args.noicon = "true"
end
-- implement eid parameter
local eid = args.eid
if eid == "" then
return nil
elseif eid then
args.qid = eid
end
local propertyID = mw.text.trim(args[1] or "")
args.reqranks = setRanks(args.rank)
-- replacetext (rt) is a string that is returned instead of any non-empty Wikidata value
-- this is useful for tracking and debugging, so we set fetchwikidata=ALL to fill the whitelist
local replacetext = mw.text.trim(args.rt or args.replacetext or "")
if replacetext ~= "" then
args.fetchwikidata = "ALL"
end
local f = {}
f.args = args
local entityid, props = parseInput(f, f.args[2], propertyID)
if not entityid then
return props -- either the input parameter or nothing
end
-- qual is a string containing the property ID of the qualifier(s) to be returned
-- if qual == "ALL" then all qualifiers returned
-- if qual == "DATES" then qualifiers P580 (start time) and P582 (end time) returned
-- if nothing or an empty string is passed set it nil -> no qualifiers returned
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
-- set a language object and code in the args table
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- table 'out' stores the return value(s):
local out = propertyvalueandquals(props, args, qualID)
-- format the table of values and return it as a string:
return assembleoutput(out, args, entityid, propertyID)
end
-------------------------------------------------------------------------------
-- getValue is used to get the value(s) of a property
-- The property ID is passed as the first unnamed parameter and is required.
-- A locally supplied parameter may optionaly be supplied as the second unnamed parameter.
-- The function will now also return qualifiers if parameter qual is supplied
-------------------------------------------------------------------------------
-- Dependencies: _getValue; setRanks; parseInput; propertyvalueandquals; assembleoutput; parseParam; sourced;
-- labelOrId; i18n.latestdatequalifier; format_Date; makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p.getValue = function(frame)
local args= frame.args
if not args[1] then
args = frame:getParent().args
if not args[1] then return i18n.errors["No property supplied"] end
end
return p._getValue(args)
end
-------------------------------------------------------------------------------
-- getPreferredValue is used to get a value,
-- (or a comma separated list of them if multiple values exist).
-- If preferred ranks are set, it will return those values, otherwise values with normal ranks
-- now redundant to getValue with |rank=best
-------------------------------------------------------------------------------
-- Dependencies: p.getValue; setRanks; parseInput; propertyvalueandquals; assembleoutput;
-- parseParam; sourced; labelOrId; i18n.latestdatequalifier; format_Date;
-- makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p.getPreferredValue = function(frame)
frame.args.rank = "best"
return p.getValue(frame)
end
-------------------------------------------------------------------------------
-- getCoords is used to get coordinates for display in an infobox
-- whitelist and blacklist are implemented
-- optional 'display' parameter is allowed, defaults to nil - was "inline, title"
-------------------------------------------------------------------------------
-- Dependencies: setRanks(); parseInput(); decimalPrecision();
-------------------------------------------------------------------------------
p.getCoords = function(frame)
local propertyID = "P625"
-- if there is a 'display' parameter supplied, use it
-- otherwise default to nothing
local disp = frame.args.display or ""
if disp == "" then
disp = nil -- default to not supplying display parameter, was "inline, title"
end
-- there may be a format parameter to switch from deg/min/sec to decimal degrees
-- default is deg/min/sec
-- decimal degrees needs |format = dec
local form = (frame.args.format or ""):lower():sub(1,3)
if form ~= "dec" then
form = "dms"
end
-- just deal with best values
frame.args.reqranks = setRanks("best")
local qid, props = parseInput(frame, frame.args[1], propertyID)
if not qid then
return props -- either local parameter or nothing
else
local dv = props[1].mainsnak.datavalue.value
local lat, long, prec = dv.latitude, dv.longitude, dv.precision
lat = decimalPrecision(lat, prec)
long = decimalPrecision(long, prec)
local lat_long = { lat, long }
lat_long["display"] = disp
lat_long["format"] = form
-- invoke template Coord with the values stored in the table
return frame:expandTemplate{title = 'coord', args = lat_long}
end
end
-------------------------------------------------------------------------------
-- getQualifierValue is used to get a formatted value of a qualifier
--
-- The call needs: a property (the unnamed parameter or 1=)
-- a target value for that property (pval=)
-- a qualifier for that target value (qual=)
-- The usual whitelisting and blacklisting of the property is implemented
-- The boolean onlysourced= parameter can be set to return nothing
-- when the property is unsourced (or only sourced to Wikipedia)
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); setRanks(); parseInput(); sourced();
-- propertyvalueandquals(); assembleoutput();
-- labelOrId(); i18n.latestdatequalifier(); format_Date();
-- findLang(); makeOrdinal(); roundto(); decimalPrecision(); decimalToDMS();
-------------------------------------------------------------------------------
p.getQualifierValue = function(frame)
-- The property ID that will have a qualifier is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or "")
-- The value of the property we want to match whose qualifier value is to be returned
-- is passed in named parameter |pval=
local propvalue = frame.args.pval
-- The property ID of the qualifier
-- whose value is to be returned is passed in named parameter |qual=
local qualifierID = frame.args.qual
-- A filter can be set like this: filter=P642==Q22674854
local filter, fprop, fval
local ftable = mw.text.split(frame.args.filter or "", "==")
if ftable[2] then
fprop = mw.text.trim(ftable[1])
fval = mw.text.trim(ftable[2])
filter = true
end
-- onlysourced is a boolean passed to return qualifiers
-- only when property values are sourced to something other than Wikipedia
-- if nothing or an empty string is passed set it true
-- if "false" or "no" or 0 is passed set it false
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set a language object and language code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- check for locally supplied parameter in second unnamed parameter
-- success means no local parameter and the property exists
local qid, props = parseInput(frame, frame.args[2], propertyID)
if qid then
local out = {}
-- Scan through the values of the property
-- we want something like property is P793, significant event (in propertyID)
-- whose value is something like Q385378, construction (in propvalue)
-- then we can return the value(s) of a qualifier such as P580, start time (in qualifierID)
for k1, v1 in pairs(props) do
if v1.mainsnak.snaktype == "value" and v1.mainsnak.datavalue.type == "wikibase-entityid" then
-- It's a wiki-linked value, so check if it's the target (in propvalue) and if it has qualifiers
if v1.mainsnak.datavalue.value.id == propvalue and v1.qualifiers then
if onlysrc == false or sourced(v1) then
-- if we've got this far, we have a (sourced) claim with qualifiers
-- which matches the target, so apply the filter and find the value(s) of the qualifier we want
if not filter or (v1.qualifiers[fprop] and v1.qualifiers[fprop][1].datavalue.value.id == fval) then
local quals = v1.qualifiers[qualifierID]
if quals then
-- can't reference qualifer, so set onlysourced = "no" (args are strings, not boolean)
local qargs = frame.args
qargs.onlysourced = "no"
local vals = propertyvalueandquals(quals, qargs, qid)
for k, v in ipairs(vals) do
out[#out + 1] = v
end
end
end
end -- of check for sourced
end -- of check for matching required value and has qualifiers
end -- of check for wikibase entity
end -- of loop through values of propertyID
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- either local parameter or nothing
end -- of test for success
return nil
end
-------------------------------------------------------------------------------
-- getSumOfParts scans the property 'has part' (P527) for values matching a list.
-- The list is passed in parameter vlist.
-- It consists of a string of Qids separated by spaces or any usual punctuation.
-- If the matched values have a qualifier 'quantity' (P1114), those quantities are summed.
-- The sum is returned as a number or nothing if zero.
-------------------------------------------------------------------------------
-- Dependencies: _getsumofparts;
-------------------------------------------------------------------------------
p.getSumOfParts = function(frame)
local sum = _getsumofparts(frame.args)
if sum == 0 then return end
return sum
end
-------------------------------------------------------------------------------
-- getValueByQual gets the value of a property which has a qualifier with a given entity value
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the ID of a qualifier for that property (qualID=Pyyy)
-- either the Wikibase-entity ID of a value for that qualifier (qvalue=Qzzz)
-- or a string value for that qualifier (qvalue=abc123)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: _getvaluebyqual; parseParam; setRanks; parseInput; sourced;
-- assembleoutput;
-------------------------------------------------------------------------------
p.getValueByQual = function(frame)
local qualID = frame.args.qualID
-- The Q-id of the value for the qualifier we want to match is in named parameter |qvalue=
local qval = frame.args.qvalue or ""
if qval == "" then return "no qualifier value supplied" end
local function checkQID(id)
return id == qval
end
return _getvaluebyqual(frame, qualID, checkQID)
end
-------------------------------------------------------------------------------
-- getValueByLang gets the value of a property which has a qualifier P407
-- ("language of work or name") whose value has the given language code
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the MediaWiki language code to match the language (lang=xx[-yy])
-- (if no code is supplied, it uses the default language)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: _getvaluebyqual; parseParam; setRanks; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
p.getValueByLang = function(frame)
-- The language code for the qualifier we want to match is in named parameter |lang=
local langcode = findLang(frame.args.lang).code
local function checkLanguage(id)
-- id should represent a language like "British English (Q7979)"
-- it should have string property "Wikimedia language code (P424)"
-- qlcode will be a table:
local qlcode = mw.wikibase.getBestStatements(id, "P424")
if (#qlcode > 0) and (qlcode[1].mainsnak.datavalue.value == langcode) then
return true
end
end
return _getvaluebyqual(frame, "P407", checkLanguage)
end
-------------------------------------------------------------------------------
-- getValueByRefSource gets the value of a property which has a reference "stated in" (P248)
-- whose value has the given entity-ID.
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the entity ID of a value to match where the reference is stated in (match=Qzzz)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getValueByRefSource = function(frame)
-- The property ID that we want to check is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or ""):upper()
if propertyID == "" then return "no property supplied" end
-- The Q-id of the value we want to match is in named parameter |qvalue=
local qval = (frame.args.match or ""):upper()
if qval == "" then qval = "Q21540096" end
local unit = (frame.args.unit or ""):upper()
if unit == "" then unit = "Q4917" end
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- set a language object and code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local linked = parseParam(frame.args.linked, true)
local uabbr = parseParam(frame.args.uabbr or frame.args.unitabbr, false)
-- qid not nil means no local parameter and the property exists
local qid, props = parseInput(frame, frame.args[2], propertyID)
if qid then
local out = {}
local mlt= {}
for k1, v1 in ipairs(props) do
if onlysrc == false or sourced(v1) then
if v1.references then
for k2, v2 in ipairs(v1.references) do
if v2.snaks.P248 then
for k3, v3 in ipairs(v2.snaks.P248) do
if v3.datavalue.value.id == qval then
out[#out+1], mlt[#out+1] = rendersnak(v1, frame.args, linked, "", "", "", "", uabbr, unit)
if not mlt[#out] then
-- we only need one match per property value
-- unless datatype was monolingual text
break
end
end -- of test for match
end -- of loop through values "stated in"
end -- of test that "stated in" exists
end -- of loop through references
end -- of test that references exist
end -- of test for sourced
end -- of loop through values of propertyID
if #mlt > 0 then
local langcode = frame.args.lang
langcode = mw.text.split( langcode, '-', true )[1]
local fbtbl = mw.language.getFallbacksFor( langcode )
table.insert( fbtbl, 1, langcode )
local bestval = ""
local found = false
for idx1, lang1 in ipairs(fbtbl) do
for idx2, lang2 in ipairs(mlt) do
if (lang1 == lang2) and not found then
bestval = out[idx2]
found = true
break
end
end -- loop through values of property
end -- loop through fallback languages
if found then
-- replace output table with a table containing the best value
out = { bestval }
else
-- more than one value and none of them on the list of fallback languages
-- sod it, just give them the first one
out = { out[1] }
end
end
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- no property or local parameter supplied
end -- of test for success
end
-------------------------------------------------------------------------------
-- getPropertyIDs takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- It returns the Entity-IDs (Qids) of the values of a property if it is a Wikibase-Entity.
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p._getPropertyIDs = function(args)
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- change default for noicon to true
args.noicon = tostring(parseParam(args.noicon or "", true))
local f = {}
f.args = args
local pid = mw.text.trim(args[1] or ""):upper()
-- get the qid and table of claims for the property, or nothing and the local value passed
local qid, props = parseInput(f, args[2], pid)
if not qid then return props end
if not props[1] then return nil end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local out = {}
for i, v in ipairs(props) do
local snak = v.mainsnak
if ( snak.datatype == "wikibase-item" )
and ( v.rank and args.reqranks[v.rank:sub(1, 1)] )
and ( snak.snaktype == "value" )
and ( sourced(v) or not onlysrc )
then
out[#out+1] = snak.datavalue.value.id
end
if maxvals > 0 and #out >= maxvals then break end
end
return assembleoutput(out, args, qid, pid)
end
p.getPropertyIDs = function(frame)
local args = frame.args
return p._getPropertyIDs(args)
end
-------------------------------------------------------------------------------
-- getQualifierIDs takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- It takes a property-id as the first unnamed parameter, and an optional parameter qlist
-- which is a list of qualifier property-ids to search for (default is "ALL")
-- It returns the Entity-IDs (Qids) of the values of a property if it is a Wikibase-Entity.
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getQualifierIDs = function(frame)
local args = frame.args
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- change default for noicon to true
args.noicon = tostring(parseParam(args.noicon or "", true))
local f = {}
f.args = args
local pid = mw.text.trim(args[1] or ""):upper()
-- get the qid and table of claims for the property, or nothing and the local value passed
local qid, props = parseInput(f, args[2], pid)
if not qid then return props end
if not props[1] then return nil end
-- get the other parameters
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qlist = args.qlist or ""
if qlist == "" then qlist = "ALL" end
qlist = qlist:gsub("[%p%s]+", " ") .. " "
local out = {}
for i, v in ipairs(props) do
local snak = v.mainsnak
if ( v.rank and args.reqranks[v.rank:sub(1, 1)] )
and ( snak.snaktype == "value" )
and ( sourced(v) or not onlysrc )
then
if v.qualifiers then
for k1, v1 in pairs(v.qualifiers) do
if qlist == "ALL " or qlist:match(k1 .. " ") then
for i2, v2 in ipairs(v1) do
if v2.datatype == "wikibase-item" and v2.snaktype == "value" then
out[#out+1] = v2.datavalue.value.id
end -- of test that id exists
end -- of loop through qualifier values
end -- of test for kq in qlist
end -- of loop through qualifiers
end -- of test for qualifiers
end -- of test for rank value, sourced, and value exists
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through property values
return assembleoutput(out, args, qid, pid)
end
-------------------------------------------------------------------------------
-- getPropOfProp takes two propertyIDs: prop1 and prop2 (as well as the usual parameters)
-- If the value(s) of prop1 are of type "wikibase-item" then it returns the value(s) of prop2
-- of each of those wikibase-items.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p._getPropOfProp = function(args)
-- parameter sets for commonly used groups of parameters
local paraset = tonumber(args.ps or args.parameterset or 0)
if paraset == 1 then
-- a common setting
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
elseif paraset == 2 then
-- equivalent to raw
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
args.linked = "no"
args.pd = "true"
elseif paraset == 3 then
-- third set goes here
end
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
local pid1 = args.prop1 or args.pid1 or ""
local pid2 = args.prop2 or args.pid2 or ""
if pid1 == "" or pid2 == "" then return nil end
local f = {}
f.args = args
local qid1, statements1 = parseInput(f, args[1], pid1)
-- parseInput nulls empty args[1] and returns args[1] if nothing on Wikidata
if not qid1 then return statements1 end
-- otherwise it returns the qid and a table for the statement
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
local out = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
local snak = v.mainsnak
if snak.datatype == "wikibase-item" and snak.snaktype == "value" then
local qid2 = snak.datavalue.value.id
local statements2 = {}
if args.reqranks.b then
statements2 = mw.wikibase.getBestStatements(qid2, pid2)
else
statements2 = mw.wikibase.getAllStatements(qid2, pid2)
end
if statements2[1] then
local out2 = propertyvalueandquals(statements2, args, qualID)
out[#out+1] = assembleoutput(out2, args, qid2, pid2)
end
end -- of test for valid property1 value
end -- of test for sourced
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of property1
return assembleoutput(out, args, qid1, pid1)
end
p.getPropOfProp = function(frame)
local args= frame.args
if not args.prop1 and not args.pid1 then
args = frame:getParent().args
if not args.prop1 and not args.pid1 then return i18n.errors["No property supplied"] end
end
return p._getPropOfProp(args)
end
-------------------------------------------------------------------------------
-- getAwardCat takes most of the usual parameters. If the item has values of P166 (award received),
-- then it examines each of those awards for P2517 (category for recipients of this award).
-- If it exists, it returns the corresponding category,
-- with the item's P734 (family name) as sort key, or no sort key if there is no family name.
-- The sort key may be overridden by the parameter |sortkey (alias |sk).
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getAwardCat = function(frame)
frame.args.reqranks = setRanks(frame.args.rank)
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
args.sep = " "
local pid1 = args.prop1 or "P166"
local pid2 = args.prop2 or "P2517"
if pid1 == "" or pid2 == "" then return nil end
-- locally supplied value:
local localval = mw.text.trim(args[1] or "")
local qid1, statements1 = parseInput(frame, localval, pid1)
if not qid1 then return localval end
-- linkprefix (strip quotes)
local lp = (args.linkprefix or args.lp or ""):gsub('"', '')
-- sort key (strip quotes, hyphens and periods):
local sk = (args.sortkey or args.sk or ""):gsub('["-.]', '')
-- family name:
local famname = ""
if sk == "" then
local p734 = mw.wikibase.getBestStatements(qid1, "P734")[1]
local p734id = p734 and p734.mainsnak.snaktype == "value" and p734.mainsnak.datavalue.value.id or ""
famname = mw.wikibase.getSitelink(p734id) or ""
-- strip namespace and disambigation
local pos = famname:find(":") or 0
famname = famname:sub(pos+1):gsub("%s%(.+%)$", "")
if famname == "" then
local lbl = mw.wikibase.getLabel(p734id)
famname = lbl and mw.text.nowiki(lbl) or ""
end
end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
local out = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
local snak = v.mainsnak
if snak.datatype == "wikibase-item" and snak.snaktype == "value" then
local qid2 = snak.datavalue.value.id
local statements2 = {}
if args.reqranks.b then
statements2 = mw.wikibase.getBestStatements(qid2, pid2)
else
statements2 = mw.wikibase.getAllStatements(qid2, pid2)
end
if statements2[1] and statements2[1].mainsnak.snaktype == "value" then
local qid3 = statements2[1].mainsnak.datavalue.value.id
local sitelink = mw.wikibase.getSitelink(qid3)
-- if there's no local sitelink, create the sitelink from English label
if not sitelink then
local lbl = mw.wikibase.getLabelByLang(qid3, "en")
if lbl then
if lbl:sub(1,9) == "Category:" then
sitelink = mw.text.nowiki(lbl)
else
sitelink = "Category:" .. mw.text.nowiki(lbl)
end
end
end
if sitelink then
if sk ~= "" then
out[#out+1] = "[[" .. lp .. sitelink .. "|" .. sk .. "]]"
elseif famname ~= "" then
out[#out+1] = "[[" .. lp .. sitelink .. "|" .. famname .. "]]"
else
out[#out+1] = "[[" .. lp .. sitelink .. "]]"
end -- of check for sort keys
end -- of test for sitelink
end -- of test for category
end -- of test for wikibase item has a value
end -- of test for sourced
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of property1
return assembleoutput(out, args, qid1, pid1)
end
-------------------------------------------------------------------------------
-- getIntersectCat takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-- It takes two properties, |prop1 and |prop2 (e.g. occupation and country of citizenship)
-- Each property's value is a wiki-base entity
-- For each value of the first parameter (ranks implemented) it fetches the value's main category
-- and then each value of the second parameter (possibly substituting a simpler description)
-- then it returns all of the categories representing the intersection of those properties,
-- (e.g. Category:Actors from Canada). A joining term may be supplied (e.g. |join=from).
-- The item's P734 (family name) is the sort key, or no sort key if there is no family name.
-- The sort key may be overridden by the parameter |sortkey (alias |sk).
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getIntersectCat = function(frame)
frame.args.reqranks = setRanks(frame.args.rank)
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
args.sep = " "
args.linked = "no"
local pid1 = args.prop1 or "P106"
local pid2 = args.prop2 or "P27"
if pid1 == "" or pid2 == "" then return nil end
local qid, statements1 = parseInput(frame, "", pid1)
if not qid then return nil end
local qid, statements2 = parseInput(frame, "", pid2)
if not qid then return nil end
-- topics like countries may have different names in categories from their label in Wikidata
local subs_exists, subs = pcall(mw.loadData, "Module:WikidataIB/subs")
local join = args.join or ""
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
-- linkprefix (strip quotes)
local lp = (args.linkprefix or args.lp or ""):gsub('"', '')
-- sort key (strip quotes, hyphens and periods):
local sk = (args.sortkey or args.sk or ""):gsub('["-.]', '')
-- family name:
local famname = ""
if sk == "" then
local p734 = mw.wikibase.getBestStatements(qid, "P734")[1]
local p734id = p734 and p734.mainsnak.snaktype == "value" and p734.mainsnak.datavalue.value.id or ""
famname = mw.wikibase.getSitelink(p734id) or ""
-- strip namespace and disambigation
local pos = famname:find(":") or 0
famname = famname:sub(pos+1):gsub("%s%(.+%)$", "")
if famname == "" then
local lbl = mw.wikibase.getLabel(p734id)
famname = lbl and mw.text.nowiki(lbl) or ""
end
end
local cat1 = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
-- get the ID representing the value of the property
local pvalID = (v.mainsnak.snaktype == "value") and v.mainsnak.datavalue.value.id
if pvalID then
-- get the topic's main category (P910) for that entity
local p910 = mw.wikibase.getBestStatements(pvalID, "P910")[1]
if p910 and p910.mainsnak.snaktype == "value" then
local tmcID = p910.mainsnak.datavalue.value.id
-- use sitelink or the English label for the cat
local cat = mw.wikibase.getSitelink(tmcID)
if not cat then
local lbl = mw.wikibase.getLabelByLang(tmcID, "en")
if lbl then
if lbl:sub(1,9) == "Category:" then
cat = mw.text.nowiki(lbl)
else
cat = "Category:" .. mw.text.nowiki(lbl)
end
end
end
cat1[#cat1+1] = cat
end -- of test for topic's main category exists
end -- of test for property has vaild value
end -- of test for sourced
if maxvals > 0 and #cat1 >= maxvals then break end
end
local cat2 = {}
for k, v in ipairs(statements2) do
if not onlysrc or sourced(v) then
local cat = rendersnak(v, args)
if subs[cat] then cat = subs[cat] end
cat2[#cat2+1] = cat
end
if maxvals > 0 and #cat2 >= maxvals then break end
end
local out = {}
for k1, v1 in ipairs(cat1) do
for k2, v2 in ipairs(cat2) do
if sk ~= "" then
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "|" .. sk .. "]]"
elseif famname ~= "" then
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "|" .. famname .. "]]"
else
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "]]"
end -- of check for sort keys
end
end
args.noicon = "true"
return assembleoutput(out, args, qid, pid1)
end
-------------------------------------------------------------------------------
-- qualsToTable takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- A qid may be given, and the first unnamed parameter is the property ID, which is of type wikibase item.
-- It takes a list of qualifier property IDs as |quals=
-- For a given qid and property, it creates the rows of an html table,
-- each row being a value of the property (optionally only if the property matches the value in |pval= )
-- each cell being the first value of the qualifier corresponding to the list in |quals
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced;
-------------------------------------------------------------------------------
p.qualsToTable = function(frame)
local args = frame.args
local quals = args.quals or ""
if quals == "" then return "" end
args.reqranks = setRanks(args.rank)
local propertyID = mw.text.trim(args[1] or "")
local f = {}
f.args = args
local entityid, props = parseInput(f, "", propertyID)
if not entityid then return "" end
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
local pval = args.pval or ""
local qplist = mw.text.split(quals, "%p") -- split at punctuation and make a sequential table
for i, v in ipairs(qplist) do
qplist[i] = mw.text.trim(v):upper() -- remove whitespace and capitalise
end
local col1 = args.firstcol or ""
if col1 ~= "" then
col1 = col1 .. "</td><td>"
end
local emptycell = args.emptycell or " "
-- construct a 2-D array of qualifier values in qvals
local qvals = {}
for i, v in ipairs(props) do
local skip = false
if pval ~= "" then
local pid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
if pid ~= pval then skip = true end
end
if not skip then
local qval = {}
local vqualifiers = v.qualifiers or {}
-- go through list of wanted qualifier properties
for i1, v1 in ipairs(qplist) do
-- check for that property ID in the statement's qualifiers
local qv, qtype
if vqualifiers[v1] then
qtype = vqualifiers[v1][1].datatype
if qtype == "time" then
if vqualifiers[v1][1].snaktype == "value" then
qv = mw.wikibase.renderSnak(vqualifiers[v1][1])
qv = frame:expandTemplate{title="dts", args={qv}}
else
qv = "?"
end
elseif qtype == "url" then
if vqualifiers[v1][1].snaktype == "value" then
qv = mw.wikibase.renderSnak(vqualifiers[v1][1])
local display = mw.ustring.match( mw.uri.decode(qv, "WIKI"), "([%w ]+)$" )
if display then
qv = "[" .. qv .. " " .. display .. "]"
end
end
else
qv = mw.wikibase.formatValue(vqualifiers[v1][1])
end
end
-- record either the value or a placeholder
qval[i1] = qv or emptycell
end -- of loop through list of qualifiers
-- add the list of qualifier values as a "row" in the main list
qvals[#qvals+1] = qval
end
end -- of for each value loop
local out = {}
for i, v in ipairs(qvals) do
out[i] = "<tr><td>" .. col1 .. table.concat(qvals[i], "</td><td>") .. "</td></tr>"
end
return table.concat(out, "\n")
end
-------------------------------------------------------------------------------
-- getGlobe takes an optional qid of a Wikidata entity passed as |qid=
-- otherwise it uses the linked item for the current page.
-- If returns the Qid of the globe used in P625 (coordinate location),
-- or nil if there isn't one.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getGlobe = function(frame)
local qid = frame.args.qid or frame.args[1] or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
local coords = mw.wikibase.getBestStatements(qid, "P625")[1]
local globeid
if coords and coords.mainsnak.snaktype == "value" then
globeid = coords.mainsnak.datavalue.value.globe:match("(Q%d+)")
end
return globeid
end
-------------------------------------------------------------------------------
-- getCommonsLink takes an optional qid of a Wikidata entity passed as |qid=
-- It returns one of the following in order of preference:
-- the Commons sitelink of the linked Wikidata item;
-- the Commons sitelink of the topic's main category of the linked Wikidata item;
-------------------------------------------------------------------------------
-- Dependencies: _getCommonslink(); _getSitelink(); parseParam()
-------------------------------------------------------------------------------
p.getCommonsLink = function(frame)
local oc = frame.args.onlycat or frame.args.onlycategories
local fb = parseParam(frame.args.fallback or frame.args.fb, true)
return _getCommonslink(frame.args.qid, oc, fb)
end
-------------------------------------------------------------------------------
-- getSitelink takes the qid of a Wikidata entity passed as |qid=
-- It takes an optional parameter |wiki= to determine which wiki is to be checked for a sitelink
-- If the parameter is blank, then it uses the local wiki.
-- If there is a sitelink to an article available, it returns the plain text link to the article
-- If there is no sitelink, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getSiteLink = function(frame)
return _getSitelink(frame.args.qid, frame.args.wiki or mw.text.trim(frame.args[1] or ""))
end
-------------------------------------------------------------------------------
-- getLink has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- If there is a sitelink to an article on the local Wiki, it returns a link to the article
-- with the Wikidata label as the displayed text.
-- If there is no sitelink, it returns the label as plain text.
-- If there is no label in the local language, it displays the qid instead.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLink = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
local sitelink = mw.wikibase.getSitelink(itemID)
local label = labelOrId(itemID)
if sitelink then
return "[[:" .. sitelink .. "|" .. label .. "]]"
else
return label
end
end
-------------------------------------------------------------------------------
-- getLabel has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- It returns the Wikidata label for the local language as plain text.
-- If there is no label in the local language, it displays the qid instead.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLabel = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
local lang = frame.args.lang or ""
if lang == "" then lang = nil end
local label = labelOrId(itemID, lang)
return label
end
-------------------------------------------------------------------------------
-- label has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- if no qid is supplied, it uses the qid associated with the current page.
-- It returns the Wikidata label for the local language as plain text.
-- If there is no label in the local language, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.label = function(frame)
local qid = mw.text.trim(frame.args[1] or frame.args.qid or "")
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return end
local lang = frame.args.lang or ""
if lang == "" then lang = nil end
local label, success = labelOrId(qid, lang)
if success then return label end
end
-------------------------------------------------------------------------------
-- getAT (Article Title)
-- has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text.
-- If there is no sitelink or qid supplied, it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAT = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
return mw.wikibase.getSitelink(itemID)
end
-------------------------------------------------------------------------------
-- getDescription has the qid of a Wikidata entity passed as |qid=
-- (it defaults to the associated qid of the current article if omitted)
-- and a local parameter passed as the first unnamed parameter.
-- Any local parameter passed (other than "Wikidata" or "none") becomes the return value.
-- It returns the article description for the Wikidata entity if the local parameter is "Wikidata".
-- Nothing is returned if the description doesn't exist or "none" is passed as the local parameter.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getDescription = function(frame)
local desc = mw.text.trim(frame.args[1] or "")
local itemID = mw.text.trim(frame.args.qid or "")
if itemID == "" then itemID = nil end
if desc:lower() == 'wikidata' then
return mw.wikibase.getDescription(itemID)
elseif desc:lower() == 'none' then
return nil
else
return desc
end
end
-------------------------------------------------------------------------------
-- getAliases has the qid of a Wikidata entity passed as |qid=
-- (it defaults to the associated qid of the current article if omitted)
-- and a local parameter passed as the first unnamed parameter.
-- It implements blacklisting and whitelisting with a field name of "alias" by default.
-- Any local parameter passed becomes the return value.
-- Otherwise it returns the aliases for the Wikidata entity with the usual list options.
-- Nothing is returned if the aliases do not exist.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); assembleoutput()
-------------------------------------------------------------------------------
p.getAliases = function(frame)
local args = frame.args
local fieldname = args.name or ""
if fieldname == "" then fieldname = "alias" end
local blacklist = args.suppressfields or args.spf or ""
if blacklist:find(fieldname) then return nil end
local localval = mw.text.trim(args[1] or "")
if localval ~= "" then return localval end
local whitelist = args.fetchwikidata or args.fwd or ""
if whitelist == "" then whitelist = "NONE" end
if not (whitelist == 'ALL' or whitelist:find(fieldname)) then return nil end
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return nil end
local aliases = mw.wikibase.getEntity(qid).aliases
if not aliases then return nil end
args.langobj = findLang(args.lang)
local langcode = args.langobj.code
args.lang = langcode
local out = {}
for k1, v1 in pairs(aliases) do
if v1[1].language == langcode then
for k1, v2 in ipairs(v1) do
out[#out+1] = v2.value
end
break
end
end
return assembleoutput(out, args, qid)
end
-------------------------------------------------------------------------------
-- pageId returns the page id (entity ID, Qnnn) of the current page
-- returns nothing if the page is not connected to Wikidata
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.pageId = function(frame)
return mw.wikibase.getEntityIdForCurrentPage()
end
-------------------------------------------------------------------------------
-- formatDate is a wrapper to export the private function format_Date
-------------------------------------------------------------------------------
-- Dependencies: format_Date();
-------------------------------------------------------------------------------
p.formatDate = function(frame)
return format_Date(frame.args[1], frame.args.df, frame.args.bc)
end
-------------------------------------------------------------------------------
-- location is a wrapper to export the private function _location
-- it takes the entity-id as qid or the first unnamed parameter
-- optional boolean parameter first toggles the display of the first item
-- optional boolean parameter skip toggles the display to skip to the last item
-- parameter debug=<y/n> (default 'n') adds error msg if not a location
-------------------------------------------------------------------------------
-- Dependencies: _location();
-------------------------------------------------------------------------------
p.location = function(frame)
local debug = (frame.args.debug or ""):sub(1, 1):lower()
if debug == "" then debug = "n" end
local qid = mw.text.trim(frame.args.qid or frame.args[1] or ""):upper()
if qid == "" then qid=mw.wikibase.getEntityIdForCurrentPage() end
if not qid then
if debug ~= "n" then
return i18n.errors["entity-not-found"]
else
return nil
end
end
local first = mw.text.trim(frame.args.first or "")
local skip = mw.text.trim(frame.args.skip or "")
return table.concat( _location(qid, first, skip), ", " )
end
-------------------------------------------------------------------------------
-- checkBlacklist implements a test to check whether a named field is allowed
-- returns true if the field is not blacklisted (i.e. allowed)
-- returns false if the field is blacklisted (i.e. disallowed)
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Joe |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}
-- displays "blacklisted"
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Jim |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}
-- displays "not blacklisted"
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.checkBlacklist = function(frame)
local blacklist = frame.args.suppressfields or frame.args.spf or ""
local fieldname = frame.args.name or ""
if blacklist ~= "" and fieldname ~= "" then
if blacklist:find(fieldname) then
return false
else
return true
end
else
-- one of the fields is missing: let's call that "not on the list"
return true
end
end
-------------------------------------------------------------------------------
-- emptyor returns nil if its first unnamed argument is just punctuation, whitespace or html tags
-- otherwise it returns the argument unchanged (including leading/trailing space).
-- If the argument may contain "=", then it must be called explicitly:
-- |1=arg
-- (In that case, leading and trailing spaces are trimmed)
-- It finds use in infoboxes where it can replace tests like:
-- {{#if: {{#invoke:WikidatIB |getvalue |P99 |fwd=ALL}} | <span class="xxx">{{#invoke:WikidatIB |getvalue |P99 |fwd=ALL}}</span> | }}
-- with a form that uses just a single call to Wikidata:
-- {{#invoke |WikidataIB |emptyor |1= <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> }}
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.emptyor = function(frame)
local s = frame.args[1] or ""
if s == "" then return nil end
local sx = s:gsub("%s", ""):gsub("<[^>]*>", ""):gsub("%p", "")
if sx == "" then
return nil
else
return s
end
end
-------------------------------------------------------------------------------
-- labelorid is a public function to expose the output of labelOrId()
-- Pass the Q-number as |qid= or as an unnamed parameter.
-- It returns the Wikidata label for that entity or the qid if no label exists.
-------------------------------------------------------------------------------
-- Dependencies: labelOrId
-------------------------------------------------------------------------------
p.labelorid = function(frame)
return (labelOrId(frame.args.qid or frame.args[1]))
end
-------------------------------------------------------------------------------
-- getLang returns the MediaWiki language code of the current content.
-- If optional parameter |style=full, it returns the language name.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLang = function(frame)
local style = (frame.args.style or ""):lower()
local langcode = mw.language.getContentLanguage().code
if style == "full" then
return mw.language.fetchLanguageName( langcode )
end
return langcode
end
-------------------------------------------------------------------------------
-- getItemLangCode takes a qid parameter (using the current page's qid if blank)
-- If the item for that qid has property country (P17) it looks at the first preferred value
-- If the country has an official language (P37), it looks at the first preferred value
-- If that official language has a language code (P424), it returns the first preferred value
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: _getItemLangCode()
-------------------------------------------------------------------------------
p.getItemLangCode = function(frame)
return _getItemLangCode(frame.args.qid or frame.args[1])
end
-------------------------------------------------------------------------------
-- findLanguage exports the local findLang() function
-- It takes an optional language code and returns, in order of preference:
-- the code if a known language;
-- the user's language, if set;
-- the server's content language.
-------------------------------------------------------------------------------
-- Dependencies: findLang
-------------------------------------------------------------------------------
p.findLanguage = function(frame)
return findLang(frame.args.lang or frame.args[1]).code
end
-------------------------------------------------------------------------------
-- getQid returns the qid, if supplied
-- failing that, the Wikidata entity ID of the "category's main topic (P301)", if it exists
-- failing that, the Wikidata entity ID associated with the current page, if it exists
-- otherwise, nothing
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getQid = function(frame)
local qid = (frame.args.qid or ""):upper()
-- check if a qid was passed; if so, return it:
if qid ~= "" then return qid end
-- check if there's a "category's main topic (P301)":
qid = mw.wikibase.getEntityIdForCurrentPage()
if qid then
local prop301 = mw.wikibase.getBestStatements(qid, "P301")
if prop301[1] then
local mctid = prop301[1].mainsnak.datavalue.value.id
if mctid then return mctid end
end
end
-- otherwise return the page qid (if any)
return qid
end
-------------------------------------------------------------------------------
-- followQid takes four optional parameters: qid, props, list and all.
-- If qid is not given, it uses the qid for the connected page
-- or returns nil if there isn't one.
-- props is a list of properties, separated by punctuation.
-- If props is given, the Wikidata item for the qid is examined for each property in turn.
-- If that property contains a value that is another Wikibase-item, that item's qid is returned,
-- and the search terminates, unless |all=y when all of the qids are returned, separated by spaces.
-- If |list= is set to a template, the qids are passed as arguments to the template.
-- If props is not given, the qid is returned.
-------------------------------------------------------------------------------
-- Dependencies: parseParam()
-------------------------------------------------------------------------------
p._followQid = function(args)
local qid = (args.qid or ""):upper()
local all = parseParam(args.all, false)
local list = args.list or ""
if list == "" then list = nil end
if qid == "" then
qid = mw.wikibase.getEntityIdForCurrentPage()
end
if not qid then return nil end
local out = {}
local props = (args.props or ""):upper()
if props ~= "" then
for p in mw.text.gsplit(props, "%p") do -- split at punctuation and iterate
p = mw.text.trim(p)
for i, v in ipairs( mw.wikibase.getBestStatements(qid, p) ) do
local linkedid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
if linkedid then
if all then
out[#out+1] = linkedid
else
return linkedid
end -- test for all or just the first one found
end -- test for value exists for that property
end -- loop through values of property to follow
end -- loop through list of properties to follow
end
if #out > 0 then
local ret = ""
if list then
ret = mw.getCurrentFrame():expandTemplate{title = list, args = out}
else
ret = table.concat(out, " ")
end
return ret
else
return qid
end
end
p.followQid = function(frame)
return p._followQid(frame.args)
end
-------------------------------------------------------------------------------
-- globalSiteID returns the globalSiteID for the current wiki
-- e.g. returns "enwiki" for the English Wikipedia, "enwikisource" for English Wikisource, etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.globalSiteID = function(frame)
return mw.wikibase.getGlobalSiteId()
end
-------------------------------------------------------------------------------
-- siteID returns the root of the globalSiteID
-- e.g. "en" for "enwiki", "enwikisource", etc.
-- treats "en-gb" as "en", etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.siteID = function(frame)
local txtlang = frame:callParserFunction('int', {'lang'}) or ""
-- This deals with specific exceptions: be-tarask -> be-x-old
if txtlang == "be-tarask" then
return "be_x_old"
end
local pos = txtlang:find("-")
local ret = ""
if pos then
ret = txtlang:sub(1, pos-1)
else
ret = txtlang
end
return ret
end
-------------------------------------------------------------------------------
-- projID returns the code used to link to the reader's language's project
-- e.g "en" for [[:en:WikidataIB]]
-- treats "en-gb" as "en", etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.projID = function(frame)
local txtlang = frame:callParserFunction('int', {'lang'}) or ""
-- This deals with specific exceptions: be-tarask -> be-x-old
if txtlang == "be-tarask" then
return "be-x-old"
end
local pos = txtlang:find("-")
local ret = ""
if pos then
ret = txtlang:sub(1, pos-1)
else
ret = txtlang
end
return ret
end
-------------------------------------------------------------------------------
-- formatNumber formats a number according to the the supplied language code ("|lang=")
-- or the default language if not supplied.
-- The number is the first unnamed parameter or "|num="
-------------------------------------------------------------------------------
-- Dependencies: findLang()
-------------------------------------------------------------------------------
p.formatNumber = function(frame)
local lang
local num = tonumber(frame.args[1] or frame.args.num) or 0
lang = findLang(frame.args.lang)
return lang:formatNum( num )
end
-------------------------------------------------------------------------------
-- examine dumps the property (the unnamed parameter or pid)
-- from the item given by the parameter 'qid' (or the other unnamed parameter)
-- or from the item corresponding to the current page if qid is not supplied.
-- e.g. {{#invoke:WikidataIB |examine |pid=P26 |qid=Q42}}
-- or {{#invoke:WikidataIB |examine |P26 |Q42}} or any combination of these
-- or {{#invoke:WikidataIB |examine |P26}} for the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.examine = function( frame )
local args
if frame.args[1] or frame.args.pid or frame.args.qid then
args = frame.args
else
args = frame:getParent().args
end
local par = {}
local pid = (args.pid or ""):upper()
local qid = (args.qid or ""):upper()
par[1] = mw.text.trim( args[1] or "" ):upper()
par[2] = mw.text.trim( args[2] or "" ):upper()
table.sort(par)
if par[2]:sub(1,1) == "P" then par[1], par[2] = par[2], par[1] end
if pid == "" then pid = par[1] end
if qid == "" then qid = par[2] end
local q1 = qid:sub(1,1)
if pid:sub(1,1) ~= "P" then return "No property supplied" end
if q1 ~= "Q" and q1 ~= "M" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return "No item for this page" end
return "<pre>" .. mw.dumpObject( mw.wikibase.getAllStatements( qid, pid ) ) .. "</pre>"
end
-------------------------------------------------------------------------------
-- checkvalue looks for 'val' as a wikibase-item value of a property (the unnamed parameter or pid)
-- from the item given by the parameter 'qid'
-- or from the Wikidata item associated with the current page if qid is not supplied.
-- It only checks ranks that are requested (preferred and normal by default)
-- If property is not supplied, then P31 (instance of) is assumed.
-- It returns val if found or nothing if not found.
-- e.g. {{#invoke:WikidataIB |checkvalue |val=Q5 |pid=P31 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |P31 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |P31}} for the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.checkvalue = function( frame )
local args
if frame.args.val then
args = frame.args
else
args = frame:getParent().args
end
local val = args.val
if not val then return nil end
local pid = mw.text.trim(args.pid or args[1] or "P31"):upper()
local qid = (args.qid or ""):upper()
if pid:sub(1,1) ~= "P" then return nil end
if qid:sub(1,1) ~= "Q" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
local ranks = setRanks(args.rank)
local stats = {}
if ranks.b then
stats = mw.wikibase.getBestStatements(qid, pid)
else
stats = mw.wikibase.getAllStatements( qid, pid )
end
if not stats[1] then return nil end
if stats[1].mainsnak.datatype == "wikibase-item" then
for k, v in pairs( stats ) do
local ms = v.mainsnak
if ranks[v.rank:sub(1,1)] and ms.snaktype == "value" and ms.datavalue.value.id == val then
return val
end
end
end
return nil
end
-------------------------------------------------------------------------------
-- url2 takes a parameter url= that is a proper url and formats it for use in an infobox.
-- If no parameter is supplied, it returns nothing.
-- This is the equivalent of Template:URL
-- but it keeps the "edit at Wikidata" pen icon out of the microformat.
-- Usually it will take its url parameter directly from a Wikidata call:
-- e.g. {{#invoke:WikidataIB |url2 |url={{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}} }}
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.url2 = function(frame)
local txt = frame.args.url or ""
if txt == "" then return nil end
-- extract any icon
local url, icon = txt:match("(.+) (.+)")
-- make sure there's at least a space at the end
url = (url or txt) .. " "
icon = icon or ""
-- extract any protocol like https://
local prot = url:match("(https*://).+[ \"\']")
-- extract address
local addr = ""
if prot then
addr = url:match("https*://(.+)[ \"\']") or " "
else
prot = "//"
addr = url:match("[^%p%s]+%.(.+)[ \"\']") or " "
end
-- strip trailing / from end of domain-only url and add <wbr/> before . and /
local disp, n = addr:gsub( "^([^/]+)/$", "%1" ):gsub("%/", "<wbr/>/"):gsub("%.", "<wbr/>.")
return '<span class="url">[' .. prot .. addr .. " " .. disp .. "]</span> " .. icon
end
-------------------------------------------------------------------------------
-- getWebsite fetches the Official website (P856) and formats it for use in an infobox.
-- This is similar to Template:Official website but with a url displayed,
-- and it adds the "edit at Wikidata" pen icon beyond the microformat if enabled.
-- A local value will override the Wikidata value. "NONE" returns nothing.
-- e.g. {{#invoke:WikidataIB |getWebsite |qid= |noicon= |lang= |url= }}
-------------------------------------------------------------------------------
-- Dependencies: findLang(); parseParam();
-------------------------------------------------------------------------------
p.getWebsite = function(frame)
local url = frame.args.url or ""
if url:upper() == "NONE" then return nil end
local urls = {}
local quals = {}
local qid = frame.args.qid or ""
if url and url ~= "" then
urls[1] = url
else
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
local prop856 = mw.wikibase.getBestStatements(qid, "P856")
for k, v in pairs(prop856) do
if v.mainsnak.snaktype == "value" then
urls[#urls+1] = v.mainsnak.datavalue.value
if v.qualifiers and v.qualifiers["P1065"] then
-- just take the first archive url (P1065)
local au = v.qualifiers["P1065"][1]
if au.snaktype == "value" then
quals[#urls] = au.datavalue.value
end -- test for archive url having a value
end -- test for qualifers
end -- test for website having a value
end -- loop through website(s)
end
if #urls == 0 then return nil end
local out = {}
for i, u in ipairs(urls) do
local link = quals[i] or u
local prot, addr = u:match("(http[s]*://)(.+)")
addr = addr or u
local disp, n = addr:gsub("%.", "<wbr/>%.")
out[#out+1] = '<span class="url">[' .. link .. " " .. disp .. "]</span>"
end
local langcode = findLang(frame.args.lang).code
local noicon = parseParam(frame.args.noicon, false)
if url == "" and not noicon then
out[#out] = out[#out] .. createicon(langcode, qid, "P856")
end
local ret = ""
if #out > 1 then
ret = mw.getCurrentFrame():expandTemplate{title = "ubl", args = out}
else
ret = out[1]
end
return ret
end
-------------------------------------------------------------------------------
-- getAllLabels fetches the set of labels and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllLabels = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local labels = mw.wikibase.getEntity(qid).labels
if not labels then return i18n["labels-not-found"] end
local out = {}
for k, v in pairs(labels) do
out[#out+1] = v.value .. " (" .. v.language .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- getAllDescriptions fetches the set of descriptions and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllDescriptions = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local descriptions = mw.wikibase.getEntity(qid).descriptions
if not descriptions then return i18n["descriptions-not-found"] end
local out = {}
for k, v in pairs(descriptions) do
out[#out+1] = v.value .. " (" .. v.language .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- getAllAliases fetches the set of aliases and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllAliases = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local aliases = mw.wikibase.getEntity(qid).aliases
if not aliases then return i18n["aliases-not-found"] end
local out = {}
for k1, v1 in pairs(aliases) do
local lang = v1[1].language
local val = {}
for k1, v2 in ipairs(v1) do
val[#val+1] = v2.value
end
out[#out+1] = table.concat(val, ", ") .. " (" .. lang .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- showNoLinks displays the article titles that should not be linked.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.showNoLinks = function(frame)
local out = {}
for k, v in pairs(donotlink) do
out[#out+1] = k
end
table.sort( out )
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- checkValidity checks whether the first unnamed parameter represents a valid entity-id,
-- that is, something like Q1235 or P123.
-- It returns the strings "true" or "false".
-- Change false to nil to return "true" or "" (easier to test with #if:).
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
function p.checkValidity(frame)
local id = mw.text.trim(frame.args[1] or "")
if mw.wikibase.isValidEntityId(id) then
return true
else
return false
end
end
-------------------------------------------------------------------------------
-- getEntityFromTitle returns the Entity-ID (Q-number) for a given title.
-- Modification of Module:ResolveEntityId
-- The title is the first unnamed parameter.
-- The site parameter determines the site/language for the title. Defaults to current wiki.
-- The showdab parameter determines whether dab pages should return the Q-number or nil. Defaults to true.
-- Returns the Q-number or nil if it does not exist.
-------------------------------------------------------------------------------
-- Dependencies: parseParam
-------------------------------------------------------------------------------
function p.getEntityFromTitle(frame)
local args=frame.args
if not args[1] then args=frame:getParent().args end
if not args[1] then return nil end
local title = mw.text.trim(args[1])
local site = args.site or ""
local showdab = parseParam(args.showdab, true)
local qid = mw.wikibase.getEntityIdForTitle(title, site)
if qid then
local prop31 = mw.wikibase.getBestStatements(qid, "P31")[1]
if not showdab and prop31 and prop31.mainsnak.datavalue.value.id == "Q4167410" then
return nil
else
return qid
end
end
end
-------------------------------------------------------------------------------
-- getDatePrecision returns the number representing the precision of the first best date value
-- for the given property.
-- It takes the qid and property ID
-- The meanings are given at https://www.mediawiki.org/wiki/Wikibase/DataModel#Dates_and_times
-- 0 = 1 billion years .. 6 = millennium, 7 = century, 8 = decade, 9 = year, 10 = month, 11 = day
-- Returns 0 (or the second unnamed parameter) if the Wikidata does not exist.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; sourced;
-------------------------------------------------------------------------------
function p.getDatePrecision(frame)
local args=frame.args
if not args[1] then args=frame:getParent().args end
local default = tonumber(args[2] or args.default) or 0
local prop = mw.text.trim(args[1] or "")
if prop == "" then return default end
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return default end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local stat = mw.wikibase.getBestStatements(qid, prop)
for i, v in ipairs(stat) do
local prec = (onlysrc == false or sourced(v))
and v.mainsnak.datavalue
and v.mainsnak.datavalue.value
and v.mainsnak.datavalue.value.precision
if prec then return prec end
end
return default
end
return p
-------------------------------------------------------------------------------
-- List of exported functions
-------------------------------------------------------------------------------
--[[
_getValue
getValue
getPreferredValue
getCoords
getQualifierValue
getSumOfParts
getValueByQual
getValueByLang
getValueByRefSource
getPropertyIDs
getQualifierIDs
getPropOfProp
getAwardCat
getIntersectCat
getGlobe
getCommonsLink
getSiteLink
getLink
getLabel
label
getAT
getDescription
getAliases
pageId
formatDate
location
checkBlacklist
emptyor
labelorid
getLang
getItemLangCode
findLanguage
getQID
followQid
globalSiteID
siteID
projID
formatNumber
examine
checkvalue
url2
getWebsite
getAllLabels
getAllDescriptions
getAllAliases
showNoLinks
checkValidity
getEntityFromTitle
getDatePrecision
--]]
-------------------------------------------------------------------------------
ql7i3j6aywa93pfslfr0svyicj7ctkn
Módulo:Wikitext Parsing
828
7214
75032
71876
2026-07-29T21:33:46Z
en>Pppery
0
Copy from sandbox per request
75032
Scribunto
text/plain
require("strict")
-- We're calling up to thousands of string methods each time we run, so
-- do this very simple micro optimisation to help a tiny bit
local string = string
-- Helper functions for PrepareText --
local function endswith(text, subtext)
return string.sub(text, -#subtext, -1) == subtext
end
local function allcases(s)
return string.gsub(s, "%a", function(c)
return "["..string.upper(c)..string.lower(c).."]"
end)
end
--[=[ Implementation notes
---- NORMAL HTML TAGS ----
Tags are very strict on how they want to start, but loose on how they end.
The start must strictly follow <[tAgNaMe](%s|>) with no room for whitespace in
the tag's name, but may then flow as they want afterwards, making
<div\nclass\n=\n"\nerror\n"\n> valid. If a tag has no end, it will consume all
text instead of not processing.
There's no sense of escaping < or >
E.g.
<div class="error\>"> will end at \> despite it being inside a quote
<div class="<span class="error">error</span>"> will not process the larger div
---- NOPROCESSING TAGS (nowiki, pre, syntaxhighlight, source, etc.) ----
(Note: <source> is the deprecated version of <syntaxhighlight>)
No-processing tags have some differences to the above rules. Specifically, their
syntax is a lot stricter. While an opening tag follows the same set of rules, A
closing tag can't have any sort of extra formatting. </div a/a> is valid,
</nowiki a/a> is not. Only newlines and spaces/tabs are allowed in closing tags.
Note that, even though tags may cause a visual change without an ending tag like
<pre>, one is required for the no-processing effects.
Both the content inside the tag pair and the text in the tags will not be
processed. E.g. <nowiki |}}>|}}</nowiki> would have both of the |}} escaped.
Since we only care about these no-processing tags, we can ignore the idea of an
intercepting tag messing us up, and just go for the first ending we can find. If
there is no ending, the tag will NOT consume the rest of the text. Even if there
is no ending tag, the content inside the opening tag will still be unprocessed,
meaning {{X20|<nowiki }}>}} wouldn't end at the first }} despite there being no
ending tag.
There are some tags, like <math>, which also function like <nowiki> for our
purposes, and are handled here. Some other tags, like <ref>, have more complex
behaviour that can't be reasonably implemented in this, and so are ignored. I
suspect that every tag listed in [[Special:Version]] may behave somewhat like
this, but that's far too many cases worth checking for rarely used tags that may
not even have a good reason to contain {{ or }} anyways, so we leave them alone.
---- INCLUDEONLY ----
While includeonly tags do technically serve the same purpose as a nowiki tag for
what this module does, contextually they don't always make sense to escape, and
as such are ignored by this module entirely.
--]=]
-- This function expects the string to start with the tag
local validtags = {nowiki=1, pre=1, syntaxhighlight=1, source=1, math=1}
local function TestForNowikiTag(text, scanPosition)
local tagName = string.match(text, "^<([^\n />]+)", scanPosition)
if not tagName or not validtags[string.lower(tagName)] then
return nil
end
local nextOpener = string.find(text, "<", scanPosition+1, true)
local nextCloser = string.find(text, ">", scanPosition+1, true)
if nextCloser and (not nextOpener or nextCloser < nextOpener) then
local startingTag = string.sub(text, scanPosition, nextCloser)
-- We have our starting tag (E.g. '<pre style="color:red">')
-- Now find our ending...
if endswith(startingTag, "/>") then -- self-closing tag (we are our own ending)
return {
Tag = tagName,
Start = startingTag,
Content = "", End = "",
Length = #startingTag
}
else
local endingTagStart, endingTagEnd = string.find(text, "</"..allcases(tagName).."[ \t\n]*>", scanPosition)
if endingTagStart then --Regular tag formation
local endingTag = string.sub(text, endingTagStart, endingTagEnd)
local tagContent = string.sub(text, nextCloser+1, endingTagStart-1)
return {
Tag = tagName,
Start = startingTag,
Content = tagContent,
End = endingTag,
Length = #startingTag + #tagContent + #endingTag
}
else -- Content inside still needs escaping (also linter error!)
return {
Tag = tagName,
Start = startingTag,
Content = "", End = "",
Length = #startingTag
}
end
end
end
return nil
end
--[=[ Implementation Notes
HTML Comments are about as basic as it gets. Start at <!--, end at -->, no extra
conditions. If a comment has no end, it will eat all the text ahead.
--]=]
local function TestForComment(text, scanPosition)
if string.match(text, "^<!%-%-", scanPosition) then
local commentEnd = string.find(text, "-->", scanPosition+4, true)
if commentEnd then
return {
Start = "<!--", End = "-->",
Content = string.sub(text, scanPosition+4, commentEnd-1),
Length = commentEnd-scanPosition+3
}
else -- Consumes all text if not given an ending
return {
Start = "<!--", End = "",
Content = string.sub(text, scanPosition+4),
Length = #text-scanPosition+1
}
end
end
return nil
end
--[[ Implementation notes
The goal of this function is to escape all text that wouldn't be parsed if it
was preprocessed (see above implementation notes).
Using keepComments will keep all HTML comments instead of removing them. They
will still be escaped regardless.
--]]
local function PrepareText(text, keepComments)
local newtext = {}
local scanPosition = 1
local textPosition = 1
while true do
local nextCheck = string.find(text, "<", scanPosition, true) -- Advance to the next potential tag we care about
if not nextCheck then -- Done
newtext[#newtext+1] = string.sub(text, textPosition)
break
end
scanPosition = nextCheck
local Comment = TestForComment(text, scanPosition)
if Comment then
newtext[#newtext+1] = string.sub(text, textPosition, nextCheck-1)
if keepComments then
newtext[#newtext+1] = Comment.Start .. mw.text.nowiki(Comment.Content) .. Comment.End
end
scanPosition = scanPosition + Comment.Length
textPosition = scanPosition
else
local Tag = TestForNowikiTag(text, scanPosition)
if Tag then
newtext[#newtext+1] = string.sub(text, textPosition, nextCheck-1)
local newTagStart = "<" .. mw.text.nowiki(string.sub(Tag.Start, 2, -2)) .. ">"
local newTagEnd =
Tag.End == "" and "" or -- Respect no tag ending
"</" .. mw.text.nowiki(string.sub(Tag.End, 3, -2)) .. ">"
local newContent = mw.text.nowiki(Tag.Content)
newtext[#newtext+1] = newTagStart .. newContent .. newTagEnd
scanPosition = scanPosition + Tag.Length
textPosition = scanPosition
else -- Nothing special, move on...
scanPosition = scanPosition + 1
end
end
end
return table.concat(newtext, "")
end
local p = {}
--Main entry points
p.PrepareText = PrepareText
--Extra entry points, not really required
p.TestForNowikiTag = TestForNowikiTag
p.TestForComment = TestForComment
return p
--[==[ console tests
local s = [=[Hey!{{Text|<nowiki | ||>
Hey! }}
A</nowiki>|<!--AAAAA|AAA-->Should see|Shouldn't see}}]=]
local out = p.PrepareText(s)
mw.logObject(out)
local s = [=[B<!--
Hey!
-->A]=]
local out = p.TestForComment(s, 2)
mw.logObject(out); mw.log(string.sub(s, 2, out.Length))
]==]
iiu3f4jhxaiu5ehdw27fgi71pmkfo78
75033
75032
2026-08-24T00:46:12Z
Robertsky
10424
1 versaun husi [[:en:Module:Wikitext_Parsing]]
75032
Scribunto
text/plain
require("strict")
-- We're calling up to thousands of string methods each time we run, so
-- do this very simple micro optimisation to help a tiny bit
local string = string
-- Helper functions for PrepareText --
local function endswith(text, subtext)
return string.sub(text, -#subtext, -1) == subtext
end
local function allcases(s)
return string.gsub(s, "%a", function(c)
return "["..string.upper(c)..string.lower(c).."]"
end)
end
--[=[ Implementation notes
---- NORMAL HTML TAGS ----
Tags are very strict on how they want to start, but loose on how they end.
The start must strictly follow <[tAgNaMe](%s|>) with no room for whitespace in
the tag's name, but may then flow as they want afterwards, making
<div\nclass\n=\n"\nerror\n"\n> valid. If a tag has no end, it will consume all
text instead of not processing.
There's no sense of escaping < or >
E.g.
<div class="error\>"> will end at \> despite it being inside a quote
<div class="<span class="error">error</span>"> will not process the larger div
---- NOPROCESSING TAGS (nowiki, pre, syntaxhighlight, source, etc.) ----
(Note: <source> is the deprecated version of <syntaxhighlight>)
No-processing tags have some differences to the above rules. Specifically, their
syntax is a lot stricter. While an opening tag follows the same set of rules, A
closing tag can't have any sort of extra formatting. </div a/a> is valid,
</nowiki a/a> is not. Only newlines and spaces/tabs are allowed in closing tags.
Note that, even though tags may cause a visual change without an ending tag like
<pre>, one is required for the no-processing effects.
Both the content inside the tag pair and the text in the tags will not be
processed. E.g. <nowiki |}}>|}}</nowiki> would have both of the |}} escaped.
Since we only care about these no-processing tags, we can ignore the idea of an
intercepting tag messing us up, and just go for the first ending we can find. If
there is no ending, the tag will NOT consume the rest of the text. Even if there
is no ending tag, the content inside the opening tag will still be unprocessed,
meaning {{X20|<nowiki }}>}} wouldn't end at the first }} despite there being no
ending tag.
There are some tags, like <math>, which also function like <nowiki> for our
purposes, and are handled here. Some other tags, like <ref>, have more complex
behaviour that can't be reasonably implemented in this, and so are ignored. I
suspect that every tag listed in [[Special:Version]] may behave somewhat like
this, but that's far too many cases worth checking for rarely used tags that may
not even have a good reason to contain {{ or }} anyways, so we leave them alone.
---- INCLUDEONLY ----
While includeonly tags do technically serve the same purpose as a nowiki tag for
what this module does, contextually they don't always make sense to escape, and
as such are ignored by this module entirely.
--]=]
-- This function expects the string to start with the tag
local validtags = {nowiki=1, pre=1, syntaxhighlight=1, source=1, math=1}
local function TestForNowikiTag(text, scanPosition)
local tagName = string.match(text, "^<([^\n />]+)", scanPosition)
if not tagName or not validtags[string.lower(tagName)] then
return nil
end
local nextOpener = string.find(text, "<", scanPosition+1, true)
local nextCloser = string.find(text, ">", scanPosition+1, true)
if nextCloser and (not nextOpener or nextCloser < nextOpener) then
local startingTag = string.sub(text, scanPosition, nextCloser)
-- We have our starting tag (E.g. '<pre style="color:red">')
-- Now find our ending...
if endswith(startingTag, "/>") then -- self-closing tag (we are our own ending)
return {
Tag = tagName,
Start = startingTag,
Content = "", End = "",
Length = #startingTag
}
else
local endingTagStart, endingTagEnd = string.find(text, "</"..allcases(tagName).."[ \t\n]*>", scanPosition)
if endingTagStart then --Regular tag formation
local endingTag = string.sub(text, endingTagStart, endingTagEnd)
local tagContent = string.sub(text, nextCloser+1, endingTagStart-1)
return {
Tag = tagName,
Start = startingTag,
Content = tagContent,
End = endingTag,
Length = #startingTag + #tagContent + #endingTag
}
else -- Content inside still needs escaping (also linter error!)
return {
Tag = tagName,
Start = startingTag,
Content = "", End = "",
Length = #startingTag
}
end
end
end
return nil
end
--[=[ Implementation Notes
HTML Comments are about as basic as it gets. Start at <!--, end at -->, no extra
conditions. If a comment has no end, it will eat all the text ahead.
--]=]
local function TestForComment(text, scanPosition)
if string.match(text, "^<!%-%-", scanPosition) then
local commentEnd = string.find(text, "-->", scanPosition+4, true)
if commentEnd then
return {
Start = "<!--", End = "-->",
Content = string.sub(text, scanPosition+4, commentEnd-1),
Length = commentEnd-scanPosition+3
}
else -- Consumes all text if not given an ending
return {
Start = "<!--", End = "",
Content = string.sub(text, scanPosition+4),
Length = #text-scanPosition+1
}
end
end
return nil
end
--[[ Implementation notes
The goal of this function is to escape all text that wouldn't be parsed if it
was preprocessed (see above implementation notes).
Using keepComments will keep all HTML comments instead of removing them. They
will still be escaped regardless.
--]]
local function PrepareText(text, keepComments)
local newtext = {}
local scanPosition = 1
local textPosition = 1
while true do
local nextCheck = string.find(text, "<", scanPosition, true) -- Advance to the next potential tag we care about
if not nextCheck then -- Done
newtext[#newtext+1] = string.sub(text, textPosition)
break
end
scanPosition = nextCheck
local Comment = TestForComment(text, scanPosition)
if Comment then
newtext[#newtext+1] = string.sub(text, textPosition, nextCheck-1)
if keepComments then
newtext[#newtext+1] = Comment.Start .. mw.text.nowiki(Comment.Content) .. Comment.End
end
scanPosition = scanPosition + Comment.Length
textPosition = scanPosition
else
local Tag = TestForNowikiTag(text, scanPosition)
if Tag then
newtext[#newtext+1] = string.sub(text, textPosition, nextCheck-1)
local newTagStart = "<" .. mw.text.nowiki(string.sub(Tag.Start, 2, -2)) .. ">"
local newTagEnd =
Tag.End == "" and "" or -- Respect no tag ending
"</" .. mw.text.nowiki(string.sub(Tag.End, 3, -2)) .. ">"
local newContent = mw.text.nowiki(Tag.Content)
newtext[#newtext+1] = newTagStart .. newContent .. newTagEnd
scanPosition = scanPosition + Tag.Length
textPosition = scanPosition
else -- Nothing special, move on...
scanPosition = scanPosition + 1
end
end
end
return table.concat(newtext, "")
end
local p = {}
--Main entry points
p.PrepareText = PrepareText
--Extra entry points, not really required
p.TestForNowikiTag = TestForNowikiTag
p.TestForComment = TestForComment
return p
--[==[ console tests
local s = [=[Hey!{{Text|<nowiki | ||>
Hey! }}
A</nowiki>|<!--AAAAA|AAA-->Should see|Shouldn't see}}]=]
local out = p.PrepareText(s)
mw.logObject(out)
local s = [=[B<!--
Hey!
-->A]=]
local out = p.TestForComment(s, 2)
mw.logObject(out); mw.log(string.sub(s, 2, out.Length))
]==]
iiu3f4jhxaiu5ehdw27fgi71pmkfo78
Módulo:Coordinates
828
7230
74770
72226
2026-07-01T16:40:59Z
en>Ahecht
0
Copy from sandbox. Implement parsing of coordinates from a single parameter. Feel free to roll back if there are unintended consequences.
74770
Scribunto
text/plain
--[[
This module is intended to replace the functionality of {{Coord}} and related
templates. It provides several methods, including
{{#invoke:Coordinates | coord }} : General function formatting and displaying
coordinate values.
{{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal
degree values to DMS format.
{{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format
to decimal degree format.
{{#invoke:Coordinates | link }} : Export the link used to reach the tools
]]
require('strict')
local math_mod = require("Module:Math")
local coordinates = {};
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true);
local current_page = mw.title.getCurrentTitle()
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );
local coord_link = 'https://geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '¶ms='
--[[ Helper function, replacement for {{coord/display/title}} ]]
local function displaytitle(coords)
return mw.getCurrentFrame():extensionTag{
name = 'indicator',
args = { name = 'coordinates' },
content = '<span id="coordinates">[[Geographic coordinate system|Coordinates]]: ' .. coords .. '</span>'
}
end
--[[ Helper function, used in detecting DMS formatting ]]
local function dmsTest(first, second)
if type(first) ~= 'string' or type(second) ~= 'string' then
return nil
end
local s = (first .. second):upper()
return s:find('^[NS][EW]$') or s:find('^[EW][NS]$')
end
--[[ Wrapper function to grab args, see Module:Arguments for this function's documentation. ]]
local function makeInvokeFunc(funcName)
return function (frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Coord'
})
return coordinates[funcName](args, frame)
end
end
--[[ Helper function, handle optional args. ]]
local function optionalArg(arg, supplement)
return arg and arg .. supplement or ''
end
--[[
Formats any error messages generated for display
]]
local function errorPrinter(errors)
local result = ""
for i,v in ipairs(errors) do
result = result .. '<strong class="error">Coordinates: ' .. v[2] .. '</strong><br />'
end
return result
end
--[[
Determine the required CSS class to display coordinates
Usually geo-nondefault is hidden by CSS, unless a user has overridden this for himself
default is the mode as specificied by the user when calling the {{coord}} template
mode is the display mode (dec or dms) that we will need to determine the css class for
]]
local function displayDefault(default, mode)
if default == "" then
default = "dec"
end
if default == mode then
return "geo-default"
else
return "geo-nondefault"
end
end
--[[
specPrinter
Output formatter. Takes the structure generated by either parseDec
or parseDMS and formats it for inclusion on Wikipedia.
]]
local function specPrinter(args, coordinateSpec)
local uriComponents = coordinateSpec["param"]
if uriComponents == "" then
-- RETURN error, should never be empty or nil
return "ERROR param was empty"
end
if args["name"] then
uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"])
end
local geodmshtml = '<span class="geo-dms" title="Maps, aerial photos, and other data for this location">'
.. '<span class="latitude">' .. coordinateSpec["dms-lat"] .. '</span> '
.. '<span class="longitude">' ..coordinateSpec["dms-long"] .. '</span>'
.. '</span>'
local lat = tonumber( coordinateSpec["dec-lat"] ) or 0
local geodeclat
if lat < 0 then
-- FIXME this breaks the pre-existing precision
geodeclat = tostring(coordinateSpec["dec-lat"]):sub(2) .. "°S"
else
geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°N"
end
local long = tonumber( coordinateSpec["dec-long"] ) or 0
local geodeclong
if long < 0 then
-- FIXME does not handle unicode minus
geodeclong = tostring(coordinateSpec["dec-long"]):sub(2) .. "°W"
else
geodeclong = (coordinateSpec["dec-long"] or 0) .. "°E"
end
local geodechtml = '<span class="geo-dec" title="Maps, aerial photos, and other data for this location">'
.. geodeclat .. ' '
.. geodeclong
.. '</span>'
local geonumhtml = '<span class="geo">'
.. coordinateSpec["dec-lat"] .. '; '
.. coordinateSpec["dec-long"]
.. '</span>'
local inner = '<span class="' .. displayDefault(coordinateSpec["default"], "dms" ) .. '">' .. geodmshtml .. '</span>'
.. '<span class="geo-multi-punct"> / </span>'
.. '<span class="' .. displayDefault(coordinateSpec["default"], "dec" ) .. '">';
if not args["name"] then
inner = inner .. geodechtml
.. '<span style="display:none"> / ' .. geonumhtml .. '</span></span>'
else
inner = inner .. '<span class="vcard">' .. geodechtml
.. '<span style="display:none"> / ' .. geonumhtml .. '</span>'
.. '<span style="display:none"> (<span class="fn org">'
.. args["name"] .. '</span>)</span></span></span>'
end
local stylesheetLink = 'Module:Coordinates' .. ( isSandbox and '/sandbox' or '' ) .. '/styles.css'
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = stylesheetLink }
} .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents ..
' ' .. inner .. ']</span>' .. '[[Category:Pages using gadget WikiMiniAtlas]]'
end
--[[ Helper function, convert decimal to degrees ]]
local function convert_dec2dms_d(coordinate)
local d = math_mod._round( coordinate, 0 ) .. "°"
return d .. ""
end
--[[ Helper function, convert decimal to degrees and minutes ]]
local function convert_dec2dms_dm(coordinate)
coordinate = math_mod._round( coordinate * 60, 0 );
local m = coordinate % 60;
coordinate = math.floor( (coordinate - m) / 60 );
local d = coordinate % 360 .."°"
return d .. string.format( "%02d′", m )
end
--[[ Helper function, convert decimal to degrees, minutes, and seconds ]]
local function convert_dec2dms_dms(coordinate)
coordinate = math_mod._round( coordinate * 60 * 60, 0 );
local s = coordinate % 60
coordinate = math.floor( (coordinate - s) / 60 );
local m = coordinate % 60
coordinate = math.floor( (coordinate - m) / 60 );
local d = coordinate % 360 .."°"
return d .. string.format( "%02d′", m ) .. string.format( "%02d″", s )
end
--[[
Helper function, convert decimal latitude or longitude to
degrees, minutes, and seconds format based on the specified precision.
]]
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)
local coord = tonumber(coordinate)
local postfix
if coord >= 0 then
postfix = firstPostfix
else
postfix = secondPostfix
end
precision = precision:lower();
if precision == "dms" then
return convert_dec2dms_dms( math.abs( coord ) ) .. postfix;
elseif precision == "dm" then
return convert_dec2dms_dm( math.abs( coord ) ) .. postfix;
elseif precision == "d" then
return convert_dec2dms_d( math.abs( coord ) ) .. postfix;
end
end
--[[
Convert DMS format into a N or E decimal coordinate
]]
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str)
local degrees = tonumber(degrees_str)
local minutes = tonumber(minutes_str) or 0
local seconds = tonumber(seconds_str) or 0
local factor = 1
if direction == "S" or direction == "W" then
factor = -1
end
local precision = 0
if seconds_str then
precision = 5 + math.max( math_mod._precision(seconds_str), 0 );
elseif minutes_str and minutes_str ~= '' then
precision = 3 + math.max( math_mod._precision(minutes_str), 0 );
else
precision = math.max( math_mod._precision(degrees_str), 0 );
end
local decimal = factor * (degrees+(minutes+seconds/60)/60)
return string.format( "%." .. precision .. "f", decimal ) -- not tonumber since this whole thing is string based.
end
--[[
Checks input values to for out of range errors.
]]
local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong )
local errors = {};
lat_d = tonumber( lat_d ) or 0;
lat_m = tonumber( lat_m ) or 0;
lat_s = tonumber( lat_s ) or 0;
long_d = tonumber( long_d ) or 0;
long_m = tonumber( long_m ) or 0;
long_s = tonumber( long_s ) or 0;
if strong then
if lat_d < 0 then
table.insert(errors, {source, "latitude degrees < 0 with hemisphere flag"})
end
if long_d < 0 then
table.insert(errors, {source, "longitude degrees < 0 with hemisphere flag"})
end
--[[
#coordinates is inconsistent about whether this is an error. If globe: is
specified, it won't error on this condition, but otherwise it will.
For not simply disable this check.
if long_d > 180 then
table.insert(errors, {source, "longitude degrees > 180 with hemisphere flag"})
end
]]
end
if lat_d > 90 then
table.insert(errors, {source, "latitude degrees > 90"})
end
if lat_d < -90 then
table.insert(errors, {source, "latitude degrees < -90"})
end
if lat_m >= 60 then
table.insert(errors, {source, "latitude minutes >= 60"})
end
if lat_m < 0 then
table.insert(errors, {source, "latitude minutes < 0"})
end
if lat_s >= 60 then
table.insert(errors, {source, "latitude seconds >= 60"})
end
if lat_s < 0 then
table.insert(errors, {source, "latitude seconds < 0"})
end
if long_d >= 360 then
table.insert(errors, {source, "longitude degrees >= 360"})
end
if long_d <= -360 then
table.insert(errors, {source, "longitude degrees <= -360"})
end
if long_m >= 60 then
table.insert(errors, {source, "longitude minutes >= 60"})
end
if long_m < 0 then
table.insert(errors, {source, "longitude minutes < 0"})
end
if long_s >= 60 then
table.insert(errors, {source, "longitude seconds >= 60"})
end
if long_s < 0 then
table.insert(errors, {source, "longitude seconds < 0"})
end
return errors;
end
--[[
parseDec
Transforms decimal format latitude and longitude into the
structure to be used in displaying coordinates
]]
local function parseDec( lat, long, format )
local coordinateSpec = {}
local errors = {}
if not long then
return nil, {{"parseDec", "Missing longitude"}}
elseif not tonumber(long) then
return nil, {{"parseDec", "Longitude could not be parsed as a number: " .. long}}
end
errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false );
coordinateSpec["dec-lat"] = lat;
coordinateSpec["dec-long"] = long;
local mode = coordinates.determineMode( lat, long );
coordinateSpec["dms-lat"] = convert_dec2dms( lat, "N", "S", mode) -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
coordinateSpec["dms-long"] = convert_dec2dms( long, "E", "W", mode) -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
if format then
coordinateSpec.default = format
else
coordinateSpec.default = "dec"
end
return coordinateSpec, errors
end
--[[
parseDMS
Transforms degrees, minutes, seconds format latitude and longitude
into the a structure to be used in displaying coordinates
]]
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )
local coordinateSpec, errors, backward = {}, {}
lat_f = lat_f:upper();
long_f = long_f:upper();
-- Check if specified backward
if lat_f == 'E' or lat_f == 'W' then
lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true;
end
errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );
if not long_d then
return nil, {{"parseDMS", "Missing longitude" }}
elseif not tonumber(long_d) then
return nil, {{"parseDMS", "Longitude could not be parsed as a number:" .. long_d }}
end
if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then
if math_mod._precision( lat_d ) > 0 or math_mod._precision( long_d ) > 0 then
if lat_f:upper() == 'S' then
lat_d = '-' .. lat_d;
end
if long_f:upper() == 'W' then
long_d = '-' .. long_d;
end
return parseDec( lat_d, long_d, format );
end
end
coordinateSpec["dms-lat"] = lat_d.."°"..optionalArg(lat_m,"′") .. optionalArg(lat_s,"″") .. lat_f
coordinateSpec["dms-long"] = long_d.."°"..optionalArg(long_m,"′") .. optionalArg(long_s,"″") .. long_f
coordinateSpec["dec-lat"] = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}
coordinateSpec["dec-long"] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}
if format then
coordinateSpec.default = format
else
coordinateSpec.default = "dms"
end
return coordinateSpec, errors, backward
end
--[[
Check the input arguments for coord to determine the kind of data being provided
and then make the necessary processing.
]]
local function formatTest(args)
local result, errors
local backward, primary = false, false
local function getParam(args, lim)
local ret = {}
for i = 1, lim do
ret[i] = args[i] or ''
end
return table.concat(ret, '_')
end
if not args[1] then
-- no lat logic
return errorPrinter( {{"formatTest", "Missing latitude"}} )
elseif not tonumber(args[1]) then
-- bad lat logic
return errorPrinter( {{"formatTest", "Unable to parse latitude as a number:" .. args[1]}} )
elseif not args[4] and not args[5] and not args[6] then
-- dec logic
result, errors = parseDec(args[1], args[2], args.format)
if not result then
return errorPrinter(errors);
end
-- formatting for geohack: geohack expects D_N_D_E notation or D;D notation
-- wikiminiatlas doesn't support D;D notation
-- #coordinates parserfunction doesn't support negative decimals with NSWE
result.param = table.concat({
math.abs(tonumber(args[1])),
((tonumber(args[1]) or 0) < 0) and 'S' or 'N',
math.abs(tonumber(args[2])),
((tonumber(args[2]) or 0) < 0) and 'W' or 'E',
args[3] or ''}, '_')
elseif dmsTest(args[4], args[8]) then
-- dms logic
result, errors, backward = parseDMS(args[1], args[2], args[3], args[4],
args[5], args[6], args[7], args[8], args.format)
if args[10] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 9)
elseif dmsTest(args[3], args[6]) then
-- dm logic
result, errors, backward = parseDMS(args[1], args[2], nil, args[3],
args[4], args[5], nil, args[6], args['format'])
if args[8] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 7)
elseif dmsTest(args[2], args[4]) then
-- d logic
result, errors, backward = parseDMS(args[1], nil, nil, args[2],
args[3], nil, nil, args[4], args.format)
if args[6] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 5)
else
-- Error
return errorPrinter({{"formatTest", "Unknown argument format"}}) .. '[[Category:Pages with malformed coordinate tags]]'
end
result.name = args.name
local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'}
for _, v in ipairs(extra_param) do
if args[v] then
table.insert(errors, {'formatTest', 'Parameter: "' .. v .. '=" should be "' .. v .. ':"' })
end
end
local ret = specPrinter(args, result)
if #errors > 0 then
ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]'
end
return ret, backward
end
--[[
Generate Wikidata tracking categories.
]]
local function makeWikidataCategories(qid)
local ret
local qid = qid or mw.wikibase.getEntityIdForCurrentPage()
if mw.wikibase and current_page.namespace == 0 then
if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then
local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype
if snaktype == 'value' then
-- coordinates exist both here and on Wikidata, and can be compared.
ret = 'Coordinates on Wikidata'
elseif snaktype == 'somevalue' then
ret = 'Coordinates on Wikidata set to unknown value'
elseif snaktype == 'novalue' then
ret = 'Coordinates on Wikidata set to no value'
end
else
-- We have to either import the coordinates to Wikidata or remove them here.
ret = 'Coordinates not on Wikidata'
end
end
if ret then
return string.format('[[Category:%s]]', ret)
else
return ''
end
end
--[[
Parse coordinates entered as a single string
]]
local function text2coord(text)
if type(text) ~= 'string' then return end
local coords = {}
local numTerms = 0
local parts
local function assign(k, number, start, pos)
if number then
coords[start + pos - 1] = number
if k == 1 then
numTerms = pos
elseif numTerms < pos then -- more terms in long than lat
return false
end
elseif numTerms >= pos then -- more terms in lat than long
return false
end
return true
end
text = mw.ustring.gsub(mw.text.trim(text:uupper()), "[*′″]", {['*'] = '°', ['′'] = "'", ['″'] = '"'})
for _, regex in ipairs({
"^([+%-%d.°'\"NS%s]+),%s*([+%-%d.°'\"EW%s]+)$", --split by commas
"^([+%-%d.°'\"%s]+[NS])%s*([+%-%d.°'\"%s]+[EW])$", --split by N/S
"^([+%-%d.°'%s]+\")%s*([+%-%d.°'%s]+\")$", --split by "
"^([+%-%d.°%s]+')%s*([+%-%d.°%s]+')$", --split by '
"^([+%-%d.%s]+°)%s*([+%-%d.%s]+°)$", --split by °
"^([+%-%d.]+)%s+([+%-%d.]+)$" --split by space
}) do
local lat, long = string.match(text, regex)
if lat and long then
parts = {mw.text.trim(lat), mw.text.trim(long)}
break
end
end
if not parts then return end
local SW = {"S", "W"}
local NE = {"N", "E"}
for k, v in ipairs(parts) do
local number
local start = k + numTerms
-- Find or create N, S, E, and W
local dir = v:match("([NSEW])$")
if dir then
v = v:sub(1,-2)
elseif v:sub(1,1) == '-' then
v = v:sub(2)
dir = SW[k]
else
dir = NE[k]
end
-- attempt to convert text to number
number = tonumber(v)
if number then
-- Single number, assign it to the position "start" in the "coords" array
if not assign(k, number, start, 1) then
return
end
-- attempt to convert dms to decimal
elseif string.match(v, "°") then
for pos, regex in ipairs({
"^%s*([+%-%d.]+)%s*°[^°]*$", --degrees
"^[^°']+°%s*([%d.]+)%s*'[^°']*$", --minutes
"^[^'\"]+'%s*([%d.]+)%s*\"[^'\"]*$" --seconds
}) do
-- Assign component to a position in the "coords" array determined
-- by "start" and "pos", and increment "numTerms" if this is latitude
if not assign(k, tonumber(string.match(v, regex)), start, pos) then
return
end
end
end
if coords[start] == nil then return end
coords[start + numTerms] = dir
end
return coords
end
--[[
link
Simple function to export the coordinates link for other uses.
Usage:
{{#invoke:Coordinates | link }}
]]
function coordinates.link(frame)
return coord_link;
end
--[[
dec2dms
Wrapper to allow templates to call dec2dms directly.
Usage:
{{#invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix |
negative_suffix | precision }}
decimal_coordinate is converted to DMS format. If positive, the positive_suffix
is appended (typical N or E), if negative, the negative suffix is appended. The
specified precision is one of 'D', 'DM', or 'DMS' to specify the level of detail
to use.
]]
coordinates.dec2dms = makeInvokeFunc('_dec2dms')
function coordinates._dec2dms(args)
local coordinate = args[1]
local firstPostfix = args[2] or ''
local secondPostfix = args[3] or ''
local precision = args[4] or ''
return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)
end
--[[
Helper function to determine whether to use D, DM, or DMS
format depending on the precision of the decimal input.
]]
function coordinates.determineMode( value1, value2 )
local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) );
if precision <= 0 then
return 'd'
elseif precision <= 2 then
return 'dm';
else
return 'dms';
end
end
--[[
dms2dec
Wrapper to allow templates to call dms2dec directly.
Usage:
{{#invoke:Coordinates | dms2dec | direction_flag | degrees |
minutes | seconds }}
Converts DMS values specified as degrees, minutes, seconds too decimal format.
direction_flag is one of N, S, E, W, and determines whether the output is
positive (i.e. N and E) or negative (i.e. S and W).
]]
coordinates.dms2dec = makeInvokeFunc('_dms2dec')
function coordinates._dms2dec(args)
local direction = args[1]
local degrees = args[2]
local minutes = args[3]
local seconds = args[4]
return convert_dms2dec(direction, degrees, minutes, seconds)
end
--[[
coord
Main entry point for Lua function to replace {{coord}}
Usage:
{{#invoke:Coordinates | coord }}
{{#invoke:Coordinates | coord | lat | long }}
{{#invoke:Coordinates | coord | lat | lat_flag | long | long_flag }}
...
Refer to {{coord}} documentation page for many additional parameters and
configuration options.
Note: This function provides the visual display elements of {{coord}}. In
order to load coordinates into the database, the {{#coordinates:}} parser
function must also be called, this is done automatically in the Lua
version of {{coord}}.
]]
coordinates.coord = makeInvokeFunc('_coord')
function coordinates._coord(args)
if not tonumber(args[1]) then
local parsed = text2coord(args[1])
if parsed then -- full lat/long entered as a single string
for i = 2, #args do args[#parsed + i - 1] = args[i] end
for i, v in ipairs(parsed) do args[i] = v end
elseif not args[2] then -- look for coordinates from wikidata
args[3] = args[1]; args[1] = nil
local entity = mw.wikibase.getEntityObject(args.qid)
if entity
and entity.claims
and entity.claims.P625
and entity.claims.P625[1].mainsnak.snaktype == 'value'
then
local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision
args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude
args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude
if precision then
precision = -math_mod._round(math.log(precision)/math.log(10),0)
args[1] = math_mod._round(args[1],precision)
args[2] = math_mod._round(args[2],precision)
end
end
end
end
local contents, backward = formatTest(args)
local Notes = args.notes or ''
local Display = args.display and args.display:lower() or 'inline'
-- it and ti are short for inline,title and title,inline
local function isInline(s)
-- Finds whether coordinates are displayed inline.
return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti'
end
local function isInTitle(s)
-- Finds whether coordinates are displayed in the title.
return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'
end
local function coord_wrapper(in_args)
-- Calls the parser function {{#coordinates:}}.
return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or ''
end
local text = ''
if isInline(Display) then
text = text .. '<span class="geo-inline">' .. contents .. Notes .. '</span>'
end
if isInTitle(Display) then
-- Add to output since indicator content is invisible to Lua later on
if not isInline(Display) then
text = text .. '<span class="geo-inline-hidden noexcerpt">' .. contents .. Notes .. '</span>'
end
text = text .. displaytitle(contents .. Notes) .. makeWikidataCategories(args.qid)
end
if not args.nosave then
local page_title, count = mw.title.getCurrentTitle(), 1
if backward then
local tmp = {}
while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end
tmp.count = count; count = 2*(count-1)
while count >= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end
for i, v in ipairs(tmp) do args[i] = v end
else
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end
end
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end
args.notes, args.format, args.display = nil
text = text .. coord_wrapper(args)
end
return text
end
--[[
coord2text
Extracts a single value from a transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
Usage:
{{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}
Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source
]]
function coordinates._coord2text(coord,type)
if coord == '' or type == '' or not type then return nil end
type = mw.text.trim(type)
if type == 'lat' or type == 'long' then
local coordString = mw.ustring.match(coord,'[%.%d]+°[NS] [%.%d]+°[EW]')
if not coordString then
return nil
end
local result = mw.text.split(coordString, ' ')
local negative
if type == 'lat' then
result, negative = result[1], 'S'
else
result, negative = result[2], 'W'
end
if not result then
return nil
end
result = mw.text.split(result, '°')
if not result[1] then
return nil
end
if result[2] == negative then result[1] = '-'..result[1] end
return result[1]
else
return mw.ustring.match(coord, 'params=.-_' .. type .. ':(.-)[ _]')
end
end
function coordinates.coord2text(frame)
return coordinates._coord2text(frame.args[1],frame.args[2]) or ''
end
--[[
coordinsert
Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
Usage:
{{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }}
Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation.
]]
function coordinates.coordinsert(frame)
-- for the 2nd or later integer parameter (the first is the coord template, as above)
for i, v in ipairs(frame.args) do
if i ~= 1 then
-- if we cannot find in the coord_template the i_th coordinsert parameter e.g. region
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then
-- find from the params= up to the first possibly-present underscore
-- and append the i_th coordinsert parameter and a space
-- IDK why we're adding a space but it does seem somewhat convenient
frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ')
end
end
end
if frame.args.name then
-- if we can't find the vcard class
if not mw.ustring.find(frame.args[1], '<span class="vcard">') then
-- take something that looks like a coord template and add the vcard span with class and fn org class
local namestr = frame.args.name
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(<span class="geo%-default">)(<span[^<>]*>[^<>]*</span><span[^<>]*>[^<>]*<span[^<>]*>[^<>]*</span></span>)(</span>)',
'%1<span class="vcard">%2<span style="display:none"> (<span class="fn org">' .. namestr .. '</span>)</span></span>%3'
)
-- then find anything from coordinates parameters to the 'end' and attach the title parameter
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(¶ms=[^&"<>%[%] ]*) ',
'%1&title=' .. mw.uri.encode(namestr) .. ' '
)
end
end
-- replace the existing indicator with a new indicator using the modified content
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(<span class="geo%-inline[^"]*">(.+)</span>)\127[^\127]*UNIQ%-%-indicator%-%x+%-%-?QINU[^\127]*\127',
function (inline, coord) return inline .. displaytitle(coord) end
)
return frame.args[1]
end
return coordinates
mgr040y9bhe26jrkzioi6ulvlqhvehy
74771
74770
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Module:Coordinates]]
74770
Scribunto
text/plain
--[[
This module is intended to replace the functionality of {{Coord}} and related
templates. It provides several methods, including
{{#invoke:Coordinates | coord }} : General function formatting and displaying
coordinate values.
{{#invoke:Coordinates | dec2dms }} : Simple function for converting decimal
degree values to DMS format.
{{#invoke:Coordinates | dms2dec }} : Simple function for converting DMS format
to decimal degree format.
{{#invoke:Coordinates | link }} : Export the link used to reach the tools
]]
require('strict')
local math_mod = require("Module:Math")
local coordinates = {};
local isSandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true);
local current_page = mw.title.getCurrentTitle()
local page_name = mw.uri.encode( current_page.prefixedText, 'WIKI' );
local coord_link = 'https://geohack.toolforge.org/geohack.php?pagename=' .. page_name .. '¶ms='
--[[ Helper function, replacement for {{coord/display/title}} ]]
local function displaytitle(coords)
return mw.getCurrentFrame():extensionTag{
name = 'indicator',
args = { name = 'coordinates' },
content = '<span id="coordinates">[[Geographic coordinate system|Coordinates]]: ' .. coords .. '</span>'
}
end
--[[ Helper function, used in detecting DMS formatting ]]
local function dmsTest(first, second)
if type(first) ~= 'string' or type(second) ~= 'string' then
return nil
end
local s = (first .. second):upper()
return s:find('^[NS][EW]$') or s:find('^[EW][NS]$')
end
--[[ Wrapper function to grab args, see Module:Arguments for this function's documentation. ]]
local function makeInvokeFunc(funcName)
return function (frame)
local args = require('Module:Arguments').getArgs(frame, {
wrappers = 'Template:Coord'
})
return coordinates[funcName](args, frame)
end
end
--[[ Helper function, handle optional args. ]]
local function optionalArg(arg, supplement)
return arg and arg .. supplement or ''
end
--[[
Formats any error messages generated for display
]]
local function errorPrinter(errors)
local result = ""
for i,v in ipairs(errors) do
result = result .. '<strong class="error">Coordinates: ' .. v[2] .. '</strong><br />'
end
return result
end
--[[
Determine the required CSS class to display coordinates
Usually geo-nondefault is hidden by CSS, unless a user has overridden this for himself
default is the mode as specificied by the user when calling the {{coord}} template
mode is the display mode (dec or dms) that we will need to determine the css class for
]]
local function displayDefault(default, mode)
if default == "" then
default = "dec"
end
if default == mode then
return "geo-default"
else
return "geo-nondefault"
end
end
--[[
specPrinter
Output formatter. Takes the structure generated by either parseDec
or parseDMS and formats it for inclusion on Wikipedia.
]]
local function specPrinter(args, coordinateSpec)
local uriComponents = coordinateSpec["param"]
if uriComponents == "" then
-- RETURN error, should never be empty or nil
return "ERROR param was empty"
end
if args["name"] then
uriComponents = uriComponents .. "&title=" .. mw.uri.encode(coordinateSpec["name"])
end
local geodmshtml = '<span class="geo-dms" title="Maps, aerial photos, and other data for this location">'
.. '<span class="latitude">' .. coordinateSpec["dms-lat"] .. '</span> '
.. '<span class="longitude">' ..coordinateSpec["dms-long"] .. '</span>'
.. '</span>'
local lat = tonumber( coordinateSpec["dec-lat"] ) or 0
local geodeclat
if lat < 0 then
-- FIXME this breaks the pre-existing precision
geodeclat = tostring(coordinateSpec["dec-lat"]):sub(2) .. "°S"
else
geodeclat = (coordinateSpec["dec-lat"] or 0) .. "°N"
end
local long = tonumber( coordinateSpec["dec-long"] ) or 0
local geodeclong
if long < 0 then
-- FIXME does not handle unicode minus
geodeclong = tostring(coordinateSpec["dec-long"]):sub(2) .. "°W"
else
geodeclong = (coordinateSpec["dec-long"] or 0) .. "°E"
end
local geodechtml = '<span class="geo-dec" title="Maps, aerial photos, and other data for this location">'
.. geodeclat .. ' '
.. geodeclong
.. '</span>'
local geonumhtml = '<span class="geo">'
.. coordinateSpec["dec-lat"] .. '; '
.. coordinateSpec["dec-long"]
.. '</span>'
local inner = '<span class="' .. displayDefault(coordinateSpec["default"], "dms" ) .. '">' .. geodmshtml .. '</span>'
.. '<span class="geo-multi-punct"> / </span>'
.. '<span class="' .. displayDefault(coordinateSpec["default"], "dec" ) .. '">';
if not args["name"] then
inner = inner .. geodechtml
.. '<span style="display:none"> / ' .. geonumhtml .. '</span></span>'
else
inner = inner .. '<span class="vcard">' .. geodechtml
.. '<span style="display:none"> / ' .. geonumhtml .. '</span>'
.. '<span style="display:none"> (<span class="fn org">'
.. args["name"] .. '</span>)</span></span></span>'
end
local stylesheetLink = 'Module:Coordinates' .. ( isSandbox and '/sandbox' or '' ) .. '/styles.css'
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = stylesheetLink }
} .. '<span class="plainlinks nourlexpansion">[' .. coord_link .. uriComponents ..
' ' .. inner .. ']</span>' .. '[[Category:Pages using gadget WikiMiniAtlas]]'
end
--[[ Helper function, convert decimal to degrees ]]
local function convert_dec2dms_d(coordinate)
local d = math_mod._round( coordinate, 0 ) .. "°"
return d .. ""
end
--[[ Helper function, convert decimal to degrees and minutes ]]
local function convert_dec2dms_dm(coordinate)
coordinate = math_mod._round( coordinate * 60, 0 );
local m = coordinate % 60;
coordinate = math.floor( (coordinate - m) / 60 );
local d = coordinate % 360 .."°"
return d .. string.format( "%02d′", m )
end
--[[ Helper function, convert decimal to degrees, minutes, and seconds ]]
local function convert_dec2dms_dms(coordinate)
coordinate = math_mod._round( coordinate * 60 * 60, 0 );
local s = coordinate % 60
coordinate = math.floor( (coordinate - s) / 60 );
local m = coordinate % 60
coordinate = math.floor( (coordinate - m) / 60 );
local d = coordinate % 360 .."°"
return d .. string.format( "%02d′", m ) .. string.format( "%02d″", s )
end
--[[
Helper function, convert decimal latitude or longitude to
degrees, minutes, and seconds format based on the specified precision.
]]
local function convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)
local coord = tonumber(coordinate)
local postfix
if coord >= 0 then
postfix = firstPostfix
else
postfix = secondPostfix
end
precision = precision:lower();
if precision == "dms" then
return convert_dec2dms_dms( math.abs( coord ) ) .. postfix;
elseif precision == "dm" then
return convert_dec2dms_dm( math.abs( coord ) ) .. postfix;
elseif precision == "d" then
return convert_dec2dms_d( math.abs( coord ) ) .. postfix;
end
end
--[[
Convert DMS format into a N or E decimal coordinate
]]
local function convert_dms2dec(direction, degrees_str, minutes_str, seconds_str)
local degrees = tonumber(degrees_str)
local minutes = tonumber(minutes_str) or 0
local seconds = tonumber(seconds_str) or 0
local factor = 1
if direction == "S" or direction == "W" then
factor = -1
end
local precision = 0
if seconds_str then
precision = 5 + math.max( math_mod._precision(seconds_str), 0 );
elseif minutes_str and minutes_str ~= '' then
precision = 3 + math.max( math_mod._precision(minutes_str), 0 );
else
precision = math.max( math_mod._precision(degrees_str), 0 );
end
local decimal = factor * (degrees+(minutes+seconds/60)/60)
return string.format( "%." .. precision .. "f", decimal ) -- not tonumber since this whole thing is string based.
end
--[[
Checks input values to for out of range errors.
]]
local function validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, source, strong )
local errors = {};
lat_d = tonumber( lat_d ) or 0;
lat_m = tonumber( lat_m ) or 0;
lat_s = tonumber( lat_s ) or 0;
long_d = tonumber( long_d ) or 0;
long_m = tonumber( long_m ) or 0;
long_s = tonumber( long_s ) or 0;
if strong then
if lat_d < 0 then
table.insert(errors, {source, "latitude degrees < 0 with hemisphere flag"})
end
if long_d < 0 then
table.insert(errors, {source, "longitude degrees < 0 with hemisphere flag"})
end
--[[
#coordinates is inconsistent about whether this is an error. If globe: is
specified, it won't error on this condition, but otherwise it will.
For not simply disable this check.
if long_d > 180 then
table.insert(errors, {source, "longitude degrees > 180 with hemisphere flag"})
end
]]
end
if lat_d > 90 then
table.insert(errors, {source, "latitude degrees > 90"})
end
if lat_d < -90 then
table.insert(errors, {source, "latitude degrees < -90"})
end
if lat_m >= 60 then
table.insert(errors, {source, "latitude minutes >= 60"})
end
if lat_m < 0 then
table.insert(errors, {source, "latitude minutes < 0"})
end
if lat_s >= 60 then
table.insert(errors, {source, "latitude seconds >= 60"})
end
if lat_s < 0 then
table.insert(errors, {source, "latitude seconds < 0"})
end
if long_d >= 360 then
table.insert(errors, {source, "longitude degrees >= 360"})
end
if long_d <= -360 then
table.insert(errors, {source, "longitude degrees <= -360"})
end
if long_m >= 60 then
table.insert(errors, {source, "longitude minutes >= 60"})
end
if long_m < 0 then
table.insert(errors, {source, "longitude minutes < 0"})
end
if long_s >= 60 then
table.insert(errors, {source, "longitude seconds >= 60"})
end
if long_s < 0 then
table.insert(errors, {source, "longitude seconds < 0"})
end
return errors;
end
--[[
parseDec
Transforms decimal format latitude and longitude into the
structure to be used in displaying coordinates
]]
local function parseDec( lat, long, format )
local coordinateSpec = {}
local errors = {}
if not long then
return nil, {{"parseDec", "Missing longitude"}}
elseif not tonumber(long) then
return nil, {{"parseDec", "Longitude could not be parsed as a number: " .. long}}
end
errors = validate( lat, nil, nil, long, nil, nil, 'parseDec', false );
coordinateSpec["dec-lat"] = lat;
coordinateSpec["dec-long"] = long;
local mode = coordinates.determineMode( lat, long );
coordinateSpec["dms-lat"] = convert_dec2dms( lat, "N", "S", mode) -- {{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
coordinateSpec["dms-long"] = convert_dec2dms( long, "E", "W", mode) -- {{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
if format then
coordinateSpec.default = format
else
coordinateSpec.default = "dec"
end
return coordinateSpec, errors
end
--[[
parseDMS
Transforms degrees, minutes, seconds format latitude and longitude
into the a structure to be used in displaying coordinates
]]
local function parseDMS( lat_d, lat_m, lat_s, lat_f, long_d, long_m, long_s, long_f, format )
local coordinateSpec, errors, backward = {}, {}
lat_f = lat_f:upper();
long_f = long_f:upper();
-- Check if specified backward
if lat_f == 'E' or lat_f == 'W' then
lat_d, long_d, lat_m, long_m, lat_s, long_s, lat_f, long_f, backward = long_d, lat_d, long_m, lat_m, long_s, lat_s, long_f, lat_f, true;
end
errors = validate( lat_d, lat_m, lat_s, long_d, long_m, long_s, 'parseDMS', true );
if not long_d then
return nil, {{"parseDMS", "Missing longitude" }}
elseif not tonumber(long_d) then
return nil, {{"parseDMS", "Longitude could not be parsed as a number:" .. long_d }}
end
if not lat_m and not lat_s and not long_m and not long_s and #errors == 0 then
if math_mod._precision( lat_d ) > 0 or math_mod._precision( long_d ) > 0 then
if lat_f:upper() == 'S' then
lat_d = '-' .. lat_d;
end
if long_f:upper() == 'W' then
long_d = '-' .. long_d;
end
return parseDec( lat_d, long_d, format );
end
end
coordinateSpec["dms-lat"] = lat_d.."°"..optionalArg(lat_m,"′") .. optionalArg(lat_s,"″") .. lat_f
coordinateSpec["dms-long"] = long_d.."°"..optionalArg(long_m,"′") .. optionalArg(long_s,"″") .. long_f
coordinateSpec["dec-lat"] = convert_dms2dec(lat_f, lat_d, lat_m, lat_s) -- {{coord/dms2dec|{{{4}}}|{{{1}}}|0{{{2}}}|0{{{3}}}}}
coordinateSpec["dec-long"] = convert_dms2dec(long_f, long_d, long_m, long_s) -- {{coord/dms2dec|{{{8}}}|{{{5}}}|0{{{6}}}|0{{{7}}}}}
if format then
coordinateSpec.default = format
else
coordinateSpec.default = "dms"
end
return coordinateSpec, errors, backward
end
--[[
Check the input arguments for coord to determine the kind of data being provided
and then make the necessary processing.
]]
local function formatTest(args)
local result, errors
local backward, primary = false, false
local function getParam(args, lim)
local ret = {}
for i = 1, lim do
ret[i] = args[i] or ''
end
return table.concat(ret, '_')
end
if not args[1] then
-- no lat logic
return errorPrinter( {{"formatTest", "Missing latitude"}} )
elseif not tonumber(args[1]) then
-- bad lat logic
return errorPrinter( {{"formatTest", "Unable to parse latitude as a number:" .. args[1]}} )
elseif not args[4] and not args[5] and not args[6] then
-- dec logic
result, errors = parseDec(args[1], args[2], args.format)
if not result then
return errorPrinter(errors);
end
-- formatting for geohack: geohack expects D_N_D_E notation or D;D notation
-- wikiminiatlas doesn't support D;D notation
-- #coordinates parserfunction doesn't support negative decimals with NSWE
result.param = table.concat({
math.abs(tonumber(args[1])),
((tonumber(args[1]) or 0) < 0) and 'S' or 'N',
math.abs(tonumber(args[2])),
((tonumber(args[2]) or 0) < 0) and 'W' or 'E',
args[3] or ''}, '_')
elseif dmsTest(args[4], args[8]) then
-- dms logic
result, errors, backward = parseDMS(args[1], args[2], args[3], args[4],
args[5], args[6], args[7], args[8], args.format)
if args[10] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 9)
elseif dmsTest(args[3], args[6]) then
-- dm logic
result, errors, backward = parseDMS(args[1], args[2], nil, args[3],
args[4], args[5], nil, args[6], args['format'])
if args[8] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 7)
elseif dmsTest(args[2], args[4]) then
-- d logic
result, errors, backward = parseDMS(args[1], nil, nil, args[2],
args[3], nil, nil, args[4], args.format)
if args[6] then
table.insert(errors, {'formatTest', 'Extra unexpected parameters'})
end
if not result then
return errorPrinter(errors)
end
result.param = getParam(args, 5)
else
-- Error
return errorPrinter({{"formatTest", "Unknown argument format"}}) .. '[[Category:Pages with malformed coordinate tags]]'
end
result.name = args.name
local extra_param = {'dim', 'globe', 'scale', 'region', 'source', 'type'}
for _, v in ipairs(extra_param) do
if args[v] then
table.insert(errors, {'formatTest', 'Parameter: "' .. v .. '=" should be "' .. v .. ':"' })
end
end
local ret = specPrinter(args, result)
if #errors > 0 then
ret = ret .. ' ' .. errorPrinter(errors) .. '[[Category:Pages with malformed coordinate tags]]'
end
return ret, backward
end
--[[
Generate Wikidata tracking categories.
]]
local function makeWikidataCategories(qid)
local ret
local qid = qid or mw.wikibase.getEntityIdForCurrentPage()
if mw.wikibase and current_page.namespace == 0 then
if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then
local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype
if snaktype == 'value' then
-- coordinates exist both here and on Wikidata, and can be compared.
ret = 'Coordinates on Wikidata'
elseif snaktype == 'somevalue' then
ret = 'Coordinates on Wikidata set to unknown value'
elseif snaktype == 'novalue' then
ret = 'Coordinates on Wikidata set to no value'
end
else
-- We have to either import the coordinates to Wikidata or remove them here.
ret = 'Coordinates not on Wikidata'
end
end
if ret then
return string.format('[[Category:%s]]', ret)
else
return ''
end
end
--[[
Parse coordinates entered as a single string
]]
local function text2coord(text)
if type(text) ~= 'string' then return end
local coords = {}
local numTerms = 0
local parts
local function assign(k, number, start, pos)
if number then
coords[start + pos - 1] = number
if k == 1 then
numTerms = pos
elseif numTerms < pos then -- more terms in long than lat
return false
end
elseif numTerms >= pos then -- more terms in lat than long
return false
end
return true
end
text = mw.ustring.gsub(mw.text.trim(text:uupper()), "[*′″]", {['*'] = '°', ['′'] = "'", ['″'] = '"'})
for _, regex in ipairs({
"^([+%-%d.°'\"NS%s]+),%s*([+%-%d.°'\"EW%s]+)$", --split by commas
"^([+%-%d.°'\"%s]+[NS])%s*([+%-%d.°'\"%s]+[EW])$", --split by N/S
"^([+%-%d.°'%s]+\")%s*([+%-%d.°'%s]+\")$", --split by "
"^([+%-%d.°%s]+')%s*([+%-%d.°%s]+')$", --split by '
"^([+%-%d.%s]+°)%s*([+%-%d.%s]+°)$", --split by °
"^([+%-%d.]+)%s+([+%-%d.]+)$" --split by space
}) do
local lat, long = string.match(text, regex)
if lat and long then
parts = {mw.text.trim(lat), mw.text.trim(long)}
break
end
end
if not parts then return end
local SW = {"S", "W"}
local NE = {"N", "E"}
for k, v in ipairs(parts) do
local number
local start = k + numTerms
-- Find or create N, S, E, and W
local dir = v:match("([NSEW])$")
if dir then
v = v:sub(1,-2)
elseif v:sub(1,1) == '-' then
v = v:sub(2)
dir = SW[k]
else
dir = NE[k]
end
-- attempt to convert text to number
number = tonumber(v)
if number then
-- Single number, assign it to the position "start" in the "coords" array
if not assign(k, number, start, 1) then
return
end
-- attempt to convert dms to decimal
elseif string.match(v, "°") then
for pos, regex in ipairs({
"^%s*([+%-%d.]+)%s*°[^°]*$", --degrees
"^[^°']+°%s*([%d.]+)%s*'[^°']*$", --minutes
"^[^'\"]+'%s*([%d.]+)%s*\"[^'\"]*$" --seconds
}) do
-- Assign component to a position in the "coords" array determined
-- by "start" and "pos", and increment "numTerms" if this is latitude
if not assign(k, tonumber(string.match(v, regex)), start, pos) then
return
end
end
end
if coords[start] == nil then return end
coords[start + numTerms] = dir
end
return coords
end
--[[
link
Simple function to export the coordinates link for other uses.
Usage:
{{#invoke:Coordinates | link }}
]]
function coordinates.link(frame)
return coord_link;
end
--[[
dec2dms
Wrapper to allow templates to call dec2dms directly.
Usage:
{{#invoke:Coordinates | dec2dms | decimal_coordinate | positive_suffix |
negative_suffix | precision }}
decimal_coordinate is converted to DMS format. If positive, the positive_suffix
is appended (typical N or E), if negative, the negative suffix is appended. The
specified precision is one of 'D', 'DM', or 'DMS' to specify the level of detail
to use.
]]
coordinates.dec2dms = makeInvokeFunc('_dec2dms')
function coordinates._dec2dms(args)
local coordinate = args[1]
local firstPostfix = args[2] or ''
local secondPostfix = args[3] or ''
local precision = args[4] or ''
return convert_dec2dms(coordinate, firstPostfix, secondPostfix, precision)
end
--[[
Helper function to determine whether to use D, DM, or DMS
format depending on the precision of the decimal input.
]]
function coordinates.determineMode( value1, value2 )
local precision = math.max( math_mod._precision( value1 ), math_mod._precision( value2 ) );
if precision <= 0 then
return 'd'
elseif precision <= 2 then
return 'dm';
else
return 'dms';
end
end
--[[
dms2dec
Wrapper to allow templates to call dms2dec directly.
Usage:
{{#invoke:Coordinates | dms2dec | direction_flag | degrees |
minutes | seconds }}
Converts DMS values specified as degrees, minutes, seconds too decimal format.
direction_flag is one of N, S, E, W, and determines whether the output is
positive (i.e. N and E) or negative (i.e. S and W).
]]
coordinates.dms2dec = makeInvokeFunc('_dms2dec')
function coordinates._dms2dec(args)
local direction = args[1]
local degrees = args[2]
local minutes = args[3]
local seconds = args[4]
return convert_dms2dec(direction, degrees, minutes, seconds)
end
--[[
coord
Main entry point for Lua function to replace {{coord}}
Usage:
{{#invoke:Coordinates | coord }}
{{#invoke:Coordinates | coord | lat | long }}
{{#invoke:Coordinates | coord | lat | lat_flag | long | long_flag }}
...
Refer to {{coord}} documentation page for many additional parameters and
configuration options.
Note: This function provides the visual display elements of {{coord}}. In
order to load coordinates into the database, the {{#coordinates:}} parser
function must also be called, this is done automatically in the Lua
version of {{coord}}.
]]
coordinates.coord = makeInvokeFunc('_coord')
function coordinates._coord(args)
if not tonumber(args[1]) then
local parsed = text2coord(args[1])
if parsed then -- full lat/long entered as a single string
for i = 2, #args do args[#parsed + i - 1] = args[i] end
for i, v in ipairs(parsed) do args[i] = v end
elseif not args[2] then -- look for coordinates from wikidata
args[3] = args[1]; args[1] = nil
local entity = mw.wikibase.getEntityObject(args.qid)
if entity
and entity.claims
and entity.claims.P625
and entity.claims.P625[1].mainsnak.snaktype == 'value'
then
local precision = entity.claims.P625[1].mainsnak.datavalue.value.precision
args[1] = entity.claims.P625[1].mainsnak.datavalue.value.latitude
args[2] = entity.claims.P625[1].mainsnak.datavalue.value.longitude
if precision then
precision = -math_mod._round(math.log(precision)/math.log(10),0)
args[1] = math_mod._round(args[1],precision)
args[2] = math_mod._round(args[2],precision)
end
end
end
end
local contents, backward = formatTest(args)
local Notes = args.notes or ''
local Display = args.display and args.display:lower() or 'inline'
-- it and ti are short for inline,title and title,inline
local function isInline(s)
-- Finds whether coordinates are displayed inline.
return s:find('inline') ~= nil or s == 'i' or s == 'it' or s == 'ti'
end
local function isInTitle(s)
-- Finds whether coordinates are displayed in the title.
return s:find('title') ~= nil or s == 't' or s == 'it' or s == 'ti'
end
local function coord_wrapper(in_args)
-- Calls the parser function {{#coordinates:}}.
return mw.getCurrentFrame():callParserFunction('#coordinates', in_args) or ''
end
local text = ''
if isInline(Display) then
text = text .. '<span class="geo-inline">' .. contents .. Notes .. '</span>'
end
if isInTitle(Display) then
-- Add to output since indicator content is invisible to Lua later on
if not isInline(Display) then
text = text .. '<span class="geo-inline-hidden noexcerpt">' .. contents .. Notes .. '</span>'
end
text = text .. displaytitle(contents .. Notes) .. makeWikidataCategories(args.qid)
end
if not args.nosave then
local page_title, count = mw.title.getCurrentTitle(), 1
if backward then
local tmp = {}
while not string.find((args[count-1] or ''), '[EW]') do tmp[count] = (args[count] or ''); count = count+1 end
tmp.count = count; count = 2*(count-1)
while count >= tmp.count do table.insert(tmp, 1, (args[count] or '')); count = count-1 end
for i, v in ipairs(tmp) do args[i] = v end
else
while count <= 9 do args[count] = (args[count] or ''); count = count+1 end
end
if isInTitle(Display) and not page_title.isTalkPage and page_title.subpageText ~= 'doc' and page_title.subpageText ~= 'testcases' then args[10] = 'primary' end
args.notes, args.format, args.display = nil
text = text .. coord_wrapper(args)
end
return text
end
--[[
coord2text
Extracts a single value from a transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
Usage:
{{#invoke:Coordinates | coord2text | {{Coord}} | parameter }}
Valid values for the second parameter are: lat (signed integer), long (signed integer), type, scale, dim, region, globe, source
]]
function coordinates._coord2text(coord,type)
if coord == '' or type == '' or not type then return nil end
type = mw.text.trim(type)
if type == 'lat' or type == 'long' then
local coordString = mw.ustring.match(coord,'[%.%d]+°[NS] [%.%d]+°[EW]')
if not coordString then
return nil
end
local result = mw.text.split(coordString, ' ')
local negative
if type == 'lat' then
result, negative = result[1], 'S'
else
result, negative = result[2], 'W'
end
if not result then
return nil
end
result = mw.text.split(result, '°')
if not result[1] then
return nil
end
if result[2] == negative then result[1] = '-'..result[1] end
return result[1]
else
return mw.ustring.match(coord, 'params=.-_' .. type .. ':(.-)[ _]')
end
end
function coordinates.coord2text(frame)
return coordinates._coord2text(frame.args[1],frame.args[2]) or ''
end
--[[
coordinsert
Injects some text into the Geohack link of a transclusion of {{Coord}} (if that text isn't already in the transclusion). Outputs the modified transclusion of {{Coord}}.
IF THE GEOHACK LINK SYNTAX CHANGES THIS FUNCTION MUST BE MODIFIED.
Usage:
{{#invoke:Coordinates | coordinsert | {{Coord}} | parameter:value | parameter:value | … }}
Do not make Geohack unhappy by inserting something which isn't mentioned in the {{Coord}} documentation.
]]
function coordinates.coordinsert(frame)
-- for the 2nd or later integer parameter (the first is the coord template, as above)
for i, v in ipairs(frame.args) do
if i ~= 1 then
-- if we cannot find in the coord_template the i_th coordinsert parameter e.g. region
if not mw.ustring.find(frame.args[1], (mw.ustring.match(frame.args[i], '^(.-:)') or '')) then
-- find from the params= up to the first possibly-present underscore
-- and append the i_th coordinsert parameter and a space
-- IDK why we're adding a space but it does seem somewhat convenient
frame.args[1] = mw.ustring.gsub(frame.args[1], '(params=.-)_? ', '%1_'..frame.args[i]..' ')
end
end
end
if frame.args.name then
-- if we can't find the vcard class
if not mw.ustring.find(frame.args[1], '<span class="vcard">') then
-- take something that looks like a coord template and add the vcard span with class and fn org class
local namestr = frame.args.name
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(<span class="geo%-default">)(<span[^<>]*>[^<>]*</span><span[^<>]*>[^<>]*<span[^<>]*>[^<>]*</span></span>)(</span>)',
'%1<span class="vcard">%2<span style="display:none"> (<span class="fn org">' .. namestr .. '</span>)</span></span>%3'
)
-- then find anything from coordinates parameters to the 'end' and attach the title parameter
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(¶ms=[^&"<>%[%] ]*) ',
'%1&title=' .. mw.uri.encode(namestr) .. ' '
)
end
end
-- replace the existing indicator with a new indicator using the modified content
frame.args[1] = mw.ustring.gsub(
frame.args[1],
'(<span class="geo%-inline[^"]*">(.+)</span>)\127[^\127]*UNIQ%-%-indicator%-%x+%-%-?QINU[^\127]*\127',
function (inline, coord) return inline .. displaytitle(coord) end
)
return frame.args[1]
end
return coordinates
mgr040y9bhe26jrkzioi6ulvlqhvehy
Módulo:Navbox/styles.css
828
7264
74882
71482
2026-07-15T16:49:33Z
en>Izno
0
Undid revision [[Special:Diff/1364216074|1364216074]] by [[Special:Contributions/Hike395|Hike395]] ([[User talk:Hike395|talk]]) please fix those in those places. Navbox is much more widely used.
71481
sanitized-css
text/css
/* {{pp|small=y}} */
.navbox {
box-sizing: border-box;
border: 1px solid #a2a9b1;
width: 100%;
clear: both;
font-size: 88%;
text-align: center;
padding: 1px;
margin: 1em auto 0; /* Prevent preceding content from clinging to navboxes */
}
.navbox .navbox {
margin-top: 0; /* No top margin for nested navboxes */
}
.navbox + .navbox-styles + .navbox,
/* category positions are wrapped in an "empty" span in Parsoid [[phab:T378906]] */
.navbox + span.mw-empty-elt + .navbox-styles + .navbox {
margin-top: -1px; /* Single pixel border between adjacent navboxes */
}
.navbox-inner,
.navbox-subgroup {
width: 100%;
}
.navbox-group,
.navbox-title,
.navbox-abovebelow {
padding: 0.25em 1em;
line-height: 1.5em;
text-align: center;
}
.navbox-group {
white-space: nowrap;
/* @noflip */
text-align: right;
}
.navbox,
.navbox-subgroup {
background-color: #fdfdfd;
color:inherit;
}
.navbox-list {
line-height: 1.5em;
border-color: #fdfdfd; /* Must match background color */
}
.navbox-list-with-group {
text-align: left;
border-left-width: 2px;
border-left-style: solid;
}
/* cell spacing for navbox cells */
/* Borders above 2nd, 3rd, etc. rows */
/* TODO: figure out how to replace tr as structure;
* with div structure it should be just a matter of first-child */
tr + tr > .navbox-abovebelow,
tr + tr > .navbox-group,
tr + tr > .navbox-image,
tr + tr > .navbox-list {
border-top: 2px solid #fdfdfd; /* Must match background color */
}
.navbox-title {
background-color: #ccf; /* Level 1 color */
color:inherit;
}
.navbox-abovebelow,
.navbox-group,
.navbox-subgroup .navbox-title {
background-color: #ddf; /* Level 2 color */
color:inherit;
}
.navbox-subgroup .navbox-group,
.navbox-subgroup .navbox-abovebelow {
background-color: #e6e6ff; /* Level 3 color */
color:inherit;
}
.navbox-even {
background-color: #f7f7f7;
color:inherit;
}
.navbox-odd {
background-color: transparent;
color:inherit;
}
/* TODO: figure out how to remove reliance on td as structure */
.navbox .hlist td dl,
.navbox .hlist td ol,
.navbox .hlist td ul,
.navbox td.hlist dl,
.navbox td.hlist ol,
.navbox td.hlist ul {
padding: 0.125em 0;
}
.navbox .navbar {
display: block;
font-size: 100%;
}
.navbox-title .navbar {
/* @noflip */
float: left;
/* @noflip */
text-align: left;
/* @noflip */
margin-right: 0.5em;
}
/** T367463 */
body.skin--responsive .navbox-image img {
max-width: none !important;
}
@media print {
body.ns-0 .navbox {
display: none !important;
}
}
ku94g873nj9xaasowc6yies69ls74c5
74883
74882
2026-08-24T00:42:42Z
Robertsky
10424
1 versaun husi [[:en:Module:Navbox/styles.css]]
71481
sanitized-css
text/css
/* {{pp|small=y}} */
.navbox {
box-sizing: border-box;
border: 1px solid #a2a9b1;
width: 100%;
clear: both;
font-size: 88%;
text-align: center;
padding: 1px;
margin: 1em auto 0; /* Prevent preceding content from clinging to navboxes */
}
.navbox .navbox {
margin-top: 0; /* No top margin for nested navboxes */
}
.navbox + .navbox-styles + .navbox,
/* category positions are wrapped in an "empty" span in Parsoid [[phab:T378906]] */
.navbox + span.mw-empty-elt + .navbox-styles + .navbox {
margin-top: -1px; /* Single pixel border between adjacent navboxes */
}
.navbox-inner,
.navbox-subgroup {
width: 100%;
}
.navbox-group,
.navbox-title,
.navbox-abovebelow {
padding: 0.25em 1em;
line-height: 1.5em;
text-align: center;
}
.navbox-group {
white-space: nowrap;
/* @noflip */
text-align: right;
}
.navbox,
.navbox-subgroup {
background-color: #fdfdfd;
color:inherit;
}
.navbox-list {
line-height: 1.5em;
border-color: #fdfdfd; /* Must match background color */
}
.navbox-list-with-group {
text-align: left;
border-left-width: 2px;
border-left-style: solid;
}
/* cell spacing for navbox cells */
/* Borders above 2nd, 3rd, etc. rows */
/* TODO: figure out how to replace tr as structure;
* with div structure it should be just a matter of first-child */
tr + tr > .navbox-abovebelow,
tr + tr > .navbox-group,
tr + tr > .navbox-image,
tr + tr > .navbox-list {
border-top: 2px solid #fdfdfd; /* Must match background color */
}
.navbox-title {
background-color: #ccf; /* Level 1 color */
color:inherit;
}
.navbox-abovebelow,
.navbox-group,
.navbox-subgroup .navbox-title {
background-color: #ddf; /* Level 2 color */
color:inherit;
}
.navbox-subgroup .navbox-group,
.navbox-subgroup .navbox-abovebelow {
background-color: #e6e6ff; /* Level 3 color */
color:inherit;
}
.navbox-even {
background-color: #f7f7f7;
color:inherit;
}
.navbox-odd {
background-color: transparent;
color:inherit;
}
/* TODO: figure out how to remove reliance on td as structure */
.navbox .hlist td dl,
.navbox .hlist td ol,
.navbox .hlist td ul,
.navbox td.hlist dl,
.navbox td.hlist ol,
.navbox td.hlist ul {
padding: 0.125em 0;
}
.navbox .navbar {
display: block;
font-size: 100%;
}
.navbox-title .navbar {
/* @noflip */
float: left;
/* @noflip */
text-align: left;
/* @noflip */
margin-right: 0.5em;
}
/** T367463 */
body.skin--responsive .navbox-image img {
max-width: none !important;
}
@media print {
body.ns-0 .navbox {
display: none !important;
}
}
ku94g873nj9xaasowc6yies69ls74c5
Template:Parameter
10
7275
74796
71403
2026-07-20T21:37:44Z
en>MSGJ
0
changes to support merging of [[Template:Parameter2]]
74796
wikitext
text/x-wiki
{{safesubst:<noinclude />#if:{{{plain|}}}{{{mxt|}}}{{{green|}}}{{{!mxt|}}}{{{red|}}}{{{color|}}}
| <code class="tpl-para" style="word-break:break-word;{{safesubst:<noinclude />#if:{{{plain|}}}
| border: none; background-color: inherit;
}} {{safesubst:<noinclude />#if:{{{color|}}}
| color: {{{color}}};
| {{safesubst:<noinclude />#if:{{{mxt|}}}{{{green|}}}
| color: #006400;
| {{safesubst:<noinclude />#if:{{{!mxt|}}}{{{red|}}}
| color: #8B0000;
| color: inherit;
}}
}}
}} {{safesubst:<noinclude />#if:{{{style|}}}|{{{style}}}}}">|{{safesubst:<noinclude />#if:{{{1|}}}
| {{{1}}}=
}}{{{2|}}}</code>
| <syntaxhighlight lang="wikitext" inline style="display: none;" /><!-- required to fetch syntaxhighlight's css --><code class="mw-highlight"><span class="p">|</span>{{safesubst:<noinclude />#if:{{{1|}}}
| <span class="nl">{{{1}}}</span><span class="o">=</span>
}}{{{2|}}}</code>
}}<noinclude>
{{Documentation}}
<!-- Categories go near the bottom of the /doc subpage – interwikis go to Wikidata, thank you! -->
</noinclude>
n9iqo9v0cpnffgle7c8palq6k3n5yle
74797
74796
2026-08-24T00:15:11Z
Robertsky
10424
1 versaun husi [[:en:Template:Parameter]]
74796
wikitext
text/x-wiki
{{safesubst:<noinclude />#if:{{{plain|}}}{{{mxt|}}}{{{green|}}}{{{!mxt|}}}{{{red|}}}{{{color|}}}
| <code class="tpl-para" style="word-break:break-word;{{safesubst:<noinclude />#if:{{{plain|}}}
| border: none; background-color: inherit;
}} {{safesubst:<noinclude />#if:{{{color|}}}
| color: {{{color}}};
| {{safesubst:<noinclude />#if:{{{mxt|}}}{{{green|}}}
| color: #006400;
| {{safesubst:<noinclude />#if:{{{!mxt|}}}{{{red|}}}
| color: #8B0000;
| color: inherit;
}}
}}
}} {{safesubst:<noinclude />#if:{{{style|}}}|{{{style}}}}}">|{{safesubst:<noinclude />#if:{{{1|}}}
| {{{1}}}=
}}{{{2|}}}</code>
| <syntaxhighlight lang="wikitext" inline style="display: none;" /><!-- required to fetch syntaxhighlight's css --><code class="mw-highlight"><span class="p">|</span>{{safesubst:<noinclude />#if:{{{1|}}}
| <span class="nl">{{{1}}}</span><span class="o">=</span>
}}{{{2|}}}</code>
}}<noinclude>
{{Documentation}}
<!-- Categories go near the bottom of the /doc subpage – interwikis go to Wikidata, thank you! -->
</noinclude>
n9iqo9v0cpnffgle7c8palq6k3n5yle
Módulo:Citation/CS1
828
7491
74986
71638
2026-08-08T13:56:56Z
en>Trappist the monk
0
synch from sandbox;
74986
Scribunto
text/plain
require ('strict');
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
each of these counts against the Lua upvalue limit
]]
local validation; -- functions in Module:Citation/CS1/Date_validation
local utilities; -- functions in Module:Citation/CS1/Utilities
local z = {}; -- table of tables in Module:Citation/CS1/Utilities
local identifiers; -- functions and tables in Module:Citation/CS1/Identifiers
local metadata; -- functions in Module:Citation/CS1/COinS
local cfg = {}; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
local whitelist = {}; -- table of tables listing valid template parameter names; defined in Module:Citation/CS1/Whitelist
--[[------------------< P A G E S C O P E V A R I A B L E S >---------------
declare variables here that have page-wide scope that are not brought in from
other modules; that are created here and used here
]]
local added_deprecated_cat; -- boolean flag so that the category is added only once
local added_vanc_errs; -- boolean flag so we only emit one Vancouver error / category
local added_generic_name_errs; -- boolean flag so we only emit one generic name error / category and stop testing names once an error is encountered
local added_numeric_name_errs; -- boolean flag so we only emit one numeric name error / category and stop testing names once an error is encountered
local added_numeric_name_maint; -- boolean flag so we only emit one numeric name maint category and stop testing names once a category has been emitted
local is_preview_mode; -- true when article is in preview mode; false when using 'Preview page with this template' (previewing the module)
local is_sandbox; -- true when using sandbox modules to render citation
local url_was_archive_today; -- boolean flag set to true when has_archive_today_url() has unset |url= because it held a deprecated archive.today url
--[[--------------------------< F I R S T _ S E T >------------------------------------------------------------
Locates and returns the first set value in a table of values where the order established in the table,
left-to-right (or top-to-bottom), is the order in which the values are evaluated. Returns nil if none are set.
This version replaces the original 'for _, val in pairs do' and a similar version that used ipairs. With the pairs
version the order of evaluation could not be guaranteed. With the ipairs version, a nil value would terminate
the for-loop before it reached the actual end of the list.
]]
local function first_set (list, count)
local i = 1;
while i <= count do -- loop through all items in list
if utilities.is_set( list[i] ) then
return list[i]; -- return the first set list member
end
i = i + 1; -- point to next
end
end
--[[--------------------------< A D D _ V A N C _ E R R O R >----------------------------------------------------
Adds a single Vancouver system error message to the template's output regardless of how many error actually exist.
To prevent duplication, added_vanc_errs is nil until an error message is emitted.
added_vanc_errs is a Boolean declared in page scope variables above
]]
local function add_vanc_error (source, position)
if added_vanc_errs then return end
added_vanc_errs = true; -- note that we've added this category
utilities.set_message ('err_vancouver', {source, position});
end
--[[--------------------------< I S _ S C H E M E >------------------------------------------------------------
does this thing that purports to be a URI scheme seem to be a valid scheme? The scheme is checked to see if it
is in agreement with http://tools.ietf.org/html/std66#section-3.1 which says:
Scheme names consist of a sequence of characters beginning with a
letter and followed by any combination of letters, digits, plus
("+"), period ("."), or hyphen ("-").
returns true if it does, else false
]]
local function is_scheme (scheme)
return scheme and scheme:match ('^%a[%a%d%+%.%-]*:'); -- true if scheme is set and matches the pattern
end
--[=[-------------------------< I S _ D O M A I N _ N A M E >--------------------------------------------------
Does this thing that purports to be a domain name seem to be a valid domain name?
Syntax defined here: http://tools.ietf.org/html/rfc1034#section-3.5
BNF defined here: https://tools.ietf.org/html/rfc4234
Single character names are generally reserved; see https://tools.ietf.org/html/draft-ietf-dnsind-iana-dns-01#page-15;
see also [[Single-letter second-level domain]]
list of TLDs: https://www.iana.org/domains/root/db
RFC 952 (modified by RFC 1123) requires the first and last character of a hostname to be a letter or a digit
(see http://tools.ietf.org/html/rfc952 §GRAMMATICAL HOST TABLE SPECIFICATION §§B. Lexical grammar <name>; see
http://tools.ietf.org/html/rfc1123#section-2). Between the first and last characters the name may use letters,
digits, and the hyphen.
Also allowed are IPv4 addresses. IPv6 not supported
domain is expected to be stripped of any path so that the last character in the last character of the TLD. tld
is two or more alpha characters. Any preceding '//' (from splitting a URL with a scheme) will be stripped
here. Perhaps not necessary but retained in case it is necessary for IPv4 dot decimal.
There are several tests:
the first character of the whole domain name including subdomains must be a letter or a digit
internationalized domain name (ASCII characters with .xn-- ASCII Compatible Encoding (ACE) prefix xn-- in the TLD) see https://tools.ietf.org/html/rfc3490
single-letter/digit second-level domains in the .org, .cash, and .today TLDs
q, x, and z SL domains in the .com TLD
i and q SL domains in the .net TLD
single-letter SL domains in the ccTLDs (where the ccTLD is two letters)
two-character SL domains in gTLDs (where the gTLD is two or more letters)
three-plus-character SL domains in gTLDs (where the gTLD is two or more letters)
IPv4 dot-decimal address format; TLD not allowed
returns true if domain appears to be a proper name and TLD or IPv4 address, else false
]=]
local function is_domain_name (domain)
if not domain then
return false; -- if not set, abandon
end
domain = domain:gsub ('^//', ''); -- strip '//' from domain name if present; done here so we only have to do it once
local sl_domain = domain:match ('[^%.]+') or domain; -- test the second level domain name
if not (sl_domain:match ('^%w') and sl_domain:match ('%w$') and -- first and last characters must be letter or digit
sl_domain:match ('^[%w%-]+$')) then -- all other characters must be letters, digits, or hyphen-minus
return false;
end
if domain:match ('^%a+:') then -- hack to detect things that look like s:Page:Title where Page: is namespace at Wikisource
return false;
end
local patterns = { -- patterns that look like URLs
'%f[%w][%w][%w%-]+[%w]%.%a%a+$', -- three or more character hostname.hostname or hostname.tld
'%f[%w][%w][%w%-]+[%w]%.xn%-%-[%w]+$', -- internationalized domain name with ACE prefix
'%f[%a][qxz]%.com$', -- assigned one character .com hostname (x.com times out 2015-12-10)
'%f[%a][iq]%.net$', -- assigned one character .net hostname (q.net registered but not active 2015-12-10)
'%f[%w][%w]%.%a%a$', -- one character hostname and ccTLD (2 chars)
'%f[%w][%w][%w]%.%a%a+$', -- two character hostname and TLD
'^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?', -- IPv4 address
'[%a%d]+%:?' -- IPv6 address
}
for _, pattern in ipairs (patterns) do -- loop through the patterns list
if domain:match (pattern) then
return true; -- if a match then we think that this thing that purports to be a URL is a URL
end
end
for _, d in ipairs (cfg.single_letter_2nd_lvl_domains_t) do -- look for single letter second level domain names for these top level domains
if domain:match ('%f[%w][%w]%.' .. d) then
return true
end
end
return false; -- no matches, we don't know what this thing is
end
--[[--------------------------< I S _ U R L >------------------------------------------------------------------
returns true if the scheme and domain parts of a URL appear to be a valid URL; else false.
This function is the last step in the validation process. This function is separate because there are cases that
are not covered by split_url(), for example is_parameter_ext_wikilink() which is looking for bracketted external
wikilinks.
]]
local function is_url (scheme, domain)
if utilities.is_set (scheme) then -- if scheme is set check it and domain
return is_scheme (scheme) and is_domain_name (domain);
else
return is_domain_name (domain); -- scheme not set when URL is protocol-relative
end
end
--[[--------------------------< S P L I T _ U R L >------------------------------------------------------------
Split a URL into a scheme, authority indicator, and domain.
First remove Fully Qualified Domain Name terminator (a dot following TLD) (if any) and any path(/), query(?) or fragment(#).
If protocol-relative URL, return nil scheme and domain else return nil for both scheme and domain.
When not protocol-relative, get scheme, authority indicator, and domain. If there is an authority indicator (one
or more '/' characters immediately following the scheme's colon), make sure that there are only 2.
Any URL that does not have news: scheme must have authority indicator (//). TODO: are there other common schemes
like news: that don't use authority indicator?
Strip off any port and path;
]]
local function split_url (url_str)
local scheme, authority, domain;
url_str = url_str:gsub ('([%a%d])%.?[/%?#].*$', '%1'); -- strip FQDN terminator and path(/), query(?), fragment (#) (the capture prevents false replacement of '//')
if url_str:match ('^//%S*') then -- if there is what appears to be a protocol-relative URL
domain = url_str:match ('^//(%S*)')
elseif url_str:match ('%S-:/*%S+') then -- if there is what appears to be a scheme, optional authority indicator, and domain name
scheme, authority, domain = url_str:match ('(%S-:)(/*)(%S+)'); -- extract the scheme, authority indicator, and domain portions
if utilities.is_set (authority) then
authority = authority:gsub ('//', '', 1); -- replace place 1 pair of '/' with nothing;
if utilities.is_set(authority) then -- if anything left (1 or 3+ '/' where authority should be) then
return scheme; -- return scheme only making domain nil which will cause an error message
end
else
if not scheme:match ('^news:') then -- except for news:..., MediaWiki won't link URLs that do not have authority indicator; TODO: a better way to do this test?
return scheme; -- return scheme only making domain nil which will cause an error message
end
end
domain = domain:gsub ('(%a):%d+', '%1'); -- strip port number if present
end
return scheme, domain;
end
--[[--------------------------< L I N K _ P A R A M _ O K >---------------------------------------------------
checks the content of |title-link=, |series-link=, |author-link=, etc. for properly formatted content: no wikilinks, no URLs
Link parameters are to hold the title of a Wikipedia article, so none of the WP:TITLESPECIALCHARACTERS are allowed:
# < > [ ] | { } _
except the underscore which is used as a space in wiki URLs and # which is used for section links
returns false when the value contains any of these characters.
When there are no illegal characters, this function returns TRUE if value DOES NOT appear to be a valid URL (the
|<param>-link= parameter is ok); else false when value appears to be a valid URL (the |<param>-link= parameter is NOT ok).
]]
local function link_param_ok (value)
local scheme, domain;
if value:find ('[<>%[%]|{}]') then -- if any prohibited characters
return false;
end
scheme, domain = split_url (value); -- get scheme or nil and domain or nil from URL;
return not is_url (scheme, domain); -- return true if value DOES NOT appear to be a valid URL
end
--[[--------------------------< L I N K _ T I T L E _ O K >---------------------------------------------------
Use link_param_ok() to validate |<param>-link= value and its matching |<title>= value.
|<title>= may be wiki-linked but not when |<param>-link= has a value. This function emits an error message when
that condition exists
check <link> for inter-language interwiki-link prefix. prefix must be a MediaWiki-recognized language
code and must begin with a colon.
]]
local function link_title_ok (link, lorig, title, torig)
local orig;
if utilities.is_set (link) then -- don't bother if <param>-link doesn't have a value
if not link_param_ok (link) then -- check |<param>-link= markup
orig = lorig; -- identify the failing link parameter
elseif title:find ('%[%[') then -- check |title= for wikilink markup
orig = torig; -- identify the failing |title= parameter
elseif link:match ('^%a+:') then -- if the link is what looks like an interwiki
local prefix = link:match ('^(%a+):'):lower(); -- get the interwiki prefix
if cfg.inter_wiki_map[prefix] then -- if prefix is in the map, must have preceding colon
orig = lorig; -- flag as error
end
end
end
if utilities.is_set (orig) then
link = ''; -- unset
utilities.set_message ('err_bad_paramlink', orig); -- URL or wikilink in |title= with |title-link=;
end
return link; -- link if ok, empty string else
end
--[[--------------------------< C H E C K _ U R L >------------------------------------------------------------
Determines whether a URL string appears to be valid.
First we test for space characters. If any are found, return false. Then split the URL into scheme and domain
portions, or for protocol-relative (//example.com) URLs, just the domain. Use is_url() to validate the two
portions of the URL. If both are valid, or for protocol-relative if domain is valid, return true, else false.
Because it is different from a standard URL, and because this module used external_link() to make external links
that work for standard and news: links, we validate newsgroup names here. The specification for a newsgroup name
is at https://tools.ietf.org/html/rfc5536#section-3.1.4
]]
local function check_url( url_str )
if nil == url_str:match ("^%S+$") then -- if there are any spaces in |url=value it can't be a proper URL
return false;
end
local scheme, domain;
scheme, domain = split_url (url_str); -- get scheme or nil and domain or nil from URL;
if 'news:' == scheme then -- special case for newsgroups
return domain:match('^[%a%d%+%-_]+%.[%a%d%+%-_%.]*[%a%d%+%-_]$');
end
return is_url (scheme, domain); -- return true if value appears to be a valid URL
end
--[=[-------------------------< I S _ P A R A M E T E R _ E X T _ W I K I L I N K >----------------------------
Return true if a parameter value has a string that begins and ends with square brackets [ and ] and the first
non-space characters following the opening bracket appear to be a URL. The test will also find external wikilinks
that use protocol-relative URLs. Also finds bare URLs.
The frontier pattern prevents a match on interwiki-links which are similar to scheme:path URLs. The tests that
find bracketed URLs are required because the parameters that call this test (currently |title=, |chapter=, |work=,
and |publisher=) may have wikilinks and there are articles or redirects like '//Hus' so, while uncommon, |title=[[//Hus]]
is possible as might be [[en://Hus]].
]=]
local function is_parameter_ext_wikilink (value)
local scheme, domain;
if value:match ('%f[%[]%[%a%S*:%S+.*%]') then -- if ext. wikilink with scheme and domain: [xxxx://yyyyy.zzz]
scheme, domain = split_url (value:match ('%f[%[]%[(%a%S*:%S+).*%]'));
elseif value:match ('%f[%[]%[//%S+.*%]') then -- if protocol-relative ext. wikilink: [//yyyyy.zzz]
scheme, domain = split_url (value:match ('%f[%[]%[(//%S+).*%]'));
elseif value:match ('%a%S*:%S+') then -- if bare URL with scheme; may have leading or trailing plain text
scheme, domain = split_url (value:match ('(%a%S*:%S+)'));
elseif value:match ('^//%S+') or value:match ('%s//%S+') then -- if protocol-relative bare URL: //yyyyy.zzz; authority indicator (//) must be be preceded nothing or by whitespace
scheme, domain = split_url (value:match ('(//%S+)')); -- what is left should be the domain
else
return false; -- didn't find anything that is obviously a URL
end
return is_url (scheme, domain); -- return true if value appears to be a valid URL
end
--[[--------------------------< I S _ A R C H I V E _ T O D A Y _ U R L >--------------------------------------
archive.today (and .ph, .is, .md, .li, .fo, .vn) are deprecated. See Wikipedia:Requests_for_comment/Archive.is_RFC_5
(Special:Permalink/1339352976)
<val> is a string that may or may not be a url
]]
local function is_archive_today_url (val)
if is_parameter_ext_wikilink (val) then -- is <val> a url?
local tld = val:match ('archive%.(%l+)/'); -- get the tld; real archive.today urls have a '/' after the tld
return tld and cfg.archive_today_tlds_t[tld]; -- return true if <tld> is one of the archive.today tlds; nil else
end
end
--[[--------------------------< H A S _ A R C H I V E _ T O D A Y _ U R L >------------------------------------
blank any parameter that holds one of the archive.today tlds (.today, .ph, .is, .md, .li, .fo, .vn) and also
blank parameters that are dependent on the offending parameter.
input <cite_args_t> is a table of all of this template's parameters This function modifies <cite_args_t>
when |url= or its alias |URL= hold an archive.today url, this function sets the flag <url_was_archive_today>
which is used later to suppress the missing url error message from {{citation}} when it has |website=<summat>
or from the templates {{cite web}}, {{cite podcast}}, {{cite mailing list}} which all require a url.
returns nothing
]]
local function has_archive_today_url (cite_args_t)
local unset_params_t = {}; -- to hold a sequence of parameters to unset from cite_args_t
for p, v in pairs (cite_args_t) do -- look at each parameter in the template
if is_archive_today_url (v:lower()) then -- if it has a parameter with an archive.today url
table.insert (unset_params_t, p); -- add the url-holding parameter name to our list of parameters to unset (may or may not be a legitimate url parameter)
if 'url' == p:lower() then -- if this parameter is |url= or |URL=
url_was_archive_today = true; -- set a flag so that cite web / podcast / mailinglist don't emit a missing url error message
end
if p:match ('archive%-?url') and ('usurped' == cite_args_t['url-status'] or 'unfit' == cite_args_t['url-status']) then -- if |archive-url=archive.today and |url-status=unfit/usurped
url_was_archive_today = true; -- set a flag so that cite web / podcast / mailinglist don't emit a missing url error message
table.insert (unset_params_t, 'url'); -- add the url parameter name to our list of parameters to unset (may or may not be a legitimate url parameter)
table.insert (unset_params_t, 'URL'); -- this one because both are possible
end
if cfg.dependencies_t[p] then -- if this url-holding parameter (<p>) has dependencies
for _, dependent in ipairs (cfg.dependencies_t[p]) do -- loop through the url-holding parameter's dependency sequence
table.insert (unset_params_t, dependent); -- add dependent parameter to the list to be unset
end
end
end
end
if 0 < #unset_params_t then -- when there are parameters to unset
if not is_preview_mode then -- when in preview mode do not suppress any parameters
for _, unset_param in ipairs (unset_params_t) do -- loop through the sequence
cite_args_t[unset_param] = nil; -- and unset the url-holding parameter and its dependent parameters to avoid parameter-requires-other-parameter errors
end
end
utilities.set_message ('maint_deprecated_archive'); -- add a maintenance message
end
end
--[[-------------------------< C H E C K _ F O R _ U R L >-----------------------------------------------------
loop through a list of parameters and their values. Look at the value and if it has an external link, emit an error message.
]]
local function check_for_url (parameter_list, error_list)
for k, v in pairs (parameter_list) do -- for each parameter in the list
if is_parameter_ext_wikilink (v) then -- look at the value; if there is a URL add an error message
table.insert (error_list, utilities.wrap_style ('parameter', k));
end
end
end
--[[--------------------------< S A F E _ F O R _ U R L >------------------------------------------------------
Escape sequences for content that will be used for URL descriptions
]]
local function safe_for_url( str )
if str:match( "%[%[.-%]%]" ) ~= nil then
utilities.set_message ('err_wikilink_in_url', {});
end
return str:gsub( '[%[%]\n]', {
['['] = '[',
[']'] = ']',
['\n'] = ' ' } );
end
--[[--------------------------< E X T E R N A L _ L I N K >----------------------------------------------------
Format an external link with error checking
]]
local function external_link (URL, label, source, access)
local domain;
local path;
local base_url;
if not utilities.is_set (label) then
label = URL;
if utilities.is_set (source) then
utilities.set_message ('err_bare_url_missing_title', {utilities.wrap_style ('parameter', source)});
else
error (cfg.messages["bare_url_no_origin"]); -- programmer error; valid parameter name does not have matching meta-parameter
end
end
if not check_url (URL) then
utilities.set_message ('err_bad_url', {utilities.wrap_style ('parameter', source)});
end
domain, path = URL:match ('^([/%.%-%+:%a%d]+)([/%?#].*)$'); -- split the URL into scheme plus domain and path
if path then -- if there is a path portion
path = path:gsub ('[%[%]]', {['['] = '%5b', [']'] = '%5d'}); -- replace '[' and ']' with their percent-encoded values
URL = table.concat ({domain, path}); -- and reassemble
end
base_url = table.concat ({ "[", URL, " ", safe_for_url (label), "]" }); -- assemble a wiki-markup URL
if utilities.is_set (access) then -- access level (subscription, registration, limited)
base_url = utilities.substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[access].class, cfg.presentation[access].title, base_url}); -- add the appropriate icon
end
return base_url;
end
--[[--------------------------< D E P R E C A T E D _ P A R A M E T E R >--------------------------------------
Categorize and emit an error message when the citation contains one or more deprecated parameters. The function includes the
offending parameter name to the error message. Only one error message is emitted regardless of the number of deprecated
parameters in the citation.
added_deprecated_cat is a Boolean declared in page scope variables above
]]
local function deprecated_parameter(name)
if not added_deprecated_cat then
added_deprecated_cat = true; -- note that we've added this category
utilities.set_message ('err_deprecated_params', {name}); -- add error message
end
end
--[=[-------------------------< K E R N _ Q U O T E S >--------------------------------------------------------
Apply kerning to open the space between the quote mark provided by the module and a leading or trailing quote
mark contained in a |title= or |chapter= parameter's value.
This function will positive kern either single or double quotes:
"'Unkerned title with leading and trailing single quote marks'"
" 'Kerned title with leading and trailing single quote marks' " (in real life the kerning isn't as wide as this example)
Double single quotes (italic or bold wiki-markup) are not kerned.
Replaces Unicode quote marks in plain text or in the label portion of a [[L|D]] style wikilink with typewriter
quote marks regardless of the need for kerning. Unicode quote marks are not replaced in simple [[D]] wikilinks.
Call this function for chapter titles, for website titles, etc.; not for book titles.
]=]
local function kern_quotes (str)
local wl_type, label, link;
wl_type, label, link = utilities.is_wikilink (str); -- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]
if 1 == wl_type then -- [[D]] simple wikilink with or without quote marks
if mw.ustring.match (str, '%[%[[\"“”\'‘’].+[\"“”\'‘’]%]%]') then -- leading and trailing quote marks
str = utilities.substitute (cfg.presentation['kern-left'], str);
str = utilities.substitute (cfg.presentation['kern-right'], str);
elseif mw.ustring.match (str, '%[%[[\"“”\'‘’].+%]%]') then -- leading quote marks
str = utilities.substitute (cfg.presentation['kern-left'], str);
elseif mw.ustring.match (str, '%[%[.+[\"“”\'‘’]%]%]') then -- trailing quote marks
str = utilities.substitute (cfg.presentation['kern-right'], str);
end
else -- plain text or [[L|D]]; text in label variable
label = mw.ustring.gsub (label, '[“”]', '\"'); -- replace “” (U+201C & U+201D) with " (typewriter double quote mark)
label = mw.ustring.gsub (label, '[‘’]', '\''); -- replace ‘’ (U+2018 & U+2019) with ' (typewriter single quote mark)
local cap = mw.ustring.match (label, "^([\"\'][^\'].+)"); -- match leading double or single quote but not doubled single quotes (italic markup)
if utilities.is_set (cap) then
label = utilities.substitute (cfg.presentation['kern-left'], cap);
end
cap = mw.ustring.match (label, "^(.+[^\'][\"\'])$") -- match trailing double or single quote but not doubled single quotes (italic markup)
if utilities.is_set (cap) then
label = utilities.substitute (cfg.presentation['kern-right'], cap);
end
if 2 == wl_type then
str = utilities.make_wikilink (link, label); -- reassemble the wikilink
else
str = label;
end
end
return str;
end
--[[--------------------------< F O R M A T _ S C R I P T _ V A L U E >----------------------------------------
|script-title= holds title parameters that are not written in Latin-based scripts: Chinese, Japanese, Arabic, Hebrew, etc. These scripts should
not be italicized and may be written right-to-left. The value supplied by |script-title= is concatenated onto Title after Title has been wrapped
in italic markup.
Regardless of language, all values provided by |script-title= are wrapped in <bdi>...</bdi> tags to isolate RTL languages from the English left to right.
|script-title= provides a unique feature. The value in |script-title= may be prefixed with a two-character ISO 639-1 language code and a colon:
|script-title=ja:*** *** (where * represents a Japanese character)
Spaces between the two-character code and the colon and the colon and the first script character are allowed:
|script-title=ja : *** ***
|script-title=ja: *** ***
|script-title=ja :*** ***
Spaces preceding the prefix are allowed: |script-title = ja:*** ***
The prefix is checked for validity. If it is a valid ISO 639-1 language code, the lang attribute (lang="ja") is added to the <bdi> tag so that browsers can
know the language the tag contains. This may help the browser render the script more correctly. If the prefix is invalid, the lang attribute
is not added. At this time there is no error message for this condition.
Supports |script-title=, |script-chapter=, |script-<periodical>=
]]
local function format_script_value (script_value, script_param)
local lang=''; -- initialize to empty string
local name;
if script_value:match('^%l%l%l?%s*:') then -- if first 3 or 4 non-space characters are script language prefix
lang = script_value:match('^(%l%l%l?)%s*:%s*%S.*'); -- get the language prefix or nil if there is no script
if not utilities.is_set (lang) then
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing title part']}); -- prefix without 'title'; add error message
return ''; -- script_value was just the prefix so return empty string
end
-- if we get this far we have prefix and script
name = cfg.lang_tag_remap[lang] or mw.language.fetchLanguageName( lang, cfg.this_wiki_code ); -- get language name so that we can use it to categorize
if utilities.is_set (name) then -- is prefix a proper ISO 639-1 language code?
script_value = script_value:gsub ('^%l+%s*:%s*', ''); -- strip prefix from script
-- is prefix one of these language codes?
if utilities.in_array (lang, cfg.script_lang_codes) then
utilities.add_prop_cat ('script', {name, lang})
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['unknown language code']}); -- unknown script-language; add error message
end
lang = ' lang="' .. lang .. '" '; -- convert prefix into a lang attribute
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['invalid language code']}); -- invalid language code; add error message
lang = ''; -- invalid so set lang to empty string
end
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing prefix']}); -- no language code prefix; add error message
end
script_value = utilities.substitute (cfg.presentation['bdi'], {lang, script_value}); -- isolate in case script is RTL
return script_value;
end
--[[--------------------------< S C R I P T _ C O N C A T E N A T E >------------------------------------------
Initially for |title= and |script-title=, this function concatenates those two parameter values after the script
value has been wrapped in <bdi> tags.
]]
local function script_concatenate (title, script, script_param)
if utilities.is_set (script) then
script = format_script_value (script, script_param); -- <bdi> tags, lang attribute, categorization, etc.; returns empty string on error
if utilities.is_set (script) then
title = title .. ' ' .. script; -- concatenate title and script title
end
end
return title;
end
--[[--------------------------< W R A P _ M S G >--------------------------------------------------------------
Applies additional message text to various parameter values. Supplied string is wrapped using a message_list
configuration taking one argument. Supports lower case text for {{citation}} templates. Additional text taken
from citation_config.messages - the reason this function is similar to but separate from wrap_style().
]]
local function wrap_msg (key, str, lower)
if not utilities.is_set ( str ) then
return "";
end
if true == lower then
local msg;
msg = cfg.messages[key]:lower(); -- set the message to lower case before
return utilities.substitute ( msg, str ); -- including template text
else
return utilities.substitute ( cfg.messages[key], str );
end
end
--[[----------------< W I K I S O U R C E _ U R L _ M A K E >-------------------
Makes a Wikisource URL from Wikisource interwiki-link. Returns the URL and appropriate
label; nil else.
str is the value assigned to |chapter= (or aliases) or |title= or |title-link=
]]
local function wikisource_url_make (str)
local wl_type, D, L;
local ws_url, ws_label;
local wikisource_prefix = table.concat ({'https://', cfg.this_wiki_code, '.wikisource.org/wiki/'});
wl_type, D, L = utilities.is_wikilink (str); -- wl_type is 0 (not a wikilink), 1 (simple wikilink), 2 (complex wikilink)
if 0 == wl_type then -- not a wikilink; might be from |title-link=
str = D:match ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title
});
ws_label = str; -- label for the URL
end
elseif 1 == wl_type then -- simple wikilink: [[Wikisource:ws article]]
str = D:match ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title
});
ws_label = str; -- label for the URL
end
elseif 2 == wl_type then -- non-so-simple wikilink: [[Wikisource:ws article|displayed text]] ([[L|D]])
str = L:match ('^[Ww]ikisource:(.+)') or L:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_label = D; -- get ws article name from display portion of interwiki link
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title without namespace from link portion of wikilink
});
end
end
if ws_url then
ws_url = mw.uri.encode (ws_url, 'WIKI'); -- make a usable URL
ws_url = ws_url:gsub ('%%23', '#'); -- undo percent-encoding of fragment marker
end
return ws_url, ws_label, L or D; -- return proper URL or nil and a label or nil
end
--[[----------------< F O R M A T _ P E R I O D I C A L >-----------------------
Format the three periodical parameters: |script-<periodical>=, |<periodical>=,
and |trans-<periodical>= into a single Periodical meta-parameter.
]]
local function format_periodical (script_periodical, script_periodical_source, periodical, trans_periodical)
if not utilities.is_set (periodical) then
periodical = ''; -- to be safe for concatenation
else
periodical = utilities.wrap_style ('italic-title', periodical); -- style
end
periodical = script_concatenate (periodical, script_periodical, script_periodical_source); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
if utilities.is_set (trans_periodical) then
trans_periodical = utilities.wrap_style ('trans-italic-title', trans_periodical);
if utilities.is_set (periodical) then
periodical = periodical .. ' ' .. trans_periodical;
else -- here when trans-periodical without periodical or script-periodical
periodical = trans_periodical;
utilities.set_message ('err_trans_missing_title', {'periodical'});
end
end
return periodical;
end
--[[------------------< F O R M A T _ C H A P T E R _ T I T L E >---------------
Format the four chapter parameters: |script-chapter=, |chapter=, |trans-chapter=,
and |chapter-url= into a single chapter meta- parameter (chapter_url_source used
for error messages).
]]
local function format_chapter_title (script_chapter, script_chapter_source, chapter, trans_chapter, trans_chapter_source, chapter_url, chapter_url_source, no_quotes, access)
local ws_url, ws_label, L = wikisource_url_make (chapter); -- make a wikisource URL and label from a wikisource interwiki link
if ws_url then
ws_label = ws_label:gsub ('_', ' '); -- replace underscore separators with space characters
chapter = ws_label;
end
if not utilities.is_set (chapter) then
chapter = ''; -- to be safe for concatenation
else
if false == no_quotes then
chapter = kern_quotes (chapter); -- if necessary, separate chapter title's leading and trailing quote marks from module provided quote marks
chapter = utilities.wrap_style ('quoted-title', chapter);
end
end
chapter = script_concatenate (chapter, script_chapter, script_chapter_source); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
if utilities.is_set (chapter_url) then
chapter = external_link (chapter_url, chapter, chapter_url_source, access); -- adds bare_url_missing_title error if appropriate
elseif ws_url then
chapter = external_link (ws_url, chapter .. ' ', 'ws link in chapter'); -- adds bare_url_missing_title error if appropriate; space char to move icon away from chap text; TODO: better way to do this?
chapter = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, chapter});
end
if utilities.is_set (trans_chapter) then
trans_chapter = utilities.wrap_style ('trans-quoted-title', trans_chapter);
if utilities.is_set (chapter) then
chapter = chapter .. ' ' .. trans_chapter;
else -- here when trans_chapter without chapter or script-chapter
chapter = trans_chapter;
utilities.set_message ('err_trans_missing_title', {trans_chapter_source:match ('trans%-?(.+)')}); -- when no chapter, get matching name from trans-<param>
end
end
return chapter;
end
--[[----------------< H A S _ I N V I S I B L E _ C H A R S >-------------------
This function searches a parameter's value for non-printable or invisible characters.
The search stops at the first match.
This function will detect the visible replacement character when it is part of the Wikisource.
Detects but ignores nowiki and math stripmarkers. Also detects other named stripmarkers
(gallery, math, pre, ref) and identifies them with a slightly different error message.
See also coins_cleanup().
Output of this function is an error message that identifies the character or the
Unicode group, or the stripmarker that was detected along with its position (or,
for multi-byte characters, the position of its first byte) in the parameter value.
]]
local function has_invisible_chars (param, v)
local position; -- position of invisible char or starting position of stripmarker
local capture; -- used by stripmarker detection to hold name of the stripmarker
local stripmarker; -- boolean set true when a stripmarker is found
capture = string.match (v, '[%w%p ]*'); -- test for values that are simple ASCII text and bypass other tests if true
if capture == v then -- if same there are no Unicode characters
return;
end
for _, invisible_char in ipairs (cfg.invisible_chars) do
local char_name = invisible_char[1]; -- the character or group name
local pattern = invisible_char[2]; -- the pattern used to find it
position, _, capture = mw.ustring.find (v, pattern); -- see if the parameter value contains characters that match the pattern
if position and (cfg.invisible_defs.zwj == capture) then -- if we found a zero-width joiner character
if mw.ustring.find (v, cfg.indic_script) then -- it's ok if one of the Indic scripts
position = nil; -- unset position
elseif cfg.emoji_t[mw.ustring.codepoint (v, position+1)] then -- is zwj followed by a character listed in emoji{}?
position = nil; -- unset position
end
end
if position then
if 'nowiki' == capture or 'math' == capture or -- nowiki and math stripmarkers (not an error condition)
('templatestyles' == capture and utilities.in_array (param, {'id', 'quote'})) then -- templatestyles stripmarker allowed in these parameters
stripmarker = true; -- set a flag
elseif true == stripmarker and cfg.invisible_defs.del == capture then -- because stripmakers begin and end with the delete char, assume that we've found one end of a stripmarker
position = nil; -- unset; for now, ignore linter warning
else
local err_msg;
if capture and not (cfg.invisible_defs.del == capture or cfg.invisible_defs.zwj == capture) then
err_msg = utilities.substitute (cfg.messages.invisible_1, {capture, char_name}); -- <capture> here is stripmarker name
else
err_msg = utilities.substitute (cfg.messages.invisible_2, char_name);
end
utilities.set_message ('err_invisible_char', {err_msg, utilities.wrap_style ('parameter', param), position}); -- add error message
return; -- and done with this parameter
end
end
end
end
--[[-------------------< A R G U M E N T _ W R A P P E R >----------------------
Argument wrapper. This function provides support for argument mapping defined
in the configuration file so that multiple names can be transparently aliased to
single internal variable.
]]
local function argument_wrapper ( args )
local origin = {};
return setmetatable({
ORIGIN = function ( self, k )
local dummy = self[k]; -- force the variable to be loaded; for now, ignore linter warning
return origin[k];
end
},
{
__index = function ( tbl, k )
if origin[k] ~= nil then
return nil;
end
local v;
local list = cfg.aliases[k];
if type( list ) == 'table' then
v, origin[k] = utilities.select_one ( args, list, 'err_redundant_parameters' );
if origin[k] == nil then
origin[k] = ''; -- Empty string, not nil
end
elseif list ~= nil then
v, origin[k] = args[list], list;
else
-- maybe let through instead of raising an error?
-- v, origin[k] = args[k], k;
error( cfg.messages['unknown_argument_map'] .. ': ' .. k);
end
-- Empty strings, not nil;
if v == nil then
v = '';
origin[k] = '';
end
-- tbl = rawset( tbl, k, v );
rawset( tbl, k, v );
return v;
end,
});
end
--[[--------------------------< N O W R A P _ D A T E >-------------------------
When date is YYYY-MM-DD format wrap in nowrap span: <span ...>YYYY-MM-DD</span>.
When date is DD MMMM YYYY or is MMMM DD, YYYY then wrap in nowrap span:
<span ...>DD MMMM</span> YYYY or <span ...>MMMM DD,</span> YYYY
DOES NOT yet support MMMM YYYY or any of the date ranges.
]]
local function nowrap_date (date)
local cap;
local cap2;
if date:match("^%d%d%d%d%-%d%d%-%d%d$") then
date = utilities.substitute (cfg.presentation['nowrap1'], date);
elseif date:match("^%a+%s*%d%d?,%s+%d%d%d%d$") or date:match ("^%d%d?%s*%a+%s+%d%d%d%d$") then
cap, cap2 = string.match (date, "^(.*)%s+(%d%d%d%d)$");
date = utilities.substitute (cfg.presentation['nowrap2'], {cap, cap2});
end
return date;
end
--[[--------------------------< S E T _ T I T L E T Y P E >---------------------
This function sets default title types (equivalent to the citation including
|type=<default value>) for those templates that have defaults. Also handles the
special case where it is desirable to omit the title type from the rendered citation
(|type=none).
]]
local function set_titletype (cite_class, title_type)
if utilities.is_set (title_type) then
if 'none' == cfg.keywords_xlate[title_type] then
title_type = ''; -- if |type=none then type parameter not displayed
end
return title_type; -- if |type= has been set to any other value use that value
end
return cfg.title_types [cite_class] or ''; -- set template's default title type; else empty string for concatenation
end
--[[--------------------------< S A F E _ J O I N >-----------------------------
Joins a sequence of strings together while checking for duplicate separation characters.
]]
local function safe_join( tbl, duplicate_char )
local f = {}; -- create a function table appropriate to type of 'duplicate character'
if 1 == #duplicate_char then -- for single byte ASCII characters use the string library functions
f.gsub = string.gsub
f.match = string.match
f.sub = string.sub
else -- for multi-byte characters use the ustring library functions
f.gsub = mw.ustring.gsub
f.match = mw.ustring.match
f.sub = mw.ustring.sub
end
local str = ''; -- the output string
for _, value in ipairs( tbl ) do
if value == nil then value = ''; end
if str == '' then -- if output string is empty
str = value; -- assign value to it (first time through the loop)
elseif value ~= '' then
local comp; -- what does 'comp' mean?
if value:sub(1, 1) == '<' then -- special case of values enclosed in spans and other markup.
comp = value:gsub( "%b<>", "" ); -- remove HTML markup (<span>string</span> -> string)
else
comp = value;
end
-- typically duplicate_char is sepc
if f.sub(comp, 1, 1) == duplicate_char then -- is first character same as duplicate_char? why test first character?
-- Because individual string segments often (always?) begin with terminal punct for the
-- preceding segment: 'First element' .. 'sepc next element' .. etc.?
local trim = false;
local end_chr = f.sub(str, -1, -1); -- get the last character of the output string
-- str = str .. "<HERE(enchr=" .. end_chr .. ")" -- debug stuff?
if end_chr == duplicate_char then -- if same as separator
str = f.sub(str, 1, -2); -- remove it
elseif end_chr == "'" then -- if it might be wiki-markup
if f.sub(str, -3, -1) == duplicate_char .. "''" then -- if last three chars of str are sepc''
str = f.sub(str, 1, -4) .. "''"; -- remove them and add back ''
elseif f.sub(str, -5, -1) == duplicate_char .. "]]''" then -- if last five chars of str are sepc]]''
trim = true; -- why? why do this and next differently from previous?
elseif f.sub(str, -4, -1) == duplicate_char .. "]''" then -- if last four chars of str are sepc]''
trim = true; -- same question
end
elseif end_chr == "]" then -- if it might be wiki-markup
if f.sub(str, -3, -1) == duplicate_char .. "]]" then -- if last three chars of str are sepc]] wikilink
trim = true;
elseif f.sub(str, -3, -1) == duplicate_char .. '"]' then -- if last three chars of str are sepc"] quoted external link
trim = true;
elseif f.sub(str, -2, -1) == duplicate_char .. "]" then -- if last two chars of str are sepc] external link
trim = true;
elseif f.sub(str, -4, -1) == duplicate_char .. "'']" then -- normal case when |url=something & |title=Title.
trim = true;
end
elseif end_chr == " " then -- if last char of output string is a space
if f.sub(str, -2, -1) == duplicate_char .. " " then -- if last two chars of str are <sepc><space>
str = f.sub(str, 1, -3); -- remove them both
end
end
if trim then
if value ~= comp then -- value does not equal comp when value contains HTML markup
local dup2 = duplicate_char;
if f.match(dup2, "%A" ) then dup2 = "%" .. dup2; end -- if duplicate_char not a letter then escape it
value = f.gsub(value, "(%b<>)" .. dup2, "%1", 1 ) -- remove duplicate_char if it follows HTML markup
else
value = f.sub(value, 2, -1 ); -- remove duplicate_char when it is first character
end
end
end
str = str .. value; -- add it to the output string
end
end
return str;
end
--[[--------------------------< I S _ S U F F I X >-----------------------------
returns true if suffix is properly formed Jr, Sr, or ordinal in the range 1–9.
Puncutation not allowed.
]]
local function is_suffix (suffix)
if utilities.in_array (suffix, {'Jr', 'Sr', 'Jnr', 'Snr', '1st', '2nd', '3rd'}) or suffix:match ('^%dth$') then
return true;
end
return false;
end
--[[--------------------< I S _ G O O D _ V A N C _ N A M E >-------------------
For Vancouver style, author/editor names are supposed to be rendered in Latin
(read ASCII) characters. When a name uses characters that contain diacritical
marks, those characters are to be converted to the corresponding Latin
character. When a name is written using a non-Latin alphabet or logogram, that
name is to be transliterated into Latin characters. The module doesn't do this
so editors may/must.
This test allows |first= and |last= names to contain any of the letters defined
in the four Unicode Latin character sets
[http://www.unicode.org/charts/PDF/U0000.pdf C0 Controls and Basic Latin] 0041–005A, 0061–007A
[http://www.unicode.org/charts/PDF/U0080.pdf C1 Controls and Latin-1 Supplement] 00C0–00D6, 00D8–00F6, 00F8–00FF
[http://www.unicode.org/charts/PDF/U0100.pdf Latin Extended-A] 0100–017F
[http://www.unicode.org/charts/PDF/U0180.pdf Latin Extended-B] 0180–01BF, 01C4–024F
|lastn= also allowed to contain hyphens, spaces, and apostrophes.
(http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)
|firstn= also allowed to contain hyphens, spaces, apostrophes, and periods
This original test:
if nil == mw.ustring.find (last, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%']*$")
or nil == mw.ustring.find (first, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%'%.]+[2-6%a]*$") then
was written outside of the code editor and pasted here because the code editor
gets confused between character insertion point and cursor position. The test has
been rewritten to use decimal character escape sequence for the individual bytes
of the Unicode characters so that it is not necessary to use an external editor
to maintain this code.
\195\128-\195\150 – À-Ö (U+00C0–U+00D6 – C0 controls)
\195\152-\195\182 – Ø-ö (U+00D8-U+00F6 – C0 controls)
\195\184-\198\191 – ø-ƿ (U+00F8-U+01BF – C0 controls, Latin extended A & B)
\199\132-\201\143 – DŽ-ɏ (U+01C4-U+024F – Latin extended B)
]]
local function is_good_vanc_name (last, first, suffix, position)
if not suffix then
if first:find ('[,%s]') then -- when there is a space or comma, might be first name/initials + generational suffix
first = first:match ('(.-)[,%s]+'); -- get name/initials
suffix = first:match ('[,%s]+(.+)$'); -- get generational suffix
end
end
if utilities.is_set (suffix) then
if not is_suffix (suffix) then
add_vanc_error (cfg.err_msg_supl.suffix, position);
return false; -- not a name with an appropriate suffix
end
end
if nil == mw.ustring.find (last, "^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191%-%s%']*$") or
nil == mw.ustring.find (first, "^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191%-%s%'%.]*$") then
add_vanc_error (cfg.err_msg_supl['non-Latin char'], position);
return false; -- not a string of Latin characters; Vancouver requires Romanization
end;
return true;
end
--[[--------------------------< R E D U C E _ T O _ I N I T I A L S >------------------------------------------
Attempts to convert names to initials in support of |name-list-style=vanc.
Names in |firstn= may be separated by spaces or hyphens, or for initials, a period.
See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35062/.
Vancouver style requires family rank designations (Jr, II, III, etc.) to be rendered
as Jr, 2nd, 3rd, etc. See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35085/.
This code only accepts and understands generational suffix in the Vancouver format
because Roman numerals look like, and can be mistaken for, initials.
This function uses ustring functions because firstname initials may be any of the
Unicode Latin characters accepted by is_good_vanc_name ().
]]
local function reduce_to_initials (first, position)
if first:find (',', 1, true) then
return first; -- commas not allowed; abandon
end
local name, suffix = mw.ustring.match (first, "^(%u+) ([%dJS][%drndth]+)$");
if not name then -- if not initials and a suffix
name = mw.ustring.match (first, "^(%u+)$"); -- is it just initials?
end
if name then -- if first is initials with or without suffix
if 3 > mw.ustring.len (name) then -- if one or two initials
if suffix then -- if there is a suffix
if is_suffix (suffix) then -- is it legitimate?
return first; -- one or two initials and a valid suffix so nothing to do
else
add_vanc_error (cfg.err_msg_supl.suffix, position); -- one or two initials with invalid suffix so error message
return first; -- and return first unmolested
end
else
return first; -- one or two initials without suffix; nothing to do
end
end
end -- if here then name has 3 or more uppercase letters so treat them as a word
local initials_t = {}; -- table to hold initials
local i = 1; -- counter for number of initials
local names_t = mw.text.split (first, '[%s%-]+'); -- split into a sequence of names and possible suffix
while names_t[i] do -- loop through the sequence
if 1 < i and names_t[i]:match ('[%dJS][%drndth]+%.?$') then -- if not the first name, and looks like a suffix (may have trailing dot)
names_t[i] = names_t[i]:gsub ('%.', ''); -- remove terminal dot if present
if is_suffix (names_t[i]) then -- if a legitimate suffix
table.insert (initials_t, ' ' .. names_t[i]); -- add a separator space, insert at end of initials sequence
break; -- and done because suffix must fall at the end of a name
end -- no error message if not a suffix; possibly because of Romanization
end
if 3 > i then
table.insert (initials_t, mw.ustring.sub (names_t[i], 1, 1)); -- insert the initial at end of initials sequence
end
i = i + 1; -- bump the counter
end
return table.concat (initials_t); -- Vancouver format does not include spaces.
end
--[[--------------------------< I N T E R W I K I _ P R E F I X E N _ G E T >----------------------------------
extract interwiki prefixen from <value>. Returns two one or two values:
false – no prefixen
nil – prefix exists but not recognized
project prefix, language prefix – when value has either of:
:<project>:<language>:<article>
:<language>:<project>:<article>
project prefix, nil – when <value> has only a known single-letter prefix
nil, language prefix – when <value> has only a known language prefix
accepts single-letter project prefixen: 'd' (wikidata), 's' (wikisource), and 'w' (wikipedia) prefixes; at this
writing, the other single-letter prefixen (b (wikibook), c (commons), m (meta), n (wikinews), q (wikiquote), and
v (wikiversity)) are not supported.
]]
local function interwiki_prefixen_get (value, is_link)
if not value:find (':%l+:') then -- if no prefix
return false; -- abandon; boolean here to distinguish from nil fail returns later
end
local prefix_patterns_linked_t = { -- sequence of valid interwiki and inter project prefixen
'^%[%[:([dsw]):(%l%l+):', -- wikilinked; project and language prefixes
'^%[%[:(%l%l+):([dsw]):', -- wikilinked; language and project prefixes
'^%[%[:([dsw]):', -- wikilinked; project prefix
'^%[%[:(%l%l+):', -- wikilinked; language prefix
}
local prefix_patterns_unlinked_t = { -- sequence of valid interwiki and inter project prefixen
'^:([dsw]):(%l%l+):', -- project and language prefixes
'^:(%l%l+):([dsw]):', -- language and project prefixes
'^:([dsw]):', -- project prefix
'^:(%l%l+):', -- language prefix
}
local cap1, cap2;
for _, pattern in ipairs ((is_link and prefix_patterns_linked_t) or prefix_patterns_unlinked_t) do
cap1, cap2 = value:match (pattern);
if cap1 then
break; -- found a match so stop looking
end
end
if cap1 and cap2 then -- when both then :project:language: or :language:project: (both forms allowed)
if 1 == #cap1 then -- length == 1 then :project:language:
if cfg.inter_wiki_map[cap2] then -- is language prefix in the interwiki map?
return cap1, cap2; -- return interwiki project and interwiki language
end
else -- here when :language:project:
if cfg.inter_wiki_map[cap1] then -- is language prefix in the interwiki map?
return cap2, cap1; -- return interwiki project and interwiki language
end
end
return nil; -- unknown interwiki language
elseif not (cap1 or cap2) then -- both are nil?
return nil; -- we got something that looks like a project prefix but isn't; return fail
elseif 1 == #cap1 then -- here when one capture
return cap1, nil; -- length is 1 so return project, nil language
else -- here when one capture and its length it more than 1
if cfg.inter_wiki_map[cap1] then -- is language prefix in the interwiki map?
return nil, cap1; -- return nil project, language
end
end
end
--[[--------------------------< L I S T _ P E O P L E >--------------------------
Formats a list of people (authors, contributors, editors, interviewers, translators)
names in the list will be linked when
|<name>-link= has a value
|<name>-mask- does NOT have a value; masked names are presumed to have been
rendered previously so should have been linked there
when |<name>-mask=0, the associated name is not rendered
]]
local function list_people (control, people, etal)
local sep;
local namesep;
local format = control.format;
local maximum = control.maximum;
local name_list = {};
if 'vanc' == format then -- Vancouver-like name styling?
sep = cfg.presentation['sep_nl_vanc']; -- name-list separator between names is a comma
namesep = cfg.presentation['sep_name_vanc']; -- last/first separator is a space
else
sep = cfg.presentation['sep_nl']; -- name-list separator between names is a semicolon
namesep = cfg.presentation['sep_name']; -- last/first separator is <comma><space>
end
if sep:sub (-1, -1) ~= " " then sep = sep .. " " end
if utilities.is_set (maximum) and maximum < 1 then return "", 0; end -- returned 0 is for EditorCount; not used for other names
for i, person in ipairs (people) do
if utilities.is_set (person.last) then
local mask = person.mask;
local one;
local sep_one = sep;
if utilities.is_set (maximum) and i > maximum then
etal = true;
break;
end
if mask then
local n = tonumber (mask); -- convert to a number if it can be converted; nil else
if n then
one = 0 ~= n and string.rep("—", n) or nil; -- make a string of (n > 0) mdashes, nil else, to replace name
person.link = nil; -- don't create link to name if name is replaces with mdash string or has been set nil
else
one = mask; -- replace name with mask text (must include name-list separator)
sep_one = " "; -- modify name-list separator
end
else
one = person.last; -- get surname
local first = person.first -- get given name
if utilities.is_set (first) then
if ("vanc" == format) then -- if Vancouver format
one = one:gsub ('%.', ''); -- remove periods from surnames (http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)
if not person.corporate and is_good_vanc_name (one, first, nil, i) then -- and name is all Latin characters; corporate authors not tested
first = reduce_to_initials (first, i); -- attempt to convert first name(s) to initials
end
end
one = one .. namesep .. first;
end
end
if utilities.is_set (person.link) then
one = utilities.make_wikilink (person.link, one); -- link author/editor
end
if one then -- if <one> has a value (name, mdash replacement, or mask text replacement)
local proj, tag = interwiki_prefixen_get (one, true); -- get the interwiki prefixen if present
if 'w' == proj and ('Wikipedia' == mw.site.namespaces.Project['name']) then
proj = nil; -- for stuff like :w:de:<article>, :w is unnecessary TODO: maint cat?
end
if proj then
local proj_name = ({['d'] = cfg.messages.wikidata, ['s'] = cfg.messages.wikisource, ['w'] = cfg.messages.wikipedia})[proj]; -- :w (wikipedia) for linking from a non-wikipedia project
if proj_name then
one = one .. utilities.wrap_style ('interproj', proj_name); -- add resized leading space, brackets, static text, language name
utilities.add_prop_cat ('interproj-linked-name', proj); -- categorize it; <proj> is sort key
tag = nil; -- unset; don't do both project and language
end
end
if tag == cfg.this_wiki_code then
tag = nil; -- stuff like :en:<article> at en.wiki is pointless TODO: maint cat?
end
if tag then
local lang = cfg.lang_tag_remap[tag] or cfg.mw_languages_by_tag_t[tag];
if lang then -- error messaging done in extract_names() where we know parameter names
one = one .. utilities.wrap_style ('interwiki', lang); -- add resized leading space, brackets, static text, language name
utilities.add_prop_cat ('interwiki-linked-name', tag); -- categorize it; <tag> is sort key
end
end
table.insert (name_list, one); -- add it to the list of names
table.insert (name_list, sep_one); -- add the proper name-list separator
end
end
end
local count = #name_list / 2; -- (number of names + number of separators) divided by 2
if 0 < count then
if 1 < count and not etal then
if 'amp' == format then
name_list[#name_list-2] = " & "; -- replace last separator with ampersand text
elseif 'and' == format then
if 2 == count then
name_list[#name_list-2] = cfg.presentation.sep_nl_and; -- replace last separator with 'and' text
else
name_list[#name_list-2] = cfg.presentation.sep_nl_end; -- replace last separator with '(sep) and' text
end
end
end
name_list[#name_list] = nil; -- erase the last separator
end
local result = table.concat (name_list); -- construct list
if etal and utilities.is_set (result) then -- etal may be set by |display-authors=etal but we might not have a last-first list
result = result .. sep .. cfg.messages['et al']; -- we've got a last-first list and etal so add et al.
end
return result, count; -- return name-list string and count of number of names (count used for editor names only)
end
--[[--------------------< M A K E _ C I T E R E F _ I D >-----------------------
Generates a CITEREF anchor ID if we have at least one name or a date. Otherwise
returns an empty string.
namelist is one of the contributor-, author-, or editor-name lists chosen in that
order. year is Year or anchor_year.
]]
local function make_citeref_id (namelist, year)
local names={}; -- a table for the one to four names and year
for i,v in ipairs (namelist) do -- loop through the list and take up to the first four last names
names[i] = v.last
if i == 4 then break end -- if four then done
end
table.insert (names, year); -- add the year at the end
local id = table.concat(names); -- concatenate names and year for CITEREF id
if utilities.is_set (id) then -- if concatenation is not an empty string
return "CITEREF" .. id; -- add the CITEREF portion
else
return ''; -- return an empty string; no reason to include CITEREF id in this citation
end
end
--[[--------------------------< C I T E _ C L A S S _A T T R I B U T E _M A K E >------------------------------
construct <cite> tag class attribute for this citation.
<cite_class> – config.CitationClass from calling template
<mode> – value from |mode= parameter
]]
local function cite_class_attribute_make (cite_class, mode)
local class_t = {};
table.insert (class_t, 'citation'); -- required for blue highlight
if 'citation' ~= cite_class then
table.insert (class_t, cite_class); -- identify this template for user css
table.insert (class_t, utilities.is_set (mode) and mode or 'cs1'); -- identify the citation style for user css or javascript
else
table.insert (class_t, utilities.is_set (mode) and mode or 'cs2'); -- identify the citation style for user css or javascript
end
for _, prop_key in ipairs (z.prop_keys_t) do
table.insert (class_t, prop_key); -- identify various properties for user css or javascript
end
return table.concat (class_t, ' '); -- make a big string and done
end
--[[---------------------< N A M E _ H A S _ E T A L >--------------------------
Evaluates the content of name parameters (author, editor, etc.) for variations on
the theme of et al. If found, the et al. is removed, a flag is set to true and
the function returns the modified name and the flag.
This function never sets the flag to false but returns its previous state because
it may have been set by previous passes through this function or by the associated
|display-<names>=etal parameter
]]
local function name_has_etal (name, etal, nocat, param)
if utilities.is_set (name) then -- name can be nil in which case just return
local patterns = cfg.et_al_patterns; -- get patterns from configuration
for _, pattern in ipairs (patterns) do -- loop through all of the patterns
if name:match (pattern) then -- if this 'et al' pattern is found in name
name = name:gsub (pattern, ''); -- remove the offending text
etal = true; -- set flag (may have been set previously here or by |display-<names>=etal)
if not nocat then -- no categorization for |vauthors=
utilities.set_message ('err_etal', {param}); -- and set an error if not added
end
end
end
end
return name, etal;
end
--[[---------------------< N A M E _ I S _ N U M E R I C >----------------------
Add an error message and category when <name> parameter value does not contain letters.
Add a maintenance category when <name> parameter value has numeric characters mixed with characters that are
not numeric characters; could be letters and/or punctuation characters.
This function will only emit one error and one maint message for the current template. Does not emit both error
and maint messages/categories for the same parameter value.
returns nothing
]]
local function name_is_numeric (name, name_alias, list_name)
local patterns = {
'^%D+%d', -- <name> must have digits preceded by other characters
'^%D*%d+%D+', -- <name> must have digits followed by other characters
}
if not added_numeric_name_errs and mw.ustring.match (name, '^[%A]+$') then -- if we have not already set an error message and <name> does not have any alpha characters
utilities.set_message ('err_numeric_names', name_alias); -- add an error message
added_numeric_name_errs = true; -- set the flag so we emit only one error message
return; -- when here no point in further testing; abandon
end
if not added_numeric_name_maint then -- if we have already set a maint message
for _, pattern in ipairs (patterns) do -- spin through list of patterns
if mw.ustring.match (name, pattern) then -- digits preceded or followed by anything but digits; %D+ includes punctuation
utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]); -- add a maint cat for this template
added_numeric_name_maint = true; -- set the flag so we emit only one maint message
return; -- when here no point in further testing; abandon
end
end
end
end
--[[-----------------< N A M E _ H A S _ M U L T _ N A M E S >------------------
Evaluates the content of last/surname (authors etc.) parameters for multiple names.
Multiple names are indicated if there is more than one comma or any "unescaped"
semicolons. Escaped semicolons are ones used as part of selected HTML entities.
If the condition is met, the function adds the multiple name maintenance category.
Same test for first except that commas should not appear in given names (MOS:JR says
that the generational suffix does not take a separator character). Titles, degrees,
postnominals, affiliations, all normally comma separated don't belong in a citation.
<name> – name parameter value
<list_name> – AuthorList, EditorList, etc
<limit> – number of allowed commas; 1 (default) for surnames; 0 for given names
returns nothing
]]
local function name_has_mult_names (name, list_name, limit)
local _, commas, semicolons, nbsps;
limit = limit and limit or 1;
if utilities.is_set (name) then
_, commas = name:gsub (',', ''); -- count the number of commas
_, semicolons = name:gsub (';', ''); -- count the number of semicolons
-- nbsps probably should be its own separate count rather than merged in
-- some way with semicolons because Lua patterns do not support the
-- grouping operator that regex does, which means there is no way to add
-- more entities to escape except by adding more counts with the new
-- entities
_, nbsps = name:gsub (' ',''); -- count nbsps
-- There is exactly 1 semicolon per entity, so subtract nbsps
-- from semicolons to 'escape' them. If additional entities are added,
-- they also can be subtracted.
if limit < commas or 0 < (semicolons - nbsps) then
utilities.set_message ('maint_mult_names', cfg.special_case_translation [list_name]); -- add a maint message
end
end
end
--[=[-------------------------< I S _ G E N E R I C >----------------------------------------------------------
Compares values assigned to various parameters according to the string provided as <item> in the function call.
<item> can have on of two values:
'generic_names' – for name-holding parameters: |last=, |first=, |editor-last=, etc
'generic_titles' – for |title=
There are two types of generic tests. The 'accept' tests look for a pattern that should not be rejected by the
'reject' test. For example,
|author=[[John Smith (author)|Smith, John]]
would be rejected by the 'author' reject test. But piped wikilinks with 'author' disambiguation should not be
rejected so the 'accept' test prevents that from happening. Accept tests are always performed before reject
tests.
Each of the 'accept' and 'reject' sequence tables hold tables for en.wiki (['en']) and local.wiki (['local'])
that each can hold a test sequence table The sequence table holds, at index [1], a test pattern, and, at index
[2], a boolean control value. The control value tells string.find() or mw.ustring.find() to do plain-text search (true)
or a pattern search (false). The intent of all this complexity is to make these searches as fast as possible so
that we don't run out of processing time on very large articles.
Returns
true when a reject test finds the pattern or string
false when an accept test finds the pattern or string
nil else
]=]
local function is_generic (item, value)
local str_lower = { -- use string.lower() for en.wiki (['en']) and use mw.ustring.lower() or local.wiki (['local'])
['en'] = string.lower,
['local'] = mw.ustring.lower,
}
local str_find = { -- use string.find() for en.wiki (['en']) and use mw.ustring.find() or local.wiki (['local'])
['en'] = string.find,
['local'] = mw.ustring.find,
}
local function test (val, test_t, wiki) -- local function to do the testing; <wiki> selects lower() and find() functions
val = test_t[2] and str_lower[wiki](value) or val; -- when <test_t[2]> set to 'true', plaintext search using lowercase value
return str_find[wiki] (val, test_t[1], 1, test_t[2]); -- return nil when not found or matched
end
local test_types_t = {'accept', 'reject'}; -- test accept patterns first, then reject patterns
local wikis_t = {'en', 'local'}; -- do tests for each of these keys; en.wiki first, local.wiki second
for _, test_type in ipairs (test_types_t) do -- for each test type
for _, generic_value in pairs (cfg.special_case_translation[item][test_type]) do -- spin through the list of generic value fragments to accept or reject
for _, wiki in ipairs (wikis_t) do
if generic_value[wiki] then
if test (value, generic_value[wiki], wiki) then -- go do the test
return ('reject' == test_type); -- param value rejected, return true; false else
end
end
end
end
end
end
--[[--------------------------< N A M E _ I S _ G E N E R I C >------------------------------------------------
calls is_generic() to determine if <name> is a 'generic name' listed in cfg.generic_names; <name_alias> is the
parameter name used in error messaging
]]
local function name_is_generic (name, name_alias)
if not added_generic_name_errs and is_generic ('generic_names', name) then
utilities.set_message ('err_generic_name', name_alias); -- set an error message
added_generic_name_errs = true;
end
end
--[[--------------------------< N A M E _ C H E C K S >--------------------------------------------------------
This function calls various name checking functions used to validate the content of the various name-holding parameters.
]]
local function name_checks (last, first, list_name, last_alias, first_alias)
local accept_name;
if utilities.is_set (last) then
last, accept_name = utilities.has_accept_as_written (last); -- remove accept-this-as-written markup when it wraps all of <last>
if not accept_name then -- <last> not wrapped in accept-as-written markup
name_has_mult_names (last, list_name); -- check for multiple names in the parameter
name_is_numeric (last, last_alias, list_name); -- check for names that have no letters or are a mix of digits and other characters
name_is_generic (last, last_alias); -- check for names found in the generic names list
end
end
if utilities.is_set (first) then
first, accept_name = utilities.has_accept_as_written (first); -- remove accept-this-as-written markup when it wraps all of <first>
if not accept_name then -- <first> not wrapped in accept-as-written markup
name_has_mult_names (first, list_name, 0); -- check for multiple names in the parameter; 0 is number of allowed commas in a given name
name_is_numeric (first, first_alias, list_name); -- check for names that have no letters or are a mix of digits and other characters
name_is_generic (first, first_alias); -- check for names found in the generic names list
end
local wl_type, D = utilities.is_wikilink (first);
if 0 ~= wl_type then
first = D;
utilities.set_message ('err_bad_paramlink', first_alias);
end
end
return last, first; -- done
end
--[[----------------------< E X T R A C T _ N A M E S >-------------------------
Gets name list from the input arguments
Searches through args in sequential order to find |lastn= and |firstn= parameters
(or their aliases), and their matching link and mask parameters. Stops searching
when both |lastn= and |firstn= are not found in args after two sequential attempts:
found |last1=, |last2=, and |last3= but doesn't find |last4= and |last5= then the
search is done.
This function emits an error message when there is a |firstn= without a matching
|lastn=. When there are 'holes' in the list of last names, |last1= and |last3=
are present but |last2= is missing, an error message is emitted. |lastn= is not
required to have a matching |firstn=.
When an author or editor parameter contains some form of 'et al.', the 'et al.'
is stripped from the parameter and a flag (etal) returned that will cause list_people()
to add the static 'et al.' text from Module:Citation/CS1/Configuration. This keeps
'et al.' out of the template's metadata. When this occurs, an error is emitted.
]]
local function extract_names(args, list_name)
local names = {}; -- table of names
local last; -- individual name components
local first;
local link;
local mask;
local i = 1; -- loop counter/indexer
local n = 1; -- output table indexer
local count = 0; -- used to count the number of times we haven't found a |last= (or alias for authors, |editor-last or alias for editors)
local etal = false; -- return value set to true when we find some form of et al. in an author parameter
local last_alias, first_alias, link_alias; -- selected parameter aliases used in error messaging
while true do
last, last_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'err_redundant_parameters', i ); -- search through args for name components beginning at 1
first, first_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'err_redundant_parameters', i );
link, link_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i );
mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', i );
if last then -- error check |lastn= alias for unknown interwiki link prefix; done here because this is where we have the parameter name
local project, language = interwiki_prefixen_get (last, true); -- true because we expect interwiki links in |lastn= to be wikilinked
if nil == project and nil == language then -- when both are nil
utilities.set_message ('err_bad_paramlink', last_alias); -- not known, emit an error message -- TODO: err_bad_interwiki?
last = utilities.remove_wiki_link (last); -- remove wikilink markup; show display value only
end
end
if link then -- error check |linkn= alias for unknown interwiki link prefix
local project, language = interwiki_prefixen_get (link, false); -- false because wiki links in |author-linkn= is an error
if nil == project and nil == language then -- when both are nil
utilities.set_message ('err_bad_paramlink', link_alias); -- not known, emit an error message -- TODO: err_bad_interwiki?
link = nil; -- unset so we don't link
link_alias = nil;
end
end
last, etal = name_has_etal (last, etal, false, last_alias); -- find and remove variations on et al.
first, etal = name_has_etal (first, etal, false, first_alias); -- find and remove variations on et al.
last, first = name_checks (last, first, list_name, last_alias, first_alias); -- multiple names, extraneous annotation, etc. checks
if first and not last then -- if there is a firstn without a matching lastn
local alias = first_alias:find ('given', 1, true) and 'given' or 'first'; -- get first or given form of the alias
utilities.set_message ('err_first_missing_last', {
first_alias, -- param name of alias missing its mate
first_alias:gsub (alias, {['first'] = 'last', ['given'] = 'surname'}), -- make param name appropriate to the alias form
}); -- add this error message
elseif not first and not last then -- if both firstn and lastn aren't found, are we done?
count = count + 1; -- number of times we haven't found last and first
if 2 <= count then -- two missing names and we give up
break; -- normal exit or there is a two-name hole in the list; can't tell which
end
else -- we have last with or without a first
link = link_title_ok (link, link_alias, last, last_alias); -- check for improper wiki-markup
if first then
link = link_title_ok (link, link_alias, first, first_alias); -- check for improper wiki-markup
end
names[n] = {last = last, first = first, link = link, mask = mask, corporate = false}; -- add this name to our names list (corporate for |vauthors= only)
n = n + 1; -- point to next location in the names table
if 1 == count then -- if the previous name was missing
utilities.set_message ('err_missing_name', {list_name:match ("(%w+)List"):lower(), i - 1}); -- add this error message
end
count = 0; -- reset the counter, we're looking for two consecutive missing names
end
i = i + 1; -- point to next args location
end
return names, etal; -- all done, return our list of names and the etal flag
end
--[[--------------------------< N A M E _ T A G _ G E T >------------------------------------------------------
attempt to decode |language=<lang_param> and return language name and matching tag; nil else.
This function looks for:
<lang_param> as a tag in cfg.lang_tag_remap{}
<lang_param> as a name in cfg.lang_name_remap{}
<lang_param> as a name in cfg.mw_languages_by_name_t
<lang_param> as a tag in cfg.mw_languages_by_tag_t
when those fail, presume that <lang_param> is an IETF-like tag that MediaWiki does not recognize. Strip all
script, region, variant, whatever subtags from <lang_param> to leave just a two or three character language tag
and look for the new <lang_param> in cfg.mw_languages_by_tag_t{}
on success, returns name (in properly capitalized form) and matching tag (in lowercase); on failure returns nil
]]
local function name_tag_get (lang_param)
local lang_param_lc = mw.ustring.lower (lang_param); -- use lowercase as an index into the various tables
local name;
local tag;
name = cfg.lang_tag_remap[lang_param_lc]; -- assume <lang_param_lc> is a tag; attempt to get remapped language name
if name then -- when <name>, <lang_param> is a tag for a remapped language name
if cfg.lang_name_remap[name:lower()][2] ~= lang_param_lc then
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
return name, cfg.lang_name_remap[name:lower()][2]; -- so return name and tag from lang_name_remap[name]; special case to xlate sr-ec and sr-el to sr-cyrl and sr-latn
end
return name, lang_param_lc; -- so return <name> from remap and <lang_param_lc>
end
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- still assuming that <lang_param_lc> is a tag; strip script, region, variant subtags
name = cfg.lang_tag_remap[tag]; -- attempt to get remapped language name with language subtag only
if name then -- when <name>, <tag> is a tag for a remapped language name
return name, tag; -- so return <name> from remap and <tag>
end
if cfg.lang_name_remap[lang_param_lc] then -- not a remapped tag, assume <lang_param_lc> is a name; attempt to get remapped language tag
return cfg.lang_name_remap[lang_param_lc][1], cfg.lang_name_remap[lang_param_lc][2]; -- for this <lang_param_lc>, return a (possibly) new name and appropriate tag
end
name = cfg.mw_languages_by_tag_t[lang_param_lc]; -- assume that <lang_param_lc> is a tag; attempt to get its matching language name
if name then
return name, lang_param_lc; -- <lang_param_lc> is a tag so return it and <name>
end
tag = cfg.mw_languages_by_name_t[lang_param_lc]; -- assume that <lang_param_lc> is a language name; attempt to get its matching tag
if tag then
return cfg.mw_languages_by_tag_t[tag], tag; -- <lang_param_lc> is a name so return the name from the table and <tag>
end
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- is <lang_param_lc> an IETF-like tag that MediaWiki doesn't recognize? <tag> gets the language subtag; nil else
if tag then
name = cfg.mw_languages_by_tag_t[tag]; -- attempt to get a language name using the shortened <tag>
if name then
return name, tag; -- <lang_param_lc> is an unrecognized IETF-like tag so return <name> and language subtag
end
end
end
--[[-------------------< L A N G U A G E _ P A R A M E T E R >------------------
Gets language name from a provided two- or three-character ISO 639 code. If a code
is recognized by MediaWiki, use the returned name; if not, then use the value that
was provided with the language parameter.
When |language= contains a recognized language (either code or name), the page is
assigned to the category for that code: Category:Norwegian-language sources (no).
For valid three-character code languages, the page is assigned to the single category
for '639-2' codes: Category:CS1 ISO 639-2 language sources.
Languages that are the same as the local wiki are not categorized. MediaWiki does
not recognize three-character equivalents of two-character codes: code 'ar' is
recognized but code 'ara' is not.
This function supports multiple languages in the form |language=nb, French, th
where the language names or codes are separated from each other by commas with
optional space characters.
]]
local function language_parameter (lang)
local tag; -- some form of IETF-like language tag; language subtag with optional region, sript, vatiant, etc subtags
local lang_subtag; -- ve populates |language= with mostly unecessary region subtags that MediaWiki does not recognize; this is the base language subtag
local name; -- the language name
local language_list = {}; -- table of language names to be rendered
local names_t = mw.text.split (lang, '%s*,%s*'); -- names should be a comma separated list
for _, lang in ipairs (names_t) do -- reuse lang here because we don't yet know if lang is a language name or a language tag; for now, ignore linter warning
name, tag = name_tag_get (lang); -- attempt to get name/tag pair for <lang>; <name> has proper capitalization; <tag> is lowercase
if utilities.is_set (tag) then
lang_subtag = tag:gsub ('^(%a%a%a?)%-.*', '%1'); -- for categorization, strip any IETF-like tags from language tag
if cfg.this_wiki_code ~= lang_subtag then -- when the language is not the same as this wiki's language
if 2 == lang_subtag:len() then -- and is a two-character tag
utilities.add_prop_cat ('foreign-lang-source', {name, tag}, lang_subtag); -- categorize it; tag appended to allow for multiple language categorization
else -- or is a recognized language (but has a three-character tag)
utilities.add_prop_cat ('foreign-lang-source-2', {lang_subtag}, lang_subtag); -- categorize it differently TODO: support multiple three-character tag categories per cs1|2 template?
end
elseif cfg.local_lang_cat_enable then -- when the language and this wiki's language are the same and categorization is enabled
utilities.add_prop_cat ('local-lang-source', {name, lang_subtag}); -- categorize it
end
else
name = lang; -- return whatever <lang> has so that we show something
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
end
table.insert (language_list, name);
end
name = utilities.make_sep_list (#language_list, language_list);
if (1 == #language_list) and (lang_subtag == cfg.this_wiki_code) then -- when only one language, find lang name in this wiki lang name; for |language=en-us, 'English' in 'American English'
return ''; -- if one language and that language is this wiki's return an empty string (no annotation)
end
return (" " .. wrap_msg ('language', name)); -- otherwise wrap with '(in ...)'
--[[ TODO: should only return blank or name rather than full list
so we can clean up the bunched parenthetical elements Language, Type, Format
]]
end
--[[-----------------------< S E T _ C S _ S T Y L E >--------------------------
Gets the default CS style configuration for the given mode.
Returns default separator and either postscript as passed in or the default.
In CS1, the default postscript and separator are '.'.
In CS2, the default postscript is the empty string and the default separator is ','.
]]
local function set_cs_style (postscript, mode)
if utilities.is_set(postscript) then
-- emit a maintenance message if user postscript is the default cs1 postscript
-- we catch the opposite case for cs2 in set_style
if mode == 'cs1' and postscript == cfg.presentation['ps_' .. mode] then
utilities.set_message ('maint_postscript');
end
else
postscript = cfg.presentation['ps_' .. mode];
end
return cfg.presentation['sep_' .. mode], postscript;
end
--[[--------------------------< S E T _ S T Y L E >-----------------------------
Sets the separator and postscript styles. Checks the |mode= first and the
#invoke CitationClass second. Removes the postscript if postscript == none.
]]
local function set_style (mode, postscript, cite_class)
local sep;
if 'cs2' == mode then
sep, postscript = set_cs_style (postscript, 'cs2');
elseif 'cs1' == mode then
sep, postscript = set_cs_style (postscript, 'cs1');
elseif 'citation' == cite_class then
sep, postscript = set_cs_style (postscript, 'cs2');
else
sep, postscript = set_cs_style (postscript, 'cs1');
end
if cfg.keywords_xlate[postscript:lower()] == 'none' then
-- emit a maintenance message if user postscript is the default cs2 postscript
-- we catch the opposite case for cs1 in set_cs_style
if 'cs2' == mode or ('cs1' ~= mode and 'citation' == cite_class) then -- {{citation |title=Title |mode=cs1 |postscript=none}} should not emit maint message
utilities.set_message ('maint_postscript');
end
postscript = '';
end
return sep, postscript
end
--[=[-------------------------< I S _ P D F >-----------------------------------
Determines if a URL has the file extension that is one of the PDF file extensions
used by [[MediaWiki:Common.css]] when applying the PDF icon to external links.
returns true if file extension is one of the recognized extensions, else false
]=]
local function is_pdf (url)
return url:match ('%.pdf$') or url:match ('%.PDF$') or
url:match ('%.pdf[%?#]') or url:match ('%.PDF[%?#]') or
url:match ('%.PDF#') or url:match ('%.pdf#');
end
--[[--------------------------< S T Y L E _ F O R M A T >-----------------------
Applies CSS style to |format=, |chapter-format=, etc. Also emits an error message
if the format parameter does not have a matching URL parameter. If the format parameter
is not set and the URL contains a file extension that is recognized as a PDF document
by MediaWiki's commons.css, this code will set the format parameter to (PDF) with
the appropriate styling.
]]
local function style_format (format, url, fmt_param, url_param)
if utilities.is_set (format) then
format = utilities.wrap_style ('format', format); -- add leading space, parentheses, resize
if not utilities.is_set (url) then
utilities.set_message ('err_format_missing_url', {fmt_param, url_param}); -- add an error message
end
elseif is_pdf (url) then -- format is not set so if URL is a PDF file then
format = utilities.wrap_style ('format', 'PDF'); -- set format to PDF
else
format = ''; -- empty string for concatenation
end
return format;
end
--[[---------------------< G E T _ D I S P L A Y _ N A M E S >------------------
Returns a number that defines the number of names displayed for author and editor
name lists and a Boolean flag to indicate when et al. should be appended to the name list.
When the value assigned to |display-xxxxors= is a number greater than or equal to zero,
return the number and the previous state of the 'etal' flag (false by default
but may have been set to true if the name list contains some variant of the text 'et al.').
When the value assigned to |display-xxxxors= is the keyword 'etal', return a number
that is one greater than the number of authors in the list and set the 'etal' flag true.
This will cause the list_people() to display all of the names in the name list followed by 'et al.'
In all other cases, returns nil and the previous state of the 'etal' flag.
inputs:
max: A['DisplayAuthors'] or A['DisplayEditors'], etc; a number or some flavor of etal
count: #a or #e
list_name: 'authors' or 'editors'
etal: author_etal or editor_etal
This function sets an error message when |display-xxxxors= value greater than or equal to number of names but
not when <max> comes from {{cs1 config}} global settings. When using global settings, <param> is set to the
keyword 'cs1 config' which is used to supress the normal error. Error is suppressed because it is to be expected
that some citations in an article will have the same or fewer names that the limit specified in {{cs1 config}}.
]]
local function get_display_names (max, count, etal, param)
if utilities.is_set (max) then
if 'etal' == cfg.keywords_xlate[max:lower():gsub("[ '%.]", '')] then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
max = count + 1; -- number of authors + 1 so display all author name plus et al.
etal = true; -- overrides value set by extract_names()
elseif max:match ('^%d+$') then -- if is a string of numbers
max = tonumber (max); -- make it a number
if (max >= count) and ('cs1 config' ~= param) then -- error when local |display-xxxxors= value greater than or equal to number of names; not an error when using global setting
utilities.set_message ('err_disp_name', {param, max}); -- add error message
max = nil;
end
else -- not a valid keyword or number
utilities.set_message ('err_disp_name', {param, max}); -- add error message
max = nil; -- unset; as if |display-xxxxors= had not been set
end
end
return max, etal;
end
--[[----------< E X T R A _ T E X T _ I N _ P A G E _ C H E C K >---------------
Adds error if |page=, |pages=, |quote-page=, |quote-pages= has what appears to be
some form of p. or pp. abbreviation in the first characters of the parameter content.
check page for extraneous p, p., pp, pp., pg, pg. at start of parameter value:
good pattern: '^P[^%.P%l]' matches when page begins PX or P# but not Px
where x and X are letters and # is a digit
bad pattern: '^[Pp][PpGg]' matches when page begins pp, pP, Pp, PP, pg, pG, Pg, PG
]]
local function extra_text_in_page_check (val, name)
if not val:match (cfg.vol_iss_pg_patterns.good_ppattern) then
for _, pattern in ipairs (cfg.vol_iss_pg_patterns.bad_ppatterns) do -- spin through the selected sequence table of patterns
if val:match (pattern) then -- when a match, error so
utilities.set_message ('err_extra_text_pages', name); -- add error message
return; -- and done
end
end
end
end
--[[--------------------------< E X T R A _ T E X T _ I N _ V O L _ I S S _ C H E C K >------------------------
Adds error if |volume= or |issue= has what appears to be some form of redundant 'type' indicator. Applies to
both; this function looks for issue text in both |issue= and |volume= and looks for volume-like text in |voluem=
and |issue=.
For |volume=:
'V.', or 'Vol.' (with or without the dot) abbreviations or 'Volume' in the first characters of the parameter
content (all case insensitive). 'V' and 'v' (without the dot) are presumed to be roman numerals so
are allowed.
For |issue=:
'No.', 'I.', 'Iss.' (with or without the dot) abbreviations, or 'Issue' in the first characters of the
parameter content (all case insensitive); numero styling: 'n°' with degree sign U+00B0, and № precomposed
numero sign U+2116.
Single character values ('v', 'i', 'n') allowed when not followed by separator character ('.', ':', '=', or
whitespace character) – param values are trimmed of whitespace by MediaWiki before delivered to the module.
<val> is |volume= or |issue= parameter value
<name> is |volume= or |issue= parameter name for error message
<selector> is 'v' for |volume=, 'i' for |issue=
sets error message on failure; returns nothing
]]
local function extra_text_in_vol_iss_check (val, name, selector)
if not utilities.is_set (val) then
return;
end
local handler = 'v' == selector and 'err_extra_text_volume' or 'err_extra_text_issue';
local accept_val; -- for now, ignore linter warning
val, accept_val = utilities.has_accept_as_written (val);
--if accept_val then -- if uncomment this, |volume=((vol. 1)) suppresses error
-- return;
--end
--val = mw.text.unstripNoWiki (val); -- if uncomment this, |volume=<nowiki>vol. 1</nowiki> shows error
val = val:lower(); -- force parameter value to lower case
for _, pattern in ipairs (cfg.vol_iss_pg_patterns.vi_patterns_t) do -- spin through the sequence table of patterns
if val:match (pattern) then -- when a match, error so
utilities.set_message (handler, name); -- add error message
return; -- and done
end
end
end
--[=[-------------------------< G E T _ V _ N A M E _ T A B L E >----------------------------------------------
split apart a |vauthors= or |veditors= parameter. This function allows for corporate names, wrapped in doubled
parentheses to also have commas; in the old version of the code, the doubled parentheses were included in the
rendered citation and in the metadata. Individual author names may be wikilinked
|vauthors=Jones AB, [[E. B. White|White EB]], ((Black, Brown, and Co.))
]=]
local function get_v_name_table (vparam, output_table, output_link_table)
local _, accept = utilities.has_accept_as_written (vparam);
if accept then
utilities.add_prop_cat ('vanc-accept'); -- add properties category
end
local name_table = mw.text.split(vparam, "%s*,%s*"); -- names are separated by commas
local wl_type, label, link; -- wl_type not used here; just a placeholder
local i = 1;
while name_table[i] do
if name_table[i]:match ('^%(%(.*[^%)][^%)]$') then -- first segment of corporate with one or more commas; this segment has the opening doubled parentheses
local name = name_table[i];
i = i + 1; -- bump indexer to next segment
while name_table[i] do
name = name .. ', ' .. name_table[i]; -- concatenate with previous segments
if name_table[i]:match ('^.*%)%)$') then -- if this table member has the closing doubled parentheses
break; -- and done reassembling so
end
i = i + 1; -- bump indexer
end
table.insert (output_table, name); -- and add corporate name to the output table
table.insert (output_link_table, ''); -- no wikilink
else
wl_type, label, link = utilities.is_wikilink (name_table[i]); -- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]
table.insert (output_table, label); -- add this name
if 1 == wl_type then
table.insert (output_link_table, label); -- simple wikilink [[D]]
else
table.insert (output_link_table, link); -- no wikilink or [[L|D]]; add this link if there is one, else empty string
end
end
i = i + 1;
end
return output_table;
end
--[[--------------------------< P A R S E _ V A U T H O R S _ V E D I T O R S >--------------------------------
This function extracts author / editor names from |vauthors= or |veditors= and finds matching |xxxxor-maskn= and
|xxxxor-linkn= in args. It then returns a table of assembled names just as extract_names() does.
Author / editor names in |vauthors= or |veditors= must be in Vancouver system style. Corporate or institutional names
may sometimes be required and because such names will often fail the is_good_vanc_name() and other format compliance
tests, are wrapped in doubled parentheses ((corporate name)) to suppress the format tests.
Supports generational suffixes Jr, 2nd, 3rd, 4th–6th.
This function sets the Vancouver error when a required comma is missing and when there is a space between an author's initials.
]]
local function parse_vauthors_veditors (args, vparam, list_name)
local names = {}; -- table of names assembled from |vauthors=, |author-maskn=, |author-linkn=
local v_name_table = {};
local v_link_table = {}; -- when name is wikilinked, targets go in this table
local etal = false; -- return value set to true when we find some form of et al. vauthors parameter
local last, first, link, mask, suffix;
local corporate = false;
vparam, etal = name_has_etal (vparam, etal, true); -- find and remove variations on et al. do not categorize (do it here because et al. might have a period)
v_name_table = get_v_name_table (vparam, v_name_table, v_link_table); -- names are separated by commas
for i, v_name in ipairs(v_name_table) do
first = ''; -- set to empty string for concatenation and because it may have been set for previous author/editor
local accept_name;
v_name, accept_name = utilities.has_accept_as_written (v_name); -- remove accept-this-as-written markup when it wraps all of <v_name>
if accept_name then
last = v_name;
corporate = true; -- flag used in list_people()
elseif string.find(v_name, "%s") then
if v_name:find('[;%.]') then -- look for commonly occurring punctuation characters;
add_vanc_error (cfg.err_msg_supl.punctuation, i);
end
local lastfirst_t = mw.text.split(v_name, "%s+");
first = table.remove (lastfirst_t); -- removes and returns value of last element in table which should be initials or generational suffix
if not mw.ustring.match (first, '^%u+$') then -- mw.ustring here so that later we will catch non-Latin characters
suffix = first; -- not initials so assume that whatever we got is a generational suffix
first = table.remove (lastfirst_t); -- get what should be the initials from the table
end
last = table.concat (lastfirst_t, ' '); -- returns a string that is the concatenation of all other names that are not initials and generational suffix
if not utilities.is_set (last) then
first = ''; -- unset
last = v_name; -- last empty because something wrong with first
add_vanc_error (cfg.err_msg_supl.name, i);
end
if mw.ustring.match (last, '%a+%s+%u+%s+%a+') then
add_vanc_error (cfg.err_msg_supl['missing comma'], i); -- matches last II last; the case when a comma is missing
end
if mw.ustring.match (v_name, ' %u %u$') then -- this test is in the wrong place TODO: move or replace with a more appropriate test
add_vanc_error (cfg.err_msg_supl.initials, i); -- matches a space between two initials
end
else
last = v_name; -- last name or single corporate name? Doesn't support multiword corporate names? do we need this?
end
if utilities.is_set (first) then
if not mw.ustring.match (first, "^%u?%u$") then -- first shall contain one or two upper-case letters, nothing else
add_vanc_error (cfg.err_msg_supl.initials, i); -- too many initials; mixed case initials (which may be ok Romanization); hyphenated initials
end
is_good_vanc_name (last, first, suffix, i); -- check first and last before restoring the suffix which may have a non-Latin digit
if utilities.is_set (suffix) then
first = first .. ' ' .. suffix; -- if there was a suffix concatenate with the initials
suffix = ''; -- unset so we don't add this suffix to all subsequent names
end
else
if not corporate then
is_good_vanc_name (last, '', nil, i);
end
end
link = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i ) or v_link_table[i];
mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', i );
names[i] = {last = last, first = first, link = link, mask = mask, corporate = corporate}; -- add this assembled name to our names list
end
return names, etal; -- all done, return our list of names
end
--[[--------------------------< S E L E C T _ A U T H O R _ E D I T O R _ S O U R C E >------------------------
Select one of |authors=, |authorn= / |lastn / firstn=, or |vauthors= as the source of the author name list or
select one of |editorn= / editor-lastn= / |editor-firstn= or |veditors= as the source of the editor name list.
Only one of these appropriate three will be used. The hierarchy is: |authorn= (and aliases) highest and |authors= lowest;
|editorn= (and aliases) highest and |veditors= lowest (support for |editors= withdrawn)
When looking for |authorn= / |editorn= parameters, test |xxxxor1= and |xxxxor2= (and all of their aliases); stops after the second
test which mimicks the test used in extract_names() when looking for a hole in the author name list. There may be a better
way to do this, I just haven't discovered what that way is.
Emits an error message when more than one xxxxor name source is provided.
In this function, vxxxxors = vauthors or veditors; xxxxors = authors as appropriate.
]]
local function select_author_editor_source (vxxxxors, xxxxors, args, list_name)
local lastfirst = false;
if utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 1 ) or -- do this twice in case we have a |first1= without a |last1=; this ...
utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 1 ) or -- ... also catches the case where |first= is used with |vauthors=
utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 2 ) or
utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 2 ) then
lastfirst = true;
end
if (utilities.is_set (vxxxxors) and true == lastfirst) or -- these are the three error conditions
(utilities.is_set (vxxxxors) and utilities.is_set (xxxxors)) or
(true == lastfirst and utilities.is_set (xxxxors)) then
utilities.set_message ('err_redundant_parameters',
utilities.substitute (cfg.special_case_translation.name_list_params,
('AuthorList' == list_name) and cfg.special_case_translation.author or cfg.special_case_translation.editor)); -- add error message
end
if true == lastfirst then return 1 end; -- return a number indicating which author name source to use
if utilities.is_set (vxxxxors) then return 2 end;
if utilities.is_set (xxxxors) then return 3 end;
return 1; -- no authors so return 1; this allows missing author name test to run in case there is a first without last
end
--[[--------------------------< I S _ V A L I D _ P A R A M E T E R _ V A L U E >------------------------------
This function is used to validate a parameter's assigned value for those parameters that have only a limited number
of allowable values (yes, y, true, live, dead, etc.). When the parameter value has not been assigned a value (missing
or empty in the source template) the function returns the value specified by ret_val. If the parameter value is one
of the list of allowed values returns the translated value; else, emits an error message and returns the value
specified by ret_val.
TODO: explain <invert>
]]
local function is_valid_parameter_value (value, name, possible, ret_val, invert)
if not utilities.is_set (value) then
return ret_val; -- an empty parameter is ok
end
if (not invert and utilities.in_array (value, possible)) then -- normal; <value> is in <possible> table
return cfg.keywords_xlate[value]; -- return translation of parameter keyword
elseif invert and not utilities.in_array (value, possible) then -- invert; <value> is not in <possible> table
return value; -- return <value> as it is
else
utilities.set_message ('err_invalid_param_val', {name, value}); -- not an allowed value so add error message
return ret_val;
end
end
--[[--------------------------< T E R M I N A T E _ N A M E _ L I S T >----------------------------------------
This function terminates a name list (author, contributor, editor) with a separator character (sepc) and a space
when the last character is not a sepc character or when the last three characters are not sepc followed by two
closing square brackets (close of a wikilink). When either of these is true, the name_list is terminated with a
single space character.
]]
local function terminate_name_list (name_list, sepc)
if (string.sub (name_list, -3, -1) == sepc .. '. ') then -- if already properly terminated
return name_list; -- just return the name list
elseif (string.sub (name_list, -1, -1) == sepc) or (string.sub (name_list, -3, -1) == sepc .. ']]') then -- if last name in list ends with sepc char
return name_list .. " "; -- don't add another
else
return name_list .. sepc .. ' '; -- otherwise terminate the name list
end
end
--[[-------------------------< F O R M A T _ V O L U M E _ I S S U E >-----------------------------------------
returns the concatenation of the formatted volume and issue (or journal article number) parameters as a single
string; or formatted volume or formatted issue, or an empty string if neither are set.
]]
local function format_volume_issue (volume, issue, article, cite_class, origin, sepc, lower)
if not utilities.is_set (volume) and not utilities.is_set (issue) and not utilities.is_set (article) then
return '';
end
-- same condition as in format_pages_sheets()
local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
local is_numeric_vol = volume and (volume:match ('^[MDCLXVI]+$') or volume:match ('^%d+$')); -- is only uppercase roman numerals or only digits?
local is_long_vol = volume and (4 < mw.ustring.len(volume)); -- is |volume= value longer than 4 characters?
if volume and (not is_numeric_vol and is_long_vol) then -- when not all digits or Roman numerals, is |volume= longer than 4 characters?
utilities.add_prop_cat ('long-vol'); -- yes, add properties cat
end
if is_journal then -- journal-style formatting
local vol = '';
if utilities.is_set (volume) then
if is_numeric_vol then -- |volume= value all digits or all uppercase Roman numerals?
vol = utilities.substitute (cfg.presentation['vol-bold'], {sepc, volume}); -- render in bold face
elseif is_long_vol then -- not all digits or Roman numerals; longer than 4 characters?
vol = utilities.substitute (cfg.messages['j-vol'], {sepc, utilities.hyphen_to_dash (volume)}); -- not bold
else -- four or fewer characters
vol = utilities.substitute (cfg.presentation['vol-bold'], {sepc, utilities.hyphen_to_dash (volume)}); -- bold
end
end
vol = vol .. (utilities.is_set (issue) and utilities.substitute (cfg.messages['j-issue'], issue) or '')
vol = vol .. (utilities.is_set (article) and utilities.substitute (cfg.messages['j-article-num'], article) or '')
return vol;
end
if 'podcast' == cite_class and utilities.is_set (issue) then
return wrap_msg ('issue', {sepc, issue}, lower);
end
if 'conference' == cite_class and utilities.is_set (article) then -- |article-number= supported only in journal and conference cites
if utilities.is_set (volume) and utilities.is_set (article) then -- both volume and article number
return wrap_msg ('vol-art', {sepc, utilities.hyphen_to_dash (volume), article}, lower);
elseif utilities.is_set (article) then -- article number alone; when volume alone, handled below
return wrap_msg ('art', {sepc, article}, lower);
end
end
-- all other types of citation
if utilities.is_set (volume) and utilities.is_set (issue) then
return wrap_msg ('vol-no', {sepc, utilities.hyphen_to_dash (volume), issue}, lower);
elseif utilities.is_set (volume) then
return wrap_msg ('vol', {sepc, utilities.hyphen_to_dash (volume)}, lower);
else
return wrap_msg ('issue', {sepc, issue}, lower);
end
end
--[[-------------------------< F O R M A T _ P A G E S _ S H E E T S >-----------------------------------------
adds static text to one of |page(s)= or |sheet(s)= values and returns it with all of the others set to empty strings.
The return order is:
page, pages, sheet, sheets
Singular has priority over plural when both are provided.
]]
local function format_pages_sheets (page, pages, sheet, sheets, cite_class, origin, sepc, nopp, lower)
if 'map' == cite_class then -- only cite map supports sheet(s) as in-source locators
if utilities.is_set (sheet) then
if 'journal' == origin then
return '', '', wrap_msg ('j-sheet', sheet, lower), '';
else
return '', '', wrap_msg ('sheet', {sepc, sheet}, lower), '';
end
elseif utilities.is_set (sheets) then
if 'journal' == origin then
return '', '', '', wrap_msg ('j-sheets', sheets, lower);
else
return '', '', '', wrap_msg ('sheets', {sepc, sheets}, lower);
end
end
end
local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
if utilities.is_set (page) then
if is_journal then
return utilities.substitute (cfg.messages['j-page(s)'], page), '', '', '';
elseif not nopp then
return utilities.substitute (cfg.messages['p-prefix'], {sepc, page}), '', '', '';
else
return utilities.substitute (cfg.messages['nopp'], {sepc, page}), '', '', '';
end
elseif utilities.is_set (pages) then
if is_journal then
return utilities.substitute (cfg.messages['j-page(s)'], pages), '', '', '';
elseif tonumber(pages) ~= nil and not nopp then -- if pages is only digits, assume a single page number
return '', utilities.substitute (cfg.messages['p-prefix'], {sepc, pages}), '', '';
elseif not nopp then
return '', utilities.substitute (cfg.messages['pp-prefix'], {sepc, pages}), '', '';
else
return '', utilities.substitute (cfg.messages['nopp'], {sepc, pages}), '', '';
end
end
return '', '', '', ''; -- return empty strings
end
--[[--------------------------< I N S O U R C E _ L O C _ G E T >----------------------------------------------
returns one of the in-source locators: page, pages, or at.
If any of these are interwiki links to Wikisource, returns the label portion of the interwiki-link as plain text
for use in COinS. This COinS thing is done because here we convert an interwiki-link to an external link and
add an icon span around that; get_coins_pages() doesn't know about the span. TODO: should it?
TODO: add support for sheet and sheets?; streamline;
TODO: make it so that this function returns only one of the three as the single in-source (the return value assigned
to a new name)?
]]
local function insource_loc_get (page, page_orig, pages, pages_orig, at)
local ws_url, ws_label, coins_pages, L; -- for Wikisource interwiki-links; TODO: this corrupts page metadata (span remains in place after cleanup; fix there?)
if utilities.is_set (page) then
if utilities.is_set (pages) or utilities.is_set (at) then
pages = ''; -- unset the others
at = '';
end
extra_text_in_page_check (page, page_orig); -- emit error message when |page= value begins with what looks like p., pp., etc.
ws_url, ws_label, L = wikisource_url_make (page); -- make ws URL from |page= interwiki link; link portion L becomes tooltip label
if ws_url then
page = external_link (ws_url, ws_label .. ' ', 'ws link in page'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
page = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, page});
coins_pages = ws_label;
end
elseif utilities.is_set (pages) then
if utilities.is_set (at) then
at = ''; -- unset
end
extra_text_in_page_check (pages, pages_orig); -- emit error message when |page= value begins with what looks like p., pp., etc.
ws_url, ws_label, L = wikisource_url_make (pages); -- make ws URL from |pages= interwiki link; link portion L becomes tooltip label
if ws_url then
pages = external_link (ws_url, ws_label .. ' ', 'ws link in pages'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
pages = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, pages});
coins_pages = ws_label;
end
elseif utilities.is_set (at) then
ws_url, ws_label, L = wikisource_url_make (at); -- make ws URL from |at= interwiki link; link portion L becomes tooltip label
if ws_url then
at = external_link (ws_url, ws_label .. ' ', 'ws link in at'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
at = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, at});
coins_pages = ws_label;
end
end
return page, pages, at, coins_pages;
end
--[[--------------------------< I S _ U N I Q U E _ A R C H I V E _ U R L >------------------------------------
add error message when |archive-url= value is same as |url= or chapter-url= (or alias...) value
]]
local function is_unique_archive_url (archive, url, c_url, source, date)
if utilities.is_set (archive) then
if archive == url or archive == c_url then
utilities.set_message ('err_bad_url', {utilities.wrap_style ('parameter', source)}); -- add error message
return '', ''; -- unset |archive-url= and |archive-date= because same as |url= or |chapter-url=
end
end
return archive, date;
end
--[=[-------------------------< A R C H I V E _ U R L _ C H E C K >--------------------------------------------
Check archive.org URLs to make sure they at least look like they are pointing at valid archives and not to the
save snapshot URL or to calendar pages. When the archive URL is 'https://web.archive.org/save/' (or http://...)
archive.org saves a snapshot of the target page in the URL. That is something that Wikipedia should not allow
unwitting readers to do.
When the archive.org URL does not have a complete timestamp, archive.org chooses a snapshot according to its own
algorithm or provides a calendar 'search' result. [[WP:ELNO]] discourages links to search results.
This function looks at the value assigned to |archive-url= and returns empty strings for |archive-url= and
|archive-date= and an error message when:
|archive-url= holds an archive.org save command URL
|archive-url= is an archive.org URL that does not have a complete timestamp (YYYYMMDDhhmmss 14 digits) in the
correct place
otherwise returns |archive-url= and |archive-date=
There are two mostly compatible archive.org URLs:
//web.archive.org/<timestamp>... -- the old form
//web.archive.org/web/<timestamp>... -- the new form
The old form does not support or map to the new form when it contains a display flag. There are four identified flags
('id_', 'js_', 'cs_', 'im_') but since archive.org ignores others following the same form (two letters and an underscore)
we don't check for these specific flags but we do check the form.
This function supports a preview mode. When the article is rendered in preview mode, this function may return a modified
archive URL:
for save command errors, return undated wildcard (/*/)
for timestamp errors when the timestamp has a wildcard, return the URL unmodified
for timestamp errors when the timestamp does not have a wildcard, return with timestamp limited to six digits plus wildcard (/yyyymm*/)
A secondary function is to return an archive-url timestamp from those archive urls that have them. The timestamp
is used by validation.archive_date_check() to see if the value in |archive-date= matches the timestamp in the
archive url.
]=]
local function archive_url_check (url, date)
local err_msg; -- start with the error message empty
local path, timestamp, flag; -- portions of the archive.org URL
local function is_ts_date_valid (ts, origin_date) -- local function to validate archive url taimestamp date; time ignored
local y, m, d = ts:match ('(%d%d%d%d)(%d%d)(%d%d)'); -- split into parts
if y and validation.is_valid_date (y, m, d) and (tonumber (y) >= 1996) then
return true, tonumber (y) >= origin_date; -- <origin_date> is 1996 for archive.org
end
end
if (not url:match('//web%.archive%.org/')) and (not url:match('//liveweb%.archive%.org/')) then -- also deprecated liveweb Wayback machine URL
return url, date; -- not an archive.org archive, return ArchiveURL and ArchiveDate
end
if url:match('//web%.archive%.org/save/') then -- if a save command URL, we don't want to allow saving of the target page
err_msg = cfg.err_msg_supl.save;
url = url:gsub ('(//web%.archive%.org)/save/', '%1/*/', 1); -- for preview mode: modify ArchiveURL
elseif url:match('//liveweb%.archive%.org/') then
err_msg = cfg.err_msg_supl.liveweb;
else
path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/'); -- split out some of the URL parts for evaluation
if not path then -- malformed in some way; pattern did not match
err_msg = cfg.err_msg_supl.timestamp;
elseif 14 ~= timestamp:len() then -- path and flag optional, must have 14-digit timestamp here
err_msg = cfg.err_msg_supl.timestamp;
if '*' ~= flag then
local replacement = timestamp:match ('^%d%d%d%d%d%d') or timestamp:match ('^%d%d%d%d'); -- get the first 6 (YYYYMM) or first 4 digits (YYYY)
if replacement then -- nil if there aren't at least 4 digits (year)
replacement = replacement .. string.rep ('0', 14 - replacement:len()); -- year or yearmo (4 or 6 digits) zero-fill to make 14-digit timestamp
url=url:gsub ('(//web%.archive%.org/[^%d]*)%d[^/]*', '%1' .. replacement .. '*', 1) -- for preview, modify ts to 14 digits plus splat for calendar display
end
end
elseif not is_ts_date_valid (timestamp, 1996) then -- is ymd portion of timestamp a valid date?
err_msg = cfg.err_msg_supl.timestamp;
timestamp = nil; -- unset because invalid
elseif utilities.is_set (path) and 'web/' ~= path then -- older archive URLs do not have the extra 'web/' path element
err_msg = cfg.err_msg_supl.path;
elseif utilities.is_set (flag) and not utilities.is_set (path) then -- flag not allowed with the old form URL (without the 'web/' path element)
err_msg = cfg.err_msg_supl.flag;
elseif utilities.is_set (flag) and not flag:match ('%a%a_') then -- flag if present must be two alpha characters and underscore (requires 'web/' path element)
err_msg = cfg.err_msg_supl.flag;
else
return url, date, timestamp; -- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=
end
end
-- if here, something not right so
utilities.set_message ('err_archive_url', {err_msg}); -- add error message and
if is_preview_mode then
return url, date, timestamp; -- preview mode so return ArchiveURL, ArchiveDate, and timestamp from |archive-url=
else
return '', ''; -- return empty strings for ArchiveURL and ArchiveDate
end
end
--[[--------------------------< P L A C E _ C H E C K >--------------------------------------------------------
check |place=, |publication-place=, |location= to see if these params include digits. This function added because
many editors misuse location to specify the in-source location (|page(s)= and |at= are supposed to do that)
returns the original parameter value without modification; added maint cat when parameter value contains digits
]]
local function place_check (param_val)
if not utilities.is_set (param_val) then -- parameter empty or omitted
return param_val; -- return that empty state
end
if mw.ustring.find (param_val, '%d') then -- not empty, are there digits in the parameter value
utilities.set_message ('maint_location'); -- yep, add maint cat
end
return param_val; -- and done
end
--[[--------------------------< I S _ A R C H I V E D _ C O P Y >----------------------------------------------
compares |title= to 'Archived copy' (placeholder added by bots that can't find proper title); if matches, return true; nil else
]]
local function is_archived_copy (title)
title = mw.ustring.lower(title); -- switch title to lower case
if title:find (cfg.special_case_translation.archived_copy.en) then -- if title is 'Archived copy'
return true;
elseif cfg.special_case_translation.archived_copy['local'] then
if mw.ustring.find (title, cfg.special_case_translation.archived_copy['local']) then -- mw.ustring() because might not be Latin script
return true;
end
end
end
--[[--------------------------< D I S P L A Y _ N A M E S _ S E L E C T >--------------------------------------
for any of the |display-authors=, |display-editors=, etc parameters, select either the local or global setting.
When both are present, look at <local_display_names> value. When the value is some sort of 'et al.'string,
special handling is required.
When {{cs1 config}} has |display-<namelist>= AND this template has |display-<namelist>=etal AND:
the number of names specified by <number_of_names> is:
greater than the number specified in the global |display-<namelist>= parameter (<global_display_names>)
use global |display-<namelist>= parameter value
set overridden maint category
less than or equal to the number specified in the global |display-<namelist>= parameter
use local |display-<namelist>= parameter value
The purpose of this function is to prevent categorizing a template that has fewer names than the global setting
to keep the etal annotation specified by <local_display_names>.
]]
local function display_names_select (global_display_names, local_display_names, param_name, number_of_names)
if global_display_names and utilities.is_set (local_display_names) then -- when both
if 'etal' == local_display_names:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
number_of_names = tonumber (number_of_names); -- convert these to numbers for comparison
local global_display_names_num = tonumber (global_display_names); -- <global_display_names> not set when parameter value is not digits
if number_of_names > global_display_names_num then -- template has more names than global config allows to be displayed?
utilities.set_message ('maint_overridden_setting'); -- set a maint message because global is overriding local |display-<namelist>=etal
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local because fewer names so let <local_display_names> control
end
end
-- here when <global_display_names> and <local_display_names> both numbers; <global_display_names> controls
utilities.set_message ('maint_overridden_setting'); -- set a maint message
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
end
-- here when only one of <global_display_names> or <local_display_names> set
if global_display_names then
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local
end
end
--[[--------------------------< M O D E _ S E T >--------------------------------------------------------------
fetch global mode setting from {{cs1 config}} (if present) or from |mode= (if present); global setting overrides
local |mode= parameter value. When both are present, emit maintenance message
]]
local function mode_set (Mode, Mode_origin)
local mode;
if cfg.global_cs1_config_t['Mode'] then -- global setting in {{cs1 config}}; nil when empty or assigned value invalid
mode = is_valid_parameter_value (cfg.global_cs1_config_t['Mode'], 'cs1 config: mode', cfg.keywords_lists['mode'], ''); -- error messaging 'param' here is a hoax
else
mode = is_valid_parameter_value (Mode, Mode_origin, cfg.keywords_lists['mode'], '');
end
if cfg.global_cs1_config_t['Mode'] and utilities.is_set (Mode) then -- when template has |mode=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
return mode;
end
--[[--------------------------< Q U O T E _ M A K E >----------------------------------------------------------
create quotation from |quote=, |trans-quote=, and/or script-quote= with or without |quote-page= or |quote-pages=
when any of those three quote parameters are set, this function unsets <PostScript>. When none of those parameters
are set, |quote-page= and |quote-pages= are unset to nil so that they are not included in the template's metadata
]]
local function quote_make (quote, trans_quote, script_quote, quote_page, quote_pages, nopp, sepc, postscript)
if utilities.is_set (quote) or utilities.is_set (trans_quote) or utilities.is_set (script_quote) then
if utilities.is_set (quote) then
if quote:sub(1, 1) == '"' and quote:sub(-1, -1) == '"' then -- if first and last characters of quote are quote marks
quote = quote:sub(2, -2); -- strip them off
end
end
quote = kern_quotes (quote); -- kern if needed
quote = utilities.wrap_style ('quoted-text', quote ); -- wrap in <q>...</q> tags
if utilities.is_set (script_quote) then
quote = script_concatenate (quote, script_quote, 'script-quote'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after quote is wrapped
end
if utilities.is_set (trans_quote) then
if trans_quote:sub(1, 1) == '"' and trans_quote:sub(-1, -1) == '"' then -- if first and last characters of |trans-quote are quote marks
trans_quote = trans_quote:sub(2, -2); -- strip them off
end
quote = quote .. " " .. utilities.wrap_style ('trans-quoted-title', trans_quote );
end
if utilities.is_set (quote_page) or utilities.is_set (quote_pages) then -- add page prefix
local quote_prefix = '';
if utilities.is_set (quote_page) then
extra_text_in_page_check (quote_page, 'quote-page'); -- add to maint cat if |quote-page= value begins with what looks like p., pp., etc.
if not nopp then
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, quote_page});
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, quote_page});
end
elseif utilities.is_set (quote_pages) then
extra_text_in_page_check (quote_pages, 'quote-pages'); -- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.
if tonumber(quote_pages) ~= nil and not nopp then -- if only digits, assume single page
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, quote_pages});
elseif not nopp then
quote_prefix = utilities.substitute (cfg.messages['pp-prefix'], {sepc, quote_pages});
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, quote_pages});
end
end
quote = quote_prefix .. ": " .. quote;
else
quote = sepc .. " " .. quote;
end
postscript = ""; -- cs1|2 does not supply terminal punctuation when |quote= is set
elseif utilities.is_set (quote_page) or utilities.is_set (quote_pages) then
quote_page = nil; -- unset; these require |quote=; TODO: error message?
quote_pages = nil;
end
return quote, quote_page, quote_pages, postscript;
end
--[[--------------------------< C H E C K _ P U B L I S H E R _ N A M E >--------------------------------------
look for variations of '<text>: <text>' that might be '<location>: <publisher>' in |publisher= parameter value.
when found, emit a maintenance message; return nil else
<publisher> is the value assigned to |publisher= or |institution=
]]
local function check_publisher_name (publisher)
local patterns_t = {
'^[%w%s]+%s*:%s*[%w%s]+$', -- plain text <location>: <publisher>
'^%[+[%w%s:|]+%]+%s*:%s*[%w%s]+$', -- partially wikilinked [[<location>]]: <publisher>
'^[%w%s]+%s*:%s*%[+[%w%s:|]+%]+$', -- partially wikilinked <location>: [[<publisher>]]
'^%[+[%w%s:|]+%]+%s*:%s*%[+[%w%s:|]+%]+$', -- wikilinked [[<location>]]: [[<publisher>]]
}
for _, pattern in ipairs (patterns_t) do -- spin through the patterns_t sequence
if mw.ustring.match (publisher, pattern) then -- does this pattern match?
utilities.set_message ('maint_publisher_location'); -- set a maint message
return; -- and done
end
end
end
--[[--------------------------< I S _ P A G E _ A R T _ N U M >------------------------------------------------
compare the trailing (rightmost) characters of the |doi= value against the whole value assigned to |page(s)=.
return boolean true when:
|page(s)= has exactly 8 digits and a dot between the fourth and fifth digits matches the trailing 9 characters
of the |doi= value: |page=12345678 → |page=1234.5678 matches |doi=10.xxxx/yyyy1234.5678
|page(s)= is 5 or more characters and matches |doi= values's trailing characters
|page(s)= begins with a lowercase 'e' and |page(s)= without the 'e' matches |doi= values's trailing
characters: |page=e12345 → |page=12345 matches |doi=10.xxxx/yyyy12345
|page(s)= begins with a uppercase 'CD' followed by (typically) six digits matches |doi= values that ends with
'CDxxxxxx.pubx' (where 'x' is any single digit)
return nil when |page(s)= values:
are ranges separated by underscore, hyphen, emdash, endash, figure dash, or minus character
are comma- or semicolon-separated lists of pages
have external urls (has text 'http')
are digit-only values less than 10000
do not match |doi= values's trailing characters
]]
local function is_page_art_num (page, doi)
if not (utilities.is_set (page) and utilities.is_set (doi)) then -- both required
return; -- abandon; nothing to do
end
if page:match ('[,;_−–—‒%-]') then -- when |page(s)= might be a page range or a separated list of pages
return; -- abandon
end
page = page:lower(); -- because doi names are case insensitive
doi = doi:lower(); -- force these to lowercase for testing
if page:match ('http') then -- when |page(s)= appears to hold a url
return; -- abandon
end
if tonumber (page) then -- is |page(s)= digits only
if 10000 > tonumber (page) then -- when |page(s)= less than 10000
return; -- abandon
end
if doi:match (page .. '$') then -- digits only page number match the last digits in |doi=?
return true;
end
if 8 == page:len() then -- special case when |page(s)= is exactly 8 digits
local dot_page = page:gsub ('(%d%d%d%d)(%d%d%d%d)', '%1.%2'); -- make a |page=xxxx.yyyy version commonly used in |doi=
if doi:match (dot_page .. '$') then -- 8-digit dotted page number match the last characters in |doi=?
return true;
end
end
else -- here when |page(s)= is alpha-numeric
if 4 < page:len() then -- when |page(s)= is five or more characters
if doi:match (page .. '$') then -- alpha-numeric page match the last characters in |doi=?
return true;
end
local epage = page:match ('^e([%w]+)$'); -- if first character of |page= is 'e', remove it
if epage and doi:match (epage .. '$') then -- page number match the last characters in |doi=?
return true;
end
local cdpage = page:match ('^cd%d+$'); -- if first characters of |page= are 'CD' and last characters are digits (typically 6 digits)
if cdpage and doi:match (cdpage .. '%.pub%d$') then -- page number matches doi 'CDxxxxxx.pubx' where 'x' is a digit
return true;
end
end
end
end
--[[--------------------------< C I T A T I O N 0 >------------------------------------------------------------
This is the main function doing the majority of the citation formatting.
]]
local function citation0( config, args )
--[[
Load Input Parameters
The argument_wrapper facilitates the mapping of multiple aliases to single internal variable.
]]
local A = argument_wrapper ( args );
-- Pick out the relevant fields from the arguments. Different citation templates
-- define different field names for the same underlying things.
local author_etal;
local a = {}; -- authors list from |lastn= / |firstn= pairs or |vauthors=
local Authors;
local NameListStyle;
if cfg.global_cs1_config_t['NameListStyle'] then -- global setting in {{cs1 config}} overrides local |name-list-style= parameter value; nil when empty or assigned value invalid
NameListStyle = is_valid_parameter_value (cfg.global_cs1_config_t['NameListStyle'], 'cs1 config: name-list-style', cfg.keywords_lists['name-list-style'], ''); -- error messaging 'param' here is a hoax
else
NameListStyle = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], '');
end
if cfg.global_cs1_config_t['NameListStyle'] and utilities.is_set (A['NameListStyle']) then -- when template has |name-list-style=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
local Collaboration = A['Collaboration'];
do -- to limit scope of selected
local selected = select_author_editor_source (A['Vauthors'], A['Authors'], args, 'AuthorList');
if 1 == selected then
a, author_etal = extract_names (args, 'AuthorList'); -- fetch author list from |authorn= / |lastn= / |firstn=, |author-linkn=, and |author-maskn=
elseif 2 == selected then
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
a, author_etal = parse_vauthors_veditors (args, A['Vauthors'], 'AuthorList'); -- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=
elseif 3 == selected then
Authors = A['Authors']; -- use content of |people= or |credits=; |authors= is deprecated; TODO: constrain |people= and |credits= to cite av media, episode, serial?
end
if utilities.is_set (Collaboration) then
author_etal = true; -- so that |display-authors=etal not required
end
end
local editor_etal;
local e = {}; -- editors list from |editor-lastn= / |editor-firstn= pairs or |veditors=
do -- to limit scope of selected
local selected = select_author_editor_source (A['Veditors'], nil, args, 'EditorList'); -- support for |editors= withdrawn
if 1 == selected then
e, editor_etal = extract_names (args, 'EditorList'); -- fetch editor list from |editorn= / |editor-lastn= / |editor-firstn=, |editor-linkn=, and |editor-maskn=
elseif 2 == selected then
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
e, editor_etal = parse_vauthors_veditors (args, args.veditors, 'EditorList'); -- fetch editor list from |veditors=, |editor-linkn=, and |editor-maskn=
end
end
local Chapter = A['Chapter']; -- done here so that we have access to |contribution= from |chapter= and |script-chapter= aliases
local Chapter_origin = A:ORIGIN ('Chapter');
local ScriptChapter = A['ScriptChapter'];
local ScriptChapter_origin = A:ORIGIN ('ScriptChapter');
local Contribution; -- because contribution is required for contributor(s)
if 'contribution' == Chapter_origin then -- is there a |contribution= parameter?
Contribution = Chapter; -- get the name of the contribution
elseif 'script-contribution' == ScriptChapter_origin then -- no, so is there a |script-contribution= parameter?
Contribution = ScriptChapter; -- get the name of the contribution
end
local c = {}; -- contributors list from |contributor-lastn= / contributor-firstn= pairs
if utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (A['Periodical']) then -- |contributor= and |contribution= only supported in book cites
c = extract_names (args, 'ContributorList'); -- fetch contributor list from |contributorn= / |contributor-lastn=, -firstn=, -linkn=, -maskn=
if 0 < #c then
if not utilities.is_set (Contribution) then -- |contributor= requires |contribution=
utilities.set_message ('err_contributor_missing_required_param', 'contribution'); -- add missing contribution error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
if 0 == #a then -- |contributor= requires |author=
utilities.set_message ('err_contributor_missing_required_param', 'author'); -- add missing author error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
end
else -- if not a book cite
if utilities.select_one (args, cfg.aliases['ContributorList-Last'], 'err_redundant_parameters', 1 ) then -- are there contributor name list parameters?
utilities.set_message ('err_contributor_ignored'); -- add contributor ignored error message
end
Contribution = nil; -- unset
end
local Title = A['Title'];
local TitleLink = A['TitleLink'];
local auto_select = ''; -- default is auto
local accept_link;
TitleLink, accept_link = utilities.has_accept_as_written (TitleLink, true); -- test for accept-this-as-written markup
if (not accept_link) and utilities.in_array (TitleLink, {'none', 'pmc', 'doi'}) then -- check for special keywords
auto_select = TitleLink; -- remember selection for later
TitleLink = ''; -- treat as if |title-link= would have been empty
end
TitleLink = link_title_ok (TitleLink, A:ORIGIN ('TitleLink'), Title, 'title'); -- check for wiki-markup in |title-link= or wiki-markup in |title= when |title-link= is set
local Section = ''; -- {{cite map}} only; preset to empty string for concatenation if not used
if 'map' == config.CitationClass and 'section' == Chapter_origin then
Section = A['Chapter']; -- get |section= from |chapter= alias list; |chapter= and the other aliases not supported in {{cite map}}
Chapter = ''; -- unset for now; will be reset later from |map= if present
end
local Periodical = A['Periodical'];
local Periodical_origin = A:ORIGIN('Periodical');
local ScriptPeriodical = A['ScriptPeriodical'];
local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical');
local TransPeriodical = A['TransPeriodical'];
local TransPeriodical_origin = A:ORIGIN ('TransPeriodical');
if (utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical))) then
local param;
if utilities.is_set (Periodical) then -- get a parameter name from one of these periodical related meta-parameters
Periodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = Periodical_origin -- get parameter name for error messaging
elseif utilities.is_set (TransPeriodical) then
TransPeriodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = TransPeriodical_origin; -- get parameter name for error messaging
elseif utilities.is_set (ScriptPeriodical) then
ScriptPeriodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = ScriptPeriodical_origin; -- get parameter name for error messaging
end
if utilities.is_set (param) then -- if we found one
utilities.set_message ('err_periodical_ignored', {param}); -- emit an error message
end
end
if utilities.is_set (Periodical) then
local i;
Periodical, i = utilities.strip_apostrophe_markup (Periodical); -- strip apostrophe markup so that metadata isn't contaminated
if i then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {Periodical_origin});
end
end
if 'mailinglist' == config.CitationClass then -- special case for {{cite mailing list}}
if utilities.is_set (Periodical) and utilities.is_set (A ['MailingList']) then -- both set emit an error TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', Periodical_origin) .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'mailinglist')});
end
Periodical = A ['MailingList']; -- error or no, set Periodical to |mailinglist= value because this template is {{cite mailing list}}
Periodical_origin = A:ORIGIN('MailingList');
end
-- web and news not tested for now because of
-- Wikipedia:Administrators%27_noticeboard#Is_there_a_semi-automated_tool_that_could_fix_these_annoying_"Cite_Web"_errors?
if not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) then -- 'periodical' templates require periodical parameter
-- local p = {['journal'] = 'journal', ['magazine'] = 'magazine', ['news'] = 'newspaper', ['web'] = 'website'}; -- for error message
local p = {['journal'] = 'journal', ['magazine'] = 'magazine'}; -- for error message
if p[config.CitationClass] then
utilities.set_message ('err_missing_periodical', {config.CitationClass, p[config.CitationClass]});
end
end
local Volume;
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) then
if not utilities.in_array (Periodical_origin, cfg.citation_no_volume_t) then -- {{citation}} does not render |volume= when these parameters are used
Volume = A['Volume']; -- but does for all other 'periodicals'
end
elseif utilities.is_set (ScriptPeriodical) then
if 'script-website' ~= ScriptPeriodical_origin then -- {{citation}} does not render volume for |script-website=
Volume = A['Volume']; -- but does for all other 'periodicals'
end
else
Volume = A['Volume']; -- and does for non-'periodical' cites
end
elseif utilities.in_array (config.CitationClass, cfg.templates_using_volume) then -- render |volume= for cs1 according to the configuration settings
Volume = A['Volume'];
end
extra_text_in_vol_iss_check (Volume, A:ORIGIN ('Volume'), 'v');
local Issue;
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) and utilities.in_array (Periodical_origin, cfg.citation_issue_t) then -- {{citation}} may render |issue= when these parameters are used
Issue = A['Issue'];
end
elseif utilities.in_array (config.CitationClass, cfg.templates_using_issue) then -- conference & map books do not support issue; {{citation}} listed here because included in settings table
if not (utilities.in_array (config.CitationClass, {'conference', 'map', 'citation'}) and not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical))) then
Issue = A['Issue'];
end
end
local ArticleNumber;
if utilities.in_array (config.CitationClass, {'journal', 'conference'}) or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then
ArticleNumber = A['ArticleNumber'];
end
extra_text_in_vol_iss_check (Issue, A:ORIGIN ('Issue'), 'i');
Issue = utilities.hyphen_to_dash (Issue);
local Page;
local Pages;
local At;
local QuotePage;
local QuotePages;
if not utilities.in_array (config.CitationClass, cfg.templates_not_using_page) then -- TODO: rewrite to emit ignored parameter error message?
Page = A['Page'];
Pages = utilities.hyphen_to_dash (A['Pages']);
At = A['At'];
QuotePage = A['QuotePage'];
QuotePages = utilities.hyphen_to_dash (A['QuotePages']);
end
local NoPP = is_valid_parameter_value (A['NoPP'], A:ORIGIN('NoPP'), cfg.keywords_lists['yes_true_y'], nil);
local Mode = mode_set (A['Mode'], A:ORIGIN('Mode'));
-- separator character and postscript
local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass);
local Quote;
Quote, QuotePage, QuotePages, PostScript = quote_make (A['Quote'], A['TransQuote'], A['ScriptQuote'], QuotePage, QuotePages, NoPP, sepc, PostScript);
local Edition = A['Edition'];
local PublicationPlace = place_check (A['PublicationPlace'], A:ORIGIN('PublicationPlace'));
local Place = place_check (A['Place'], A:ORIGIN('Place'));
local PublisherName = A['PublisherName'];
local PublisherName_origin = A:ORIGIN('PublisherName');
if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then
local i;
PublisherName, i = utilities.strip_apostrophe_markup (PublisherName); -- strip apostrophe markup so that metadata isn't contaminated; publisher is never italicized
if i and (0 < i) then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {PublisherName_origin});
end
end
if ('document' == config.CitationClass) and not utilities.is_set (PublisherName) then
utilities.set_message ('err_missing_publisher', {config.CitationClass, 'publisher'});
end
local Newsgroup = A['Newsgroup']; -- TODO: strip apostrophe markup?
local Newsgroup_origin = A:ORIGIN('Newsgroup');
if 'newsgroup' == config.CitationClass then
if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then -- general use parameter |publisher= not allowed in cite newsgroup
utilities.set_message ('err_parameter_ignored', {PublisherName_origin});
end
PublisherName = nil; -- ensure that this parameter is unset for the time being; will be used again after COinS
end
if 'book' == config.CitationClass or 'encyclopaedia' == config.CitationClass or ('citation' == config.CitationClass and not utilities.is_set (Periodical)) then
local accept;
PublisherName, accept = utilities.has_accept_as_written (PublisherName); -- check for and remove accept-as-written markup from |publisher= wrapped
if not accept then -- when no accept-as-written markup
check_publisher_name (PublisherName); -- emit maint message when |publisher= might be prefixed with publisher's location
end
end
local URL = A['URL']; -- TODO: better way to do this for URL, ChapterURL, and MapURL?
local UrlAccess = is_valid_parameter_value (A['UrlAccess'], A:ORIGIN('UrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (URL) and utilities.is_set (UrlAccess) then
UrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', 'url');
end
local ChapterURL = A['ChapterURL'];
local ChapterUrlAccess = is_valid_parameter_value (A['ChapterUrlAccess'], A:ORIGIN('ChapterUrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (ChapterURL) and utilities.is_set (ChapterUrlAccess) then
ChapterUrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', {A:ORIGIN('ChapterUrlAccess'):gsub ('%-access', '')});
end
local MapUrlAccess = is_valid_parameter_value (A['MapUrlAccess'], A:ORIGIN('MapUrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (A['MapURL']) and utilities.is_set (MapUrlAccess) then
MapUrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', {'map-url'});
end
local this_page = mw.title.getCurrentTitle(); -- also used for COinS and for language
local no_tracking_cats = is_valid_parameter_value (A['NoTracking'], A:ORIGIN('NoTracking'), cfg.keywords_lists['yes_true_y'], nil);
-- check this page to see if it is in one of the namespaces that cs1 is not supposed to add to the error categories
if not utilities.is_set (no_tracking_cats) then -- ignore if we are already not going to categorize this page
if cfg.uncategorized_namespaces[this_page.namespace] then -- is this page's namespace id one of the uncategorized namespace ids?
no_tracking_cats = "true"; -- set no_tracking_cats
end
for _, v in ipairs (cfg.uncategorized_subpages) do -- cycle through page name patterns
if this_page.text:match (v) then -- test page name against each pattern
no_tracking_cats = "true"; -- set no_tracking_cats
break; -- bail out if one is found
end
end
end
-- check for extra |page=, |pages= or |at= parameters. (also sheet and sheets while we're at it)
utilities.select_one (args, {'page', 'p', 'pp', 'pages', 'at', 'sheet', 'sheets'}, 'err_redundant_parameters'); -- this is a dummy call simply to get the error message and category
local coins_pages;
Page, Pages, At, coins_pages = insource_loc_get (Page, A:ORIGIN('Page'), Pages, A:ORIGIN('Pages'), At);
if utilities.is_set (PublicationPlace) and utilities.is_set (Place) then -- both |publication-place= and |place= (|location=) allowed if different
utilities.add_prop_cat ('location-test'); -- add property cat to evaluate how often PublicationPlace and Place are used together
if PublicationPlace == Place then
Place = ''; -- unset; don't need both if they are the same
end
elseif not utilities.is_set (PublicationPlace) and utilities.is_set (Place) then -- when only |place= (|location=) is set ...
PublicationPlace = Place; -- promote |place= (|location=) to |publication-place
end
if PublicationPlace == Place then Place = ''; end -- don't need both if they are the same
local URL_origin = A:ORIGIN('URL'); -- get name of parameter that holds URL
local ChapterURL_origin = A:ORIGIN('ChapterURL'); -- get name of parameter that holds ChapterURL
-- local ScriptChapter = A['ScriptChapter'];
-- local ScriptChapter_origin = A:ORIGIN ('ScriptChapter');
local Format = A['Format'];
local ChapterFormat = A['ChapterFormat'];
local TransChapter = A['TransChapter'];
local TransChapter_origin = A:ORIGIN ('TransChapter');
local TransTitle = A['TransTitle'];
local ScriptTitle = A['ScriptTitle'];
--[[
Parameter remapping for cite encyclopedia:
When the citation has these parameters:
|encyclopedia= and |title= then map |title= to |article= and |encyclopedia= to |title= for rendering
|encyclopedia= and |article= then map |encyclopedia= to |title= for rendering
|trans-title= maps to |trans-chapter= when |title= is re-mapped
|url= maps to |chapter-url= when |title= is remapped
All other combinations of |encyclopedia=, |title=, and |article= are not modified
]]
local Encyclopedia = A['Encyclopedia']; -- used as a flag by this module and by ~/COinS
local ScriptEncyclopedia = A['ScriptEncyclopedia'];
local TransEncyclopedia = A['TransEncyclopedia'];
if utilities.is_set (Encyclopedia) or utilities.is_set (ScriptEncyclopedia) then -- emit error message when Encyclopedia set but template is other than {{cite encyclopedia}} or {{citation}}
if 'encyclopaedia' ~= config.CitationClass and 'citation' ~= config.CitationClass then
if utilities.is_set (Encyclopedia) then
utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('Encyclopedia')});
else
utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('ScriptEncyclopedia')});
end
Encyclopedia = nil; -- unset these because not supported by this template
ScriptEncyclopedia = nil;
TransEncyclopedia = nil;
end
elseif utilities.is_set (TransEncyclopedia) then
utilities.set_message ('err_trans_missing_title', {'encyclopedia'});
end
if ('encyclopaedia' == config.CitationClass) or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then
if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then -- when both parameters set emit an error message; {{citation}} only; Periodical not allowed in {{cite encyclopedia}}
utilities.set_message ('err_periodical_ignored', {Periodical_origin});
end
if utilities.is_set (Encyclopedia) or utilities.is_set (ScriptEncyclopedia) then
Periodical = Encyclopedia; -- error or no, set Periodical to Encyclopedia for rendering; {{citation}} could (not legitimately) have both; use Encyclopedia
Periodical_origin = A:ORIGIN ('Encyclopedia');
ScriptPeriodical = ScriptEncyclopedia;
ScriptPeriodical_origin = A:ORIGIN ('ScriptEncyclopedia');
if utilities.is_set (Title) or utilities.is_set (ScriptTitle) then
if not utilities.is_set (Chapter) then
Chapter = Title; -- |encyclopedia= and |title= are set so map |title= params to |article= params for rendering
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle')
TransChapter = TransTitle;
ChapterURL = URL;
ChapterURL_origin = URL_origin;
ChapterUrlAccess = UrlAccess;
ChapterFormat = Format;
if not utilities.is_set (ChapterURL) and utilities.is_set (TitleLink) then
Chapter = utilities.make_wikilink (TitleLink, Chapter);
end
Title = Periodical; -- now map |encyclopedia= params to |title= params for rendering
ScriptTitle = ScriptPeriodical or '';
TransTitle = TransEncyclopedia or '';
Periodical = ''; -- redundant so unset
ScriptPeriodical = '';
URL = '';
Format = '';
TitleLink = '';
end
elseif utilities.is_set (Chapter) or utilities.is_set (ScriptChapter) then -- |title= not set
Title = Periodical; -- |encyclopedia= set and |article= set so map |encyclopedia= to |title= for rendering
ScriptTitle = ScriptPeriodical or '';
TransTitle = TransEncyclopedia or '';
Periodical = ''; -- redundant so unset
ScriptPeriodical = '';
end
end
end
-- special case for cite techreport.
local ID = A['ID'];
if (config.CitationClass == "techreport") then -- special case for cite techreport
if utilities.is_set (A['Number']) then -- cite techreport uses 'number', which other citations alias to 'issue'
if not utilities.is_set (ID) then -- can we use ID for the "number"?
ID = A['Number']; -- yes, use it
else -- ID has a value so emit error message
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'id') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'number')});
end
end
end
-- Account for the oddity that is {{cite conference}}, before generation of COinS data.
local ChapterLink -- = A['ChapterLink']; -- deprecated as a parameter but still used internally by cite episode
local Conference = A['Conference'];
local BookTitle = A['BookTitle'];
local TransTitle_origin = A:ORIGIN ('TransTitle');
if 'conference' == config.CitationClass then
if utilities.is_set (BookTitle) then
Chapter = Title;
Chapter_origin = 'title';
-- ChapterLink = TitleLink; -- |chapter-link= is deprecated
ChapterURL = URL;
ChapterUrlAccess = UrlAccess;
ChapterURL_origin = URL_origin;
URL_origin = '';
ChapterFormat = Format;
TransChapter = TransTitle;
TransChapter_origin = TransTitle_origin;
Title = BookTitle;
Format = '';
-- TitleLink = '';
TransTitle = '';
URL = '';
end
elseif 'speech' ~= config.CitationClass then
Conference = ''; -- not cite conference or cite speech so make sure this is empty string
end
local cs2_lower = function (text) -- if mode is cs2, use lower case
if (sepc ~= '.') then
return text:lower();
end
return text;
end
local use_lowercase = ( sepc == ',' ); -- controls capitalization of certain static text
-- cite map oddities
local Cartography = "";
local Scale = "";
local Sheet = A['Sheet'] or '';
local Sheets = A['Sheets'] or '';
if config.CitationClass == "map" then
if utilities.is_set (Chapter) then --TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'map') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', Chapter_origin)}); -- add error message
end
Chapter = A['Map'];
Chapter_origin = A:ORIGIN('Map'); -- for now, ignore linter warning
ChapterURL = A['MapURL'];
ChapterURL_origin = A:ORIGIN('MapURL');
TransChapter = A['TransMap'];
ScriptChapter = A['ScriptMap']
ScriptChapter_origin = A:ORIGIN('ScriptMap')
ChapterUrlAccess = MapUrlAccess;
ChapterFormat = A['MapFormat'];
Cartography = A['Cartography'];
if utilities.is_set ( Cartography ) then
Cartography = sepc .. " " .. wrap_msg ('cartography', Cartography, use_lowercase);
end
Scale = A['Scale'];
if utilities.is_set ( Scale ) then
Scale = sepc .. " " .. Scale;
end
end
-- Account for the oddities that are {{cite episode}} and {{cite serial}}, before generation of COinS data.
local Series = A['Series'];
if 'episode' == config.CitationClass or 'serial' == config.CitationClass then
local SeriesLink = A['SeriesLink'];
SeriesLink = link_title_ok (SeriesLink, A:ORIGIN ('SeriesLink'), Series, 'series'); -- check for wiki-markup in |series-link= or wiki-markup in |series= when |series-link= is set
local Network = A['Network'];
local Station = A['Station'];
local s, n = {}, {};
-- do common parameters first
if utilities.is_set (Network) then table.insert(n, Network); end
if utilities.is_set (Station) then table.insert(n, Station); end
ID = table.concat(n, sepc .. ' ');
if 'episode' == config.CitationClass then -- handle the oddities that are strictly {{cite episode}}
local Season = A['Season'];
local SeriesNumber = A['SeriesNumber'];
if utilities.is_set (Season) and utilities.is_set (SeriesNumber) then -- these are mutually exclusive so if both are set TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'season') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'seriesno')}); -- add error message
SeriesNumber = ''; -- unset; prefer |season= over |seriesno=
end
-- assemble a table of parts concatenated later into Series
if utilities.is_set (Season) then table.insert(s, wrap_msg ('season', Season, use_lowercase)); end
if utilities.is_set (SeriesNumber) then table.insert(s, wrap_msg ('seriesnum', SeriesNumber, use_lowercase)); end
if utilities.is_set (Issue) then table.insert(s, wrap_msg ('episode', Issue, use_lowercase)); end
Issue = ''; -- unset because this is not a unique parameter
Chapter = Title; -- promote title parameters to chapter
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle');
ChapterLink = TitleLink; -- alias |episode-link=
TransChapter = TransTitle;
ChapterURL = URL;
ChapterUrlAccess = UrlAccess;
ChapterURL_origin = URL_origin;
ChapterFormat = Format;
Title = Series; -- promote series to title
TitleLink = SeriesLink;
Series = table.concat(s, sepc .. ' '); -- this is concatenation of season, seriesno, episode number
if utilities.is_set (ChapterLink) and not utilities.is_set (ChapterURL) then -- link but not URL
Chapter = utilities.make_wikilink (ChapterLink, Chapter);
elseif utilities.is_set (ChapterLink) and utilities.is_set (ChapterURL) then -- if both are set, URL links episode;
Series = utilities.make_wikilink (ChapterLink, Series);
end
URL = ''; -- unset
TransTitle = '';
ScriptTitle = '';
Format = '';
else -- now oddities that are cite serial
Issue = ''; -- unset because this parameter no longer supported by the citation/core version of cite serial
Chapter = A['Episode']; -- TODO: make |episode= available to cite episode someday?
if utilities.is_set (Series) and utilities.is_set (SeriesLink) then
Series = utilities.make_wikilink (SeriesLink, Series);
end
Series = utilities.wrap_style ('italic-title', Series); -- series is italicized
end
end
-- end of {{cite episode}} stuff
-- handle type parameter for those CS1 citations that have default values
local TitleType = A['TitleType'];
local Degree = A['Degree'];
if utilities.in_array (config.CitationClass, {'AV-media-notes', 'document', 'interview', 'mailinglist', 'map', 'podcast', 'pressrelease', 'report', 'speech', 'techreport', 'thesis'}) then
TitleType = set_titletype (config.CitationClass, TitleType);
if utilities.is_set (Degree) and "Thesis" == TitleType then -- special case for cite thesis
TitleType = Degree .. ' ' .. cfg.title_types ['thesis']:lower();
end
end
if utilities.is_set (TitleType) then -- if type parameter is specified
TitleType = utilities.substitute ( cfg.messages['type'], TitleType); -- display it in parentheses
-- TODO: Hack on TitleType to fix bunched parentheses problem
end
-- legacy: promote PublicationDate to Date if neither Date nor Year are set.
local Date = A['Date'];
local Date_origin; -- to hold the name of parameter promoted to Date; required for date error messaging
local PublicationDate = A['PublicationDate'];
local Year = A['Year'];
if utilities.is_set (Year) then
validation.year_check (Year); -- returns nothing; emits maint message when |year= doesn't hold a 'year' value
end
if not utilities.is_set (Date) then
Date = Year; -- promote Year to Date
Year = nil; -- make nil so Year as empty string isn't used for CITEREF
if not utilities.is_set (Date) and utilities.is_set (PublicationDate) then -- use PublicationDate when |date= and |year= are not set
Date = PublicationDate; -- promote PublicationDate to Date
PublicationDate = ''; -- unset, no longer needed
Date_origin = A:ORIGIN('PublicationDate'); -- save the name of the promoted parameter
else
Date_origin = A:ORIGIN('Year'); -- save the name of the promoted parameter
end
else
Date_origin = A:ORIGIN('Date'); -- not a promotion; name required for error messaging
end
if PublicationDate == Date then PublicationDate = ''; end -- if PublicationDate is same as Date, don't display in rendered citation
--[[
Go test all of the date-holding parameters for valid MOS:DATE format and make sure that dates are real dates. This must be done before we do COinS because here is where
we get the date used in the metadata.
Date validation supporting code is in Module:Citation/CS1/Date_validation
]]
local DF = is_valid_parameter_value (A['DF'], A:ORIGIN('DF'), cfg.keywords_lists['df'], '');
if not utilities.is_set (DF) then
DF = cfg.global_df; -- local |df= if present overrides global df set by {{use xxx date}} template
end
local ArchiveURL;
local ArchiveDate;
local ArchiveFormat = A['ArchiveFormat'];
local archive_url_timestamp; -- timestamp from wayback machine url
ArchiveURL, ArchiveDate, archive_url_timestamp = archive_url_check (A['ArchiveURL'], A['ArchiveDate'])
ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, 'archive-format', 'archive-url');
ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN('ArchiveURL'), ArchiveDate); -- add error message when URL or ChapterURL == ArchiveURL
local AccessDate = A['AccessDate'];
local COinS_date = {}; -- holds date info extracted from |date= for the COinS metadata by Module:Date verification
local DoiBroken = A['DoiBroken'];
local Embargo = A['Embargo'];
local anchor_year; -- used in the CITEREF identifier
do -- create defined block to contain local variables date_parameters_list, mismatch
local date_parameters_list = { -- AirDate has been promoted to Date so not necessary to check it
['access-date'] = {val = AccessDate, name = A:ORIGIN ('AccessDate')},
['archive-date'] = {val = ArchiveDate, name = A:ORIGIN ('ArchiveDate')},
['date'] = {val = Date, name = Date_origin},
['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')},
['pmc-embargo-date'] = {val = Embargo, name = A:ORIGIN ('Embargo')},
['publication-date'] = {val = PublicationDate, name = A:ORIGIN ('PublicationDate')},
['year'] = {val = Year, name = A:ORIGIN ('Year')},
};
local error_list = {};
anchor_year, Embargo = validation.dates(date_parameters_list, COinS_date, error_list);
if utilities.is_set (Year) and utilities.is_set (Date) then -- both |date= and |year= not normally needed;
validation.year_date_check (Year, A:ORIGIN ('Year'), Date, A:ORIGIN ('Date'), error_list);
end
if 0 == #error_list then -- error free dates only; 0 when error_list is empty
local modified = false; -- flag
if utilities.is_set (DF) then -- if we need to reformat dates
modified = validation.reformat_dates (date_parameters_list, DF); -- reformat to DF format, use long month names if appropriate
end
if true == validation.date_hyphen_to_dash (date_parameters_list) then -- convert hyphens to dashes where appropriate
modified = true;
utilities.set_message ('maint_date_format'); -- hyphens were converted so add maint category
end
-- for those wikis that can and want to have English date names translated to the local language; not supported at en.wiki
if cfg.date_name_auto_xlate_enable and validation.date_name_xlate (date_parameters_list, cfg.date_digit_auto_xlate_enable ) then
utilities.set_message ('maint_date_auto_xlated'); -- add maint cat
modified = true;
end
if modified then -- if the date_parameters_list values were modified
AccessDate = date_parameters_list['access-date'].val; -- overwrite date holding parameters with modified values
ArchiveDate = date_parameters_list['archive-date'].val;
Date = date_parameters_list['date'].val;
DoiBroken = date_parameters_list['doi-broken-date'].val;
PublicationDate = date_parameters_list['publication-date'].val;
end
if archive_url_timestamp and utilities.is_set (ArchiveDate) then
validation.archive_date_check (ArchiveDate, archive_url_timestamp, DF); -- does YYYYMMDD in archive_url_timestamp match date in ArchiveDate
end
else
utilities.set_message ('err_bad_date', {utilities.make_sep_list (#error_list, error_list)}); -- add this error message
end
end -- end of do
if utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) or -- {{cite book}}, {{cite encyclopedia}}; TODO: {{cite conference}} and others?
('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) or -- {{citation}} as an encylopedia citation
('citation' == config.CitationClass and not utilities.is_set (Periodical)) then -- {{citation}} as a book citation
if utilities.is_set (PublicationPlace) then
if not utilities.is_set (PublisherName) then
local date = COinS_date.rftdate and tonumber (COinS_date.rftdate:match ('%d%d%d%d')); -- get year portion of COinS date (because in Arabic numerals); convert string to number
if date and (1850 <= date) then -- location has no publisher; if date is 1850 or later
utilities.set_message ('maint_location_no_publisher'); -- add maint cat
end
else -- PublisherName has a value
if cfg.keywords_xlate['none'] == PublisherName then -- if that value is 'none' (only for book and encyclopedia citations)
PublisherName = ''; -- unset
end
end
end
end
local ID_list_t; -- sequence table of rendered identifiers
local ID_list_coins_t; -- table of identifiers and their values from args; key is same as cfg.id_handlers's key
local Class = A['Class']; -- arxiv class identifier
local ID_support = {
{A['ASINTLD'], 'ASIN', 'err_asintld_missing_asin', A:ORIGIN ('ASINTLD')},
{DoiBroken, 'DOI', 'err_doibroken_missing_doi', A:ORIGIN ('DoiBroken')},
{Embargo, 'PMC', 'err_embargo_missing_pmc', A:ORIGIN ('Embargo')},
}
ID_list_t, ID_list_coins_t = identifiers.identifier_lists_get (args, {
DoiBroken = DoiBroken, -- for |doi=
ASINTLD = A['ASINTLD'], -- for |asin=
Embargo = Embargo, -- for |pmc=
Class = Class, -- for |arxiv=
CitationClass = config.CitationClass, -- for |arxiv=
Year=anchor_year, -- for |isbn=
}, ID_support);
for _, id in ipairs (ID_list_t) do -- search through the ID_list_t sequence looking for an ISBN identifier string
if id:find ('ISBN', 3, true) then -- plain find, start at index 3 ([[ISBN)
if 'citation' == config.CitationClass then -- catch ve/citoid malformed book cites in {{citation}} templates
if utilities.is_set (Periodical) then -- when a |work= alias is set
utilities.set_message ('maint_work_isbn'); -- add maint cat
break; -- and abandon
end
elseif ({['journal'] = true, ['magazine'] = true, ['news'] = true, ['web'] = true})[config.CitationClass] then
utilities.set_message ('maint_periodical_has_isbn'); -- add maint cat
break; -- and abandon
end
end
end
-- if 'citation' == config.CitationClass then -- catch ve/citoid malformed book cites in {{citation}} templates
-- for _, id in ipairs (ID_list_t) do -- search through the ID_list_t sequence looking for an ISBN identifier string
-- if id:find ('ISBN', 3, true) then -- plain find, start at index 3 ([[ISBN)
-- if utilities.is_set (Periodical) then -- when a |work= alias is set
-- utilities.set_message ('maint_work_isbn'); -- add maint cat
-- end
-- end
-- end
-- end
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, {{cite ssrn}}, before generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then -- |arxiv= or |eprint= required for cite arxiv; |biorxiv=, |citeseerx=, |medrxiv=, |ssrn= required for their templates
if not (args[cfg.id_handlers[config.CitationClass:upper()].parameters[1]] or -- can't use ID_list_coins_t k/v table here because invalid parameters omitted
args[cfg.id_handlers[config.CitationClass:upper()].parameters[2]]) then -- which causes unexpected parameter missing error message
utilities.set_message ('err_' .. config.CitationClass .. '_missing'); -- add error message
end
Periodical = ({['arxiv'] = 'arXiv', ['biorxiv'] = 'bioRxiv', ['citeseerx'] = 'CiteSeerX', ['medrxiv'] = 'medRxiv', ['ssrn'] = 'Social Science Research Network'})[config.CitationClass];
end
-- Link the title of the work if no |url= was provided, but we have a |pmc= or a |doi= with |doi-access=free
if config.CitationClass == "journal" and not utilities.is_set (URL) and not utilities.is_set (TitleLink) and not utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) then -- TODO: remove 'none' once existing citations have been switched to 'off', so 'none' can be used as token for "no title" instead
if 'none' ~= cfg.keywords_xlate[auto_select] then -- if auto-linking not disabled
if identifiers.auto_link_urls[auto_select] then -- manual selection
URL = identifiers.auto_link_urls[auto_select]; -- set URL to be the same as identifier's external link
URL_origin = cfg.id_handlers[auto_select:upper()].parameters[1]; -- set URL_origin to parameter name for use in error message if citation is missing a |title=
elseif identifiers.auto_link_urls['pmc'] then -- auto-select PMC
URL = identifiers.auto_link_urls['pmc']; -- set URL to be the same as the PMC external link if not embargoed
URL_origin = cfg.id_handlers['PMC'].parameters[1]; -- set URL_origin to parameter name for use in error message if citation is missing a |title=
elseif identifiers.auto_link_urls['doi'] then -- auto-select DOI
URL = identifiers.auto_link_urls['doi'];
URL_origin = cfg.id_handlers['DOI'].parameters[1];
end
end
if utilities.is_set (URL) then -- set when using an identifier-created URL
if utilities.is_set (AccessDate) then -- |access-date= requires |url=; identifier-created URL is not |url=
utilities.set_message ('err_accessdate_missing_url'); -- add an error message
AccessDate = ''; -- unset
end
if utilities.is_set (ArchiveURL) then -- |archive-url= requires |url=; identifier-created URL is not |url=
utilities.set_message ('err_archive_missing_url'); -- add an error message
ArchiveURL = ''; -- unset
end
end
end
-- At this point fields may be nil if they weren't specified in the template use. We can use that fact.
-- Test if citation has no title
if not utilities.is_set (Title) and not utilities.is_set (TransTitle) and not utilities.is_set (ScriptTitle) then -- has special case for cite episode
utilities.set_message ('err_citation_missing_title', {'episode' == config.CitationClass and 'series' or 'title'});
end
if utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) and
utilities.in_array (config.CitationClass, {'journal', 'citation'}) and
(utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and
('journal' == Periodical_origin or 'script-journal' == ScriptPeriodical_origin) then -- special case for journal cites
Title = ''; -- set title to empty string
utilities.set_message ('maint_untitled'); -- add maint cat
end
if 'journal' == config.CitationClass or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then
if is_page_art_num (((utilities.is_set (Page) and Page) or (utilities.is_set (Pages) and Pages)) or nil, ID_list_coins_t['DOI']) then -- does |page(s)= look like it holds an article number
utilities.set_message ('maint_page_art_num'); -- add maint cat
end
end
-- COinS metadata (see <http://ocoins.info/>) for automated parsing of citation information.
-- handle the oddity that is cite encyclopedia and {{citation |encyclopedia=something}}. Here we presume that
-- when Periodical, Title, and Chapter are all set, then Periodical is the book (encyclopedia) title, Title
-- is the article title, and Chapter is a section within the article. So, we remap
local coins_chapter = Chapter; -- default assuming that remapping not required
local coins_title = Title; -- et tu
if 'encyclopaedia' == config.CitationClass or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then
if utilities.is_set (Chapter) and utilities.is_set (Title) and utilities.is_set (Periodical) then -- if all are used then
coins_chapter = Title; -- remap
coins_title = Periodical;
end
end
local coins_author = a; -- default for coins rft.au
if 0 < #c then -- but if contributor list
coins_author = c; -- use that instead
end
-- this is the function call to COinS()
local OCinSoutput = metadata.COinS({
['Periodical'] = utilities.strip_apostrophe_markup (Periodical), -- no markup in the metadata
['Encyclopedia'] = Encyclopedia, -- just a flag; content ignored by ~/COinS
['Chapter'] = metadata.make_coins_title (coins_chapter, ScriptChapter), -- Chapter and ScriptChapter stripped of bold / italic / accept-as-written markup
['Degree'] = Degree; -- cite thesis only
['Title'] = metadata.make_coins_title (coins_title, ScriptTitle), -- Title and ScriptTitle stripped of bold / italic / accept-as-written markup
['PublicationPlace'] = PublicationPlace,
['Date'] = COinS_date.rftdate, -- COinS_date.* has correctly formatted date values if Date is valid;
['Season'] = COinS_date.rftssn,
['Quarter'] = COinS_date.rftquarter,
['Chron'] = COinS_date.rftchron,
['Series'] = Series,
['Volume'] = Volume,
['Issue'] = Issue,
['ArticleNumber'] = ArticleNumber,
['Pages'] = coins_pages or metadata.get_coins_pages (first_set ({Sheet, Sheets, Page, Pages, At, QuotePage, QuotePages}, 7)), -- pages stripped of external links
['Edition'] = Edition,
['PublisherName'] = PublisherName or Newsgroup, -- any apostrophe markup already removed from PublisherName
['URL'] = first_set ({ChapterURL, URL}, 2),
['Authors'] = coins_author,
['ID_list'] = ID_list_coins_t,
['RawPage'] = this_page.prefixedText,
}, config.CitationClass);
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, and {{cite ssrn}} AFTER generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then -- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, medRxiv, or ssrn now unset so it isn't displayed
Periodical = ''; -- periodical not allowed in these templates; if article has been published, use cite journal
end
-- special case for cite newsgroup. Do this after COinS because we are modifying Publishername to include some static text
if 'newsgroup' == config.CitationClass and utilities.is_set (Newsgroup) then
PublisherName = utilities.substitute (cfg.messages['newsgroup'], external_link( 'news:' .. Newsgroup, Newsgroup, Newsgroup_origin, nil ));
end
local Editors;
local EditorCount; -- used only for choosing {ed.) or (eds.) annotation at end of editor name-list
local Contributors; -- assembled contributors name list
local contributor_etal = nil; -- must be intentionally initialized
local Translators; -- assembled translators name list
local translator_etal = nil; -- must be intentionally initialized
local t = extract_names (args, 'TranslatorList'); -- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn=
local Interviewers;
local interviewers_list = extract_names (args, 'InterviewerList'); -- process preferred interviewers parameters
local interviewer_etal = nil; -- must be intentionally initialized
-- Now perform various field substitutions.
-- We also add leading spaces and surrounding markup and punctuation to the
-- various parts of the citation, but only when they are non-nil.
do
local last_first_list;
local control = {
format = NameListStyle, -- empty string, '&', 'amp', 'and', or 'vanc'
maximum = nil, -- as if display-authors or display-editors not set
mode = Mode
};
do -- do editor name list first because the now unsupported coauthors used to modify control table
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayEditors'], A['DisplayEditors'], A:ORIGIN ('DisplayEditors'), #e);
control.maximum, editor_etal = get_display_names (display_names, #e, editor_etal, param);
Editors, EditorCount = list_people (control, e, editor_etal);
if 1 == EditorCount and (true == editor_etal or 1 < #e) then -- only one editor displayed but includes etal then
EditorCount = 2; -- spoof to display (eds.) annotation
end
end
do -- now do interviewers
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayInterviewers'], A['DisplayInterviewers'], A:ORIGIN ('DisplayInterviewers'), #interviewers_list);
control.maximum, interviewer_etal = get_display_names (display_names, #interviewers_list, interviewer_etal, param);
Interviewers = list_people (control, interviewers_list, interviewer_etal);
end
do -- now do translators
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayTranslators'], A['DisplayTranslators'], A:ORIGIN ('DisplayTranslators'), #t);
control.maximum, translator_etal = get_display_names (display_names, #t, translator_etal, param);
Translators = list_people (control, t, translator_etal);
end
do -- now do contributors
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayContributors'], A['DisplayContributors'], A:ORIGIN ('DisplayContributors'), #c);
control.maximum, contributor_etal = get_display_names (display_names, #c, contributor_etal, param);
Contributors = list_people (control, c, contributor_etal);
end
do -- now do authors
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayAuthors'], A['DisplayAuthors'], A:ORIGIN ('DisplayAuthors'), #a, author_etal);
control.maximum, author_etal = get_display_names (display_names, #a, author_etal, param);
last_first_list = list_people (control, a, author_etal);
if utilities.is_set (Authors) then
Authors, author_etal = name_has_etal (Authors, author_etal, false, 'authors'); -- find and remove variations on et al.
if author_etal then
Authors = Authors .. ' ' .. cfg.messages['et al']; -- add et al. to authors parameter
end
else
Authors = last_first_list; -- either an author name list or an empty string
end
end -- end of do
if utilities.is_set (Authors) and utilities.is_set (Collaboration) then
Authors = utilities.substitute (cfg.messages['collaboration'], {Authors, Collaboration}); -- add collaboration after et al.
end
end
local ConferenceFormat = A['ConferenceFormat'];
local ConferenceURL = A['ConferenceURL'];
ConferenceFormat = style_format (ConferenceFormat, ConferenceURL, 'conference-format', 'conference-url');
Format = style_format (Format, URL, 'format', 'url');
-- special case for chapter format so no error message or cat when chapter not supported
if not (utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia))) then
ChapterFormat = style_format (ChapterFormat, ChapterURL, 'chapter-format', 'chapter-url');
end
if not utilities.is_set (URL) then
if utilities.in_array (config.CitationClass, {"web", "podcast", "mailinglist"}) or -- |url= required for {{cite web}}, {{cite podcast}}, and {{cite mailing list}}
('citation' == config.CitationClass and ('website' == Periodical_origin or 'script-website' == ScriptPeriodical_origin)) then -- and required for {{citation}} with |website= or |script-website=
if not url_was_archive_today then -- is <URL> empty/missing because it was a deprecated archive.today url
utilities.set_message ('err_cite_web_url'); -- no; emit an error message for an empty/ missing |url=
end
end
-- do we have |accessdate= without either |url= or |chapter-url=?
if utilities.is_set (AccessDate) and not utilities.is_set (ChapterURL) then -- ChapterURL may be set when URL is not set;
utilities.set_message ('err_accessdate_missing_url');
AccessDate = '';
end
end
local UrlStatus = is_valid_parameter_value (A['UrlStatus'], A:ORIGIN('UrlStatus'), cfg.keywords_lists['url-status'], '');
local OriginalURL
local OriginalURL_origin
local OriginalFormat
local OriginalAccess;
UrlStatus = UrlStatus:lower(); -- used later when assembling archived text
if utilities.is_set ( ArchiveURL ) then
if utilities.is_set (ChapterURL) then -- if chapter-url= is set apply archive url to it
OriginalURL = ChapterURL; -- save copy of source chapter's url for archive text
OriginalURL_origin = ChapterURL_origin; -- name of |chapter-url= parameter for error messages
OriginalFormat = ChapterFormat; -- and original |chapter-format=
if 'live' ~= UrlStatus then
ChapterURL = ArchiveURL -- swap-in the archive's URL
ChapterURL_origin = A:ORIGIN('ArchiveURL') -- name of |archive-url= parameter for error messages
ChapterFormat = ArchiveFormat or ''; -- swap in archive's format
ChapterUrlAccess = nil; -- restricted access levels do not make sense for archived URLs
end
elseif utilities.is_set (URL) then
OriginalURL = URL; -- save copy of original source URL
OriginalURL_origin = URL_origin; -- name of URL parameter for error messages
OriginalFormat = Format; -- and original |format=
OriginalAccess = UrlAccess;
if 'live' ~= UrlStatus then -- if URL set then |archive-url= applies to it
URL = ArchiveURL -- swap-in the archive's URL
URL_origin = A:ORIGIN('ArchiveURL') -- name of archive URL parameter for error messages
Format = ArchiveFormat or ''; -- swap in archive's format
UrlAccess = nil; -- restricted access levels do not make sense for archived URLs
end
end
elseif utilities.is_set (UrlStatus) then -- if |url-status= is set when |archive-url= is not set
utilities.set_message ('maint_url_status'); -- add maint cat
end
if utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or -- if any of the 'periodical' cites except encyclopedia
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) then
local chap_param;
if utilities.is_set (Chapter) then -- get a parameter name from one of these chapter related meta-parameters
chap_param = A:ORIGIN ('Chapter')
elseif utilities.is_set (TransChapter) then
chap_param = A:ORIGIN ('TransChapter')
elseif utilities.is_set (ChapterURL) then
chap_param = A:ORIGIN ('ChapterURL')
elseif utilities.is_set (ScriptChapter) then
chap_param = ScriptChapter_origin;
else utilities.is_set (ChapterFormat)
chap_param = A:ORIGIN ('ChapterFormat')
end
if utilities.is_set (chap_param) then -- if we found one
utilities.set_message ('err_chapter_ignored', {chap_param}); -- add error message
Chapter = ''; -- and set them to empty string to be safe with concatenation
TransChapter = ''; -- for now, ignore linter warnings
ChapterURL = '';
ScriptChapter = '';
ChapterFormat = '';
end
else -- otherwise, format chapter / article title
local no_quotes = false; -- default assume that we will be quoting the chapter parameter value
if utilities.is_set (Contribution) and 0 < #c then -- if this is a contribution with contributor(s)
if utilities.in_array (Contribution:lower(), cfg.keywords_lists.contribution) then -- and a generic contribution title
no_quotes = true; -- then render it unquoted
end
end
Chapter = format_chapter_title (ScriptChapter, ScriptChapter_origin, Chapter, TransChapter, TransChapter_origin, ChapterURL, ChapterURL_origin, no_quotes, ChapterUrlAccess); -- Contribution is also in Chapter
if utilities.is_set (Chapter) then
Chapter = Chapter .. ChapterFormat ;
if 'map' == config.CitationClass and utilities.is_set (TitleType) then
Chapter = Chapter .. ' ' .. TitleType; -- map annotation here; not after title
end
Chapter = Chapter .. sepc .. ' ';
elseif utilities.is_set (ChapterFormat) then -- |chapter= not set but |chapter-format= is so ...
Chapter = ChapterFormat .. sepc .. ' '; -- ... ChapterFormat has error message, we want to see it
end
end
-- Format main title
local plain_title = false;
local accept_title;
Title, accept_title = utilities.has_accept_as_written (Title, true); -- remove accept-this-as-written markup when it wraps all of <Title>
if accept_title and ('' == Title) then -- only support forced empty for now "(())"
Title = cfg.messages['notitle']; -- replace by predefined "No title" message
-- TODO: utilities.set_message ( 'err_redundant_parameters', ...); -- issue proper error message instead of muting
ScriptTitle = ''; -- just mute for now
TransTitle = ''; -- just mute for now
plain_title = true; -- suppress text decoration for descriptive title
utilities.set_message ('maint_untitled'); -- add maint cat
end
if not accept_title then -- <Title> not wrapped in accept-as-written markup
if '...' == Title:sub (-3) then -- if ellipsis is the last three characters of |title=
Title = Title:gsub ('(%.%.%.)%.+$', '%1'); -- limit the number of dots to three
elseif not mw.ustring.find (Title, '%.%s*%a%.$') and -- end of title is not a 'dot-(optional space-)letter-dot' initialism ...
not mw.ustring.find (Title, '%s+%a%.$') then -- ...and not a 'space-letter-dot' initial (''Allium canadense'' L.)
Title = mw.ustring.gsub(Title, '%' .. sepc .. '$', ''); -- remove any trailing separator character; sepc and ms.ustring() here for languages that use multibyte separator characters
end
if utilities.is_set (ArchiveURL) and is_archived_copy (Title) then
utilities.set_message ('maint_archived_copy'); -- add maintenance category before we modify the content of Title
end
if is_generic ('generic_titles', Title) then
utilities.set_message ('err_generic_title'); -- set an error message
end
end
if (not plain_title) and (utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'document', 'pressrelease', 'podcast', 'newsgroup', 'mailinglist', 'interview', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) or
('map' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)))) then -- special case for cite map when the map is in a periodical treat as an article
Title = kern_quotes (Title); -- if necessary, separate title's leading and trailing quote marks from module provided quote marks
Title = utilities.wrap_style ('quoted-title', Title);
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle );
elseif plain_title or ('report' == config.CitationClass) then -- no styling for cite report and descriptive titles (otherwise same as above)
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle ); -- for cite report, use this form for trans-title
else
Title = utilities.wrap_style ('italic-title', Title);
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-italic-title', TransTitle);
end
if utilities.is_set (TransTitle) then
if utilities.is_set (Title) then
TransTitle = " " .. TransTitle;
else
utilities.set_message ('err_trans_missing_title', {'title'});
end
end
if utilities.is_set (Title) then -- TODO: is this the right place to be making Wikisource URLs?
if utilities.is_set (TitleLink) and utilities.is_set (URL) then
utilities.set_message ('err_wikilink_in_url'); -- set an error message because we can't have both
TitleLink = ''; -- unset
end
if not utilities.is_set (TitleLink) and utilities.is_set (URL) then
Title = external_link (URL, Title, URL_origin, UrlAccess) .. TransTitle .. Format;
URL = ''; -- unset these because no longer needed
Format = ''; -- for now, ignore linter warning
elseif utilities.is_set (TitleLink) and not utilities.is_set (URL) then
local ws_url;
ws_url = wikisource_url_make (TitleLink); -- ignore ws_label return; not used here
if ws_url then
Title = external_link (ws_url, Title .. ' ', 'ws link in title-link'); -- space char after Title to move icon away from italic text; TODO: a better way to do this?
Title = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], TitleLink, Title});
Title = Title .. TransTitle;
else
Title = utilities.make_wikilink (TitleLink, Title) .. TransTitle;
end
else
local ws_url, ws_label, L; -- Title has italic or quote markup by the time we get here which causes is_wikilink() to return 0 (not a wikilink)
ws_url, ws_label, L = wikisource_url_make (Title:gsub('^[\'"]*(.-)[\'"]*$', '%1')); -- make ws URL from |title= interwiki link (strip italic or quote markup); link portion L becomes tooltip label
if ws_url then
Title = Title:gsub ('%b[]', ws_label); -- replace interwiki link with ws_label to retain markup
Title = external_link (ws_url, Title .. ' ', 'ws link in title'); -- space char after Title to move icon away from italic text; TODO: a better way to do this?
Title = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, Title});
Title = Title .. TransTitle;
else
Title = Title .. TransTitle;
end
end
else
Title = TransTitle;
end
if utilities.is_set (Place) then
Place = " " .. wrap_msg ('written', Place, use_lowercase) .. sepc .. " ";
end
local ConferenceURL_origin = A:ORIGIN('ConferenceURL'); -- get name of parameter that holds ConferenceURL
if utilities.is_set (Conference) then
if utilities.is_set (ConferenceURL) then
Conference = external_link( ConferenceURL, Conference, ConferenceURL_origin, nil );
end
Conference = sepc .. " " .. Conference .. ConferenceFormat;
elseif utilities.is_set (ConferenceURL) then
Conference = sepc .. " " .. external_link( ConferenceURL, nil, ConferenceURL_origin, nil );
end
local Position = '';
if not utilities.is_set (Position) then
local Minutes = A['Minutes'];
local Time = A['Time'];
if utilities.is_set (Minutes) then
if utilities.is_set (Time) then --TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'minutes') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'time')});
end
Position = utilities.substitute (cfg.messages.minutes, Minutes);
else
if utilities.is_set (Time) then
local TimeCaption = A['TimeCaption']
if not utilities.is_set (TimeCaption) then
TimeCaption = cs2_lower(cfg.messages['event']);
end
Position = " " .. TimeCaption .. " " .. Time;
end
end
else
Position = " " .. Position;
At = '';
end
Page, Pages, Sheet, Sheets = format_pages_sheets (Page, Pages, Sheet, Sheets, config.CitationClass, Periodical_origin, sepc, NoPP, use_lowercase);
At = utilities.is_set (At) and (sepc .. " " .. At) or "";
Position = utilities.is_set (Position) and (sepc .. " " .. Position) or "";
if config.CitationClass == 'map' then
local Sections = A['Sections']; -- Section (singular) is an alias of Chapter so set earlier
local Inset = A['Inset'];
if utilities.is_set ( Inset ) then
Inset = sepc .. " " .. wrap_msg ('inset', Inset, use_lowercase);
end
if utilities.is_set ( Sections ) then
Section = sepc .. " " .. wrap_msg ('sections', Sections, use_lowercase);
elseif utilities.is_set ( Section ) then
Section = sepc .. " " .. wrap_msg ('section', Section, use_lowercase);
end
At = At .. Inset .. Section;
end
local Others = A['Others'];
if utilities.is_set (Others) and 0 == #a and 0 == #e then -- add maint cat when |others= has value and used without |author=, |editor=
if config.CitationClass == "AV-media-notes"
or config.CitationClass == "audio-visual" then -- special maint for AV/M which has a lot of 'false' positives right now
utilities.set_message ('maint_others_avm')
else
utilities.set_message ('maint_others');
end
end
Others = utilities.is_set (Others) and (sepc .. " " .. Others) or "";
if utilities.is_set (Translators) then
Others = safe_join ({sepc .. ' ', wrap_msg ('translated', Translators, use_lowercase), Others}, sepc);
end
if utilities.is_set (Interviewers) then
Others = safe_join ({sepc .. ' ', wrap_msg ('interview', Interviewers, use_lowercase), Others}, sepc);
end
local TitleNote = A['TitleNote'];
TitleNote = utilities.is_set (TitleNote) and (sepc .. " " .. TitleNote) or "";
if utilities.is_set (Edition) then
if Edition:match ('%f[%a][Ee]d%n?%.?$') or Edition:match ('%f[%a][Ee]dition$') then -- Ed, ed, Ed., ed., Edn, edn, Edn., edn.
utilities.set_message ('err_extra_text_edition'); -- add error message
end
Edition = " " .. wrap_msg ('edition', Edition);
else
Edition = '';
end
Series = utilities.is_set (Series) and wrap_msg ('series', {sepc, Series}) or ""; -- not the same as SeriesNum
local Agency = A['Agency'] or ''; -- |agency= is supported by {{cite magazine}}, {{cite news}}, {{cite press release}}, {{cite web}}, and certain {{citation}} templates
if utilities.is_set (Agency) then -- this testing done here because {{citation}} supports 'news' citations
if utilities.in_array (config.CitationClass, {'magazine', 'news', 'pressrelease', 'web'}) or ('citation' == config.CitationClass and utilities.in_array (Periodical_origin, {"magazine", "newspaper", "work"})) then
Agency = wrap_msg ('agency', {sepc, Agency}); -- format for rendering
else
Agency = ''; -- unset; not supported
utilities.set_message ('err_parameter_ignored', {'agency'}); -- add error message
end
end
Volume = format_volume_issue (Volume, Issue, ArticleNumber, config.CitationClass, Periodical_origin, sepc, use_lowercase);
if utilities.is_set (AccessDate) then
local retrv_text = " " .. cfg.messages['retrieved'];
AccessDate = nowrap_date (AccessDate); -- wrap in nowrap span if date in appropriate format
retrv_text = cs2_lower(retrv_text); -- if mode is cs2, lower case
AccessDate = utilities.substitute (retrv_text, AccessDate); -- add retrieved text
AccessDate = utilities.substitute (cfg.presentation['accessdate'], {sepc, AccessDate}); -- allow editors to hide accessdates
end
if utilities.is_set (ID) then ID = sepc .. " " .. ID; end
local Docket = A['Docket'];
if "thesis" == config.CitationClass and utilities.is_set (Docket) then
ID = sepc .. " Docket " .. Docket .. ID;
end
if "report" == config.CitationClass and utilities.is_set (Docket) then -- for cite report when |docket= is set
ID = sepc .. ' ' .. Docket; -- overwrite ID even if |id= is set
end
if utilities.is_set (URL) then
URL = " " .. external_link( URL, nil, URL_origin, UrlAccess );
end
-- We check length of PostScript here because it will have been nuked by
-- the quote parameters. We'd otherwise emit a message even if there wasn't
-- a displayed postscript.
-- TODO: Should the max size (1) be configurable?
-- TODO: Should we check a specific pattern?
if utilities.is_set(PostScript) and mw.ustring.len(PostScript) > 1 then
utilities.set_message ('maint_postscript')
end
local Archived;
if utilities.is_set (ArchiveURL) then
if not utilities.is_set (ArchiveDate) then -- ArchiveURL set but ArchiveDate not set
utilities.set_message ('err_archive_missing_date'); -- emit an error message
ArchiveURL = ''; -- empty string for concatenation
ArchiveDate = ''; -- empty string for concatenation
end
else
if utilities.is_set (ArchiveDate) then -- ArchiveURL not set but ArchiveDate is set
utilities.set_message ('err_archive_date_missing_url'); -- emit an error message
ArchiveURL = ''; -- empty string for concatenation
ArchiveDate = ''; -- empty string for concatenation
end
end
if utilities.is_set (ArchiveURL) then
if "live" == UrlStatus then
if utilities.is_set (ArchiveDate) then
Archived = sepc .. ' ' .. utilities.substitute ( cfg.messages['archived-live'],
{ external_link( ArchiveURL, cs2_lower(cfg.messages['archived']), A:ORIGIN('ArchiveURL'), nil) .. ArchiveFormat, ArchiveDate } );
else
Archived = '';
end
if not utilities.is_set (OriginalURL) then
utilities.set_message ('err_archive_missing_url');
Archived = ''; -- empty string for concatenation
end
elseif utilities.is_set (OriginalURL) then -- UrlStatus is empty, 'dead', 'unfit', 'usurped', 'bot: unknown'
if utilities.in_array (UrlStatus, {'unfit', 'usurped', 'bot: unknown'}) then
Archived = sepc .. ' ' .. utilities.substitute ( cs2_lower(cfg.messages['archived-unfit']), ArchiveDate);
if 'bot: unknown' == UrlStatus then
utilities.set_message ('maint_bot_unknown'); -- and add a category if not already added
else
utilities.add_prop_cat ('unfit'); -- and add a category if not already added
end
else -- UrlStatus is empty, 'dead'
if utilities.is_set (ArchiveDate) then
Archived = sepc .. ' ' .. utilities.substitute ( cs2_lower(cfg.messages['archived-dead']),
{ external_link( OriginalURL, cfg.messages['original'], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } );
else
Archived = ''; -- unset for concatenation
end
end
else -- OriginalUrl not set
utilities.set_message ('err_archive_missing_url');
Archived = ''; -- empty string for concatenation
end
elseif utilities.is_set (ArchiveFormat) then
Archived = ArchiveFormat; -- if set and ArchiveURL not set ArchiveFormat has error message
else
Archived = '';
end
local TranscriptURL = A['TranscriptURL']
local TranscriptFormat = A['TranscriptFormat'];
TranscriptFormat = style_format (TranscriptFormat, TranscriptURL, 'transcript-format', 'transcripturl');
local Transcript = A['Transcript'];
local TranscriptURL_origin = A:ORIGIN('TranscriptURL'); -- get name of parameter that holds TranscriptURL
if utilities.is_set (Transcript) then
if utilities.is_set (TranscriptURL) then
Transcript = external_link( TranscriptURL, Transcript, TranscriptURL_origin, nil );
end
Transcript = sepc .. ' ' .. Transcript .. TranscriptFormat;
elseif utilities.is_set (TranscriptURL) then
Transcript = external_link( TranscriptURL, nil, TranscriptURL_origin, nil );
end
local Publisher;
if utilities.is_set (PublicationDate) then
PublicationDate = wrap_msg ('published', PublicationDate);
end
if utilities.is_set (PublisherName) then
if utilities.is_set (PublicationPlace) then
Publisher = sepc .. " " .. PublicationPlace .. ": " .. PublisherName .. PublicationDate;
else
Publisher = sepc .. " " .. PublisherName .. PublicationDate;
end
elseif utilities.is_set (PublicationPlace) then
Publisher= sepc .. " " .. PublicationPlace .. PublicationDate;
else
Publisher = PublicationDate;
end
-- Several of the above rely upon detecting this as nil, so do it last.
if (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical)) then
if utilities.is_set (Title) or utilities.is_set (TitleNote) then
Periodical = sepc .. " " .. format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);
else
Periodical = format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);
end
end
local Language = A['Language'];
if utilities.is_set (Language) then
Language = language_parameter (Language); -- format, categories, name from ISO639-1, etc.
else
Language=''; -- language not specified so make sure this is an empty string;
--[[ TODO: need to extract the wrap_msg from language_parameter
so that we can solve parentheses bunching problem with Format/Language/TitleType
]]
end
--[[
Handle the oddity that is cite speech. This code overrides whatever may be the value assigned to TitleNote (through |department=) and forces it to be " (Speech)" so that
the annotation directly follows the |title= parameter value in the citation rather than the |event= parameter value (if provided).
]]
if "speech" == config.CitationClass then -- cite speech only
TitleNote = TitleType; -- move TitleType to TitleNote so that it renders ahead of |event=
TitleType = ''; -- and unset
if utilities.is_set (Periodical) then -- if Periodical, perhaps because of an included |website= or |journal= parameter
if utilities.is_set (Conference) then -- and if |event= is set
Conference = Conference .. sepc .. " "; -- then add appropriate punctuation to the end of the Conference variable before rendering
end
end
end
-- Piece all bits together at last. Here, all should be non-nil.
-- We build things this way because it is more efficient in LUA
-- not to keep reassigning to the same string variable over and over.
local tcommon;
local tcommon2; -- used for book cite when |contributor= is set
local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;
if utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (Periodical) then -- special cases for book cites
if utilities.is_set (Contributors) then -- when we are citing foreword, preface, introduction, etc.
tcommon = safe_join ({Title, TitleNote}, sepc); -- author and other stuff will come after this and before tcommon2
tcommon2 = safe_join ({TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc);
else
tcommon = safe_join ({Title, TitleNote, TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc);
end
elseif 'map' == config.CitationClass then -- special cases for cite map
if utilities.is_set (Chapter) then -- map in a book; TitleType is part of Chapter
tcommon = safe_join ({Title, Edition, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc);
elseif utilities.is_set (Periodical) then -- map in a periodical
tcommon = safe_join ({Title, TitleType, Periodical, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc);
else -- a sheet or stand-alone map
tcommon = safe_join ({Title, TitleType, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc);
end
elseif 'episode' == config.CitationClass then -- special case for cite episode
tcommon = safe_join ({Title, TitleNote, TitleType, Series, Language, Edition, Publisher}, sepc);
else -- all other CS1 templates
tcommon = safe_join ({Title, TitleNote, Conference, Periodical, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc);
end
if #ID_list_t > 0 then
ID_list_t = safe_join( { sepc .. " ", table.concat( ID_list_t, sepc .. " " ), ID }, sepc );
else
ID_list_t = ID;
end
local Via = A['Via'];
Via = utilities.is_set (Via) and wrap_msg ('via', Via) or '';
local idcommon;
if 'audio-visual' == config.CitationClass or 'episode' == config.CitationClass then -- special case for cite AV media & cite episode position transcript
idcommon = safe_join( { ID_list_t, URL, Archived, Transcript, AccessDate, Via, Quote }, sepc );
else
idcommon = safe_join( { ID_list_t, URL, Archived, AccessDate, Via, Quote }, sepc );
end
local text;
-- local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;
local OrigDate = A['OrigDate'];
OrigDate = utilities.is_set (OrigDate) and wrap_msg ('origdate', OrigDate) or '';
if utilities.is_set (Date) then
if utilities.is_set (Authors) or utilities.is_set (Editors) then -- date follows authors or editors when authors not set
Date = " (" .. Date .. ")" .. OrigDate .. sepc .. " "; -- in parentheses
else -- neither of authors and editors set
if (string.sub(tcommon, -1, -1) == sepc) then -- if the last character of tcommon is sepc
Date = " " .. Date .. OrigDate; -- Date does not begin with sepc
else
Date = sepc .. " " .. Date .. OrigDate; -- Date begins with sepc
end
end
end
if utilities.is_set (Authors) then
if (not utilities.is_set (Date)) then -- when date is set it's in parentheses; no Authors termination
Authors = terminate_name_list (Authors, sepc); -- when no date, terminate with 0 or 1 sepc and a space
end
if utilities.is_set (Editors) then
local in_text = '';
local post_text;
if utilities.is_set (Chapter) and 0 == #c then
in_text = cfg.messages['in'] .. ' ';
in_text = cs2_lower(in_text); -- lowercase for cs2
end
if EditorCount <= 1 then
post_text = ' (' .. cfg.messages['editor'] .. ')'; -- be consistent with no-author, no-date case
else
post_text = ' (' .. cfg.messages['editors'] .. ')';
end
Editors = terminate_name_list (in_text .. Editors .. post_text, sepc); -- terminate with 0 or 1 sepc and a space
end
if utilities.is_set (Contributors) then -- book cite and we're citing the intro, preface, etc.
local by_text = sepc .. ' ' .. cfg.messages['by'] .. ' ';
by_text = cs2_lower(by_text); -- lowercase for cs2
Authors = by_text .. Authors; -- author follows title so tweak it here
if utilities.is_set (Editors) and utilities.is_set (Date) then -- when Editors make sure that Authors gets terminated
Authors = terminate_name_list (Authors, sepc); -- terminate with 0 or 1 sepc and a space
end
if (not utilities.is_set (Date)) then -- when date is set it's in parentheses; no Contributors termination
Contributors = terminate_name_list (Contributors, sepc); -- terminate with 0 or 1 sepc and a space
end
text = safe_join( {Contributors, Date, Chapter, tcommon, Authors, Place, Editors, tcommon2, pgtext, idcommon }, sepc );
else
text = safe_join( {Authors, Date, Chapter, Place, Editors, tcommon, pgtext, idcommon }, sepc );
end
elseif utilities.is_set (Editors) then
if utilities.is_set (Date) then
if EditorCount <= 1 then
Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editor'];
else
Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editors'];
end
else
if EditorCount <= 1 then
Editors = Editors .. " (" .. cfg.messages['editor'] .. ")" .. sepc .. " "
else
Editors = Editors .. " (" .. cfg.messages['editors'] .. ")" .. sepc .. " "
end
end
text = safe_join( {Editors, Date, Chapter, Place, tcommon, pgtext, idcommon}, sepc );
else
if utilities.in_array (config.CitationClass, {"journal", "citation"}) and utilities.is_set (Periodical) then
text = safe_join( {Chapter, Place, tcommon, pgtext, Date, idcommon}, sepc );
else
text = safe_join( {Chapter, Place, tcommon, Date, pgtext, idcommon}, sepc );
end
end
if utilities.is_set (PostScript) and PostScript ~= sepc then
text = safe_join( {text, sepc}, sepc ); -- Deals with italics, spaces, etc.
if '.' == sepc then -- remove final seperator if present
text = text:gsub ('%' .. sepc .. '$', ''); -- dot must be escaped here
else
text = mw.ustring.gsub (text, sepc .. '$', ''); -- using ustring for non-dot sepc (likely a non-Latin character)
end
end
text = safe_join( {text, PostScript}, sepc );
-- Now enclose the whole thing in a <cite> element
local options_t = {};
options_t.class = cite_class_attribute_make (config.CitationClass, Mode);
local Ref = is_valid_parameter_value (A['Ref'], A:ORIGIN('Ref'), cfg.keywords_lists['ref'], nil, true); -- nil when |ref=harv; A['Ref'] else
if 'none' ~= cfg.keywords_xlate[(Ref and Ref:lower()) or ''] then
local namelist_t = {}; -- holds selected contributor, author, editor name list
local year = first_set ({Year, anchor_year}, 2); -- Year first for legacy citations and for YMD dates that require disambiguation
if #c > 0 then -- if there is a contributor list
namelist_t = c; -- select it
elseif #a > 0 then -- or an author list
namelist_t = a;
elseif #e > 0 then -- or an editor list
namelist_t = e;
end
local citeref_id;
if #namelist_t > 0 then -- if there are names in namelist_t
citeref_id = make_citeref_id (namelist_t, year); -- go make the CITEREF anchor
if mw.uri.anchorEncode (citeref_id) == ((Ref and mw.uri.anchorEncode (Ref)) or '') then -- Ref may already be encoded (by {{sfnref}}) so citeref_id must be encoded before comparison
utilities.set_message ('maint_ref_duplicates_default');
end
else
citeref_id = ''; -- unset
end
options_t.id = Ref or citeref_id;
end
if string.len (text:gsub('%b<>', '')) <= 2 then -- remove html and html-like tags; then get length of what remains;
z.error_cats_t = {}; -- blank the categories list
z.error_msgs_t = {}; -- blank the error messages list
OCinSoutput = nil; -- blank the metadata string
text = ''; -- blank the the citation
utilities.set_message ('err_empty_citation'); -- set empty citation message and category
end
local render_t = {}; -- here we collect the final bits for concatenation into the rendered citation
if is_preview_mode and (0 ~= #z.error_msgs_t or 0 ~= #z.maint_cats_t) then -- when in preview mode
if not utilities.is_set (options_t.id) then -- and when this template has not created an anchor ID
math.randomseed (tonumber (mw.getLanguage ('en'):formatDate ('U')) * 10000 + os.clock() * 10000);
options_t.id = 'CITEREF_temp_preview_id_' .. math.random (100000, 999999); -- create temporary anchor ID for preview mode
end
end
if utilities.is_set (options_t.id) then -- here we wrap the rendered citation in <cite ...>...</cite> tags
options_t.id = mw.uri.anchorEncode(options_t.id); -- do this here; also used when adding preview warning messages
table.insert (render_t, utilities.substitute (cfg.presentation['cite-id'], {options_t.id, mw.text.nowiki(options_t.class), text})); -- when |ref= is set or when there is a namelist
else
table.insert (render_t, utilities.substitute (cfg.presentation['cite'], {mw.text.nowiki(options_t.class), text})); -- when |ref=none or when namelist_t empty and |ref= is missing or is empty
end
if OCinSoutput then -- blanked when citation is 'empty' so don't bother to add boilerplate metadata span
table.insert (render_t, utilities.substitute (cfg.presentation['ocins'], OCinSoutput)); -- format and append metadata to the citation
end
local template_name = cfg.citation_class_map_t[config.CitationClass];
local template_link = '[[Template:' .. template_name .. '|' .. template_name .. ']]';
local msg_prefix = '<code class="cs1-code">{{' .. template_link .. '}}</code>: ';
if 0 ~= #z.error_msgs_t then
mw.addWarning (utilities.substitute (cfg.messages.warning_msg_e, {template_link, options_t.id}));
table.insert (render_t, ' '); -- insert a space between citation and its error messages
table.sort (z.error_msgs_t); -- sort the error messages list; sorting includes wrapping <span> and <code> tags; hidden-error sorts ahead of visible-error
local hidden = true; -- presume that the only error messages emited by this template are hidden
for _, v in ipairs (z.error_msgs_t) do -- spin through the list of error messages
if v:find ('cs1-visible-error', 1, true) then -- look for the visible error class name
hidden = false; -- found one; so don't hide the error message prefix
break; -- and done because no need to look further
end
end
z.error_msgs_t[1] = table.concat ({utilities.error_comment (msg_prefix, hidden), z.error_msgs_t[1]}); -- add error message prefix to first error message to prevent extraneous punctuation
table.insert (render_t, table.concat (z.error_msgs_t, '; ')); -- make a big string of error messages and add it to the rendering
end
if 0 ~= #z.maint_cats_t then
mw.addWarning (utilities.substitute (cfg.messages.warning_msg_m, {template_link, options_t.id}));
table.sort (z.maint_cats_t); -- sort the maintenance messages list
local maint_msgs_t = {}; -- here we collect all of the maint messages
if 0 == #z.error_msgs_t then -- if no error messages
table.insert (maint_msgs_t, msg_prefix); -- insert message prefix in maint message livery
end
for _, v in ipairs( z.maint_cats_t ) do -- append maintenance categories
table.insert (maint_msgs_t, -- assemble new maint message and add it to the maint_msgs_t table
table.concat ({v, ' (', utilities.substitute (cfg.messages[':cat wikilink'], v), ')'})
);
end
table.insert (render_t, utilities.substitute (cfg.presentation['hidden-maint'], table.concat (maint_msgs_t, ' '))); -- wrap the group of maint messages with proper presentation and save
end
if not no_tracking_cats then
local sort_key;
local cat_wikilink = 'cat wikilink';
if cfg.enable_sort_keys then -- when namespace sort keys enabled
local namespace_number = mw.title.getCurrentTitle().namespace; -- get namespace number for this wikitext
sort_key = (0 ~= namespace_number and (cfg.name_space_sort_keys[namespace_number] or cfg.name_space_sort_keys.other)) or nil; -- get sort key character; nil for mainspace
cat_wikilink = (not sort_key and 'cat wikilink') or 'cat wikilink sk'; -- make <cfg.messages> key
end
for _, v in ipairs (z.error_cats_t) do -- append error categories
table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));
end
if cfg.id_limits_data_load_fail then -- boolean true when load failed
utilities.set_message ('maint_id_limit_load_fail'); -- done here because this maint cat emits no message
end
for _, v in ipairs (z.maint_cats_t) do -- append maintenance categories
table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));
end
for _, v in ipairs (z.prop_cats_t) do -- append properties categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v)); -- no sort keys
end
end
return table.concat (render_t); -- make a big string and done
end
--[[--------------------------< V A L I D A T E >--------------------------------------------------------------
Looks for a parameter's name in one of several whitelists.
Parameters in the whitelist can have three values:
true - active, supported parameters
false - deprecated, supported parameters
nil - unsupported parameters
]]
local function validate (name, cite_class, empty)
local enum_name; -- parameter name with enumerator (if any) replaced with '#'
local state;
local function state_test () -- local function to do testing of state values; operates on the upvalues <state> and <name>
if true == state then return true; end -- valid actively supported parameter
if false == state then
if empty then return nil; end -- empty deprecated parameters are treated as unknowns
deprecated_parameter (name); -- parameter is deprecated but still supported
return true;
end
if 'tracked' == state then
local base_name = name:gsub ('%d', ''); -- strip enumerators from parameter names that have them to get the base name
utilities.add_prop_cat ('tracked-param', {base_name}, base_name); -- add a properties category; <base_name> modifies <key>
return true;
end
return nil;
end
if 'string' ~= type (name) or name:find ('#') then -- # is a cs1|2 reserved character so parameters with # not permitted; positional params are 'number' type; not supported
return nil;
end
-- replace enumerator digit(s) with # (|last25= becomes |last#=) (mw.ustring because non-Western 'local' digits)
enum_name = mw.ustring.gsub (name, '%d+$', '#'); -- where enumerator is last charaters in parameter name (these to protect |s2cid=)
enum_name = mw.ustring.gsub (enum_name, '%d+([%-l])', '#%1'); -- where enumerator is in the middle of the parameter name; |author#link= is the oddity
if 'document' == cite_class then -- special case for {{cite document}}
state = whitelist.document_parameters_t[enum_name]; -- this list holds enumerated and nonenumerated parameters
if true == state_test () then return true; end
return false;
end
if utilities.in_array (cite_class, whitelist.preprint_template_list_t) then -- limited parameter sets allowed for these templates
state = whitelist.limited_parameters_t[enum_name]; -- this list holds enumerated and nonenumerated parameters
if true == state_test () then return true; end
state = whitelist.preprint_arguments_t[cite_class][name]; -- look in the parameter-list for the template identified by cite_class
if true == state_test () then return true; end
return false; -- not supported because not found or name is set to nil
end -- end limited parameter-set templates
if utilities.in_array (cite_class, whitelist.unique_param_template_list_t) then -- template-specific parameters for templates that accept parameters from the basic argument list
state = whitelist.unique_arguments_t[cite_class][name]; -- look in the template-specific parameter-lists for the template identified by cite_class
if true == state_test () then return true; end
end -- if here, fall into general validation
state = whitelist.common_parameters_t[enum_name]; -- all other templates; all normal parameters allowed; this list holds enumerated and nonenumerated parameters
if true == state_test () then return true; end
return false; -- not supported because not found or name is set to nil
end
--[=[-------------------------< I N T E R _ W I K I _ C H E C K >----------------------------------------------
check <value> for inter-language interwiki-link markup. <prefix> must be a MediaWiki-recognized language
code. when these values have the form (without leading colon):
[[<prefix>:link|label]] return label as plain-text
[[<prefix>:link]] return <prefix>:link as plain-text
return value as is else
]=]
local function inter_wiki_check (parameter, value)
local prefix = value:match ('%[%[(%a+):'); -- get an interwiki prefix if one exists
local _;
if prefix and cfg.inter_wiki_map[prefix:lower()] then -- if prefix is in the map, needs preceding colon so
utilities.set_message ('err_bad_paramlink', parameter); -- emit an error message
_, value, _ = utilities.is_wikilink (value); -- extract label portion from wikilink
end
return value;
end
--[[--------------------------< M I S S I N G _ P I P E _ C H E C K >------------------------------------------
Look at the contents of a parameter. If the content has a string of characters and digits followed by an equal
sign, compare the alphanumeric string to the list of cs1|2 parameters. If found, then the string is possibly a
parameter that is missing its pipe. There are two tests made:
{{cite ... |title=Title access-date=2016-03-17}} -- the first parameter has a value and whitespace separates that value from the missing pipe parameter name
{{cite ... |title=access-date=2016-03-17}} -- the first parameter has no value (whitespace after the first = is trimmed by MediaWiki)
cs1|2 shares some parameter names with XML/HTML attributes: class=, title=, etc. To prevent false positives XML/HTML
tags are removed before the search.
If a missing pipe is detected, this function adds the missing pipe maintenance category.
]]
local function missing_pipe_check (parameter, value)
local capture;
value = value:gsub ('%b<>', ''); -- remove XML/HTML tags because attributes: class=, title=, etc.
capture = value:match ('%s+(%a[%w%-]+)%s*=') or value:match ('^(%a[%w%-]+)%s*='); -- find and categorize parameters with possible missing pipes
if capture and validate (capture) then -- if the capture is a valid parameter name
utilities.set_message ('err_missing_pipe', parameter);
end
end
--[[--------------------------< H A S _ E X T R A N E O U S _ P U N C T >--------------------------------------
look for extraneous terminal punctuation in most parameter values; parameters listed in skip table are not checked
]]
local function has_extraneous_punc (param, value)
if 'number' == type (param) then
return;
end
param = param:gsub ('%d+', '#'); -- enumerated name-list mask params allow terminal punct; normalize
if cfg.punct_skip[param] then
return; -- parameter name found in the skip table so done
end
if value:match ('[,;:]$') then
utilities.set_message ('maint_extra_punct'); -- has extraneous punctuation; add maint cat
end
if value:match ('^=') then -- sometimes an extraneous '=' character appears ...
utilities.set_message ('maint_extra_punct'); -- has extraneous punctuation; add maint cat
end
end
--[[--------------------------< H A S _ T W L _ U R L >--------------------------------------------------------
look for The Wikipedia Library urls in url-holding parameters. TWL urls are accessible only for readers who are
active extended confirmed Wikipedia editors. This function sets an error message when such urls are discovered
and when appropriate, sets the |<param>-url-access=subscription. returns nothing.
looks for: '.wikipedialibrary.idm.oclc.org'
]]
local function has_twl_url (url_params_t, cite_args_t)
local url_error_t = {}; -- sequence of url-holding parameters that have a TWL url
for param, value in pairs (url_params_t) do
if value:find ('%.wikipedialibrary%.idm%.oclc%.org') then -- has the TWL base url?
table.insert (url_error_t, param); -- add parameter name to the error list
end
end
if 0 ~= #url_error_t then -- non-zero when there are errors
table.sort (url_error_t); -- sor for error messaging
for i, param in ipairs (url_error_t) do
if cfg.url_access_map_t[param] then -- if <param> has a matching -access parameter
cite_args_t[cfg.url_access_map_t[param]] = cfg.keywords_xlate.subscription; -- set |<param>-url-access=subscription
end
url_error_t[i] = utilities.wrap_style ('parameter', param); -- make the parameter pretty for error message
end
utilities.set_message ('err_param_has_twl_url', {utilities.make_sep_list (#url_error_t, url_error_t)}); -- add this error message
end
end
--[[--------------------------< M I S C _ U R L _ D E T E C T >------------------------------------------------
look for miscellaneous urls that might be converted to, or are duplicates of, identifiers.
]]
local misc_url_patterns_t = {
'idm%.oclc%.org', -- but not wikipedialibrary.idm.oclc.org; has_twl_url()
'https?://citeseerx?%.ist%.psu%.edu/', -- simplified so we catch all citeseer and citeseerx urls except ~/document/... (the 'new' form)
}
local ignore_patterns_t = {
'wikipedialibrary.idm.oclc.org', -- handled by has_twl_url()
'https?://citeseerx?%.ist%.psu%.edu/document', -- 'new'-form citeseerx urls that mostly work; ignore for now
}
local function misc_url_detect (url_params_t)
local ignore_flag = false;
for _, value in pairs (url_params_t) do
for _, ignore_pattern in ipairs (ignore_patterns_t) do
if value:find (ignore_pattern) then -- matches this ignore_pattern?
ignore_flag = true; -- found a pattern to ignore
break; --
end
end
if not ignore_flag then -- if ignore_flag is set then don't bother to test this url <value>
for _, misc_pattern in ipairs (misc_url_patterns_t) do
if value:find (misc_pattern) then -- matches this misc_pattern?
utilities.set_message ('maint_misc_url'); -- found one; set the message
return; -- and done; no need to test other <value>s
end
end
end
ignore_flag = false; -- reset
end
end
--[[--------------------------< H A S _ E X T R A N E O U S _ U R L >------------------------------------------
look for extraneous url parameter values; parameters listed in skip table are not checked
]]
local function has_extraneous_url (non_url_param_t)
local url_error_t = {};
check_for_url (non_url_param_t, url_error_t); -- extraneous url check
if 0 ~= #url_error_t then -- non-zero when there are errors
table.sort (url_error_t);
utilities.set_message ('err_param_has_ext_link', {utilities.make_sep_list (#url_error_t, url_error_t)}); -- add this error message
end
end
--[[--------------------------< _ C I T A T I O N >------------------------------------------------------------
Module entry point
frame – from template call (citation()); may be nil when called from another module
args_t – table of all cs1|2 parameters in the template (the parent frame)
config_t – table of template-supplied parameter (the #invoke frame)
]]
local function _citation (frame, args_t, config_t) -- save a copy in case we need to display an error message in preview mode
if not frame then
frame = mw.getCurrentFrame(); -- if called from another module, get a frame for frame-provided functions
end
-- i18n: set the name that your wiki uses to identify sandbox subpages from sandbox template invoke (or can be set here)
local sandbox = ((config_t.SandboxPath and '' ~= config_t.SandboxPath) and config_t.SandboxPath) or '/sandbox'; -- sandbox path from {{#invoke:Citation/CS1/sandbox|citation|SandboxPath=/...}}
is_sandbox = nil ~= string.find (frame:getTitle(), sandbox, 1, true); -- is this invoke the sandbox module?
sandbox = is_sandbox and sandbox or ''; -- use i18n sandbox to load sandbox modules when this module is the sandox; live modules else
cfg = mw.loadData ('Module:Citation/CS1/Configuration' .. sandbox); -- load sandbox versions of support modules when {{#invoke:Citation/CS1/sandbox|...}}; live modules else
whitelist = mw.loadData ('Module:Citation/CS1/Whitelist' .. sandbox);
utilities = require ('Module:Citation/CS1/Utilities' .. sandbox);
validation = require ('Module:Citation/CS1/Date_validation' .. sandbox);
identifiers = require ('Module:Citation/CS1/Identifiers' .. sandbox);
metadata = require ('Module:Citation/CS1/COinS' .. sandbox);
utilities.set_selected_modules (cfg); -- so that functions in Utilities can see the selected cfg tables
identifiers.set_selected_modules (cfg, utilities); -- so that functions in Identifiers can see the selected cfg tables and selected Utilities module
validation.set_selected_modules (cfg, utilities); -- so that functions in Date validataion can see selected cfg tables and the selected Utilities module
metadata.set_selected_modules (cfg, utilities); -- so that functions in COinS can see the selected cfg tables and selected Utilities module
z = utilities.z; -- table of error and category tables in Module:Citation/CS1/Utilities
local cite_args_t = {}; -- because args_t is the parent (template) frame args (which cannot be modified); params and their values will be placed here
is_preview_mode = not utilities.is_set (frame:preprocess ('{{REVISIONID}}'));
local suggestions = {}; -- table where we store suggestions if we need to loadData them
local error_text; -- used as a flag
local capture; -- the single supported capture when matching unknown parameters using patterns
local empty_unknowns = {}; -- sequence table to hold empty unknown params for error message listing
for k, v in pairs (args_t) do -- get parameters from the parent (template) frame
v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1'); -- trim leading/trailing whitespace; when v is only whitespace, becomes empty string
if v ~= '' then
if cfg.enum_needs_xlation and 'string' == type (k) then -- for wikis that set date_names['local_digits'] to non-western digits
k = mw.ustring.gsub (k, '%d', cfg.date_names.local_digits); -- translate 'local' digits enumerators to Western 0-9
end
if not validate( k, config_t.CitationClass ) then
if type (k) ~= 'string' then -- exclude empty numbered parameters
if v:match("%S+") ~= nil then
error_text = utilities.set_message ('err_text_ignored', {v});
end
elseif validate (k:lower(), config_t.CitationClass) then
error_text = utilities.set_message ('err_parameter_ignored_suggest', {k, k:lower()}); -- suggest the lowercase version of the parameter
else
if nil == suggestions.suggestions then -- if this table is nil then we need to load it
suggestions = mw.loadData ('Module:Citation/CS1/Suggestions' .. sandbox); --load sandbox version of suggestion module when {{#invoke:Citation/CS1/sandbox|...}}; live module else
end
for pattern, param in pairs (suggestions.patterns) do -- loop through the patterns to see if we can suggest a proper parameter
capture = k:match (pattern); -- the whole match if no capture in pattern else the capture if a match
if capture then -- if the pattern matches
param = utilities.substitute (param, capture); -- add the capture to the suggested parameter (typically the enumerator)
if validate (param, config_t.CitationClass) then -- validate the suggestion to make sure that the suggestion is supported by this template (necessary for limited parameter lists)
error_text = utilities.set_message ('err_parameter_ignored_suggest', {k, param}); -- set the suggestion error message
else
error_text = utilities.set_message ('err_parameter_ignored', {k}); -- suggested param not supported by this template
v = ''; -- unset
end
end
end
if not utilities.is_set (error_text) then -- couldn't match with a pattern, is there an explicit suggestion?
if (suggestions.suggestions[ k:lower() ] ~= nil) and validate (suggestions.suggestions[ k:lower() ], config_t.CitationClass) then
utilities.set_message ('err_parameter_ignored_suggest', {k, suggestions.suggestions[ k:lower() ]});
else
utilities.set_message ('err_parameter_ignored', {k});
v = ''; -- unset value assigned to unrecognized parameters (this for the limited parameter lists)
end
end
end
end
cite_args_t[k] = v; -- save this parameter and its value
elseif not utilities.is_set (v) then -- for empty parameters
if not validate (k, config_t.CitationClass, true) then -- is this empty parameter a valid parameter
k = ('' == k) and cfg.err_msg_supl.empty_str or k; -- when k is empty string (or was space(s) trimmed to empty string), replace with descriptive text
table.insert (empty_unknowns, utilities.wrap_style ('parameter', k)); -- format for error message and add to the list
end
end
end
if 0 ~= #empty_unknowns then -- create empty unknown error message
utilities.set_message ('err_param_unknown_empty', {
1 == #empty_unknowns and '' or 's',
utilities.make_sep_list (#empty_unknowns, empty_unknowns)
});
end
local non_url_param_t = {}; -- table of parameters and values that are not url-holding parameters
local url_param_t = {}; -- table of url-holding paramters and their values
for k, v in pairs (cite_args_t) do
if 'string' == type (k) then -- don't evaluate positional parameters
has_invisible_chars (k, v); -- look for invisible characters
end
has_extraneous_punc (k, v); -- look for extraneous terminal punctuation in parameter values
missing_pipe_check (k, v); -- do we think that there is a parameter that is missing a pipe?
cite_args_t[k] = inter_wiki_check (k, v); -- when language interwiki-linked parameter missing leading colon replace with wiki-link label
if 'string' == type (k) then -- when parameter k is not positional
if not cfg.url_skip[k] then -- and not in url skip table
non_url_param_t[k] = v; -- make a parameter/value list for extraneous url check
else -- and is in url skip table (a url-holding parameter)
url_param_t[k] = v; -- make a parameter/value list to check for values that are The Wikipedia Library url
end
end
end
if cfg.suppress_archive_today_urls then
has_archive_today_url (cite_args_t); -- look for and suppress archive.today urls and dependent parameters for all templates
end
has_extraneous_url (non_url_param_t); -- look for url in parameter values where a url does not belong
has_twl_url (url_param_t, cite_args_t); -- look for url-holding parameters that hold a The Wikipedia Library url
misc_url_detect (url_param_t); -- look for url-holding parameters that hold certain miscellaneous urls
return table.concat ({
frame:extensionTag ('templatestyles', '', {src='Module:Citation/CS1' .. sandbox .. '/styles.css'}),
citation0 (config_t, cite_args_t)
});
end
--[[--------------------------< C I T A T I O N >--------------------------------------------------------------
Template entry point
]]
local function citation (frame)
local config_t = {}; -- table to store parameters from the module {{#invoke:}}
local args_t = frame:getParent().args; -- get template's preset parameters
for k, v in pairs (frame.args) do -- get parameters from the {{#invoke}} frame
config_t[k] = v;
-- args_t[k] = v; -- crude debug support that allows us to render a citation from module {{#invoke:}}; skips parameter validation; TODO: keep?
end
return _citation (frame, args_t, config_t)
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
citation = citation, -- template entry point
_citation = _citation, -- module entry point
}
mzkfjlhyhvftcb93lj0ik7zu7t1myhw
74987
74986
2026-08-24T00:44:38Z
Robertsky
10424
1 versaun husi [[:en:Module:Citation/CS1]]
74986
Scribunto
text/plain
require ('strict');
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
each of these counts against the Lua upvalue limit
]]
local validation; -- functions in Module:Citation/CS1/Date_validation
local utilities; -- functions in Module:Citation/CS1/Utilities
local z = {}; -- table of tables in Module:Citation/CS1/Utilities
local identifiers; -- functions and tables in Module:Citation/CS1/Identifiers
local metadata; -- functions in Module:Citation/CS1/COinS
local cfg = {}; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
local whitelist = {}; -- table of tables listing valid template parameter names; defined in Module:Citation/CS1/Whitelist
--[[------------------< P A G E S C O P E V A R I A B L E S >---------------
declare variables here that have page-wide scope that are not brought in from
other modules; that are created here and used here
]]
local added_deprecated_cat; -- boolean flag so that the category is added only once
local added_vanc_errs; -- boolean flag so we only emit one Vancouver error / category
local added_generic_name_errs; -- boolean flag so we only emit one generic name error / category and stop testing names once an error is encountered
local added_numeric_name_errs; -- boolean flag so we only emit one numeric name error / category and stop testing names once an error is encountered
local added_numeric_name_maint; -- boolean flag so we only emit one numeric name maint category and stop testing names once a category has been emitted
local is_preview_mode; -- true when article is in preview mode; false when using 'Preview page with this template' (previewing the module)
local is_sandbox; -- true when using sandbox modules to render citation
local url_was_archive_today; -- boolean flag set to true when has_archive_today_url() has unset |url= because it held a deprecated archive.today url
--[[--------------------------< F I R S T _ S E T >------------------------------------------------------------
Locates and returns the first set value in a table of values where the order established in the table,
left-to-right (or top-to-bottom), is the order in which the values are evaluated. Returns nil if none are set.
This version replaces the original 'for _, val in pairs do' and a similar version that used ipairs. With the pairs
version the order of evaluation could not be guaranteed. With the ipairs version, a nil value would terminate
the for-loop before it reached the actual end of the list.
]]
local function first_set (list, count)
local i = 1;
while i <= count do -- loop through all items in list
if utilities.is_set( list[i] ) then
return list[i]; -- return the first set list member
end
i = i + 1; -- point to next
end
end
--[[--------------------------< A D D _ V A N C _ E R R O R >----------------------------------------------------
Adds a single Vancouver system error message to the template's output regardless of how many error actually exist.
To prevent duplication, added_vanc_errs is nil until an error message is emitted.
added_vanc_errs is a Boolean declared in page scope variables above
]]
local function add_vanc_error (source, position)
if added_vanc_errs then return end
added_vanc_errs = true; -- note that we've added this category
utilities.set_message ('err_vancouver', {source, position});
end
--[[--------------------------< I S _ S C H E M E >------------------------------------------------------------
does this thing that purports to be a URI scheme seem to be a valid scheme? The scheme is checked to see if it
is in agreement with http://tools.ietf.org/html/std66#section-3.1 which says:
Scheme names consist of a sequence of characters beginning with a
letter and followed by any combination of letters, digits, plus
("+"), period ("."), or hyphen ("-").
returns true if it does, else false
]]
local function is_scheme (scheme)
return scheme and scheme:match ('^%a[%a%d%+%.%-]*:'); -- true if scheme is set and matches the pattern
end
--[=[-------------------------< I S _ D O M A I N _ N A M E >--------------------------------------------------
Does this thing that purports to be a domain name seem to be a valid domain name?
Syntax defined here: http://tools.ietf.org/html/rfc1034#section-3.5
BNF defined here: https://tools.ietf.org/html/rfc4234
Single character names are generally reserved; see https://tools.ietf.org/html/draft-ietf-dnsind-iana-dns-01#page-15;
see also [[Single-letter second-level domain]]
list of TLDs: https://www.iana.org/domains/root/db
RFC 952 (modified by RFC 1123) requires the first and last character of a hostname to be a letter or a digit
(see http://tools.ietf.org/html/rfc952 §GRAMMATICAL HOST TABLE SPECIFICATION §§B. Lexical grammar <name>; see
http://tools.ietf.org/html/rfc1123#section-2). Between the first and last characters the name may use letters,
digits, and the hyphen.
Also allowed are IPv4 addresses. IPv6 not supported
domain is expected to be stripped of any path so that the last character in the last character of the TLD. tld
is two or more alpha characters. Any preceding '//' (from splitting a URL with a scheme) will be stripped
here. Perhaps not necessary but retained in case it is necessary for IPv4 dot decimal.
There are several tests:
the first character of the whole domain name including subdomains must be a letter or a digit
internationalized domain name (ASCII characters with .xn-- ASCII Compatible Encoding (ACE) prefix xn-- in the TLD) see https://tools.ietf.org/html/rfc3490
single-letter/digit second-level domains in the .org, .cash, and .today TLDs
q, x, and z SL domains in the .com TLD
i and q SL domains in the .net TLD
single-letter SL domains in the ccTLDs (where the ccTLD is two letters)
two-character SL domains in gTLDs (where the gTLD is two or more letters)
three-plus-character SL domains in gTLDs (where the gTLD is two or more letters)
IPv4 dot-decimal address format; TLD not allowed
returns true if domain appears to be a proper name and TLD or IPv4 address, else false
]=]
local function is_domain_name (domain)
if not domain then
return false; -- if not set, abandon
end
domain = domain:gsub ('^//', ''); -- strip '//' from domain name if present; done here so we only have to do it once
local sl_domain = domain:match ('[^%.]+') or domain; -- test the second level domain name
if not (sl_domain:match ('^%w') and sl_domain:match ('%w$') and -- first and last characters must be letter or digit
sl_domain:match ('^[%w%-]+$')) then -- all other characters must be letters, digits, or hyphen-minus
return false;
end
if domain:match ('^%a+:') then -- hack to detect things that look like s:Page:Title where Page: is namespace at Wikisource
return false;
end
local patterns = { -- patterns that look like URLs
'%f[%w][%w][%w%-]+[%w]%.%a%a+$', -- three or more character hostname.hostname or hostname.tld
'%f[%w][%w][%w%-]+[%w]%.xn%-%-[%w]+$', -- internationalized domain name with ACE prefix
'%f[%a][qxz]%.com$', -- assigned one character .com hostname (x.com times out 2015-12-10)
'%f[%a][iq]%.net$', -- assigned one character .net hostname (q.net registered but not active 2015-12-10)
'%f[%w][%w]%.%a%a$', -- one character hostname and ccTLD (2 chars)
'%f[%w][%w][%w]%.%a%a+$', -- two character hostname and TLD
'^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?', -- IPv4 address
'[%a%d]+%:?' -- IPv6 address
}
for _, pattern in ipairs (patterns) do -- loop through the patterns list
if domain:match (pattern) then
return true; -- if a match then we think that this thing that purports to be a URL is a URL
end
end
for _, d in ipairs (cfg.single_letter_2nd_lvl_domains_t) do -- look for single letter second level domain names for these top level domains
if domain:match ('%f[%w][%w]%.' .. d) then
return true
end
end
return false; -- no matches, we don't know what this thing is
end
--[[--------------------------< I S _ U R L >------------------------------------------------------------------
returns true if the scheme and domain parts of a URL appear to be a valid URL; else false.
This function is the last step in the validation process. This function is separate because there are cases that
are not covered by split_url(), for example is_parameter_ext_wikilink() which is looking for bracketted external
wikilinks.
]]
local function is_url (scheme, domain)
if utilities.is_set (scheme) then -- if scheme is set check it and domain
return is_scheme (scheme) and is_domain_name (domain);
else
return is_domain_name (domain); -- scheme not set when URL is protocol-relative
end
end
--[[--------------------------< S P L I T _ U R L >------------------------------------------------------------
Split a URL into a scheme, authority indicator, and domain.
First remove Fully Qualified Domain Name terminator (a dot following TLD) (if any) and any path(/), query(?) or fragment(#).
If protocol-relative URL, return nil scheme and domain else return nil for both scheme and domain.
When not protocol-relative, get scheme, authority indicator, and domain. If there is an authority indicator (one
or more '/' characters immediately following the scheme's colon), make sure that there are only 2.
Any URL that does not have news: scheme must have authority indicator (//). TODO: are there other common schemes
like news: that don't use authority indicator?
Strip off any port and path;
]]
local function split_url (url_str)
local scheme, authority, domain;
url_str = url_str:gsub ('([%a%d])%.?[/%?#].*$', '%1'); -- strip FQDN terminator and path(/), query(?), fragment (#) (the capture prevents false replacement of '//')
if url_str:match ('^//%S*') then -- if there is what appears to be a protocol-relative URL
domain = url_str:match ('^//(%S*)')
elseif url_str:match ('%S-:/*%S+') then -- if there is what appears to be a scheme, optional authority indicator, and domain name
scheme, authority, domain = url_str:match ('(%S-:)(/*)(%S+)'); -- extract the scheme, authority indicator, and domain portions
if utilities.is_set (authority) then
authority = authority:gsub ('//', '', 1); -- replace place 1 pair of '/' with nothing;
if utilities.is_set(authority) then -- if anything left (1 or 3+ '/' where authority should be) then
return scheme; -- return scheme only making domain nil which will cause an error message
end
else
if not scheme:match ('^news:') then -- except for news:..., MediaWiki won't link URLs that do not have authority indicator; TODO: a better way to do this test?
return scheme; -- return scheme only making domain nil which will cause an error message
end
end
domain = domain:gsub ('(%a):%d+', '%1'); -- strip port number if present
end
return scheme, domain;
end
--[[--------------------------< L I N K _ P A R A M _ O K >---------------------------------------------------
checks the content of |title-link=, |series-link=, |author-link=, etc. for properly formatted content: no wikilinks, no URLs
Link parameters are to hold the title of a Wikipedia article, so none of the WP:TITLESPECIALCHARACTERS are allowed:
# < > [ ] | { } _
except the underscore which is used as a space in wiki URLs and # which is used for section links
returns false when the value contains any of these characters.
When there are no illegal characters, this function returns TRUE if value DOES NOT appear to be a valid URL (the
|<param>-link= parameter is ok); else false when value appears to be a valid URL (the |<param>-link= parameter is NOT ok).
]]
local function link_param_ok (value)
local scheme, domain;
if value:find ('[<>%[%]|{}]') then -- if any prohibited characters
return false;
end
scheme, domain = split_url (value); -- get scheme or nil and domain or nil from URL;
return not is_url (scheme, domain); -- return true if value DOES NOT appear to be a valid URL
end
--[[--------------------------< L I N K _ T I T L E _ O K >---------------------------------------------------
Use link_param_ok() to validate |<param>-link= value and its matching |<title>= value.
|<title>= may be wiki-linked but not when |<param>-link= has a value. This function emits an error message when
that condition exists
check <link> for inter-language interwiki-link prefix. prefix must be a MediaWiki-recognized language
code and must begin with a colon.
]]
local function link_title_ok (link, lorig, title, torig)
local orig;
if utilities.is_set (link) then -- don't bother if <param>-link doesn't have a value
if not link_param_ok (link) then -- check |<param>-link= markup
orig = lorig; -- identify the failing link parameter
elseif title:find ('%[%[') then -- check |title= for wikilink markup
orig = torig; -- identify the failing |title= parameter
elseif link:match ('^%a+:') then -- if the link is what looks like an interwiki
local prefix = link:match ('^(%a+):'):lower(); -- get the interwiki prefix
if cfg.inter_wiki_map[prefix] then -- if prefix is in the map, must have preceding colon
orig = lorig; -- flag as error
end
end
end
if utilities.is_set (orig) then
link = ''; -- unset
utilities.set_message ('err_bad_paramlink', orig); -- URL or wikilink in |title= with |title-link=;
end
return link; -- link if ok, empty string else
end
--[[--------------------------< C H E C K _ U R L >------------------------------------------------------------
Determines whether a URL string appears to be valid.
First we test for space characters. If any are found, return false. Then split the URL into scheme and domain
portions, or for protocol-relative (//example.com) URLs, just the domain. Use is_url() to validate the two
portions of the URL. If both are valid, or for protocol-relative if domain is valid, return true, else false.
Because it is different from a standard URL, and because this module used external_link() to make external links
that work for standard and news: links, we validate newsgroup names here. The specification for a newsgroup name
is at https://tools.ietf.org/html/rfc5536#section-3.1.4
]]
local function check_url( url_str )
if nil == url_str:match ("^%S+$") then -- if there are any spaces in |url=value it can't be a proper URL
return false;
end
local scheme, domain;
scheme, domain = split_url (url_str); -- get scheme or nil and domain or nil from URL;
if 'news:' == scheme then -- special case for newsgroups
return domain:match('^[%a%d%+%-_]+%.[%a%d%+%-_%.]*[%a%d%+%-_]$');
end
return is_url (scheme, domain); -- return true if value appears to be a valid URL
end
--[=[-------------------------< I S _ P A R A M E T E R _ E X T _ W I K I L I N K >----------------------------
Return true if a parameter value has a string that begins and ends with square brackets [ and ] and the first
non-space characters following the opening bracket appear to be a URL. The test will also find external wikilinks
that use protocol-relative URLs. Also finds bare URLs.
The frontier pattern prevents a match on interwiki-links which are similar to scheme:path URLs. The tests that
find bracketed URLs are required because the parameters that call this test (currently |title=, |chapter=, |work=,
and |publisher=) may have wikilinks and there are articles or redirects like '//Hus' so, while uncommon, |title=[[//Hus]]
is possible as might be [[en://Hus]].
]=]
local function is_parameter_ext_wikilink (value)
local scheme, domain;
if value:match ('%f[%[]%[%a%S*:%S+.*%]') then -- if ext. wikilink with scheme and domain: [xxxx://yyyyy.zzz]
scheme, domain = split_url (value:match ('%f[%[]%[(%a%S*:%S+).*%]'));
elseif value:match ('%f[%[]%[//%S+.*%]') then -- if protocol-relative ext. wikilink: [//yyyyy.zzz]
scheme, domain = split_url (value:match ('%f[%[]%[(//%S+).*%]'));
elseif value:match ('%a%S*:%S+') then -- if bare URL with scheme; may have leading or trailing plain text
scheme, domain = split_url (value:match ('(%a%S*:%S+)'));
elseif value:match ('^//%S+') or value:match ('%s//%S+') then -- if protocol-relative bare URL: //yyyyy.zzz; authority indicator (//) must be be preceded nothing or by whitespace
scheme, domain = split_url (value:match ('(//%S+)')); -- what is left should be the domain
else
return false; -- didn't find anything that is obviously a URL
end
return is_url (scheme, domain); -- return true if value appears to be a valid URL
end
--[[--------------------------< I S _ A R C H I V E _ T O D A Y _ U R L >--------------------------------------
archive.today (and .ph, .is, .md, .li, .fo, .vn) are deprecated. See Wikipedia:Requests_for_comment/Archive.is_RFC_5
(Special:Permalink/1339352976)
<val> is a string that may or may not be a url
]]
local function is_archive_today_url (val)
if is_parameter_ext_wikilink (val) then -- is <val> a url?
local tld = val:match ('archive%.(%l+)/'); -- get the tld; real archive.today urls have a '/' after the tld
return tld and cfg.archive_today_tlds_t[tld]; -- return true if <tld> is one of the archive.today tlds; nil else
end
end
--[[--------------------------< H A S _ A R C H I V E _ T O D A Y _ U R L >------------------------------------
blank any parameter that holds one of the archive.today tlds (.today, .ph, .is, .md, .li, .fo, .vn) and also
blank parameters that are dependent on the offending parameter.
input <cite_args_t> is a table of all of this template's parameters This function modifies <cite_args_t>
when |url= or its alias |URL= hold an archive.today url, this function sets the flag <url_was_archive_today>
which is used later to suppress the missing url error message from {{citation}} when it has |website=<summat>
or from the templates {{cite web}}, {{cite podcast}}, {{cite mailing list}} which all require a url.
returns nothing
]]
local function has_archive_today_url (cite_args_t)
local unset_params_t = {}; -- to hold a sequence of parameters to unset from cite_args_t
for p, v in pairs (cite_args_t) do -- look at each parameter in the template
if is_archive_today_url (v:lower()) then -- if it has a parameter with an archive.today url
table.insert (unset_params_t, p); -- add the url-holding parameter name to our list of parameters to unset (may or may not be a legitimate url parameter)
if 'url' == p:lower() then -- if this parameter is |url= or |URL=
url_was_archive_today = true; -- set a flag so that cite web / podcast / mailinglist don't emit a missing url error message
end
if p:match ('archive%-?url') and ('usurped' == cite_args_t['url-status'] or 'unfit' == cite_args_t['url-status']) then -- if |archive-url=archive.today and |url-status=unfit/usurped
url_was_archive_today = true; -- set a flag so that cite web / podcast / mailinglist don't emit a missing url error message
table.insert (unset_params_t, 'url'); -- add the url parameter name to our list of parameters to unset (may or may not be a legitimate url parameter)
table.insert (unset_params_t, 'URL'); -- this one because both are possible
end
if cfg.dependencies_t[p] then -- if this url-holding parameter (<p>) has dependencies
for _, dependent in ipairs (cfg.dependencies_t[p]) do -- loop through the url-holding parameter's dependency sequence
table.insert (unset_params_t, dependent); -- add dependent parameter to the list to be unset
end
end
end
end
if 0 < #unset_params_t then -- when there are parameters to unset
if not is_preview_mode then -- when in preview mode do not suppress any parameters
for _, unset_param in ipairs (unset_params_t) do -- loop through the sequence
cite_args_t[unset_param] = nil; -- and unset the url-holding parameter and its dependent parameters to avoid parameter-requires-other-parameter errors
end
end
utilities.set_message ('maint_deprecated_archive'); -- add a maintenance message
end
end
--[[-------------------------< C H E C K _ F O R _ U R L >-----------------------------------------------------
loop through a list of parameters and their values. Look at the value and if it has an external link, emit an error message.
]]
local function check_for_url (parameter_list, error_list)
for k, v in pairs (parameter_list) do -- for each parameter in the list
if is_parameter_ext_wikilink (v) then -- look at the value; if there is a URL add an error message
table.insert (error_list, utilities.wrap_style ('parameter', k));
end
end
end
--[[--------------------------< S A F E _ F O R _ U R L >------------------------------------------------------
Escape sequences for content that will be used for URL descriptions
]]
local function safe_for_url( str )
if str:match( "%[%[.-%]%]" ) ~= nil then
utilities.set_message ('err_wikilink_in_url', {});
end
return str:gsub( '[%[%]\n]', {
['['] = '[',
[']'] = ']',
['\n'] = ' ' } );
end
--[[--------------------------< E X T E R N A L _ L I N K >----------------------------------------------------
Format an external link with error checking
]]
local function external_link (URL, label, source, access)
local domain;
local path;
local base_url;
if not utilities.is_set (label) then
label = URL;
if utilities.is_set (source) then
utilities.set_message ('err_bare_url_missing_title', {utilities.wrap_style ('parameter', source)});
else
error (cfg.messages["bare_url_no_origin"]); -- programmer error; valid parameter name does not have matching meta-parameter
end
end
if not check_url (URL) then
utilities.set_message ('err_bad_url', {utilities.wrap_style ('parameter', source)});
end
domain, path = URL:match ('^([/%.%-%+:%a%d]+)([/%?#].*)$'); -- split the URL into scheme plus domain and path
if path then -- if there is a path portion
path = path:gsub ('[%[%]]', {['['] = '%5b', [']'] = '%5d'}); -- replace '[' and ']' with their percent-encoded values
URL = table.concat ({domain, path}); -- and reassemble
end
base_url = table.concat ({ "[", URL, " ", safe_for_url (label), "]" }); -- assemble a wiki-markup URL
if utilities.is_set (access) then -- access level (subscription, registration, limited)
base_url = utilities.substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[access].class, cfg.presentation[access].title, base_url}); -- add the appropriate icon
end
return base_url;
end
--[[--------------------------< D E P R E C A T E D _ P A R A M E T E R >--------------------------------------
Categorize and emit an error message when the citation contains one or more deprecated parameters. The function includes the
offending parameter name to the error message. Only one error message is emitted regardless of the number of deprecated
parameters in the citation.
added_deprecated_cat is a Boolean declared in page scope variables above
]]
local function deprecated_parameter(name)
if not added_deprecated_cat then
added_deprecated_cat = true; -- note that we've added this category
utilities.set_message ('err_deprecated_params', {name}); -- add error message
end
end
--[=[-------------------------< K E R N _ Q U O T E S >--------------------------------------------------------
Apply kerning to open the space between the quote mark provided by the module and a leading or trailing quote
mark contained in a |title= or |chapter= parameter's value.
This function will positive kern either single or double quotes:
"'Unkerned title with leading and trailing single quote marks'"
" 'Kerned title with leading and trailing single quote marks' " (in real life the kerning isn't as wide as this example)
Double single quotes (italic or bold wiki-markup) are not kerned.
Replaces Unicode quote marks in plain text or in the label portion of a [[L|D]] style wikilink with typewriter
quote marks regardless of the need for kerning. Unicode quote marks are not replaced in simple [[D]] wikilinks.
Call this function for chapter titles, for website titles, etc.; not for book titles.
]=]
local function kern_quotes (str)
local wl_type, label, link;
wl_type, label, link = utilities.is_wikilink (str); -- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]
if 1 == wl_type then -- [[D]] simple wikilink with or without quote marks
if mw.ustring.match (str, '%[%[[\"“”\'‘’].+[\"“”\'‘’]%]%]') then -- leading and trailing quote marks
str = utilities.substitute (cfg.presentation['kern-left'], str);
str = utilities.substitute (cfg.presentation['kern-right'], str);
elseif mw.ustring.match (str, '%[%[[\"“”\'‘’].+%]%]') then -- leading quote marks
str = utilities.substitute (cfg.presentation['kern-left'], str);
elseif mw.ustring.match (str, '%[%[.+[\"“”\'‘’]%]%]') then -- trailing quote marks
str = utilities.substitute (cfg.presentation['kern-right'], str);
end
else -- plain text or [[L|D]]; text in label variable
label = mw.ustring.gsub (label, '[“”]', '\"'); -- replace “” (U+201C & U+201D) with " (typewriter double quote mark)
label = mw.ustring.gsub (label, '[‘’]', '\''); -- replace ‘’ (U+2018 & U+2019) with ' (typewriter single quote mark)
local cap = mw.ustring.match (label, "^([\"\'][^\'].+)"); -- match leading double or single quote but not doubled single quotes (italic markup)
if utilities.is_set (cap) then
label = utilities.substitute (cfg.presentation['kern-left'], cap);
end
cap = mw.ustring.match (label, "^(.+[^\'][\"\'])$") -- match trailing double or single quote but not doubled single quotes (italic markup)
if utilities.is_set (cap) then
label = utilities.substitute (cfg.presentation['kern-right'], cap);
end
if 2 == wl_type then
str = utilities.make_wikilink (link, label); -- reassemble the wikilink
else
str = label;
end
end
return str;
end
--[[--------------------------< F O R M A T _ S C R I P T _ V A L U E >----------------------------------------
|script-title= holds title parameters that are not written in Latin-based scripts: Chinese, Japanese, Arabic, Hebrew, etc. These scripts should
not be italicized and may be written right-to-left. The value supplied by |script-title= is concatenated onto Title after Title has been wrapped
in italic markup.
Regardless of language, all values provided by |script-title= are wrapped in <bdi>...</bdi> tags to isolate RTL languages from the English left to right.
|script-title= provides a unique feature. The value in |script-title= may be prefixed with a two-character ISO 639-1 language code and a colon:
|script-title=ja:*** *** (where * represents a Japanese character)
Spaces between the two-character code and the colon and the colon and the first script character are allowed:
|script-title=ja : *** ***
|script-title=ja: *** ***
|script-title=ja :*** ***
Spaces preceding the prefix are allowed: |script-title = ja:*** ***
The prefix is checked for validity. If it is a valid ISO 639-1 language code, the lang attribute (lang="ja") is added to the <bdi> tag so that browsers can
know the language the tag contains. This may help the browser render the script more correctly. If the prefix is invalid, the lang attribute
is not added. At this time there is no error message for this condition.
Supports |script-title=, |script-chapter=, |script-<periodical>=
]]
local function format_script_value (script_value, script_param)
local lang=''; -- initialize to empty string
local name;
if script_value:match('^%l%l%l?%s*:') then -- if first 3 or 4 non-space characters are script language prefix
lang = script_value:match('^(%l%l%l?)%s*:%s*%S.*'); -- get the language prefix or nil if there is no script
if not utilities.is_set (lang) then
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing title part']}); -- prefix without 'title'; add error message
return ''; -- script_value was just the prefix so return empty string
end
-- if we get this far we have prefix and script
name = cfg.lang_tag_remap[lang] or mw.language.fetchLanguageName( lang, cfg.this_wiki_code ); -- get language name so that we can use it to categorize
if utilities.is_set (name) then -- is prefix a proper ISO 639-1 language code?
script_value = script_value:gsub ('^%l+%s*:%s*', ''); -- strip prefix from script
-- is prefix one of these language codes?
if utilities.in_array (lang, cfg.script_lang_codes) then
utilities.add_prop_cat ('script', {name, lang})
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['unknown language code']}); -- unknown script-language; add error message
end
lang = ' lang="' .. lang .. '" '; -- convert prefix into a lang attribute
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['invalid language code']}); -- invalid language code; add error message
lang = ''; -- invalid so set lang to empty string
end
else
utilities.set_message ('err_script_parameter', {script_param, cfg.err_msg_supl['missing prefix']}); -- no language code prefix; add error message
end
script_value = utilities.substitute (cfg.presentation['bdi'], {lang, script_value}); -- isolate in case script is RTL
return script_value;
end
--[[--------------------------< S C R I P T _ C O N C A T E N A T E >------------------------------------------
Initially for |title= and |script-title=, this function concatenates those two parameter values after the script
value has been wrapped in <bdi> tags.
]]
local function script_concatenate (title, script, script_param)
if utilities.is_set (script) then
script = format_script_value (script, script_param); -- <bdi> tags, lang attribute, categorization, etc.; returns empty string on error
if utilities.is_set (script) then
title = title .. ' ' .. script; -- concatenate title and script title
end
end
return title;
end
--[[--------------------------< W R A P _ M S G >--------------------------------------------------------------
Applies additional message text to various parameter values. Supplied string is wrapped using a message_list
configuration taking one argument. Supports lower case text for {{citation}} templates. Additional text taken
from citation_config.messages - the reason this function is similar to but separate from wrap_style().
]]
local function wrap_msg (key, str, lower)
if not utilities.is_set ( str ) then
return "";
end
if true == lower then
local msg;
msg = cfg.messages[key]:lower(); -- set the message to lower case before
return utilities.substitute ( msg, str ); -- including template text
else
return utilities.substitute ( cfg.messages[key], str );
end
end
--[[----------------< W I K I S O U R C E _ U R L _ M A K E >-------------------
Makes a Wikisource URL from Wikisource interwiki-link. Returns the URL and appropriate
label; nil else.
str is the value assigned to |chapter= (or aliases) or |title= or |title-link=
]]
local function wikisource_url_make (str)
local wl_type, D, L;
local ws_url, ws_label;
local wikisource_prefix = table.concat ({'https://', cfg.this_wiki_code, '.wikisource.org/wiki/'});
wl_type, D, L = utilities.is_wikilink (str); -- wl_type is 0 (not a wikilink), 1 (simple wikilink), 2 (complex wikilink)
if 0 == wl_type then -- not a wikilink; might be from |title-link=
str = D:match ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title
});
ws_label = str; -- label for the URL
end
elseif 1 == wl_type then -- simple wikilink: [[Wikisource:ws article]]
str = D:match ('^[Ww]ikisource:(.+)') or D:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title
});
ws_label = str; -- label for the URL
end
elseif 2 == wl_type then -- non-so-simple wikilink: [[Wikisource:ws article|displayed text]] ([[L|D]])
str = L:match ('^[Ww]ikisource:(.+)') or L:match ('^[Ss]:(.+)'); -- article title from interwiki link with long-form or short-form namespace
if utilities.is_set (str) then
ws_label = D; -- get ws article name from display portion of interwiki link
ws_url = table.concat ({ -- build a Wikisource URL
wikisource_prefix, -- prefix
str, -- article title without namespace from link portion of wikilink
});
end
end
if ws_url then
ws_url = mw.uri.encode (ws_url, 'WIKI'); -- make a usable URL
ws_url = ws_url:gsub ('%%23', '#'); -- undo percent-encoding of fragment marker
end
return ws_url, ws_label, L or D; -- return proper URL or nil and a label or nil
end
--[[----------------< F O R M A T _ P E R I O D I C A L >-----------------------
Format the three periodical parameters: |script-<periodical>=, |<periodical>=,
and |trans-<periodical>= into a single Periodical meta-parameter.
]]
local function format_periodical (script_periodical, script_periodical_source, periodical, trans_periodical)
if not utilities.is_set (periodical) then
periodical = ''; -- to be safe for concatenation
else
periodical = utilities.wrap_style ('italic-title', periodical); -- style
end
periodical = script_concatenate (periodical, script_periodical, script_periodical_source); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
if utilities.is_set (trans_periodical) then
trans_periodical = utilities.wrap_style ('trans-italic-title', trans_periodical);
if utilities.is_set (periodical) then
periodical = periodical .. ' ' .. trans_periodical;
else -- here when trans-periodical without periodical or script-periodical
periodical = trans_periodical;
utilities.set_message ('err_trans_missing_title', {'periodical'});
end
end
return periodical;
end
--[[------------------< F O R M A T _ C H A P T E R _ T I T L E >---------------
Format the four chapter parameters: |script-chapter=, |chapter=, |trans-chapter=,
and |chapter-url= into a single chapter meta- parameter (chapter_url_source used
for error messages).
]]
local function format_chapter_title (script_chapter, script_chapter_source, chapter, trans_chapter, trans_chapter_source, chapter_url, chapter_url_source, no_quotes, access)
local ws_url, ws_label, L = wikisource_url_make (chapter); -- make a wikisource URL and label from a wikisource interwiki link
if ws_url then
ws_label = ws_label:gsub ('_', ' '); -- replace underscore separators with space characters
chapter = ws_label;
end
if not utilities.is_set (chapter) then
chapter = ''; -- to be safe for concatenation
else
if false == no_quotes then
chapter = kern_quotes (chapter); -- if necessary, separate chapter title's leading and trailing quote marks from module provided quote marks
chapter = utilities.wrap_style ('quoted-title', chapter);
end
end
chapter = script_concatenate (chapter, script_chapter, script_chapter_source); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
if utilities.is_set (chapter_url) then
chapter = external_link (chapter_url, chapter, chapter_url_source, access); -- adds bare_url_missing_title error if appropriate
elseif ws_url then
chapter = external_link (ws_url, chapter .. ' ', 'ws link in chapter'); -- adds bare_url_missing_title error if appropriate; space char to move icon away from chap text; TODO: better way to do this?
chapter = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, chapter});
end
if utilities.is_set (trans_chapter) then
trans_chapter = utilities.wrap_style ('trans-quoted-title', trans_chapter);
if utilities.is_set (chapter) then
chapter = chapter .. ' ' .. trans_chapter;
else -- here when trans_chapter without chapter or script-chapter
chapter = trans_chapter;
utilities.set_message ('err_trans_missing_title', {trans_chapter_source:match ('trans%-?(.+)')}); -- when no chapter, get matching name from trans-<param>
end
end
return chapter;
end
--[[----------------< H A S _ I N V I S I B L E _ C H A R S >-------------------
This function searches a parameter's value for non-printable or invisible characters.
The search stops at the first match.
This function will detect the visible replacement character when it is part of the Wikisource.
Detects but ignores nowiki and math stripmarkers. Also detects other named stripmarkers
(gallery, math, pre, ref) and identifies them with a slightly different error message.
See also coins_cleanup().
Output of this function is an error message that identifies the character or the
Unicode group, or the stripmarker that was detected along with its position (or,
for multi-byte characters, the position of its first byte) in the parameter value.
]]
local function has_invisible_chars (param, v)
local position; -- position of invisible char or starting position of stripmarker
local capture; -- used by stripmarker detection to hold name of the stripmarker
local stripmarker; -- boolean set true when a stripmarker is found
capture = string.match (v, '[%w%p ]*'); -- test for values that are simple ASCII text and bypass other tests if true
if capture == v then -- if same there are no Unicode characters
return;
end
for _, invisible_char in ipairs (cfg.invisible_chars) do
local char_name = invisible_char[1]; -- the character or group name
local pattern = invisible_char[2]; -- the pattern used to find it
position, _, capture = mw.ustring.find (v, pattern); -- see if the parameter value contains characters that match the pattern
if position and (cfg.invisible_defs.zwj == capture) then -- if we found a zero-width joiner character
if mw.ustring.find (v, cfg.indic_script) then -- it's ok if one of the Indic scripts
position = nil; -- unset position
elseif cfg.emoji_t[mw.ustring.codepoint (v, position+1)] then -- is zwj followed by a character listed in emoji{}?
position = nil; -- unset position
end
end
if position then
if 'nowiki' == capture or 'math' == capture or -- nowiki and math stripmarkers (not an error condition)
('templatestyles' == capture and utilities.in_array (param, {'id', 'quote'})) then -- templatestyles stripmarker allowed in these parameters
stripmarker = true; -- set a flag
elseif true == stripmarker and cfg.invisible_defs.del == capture then -- because stripmakers begin and end with the delete char, assume that we've found one end of a stripmarker
position = nil; -- unset; for now, ignore linter warning
else
local err_msg;
if capture and not (cfg.invisible_defs.del == capture or cfg.invisible_defs.zwj == capture) then
err_msg = utilities.substitute (cfg.messages.invisible_1, {capture, char_name}); -- <capture> here is stripmarker name
else
err_msg = utilities.substitute (cfg.messages.invisible_2, char_name);
end
utilities.set_message ('err_invisible_char', {err_msg, utilities.wrap_style ('parameter', param), position}); -- add error message
return; -- and done with this parameter
end
end
end
end
--[[-------------------< A R G U M E N T _ W R A P P E R >----------------------
Argument wrapper. This function provides support for argument mapping defined
in the configuration file so that multiple names can be transparently aliased to
single internal variable.
]]
local function argument_wrapper ( args )
local origin = {};
return setmetatable({
ORIGIN = function ( self, k )
local dummy = self[k]; -- force the variable to be loaded; for now, ignore linter warning
return origin[k];
end
},
{
__index = function ( tbl, k )
if origin[k] ~= nil then
return nil;
end
local v;
local list = cfg.aliases[k];
if type( list ) == 'table' then
v, origin[k] = utilities.select_one ( args, list, 'err_redundant_parameters' );
if origin[k] == nil then
origin[k] = ''; -- Empty string, not nil
end
elseif list ~= nil then
v, origin[k] = args[list], list;
else
-- maybe let through instead of raising an error?
-- v, origin[k] = args[k], k;
error( cfg.messages['unknown_argument_map'] .. ': ' .. k);
end
-- Empty strings, not nil;
if v == nil then
v = '';
origin[k] = '';
end
-- tbl = rawset( tbl, k, v );
rawset( tbl, k, v );
return v;
end,
});
end
--[[--------------------------< N O W R A P _ D A T E >-------------------------
When date is YYYY-MM-DD format wrap in nowrap span: <span ...>YYYY-MM-DD</span>.
When date is DD MMMM YYYY or is MMMM DD, YYYY then wrap in nowrap span:
<span ...>DD MMMM</span> YYYY or <span ...>MMMM DD,</span> YYYY
DOES NOT yet support MMMM YYYY or any of the date ranges.
]]
local function nowrap_date (date)
local cap;
local cap2;
if date:match("^%d%d%d%d%-%d%d%-%d%d$") then
date = utilities.substitute (cfg.presentation['nowrap1'], date);
elseif date:match("^%a+%s*%d%d?,%s+%d%d%d%d$") or date:match ("^%d%d?%s*%a+%s+%d%d%d%d$") then
cap, cap2 = string.match (date, "^(.*)%s+(%d%d%d%d)$");
date = utilities.substitute (cfg.presentation['nowrap2'], {cap, cap2});
end
return date;
end
--[[--------------------------< S E T _ T I T L E T Y P E >---------------------
This function sets default title types (equivalent to the citation including
|type=<default value>) for those templates that have defaults. Also handles the
special case where it is desirable to omit the title type from the rendered citation
(|type=none).
]]
local function set_titletype (cite_class, title_type)
if utilities.is_set (title_type) then
if 'none' == cfg.keywords_xlate[title_type] then
title_type = ''; -- if |type=none then type parameter not displayed
end
return title_type; -- if |type= has been set to any other value use that value
end
return cfg.title_types [cite_class] or ''; -- set template's default title type; else empty string for concatenation
end
--[[--------------------------< S A F E _ J O I N >-----------------------------
Joins a sequence of strings together while checking for duplicate separation characters.
]]
local function safe_join( tbl, duplicate_char )
local f = {}; -- create a function table appropriate to type of 'duplicate character'
if 1 == #duplicate_char then -- for single byte ASCII characters use the string library functions
f.gsub = string.gsub
f.match = string.match
f.sub = string.sub
else -- for multi-byte characters use the ustring library functions
f.gsub = mw.ustring.gsub
f.match = mw.ustring.match
f.sub = mw.ustring.sub
end
local str = ''; -- the output string
for _, value in ipairs( tbl ) do
if value == nil then value = ''; end
if str == '' then -- if output string is empty
str = value; -- assign value to it (first time through the loop)
elseif value ~= '' then
local comp; -- what does 'comp' mean?
if value:sub(1, 1) == '<' then -- special case of values enclosed in spans and other markup.
comp = value:gsub( "%b<>", "" ); -- remove HTML markup (<span>string</span> -> string)
else
comp = value;
end
-- typically duplicate_char is sepc
if f.sub(comp, 1, 1) == duplicate_char then -- is first character same as duplicate_char? why test first character?
-- Because individual string segments often (always?) begin with terminal punct for the
-- preceding segment: 'First element' .. 'sepc next element' .. etc.?
local trim = false;
local end_chr = f.sub(str, -1, -1); -- get the last character of the output string
-- str = str .. "<HERE(enchr=" .. end_chr .. ")" -- debug stuff?
if end_chr == duplicate_char then -- if same as separator
str = f.sub(str, 1, -2); -- remove it
elseif end_chr == "'" then -- if it might be wiki-markup
if f.sub(str, -3, -1) == duplicate_char .. "''" then -- if last three chars of str are sepc''
str = f.sub(str, 1, -4) .. "''"; -- remove them and add back ''
elseif f.sub(str, -5, -1) == duplicate_char .. "]]''" then -- if last five chars of str are sepc]]''
trim = true; -- why? why do this and next differently from previous?
elseif f.sub(str, -4, -1) == duplicate_char .. "]''" then -- if last four chars of str are sepc]''
trim = true; -- same question
end
elseif end_chr == "]" then -- if it might be wiki-markup
if f.sub(str, -3, -1) == duplicate_char .. "]]" then -- if last three chars of str are sepc]] wikilink
trim = true;
elseif f.sub(str, -3, -1) == duplicate_char .. '"]' then -- if last three chars of str are sepc"] quoted external link
trim = true;
elseif f.sub(str, -2, -1) == duplicate_char .. "]" then -- if last two chars of str are sepc] external link
trim = true;
elseif f.sub(str, -4, -1) == duplicate_char .. "'']" then -- normal case when |url=something & |title=Title.
trim = true;
end
elseif end_chr == " " then -- if last char of output string is a space
if f.sub(str, -2, -1) == duplicate_char .. " " then -- if last two chars of str are <sepc><space>
str = f.sub(str, 1, -3); -- remove them both
end
end
if trim then
if value ~= comp then -- value does not equal comp when value contains HTML markup
local dup2 = duplicate_char;
if f.match(dup2, "%A" ) then dup2 = "%" .. dup2; end -- if duplicate_char not a letter then escape it
value = f.gsub(value, "(%b<>)" .. dup2, "%1", 1 ) -- remove duplicate_char if it follows HTML markup
else
value = f.sub(value, 2, -1 ); -- remove duplicate_char when it is first character
end
end
end
str = str .. value; -- add it to the output string
end
end
return str;
end
--[[--------------------------< I S _ S U F F I X >-----------------------------
returns true if suffix is properly formed Jr, Sr, or ordinal in the range 1–9.
Puncutation not allowed.
]]
local function is_suffix (suffix)
if utilities.in_array (suffix, {'Jr', 'Sr', 'Jnr', 'Snr', '1st', '2nd', '3rd'}) or suffix:match ('^%dth$') then
return true;
end
return false;
end
--[[--------------------< I S _ G O O D _ V A N C _ N A M E >-------------------
For Vancouver style, author/editor names are supposed to be rendered in Latin
(read ASCII) characters. When a name uses characters that contain diacritical
marks, those characters are to be converted to the corresponding Latin
character. When a name is written using a non-Latin alphabet or logogram, that
name is to be transliterated into Latin characters. The module doesn't do this
so editors may/must.
This test allows |first= and |last= names to contain any of the letters defined
in the four Unicode Latin character sets
[http://www.unicode.org/charts/PDF/U0000.pdf C0 Controls and Basic Latin] 0041–005A, 0061–007A
[http://www.unicode.org/charts/PDF/U0080.pdf C1 Controls and Latin-1 Supplement] 00C0–00D6, 00D8–00F6, 00F8–00FF
[http://www.unicode.org/charts/PDF/U0100.pdf Latin Extended-A] 0100–017F
[http://www.unicode.org/charts/PDF/U0180.pdf Latin Extended-B] 0180–01BF, 01C4–024F
|lastn= also allowed to contain hyphens, spaces, and apostrophes.
(http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)
|firstn= also allowed to contain hyphens, spaces, apostrophes, and periods
This original test:
if nil == mw.ustring.find (last, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%']*$")
or nil == mw.ustring.find (first, "^[A-Za-zÀ-ÖØ-öø-ƿDŽ-ɏ%-%s%'%.]+[2-6%a]*$") then
was written outside of the code editor and pasted here because the code editor
gets confused between character insertion point and cursor position. The test has
been rewritten to use decimal character escape sequence for the individual bytes
of the Unicode characters so that it is not necessary to use an external editor
to maintain this code.
\195\128-\195\150 – À-Ö (U+00C0–U+00D6 – C0 controls)
\195\152-\195\182 – Ø-ö (U+00D8-U+00F6 – C0 controls)
\195\184-\198\191 – ø-ƿ (U+00F8-U+01BF – C0 controls, Latin extended A & B)
\199\132-\201\143 – DŽ-ɏ (U+01C4-U+024F – Latin extended B)
]]
local function is_good_vanc_name (last, first, suffix, position)
if not suffix then
if first:find ('[,%s]') then -- when there is a space or comma, might be first name/initials + generational suffix
first = first:match ('(.-)[,%s]+'); -- get name/initials
suffix = first:match ('[,%s]+(.+)$'); -- get generational suffix
end
end
if utilities.is_set (suffix) then
if not is_suffix (suffix) then
add_vanc_error (cfg.err_msg_supl.suffix, position);
return false; -- not a name with an appropriate suffix
end
end
if nil == mw.ustring.find (last, "^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191%-%s%']*$") or
nil == mw.ustring.find (first, "^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191%-%s%'%.]*$") then
add_vanc_error (cfg.err_msg_supl['non-Latin char'], position);
return false; -- not a string of Latin characters; Vancouver requires Romanization
end;
return true;
end
--[[--------------------------< R E D U C E _ T O _ I N I T I A L S >------------------------------------------
Attempts to convert names to initials in support of |name-list-style=vanc.
Names in |firstn= may be separated by spaces or hyphens, or for initials, a period.
See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35062/.
Vancouver style requires family rank designations (Jr, II, III, etc.) to be rendered
as Jr, 2nd, 3rd, etc. See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35085/.
This code only accepts and understands generational suffix in the Vancouver format
because Roman numerals look like, and can be mistaken for, initials.
This function uses ustring functions because firstname initials may be any of the
Unicode Latin characters accepted by is_good_vanc_name ().
]]
local function reduce_to_initials (first, position)
if first:find (',', 1, true) then
return first; -- commas not allowed; abandon
end
local name, suffix = mw.ustring.match (first, "^(%u+) ([%dJS][%drndth]+)$");
if not name then -- if not initials and a suffix
name = mw.ustring.match (first, "^(%u+)$"); -- is it just initials?
end
if name then -- if first is initials with or without suffix
if 3 > mw.ustring.len (name) then -- if one or two initials
if suffix then -- if there is a suffix
if is_suffix (suffix) then -- is it legitimate?
return first; -- one or two initials and a valid suffix so nothing to do
else
add_vanc_error (cfg.err_msg_supl.suffix, position); -- one or two initials with invalid suffix so error message
return first; -- and return first unmolested
end
else
return first; -- one or two initials without suffix; nothing to do
end
end
end -- if here then name has 3 or more uppercase letters so treat them as a word
local initials_t = {}; -- table to hold initials
local i = 1; -- counter for number of initials
local names_t = mw.text.split (first, '[%s%-]+'); -- split into a sequence of names and possible suffix
while names_t[i] do -- loop through the sequence
if 1 < i and names_t[i]:match ('[%dJS][%drndth]+%.?$') then -- if not the first name, and looks like a suffix (may have trailing dot)
names_t[i] = names_t[i]:gsub ('%.', ''); -- remove terminal dot if present
if is_suffix (names_t[i]) then -- if a legitimate suffix
table.insert (initials_t, ' ' .. names_t[i]); -- add a separator space, insert at end of initials sequence
break; -- and done because suffix must fall at the end of a name
end -- no error message if not a suffix; possibly because of Romanization
end
if 3 > i then
table.insert (initials_t, mw.ustring.sub (names_t[i], 1, 1)); -- insert the initial at end of initials sequence
end
i = i + 1; -- bump the counter
end
return table.concat (initials_t); -- Vancouver format does not include spaces.
end
--[[--------------------------< I N T E R W I K I _ P R E F I X E N _ G E T >----------------------------------
extract interwiki prefixen from <value>. Returns two one or two values:
false – no prefixen
nil – prefix exists but not recognized
project prefix, language prefix – when value has either of:
:<project>:<language>:<article>
:<language>:<project>:<article>
project prefix, nil – when <value> has only a known single-letter prefix
nil, language prefix – when <value> has only a known language prefix
accepts single-letter project prefixen: 'd' (wikidata), 's' (wikisource), and 'w' (wikipedia) prefixes; at this
writing, the other single-letter prefixen (b (wikibook), c (commons), m (meta), n (wikinews), q (wikiquote), and
v (wikiversity)) are not supported.
]]
local function interwiki_prefixen_get (value, is_link)
if not value:find (':%l+:') then -- if no prefix
return false; -- abandon; boolean here to distinguish from nil fail returns later
end
local prefix_patterns_linked_t = { -- sequence of valid interwiki and inter project prefixen
'^%[%[:([dsw]):(%l%l+):', -- wikilinked; project and language prefixes
'^%[%[:(%l%l+):([dsw]):', -- wikilinked; language and project prefixes
'^%[%[:([dsw]):', -- wikilinked; project prefix
'^%[%[:(%l%l+):', -- wikilinked; language prefix
}
local prefix_patterns_unlinked_t = { -- sequence of valid interwiki and inter project prefixen
'^:([dsw]):(%l%l+):', -- project and language prefixes
'^:(%l%l+):([dsw]):', -- language and project prefixes
'^:([dsw]):', -- project prefix
'^:(%l%l+):', -- language prefix
}
local cap1, cap2;
for _, pattern in ipairs ((is_link and prefix_patterns_linked_t) or prefix_patterns_unlinked_t) do
cap1, cap2 = value:match (pattern);
if cap1 then
break; -- found a match so stop looking
end
end
if cap1 and cap2 then -- when both then :project:language: or :language:project: (both forms allowed)
if 1 == #cap1 then -- length == 1 then :project:language:
if cfg.inter_wiki_map[cap2] then -- is language prefix in the interwiki map?
return cap1, cap2; -- return interwiki project and interwiki language
end
else -- here when :language:project:
if cfg.inter_wiki_map[cap1] then -- is language prefix in the interwiki map?
return cap2, cap1; -- return interwiki project and interwiki language
end
end
return nil; -- unknown interwiki language
elseif not (cap1 or cap2) then -- both are nil?
return nil; -- we got something that looks like a project prefix but isn't; return fail
elseif 1 == #cap1 then -- here when one capture
return cap1, nil; -- length is 1 so return project, nil language
else -- here when one capture and its length it more than 1
if cfg.inter_wiki_map[cap1] then -- is language prefix in the interwiki map?
return nil, cap1; -- return nil project, language
end
end
end
--[[--------------------------< L I S T _ P E O P L E >--------------------------
Formats a list of people (authors, contributors, editors, interviewers, translators)
names in the list will be linked when
|<name>-link= has a value
|<name>-mask- does NOT have a value; masked names are presumed to have been
rendered previously so should have been linked there
when |<name>-mask=0, the associated name is not rendered
]]
local function list_people (control, people, etal)
local sep;
local namesep;
local format = control.format;
local maximum = control.maximum;
local name_list = {};
if 'vanc' == format then -- Vancouver-like name styling?
sep = cfg.presentation['sep_nl_vanc']; -- name-list separator between names is a comma
namesep = cfg.presentation['sep_name_vanc']; -- last/first separator is a space
else
sep = cfg.presentation['sep_nl']; -- name-list separator between names is a semicolon
namesep = cfg.presentation['sep_name']; -- last/first separator is <comma><space>
end
if sep:sub (-1, -1) ~= " " then sep = sep .. " " end
if utilities.is_set (maximum) and maximum < 1 then return "", 0; end -- returned 0 is for EditorCount; not used for other names
for i, person in ipairs (people) do
if utilities.is_set (person.last) then
local mask = person.mask;
local one;
local sep_one = sep;
if utilities.is_set (maximum) and i > maximum then
etal = true;
break;
end
if mask then
local n = tonumber (mask); -- convert to a number if it can be converted; nil else
if n then
one = 0 ~= n and string.rep("—", n) or nil; -- make a string of (n > 0) mdashes, nil else, to replace name
person.link = nil; -- don't create link to name if name is replaces with mdash string or has been set nil
else
one = mask; -- replace name with mask text (must include name-list separator)
sep_one = " "; -- modify name-list separator
end
else
one = person.last; -- get surname
local first = person.first -- get given name
if utilities.is_set (first) then
if ("vanc" == format) then -- if Vancouver format
one = one:gsub ('%.', ''); -- remove periods from surnames (http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)
if not person.corporate and is_good_vanc_name (one, first, nil, i) then -- and name is all Latin characters; corporate authors not tested
first = reduce_to_initials (first, i); -- attempt to convert first name(s) to initials
end
end
one = one .. namesep .. first;
end
end
if utilities.is_set (person.link) then
one = utilities.make_wikilink (person.link, one); -- link author/editor
end
if one then -- if <one> has a value (name, mdash replacement, or mask text replacement)
local proj, tag = interwiki_prefixen_get (one, true); -- get the interwiki prefixen if present
if 'w' == proj and ('Wikipedia' == mw.site.namespaces.Project['name']) then
proj = nil; -- for stuff like :w:de:<article>, :w is unnecessary TODO: maint cat?
end
if proj then
local proj_name = ({['d'] = cfg.messages.wikidata, ['s'] = cfg.messages.wikisource, ['w'] = cfg.messages.wikipedia})[proj]; -- :w (wikipedia) for linking from a non-wikipedia project
if proj_name then
one = one .. utilities.wrap_style ('interproj', proj_name); -- add resized leading space, brackets, static text, language name
utilities.add_prop_cat ('interproj-linked-name', proj); -- categorize it; <proj> is sort key
tag = nil; -- unset; don't do both project and language
end
end
if tag == cfg.this_wiki_code then
tag = nil; -- stuff like :en:<article> at en.wiki is pointless TODO: maint cat?
end
if tag then
local lang = cfg.lang_tag_remap[tag] or cfg.mw_languages_by_tag_t[tag];
if lang then -- error messaging done in extract_names() where we know parameter names
one = one .. utilities.wrap_style ('interwiki', lang); -- add resized leading space, brackets, static text, language name
utilities.add_prop_cat ('interwiki-linked-name', tag); -- categorize it; <tag> is sort key
end
end
table.insert (name_list, one); -- add it to the list of names
table.insert (name_list, sep_one); -- add the proper name-list separator
end
end
end
local count = #name_list / 2; -- (number of names + number of separators) divided by 2
if 0 < count then
if 1 < count and not etal then
if 'amp' == format then
name_list[#name_list-2] = " & "; -- replace last separator with ampersand text
elseif 'and' == format then
if 2 == count then
name_list[#name_list-2] = cfg.presentation.sep_nl_and; -- replace last separator with 'and' text
else
name_list[#name_list-2] = cfg.presentation.sep_nl_end; -- replace last separator with '(sep) and' text
end
end
end
name_list[#name_list] = nil; -- erase the last separator
end
local result = table.concat (name_list); -- construct list
if etal and utilities.is_set (result) then -- etal may be set by |display-authors=etal but we might not have a last-first list
result = result .. sep .. cfg.messages['et al']; -- we've got a last-first list and etal so add et al.
end
return result, count; -- return name-list string and count of number of names (count used for editor names only)
end
--[[--------------------< M A K E _ C I T E R E F _ I D >-----------------------
Generates a CITEREF anchor ID if we have at least one name or a date. Otherwise
returns an empty string.
namelist is one of the contributor-, author-, or editor-name lists chosen in that
order. year is Year or anchor_year.
]]
local function make_citeref_id (namelist, year)
local names={}; -- a table for the one to four names and year
for i,v in ipairs (namelist) do -- loop through the list and take up to the first four last names
names[i] = v.last
if i == 4 then break end -- if four then done
end
table.insert (names, year); -- add the year at the end
local id = table.concat(names); -- concatenate names and year for CITEREF id
if utilities.is_set (id) then -- if concatenation is not an empty string
return "CITEREF" .. id; -- add the CITEREF portion
else
return ''; -- return an empty string; no reason to include CITEREF id in this citation
end
end
--[[--------------------------< C I T E _ C L A S S _A T T R I B U T E _M A K E >------------------------------
construct <cite> tag class attribute for this citation.
<cite_class> – config.CitationClass from calling template
<mode> – value from |mode= parameter
]]
local function cite_class_attribute_make (cite_class, mode)
local class_t = {};
table.insert (class_t, 'citation'); -- required for blue highlight
if 'citation' ~= cite_class then
table.insert (class_t, cite_class); -- identify this template for user css
table.insert (class_t, utilities.is_set (mode) and mode or 'cs1'); -- identify the citation style for user css or javascript
else
table.insert (class_t, utilities.is_set (mode) and mode or 'cs2'); -- identify the citation style for user css or javascript
end
for _, prop_key in ipairs (z.prop_keys_t) do
table.insert (class_t, prop_key); -- identify various properties for user css or javascript
end
return table.concat (class_t, ' '); -- make a big string and done
end
--[[---------------------< N A M E _ H A S _ E T A L >--------------------------
Evaluates the content of name parameters (author, editor, etc.) for variations on
the theme of et al. If found, the et al. is removed, a flag is set to true and
the function returns the modified name and the flag.
This function never sets the flag to false but returns its previous state because
it may have been set by previous passes through this function or by the associated
|display-<names>=etal parameter
]]
local function name_has_etal (name, etal, nocat, param)
if utilities.is_set (name) then -- name can be nil in which case just return
local patterns = cfg.et_al_patterns; -- get patterns from configuration
for _, pattern in ipairs (patterns) do -- loop through all of the patterns
if name:match (pattern) then -- if this 'et al' pattern is found in name
name = name:gsub (pattern, ''); -- remove the offending text
etal = true; -- set flag (may have been set previously here or by |display-<names>=etal)
if not nocat then -- no categorization for |vauthors=
utilities.set_message ('err_etal', {param}); -- and set an error if not added
end
end
end
end
return name, etal;
end
--[[---------------------< N A M E _ I S _ N U M E R I C >----------------------
Add an error message and category when <name> parameter value does not contain letters.
Add a maintenance category when <name> parameter value has numeric characters mixed with characters that are
not numeric characters; could be letters and/or punctuation characters.
This function will only emit one error and one maint message for the current template. Does not emit both error
and maint messages/categories for the same parameter value.
returns nothing
]]
local function name_is_numeric (name, name_alias, list_name)
local patterns = {
'^%D+%d', -- <name> must have digits preceded by other characters
'^%D*%d+%D+', -- <name> must have digits followed by other characters
}
if not added_numeric_name_errs and mw.ustring.match (name, '^[%A]+$') then -- if we have not already set an error message and <name> does not have any alpha characters
utilities.set_message ('err_numeric_names', name_alias); -- add an error message
added_numeric_name_errs = true; -- set the flag so we emit only one error message
return; -- when here no point in further testing; abandon
end
if not added_numeric_name_maint then -- if we have already set a maint message
for _, pattern in ipairs (patterns) do -- spin through list of patterns
if mw.ustring.match (name, pattern) then -- digits preceded or followed by anything but digits; %D+ includes punctuation
utilities.set_message ('maint_numeric_names', cfg.special_case_translation [list_name]); -- add a maint cat for this template
added_numeric_name_maint = true; -- set the flag so we emit only one maint message
return; -- when here no point in further testing; abandon
end
end
end
end
--[[-----------------< N A M E _ H A S _ M U L T _ N A M E S >------------------
Evaluates the content of last/surname (authors etc.) parameters for multiple names.
Multiple names are indicated if there is more than one comma or any "unescaped"
semicolons. Escaped semicolons are ones used as part of selected HTML entities.
If the condition is met, the function adds the multiple name maintenance category.
Same test for first except that commas should not appear in given names (MOS:JR says
that the generational suffix does not take a separator character). Titles, degrees,
postnominals, affiliations, all normally comma separated don't belong in a citation.
<name> – name parameter value
<list_name> – AuthorList, EditorList, etc
<limit> – number of allowed commas; 1 (default) for surnames; 0 for given names
returns nothing
]]
local function name_has_mult_names (name, list_name, limit)
local _, commas, semicolons, nbsps;
limit = limit and limit or 1;
if utilities.is_set (name) then
_, commas = name:gsub (',', ''); -- count the number of commas
_, semicolons = name:gsub (';', ''); -- count the number of semicolons
-- nbsps probably should be its own separate count rather than merged in
-- some way with semicolons because Lua patterns do not support the
-- grouping operator that regex does, which means there is no way to add
-- more entities to escape except by adding more counts with the new
-- entities
_, nbsps = name:gsub (' ',''); -- count nbsps
-- There is exactly 1 semicolon per entity, so subtract nbsps
-- from semicolons to 'escape' them. If additional entities are added,
-- they also can be subtracted.
if limit < commas or 0 < (semicolons - nbsps) then
utilities.set_message ('maint_mult_names', cfg.special_case_translation [list_name]); -- add a maint message
end
end
end
--[=[-------------------------< I S _ G E N E R I C >----------------------------------------------------------
Compares values assigned to various parameters according to the string provided as <item> in the function call.
<item> can have on of two values:
'generic_names' – for name-holding parameters: |last=, |first=, |editor-last=, etc
'generic_titles' – for |title=
There are two types of generic tests. The 'accept' tests look for a pattern that should not be rejected by the
'reject' test. For example,
|author=[[John Smith (author)|Smith, John]]
would be rejected by the 'author' reject test. But piped wikilinks with 'author' disambiguation should not be
rejected so the 'accept' test prevents that from happening. Accept tests are always performed before reject
tests.
Each of the 'accept' and 'reject' sequence tables hold tables for en.wiki (['en']) and local.wiki (['local'])
that each can hold a test sequence table The sequence table holds, at index [1], a test pattern, and, at index
[2], a boolean control value. The control value tells string.find() or mw.ustring.find() to do plain-text search (true)
or a pattern search (false). The intent of all this complexity is to make these searches as fast as possible so
that we don't run out of processing time on very large articles.
Returns
true when a reject test finds the pattern or string
false when an accept test finds the pattern or string
nil else
]=]
local function is_generic (item, value)
local str_lower = { -- use string.lower() for en.wiki (['en']) and use mw.ustring.lower() or local.wiki (['local'])
['en'] = string.lower,
['local'] = mw.ustring.lower,
}
local str_find = { -- use string.find() for en.wiki (['en']) and use mw.ustring.find() or local.wiki (['local'])
['en'] = string.find,
['local'] = mw.ustring.find,
}
local function test (val, test_t, wiki) -- local function to do the testing; <wiki> selects lower() and find() functions
val = test_t[2] and str_lower[wiki](value) or val; -- when <test_t[2]> set to 'true', plaintext search using lowercase value
return str_find[wiki] (val, test_t[1], 1, test_t[2]); -- return nil when not found or matched
end
local test_types_t = {'accept', 'reject'}; -- test accept patterns first, then reject patterns
local wikis_t = {'en', 'local'}; -- do tests for each of these keys; en.wiki first, local.wiki second
for _, test_type in ipairs (test_types_t) do -- for each test type
for _, generic_value in pairs (cfg.special_case_translation[item][test_type]) do -- spin through the list of generic value fragments to accept or reject
for _, wiki in ipairs (wikis_t) do
if generic_value[wiki] then
if test (value, generic_value[wiki], wiki) then -- go do the test
return ('reject' == test_type); -- param value rejected, return true; false else
end
end
end
end
end
end
--[[--------------------------< N A M E _ I S _ G E N E R I C >------------------------------------------------
calls is_generic() to determine if <name> is a 'generic name' listed in cfg.generic_names; <name_alias> is the
parameter name used in error messaging
]]
local function name_is_generic (name, name_alias)
if not added_generic_name_errs and is_generic ('generic_names', name) then
utilities.set_message ('err_generic_name', name_alias); -- set an error message
added_generic_name_errs = true;
end
end
--[[--------------------------< N A M E _ C H E C K S >--------------------------------------------------------
This function calls various name checking functions used to validate the content of the various name-holding parameters.
]]
local function name_checks (last, first, list_name, last_alias, first_alias)
local accept_name;
if utilities.is_set (last) then
last, accept_name = utilities.has_accept_as_written (last); -- remove accept-this-as-written markup when it wraps all of <last>
if not accept_name then -- <last> not wrapped in accept-as-written markup
name_has_mult_names (last, list_name); -- check for multiple names in the parameter
name_is_numeric (last, last_alias, list_name); -- check for names that have no letters or are a mix of digits and other characters
name_is_generic (last, last_alias); -- check for names found in the generic names list
end
end
if utilities.is_set (first) then
first, accept_name = utilities.has_accept_as_written (first); -- remove accept-this-as-written markup when it wraps all of <first>
if not accept_name then -- <first> not wrapped in accept-as-written markup
name_has_mult_names (first, list_name, 0); -- check for multiple names in the parameter; 0 is number of allowed commas in a given name
name_is_numeric (first, first_alias, list_name); -- check for names that have no letters or are a mix of digits and other characters
name_is_generic (first, first_alias); -- check for names found in the generic names list
end
local wl_type, D = utilities.is_wikilink (first);
if 0 ~= wl_type then
first = D;
utilities.set_message ('err_bad_paramlink', first_alias);
end
end
return last, first; -- done
end
--[[----------------------< E X T R A C T _ N A M E S >-------------------------
Gets name list from the input arguments
Searches through args in sequential order to find |lastn= and |firstn= parameters
(or their aliases), and their matching link and mask parameters. Stops searching
when both |lastn= and |firstn= are not found in args after two sequential attempts:
found |last1=, |last2=, and |last3= but doesn't find |last4= and |last5= then the
search is done.
This function emits an error message when there is a |firstn= without a matching
|lastn=. When there are 'holes' in the list of last names, |last1= and |last3=
are present but |last2= is missing, an error message is emitted. |lastn= is not
required to have a matching |firstn=.
When an author or editor parameter contains some form of 'et al.', the 'et al.'
is stripped from the parameter and a flag (etal) returned that will cause list_people()
to add the static 'et al.' text from Module:Citation/CS1/Configuration. This keeps
'et al.' out of the template's metadata. When this occurs, an error is emitted.
]]
local function extract_names(args, list_name)
local names = {}; -- table of names
local last; -- individual name components
local first;
local link;
local mask;
local i = 1; -- loop counter/indexer
local n = 1; -- output table indexer
local count = 0; -- used to count the number of times we haven't found a |last= (or alias for authors, |editor-last or alias for editors)
local etal = false; -- return value set to true when we find some form of et al. in an author parameter
local last_alias, first_alias, link_alias; -- selected parameter aliases used in error messaging
while true do
last, last_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'err_redundant_parameters', i ); -- search through args for name components beginning at 1
first, first_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'err_redundant_parameters', i );
link, link_alias = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i );
mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', i );
if last then -- error check |lastn= alias for unknown interwiki link prefix; done here because this is where we have the parameter name
local project, language = interwiki_prefixen_get (last, true); -- true because we expect interwiki links in |lastn= to be wikilinked
if nil == project and nil == language then -- when both are nil
utilities.set_message ('err_bad_paramlink', last_alias); -- not known, emit an error message -- TODO: err_bad_interwiki?
last = utilities.remove_wiki_link (last); -- remove wikilink markup; show display value only
end
end
if link then -- error check |linkn= alias for unknown interwiki link prefix
local project, language = interwiki_prefixen_get (link, false); -- false because wiki links in |author-linkn= is an error
if nil == project and nil == language then -- when both are nil
utilities.set_message ('err_bad_paramlink', link_alias); -- not known, emit an error message -- TODO: err_bad_interwiki?
link = nil; -- unset so we don't link
link_alias = nil;
end
end
last, etal = name_has_etal (last, etal, false, last_alias); -- find and remove variations on et al.
first, etal = name_has_etal (first, etal, false, first_alias); -- find and remove variations on et al.
last, first = name_checks (last, first, list_name, last_alias, first_alias); -- multiple names, extraneous annotation, etc. checks
if first and not last then -- if there is a firstn without a matching lastn
local alias = first_alias:find ('given', 1, true) and 'given' or 'first'; -- get first or given form of the alias
utilities.set_message ('err_first_missing_last', {
first_alias, -- param name of alias missing its mate
first_alias:gsub (alias, {['first'] = 'last', ['given'] = 'surname'}), -- make param name appropriate to the alias form
}); -- add this error message
elseif not first and not last then -- if both firstn and lastn aren't found, are we done?
count = count + 1; -- number of times we haven't found last and first
if 2 <= count then -- two missing names and we give up
break; -- normal exit or there is a two-name hole in the list; can't tell which
end
else -- we have last with or without a first
link = link_title_ok (link, link_alias, last, last_alias); -- check for improper wiki-markup
if first then
link = link_title_ok (link, link_alias, first, first_alias); -- check for improper wiki-markup
end
names[n] = {last = last, first = first, link = link, mask = mask, corporate = false}; -- add this name to our names list (corporate for |vauthors= only)
n = n + 1; -- point to next location in the names table
if 1 == count then -- if the previous name was missing
utilities.set_message ('err_missing_name', {list_name:match ("(%w+)List"):lower(), i - 1}); -- add this error message
end
count = 0; -- reset the counter, we're looking for two consecutive missing names
end
i = i + 1; -- point to next args location
end
return names, etal; -- all done, return our list of names and the etal flag
end
--[[--------------------------< N A M E _ T A G _ G E T >------------------------------------------------------
attempt to decode |language=<lang_param> and return language name and matching tag; nil else.
This function looks for:
<lang_param> as a tag in cfg.lang_tag_remap{}
<lang_param> as a name in cfg.lang_name_remap{}
<lang_param> as a name in cfg.mw_languages_by_name_t
<lang_param> as a tag in cfg.mw_languages_by_tag_t
when those fail, presume that <lang_param> is an IETF-like tag that MediaWiki does not recognize. Strip all
script, region, variant, whatever subtags from <lang_param> to leave just a two or three character language tag
and look for the new <lang_param> in cfg.mw_languages_by_tag_t{}
on success, returns name (in properly capitalized form) and matching tag (in lowercase); on failure returns nil
]]
local function name_tag_get (lang_param)
local lang_param_lc = mw.ustring.lower (lang_param); -- use lowercase as an index into the various tables
local name;
local tag;
name = cfg.lang_tag_remap[lang_param_lc]; -- assume <lang_param_lc> is a tag; attempt to get remapped language name
if name then -- when <name>, <lang_param> is a tag for a remapped language name
if cfg.lang_name_remap[name:lower()][2] ~= lang_param_lc then
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
return name, cfg.lang_name_remap[name:lower()][2]; -- so return name and tag from lang_name_remap[name]; special case to xlate sr-ec and sr-el to sr-cyrl and sr-latn
end
return name, lang_param_lc; -- so return <name> from remap and <lang_param_lc>
end
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- still assuming that <lang_param_lc> is a tag; strip script, region, variant subtags
name = cfg.lang_tag_remap[tag]; -- attempt to get remapped language name with language subtag only
if name then -- when <name>, <tag> is a tag for a remapped language name
return name, tag; -- so return <name> from remap and <tag>
end
if cfg.lang_name_remap[lang_param_lc] then -- not a remapped tag, assume <lang_param_lc> is a name; attempt to get remapped language tag
return cfg.lang_name_remap[lang_param_lc][1], cfg.lang_name_remap[lang_param_lc][2]; -- for this <lang_param_lc>, return a (possibly) new name and appropriate tag
end
name = cfg.mw_languages_by_tag_t[lang_param_lc]; -- assume that <lang_param_lc> is a tag; attempt to get its matching language name
if name then
return name, lang_param_lc; -- <lang_param_lc> is a tag so return it and <name>
end
tag = cfg.mw_languages_by_name_t[lang_param_lc]; -- assume that <lang_param_lc> is a language name; attempt to get its matching tag
if tag then
return cfg.mw_languages_by_tag_t[tag], tag; -- <lang_param_lc> is a name so return the name from the table and <tag>
end
tag = lang_param_lc:match ('^(%a%a%a?)%-.*'); -- is <lang_param_lc> an IETF-like tag that MediaWiki doesn't recognize? <tag> gets the language subtag; nil else
if tag then
name = cfg.mw_languages_by_tag_t[tag]; -- attempt to get a language name using the shortened <tag>
if name then
return name, tag; -- <lang_param_lc> is an unrecognized IETF-like tag so return <name> and language subtag
end
end
end
--[[-------------------< L A N G U A G E _ P A R A M E T E R >------------------
Gets language name from a provided two- or three-character ISO 639 code. If a code
is recognized by MediaWiki, use the returned name; if not, then use the value that
was provided with the language parameter.
When |language= contains a recognized language (either code or name), the page is
assigned to the category for that code: Category:Norwegian-language sources (no).
For valid three-character code languages, the page is assigned to the single category
for '639-2' codes: Category:CS1 ISO 639-2 language sources.
Languages that are the same as the local wiki are not categorized. MediaWiki does
not recognize three-character equivalents of two-character codes: code 'ar' is
recognized but code 'ara' is not.
This function supports multiple languages in the form |language=nb, French, th
where the language names or codes are separated from each other by commas with
optional space characters.
]]
local function language_parameter (lang)
local tag; -- some form of IETF-like language tag; language subtag with optional region, sript, vatiant, etc subtags
local lang_subtag; -- ve populates |language= with mostly unecessary region subtags that MediaWiki does not recognize; this is the base language subtag
local name; -- the language name
local language_list = {}; -- table of language names to be rendered
local names_t = mw.text.split (lang, '%s*,%s*'); -- names should be a comma separated list
for _, lang in ipairs (names_t) do -- reuse lang here because we don't yet know if lang is a language name or a language tag; for now, ignore linter warning
name, tag = name_tag_get (lang); -- attempt to get name/tag pair for <lang>; <name> has proper capitalization; <tag> is lowercase
if utilities.is_set (tag) then
lang_subtag = tag:gsub ('^(%a%a%a?)%-.*', '%1'); -- for categorization, strip any IETF-like tags from language tag
if cfg.this_wiki_code ~= lang_subtag then -- when the language is not the same as this wiki's language
if 2 == lang_subtag:len() then -- and is a two-character tag
utilities.add_prop_cat ('foreign-lang-source', {name, tag}, lang_subtag); -- categorize it; tag appended to allow for multiple language categorization
else -- or is a recognized language (but has a three-character tag)
utilities.add_prop_cat ('foreign-lang-source-2', {lang_subtag}, lang_subtag); -- categorize it differently TODO: support multiple three-character tag categories per cs1|2 template?
end
elseif cfg.local_lang_cat_enable then -- when the language and this wiki's language are the same and categorization is enabled
utilities.add_prop_cat ('local-lang-source', {name, lang_subtag}); -- categorize it
end
else
name = lang; -- return whatever <lang> has so that we show something
utilities.set_message ('maint_unknown_lang'); -- add maint category if not already added
end
table.insert (language_list, name);
end
name = utilities.make_sep_list (#language_list, language_list);
if (1 == #language_list) and (lang_subtag == cfg.this_wiki_code) then -- when only one language, find lang name in this wiki lang name; for |language=en-us, 'English' in 'American English'
return ''; -- if one language and that language is this wiki's return an empty string (no annotation)
end
return (" " .. wrap_msg ('language', name)); -- otherwise wrap with '(in ...)'
--[[ TODO: should only return blank or name rather than full list
so we can clean up the bunched parenthetical elements Language, Type, Format
]]
end
--[[-----------------------< S E T _ C S _ S T Y L E >--------------------------
Gets the default CS style configuration for the given mode.
Returns default separator and either postscript as passed in or the default.
In CS1, the default postscript and separator are '.'.
In CS2, the default postscript is the empty string and the default separator is ','.
]]
local function set_cs_style (postscript, mode)
if utilities.is_set(postscript) then
-- emit a maintenance message if user postscript is the default cs1 postscript
-- we catch the opposite case for cs2 in set_style
if mode == 'cs1' and postscript == cfg.presentation['ps_' .. mode] then
utilities.set_message ('maint_postscript');
end
else
postscript = cfg.presentation['ps_' .. mode];
end
return cfg.presentation['sep_' .. mode], postscript;
end
--[[--------------------------< S E T _ S T Y L E >-----------------------------
Sets the separator and postscript styles. Checks the |mode= first and the
#invoke CitationClass second. Removes the postscript if postscript == none.
]]
local function set_style (mode, postscript, cite_class)
local sep;
if 'cs2' == mode then
sep, postscript = set_cs_style (postscript, 'cs2');
elseif 'cs1' == mode then
sep, postscript = set_cs_style (postscript, 'cs1');
elseif 'citation' == cite_class then
sep, postscript = set_cs_style (postscript, 'cs2');
else
sep, postscript = set_cs_style (postscript, 'cs1');
end
if cfg.keywords_xlate[postscript:lower()] == 'none' then
-- emit a maintenance message if user postscript is the default cs2 postscript
-- we catch the opposite case for cs1 in set_cs_style
if 'cs2' == mode or ('cs1' ~= mode and 'citation' == cite_class) then -- {{citation |title=Title |mode=cs1 |postscript=none}} should not emit maint message
utilities.set_message ('maint_postscript');
end
postscript = '';
end
return sep, postscript
end
--[=[-------------------------< I S _ P D F >-----------------------------------
Determines if a URL has the file extension that is one of the PDF file extensions
used by [[MediaWiki:Common.css]] when applying the PDF icon to external links.
returns true if file extension is one of the recognized extensions, else false
]=]
local function is_pdf (url)
return url:match ('%.pdf$') or url:match ('%.PDF$') or
url:match ('%.pdf[%?#]') or url:match ('%.PDF[%?#]') or
url:match ('%.PDF#') or url:match ('%.pdf#');
end
--[[--------------------------< S T Y L E _ F O R M A T >-----------------------
Applies CSS style to |format=, |chapter-format=, etc. Also emits an error message
if the format parameter does not have a matching URL parameter. If the format parameter
is not set and the URL contains a file extension that is recognized as a PDF document
by MediaWiki's commons.css, this code will set the format parameter to (PDF) with
the appropriate styling.
]]
local function style_format (format, url, fmt_param, url_param)
if utilities.is_set (format) then
format = utilities.wrap_style ('format', format); -- add leading space, parentheses, resize
if not utilities.is_set (url) then
utilities.set_message ('err_format_missing_url', {fmt_param, url_param}); -- add an error message
end
elseif is_pdf (url) then -- format is not set so if URL is a PDF file then
format = utilities.wrap_style ('format', 'PDF'); -- set format to PDF
else
format = ''; -- empty string for concatenation
end
return format;
end
--[[---------------------< G E T _ D I S P L A Y _ N A M E S >------------------
Returns a number that defines the number of names displayed for author and editor
name lists and a Boolean flag to indicate when et al. should be appended to the name list.
When the value assigned to |display-xxxxors= is a number greater than or equal to zero,
return the number and the previous state of the 'etal' flag (false by default
but may have been set to true if the name list contains some variant of the text 'et al.').
When the value assigned to |display-xxxxors= is the keyword 'etal', return a number
that is one greater than the number of authors in the list and set the 'etal' flag true.
This will cause the list_people() to display all of the names in the name list followed by 'et al.'
In all other cases, returns nil and the previous state of the 'etal' flag.
inputs:
max: A['DisplayAuthors'] or A['DisplayEditors'], etc; a number or some flavor of etal
count: #a or #e
list_name: 'authors' or 'editors'
etal: author_etal or editor_etal
This function sets an error message when |display-xxxxors= value greater than or equal to number of names but
not when <max> comes from {{cs1 config}} global settings. When using global settings, <param> is set to the
keyword 'cs1 config' which is used to supress the normal error. Error is suppressed because it is to be expected
that some citations in an article will have the same or fewer names that the limit specified in {{cs1 config}}.
]]
local function get_display_names (max, count, etal, param)
if utilities.is_set (max) then
if 'etal' == cfg.keywords_xlate[max:lower():gsub("[ '%.]", '')] then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
max = count + 1; -- number of authors + 1 so display all author name plus et al.
etal = true; -- overrides value set by extract_names()
elseif max:match ('^%d+$') then -- if is a string of numbers
max = tonumber (max); -- make it a number
if (max >= count) and ('cs1 config' ~= param) then -- error when local |display-xxxxors= value greater than or equal to number of names; not an error when using global setting
utilities.set_message ('err_disp_name', {param, max}); -- add error message
max = nil;
end
else -- not a valid keyword or number
utilities.set_message ('err_disp_name', {param, max}); -- add error message
max = nil; -- unset; as if |display-xxxxors= had not been set
end
end
return max, etal;
end
--[[----------< E X T R A _ T E X T _ I N _ P A G E _ C H E C K >---------------
Adds error if |page=, |pages=, |quote-page=, |quote-pages= has what appears to be
some form of p. or pp. abbreviation in the first characters of the parameter content.
check page for extraneous p, p., pp, pp., pg, pg. at start of parameter value:
good pattern: '^P[^%.P%l]' matches when page begins PX or P# but not Px
where x and X are letters and # is a digit
bad pattern: '^[Pp][PpGg]' matches when page begins pp, pP, Pp, PP, pg, pG, Pg, PG
]]
local function extra_text_in_page_check (val, name)
if not val:match (cfg.vol_iss_pg_patterns.good_ppattern) then
for _, pattern in ipairs (cfg.vol_iss_pg_patterns.bad_ppatterns) do -- spin through the selected sequence table of patterns
if val:match (pattern) then -- when a match, error so
utilities.set_message ('err_extra_text_pages', name); -- add error message
return; -- and done
end
end
end
end
--[[--------------------------< E X T R A _ T E X T _ I N _ V O L _ I S S _ C H E C K >------------------------
Adds error if |volume= or |issue= has what appears to be some form of redundant 'type' indicator. Applies to
both; this function looks for issue text in both |issue= and |volume= and looks for volume-like text in |voluem=
and |issue=.
For |volume=:
'V.', or 'Vol.' (with or without the dot) abbreviations or 'Volume' in the first characters of the parameter
content (all case insensitive). 'V' and 'v' (without the dot) are presumed to be roman numerals so
are allowed.
For |issue=:
'No.', 'I.', 'Iss.' (with or without the dot) abbreviations, or 'Issue' in the first characters of the
parameter content (all case insensitive); numero styling: 'n°' with degree sign U+00B0, and № precomposed
numero sign U+2116.
Single character values ('v', 'i', 'n') allowed when not followed by separator character ('.', ':', '=', or
whitespace character) – param values are trimmed of whitespace by MediaWiki before delivered to the module.
<val> is |volume= or |issue= parameter value
<name> is |volume= or |issue= parameter name for error message
<selector> is 'v' for |volume=, 'i' for |issue=
sets error message on failure; returns nothing
]]
local function extra_text_in_vol_iss_check (val, name, selector)
if not utilities.is_set (val) then
return;
end
local handler = 'v' == selector and 'err_extra_text_volume' or 'err_extra_text_issue';
local accept_val; -- for now, ignore linter warning
val, accept_val = utilities.has_accept_as_written (val);
--if accept_val then -- if uncomment this, |volume=((vol. 1)) suppresses error
-- return;
--end
--val = mw.text.unstripNoWiki (val); -- if uncomment this, |volume=<nowiki>vol. 1</nowiki> shows error
val = val:lower(); -- force parameter value to lower case
for _, pattern in ipairs (cfg.vol_iss_pg_patterns.vi_patterns_t) do -- spin through the sequence table of patterns
if val:match (pattern) then -- when a match, error so
utilities.set_message (handler, name); -- add error message
return; -- and done
end
end
end
--[=[-------------------------< G E T _ V _ N A M E _ T A B L E >----------------------------------------------
split apart a |vauthors= or |veditors= parameter. This function allows for corporate names, wrapped in doubled
parentheses to also have commas; in the old version of the code, the doubled parentheses were included in the
rendered citation and in the metadata. Individual author names may be wikilinked
|vauthors=Jones AB, [[E. B. White|White EB]], ((Black, Brown, and Co.))
]=]
local function get_v_name_table (vparam, output_table, output_link_table)
local _, accept = utilities.has_accept_as_written (vparam);
if accept then
utilities.add_prop_cat ('vanc-accept'); -- add properties category
end
local name_table = mw.text.split(vparam, "%s*,%s*"); -- names are separated by commas
local wl_type, label, link; -- wl_type not used here; just a placeholder
local i = 1;
while name_table[i] do
if name_table[i]:match ('^%(%(.*[^%)][^%)]$') then -- first segment of corporate with one or more commas; this segment has the opening doubled parentheses
local name = name_table[i];
i = i + 1; -- bump indexer to next segment
while name_table[i] do
name = name .. ', ' .. name_table[i]; -- concatenate with previous segments
if name_table[i]:match ('^.*%)%)$') then -- if this table member has the closing doubled parentheses
break; -- and done reassembling so
end
i = i + 1; -- bump indexer
end
table.insert (output_table, name); -- and add corporate name to the output table
table.insert (output_link_table, ''); -- no wikilink
else
wl_type, label, link = utilities.is_wikilink (name_table[i]); -- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]
table.insert (output_table, label); -- add this name
if 1 == wl_type then
table.insert (output_link_table, label); -- simple wikilink [[D]]
else
table.insert (output_link_table, link); -- no wikilink or [[L|D]]; add this link if there is one, else empty string
end
end
i = i + 1;
end
return output_table;
end
--[[--------------------------< P A R S E _ V A U T H O R S _ V E D I T O R S >--------------------------------
This function extracts author / editor names from |vauthors= or |veditors= and finds matching |xxxxor-maskn= and
|xxxxor-linkn= in args. It then returns a table of assembled names just as extract_names() does.
Author / editor names in |vauthors= or |veditors= must be in Vancouver system style. Corporate or institutional names
may sometimes be required and because such names will often fail the is_good_vanc_name() and other format compliance
tests, are wrapped in doubled parentheses ((corporate name)) to suppress the format tests.
Supports generational suffixes Jr, 2nd, 3rd, 4th–6th.
This function sets the Vancouver error when a required comma is missing and when there is a space between an author's initials.
]]
local function parse_vauthors_veditors (args, vparam, list_name)
local names = {}; -- table of names assembled from |vauthors=, |author-maskn=, |author-linkn=
local v_name_table = {};
local v_link_table = {}; -- when name is wikilinked, targets go in this table
local etal = false; -- return value set to true when we find some form of et al. vauthors parameter
local last, first, link, mask, suffix;
local corporate = false;
vparam, etal = name_has_etal (vparam, etal, true); -- find and remove variations on et al. do not categorize (do it here because et al. might have a period)
v_name_table = get_v_name_table (vparam, v_name_table, v_link_table); -- names are separated by commas
for i, v_name in ipairs(v_name_table) do
first = ''; -- set to empty string for concatenation and because it may have been set for previous author/editor
local accept_name;
v_name, accept_name = utilities.has_accept_as_written (v_name); -- remove accept-this-as-written markup when it wraps all of <v_name>
if accept_name then
last = v_name;
corporate = true; -- flag used in list_people()
elseif string.find(v_name, "%s") then
if v_name:find('[;%.]') then -- look for commonly occurring punctuation characters;
add_vanc_error (cfg.err_msg_supl.punctuation, i);
end
local lastfirst_t = mw.text.split(v_name, "%s+");
first = table.remove (lastfirst_t); -- removes and returns value of last element in table which should be initials or generational suffix
if not mw.ustring.match (first, '^%u+$') then -- mw.ustring here so that later we will catch non-Latin characters
suffix = first; -- not initials so assume that whatever we got is a generational suffix
first = table.remove (lastfirst_t); -- get what should be the initials from the table
end
last = table.concat (lastfirst_t, ' '); -- returns a string that is the concatenation of all other names that are not initials and generational suffix
if not utilities.is_set (last) then
first = ''; -- unset
last = v_name; -- last empty because something wrong with first
add_vanc_error (cfg.err_msg_supl.name, i);
end
if mw.ustring.match (last, '%a+%s+%u+%s+%a+') then
add_vanc_error (cfg.err_msg_supl['missing comma'], i); -- matches last II last; the case when a comma is missing
end
if mw.ustring.match (v_name, ' %u %u$') then -- this test is in the wrong place TODO: move or replace with a more appropriate test
add_vanc_error (cfg.err_msg_supl.initials, i); -- matches a space between two initials
end
else
last = v_name; -- last name or single corporate name? Doesn't support multiword corporate names? do we need this?
end
if utilities.is_set (first) then
if not mw.ustring.match (first, "^%u?%u$") then -- first shall contain one or two upper-case letters, nothing else
add_vanc_error (cfg.err_msg_supl.initials, i); -- too many initials; mixed case initials (which may be ok Romanization); hyphenated initials
end
is_good_vanc_name (last, first, suffix, i); -- check first and last before restoring the suffix which may have a non-Latin digit
if utilities.is_set (suffix) then
first = first .. ' ' .. suffix; -- if there was a suffix concatenate with the initials
suffix = ''; -- unset so we don't add this suffix to all subsequent names
end
else
if not corporate then
is_good_vanc_name (last, '', nil, i);
end
end
link = utilities.select_one ( args, cfg.aliases[list_name .. '-Link'], 'err_redundant_parameters', i ) or v_link_table[i];
mask = utilities.select_one ( args, cfg.aliases[list_name .. '-Mask'], 'err_redundant_parameters', i );
names[i] = {last = last, first = first, link = link, mask = mask, corporate = corporate}; -- add this assembled name to our names list
end
return names, etal; -- all done, return our list of names
end
--[[--------------------------< S E L E C T _ A U T H O R _ E D I T O R _ S O U R C E >------------------------
Select one of |authors=, |authorn= / |lastn / firstn=, or |vauthors= as the source of the author name list or
select one of |editorn= / editor-lastn= / |editor-firstn= or |veditors= as the source of the editor name list.
Only one of these appropriate three will be used. The hierarchy is: |authorn= (and aliases) highest and |authors= lowest;
|editorn= (and aliases) highest and |veditors= lowest (support for |editors= withdrawn)
When looking for |authorn= / |editorn= parameters, test |xxxxor1= and |xxxxor2= (and all of their aliases); stops after the second
test which mimicks the test used in extract_names() when looking for a hole in the author name list. There may be a better
way to do this, I just haven't discovered what that way is.
Emits an error message when more than one xxxxor name source is provided.
In this function, vxxxxors = vauthors or veditors; xxxxors = authors as appropriate.
]]
local function select_author_editor_source (vxxxxors, xxxxors, args, list_name)
local lastfirst = false;
if utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 1 ) or -- do this twice in case we have a |first1= without a |last1=; this ...
utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 1 ) or -- ... also catches the case where |first= is used with |vauthors=
utilities.select_one ( args, cfg.aliases[list_name .. '-Last'], 'none', 2 ) or
utilities.select_one ( args, cfg.aliases[list_name .. '-First'], 'none', 2 ) then
lastfirst = true;
end
if (utilities.is_set (vxxxxors) and true == lastfirst) or -- these are the three error conditions
(utilities.is_set (vxxxxors) and utilities.is_set (xxxxors)) or
(true == lastfirst and utilities.is_set (xxxxors)) then
utilities.set_message ('err_redundant_parameters',
utilities.substitute (cfg.special_case_translation.name_list_params,
('AuthorList' == list_name) and cfg.special_case_translation.author or cfg.special_case_translation.editor)); -- add error message
end
if true == lastfirst then return 1 end; -- return a number indicating which author name source to use
if utilities.is_set (vxxxxors) then return 2 end;
if utilities.is_set (xxxxors) then return 3 end;
return 1; -- no authors so return 1; this allows missing author name test to run in case there is a first without last
end
--[[--------------------------< I S _ V A L I D _ P A R A M E T E R _ V A L U E >------------------------------
This function is used to validate a parameter's assigned value for those parameters that have only a limited number
of allowable values (yes, y, true, live, dead, etc.). When the parameter value has not been assigned a value (missing
or empty in the source template) the function returns the value specified by ret_val. If the parameter value is one
of the list of allowed values returns the translated value; else, emits an error message and returns the value
specified by ret_val.
TODO: explain <invert>
]]
local function is_valid_parameter_value (value, name, possible, ret_val, invert)
if not utilities.is_set (value) then
return ret_val; -- an empty parameter is ok
end
if (not invert and utilities.in_array (value, possible)) then -- normal; <value> is in <possible> table
return cfg.keywords_xlate[value]; -- return translation of parameter keyword
elseif invert and not utilities.in_array (value, possible) then -- invert; <value> is not in <possible> table
return value; -- return <value> as it is
else
utilities.set_message ('err_invalid_param_val', {name, value}); -- not an allowed value so add error message
return ret_val;
end
end
--[[--------------------------< T E R M I N A T E _ N A M E _ L I S T >----------------------------------------
This function terminates a name list (author, contributor, editor) with a separator character (sepc) and a space
when the last character is not a sepc character or when the last three characters are not sepc followed by two
closing square brackets (close of a wikilink). When either of these is true, the name_list is terminated with a
single space character.
]]
local function terminate_name_list (name_list, sepc)
if (string.sub (name_list, -3, -1) == sepc .. '. ') then -- if already properly terminated
return name_list; -- just return the name list
elseif (string.sub (name_list, -1, -1) == sepc) or (string.sub (name_list, -3, -1) == sepc .. ']]') then -- if last name in list ends with sepc char
return name_list .. " "; -- don't add another
else
return name_list .. sepc .. ' '; -- otherwise terminate the name list
end
end
--[[-------------------------< F O R M A T _ V O L U M E _ I S S U E >-----------------------------------------
returns the concatenation of the formatted volume and issue (or journal article number) parameters as a single
string; or formatted volume or formatted issue, or an empty string if neither are set.
]]
local function format_volume_issue (volume, issue, article, cite_class, origin, sepc, lower)
if not utilities.is_set (volume) and not utilities.is_set (issue) and not utilities.is_set (article) then
return '';
end
-- same condition as in format_pages_sheets()
local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
local is_numeric_vol = volume and (volume:match ('^[MDCLXVI]+$') or volume:match ('^%d+$')); -- is only uppercase roman numerals or only digits?
local is_long_vol = volume and (4 < mw.ustring.len(volume)); -- is |volume= value longer than 4 characters?
if volume and (not is_numeric_vol and is_long_vol) then -- when not all digits or Roman numerals, is |volume= longer than 4 characters?
utilities.add_prop_cat ('long-vol'); -- yes, add properties cat
end
if is_journal then -- journal-style formatting
local vol = '';
if utilities.is_set (volume) then
if is_numeric_vol then -- |volume= value all digits or all uppercase Roman numerals?
vol = utilities.substitute (cfg.presentation['vol-bold'], {sepc, volume}); -- render in bold face
elseif is_long_vol then -- not all digits or Roman numerals; longer than 4 characters?
vol = utilities.substitute (cfg.messages['j-vol'], {sepc, utilities.hyphen_to_dash (volume)}); -- not bold
else -- four or fewer characters
vol = utilities.substitute (cfg.presentation['vol-bold'], {sepc, utilities.hyphen_to_dash (volume)}); -- bold
end
end
vol = vol .. (utilities.is_set (issue) and utilities.substitute (cfg.messages['j-issue'], issue) or '')
vol = vol .. (utilities.is_set (article) and utilities.substitute (cfg.messages['j-article-num'], article) or '')
return vol;
end
if 'podcast' == cite_class and utilities.is_set (issue) then
return wrap_msg ('issue', {sepc, issue}, lower);
end
if 'conference' == cite_class and utilities.is_set (article) then -- |article-number= supported only in journal and conference cites
if utilities.is_set (volume) and utilities.is_set (article) then -- both volume and article number
return wrap_msg ('vol-art', {sepc, utilities.hyphen_to_dash (volume), article}, lower);
elseif utilities.is_set (article) then -- article number alone; when volume alone, handled below
return wrap_msg ('art', {sepc, article}, lower);
end
end
-- all other types of citation
if utilities.is_set (volume) and utilities.is_set (issue) then
return wrap_msg ('vol-no', {sepc, utilities.hyphen_to_dash (volume), issue}, lower);
elseif utilities.is_set (volume) then
return wrap_msg ('vol', {sepc, utilities.hyphen_to_dash (volume)}, lower);
else
return wrap_msg ('issue', {sepc, issue}, lower);
end
end
--[[-------------------------< F O R M A T _ P A G E S _ S H E E T S >-----------------------------------------
adds static text to one of |page(s)= or |sheet(s)= values and returns it with all of the others set to empty strings.
The return order is:
page, pages, sheet, sheets
Singular has priority over plural when both are provided.
]]
local function format_pages_sheets (page, pages, sheet, sheets, cite_class, origin, sepc, nopp, lower)
if 'map' == cite_class then -- only cite map supports sheet(s) as in-source locators
if utilities.is_set (sheet) then
if 'journal' == origin then
return '', '', wrap_msg ('j-sheet', sheet, lower), '';
else
return '', '', wrap_msg ('sheet', {sepc, sheet}, lower), '';
end
elseif utilities.is_set (sheets) then
if 'journal' == origin then
return '', '', '', wrap_msg ('j-sheets', sheets, lower);
else
return '', '', '', wrap_msg ('sheets', {sepc, sheets}, lower);
end
end
end
local is_journal = 'journal' == cite_class or (utilities.in_array (cite_class, {'citation', 'map', 'interview'}) and 'journal' == origin);
if utilities.is_set (page) then
if is_journal then
return utilities.substitute (cfg.messages['j-page(s)'], page), '', '', '';
elseif not nopp then
return utilities.substitute (cfg.messages['p-prefix'], {sepc, page}), '', '', '';
else
return utilities.substitute (cfg.messages['nopp'], {sepc, page}), '', '', '';
end
elseif utilities.is_set (pages) then
if is_journal then
return utilities.substitute (cfg.messages['j-page(s)'], pages), '', '', '';
elseif tonumber(pages) ~= nil and not nopp then -- if pages is only digits, assume a single page number
return '', utilities.substitute (cfg.messages['p-prefix'], {sepc, pages}), '', '';
elseif not nopp then
return '', utilities.substitute (cfg.messages['pp-prefix'], {sepc, pages}), '', '';
else
return '', utilities.substitute (cfg.messages['nopp'], {sepc, pages}), '', '';
end
end
return '', '', '', ''; -- return empty strings
end
--[[--------------------------< I N S O U R C E _ L O C _ G E T >----------------------------------------------
returns one of the in-source locators: page, pages, or at.
If any of these are interwiki links to Wikisource, returns the label portion of the interwiki-link as plain text
for use in COinS. This COinS thing is done because here we convert an interwiki-link to an external link and
add an icon span around that; get_coins_pages() doesn't know about the span. TODO: should it?
TODO: add support for sheet and sheets?; streamline;
TODO: make it so that this function returns only one of the three as the single in-source (the return value assigned
to a new name)?
]]
local function insource_loc_get (page, page_orig, pages, pages_orig, at)
local ws_url, ws_label, coins_pages, L; -- for Wikisource interwiki-links; TODO: this corrupts page metadata (span remains in place after cleanup; fix there?)
if utilities.is_set (page) then
if utilities.is_set (pages) or utilities.is_set (at) then
pages = ''; -- unset the others
at = '';
end
extra_text_in_page_check (page, page_orig); -- emit error message when |page= value begins with what looks like p., pp., etc.
ws_url, ws_label, L = wikisource_url_make (page); -- make ws URL from |page= interwiki link; link portion L becomes tooltip label
if ws_url then
page = external_link (ws_url, ws_label .. ' ', 'ws link in page'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
page = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, page});
coins_pages = ws_label;
end
elseif utilities.is_set (pages) then
if utilities.is_set (at) then
at = ''; -- unset
end
extra_text_in_page_check (pages, pages_orig); -- emit error message when |page= value begins with what looks like p., pp., etc.
ws_url, ws_label, L = wikisource_url_make (pages); -- make ws URL from |pages= interwiki link; link portion L becomes tooltip label
if ws_url then
pages = external_link (ws_url, ws_label .. ' ', 'ws link in pages'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
pages = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, pages});
coins_pages = ws_label;
end
elseif utilities.is_set (at) then
ws_url, ws_label, L = wikisource_url_make (at); -- make ws URL from |at= interwiki link; link portion L becomes tooltip label
if ws_url then
at = external_link (ws_url, ws_label .. ' ', 'ws link in at'); -- space char after label to move icon away from in-source text; TODO: a better way to do this?
at = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, at});
coins_pages = ws_label;
end
end
return page, pages, at, coins_pages;
end
--[[--------------------------< I S _ U N I Q U E _ A R C H I V E _ U R L >------------------------------------
add error message when |archive-url= value is same as |url= or chapter-url= (or alias...) value
]]
local function is_unique_archive_url (archive, url, c_url, source, date)
if utilities.is_set (archive) then
if archive == url or archive == c_url then
utilities.set_message ('err_bad_url', {utilities.wrap_style ('parameter', source)}); -- add error message
return '', ''; -- unset |archive-url= and |archive-date= because same as |url= or |chapter-url=
end
end
return archive, date;
end
--[=[-------------------------< A R C H I V E _ U R L _ C H E C K >--------------------------------------------
Check archive.org URLs to make sure they at least look like they are pointing at valid archives and not to the
save snapshot URL or to calendar pages. When the archive URL is 'https://web.archive.org/save/' (or http://...)
archive.org saves a snapshot of the target page in the URL. That is something that Wikipedia should not allow
unwitting readers to do.
When the archive.org URL does not have a complete timestamp, archive.org chooses a snapshot according to its own
algorithm or provides a calendar 'search' result. [[WP:ELNO]] discourages links to search results.
This function looks at the value assigned to |archive-url= and returns empty strings for |archive-url= and
|archive-date= and an error message when:
|archive-url= holds an archive.org save command URL
|archive-url= is an archive.org URL that does not have a complete timestamp (YYYYMMDDhhmmss 14 digits) in the
correct place
otherwise returns |archive-url= and |archive-date=
There are two mostly compatible archive.org URLs:
//web.archive.org/<timestamp>... -- the old form
//web.archive.org/web/<timestamp>... -- the new form
The old form does not support or map to the new form when it contains a display flag. There are four identified flags
('id_', 'js_', 'cs_', 'im_') but since archive.org ignores others following the same form (two letters and an underscore)
we don't check for these specific flags but we do check the form.
This function supports a preview mode. When the article is rendered in preview mode, this function may return a modified
archive URL:
for save command errors, return undated wildcard (/*/)
for timestamp errors when the timestamp has a wildcard, return the URL unmodified
for timestamp errors when the timestamp does not have a wildcard, return with timestamp limited to six digits plus wildcard (/yyyymm*/)
A secondary function is to return an archive-url timestamp from those archive urls that have them. The timestamp
is used by validation.archive_date_check() to see if the value in |archive-date= matches the timestamp in the
archive url.
]=]
local function archive_url_check (url, date)
local err_msg; -- start with the error message empty
local path, timestamp, flag; -- portions of the archive.org URL
local function is_ts_date_valid (ts, origin_date) -- local function to validate archive url taimestamp date; time ignored
local y, m, d = ts:match ('(%d%d%d%d)(%d%d)(%d%d)'); -- split into parts
if y and validation.is_valid_date (y, m, d) and (tonumber (y) >= 1996) then
return true, tonumber (y) >= origin_date; -- <origin_date> is 1996 for archive.org
end
end
if (not url:match('//web%.archive%.org/')) and (not url:match('//liveweb%.archive%.org/')) then -- also deprecated liveweb Wayback machine URL
return url, date; -- not an archive.org archive, return ArchiveURL and ArchiveDate
end
if url:match('//web%.archive%.org/save/') then -- if a save command URL, we don't want to allow saving of the target page
err_msg = cfg.err_msg_supl.save;
url = url:gsub ('(//web%.archive%.org)/save/', '%1/*/', 1); -- for preview mode: modify ArchiveURL
elseif url:match('//liveweb%.archive%.org/') then
err_msg = cfg.err_msg_supl.liveweb;
else
path, timestamp, flag = url:match('//web%.archive%.org/([^%d]*)(%d+)([^/]*)/'); -- split out some of the URL parts for evaluation
if not path then -- malformed in some way; pattern did not match
err_msg = cfg.err_msg_supl.timestamp;
elseif 14 ~= timestamp:len() then -- path and flag optional, must have 14-digit timestamp here
err_msg = cfg.err_msg_supl.timestamp;
if '*' ~= flag then
local replacement = timestamp:match ('^%d%d%d%d%d%d') or timestamp:match ('^%d%d%d%d'); -- get the first 6 (YYYYMM) or first 4 digits (YYYY)
if replacement then -- nil if there aren't at least 4 digits (year)
replacement = replacement .. string.rep ('0', 14 - replacement:len()); -- year or yearmo (4 or 6 digits) zero-fill to make 14-digit timestamp
url=url:gsub ('(//web%.archive%.org/[^%d]*)%d[^/]*', '%1' .. replacement .. '*', 1) -- for preview, modify ts to 14 digits plus splat for calendar display
end
end
elseif not is_ts_date_valid (timestamp, 1996) then -- is ymd portion of timestamp a valid date?
err_msg = cfg.err_msg_supl.timestamp;
timestamp = nil; -- unset because invalid
elseif utilities.is_set (path) and 'web/' ~= path then -- older archive URLs do not have the extra 'web/' path element
err_msg = cfg.err_msg_supl.path;
elseif utilities.is_set (flag) and not utilities.is_set (path) then -- flag not allowed with the old form URL (without the 'web/' path element)
err_msg = cfg.err_msg_supl.flag;
elseif utilities.is_set (flag) and not flag:match ('%a%a_') then -- flag if present must be two alpha characters and underscore (requires 'web/' path element)
err_msg = cfg.err_msg_supl.flag;
else
return url, date, timestamp; -- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=
end
end
-- if here, something not right so
utilities.set_message ('err_archive_url', {err_msg}); -- add error message and
if is_preview_mode then
return url, date, timestamp; -- preview mode so return ArchiveURL, ArchiveDate, and timestamp from |archive-url=
else
return '', ''; -- return empty strings for ArchiveURL and ArchiveDate
end
end
--[[--------------------------< P L A C E _ C H E C K >--------------------------------------------------------
check |place=, |publication-place=, |location= to see if these params include digits. This function added because
many editors misuse location to specify the in-source location (|page(s)= and |at= are supposed to do that)
returns the original parameter value without modification; added maint cat when parameter value contains digits
]]
local function place_check (param_val)
if not utilities.is_set (param_val) then -- parameter empty or omitted
return param_val; -- return that empty state
end
if mw.ustring.find (param_val, '%d') then -- not empty, are there digits in the parameter value
utilities.set_message ('maint_location'); -- yep, add maint cat
end
return param_val; -- and done
end
--[[--------------------------< I S _ A R C H I V E D _ C O P Y >----------------------------------------------
compares |title= to 'Archived copy' (placeholder added by bots that can't find proper title); if matches, return true; nil else
]]
local function is_archived_copy (title)
title = mw.ustring.lower(title); -- switch title to lower case
if title:find (cfg.special_case_translation.archived_copy.en) then -- if title is 'Archived copy'
return true;
elseif cfg.special_case_translation.archived_copy['local'] then
if mw.ustring.find (title, cfg.special_case_translation.archived_copy['local']) then -- mw.ustring() because might not be Latin script
return true;
end
end
end
--[[--------------------------< D I S P L A Y _ N A M E S _ S E L E C T >--------------------------------------
for any of the |display-authors=, |display-editors=, etc parameters, select either the local or global setting.
When both are present, look at <local_display_names> value. When the value is some sort of 'et al.'string,
special handling is required.
When {{cs1 config}} has |display-<namelist>= AND this template has |display-<namelist>=etal AND:
the number of names specified by <number_of_names> is:
greater than the number specified in the global |display-<namelist>= parameter (<global_display_names>)
use global |display-<namelist>= parameter value
set overridden maint category
less than or equal to the number specified in the global |display-<namelist>= parameter
use local |display-<namelist>= parameter value
The purpose of this function is to prevent categorizing a template that has fewer names than the global setting
to keep the etal annotation specified by <local_display_names>.
]]
local function display_names_select (global_display_names, local_display_names, param_name, number_of_names)
if global_display_names and utilities.is_set (local_display_names) then -- when both
if 'etal' == local_display_names:lower():gsub("[ '%.]", '') then -- the :gsub() portion makes 'etal' from a variety of 'et al.' spellings and stylings
number_of_names = tonumber (number_of_names); -- convert these to numbers for comparison
local global_display_names_num = tonumber (global_display_names); -- <global_display_names> not set when parameter value is not digits
if number_of_names > global_display_names_num then -- template has more names than global config allows to be displayed?
utilities.set_message ('maint_overridden_setting'); -- set a maint message because global is overriding local |display-<namelist>=etal
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local because fewer names so let <local_display_names> control
end
end
-- here when <global_display_names> and <local_display_names> both numbers; <global_display_names> controls
utilities.set_message ('maint_overridden_setting'); -- set a maint message
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
end
-- here when only one of <global_display_names> or <local_display_names> set
if global_display_names then
return global_display_names, 'cs1 config'; -- return global with spoof parameter name (for get_display_names())
else
return local_display_names, param_name; -- return local
end
end
--[[--------------------------< M O D E _ S E T >--------------------------------------------------------------
fetch global mode setting from {{cs1 config}} (if present) or from |mode= (if present); global setting overrides
local |mode= parameter value. When both are present, emit maintenance message
]]
local function mode_set (Mode, Mode_origin)
local mode;
if cfg.global_cs1_config_t['Mode'] then -- global setting in {{cs1 config}}; nil when empty or assigned value invalid
mode = is_valid_parameter_value (cfg.global_cs1_config_t['Mode'], 'cs1 config: mode', cfg.keywords_lists['mode'], ''); -- error messaging 'param' here is a hoax
else
mode = is_valid_parameter_value (Mode, Mode_origin, cfg.keywords_lists['mode'], '');
end
if cfg.global_cs1_config_t['Mode'] and utilities.is_set (Mode) then -- when template has |mode=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
return mode;
end
--[[--------------------------< Q U O T E _ M A K E >----------------------------------------------------------
create quotation from |quote=, |trans-quote=, and/or script-quote= with or without |quote-page= or |quote-pages=
when any of those three quote parameters are set, this function unsets <PostScript>. When none of those parameters
are set, |quote-page= and |quote-pages= are unset to nil so that they are not included in the template's metadata
]]
local function quote_make (quote, trans_quote, script_quote, quote_page, quote_pages, nopp, sepc, postscript)
if utilities.is_set (quote) or utilities.is_set (trans_quote) or utilities.is_set (script_quote) then
if utilities.is_set (quote) then
if quote:sub(1, 1) == '"' and quote:sub(-1, -1) == '"' then -- if first and last characters of quote are quote marks
quote = quote:sub(2, -2); -- strip them off
end
end
quote = kern_quotes (quote); -- kern if needed
quote = utilities.wrap_style ('quoted-text', quote ); -- wrap in <q>...</q> tags
if utilities.is_set (script_quote) then
quote = script_concatenate (quote, script_quote, 'script-quote'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after quote is wrapped
end
if utilities.is_set (trans_quote) then
if trans_quote:sub(1, 1) == '"' and trans_quote:sub(-1, -1) == '"' then -- if first and last characters of |trans-quote are quote marks
trans_quote = trans_quote:sub(2, -2); -- strip them off
end
quote = quote .. " " .. utilities.wrap_style ('trans-quoted-title', trans_quote );
end
if utilities.is_set (quote_page) or utilities.is_set (quote_pages) then -- add page prefix
local quote_prefix = '';
if utilities.is_set (quote_page) then
extra_text_in_page_check (quote_page, 'quote-page'); -- add to maint cat if |quote-page= value begins with what looks like p., pp., etc.
if not nopp then
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, quote_page});
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, quote_page});
end
elseif utilities.is_set (quote_pages) then
extra_text_in_page_check (quote_pages, 'quote-pages'); -- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.
if tonumber(quote_pages) ~= nil and not nopp then -- if only digits, assume single page
quote_prefix = utilities.substitute (cfg.messages['p-prefix'], {sepc, quote_pages});
elseif not nopp then
quote_prefix = utilities.substitute (cfg.messages['pp-prefix'], {sepc, quote_pages});
else
quote_prefix = utilities.substitute (cfg.messages['nopp'], {sepc, quote_pages});
end
end
quote = quote_prefix .. ": " .. quote;
else
quote = sepc .. " " .. quote;
end
postscript = ""; -- cs1|2 does not supply terminal punctuation when |quote= is set
elseif utilities.is_set (quote_page) or utilities.is_set (quote_pages) then
quote_page = nil; -- unset; these require |quote=; TODO: error message?
quote_pages = nil;
end
return quote, quote_page, quote_pages, postscript;
end
--[[--------------------------< C H E C K _ P U B L I S H E R _ N A M E >--------------------------------------
look for variations of '<text>: <text>' that might be '<location>: <publisher>' in |publisher= parameter value.
when found, emit a maintenance message; return nil else
<publisher> is the value assigned to |publisher= or |institution=
]]
local function check_publisher_name (publisher)
local patterns_t = {
'^[%w%s]+%s*:%s*[%w%s]+$', -- plain text <location>: <publisher>
'^%[+[%w%s:|]+%]+%s*:%s*[%w%s]+$', -- partially wikilinked [[<location>]]: <publisher>
'^[%w%s]+%s*:%s*%[+[%w%s:|]+%]+$', -- partially wikilinked <location>: [[<publisher>]]
'^%[+[%w%s:|]+%]+%s*:%s*%[+[%w%s:|]+%]+$', -- wikilinked [[<location>]]: [[<publisher>]]
}
for _, pattern in ipairs (patterns_t) do -- spin through the patterns_t sequence
if mw.ustring.match (publisher, pattern) then -- does this pattern match?
utilities.set_message ('maint_publisher_location'); -- set a maint message
return; -- and done
end
end
end
--[[--------------------------< I S _ P A G E _ A R T _ N U M >------------------------------------------------
compare the trailing (rightmost) characters of the |doi= value against the whole value assigned to |page(s)=.
return boolean true when:
|page(s)= has exactly 8 digits and a dot between the fourth and fifth digits matches the trailing 9 characters
of the |doi= value: |page=12345678 → |page=1234.5678 matches |doi=10.xxxx/yyyy1234.5678
|page(s)= is 5 or more characters and matches |doi= values's trailing characters
|page(s)= begins with a lowercase 'e' and |page(s)= without the 'e' matches |doi= values's trailing
characters: |page=e12345 → |page=12345 matches |doi=10.xxxx/yyyy12345
|page(s)= begins with a uppercase 'CD' followed by (typically) six digits matches |doi= values that ends with
'CDxxxxxx.pubx' (where 'x' is any single digit)
return nil when |page(s)= values:
are ranges separated by underscore, hyphen, emdash, endash, figure dash, or minus character
are comma- or semicolon-separated lists of pages
have external urls (has text 'http')
are digit-only values less than 10000
do not match |doi= values's trailing characters
]]
local function is_page_art_num (page, doi)
if not (utilities.is_set (page) and utilities.is_set (doi)) then -- both required
return; -- abandon; nothing to do
end
if page:match ('[,;_−–—‒%-]') then -- when |page(s)= might be a page range or a separated list of pages
return; -- abandon
end
page = page:lower(); -- because doi names are case insensitive
doi = doi:lower(); -- force these to lowercase for testing
if page:match ('http') then -- when |page(s)= appears to hold a url
return; -- abandon
end
if tonumber (page) then -- is |page(s)= digits only
if 10000 > tonumber (page) then -- when |page(s)= less than 10000
return; -- abandon
end
if doi:match (page .. '$') then -- digits only page number match the last digits in |doi=?
return true;
end
if 8 == page:len() then -- special case when |page(s)= is exactly 8 digits
local dot_page = page:gsub ('(%d%d%d%d)(%d%d%d%d)', '%1.%2'); -- make a |page=xxxx.yyyy version commonly used in |doi=
if doi:match (dot_page .. '$') then -- 8-digit dotted page number match the last characters in |doi=?
return true;
end
end
else -- here when |page(s)= is alpha-numeric
if 4 < page:len() then -- when |page(s)= is five or more characters
if doi:match (page .. '$') then -- alpha-numeric page match the last characters in |doi=?
return true;
end
local epage = page:match ('^e([%w]+)$'); -- if first character of |page= is 'e', remove it
if epage and doi:match (epage .. '$') then -- page number match the last characters in |doi=?
return true;
end
local cdpage = page:match ('^cd%d+$'); -- if first characters of |page= are 'CD' and last characters are digits (typically 6 digits)
if cdpage and doi:match (cdpage .. '%.pub%d$') then -- page number matches doi 'CDxxxxxx.pubx' where 'x' is a digit
return true;
end
end
end
end
--[[--------------------------< C I T A T I O N 0 >------------------------------------------------------------
This is the main function doing the majority of the citation formatting.
]]
local function citation0( config, args )
--[[
Load Input Parameters
The argument_wrapper facilitates the mapping of multiple aliases to single internal variable.
]]
local A = argument_wrapper ( args );
-- Pick out the relevant fields from the arguments. Different citation templates
-- define different field names for the same underlying things.
local author_etal;
local a = {}; -- authors list from |lastn= / |firstn= pairs or |vauthors=
local Authors;
local NameListStyle;
if cfg.global_cs1_config_t['NameListStyle'] then -- global setting in {{cs1 config}} overrides local |name-list-style= parameter value; nil when empty or assigned value invalid
NameListStyle = is_valid_parameter_value (cfg.global_cs1_config_t['NameListStyle'], 'cs1 config: name-list-style', cfg.keywords_lists['name-list-style'], ''); -- error messaging 'param' here is a hoax
else
NameListStyle = is_valid_parameter_value (A['NameListStyle'], A:ORIGIN('NameListStyle'), cfg.keywords_lists['name-list-style'], '');
end
if cfg.global_cs1_config_t['NameListStyle'] and utilities.is_set (A['NameListStyle']) then -- when template has |name-list-style=<something> which global setting has overridden
utilities.set_message ('maint_overridden_setting'); -- set a maint message
end
local Collaboration = A['Collaboration'];
do -- to limit scope of selected
local selected = select_author_editor_source (A['Vauthors'], A['Authors'], args, 'AuthorList');
if 1 == selected then
a, author_etal = extract_names (args, 'AuthorList'); -- fetch author list from |authorn= / |lastn= / |firstn=, |author-linkn=, and |author-maskn=
elseif 2 == selected then
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
a, author_etal = parse_vauthors_veditors (args, A['Vauthors'], 'AuthorList'); -- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=
elseif 3 == selected then
Authors = A['Authors']; -- use content of |people= or |credits=; |authors= is deprecated; TODO: constrain |people= and |credits= to cite av media, episode, serial?
end
if utilities.is_set (Collaboration) then
author_etal = true; -- so that |display-authors=etal not required
end
end
local editor_etal;
local e = {}; -- editors list from |editor-lastn= / |editor-firstn= pairs or |veditors=
do -- to limit scope of selected
local selected = select_author_editor_source (A['Veditors'], nil, args, 'EditorList'); -- support for |editors= withdrawn
if 1 == selected then
e, editor_etal = extract_names (args, 'EditorList'); -- fetch editor list from |editorn= / |editor-lastn= / |editor-firstn=, |editor-linkn=, and |editor-maskn=
elseif 2 == selected then
NameListStyle = 'vanc'; -- override whatever |name-list-style= might be
e, editor_etal = parse_vauthors_veditors (args, args.veditors, 'EditorList'); -- fetch editor list from |veditors=, |editor-linkn=, and |editor-maskn=
end
end
local Chapter = A['Chapter']; -- done here so that we have access to |contribution= from |chapter= and |script-chapter= aliases
local Chapter_origin = A:ORIGIN ('Chapter');
local ScriptChapter = A['ScriptChapter'];
local ScriptChapter_origin = A:ORIGIN ('ScriptChapter');
local Contribution; -- because contribution is required for contributor(s)
if 'contribution' == Chapter_origin then -- is there a |contribution= parameter?
Contribution = Chapter; -- get the name of the contribution
elseif 'script-contribution' == ScriptChapter_origin then -- no, so is there a |script-contribution= parameter?
Contribution = ScriptChapter; -- get the name of the contribution
end
local c = {}; -- contributors list from |contributor-lastn= / contributor-firstn= pairs
if utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (A['Periodical']) then -- |contributor= and |contribution= only supported in book cites
c = extract_names (args, 'ContributorList'); -- fetch contributor list from |contributorn= / |contributor-lastn=, -firstn=, -linkn=, -maskn=
if 0 < #c then
if not utilities.is_set (Contribution) then -- |contributor= requires |contribution=
utilities.set_message ('err_contributor_missing_required_param', 'contribution'); -- add missing contribution error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
if 0 == #a then -- |contributor= requires |author=
utilities.set_message ('err_contributor_missing_required_param', 'author'); -- add missing author error message
c = {}; -- blank the contributors' table; it is used as a flag later
end
end
else -- if not a book cite
if utilities.select_one (args, cfg.aliases['ContributorList-Last'], 'err_redundant_parameters', 1 ) then -- are there contributor name list parameters?
utilities.set_message ('err_contributor_ignored'); -- add contributor ignored error message
end
Contribution = nil; -- unset
end
local Title = A['Title'];
local TitleLink = A['TitleLink'];
local auto_select = ''; -- default is auto
local accept_link;
TitleLink, accept_link = utilities.has_accept_as_written (TitleLink, true); -- test for accept-this-as-written markup
if (not accept_link) and utilities.in_array (TitleLink, {'none', 'pmc', 'doi'}) then -- check for special keywords
auto_select = TitleLink; -- remember selection for later
TitleLink = ''; -- treat as if |title-link= would have been empty
end
TitleLink = link_title_ok (TitleLink, A:ORIGIN ('TitleLink'), Title, 'title'); -- check for wiki-markup in |title-link= or wiki-markup in |title= when |title-link= is set
local Section = ''; -- {{cite map}} only; preset to empty string for concatenation if not used
if 'map' == config.CitationClass and 'section' == Chapter_origin then
Section = A['Chapter']; -- get |section= from |chapter= alias list; |chapter= and the other aliases not supported in {{cite map}}
Chapter = ''; -- unset for now; will be reset later from |map= if present
end
local Periodical = A['Periodical'];
local Periodical_origin = A:ORIGIN('Periodical');
local ScriptPeriodical = A['ScriptPeriodical'];
local ScriptPeriodical_origin = A:ORIGIN('ScriptPeriodical');
local TransPeriodical = A['TransPeriodical'];
local TransPeriodical_origin = A:ORIGIN ('TransPeriodical');
if (utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical))) then
local param;
if utilities.is_set (Periodical) then -- get a parameter name from one of these periodical related meta-parameters
Periodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = Periodical_origin -- get parameter name for error messaging
elseif utilities.is_set (TransPeriodical) then
TransPeriodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = TransPeriodical_origin; -- get parameter name for error messaging
elseif utilities.is_set (ScriptPeriodical) then
ScriptPeriodical = ''; -- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters
param = ScriptPeriodical_origin; -- get parameter name for error messaging
end
if utilities.is_set (param) then -- if we found one
utilities.set_message ('err_periodical_ignored', {param}); -- emit an error message
end
end
if utilities.is_set (Periodical) then
local i;
Periodical, i = utilities.strip_apostrophe_markup (Periodical); -- strip apostrophe markup so that metadata isn't contaminated
if i then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {Periodical_origin});
end
end
if 'mailinglist' == config.CitationClass then -- special case for {{cite mailing list}}
if utilities.is_set (Periodical) and utilities.is_set (A ['MailingList']) then -- both set emit an error TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', Periodical_origin) .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'mailinglist')});
end
Periodical = A ['MailingList']; -- error or no, set Periodical to |mailinglist= value because this template is {{cite mailing list}}
Periodical_origin = A:ORIGIN('MailingList');
end
-- web and news not tested for now because of
-- Wikipedia:Administrators%27_noticeboard#Is_there_a_semi-automated_tool_that_could_fix_these_annoying_"Cite_Web"_errors?
if not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) then -- 'periodical' templates require periodical parameter
-- local p = {['journal'] = 'journal', ['magazine'] = 'magazine', ['news'] = 'newspaper', ['web'] = 'website'}; -- for error message
local p = {['journal'] = 'journal', ['magazine'] = 'magazine'}; -- for error message
if p[config.CitationClass] then
utilities.set_message ('err_missing_periodical', {config.CitationClass, p[config.CitationClass]});
end
end
local Volume;
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) then
if not utilities.in_array (Periodical_origin, cfg.citation_no_volume_t) then -- {{citation}} does not render |volume= when these parameters are used
Volume = A['Volume']; -- but does for all other 'periodicals'
end
elseif utilities.is_set (ScriptPeriodical) then
if 'script-website' ~= ScriptPeriodical_origin then -- {{citation}} does not render volume for |script-website=
Volume = A['Volume']; -- but does for all other 'periodicals'
end
else
Volume = A['Volume']; -- and does for non-'periodical' cites
end
elseif utilities.in_array (config.CitationClass, cfg.templates_using_volume) then -- render |volume= for cs1 according to the configuration settings
Volume = A['Volume'];
end
extra_text_in_vol_iss_check (Volume, A:ORIGIN ('Volume'), 'v');
local Issue;
if 'citation' == config.CitationClass then
if utilities.is_set (Periodical) and utilities.in_array (Periodical_origin, cfg.citation_issue_t) then -- {{citation}} may render |issue= when these parameters are used
Issue = A['Issue'];
end
elseif utilities.in_array (config.CitationClass, cfg.templates_using_issue) then -- conference & map books do not support issue; {{citation}} listed here because included in settings table
if not (utilities.in_array (config.CitationClass, {'conference', 'map', 'citation'}) and not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical))) then
Issue = A['Issue'];
end
end
local ArticleNumber;
if utilities.in_array (config.CitationClass, {'journal', 'conference'}) or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then
ArticleNumber = A['ArticleNumber'];
end
extra_text_in_vol_iss_check (Issue, A:ORIGIN ('Issue'), 'i');
Issue = utilities.hyphen_to_dash (Issue);
local Page;
local Pages;
local At;
local QuotePage;
local QuotePages;
if not utilities.in_array (config.CitationClass, cfg.templates_not_using_page) then -- TODO: rewrite to emit ignored parameter error message?
Page = A['Page'];
Pages = utilities.hyphen_to_dash (A['Pages']);
At = A['At'];
QuotePage = A['QuotePage'];
QuotePages = utilities.hyphen_to_dash (A['QuotePages']);
end
local NoPP = is_valid_parameter_value (A['NoPP'], A:ORIGIN('NoPP'), cfg.keywords_lists['yes_true_y'], nil);
local Mode = mode_set (A['Mode'], A:ORIGIN('Mode'));
-- separator character and postscript
local sepc, PostScript = set_style (Mode:lower(), A['PostScript'], config.CitationClass);
local Quote;
Quote, QuotePage, QuotePages, PostScript = quote_make (A['Quote'], A['TransQuote'], A['ScriptQuote'], QuotePage, QuotePages, NoPP, sepc, PostScript);
local Edition = A['Edition'];
local PublicationPlace = place_check (A['PublicationPlace'], A:ORIGIN('PublicationPlace'));
local Place = place_check (A['Place'], A:ORIGIN('Place'));
local PublisherName = A['PublisherName'];
local PublisherName_origin = A:ORIGIN('PublisherName');
if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then
local i;
PublisherName, i = utilities.strip_apostrophe_markup (PublisherName); -- strip apostrophe markup so that metadata isn't contaminated; publisher is never italicized
if i and (0 < i) then -- non-zero when markup was stripped so emit an error message
utilities.set_message ('err_apostrophe_markup', {PublisherName_origin});
end
end
if ('document' == config.CitationClass) and not utilities.is_set (PublisherName) then
utilities.set_message ('err_missing_publisher', {config.CitationClass, 'publisher'});
end
local Newsgroup = A['Newsgroup']; -- TODO: strip apostrophe markup?
local Newsgroup_origin = A:ORIGIN('Newsgroup');
if 'newsgroup' == config.CitationClass then
if utilities.is_set (PublisherName) and (cfg.keywords_xlate['none'] ~= PublisherName) then -- general use parameter |publisher= not allowed in cite newsgroup
utilities.set_message ('err_parameter_ignored', {PublisherName_origin});
end
PublisherName = nil; -- ensure that this parameter is unset for the time being; will be used again after COinS
end
if 'book' == config.CitationClass or 'encyclopaedia' == config.CitationClass or ('citation' == config.CitationClass and not utilities.is_set (Periodical)) then
local accept;
PublisherName, accept = utilities.has_accept_as_written (PublisherName); -- check for and remove accept-as-written markup from |publisher= wrapped
if not accept then -- when no accept-as-written markup
check_publisher_name (PublisherName); -- emit maint message when |publisher= might be prefixed with publisher's location
end
end
local URL = A['URL']; -- TODO: better way to do this for URL, ChapterURL, and MapURL?
local UrlAccess = is_valid_parameter_value (A['UrlAccess'], A:ORIGIN('UrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (URL) and utilities.is_set (UrlAccess) then
UrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', 'url');
end
local ChapterURL = A['ChapterURL'];
local ChapterUrlAccess = is_valid_parameter_value (A['ChapterUrlAccess'], A:ORIGIN('ChapterUrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (ChapterURL) and utilities.is_set (ChapterUrlAccess) then
ChapterUrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', {A:ORIGIN('ChapterUrlAccess'):gsub ('%-access', '')});
end
local MapUrlAccess = is_valid_parameter_value (A['MapUrlAccess'], A:ORIGIN('MapUrlAccess'), cfg.keywords_lists['url-access'], nil);
if not utilities.is_set (A['MapURL']) and utilities.is_set (MapUrlAccess) then
MapUrlAccess = nil;
utilities.set_message ('err_param_access_requires_param', {'map-url'});
end
local this_page = mw.title.getCurrentTitle(); -- also used for COinS and for language
local no_tracking_cats = is_valid_parameter_value (A['NoTracking'], A:ORIGIN('NoTracking'), cfg.keywords_lists['yes_true_y'], nil);
-- check this page to see if it is in one of the namespaces that cs1 is not supposed to add to the error categories
if not utilities.is_set (no_tracking_cats) then -- ignore if we are already not going to categorize this page
if cfg.uncategorized_namespaces[this_page.namespace] then -- is this page's namespace id one of the uncategorized namespace ids?
no_tracking_cats = "true"; -- set no_tracking_cats
end
for _, v in ipairs (cfg.uncategorized_subpages) do -- cycle through page name patterns
if this_page.text:match (v) then -- test page name against each pattern
no_tracking_cats = "true"; -- set no_tracking_cats
break; -- bail out if one is found
end
end
end
-- check for extra |page=, |pages= or |at= parameters. (also sheet and sheets while we're at it)
utilities.select_one (args, {'page', 'p', 'pp', 'pages', 'at', 'sheet', 'sheets'}, 'err_redundant_parameters'); -- this is a dummy call simply to get the error message and category
local coins_pages;
Page, Pages, At, coins_pages = insource_loc_get (Page, A:ORIGIN('Page'), Pages, A:ORIGIN('Pages'), At);
if utilities.is_set (PublicationPlace) and utilities.is_set (Place) then -- both |publication-place= and |place= (|location=) allowed if different
utilities.add_prop_cat ('location-test'); -- add property cat to evaluate how often PublicationPlace and Place are used together
if PublicationPlace == Place then
Place = ''; -- unset; don't need both if they are the same
end
elseif not utilities.is_set (PublicationPlace) and utilities.is_set (Place) then -- when only |place= (|location=) is set ...
PublicationPlace = Place; -- promote |place= (|location=) to |publication-place
end
if PublicationPlace == Place then Place = ''; end -- don't need both if they are the same
local URL_origin = A:ORIGIN('URL'); -- get name of parameter that holds URL
local ChapterURL_origin = A:ORIGIN('ChapterURL'); -- get name of parameter that holds ChapterURL
-- local ScriptChapter = A['ScriptChapter'];
-- local ScriptChapter_origin = A:ORIGIN ('ScriptChapter');
local Format = A['Format'];
local ChapterFormat = A['ChapterFormat'];
local TransChapter = A['TransChapter'];
local TransChapter_origin = A:ORIGIN ('TransChapter');
local TransTitle = A['TransTitle'];
local ScriptTitle = A['ScriptTitle'];
--[[
Parameter remapping for cite encyclopedia:
When the citation has these parameters:
|encyclopedia= and |title= then map |title= to |article= and |encyclopedia= to |title= for rendering
|encyclopedia= and |article= then map |encyclopedia= to |title= for rendering
|trans-title= maps to |trans-chapter= when |title= is re-mapped
|url= maps to |chapter-url= when |title= is remapped
All other combinations of |encyclopedia=, |title=, and |article= are not modified
]]
local Encyclopedia = A['Encyclopedia']; -- used as a flag by this module and by ~/COinS
local ScriptEncyclopedia = A['ScriptEncyclopedia'];
local TransEncyclopedia = A['TransEncyclopedia'];
if utilities.is_set (Encyclopedia) or utilities.is_set (ScriptEncyclopedia) then -- emit error message when Encyclopedia set but template is other than {{cite encyclopedia}} or {{citation}}
if 'encyclopaedia' ~= config.CitationClass and 'citation' ~= config.CitationClass then
if utilities.is_set (Encyclopedia) then
utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('Encyclopedia')});
else
utilities.set_message ('err_parameter_ignored', {A:ORIGIN ('ScriptEncyclopedia')});
end
Encyclopedia = nil; -- unset these because not supported by this template
ScriptEncyclopedia = nil;
TransEncyclopedia = nil;
end
elseif utilities.is_set (TransEncyclopedia) then
utilities.set_message ('err_trans_missing_title', {'encyclopedia'});
end
if ('encyclopaedia' == config.CitationClass) or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then
if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then -- when both parameters set emit an error message; {{citation}} only; Periodical not allowed in {{cite encyclopedia}}
utilities.set_message ('err_periodical_ignored', {Periodical_origin});
end
if utilities.is_set (Encyclopedia) or utilities.is_set (ScriptEncyclopedia) then
Periodical = Encyclopedia; -- error or no, set Periodical to Encyclopedia for rendering; {{citation}} could (not legitimately) have both; use Encyclopedia
Periodical_origin = A:ORIGIN ('Encyclopedia');
ScriptPeriodical = ScriptEncyclopedia;
ScriptPeriodical_origin = A:ORIGIN ('ScriptEncyclopedia');
if utilities.is_set (Title) or utilities.is_set (ScriptTitle) then
if not utilities.is_set (Chapter) then
Chapter = Title; -- |encyclopedia= and |title= are set so map |title= params to |article= params for rendering
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle')
TransChapter = TransTitle;
ChapterURL = URL;
ChapterURL_origin = URL_origin;
ChapterUrlAccess = UrlAccess;
ChapterFormat = Format;
if not utilities.is_set (ChapterURL) and utilities.is_set (TitleLink) then
Chapter = utilities.make_wikilink (TitleLink, Chapter);
end
Title = Periodical; -- now map |encyclopedia= params to |title= params for rendering
ScriptTitle = ScriptPeriodical or '';
TransTitle = TransEncyclopedia or '';
Periodical = ''; -- redundant so unset
ScriptPeriodical = '';
URL = '';
Format = '';
TitleLink = '';
end
elseif utilities.is_set (Chapter) or utilities.is_set (ScriptChapter) then -- |title= not set
Title = Periodical; -- |encyclopedia= set and |article= set so map |encyclopedia= to |title= for rendering
ScriptTitle = ScriptPeriodical or '';
TransTitle = TransEncyclopedia or '';
Periodical = ''; -- redundant so unset
ScriptPeriodical = '';
end
end
end
-- special case for cite techreport.
local ID = A['ID'];
if (config.CitationClass == "techreport") then -- special case for cite techreport
if utilities.is_set (A['Number']) then -- cite techreport uses 'number', which other citations alias to 'issue'
if not utilities.is_set (ID) then -- can we use ID for the "number"?
ID = A['Number']; -- yes, use it
else -- ID has a value so emit error message
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'id') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'number')});
end
end
end
-- Account for the oddity that is {{cite conference}}, before generation of COinS data.
local ChapterLink -- = A['ChapterLink']; -- deprecated as a parameter but still used internally by cite episode
local Conference = A['Conference'];
local BookTitle = A['BookTitle'];
local TransTitle_origin = A:ORIGIN ('TransTitle');
if 'conference' == config.CitationClass then
if utilities.is_set (BookTitle) then
Chapter = Title;
Chapter_origin = 'title';
-- ChapterLink = TitleLink; -- |chapter-link= is deprecated
ChapterURL = URL;
ChapterUrlAccess = UrlAccess;
ChapterURL_origin = URL_origin;
URL_origin = '';
ChapterFormat = Format;
TransChapter = TransTitle;
TransChapter_origin = TransTitle_origin;
Title = BookTitle;
Format = '';
-- TitleLink = '';
TransTitle = '';
URL = '';
end
elseif 'speech' ~= config.CitationClass then
Conference = ''; -- not cite conference or cite speech so make sure this is empty string
end
local cs2_lower = function (text) -- if mode is cs2, use lower case
if (sepc ~= '.') then
return text:lower();
end
return text;
end
local use_lowercase = ( sepc == ',' ); -- controls capitalization of certain static text
-- cite map oddities
local Cartography = "";
local Scale = "";
local Sheet = A['Sheet'] or '';
local Sheets = A['Sheets'] or '';
if config.CitationClass == "map" then
if utilities.is_set (Chapter) then --TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'map') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', Chapter_origin)}); -- add error message
end
Chapter = A['Map'];
Chapter_origin = A:ORIGIN('Map'); -- for now, ignore linter warning
ChapterURL = A['MapURL'];
ChapterURL_origin = A:ORIGIN('MapURL');
TransChapter = A['TransMap'];
ScriptChapter = A['ScriptMap']
ScriptChapter_origin = A:ORIGIN('ScriptMap')
ChapterUrlAccess = MapUrlAccess;
ChapterFormat = A['MapFormat'];
Cartography = A['Cartography'];
if utilities.is_set ( Cartography ) then
Cartography = sepc .. " " .. wrap_msg ('cartography', Cartography, use_lowercase);
end
Scale = A['Scale'];
if utilities.is_set ( Scale ) then
Scale = sepc .. " " .. Scale;
end
end
-- Account for the oddities that are {{cite episode}} and {{cite serial}}, before generation of COinS data.
local Series = A['Series'];
if 'episode' == config.CitationClass or 'serial' == config.CitationClass then
local SeriesLink = A['SeriesLink'];
SeriesLink = link_title_ok (SeriesLink, A:ORIGIN ('SeriesLink'), Series, 'series'); -- check for wiki-markup in |series-link= or wiki-markup in |series= when |series-link= is set
local Network = A['Network'];
local Station = A['Station'];
local s, n = {}, {};
-- do common parameters first
if utilities.is_set (Network) then table.insert(n, Network); end
if utilities.is_set (Station) then table.insert(n, Station); end
ID = table.concat(n, sepc .. ' ');
if 'episode' == config.CitationClass then -- handle the oddities that are strictly {{cite episode}}
local Season = A['Season'];
local SeriesNumber = A['SeriesNumber'];
if utilities.is_set (Season) and utilities.is_set (SeriesNumber) then -- these are mutually exclusive so if both are set TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'season') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'seriesno')}); -- add error message
SeriesNumber = ''; -- unset; prefer |season= over |seriesno=
end
-- assemble a table of parts concatenated later into Series
if utilities.is_set (Season) then table.insert(s, wrap_msg ('season', Season, use_lowercase)); end
if utilities.is_set (SeriesNumber) then table.insert(s, wrap_msg ('seriesnum', SeriesNumber, use_lowercase)); end
if utilities.is_set (Issue) then table.insert(s, wrap_msg ('episode', Issue, use_lowercase)); end
Issue = ''; -- unset because this is not a unique parameter
Chapter = Title; -- promote title parameters to chapter
ScriptChapter = ScriptTitle;
ScriptChapter_origin = A:ORIGIN('ScriptTitle');
ChapterLink = TitleLink; -- alias |episode-link=
TransChapter = TransTitle;
ChapterURL = URL;
ChapterUrlAccess = UrlAccess;
ChapterURL_origin = URL_origin;
ChapterFormat = Format;
Title = Series; -- promote series to title
TitleLink = SeriesLink;
Series = table.concat(s, sepc .. ' '); -- this is concatenation of season, seriesno, episode number
if utilities.is_set (ChapterLink) and not utilities.is_set (ChapterURL) then -- link but not URL
Chapter = utilities.make_wikilink (ChapterLink, Chapter);
elseif utilities.is_set (ChapterLink) and utilities.is_set (ChapterURL) then -- if both are set, URL links episode;
Series = utilities.make_wikilink (ChapterLink, Series);
end
URL = ''; -- unset
TransTitle = '';
ScriptTitle = '';
Format = '';
else -- now oddities that are cite serial
Issue = ''; -- unset because this parameter no longer supported by the citation/core version of cite serial
Chapter = A['Episode']; -- TODO: make |episode= available to cite episode someday?
if utilities.is_set (Series) and utilities.is_set (SeriesLink) then
Series = utilities.make_wikilink (SeriesLink, Series);
end
Series = utilities.wrap_style ('italic-title', Series); -- series is italicized
end
end
-- end of {{cite episode}} stuff
-- handle type parameter for those CS1 citations that have default values
local TitleType = A['TitleType'];
local Degree = A['Degree'];
if utilities.in_array (config.CitationClass, {'AV-media-notes', 'document', 'interview', 'mailinglist', 'map', 'podcast', 'pressrelease', 'report', 'speech', 'techreport', 'thesis'}) then
TitleType = set_titletype (config.CitationClass, TitleType);
if utilities.is_set (Degree) and "Thesis" == TitleType then -- special case for cite thesis
TitleType = Degree .. ' ' .. cfg.title_types ['thesis']:lower();
end
end
if utilities.is_set (TitleType) then -- if type parameter is specified
TitleType = utilities.substitute ( cfg.messages['type'], TitleType); -- display it in parentheses
-- TODO: Hack on TitleType to fix bunched parentheses problem
end
-- legacy: promote PublicationDate to Date if neither Date nor Year are set.
local Date = A['Date'];
local Date_origin; -- to hold the name of parameter promoted to Date; required for date error messaging
local PublicationDate = A['PublicationDate'];
local Year = A['Year'];
if utilities.is_set (Year) then
validation.year_check (Year); -- returns nothing; emits maint message when |year= doesn't hold a 'year' value
end
if not utilities.is_set (Date) then
Date = Year; -- promote Year to Date
Year = nil; -- make nil so Year as empty string isn't used for CITEREF
if not utilities.is_set (Date) and utilities.is_set (PublicationDate) then -- use PublicationDate when |date= and |year= are not set
Date = PublicationDate; -- promote PublicationDate to Date
PublicationDate = ''; -- unset, no longer needed
Date_origin = A:ORIGIN('PublicationDate'); -- save the name of the promoted parameter
else
Date_origin = A:ORIGIN('Year'); -- save the name of the promoted parameter
end
else
Date_origin = A:ORIGIN('Date'); -- not a promotion; name required for error messaging
end
if PublicationDate == Date then PublicationDate = ''; end -- if PublicationDate is same as Date, don't display in rendered citation
--[[
Go test all of the date-holding parameters for valid MOS:DATE format and make sure that dates are real dates. This must be done before we do COinS because here is where
we get the date used in the metadata.
Date validation supporting code is in Module:Citation/CS1/Date_validation
]]
local DF = is_valid_parameter_value (A['DF'], A:ORIGIN('DF'), cfg.keywords_lists['df'], '');
if not utilities.is_set (DF) then
DF = cfg.global_df; -- local |df= if present overrides global df set by {{use xxx date}} template
end
local ArchiveURL;
local ArchiveDate;
local ArchiveFormat = A['ArchiveFormat'];
local archive_url_timestamp; -- timestamp from wayback machine url
ArchiveURL, ArchiveDate, archive_url_timestamp = archive_url_check (A['ArchiveURL'], A['ArchiveDate'])
ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, 'archive-format', 'archive-url');
ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN('ArchiveURL'), ArchiveDate); -- add error message when URL or ChapterURL == ArchiveURL
local AccessDate = A['AccessDate'];
local COinS_date = {}; -- holds date info extracted from |date= for the COinS metadata by Module:Date verification
local DoiBroken = A['DoiBroken'];
local Embargo = A['Embargo'];
local anchor_year; -- used in the CITEREF identifier
do -- create defined block to contain local variables date_parameters_list, mismatch
local date_parameters_list = { -- AirDate has been promoted to Date so not necessary to check it
['access-date'] = {val = AccessDate, name = A:ORIGIN ('AccessDate')},
['archive-date'] = {val = ArchiveDate, name = A:ORIGIN ('ArchiveDate')},
['date'] = {val = Date, name = Date_origin},
['doi-broken-date'] = {val = DoiBroken, name = A:ORIGIN ('DoiBroken')},
['pmc-embargo-date'] = {val = Embargo, name = A:ORIGIN ('Embargo')},
['publication-date'] = {val = PublicationDate, name = A:ORIGIN ('PublicationDate')},
['year'] = {val = Year, name = A:ORIGIN ('Year')},
};
local error_list = {};
anchor_year, Embargo = validation.dates(date_parameters_list, COinS_date, error_list);
if utilities.is_set (Year) and utilities.is_set (Date) then -- both |date= and |year= not normally needed;
validation.year_date_check (Year, A:ORIGIN ('Year'), Date, A:ORIGIN ('Date'), error_list);
end
if 0 == #error_list then -- error free dates only; 0 when error_list is empty
local modified = false; -- flag
if utilities.is_set (DF) then -- if we need to reformat dates
modified = validation.reformat_dates (date_parameters_list, DF); -- reformat to DF format, use long month names if appropriate
end
if true == validation.date_hyphen_to_dash (date_parameters_list) then -- convert hyphens to dashes where appropriate
modified = true;
utilities.set_message ('maint_date_format'); -- hyphens were converted so add maint category
end
-- for those wikis that can and want to have English date names translated to the local language; not supported at en.wiki
if cfg.date_name_auto_xlate_enable and validation.date_name_xlate (date_parameters_list, cfg.date_digit_auto_xlate_enable ) then
utilities.set_message ('maint_date_auto_xlated'); -- add maint cat
modified = true;
end
if modified then -- if the date_parameters_list values were modified
AccessDate = date_parameters_list['access-date'].val; -- overwrite date holding parameters with modified values
ArchiveDate = date_parameters_list['archive-date'].val;
Date = date_parameters_list['date'].val;
DoiBroken = date_parameters_list['doi-broken-date'].val;
PublicationDate = date_parameters_list['publication-date'].val;
end
if archive_url_timestamp and utilities.is_set (ArchiveDate) then
validation.archive_date_check (ArchiveDate, archive_url_timestamp, DF); -- does YYYYMMDD in archive_url_timestamp match date in ArchiveDate
end
else
utilities.set_message ('err_bad_date', {utilities.make_sep_list (#error_list, error_list)}); -- add this error message
end
end -- end of do
if utilities.in_array (config.CitationClass, {'book', 'encyclopaedia'}) or -- {{cite book}}, {{cite encyclopedia}}; TODO: {{cite conference}} and others?
('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) or -- {{citation}} as an encylopedia citation
('citation' == config.CitationClass and not utilities.is_set (Periodical)) then -- {{citation}} as a book citation
if utilities.is_set (PublicationPlace) then
if not utilities.is_set (PublisherName) then
local date = COinS_date.rftdate and tonumber (COinS_date.rftdate:match ('%d%d%d%d')); -- get year portion of COinS date (because in Arabic numerals); convert string to number
if date and (1850 <= date) then -- location has no publisher; if date is 1850 or later
utilities.set_message ('maint_location_no_publisher'); -- add maint cat
end
else -- PublisherName has a value
if cfg.keywords_xlate['none'] == PublisherName then -- if that value is 'none' (only for book and encyclopedia citations)
PublisherName = ''; -- unset
end
end
end
end
local ID_list_t; -- sequence table of rendered identifiers
local ID_list_coins_t; -- table of identifiers and their values from args; key is same as cfg.id_handlers's key
local Class = A['Class']; -- arxiv class identifier
local ID_support = {
{A['ASINTLD'], 'ASIN', 'err_asintld_missing_asin', A:ORIGIN ('ASINTLD')},
{DoiBroken, 'DOI', 'err_doibroken_missing_doi', A:ORIGIN ('DoiBroken')},
{Embargo, 'PMC', 'err_embargo_missing_pmc', A:ORIGIN ('Embargo')},
}
ID_list_t, ID_list_coins_t = identifiers.identifier_lists_get (args, {
DoiBroken = DoiBroken, -- for |doi=
ASINTLD = A['ASINTLD'], -- for |asin=
Embargo = Embargo, -- for |pmc=
Class = Class, -- for |arxiv=
CitationClass = config.CitationClass, -- for |arxiv=
Year=anchor_year, -- for |isbn=
}, ID_support);
for _, id in ipairs (ID_list_t) do -- search through the ID_list_t sequence looking for an ISBN identifier string
if id:find ('ISBN', 3, true) then -- plain find, start at index 3 ([[ISBN)
if 'citation' == config.CitationClass then -- catch ve/citoid malformed book cites in {{citation}} templates
if utilities.is_set (Periodical) then -- when a |work= alias is set
utilities.set_message ('maint_work_isbn'); -- add maint cat
break; -- and abandon
end
elseif ({['journal'] = true, ['magazine'] = true, ['news'] = true, ['web'] = true})[config.CitationClass] then
utilities.set_message ('maint_periodical_has_isbn'); -- add maint cat
break; -- and abandon
end
end
end
-- if 'citation' == config.CitationClass then -- catch ve/citoid malformed book cites in {{citation}} templates
-- for _, id in ipairs (ID_list_t) do -- search through the ID_list_t sequence looking for an ISBN identifier string
-- if id:find ('ISBN', 3, true) then -- plain find, start at index 3 ([[ISBN)
-- if utilities.is_set (Periodical) then -- when a |work= alias is set
-- utilities.set_message ('maint_work_isbn'); -- add maint cat
-- end
-- end
-- end
-- end
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, {{cite ssrn}}, before generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then -- |arxiv= or |eprint= required for cite arxiv; |biorxiv=, |citeseerx=, |medrxiv=, |ssrn= required for their templates
if not (args[cfg.id_handlers[config.CitationClass:upper()].parameters[1]] or -- can't use ID_list_coins_t k/v table here because invalid parameters omitted
args[cfg.id_handlers[config.CitationClass:upper()].parameters[2]]) then -- which causes unexpected parameter missing error message
utilities.set_message ('err_' .. config.CitationClass .. '_missing'); -- add error message
end
Periodical = ({['arxiv'] = 'arXiv', ['biorxiv'] = 'bioRxiv', ['citeseerx'] = 'CiteSeerX', ['medrxiv'] = 'medRxiv', ['ssrn'] = 'Social Science Research Network'})[config.CitationClass];
end
-- Link the title of the work if no |url= was provided, but we have a |pmc= or a |doi= with |doi-access=free
if config.CitationClass == "journal" and not utilities.is_set (URL) and not utilities.is_set (TitleLink) and not utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) then -- TODO: remove 'none' once existing citations have been switched to 'off', so 'none' can be used as token for "no title" instead
if 'none' ~= cfg.keywords_xlate[auto_select] then -- if auto-linking not disabled
if identifiers.auto_link_urls[auto_select] then -- manual selection
URL = identifiers.auto_link_urls[auto_select]; -- set URL to be the same as identifier's external link
URL_origin = cfg.id_handlers[auto_select:upper()].parameters[1]; -- set URL_origin to parameter name for use in error message if citation is missing a |title=
elseif identifiers.auto_link_urls['pmc'] then -- auto-select PMC
URL = identifiers.auto_link_urls['pmc']; -- set URL to be the same as the PMC external link if not embargoed
URL_origin = cfg.id_handlers['PMC'].parameters[1]; -- set URL_origin to parameter name for use in error message if citation is missing a |title=
elseif identifiers.auto_link_urls['doi'] then -- auto-select DOI
URL = identifiers.auto_link_urls['doi'];
URL_origin = cfg.id_handlers['DOI'].parameters[1];
end
end
if utilities.is_set (URL) then -- set when using an identifier-created URL
if utilities.is_set (AccessDate) then -- |access-date= requires |url=; identifier-created URL is not |url=
utilities.set_message ('err_accessdate_missing_url'); -- add an error message
AccessDate = ''; -- unset
end
if utilities.is_set (ArchiveURL) then -- |archive-url= requires |url=; identifier-created URL is not |url=
utilities.set_message ('err_archive_missing_url'); -- add an error message
ArchiveURL = ''; -- unset
end
end
end
-- At this point fields may be nil if they weren't specified in the template use. We can use that fact.
-- Test if citation has no title
if not utilities.is_set (Title) and not utilities.is_set (TransTitle) and not utilities.is_set (ScriptTitle) then -- has special case for cite episode
utilities.set_message ('err_citation_missing_title', {'episode' == config.CitationClass and 'series' or 'title'});
end
if utilities.in_array (cfg.keywords_xlate[Title], {'off', 'none'}) and
utilities.in_array (config.CitationClass, {'journal', 'citation'}) and
(utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and
('journal' == Periodical_origin or 'script-journal' == ScriptPeriodical_origin) then -- special case for journal cites
Title = ''; -- set title to empty string
utilities.set_message ('maint_untitled'); -- add maint cat
end
if 'journal' == config.CitationClass or ('citation' == config.CitationClass and utilities.is_set (Periodical) and 'journal' == Periodical_origin) then
if is_page_art_num (((utilities.is_set (Page) and Page) or (utilities.is_set (Pages) and Pages)) or nil, ID_list_coins_t['DOI']) then -- does |page(s)= look like it holds an article number
utilities.set_message ('maint_page_art_num'); -- add maint cat
end
end
-- COinS metadata (see <http://ocoins.info/>) for automated parsing of citation information.
-- handle the oddity that is cite encyclopedia and {{citation |encyclopedia=something}}. Here we presume that
-- when Periodical, Title, and Chapter are all set, then Periodical is the book (encyclopedia) title, Title
-- is the article title, and Chapter is a section within the article. So, we remap
local coins_chapter = Chapter; -- default assuming that remapping not required
local coins_title = Title; -- et tu
if 'encyclopaedia' == config.CitationClass or ('citation' == config.CitationClass and utilities.is_set (Encyclopedia)) then
if utilities.is_set (Chapter) and utilities.is_set (Title) and utilities.is_set (Periodical) then -- if all are used then
coins_chapter = Title; -- remap
coins_title = Periodical;
end
end
local coins_author = a; -- default for coins rft.au
if 0 < #c then -- but if contributor list
coins_author = c; -- use that instead
end
-- this is the function call to COinS()
local OCinSoutput = metadata.COinS({
['Periodical'] = utilities.strip_apostrophe_markup (Periodical), -- no markup in the metadata
['Encyclopedia'] = Encyclopedia, -- just a flag; content ignored by ~/COinS
['Chapter'] = metadata.make_coins_title (coins_chapter, ScriptChapter), -- Chapter and ScriptChapter stripped of bold / italic / accept-as-written markup
['Degree'] = Degree; -- cite thesis only
['Title'] = metadata.make_coins_title (coins_title, ScriptTitle), -- Title and ScriptTitle stripped of bold / italic / accept-as-written markup
['PublicationPlace'] = PublicationPlace,
['Date'] = COinS_date.rftdate, -- COinS_date.* has correctly formatted date values if Date is valid;
['Season'] = COinS_date.rftssn,
['Quarter'] = COinS_date.rftquarter,
['Chron'] = COinS_date.rftchron,
['Series'] = Series,
['Volume'] = Volume,
['Issue'] = Issue,
['ArticleNumber'] = ArticleNumber,
['Pages'] = coins_pages or metadata.get_coins_pages (first_set ({Sheet, Sheets, Page, Pages, At, QuotePage, QuotePages}, 7)), -- pages stripped of external links
['Edition'] = Edition,
['PublisherName'] = PublisherName or Newsgroup, -- any apostrophe markup already removed from PublisherName
['URL'] = first_set ({ChapterURL, URL}, 2),
['Authors'] = coins_author,
['ID_list'] = ID_list_coins_t,
['RawPage'] = this_page.prefixedText,
}, config.CitationClass);
-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, and {{cite ssrn}} AFTER generation of COinS data.
if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then -- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, medRxiv, or ssrn now unset so it isn't displayed
Periodical = ''; -- periodical not allowed in these templates; if article has been published, use cite journal
end
-- special case for cite newsgroup. Do this after COinS because we are modifying Publishername to include some static text
if 'newsgroup' == config.CitationClass and utilities.is_set (Newsgroup) then
PublisherName = utilities.substitute (cfg.messages['newsgroup'], external_link( 'news:' .. Newsgroup, Newsgroup, Newsgroup_origin, nil ));
end
local Editors;
local EditorCount; -- used only for choosing {ed.) or (eds.) annotation at end of editor name-list
local Contributors; -- assembled contributors name list
local contributor_etal = nil; -- must be intentionally initialized
local Translators; -- assembled translators name list
local translator_etal = nil; -- must be intentionally initialized
local t = extract_names (args, 'TranslatorList'); -- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn=
local Interviewers;
local interviewers_list = extract_names (args, 'InterviewerList'); -- process preferred interviewers parameters
local interviewer_etal = nil; -- must be intentionally initialized
-- Now perform various field substitutions.
-- We also add leading spaces and surrounding markup and punctuation to the
-- various parts of the citation, but only when they are non-nil.
do
local last_first_list;
local control = {
format = NameListStyle, -- empty string, '&', 'amp', 'and', or 'vanc'
maximum = nil, -- as if display-authors or display-editors not set
mode = Mode
};
do -- do editor name list first because the now unsupported coauthors used to modify control table
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayEditors'], A['DisplayEditors'], A:ORIGIN ('DisplayEditors'), #e);
control.maximum, editor_etal = get_display_names (display_names, #e, editor_etal, param);
Editors, EditorCount = list_people (control, e, editor_etal);
if 1 == EditorCount and (true == editor_etal or 1 < #e) then -- only one editor displayed but includes etal then
EditorCount = 2; -- spoof to display (eds.) annotation
end
end
do -- now do interviewers
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayInterviewers'], A['DisplayInterviewers'], A:ORIGIN ('DisplayInterviewers'), #interviewers_list);
control.maximum, interviewer_etal = get_display_names (display_names, #interviewers_list, interviewer_etal, param);
Interviewers = list_people (control, interviewers_list, interviewer_etal);
end
do -- now do translators
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayTranslators'], A['DisplayTranslators'], A:ORIGIN ('DisplayTranslators'), #t);
control.maximum, translator_etal = get_display_names (display_names, #t, translator_etal, param);
Translators = list_people (control, t, translator_etal);
end
do -- now do contributors
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayContributors'], A['DisplayContributors'], A:ORIGIN ('DisplayContributors'), #c);
control.maximum, contributor_etal = get_display_names (display_names, #c, contributor_etal, param);
Contributors = list_people (control, c, contributor_etal);
end
do -- now do authors
local display_names, param = display_names_select (cfg.global_cs1_config_t['DisplayAuthors'], A['DisplayAuthors'], A:ORIGIN ('DisplayAuthors'), #a, author_etal);
control.maximum, author_etal = get_display_names (display_names, #a, author_etal, param);
last_first_list = list_people (control, a, author_etal);
if utilities.is_set (Authors) then
Authors, author_etal = name_has_etal (Authors, author_etal, false, 'authors'); -- find and remove variations on et al.
if author_etal then
Authors = Authors .. ' ' .. cfg.messages['et al']; -- add et al. to authors parameter
end
else
Authors = last_first_list; -- either an author name list or an empty string
end
end -- end of do
if utilities.is_set (Authors) and utilities.is_set (Collaboration) then
Authors = utilities.substitute (cfg.messages['collaboration'], {Authors, Collaboration}); -- add collaboration after et al.
end
end
local ConferenceFormat = A['ConferenceFormat'];
local ConferenceURL = A['ConferenceURL'];
ConferenceFormat = style_format (ConferenceFormat, ConferenceURL, 'conference-format', 'conference-url');
Format = style_format (Format, URL, 'format', 'url');
-- special case for chapter format so no error message or cat when chapter not supported
if not (utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia))) then
ChapterFormat = style_format (ChapterFormat, ChapterURL, 'chapter-format', 'chapter-url');
end
if not utilities.is_set (URL) then
if utilities.in_array (config.CitationClass, {"web", "podcast", "mailinglist"}) or -- |url= required for {{cite web}}, {{cite podcast}}, and {{cite mailing list}}
('citation' == config.CitationClass and ('website' == Periodical_origin or 'script-website' == ScriptPeriodical_origin)) then -- and required for {{citation}} with |website= or |script-website=
if not url_was_archive_today then -- is <URL> empty/missing because it was a deprecated archive.today url
utilities.set_message ('err_cite_web_url'); -- no; emit an error message for an empty/ missing |url=
end
end
-- do we have |accessdate= without either |url= or |chapter-url=?
if utilities.is_set (AccessDate) and not utilities.is_set (ChapterURL) then -- ChapterURL may be set when URL is not set;
utilities.set_message ('err_accessdate_missing_url');
AccessDate = '';
end
end
local UrlStatus = is_valid_parameter_value (A['UrlStatus'], A:ORIGIN('UrlStatus'), cfg.keywords_lists['url-status'], '');
local OriginalURL
local OriginalURL_origin
local OriginalFormat
local OriginalAccess;
UrlStatus = UrlStatus:lower(); -- used later when assembling archived text
if utilities.is_set ( ArchiveURL ) then
if utilities.is_set (ChapterURL) then -- if chapter-url= is set apply archive url to it
OriginalURL = ChapterURL; -- save copy of source chapter's url for archive text
OriginalURL_origin = ChapterURL_origin; -- name of |chapter-url= parameter for error messages
OriginalFormat = ChapterFormat; -- and original |chapter-format=
if 'live' ~= UrlStatus then
ChapterURL = ArchiveURL -- swap-in the archive's URL
ChapterURL_origin = A:ORIGIN('ArchiveURL') -- name of |archive-url= parameter for error messages
ChapterFormat = ArchiveFormat or ''; -- swap in archive's format
ChapterUrlAccess = nil; -- restricted access levels do not make sense for archived URLs
end
elseif utilities.is_set (URL) then
OriginalURL = URL; -- save copy of original source URL
OriginalURL_origin = URL_origin; -- name of URL parameter for error messages
OriginalFormat = Format; -- and original |format=
OriginalAccess = UrlAccess;
if 'live' ~= UrlStatus then -- if URL set then |archive-url= applies to it
URL = ArchiveURL -- swap-in the archive's URL
URL_origin = A:ORIGIN('ArchiveURL') -- name of archive URL parameter for error messages
Format = ArchiveFormat or ''; -- swap in archive's format
UrlAccess = nil; -- restricted access levels do not make sense for archived URLs
end
end
elseif utilities.is_set (UrlStatus) then -- if |url-status= is set when |archive-url= is not set
utilities.set_message ('maint_url_status'); -- add maint cat
end
if utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'pressrelease', 'podcast', 'newsgroup', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or -- if any of the 'periodical' cites except encyclopedia
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) then
local chap_param;
if utilities.is_set (Chapter) then -- get a parameter name from one of these chapter related meta-parameters
chap_param = A:ORIGIN ('Chapter')
elseif utilities.is_set (TransChapter) then
chap_param = A:ORIGIN ('TransChapter')
elseif utilities.is_set (ChapterURL) then
chap_param = A:ORIGIN ('ChapterURL')
elseif utilities.is_set (ScriptChapter) then
chap_param = ScriptChapter_origin;
else utilities.is_set (ChapterFormat)
chap_param = A:ORIGIN ('ChapterFormat')
end
if utilities.is_set (chap_param) then -- if we found one
utilities.set_message ('err_chapter_ignored', {chap_param}); -- add error message
Chapter = ''; -- and set them to empty string to be safe with concatenation
TransChapter = ''; -- for now, ignore linter warnings
ChapterURL = '';
ScriptChapter = '';
ChapterFormat = '';
end
else -- otherwise, format chapter / article title
local no_quotes = false; -- default assume that we will be quoting the chapter parameter value
if utilities.is_set (Contribution) and 0 < #c then -- if this is a contribution with contributor(s)
if utilities.in_array (Contribution:lower(), cfg.keywords_lists.contribution) then -- and a generic contribution title
no_quotes = true; -- then render it unquoted
end
end
Chapter = format_chapter_title (ScriptChapter, ScriptChapter_origin, Chapter, TransChapter, TransChapter_origin, ChapterURL, ChapterURL_origin, no_quotes, ChapterUrlAccess); -- Contribution is also in Chapter
if utilities.is_set (Chapter) then
Chapter = Chapter .. ChapterFormat ;
if 'map' == config.CitationClass and utilities.is_set (TitleType) then
Chapter = Chapter .. ' ' .. TitleType; -- map annotation here; not after title
end
Chapter = Chapter .. sepc .. ' ';
elseif utilities.is_set (ChapterFormat) then -- |chapter= not set but |chapter-format= is so ...
Chapter = ChapterFormat .. sepc .. ' '; -- ... ChapterFormat has error message, we want to see it
end
end
-- Format main title
local plain_title = false;
local accept_title;
Title, accept_title = utilities.has_accept_as_written (Title, true); -- remove accept-this-as-written markup when it wraps all of <Title>
if accept_title and ('' == Title) then -- only support forced empty for now "(())"
Title = cfg.messages['notitle']; -- replace by predefined "No title" message
-- TODO: utilities.set_message ( 'err_redundant_parameters', ...); -- issue proper error message instead of muting
ScriptTitle = ''; -- just mute for now
TransTitle = ''; -- just mute for now
plain_title = true; -- suppress text decoration for descriptive title
utilities.set_message ('maint_untitled'); -- add maint cat
end
if not accept_title then -- <Title> not wrapped in accept-as-written markup
if '...' == Title:sub (-3) then -- if ellipsis is the last three characters of |title=
Title = Title:gsub ('(%.%.%.)%.+$', '%1'); -- limit the number of dots to three
elseif not mw.ustring.find (Title, '%.%s*%a%.$') and -- end of title is not a 'dot-(optional space-)letter-dot' initialism ...
not mw.ustring.find (Title, '%s+%a%.$') then -- ...and not a 'space-letter-dot' initial (''Allium canadense'' L.)
Title = mw.ustring.gsub(Title, '%' .. sepc .. '$', ''); -- remove any trailing separator character; sepc and ms.ustring() here for languages that use multibyte separator characters
end
if utilities.is_set (ArchiveURL) and is_archived_copy (Title) then
utilities.set_message ('maint_archived_copy'); -- add maintenance category before we modify the content of Title
end
if is_generic ('generic_titles', Title) then
utilities.set_message ('err_generic_title'); -- set an error message
end
end
if (not plain_title) and (utilities.in_array (config.CitationClass, {'web', 'news', 'journal', 'magazine', 'document', 'pressrelease', 'podcast', 'newsgroup', 'mailinglist', 'interview', 'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) or
('citation' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) or
('map' == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)))) then -- special case for cite map when the map is in a periodical treat as an article
Title = kern_quotes (Title); -- if necessary, separate title's leading and trailing quote marks from module provided quote marks
Title = utilities.wrap_style ('quoted-title', Title);
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle );
elseif plain_title or ('report' == config.CitationClass) then -- no styling for cite report and descriptive titles (otherwise same as above)
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-quoted-title', TransTitle ); -- for cite report, use this form for trans-title
else
Title = utilities.wrap_style ('italic-title', Title);
Title = script_concatenate (Title, ScriptTitle, 'script-title'); -- <bdi> tags, lang attribute, categorization, etc.; must be done after title is wrapped
TransTitle = utilities.wrap_style ('trans-italic-title', TransTitle);
end
if utilities.is_set (TransTitle) then
if utilities.is_set (Title) then
TransTitle = " " .. TransTitle;
else
utilities.set_message ('err_trans_missing_title', {'title'});
end
end
if utilities.is_set (Title) then -- TODO: is this the right place to be making Wikisource URLs?
if utilities.is_set (TitleLink) and utilities.is_set (URL) then
utilities.set_message ('err_wikilink_in_url'); -- set an error message because we can't have both
TitleLink = ''; -- unset
end
if not utilities.is_set (TitleLink) and utilities.is_set (URL) then
Title = external_link (URL, Title, URL_origin, UrlAccess) .. TransTitle .. Format;
URL = ''; -- unset these because no longer needed
Format = ''; -- for now, ignore linter warning
elseif utilities.is_set (TitleLink) and not utilities.is_set (URL) then
local ws_url;
ws_url = wikisource_url_make (TitleLink); -- ignore ws_label return; not used here
if ws_url then
Title = external_link (ws_url, Title .. ' ', 'ws link in title-link'); -- space char after Title to move icon away from italic text; TODO: a better way to do this?
Title = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], TitleLink, Title});
Title = Title .. TransTitle;
else
Title = utilities.make_wikilink (TitleLink, Title) .. TransTitle;
end
else
local ws_url, ws_label, L; -- Title has italic or quote markup by the time we get here which causes is_wikilink() to return 0 (not a wikilink)
ws_url, ws_label, L = wikisource_url_make (Title:gsub('^[\'"]*(.-)[\'"]*$', '%1')); -- make ws URL from |title= interwiki link (strip italic or quote markup); link portion L becomes tooltip label
if ws_url then
Title = Title:gsub ('%b[]', ws_label); -- replace interwiki link with ws_label to retain markup
Title = external_link (ws_url, Title .. ' ', 'ws link in title'); -- space char after Title to move icon away from italic text; TODO: a better way to do this?
Title = utilities.substitute (cfg.presentation['interwiki-icon'], {cfg.presentation['class-wikisource'], L, Title});
Title = Title .. TransTitle;
else
Title = Title .. TransTitle;
end
end
else
Title = TransTitle;
end
if utilities.is_set (Place) then
Place = " " .. wrap_msg ('written', Place, use_lowercase) .. sepc .. " ";
end
local ConferenceURL_origin = A:ORIGIN('ConferenceURL'); -- get name of parameter that holds ConferenceURL
if utilities.is_set (Conference) then
if utilities.is_set (ConferenceURL) then
Conference = external_link( ConferenceURL, Conference, ConferenceURL_origin, nil );
end
Conference = sepc .. " " .. Conference .. ConferenceFormat;
elseif utilities.is_set (ConferenceURL) then
Conference = sepc .. " " .. external_link( ConferenceURL, nil, ConferenceURL_origin, nil );
end
local Position = '';
if not utilities.is_set (Position) then
local Minutes = A['Minutes'];
local Time = A['Time'];
if utilities.is_set (Minutes) then
if utilities.is_set (Time) then --TODO: make a function for this and similar?
utilities.set_message ('err_redundant_parameters', {utilities.wrap_style ('parameter', 'minutes') .. cfg.presentation['sep_list_pair'] .. utilities.wrap_style ('parameter', 'time')});
end
Position = utilities.substitute (cfg.messages.minutes, Minutes);
else
if utilities.is_set (Time) then
local TimeCaption = A['TimeCaption']
if not utilities.is_set (TimeCaption) then
TimeCaption = cs2_lower(cfg.messages['event']);
end
Position = " " .. TimeCaption .. " " .. Time;
end
end
else
Position = " " .. Position;
At = '';
end
Page, Pages, Sheet, Sheets = format_pages_sheets (Page, Pages, Sheet, Sheets, config.CitationClass, Periodical_origin, sepc, NoPP, use_lowercase);
At = utilities.is_set (At) and (sepc .. " " .. At) or "";
Position = utilities.is_set (Position) and (sepc .. " " .. Position) or "";
if config.CitationClass == 'map' then
local Sections = A['Sections']; -- Section (singular) is an alias of Chapter so set earlier
local Inset = A['Inset'];
if utilities.is_set ( Inset ) then
Inset = sepc .. " " .. wrap_msg ('inset', Inset, use_lowercase);
end
if utilities.is_set ( Sections ) then
Section = sepc .. " " .. wrap_msg ('sections', Sections, use_lowercase);
elseif utilities.is_set ( Section ) then
Section = sepc .. " " .. wrap_msg ('section', Section, use_lowercase);
end
At = At .. Inset .. Section;
end
local Others = A['Others'];
if utilities.is_set (Others) and 0 == #a and 0 == #e then -- add maint cat when |others= has value and used without |author=, |editor=
if config.CitationClass == "AV-media-notes"
or config.CitationClass == "audio-visual" then -- special maint for AV/M which has a lot of 'false' positives right now
utilities.set_message ('maint_others_avm')
else
utilities.set_message ('maint_others');
end
end
Others = utilities.is_set (Others) and (sepc .. " " .. Others) or "";
if utilities.is_set (Translators) then
Others = safe_join ({sepc .. ' ', wrap_msg ('translated', Translators, use_lowercase), Others}, sepc);
end
if utilities.is_set (Interviewers) then
Others = safe_join ({sepc .. ' ', wrap_msg ('interview', Interviewers, use_lowercase), Others}, sepc);
end
local TitleNote = A['TitleNote'];
TitleNote = utilities.is_set (TitleNote) and (sepc .. " " .. TitleNote) or "";
if utilities.is_set (Edition) then
if Edition:match ('%f[%a][Ee]d%n?%.?$') or Edition:match ('%f[%a][Ee]dition$') then -- Ed, ed, Ed., ed., Edn, edn, Edn., edn.
utilities.set_message ('err_extra_text_edition'); -- add error message
end
Edition = " " .. wrap_msg ('edition', Edition);
else
Edition = '';
end
Series = utilities.is_set (Series) and wrap_msg ('series', {sepc, Series}) or ""; -- not the same as SeriesNum
local Agency = A['Agency'] or ''; -- |agency= is supported by {{cite magazine}}, {{cite news}}, {{cite press release}}, {{cite web}}, and certain {{citation}} templates
if utilities.is_set (Agency) then -- this testing done here because {{citation}} supports 'news' citations
if utilities.in_array (config.CitationClass, {'magazine', 'news', 'pressrelease', 'web'}) or ('citation' == config.CitationClass and utilities.in_array (Periodical_origin, {"magazine", "newspaper", "work"})) then
Agency = wrap_msg ('agency', {sepc, Agency}); -- format for rendering
else
Agency = ''; -- unset; not supported
utilities.set_message ('err_parameter_ignored', {'agency'}); -- add error message
end
end
Volume = format_volume_issue (Volume, Issue, ArticleNumber, config.CitationClass, Periodical_origin, sepc, use_lowercase);
if utilities.is_set (AccessDate) then
local retrv_text = " " .. cfg.messages['retrieved'];
AccessDate = nowrap_date (AccessDate); -- wrap in nowrap span if date in appropriate format
retrv_text = cs2_lower(retrv_text); -- if mode is cs2, lower case
AccessDate = utilities.substitute (retrv_text, AccessDate); -- add retrieved text
AccessDate = utilities.substitute (cfg.presentation['accessdate'], {sepc, AccessDate}); -- allow editors to hide accessdates
end
if utilities.is_set (ID) then ID = sepc .. " " .. ID; end
local Docket = A['Docket'];
if "thesis" == config.CitationClass and utilities.is_set (Docket) then
ID = sepc .. " Docket " .. Docket .. ID;
end
if "report" == config.CitationClass and utilities.is_set (Docket) then -- for cite report when |docket= is set
ID = sepc .. ' ' .. Docket; -- overwrite ID even if |id= is set
end
if utilities.is_set (URL) then
URL = " " .. external_link( URL, nil, URL_origin, UrlAccess );
end
-- We check length of PostScript here because it will have been nuked by
-- the quote parameters. We'd otherwise emit a message even if there wasn't
-- a displayed postscript.
-- TODO: Should the max size (1) be configurable?
-- TODO: Should we check a specific pattern?
if utilities.is_set(PostScript) and mw.ustring.len(PostScript) > 1 then
utilities.set_message ('maint_postscript')
end
local Archived;
if utilities.is_set (ArchiveURL) then
if not utilities.is_set (ArchiveDate) then -- ArchiveURL set but ArchiveDate not set
utilities.set_message ('err_archive_missing_date'); -- emit an error message
ArchiveURL = ''; -- empty string for concatenation
ArchiveDate = ''; -- empty string for concatenation
end
else
if utilities.is_set (ArchiveDate) then -- ArchiveURL not set but ArchiveDate is set
utilities.set_message ('err_archive_date_missing_url'); -- emit an error message
ArchiveURL = ''; -- empty string for concatenation
ArchiveDate = ''; -- empty string for concatenation
end
end
if utilities.is_set (ArchiveURL) then
if "live" == UrlStatus then
if utilities.is_set (ArchiveDate) then
Archived = sepc .. ' ' .. utilities.substitute ( cfg.messages['archived-live'],
{ external_link( ArchiveURL, cs2_lower(cfg.messages['archived']), A:ORIGIN('ArchiveURL'), nil) .. ArchiveFormat, ArchiveDate } );
else
Archived = '';
end
if not utilities.is_set (OriginalURL) then
utilities.set_message ('err_archive_missing_url');
Archived = ''; -- empty string for concatenation
end
elseif utilities.is_set (OriginalURL) then -- UrlStatus is empty, 'dead', 'unfit', 'usurped', 'bot: unknown'
if utilities.in_array (UrlStatus, {'unfit', 'usurped', 'bot: unknown'}) then
Archived = sepc .. ' ' .. utilities.substitute ( cs2_lower(cfg.messages['archived-unfit']), ArchiveDate);
if 'bot: unknown' == UrlStatus then
utilities.set_message ('maint_bot_unknown'); -- and add a category if not already added
else
utilities.add_prop_cat ('unfit'); -- and add a category if not already added
end
else -- UrlStatus is empty, 'dead'
if utilities.is_set (ArchiveDate) then
Archived = sepc .. ' ' .. utilities.substitute ( cs2_lower(cfg.messages['archived-dead']),
{ external_link( OriginalURL, cfg.messages['original'], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } );
else
Archived = ''; -- unset for concatenation
end
end
else -- OriginalUrl not set
utilities.set_message ('err_archive_missing_url');
Archived = ''; -- empty string for concatenation
end
elseif utilities.is_set (ArchiveFormat) then
Archived = ArchiveFormat; -- if set and ArchiveURL not set ArchiveFormat has error message
else
Archived = '';
end
local TranscriptURL = A['TranscriptURL']
local TranscriptFormat = A['TranscriptFormat'];
TranscriptFormat = style_format (TranscriptFormat, TranscriptURL, 'transcript-format', 'transcripturl');
local Transcript = A['Transcript'];
local TranscriptURL_origin = A:ORIGIN('TranscriptURL'); -- get name of parameter that holds TranscriptURL
if utilities.is_set (Transcript) then
if utilities.is_set (TranscriptURL) then
Transcript = external_link( TranscriptURL, Transcript, TranscriptURL_origin, nil );
end
Transcript = sepc .. ' ' .. Transcript .. TranscriptFormat;
elseif utilities.is_set (TranscriptURL) then
Transcript = external_link( TranscriptURL, nil, TranscriptURL_origin, nil );
end
local Publisher;
if utilities.is_set (PublicationDate) then
PublicationDate = wrap_msg ('published', PublicationDate);
end
if utilities.is_set (PublisherName) then
if utilities.is_set (PublicationPlace) then
Publisher = sepc .. " " .. PublicationPlace .. ": " .. PublisherName .. PublicationDate;
else
Publisher = sepc .. " " .. PublisherName .. PublicationDate;
end
elseif utilities.is_set (PublicationPlace) then
Publisher= sepc .. " " .. PublicationPlace .. PublicationDate;
else
Publisher = PublicationDate;
end
-- Several of the above rely upon detecting this as nil, so do it last.
if (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical)) then
if utilities.is_set (Title) or utilities.is_set (TitleNote) then
Periodical = sepc .. " " .. format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);
else
Periodical = format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);
end
end
local Language = A['Language'];
if utilities.is_set (Language) then
Language = language_parameter (Language); -- format, categories, name from ISO639-1, etc.
else
Language=''; -- language not specified so make sure this is an empty string;
--[[ TODO: need to extract the wrap_msg from language_parameter
so that we can solve parentheses bunching problem with Format/Language/TitleType
]]
end
--[[
Handle the oddity that is cite speech. This code overrides whatever may be the value assigned to TitleNote (through |department=) and forces it to be " (Speech)" so that
the annotation directly follows the |title= parameter value in the citation rather than the |event= parameter value (if provided).
]]
if "speech" == config.CitationClass then -- cite speech only
TitleNote = TitleType; -- move TitleType to TitleNote so that it renders ahead of |event=
TitleType = ''; -- and unset
if utilities.is_set (Periodical) then -- if Periodical, perhaps because of an included |website= or |journal= parameter
if utilities.is_set (Conference) then -- and if |event= is set
Conference = Conference .. sepc .. " "; -- then add appropriate punctuation to the end of the Conference variable before rendering
end
end
end
-- Piece all bits together at last. Here, all should be non-nil.
-- We build things this way because it is more efficient in LUA
-- not to keep reassigning to the same string variable over and over.
local tcommon;
local tcommon2; -- used for book cite when |contributor= is set
local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;
if utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (Periodical) then -- special cases for book cites
if utilities.is_set (Contributors) then -- when we are citing foreword, preface, introduction, etc.
tcommon = safe_join ({Title, TitleNote}, sepc); -- author and other stuff will come after this and before tcommon2
tcommon2 = safe_join ({TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc);
else
tcommon = safe_join ({Title, TitleNote, TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc);
end
elseif 'map' == config.CitationClass then -- special cases for cite map
if utilities.is_set (Chapter) then -- map in a book; TitleType is part of Chapter
tcommon = safe_join ({Title, Edition, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc);
elseif utilities.is_set (Periodical) then -- map in a periodical
tcommon = safe_join ({Title, TitleType, Periodical, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc);
else -- a sheet or stand-alone map
tcommon = safe_join ({Title, TitleType, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc);
end
elseif 'episode' == config.CitationClass then -- special case for cite episode
tcommon = safe_join ({Title, TitleNote, TitleType, Series, Language, Edition, Publisher}, sepc);
else -- all other CS1 templates
tcommon = safe_join ({Title, TitleNote, Conference, Periodical, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc);
end
if #ID_list_t > 0 then
ID_list_t = safe_join( { sepc .. " ", table.concat( ID_list_t, sepc .. " " ), ID }, sepc );
else
ID_list_t = ID;
end
local Via = A['Via'];
Via = utilities.is_set (Via) and wrap_msg ('via', Via) or '';
local idcommon;
if 'audio-visual' == config.CitationClass or 'episode' == config.CitationClass then -- special case for cite AV media & cite episode position transcript
idcommon = safe_join( { ID_list_t, URL, Archived, Transcript, AccessDate, Via, Quote }, sepc );
else
idcommon = safe_join( { ID_list_t, URL, Archived, AccessDate, Via, Quote }, sepc );
end
local text;
-- local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;
local OrigDate = A['OrigDate'];
OrigDate = utilities.is_set (OrigDate) and wrap_msg ('origdate', OrigDate) or '';
if utilities.is_set (Date) then
if utilities.is_set (Authors) or utilities.is_set (Editors) then -- date follows authors or editors when authors not set
Date = " (" .. Date .. ")" .. OrigDate .. sepc .. " "; -- in parentheses
else -- neither of authors and editors set
if (string.sub(tcommon, -1, -1) == sepc) then -- if the last character of tcommon is sepc
Date = " " .. Date .. OrigDate; -- Date does not begin with sepc
else
Date = sepc .. " " .. Date .. OrigDate; -- Date begins with sepc
end
end
end
if utilities.is_set (Authors) then
if (not utilities.is_set (Date)) then -- when date is set it's in parentheses; no Authors termination
Authors = terminate_name_list (Authors, sepc); -- when no date, terminate with 0 or 1 sepc and a space
end
if utilities.is_set (Editors) then
local in_text = '';
local post_text;
if utilities.is_set (Chapter) and 0 == #c then
in_text = cfg.messages['in'] .. ' ';
in_text = cs2_lower(in_text); -- lowercase for cs2
end
if EditorCount <= 1 then
post_text = ' (' .. cfg.messages['editor'] .. ')'; -- be consistent with no-author, no-date case
else
post_text = ' (' .. cfg.messages['editors'] .. ')';
end
Editors = terminate_name_list (in_text .. Editors .. post_text, sepc); -- terminate with 0 or 1 sepc and a space
end
if utilities.is_set (Contributors) then -- book cite and we're citing the intro, preface, etc.
local by_text = sepc .. ' ' .. cfg.messages['by'] .. ' ';
by_text = cs2_lower(by_text); -- lowercase for cs2
Authors = by_text .. Authors; -- author follows title so tweak it here
if utilities.is_set (Editors) and utilities.is_set (Date) then -- when Editors make sure that Authors gets terminated
Authors = terminate_name_list (Authors, sepc); -- terminate with 0 or 1 sepc and a space
end
if (not utilities.is_set (Date)) then -- when date is set it's in parentheses; no Contributors termination
Contributors = terminate_name_list (Contributors, sepc); -- terminate with 0 or 1 sepc and a space
end
text = safe_join( {Contributors, Date, Chapter, tcommon, Authors, Place, Editors, tcommon2, pgtext, idcommon }, sepc );
else
text = safe_join( {Authors, Date, Chapter, Place, Editors, tcommon, pgtext, idcommon }, sepc );
end
elseif utilities.is_set (Editors) then
if utilities.is_set (Date) then
if EditorCount <= 1 then
Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editor'];
else
Editors = Editors .. cfg.presentation['sep_name'] .. cfg.messages['editors'];
end
else
if EditorCount <= 1 then
Editors = Editors .. " (" .. cfg.messages['editor'] .. ")" .. sepc .. " "
else
Editors = Editors .. " (" .. cfg.messages['editors'] .. ")" .. sepc .. " "
end
end
text = safe_join( {Editors, Date, Chapter, Place, tcommon, pgtext, idcommon}, sepc );
else
if utilities.in_array (config.CitationClass, {"journal", "citation"}) and utilities.is_set (Periodical) then
text = safe_join( {Chapter, Place, tcommon, pgtext, Date, idcommon}, sepc );
else
text = safe_join( {Chapter, Place, tcommon, Date, pgtext, idcommon}, sepc );
end
end
if utilities.is_set (PostScript) and PostScript ~= sepc then
text = safe_join( {text, sepc}, sepc ); -- Deals with italics, spaces, etc.
if '.' == sepc then -- remove final seperator if present
text = text:gsub ('%' .. sepc .. '$', ''); -- dot must be escaped here
else
text = mw.ustring.gsub (text, sepc .. '$', ''); -- using ustring for non-dot sepc (likely a non-Latin character)
end
end
text = safe_join( {text, PostScript}, sepc );
-- Now enclose the whole thing in a <cite> element
local options_t = {};
options_t.class = cite_class_attribute_make (config.CitationClass, Mode);
local Ref = is_valid_parameter_value (A['Ref'], A:ORIGIN('Ref'), cfg.keywords_lists['ref'], nil, true); -- nil when |ref=harv; A['Ref'] else
if 'none' ~= cfg.keywords_xlate[(Ref and Ref:lower()) or ''] then
local namelist_t = {}; -- holds selected contributor, author, editor name list
local year = first_set ({Year, anchor_year}, 2); -- Year first for legacy citations and for YMD dates that require disambiguation
if #c > 0 then -- if there is a contributor list
namelist_t = c; -- select it
elseif #a > 0 then -- or an author list
namelist_t = a;
elseif #e > 0 then -- or an editor list
namelist_t = e;
end
local citeref_id;
if #namelist_t > 0 then -- if there are names in namelist_t
citeref_id = make_citeref_id (namelist_t, year); -- go make the CITEREF anchor
if mw.uri.anchorEncode (citeref_id) == ((Ref and mw.uri.anchorEncode (Ref)) or '') then -- Ref may already be encoded (by {{sfnref}}) so citeref_id must be encoded before comparison
utilities.set_message ('maint_ref_duplicates_default');
end
else
citeref_id = ''; -- unset
end
options_t.id = Ref or citeref_id;
end
if string.len (text:gsub('%b<>', '')) <= 2 then -- remove html and html-like tags; then get length of what remains;
z.error_cats_t = {}; -- blank the categories list
z.error_msgs_t = {}; -- blank the error messages list
OCinSoutput = nil; -- blank the metadata string
text = ''; -- blank the the citation
utilities.set_message ('err_empty_citation'); -- set empty citation message and category
end
local render_t = {}; -- here we collect the final bits for concatenation into the rendered citation
if is_preview_mode and (0 ~= #z.error_msgs_t or 0 ~= #z.maint_cats_t) then -- when in preview mode
if not utilities.is_set (options_t.id) then -- and when this template has not created an anchor ID
math.randomseed (tonumber (mw.getLanguage ('en'):formatDate ('U')) * 10000 + os.clock() * 10000);
options_t.id = 'CITEREF_temp_preview_id_' .. math.random (100000, 999999); -- create temporary anchor ID for preview mode
end
end
if utilities.is_set (options_t.id) then -- here we wrap the rendered citation in <cite ...>...</cite> tags
options_t.id = mw.uri.anchorEncode(options_t.id); -- do this here; also used when adding preview warning messages
table.insert (render_t, utilities.substitute (cfg.presentation['cite-id'], {options_t.id, mw.text.nowiki(options_t.class), text})); -- when |ref= is set or when there is a namelist
else
table.insert (render_t, utilities.substitute (cfg.presentation['cite'], {mw.text.nowiki(options_t.class), text})); -- when |ref=none or when namelist_t empty and |ref= is missing or is empty
end
if OCinSoutput then -- blanked when citation is 'empty' so don't bother to add boilerplate metadata span
table.insert (render_t, utilities.substitute (cfg.presentation['ocins'], OCinSoutput)); -- format and append metadata to the citation
end
local template_name = cfg.citation_class_map_t[config.CitationClass];
local template_link = '[[Template:' .. template_name .. '|' .. template_name .. ']]';
local msg_prefix = '<code class="cs1-code">{{' .. template_link .. '}}</code>: ';
if 0 ~= #z.error_msgs_t then
mw.addWarning (utilities.substitute (cfg.messages.warning_msg_e, {template_link, options_t.id}));
table.insert (render_t, ' '); -- insert a space between citation and its error messages
table.sort (z.error_msgs_t); -- sort the error messages list; sorting includes wrapping <span> and <code> tags; hidden-error sorts ahead of visible-error
local hidden = true; -- presume that the only error messages emited by this template are hidden
for _, v in ipairs (z.error_msgs_t) do -- spin through the list of error messages
if v:find ('cs1-visible-error', 1, true) then -- look for the visible error class name
hidden = false; -- found one; so don't hide the error message prefix
break; -- and done because no need to look further
end
end
z.error_msgs_t[1] = table.concat ({utilities.error_comment (msg_prefix, hidden), z.error_msgs_t[1]}); -- add error message prefix to first error message to prevent extraneous punctuation
table.insert (render_t, table.concat (z.error_msgs_t, '; ')); -- make a big string of error messages and add it to the rendering
end
if 0 ~= #z.maint_cats_t then
mw.addWarning (utilities.substitute (cfg.messages.warning_msg_m, {template_link, options_t.id}));
table.sort (z.maint_cats_t); -- sort the maintenance messages list
local maint_msgs_t = {}; -- here we collect all of the maint messages
if 0 == #z.error_msgs_t then -- if no error messages
table.insert (maint_msgs_t, msg_prefix); -- insert message prefix in maint message livery
end
for _, v in ipairs( z.maint_cats_t ) do -- append maintenance categories
table.insert (maint_msgs_t, -- assemble new maint message and add it to the maint_msgs_t table
table.concat ({v, ' (', utilities.substitute (cfg.messages[':cat wikilink'], v), ')'})
);
end
table.insert (render_t, utilities.substitute (cfg.presentation['hidden-maint'], table.concat (maint_msgs_t, ' '))); -- wrap the group of maint messages with proper presentation and save
end
if not no_tracking_cats then
local sort_key;
local cat_wikilink = 'cat wikilink';
if cfg.enable_sort_keys then -- when namespace sort keys enabled
local namespace_number = mw.title.getCurrentTitle().namespace; -- get namespace number for this wikitext
sort_key = (0 ~= namespace_number and (cfg.name_space_sort_keys[namespace_number] or cfg.name_space_sort_keys.other)) or nil; -- get sort key character; nil for mainspace
cat_wikilink = (not sort_key and 'cat wikilink') or 'cat wikilink sk'; -- make <cfg.messages> key
end
for _, v in ipairs (z.error_cats_t) do -- append error categories
table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));
end
if cfg.id_limits_data_load_fail then -- boolean true when load failed
utilities.set_message ('maint_id_limit_load_fail'); -- done here because this maint cat emits no message
end
for _, v in ipairs (z.maint_cats_t) do -- append maintenance categories
table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));
end
for _, v in ipairs (z.prop_cats_t) do -- append properties categories
table.insert (render_t, utilities.substitute (cfg.messages['cat wikilink'], v)); -- no sort keys
end
end
return table.concat (render_t); -- make a big string and done
end
--[[--------------------------< V A L I D A T E >--------------------------------------------------------------
Looks for a parameter's name in one of several whitelists.
Parameters in the whitelist can have three values:
true - active, supported parameters
false - deprecated, supported parameters
nil - unsupported parameters
]]
local function validate (name, cite_class, empty)
local enum_name; -- parameter name with enumerator (if any) replaced with '#'
local state;
local function state_test () -- local function to do testing of state values; operates on the upvalues <state> and <name>
if true == state then return true; end -- valid actively supported parameter
if false == state then
if empty then return nil; end -- empty deprecated parameters are treated as unknowns
deprecated_parameter (name); -- parameter is deprecated but still supported
return true;
end
if 'tracked' == state then
local base_name = name:gsub ('%d', ''); -- strip enumerators from parameter names that have them to get the base name
utilities.add_prop_cat ('tracked-param', {base_name}, base_name); -- add a properties category; <base_name> modifies <key>
return true;
end
return nil;
end
if 'string' ~= type (name) or name:find ('#') then -- # is a cs1|2 reserved character so parameters with # not permitted; positional params are 'number' type; not supported
return nil;
end
-- replace enumerator digit(s) with # (|last25= becomes |last#=) (mw.ustring because non-Western 'local' digits)
enum_name = mw.ustring.gsub (name, '%d+$', '#'); -- where enumerator is last charaters in parameter name (these to protect |s2cid=)
enum_name = mw.ustring.gsub (enum_name, '%d+([%-l])', '#%1'); -- where enumerator is in the middle of the parameter name; |author#link= is the oddity
if 'document' == cite_class then -- special case for {{cite document}}
state = whitelist.document_parameters_t[enum_name]; -- this list holds enumerated and nonenumerated parameters
if true == state_test () then return true; end
return false;
end
if utilities.in_array (cite_class, whitelist.preprint_template_list_t) then -- limited parameter sets allowed for these templates
state = whitelist.limited_parameters_t[enum_name]; -- this list holds enumerated and nonenumerated parameters
if true == state_test () then return true; end
state = whitelist.preprint_arguments_t[cite_class][name]; -- look in the parameter-list for the template identified by cite_class
if true == state_test () then return true; end
return false; -- not supported because not found or name is set to nil
end -- end limited parameter-set templates
if utilities.in_array (cite_class, whitelist.unique_param_template_list_t) then -- template-specific parameters for templates that accept parameters from the basic argument list
state = whitelist.unique_arguments_t[cite_class][name]; -- look in the template-specific parameter-lists for the template identified by cite_class
if true == state_test () then return true; end
end -- if here, fall into general validation
state = whitelist.common_parameters_t[enum_name]; -- all other templates; all normal parameters allowed; this list holds enumerated and nonenumerated parameters
if true == state_test () then return true; end
return false; -- not supported because not found or name is set to nil
end
--[=[-------------------------< I N T E R _ W I K I _ C H E C K >----------------------------------------------
check <value> for inter-language interwiki-link markup. <prefix> must be a MediaWiki-recognized language
code. when these values have the form (without leading colon):
[[<prefix>:link|label]] return label as plain-text
[[<prefix>:link]] return <prefix>:link as plain-text
return value as is else
]=]
local function inter_wiki_check (parameter, value)
local prefix = value:match ('%[%[(%a+):'); -- get an interwiki prefix if one exists
local _;
if prefix and cfg.inter_wiki_map[prefix:lower()] then -- if prefix is in the map, needs preceding colon so
utilities.set_message ('err_bad_paramlink', parameter); -- emit an error message
_, value, _ = utilities.is_wikilink (value); -- extract label portion from wikilink
end
return value;
end
--[[--------------------------< M I S S I N G _ P I P E _ C H E C K >------------------------------------------
Look at the contents of a parameter. If the content has a string of characters and digits followed by an equal
sign, compare the alphanumeric string to the list of cs1|2 parameters. If found, then the string is possibly a
parameter that is missing its pipe. There are two tests made:
{{cite ... |title=Title access-date=2016-03-17}} -- the first parameter has a value and whitespace separates that value from the missing pipe parameter name
{{cite ... |title=access-date=2016-03-17}} -- the first parameter has no value (whitespace after the first = is trimmed by MediaWiki)
cs1|2 shares some parameter names with XML/HTML attributes: class=, title=, etc. To prevent false positives XML/HTML
tags are removed before the search.
If a missing pipe is detected, this function adds the missing pipe maintenance category.
]]
local function missing_pipe_check (parameter, value)
local capture;
value = value:gsub ('%b<>', ''); -- remove XML/HTML tags because attributes: class=, title=, etc.
capture = value:match ('%s+(%a[%w%-]+)%s*=') or value:match ('^(%a[%w%-]+)%s*='); -- find and categorize parameters with possible missing pipes
if capture and validate (capture) then -- if the capture is a valid parameter name
utilities.set_message ('err_missing_pipe', parameter);
end
end
--[[--------------------------< H A S _ E X T R A N E O U S _ P U N C T >--------------------------------------
look for extraneous terminal punctuation in most parameter values; parameters listed in skip table are not checked
]]
local function has_extraneous_punc (param, value)
if 'number' == type (param) then
return;
end
param = param:gsub ('%d+', '#'); -- enumerated name-list mask params allow terminal punct; normalize
if cfg.punct_skip[param] then
return; -- parameter name found in the skip table so done
end
if value:match ('[,;:]$') then
utilities.set_message ('maint_extra_punct'); -- has extraneous punctuation; add maint cat
end
if value:match ('^=') then -- sometimes an extraneous '=' character appears ...
utilities.set_message ('maint_extra_punct'); -- has extraneous punctuation; add maint cat
end
end
--[[--------------------------< H A S _ T W L _ U R L >--------------------------------------------------------
look for The Wikipedia Library urls in url-holding parameters. TWL urls are accessible only for readers who are
active extended confirmed Wikipedia editors. This function sets an error message when such urls are discovered
and when appropriate, sets the |<param>-url-access=subscription. returns nothing.
looks for: '.wikipedialibrary.idm.oclc.org'
]]
local function has_twl_url (url_params_t, cite_args_t)
local url_error_t = {}; -- sequence of url-holding parameters that have a TWL url
for param, value in pairs (url_params_t) do
if value:find ('%.wikipedialibrary%.idm%.oclc%.org') then -- has the TWL base url?
table.insert (url_error_t, param); -- add parameter name to the error list
end
end
if 0 ~= #url_error_t then -- non-zero when there are errors
table.sort (url_error_t); -- sor for error messaging
for i, param in ipairs (url_error_t) do
if cfg.url_access_map_t[param] then -- if <param> has a matching -access parameter
cite_args_t[cfg.url_access_map_t[param]] = cfg.keywords_xlate.subscription; -- set |<param>-url-access=subscription
end
url_error_t[i] = utilities.wrap_style ('parameter', param); -- make the parameter pretty for error message
end
utilities.set_message ('err_param_has_twl_url', {utilities.make_sep_list (#url_error_t, url_error_t)}); -- add this error message
end
end
--[[--------------------------< M I S C _ U R L _ D E T E C T >------------------------------------------------
look for miscellaneous urls that might be converted to, or are duplicates of, identifiers.
]]
local misc_url_patterns_t = {
'idm%.oclc%.org', -- but not wikipedialibrary.idm.oclc.org; has_twl_url()
'https?://citeseerx?%.ist%.psu%.edu/', -- simplified so we catch all citeseer and citeseerx urls except ~/document/... (the 'new' form)
}
local ignore_patterns_t = {
'wikipedialibrary.idm.oclc.org', -- handled by has_twl_url()
'https?://citeseerx?%.ist%.psu%.edu/document', -- 'new'-form citeseerx urls that mostly work; ignore for now
}
local function misc_url_detect (url_params_t)
local ignore_flag = false;
for _, value in pairs (url_params_t) do
for _, ignore_pattern in ipairs (ignore_patterns_t) do
if value:find (ignore_pattern) then -- matches this ignore_pattern?
ignore_flag = true; -- found a pattern to ignore
break; --
end
end
if not ignore_flag then -- if ignore_flag is set then don't bother to test this url <value>
for _, misc_pattern in ipairs (misc_url_patterns_t) do
if value:find (misc_pattern) then -- matches this misc_pattern?
utilities.set_message ('maint_misc_url'); -- found one; set the message
return; -- and done; no need to test other <value>s
end
end
end
ignore_flag = false; -- reset
end
end
--[[--------------------------< H A S _ E X T R A N E O U S _ U R L >------------------------------------------
look for extraneous url parameter values; parameters listed in skip table are not checked
]]
local function has_extraneous_url (non_url_param_t)
local url_error_t = {};
check_for_url (non_url_param_t, url_error_t); -- extraneous url check
if 0 ~= #url_error_t then -- non-zero when there are errors
table.sort (url_error_t);
utilities.set_message ('err_param_has_ext_link', {utilities.make_sep_list (#url_error_t, url_error_t)}); -- add this error message
end
end
--[[--------------------------< _ C I T A T I O N >------------------------------------------------------------
Module entry point
frame – from template call (citation()); may be nil when called from another module
args_t – table of all cs1|2 parameters in the template (the parent frame)
config_t – table of template-supplied parameter (the #invoke frame)
]]
local function _citation (frame, args_t, config_t) -- save a copy in case we need to display an error message in preview mode
if not frame then
frame = mw.getCurrentFrame(); -- if called from another module, get a frame for frame-provided functions
end
-- i18n: set the name that your wiki uses to identify sandbox subpages from sandbox template invoke (or can be set here)
local sandbox = ((config_t.SandboxPath and '' ~= config_t.SandboxPath) and config_t.SandboxPath) or '/sandbox'; -- sandbox path from {{#invoke:Citation/CS1/sandbox|citation|SandboxPath=/...}}
is_sandbox = nil ~= string.find (frame:getTitle(), sandbox, 1, true); -- is this invoke the sandbox module?
sandbox = is_sandbox and sandbox or ''; -- use i18n sandbox to load sandbox modules when this module is the sandox; live modules else
cfg = mw.loadData ('Module:Citation/CS1/Configuration' .. sandbox); -- load sandbox versions of support modules when {{#invoke:Citation/CS1/sandbox|...}}; live modules else
whitelist = mw.loadData ('Module:Citation/CS1/Whitelist' .. sandbox);
utilities = require ('Module:Citation/CS1/Utilities' .. sandbox);
validation = require ('Module:Citation/CS1/Date_validation' .. sandbox);
identifiers = require ('Module:Citation/CS1/Identifiers' .. sandbox);
metadata = require ('Module:Citation/CS1/COinS' .. sandbox);
utilities.set_selected_modules (cfg); -- so that functions in Utilities can see the selected cfg tables
identifiers.set_selected_modules (cfg, utilities); -- so that functions in Identifiers can see the selected cfg tables and selected Utilities module
validation.set_selected_modules (cfg, utilities); -- so that functions in Date validataion can see selected cfg tables and the selected Utilities module
metadata.set_selected_modules (cfg, utilities); -- so that functions in COinS can see the selected cfg tables and selected Utilities module
z = utilities.z; -- table of error and category tables in Module:Citation/CS1/Utilities
local cite_args_t = {}; -- because args_t is the parent (template) frame args (which cannot be modified); params and their values will be placed here
is_preview_mode = not utilities.is_set (frame:preprocess ('{{REVISIONID}}'));
local suggestions = {}; -- table where we store suggestions if we need to loadData them
local error_text; -- used as a flag
local capture; -- the single supported capture when matching unknown parameters using patterns
local empty_unknowns = {}; -- sequence table to hold empty unknown params for error message listing
for k, v in pairs (args_t) do -- get parameters from the parent (template) frame
v = mw.ustring.gsub (v, '^%s*(.-)%s*$', '%1'); -- trim leading/trailing whitespace; when v is only whitespace, becomes empty string
if v ~= '' then
if cfg.enum_needs_xlation and 'string' == type (k) then -- for wikis that set date_names['local_digits'] to non-western digits
k = mw.ustring.gsub (k, '%d', cfg.date_names.local_digits); -- translate 'local' digits enumerators to Western 0-9
end
if not validate( k, config_t.CitationClass ) then
if type (k) ~= 'string' then -- exclude empty numbered parameters
if v:match("%S+") ~= nil then
error_text = utilities.set_message ('err_text_ignored', {v});
end
elseif validate (k:lower(), config_t.CitationClass) then
error_text = utilities.set_message ('err_parameter_ignored_suggest', {k, k:lower()}); -- suggest the lowercase version of the parameter
else
if nil == suggestions.suggestions then -- if this table is nil then we need to load it
suggestions = mw.loadData ('Module:Citation/CS1/Suggestions' .. sandbox); --load sandbox version of suggestion module when {{#invoke:Citation/CS1/sandbox|...}}; live module else
end
for pattern, param in pairs (suggestions.patterns) do -- loop through the patterns to see if we can suggest a proper parameter
capture = k:match (pattern); -- the whole match if no capture in pattern else the capture if a match
if capture then -- if the pattern matches
param = utilities.substitute (param, capture); -- add the capture to the suggested parameter (typically the enumerator)
if validate (param, config_t.CitationClass) then -- validate the suggestion to make sure that the suggestion is supported by this template (necessary for limited parameter lists)
error_text = utilities.set_message ('err_parameter_ignored_suggest', {k, param}); -- set the suggestion error message
else
error_text = utilities.set_message ('err_parameter_ignored', {k}); -- suggested param not supported by this template
v = ''; -- unset
end
end
end
if not utilities.is_set (error_text) then -- couldn't match with a pattern, is there an explicit suggestion?
if (suggestions.suggestions[ k:lower() ] ~= nil) and validate (suggestions.suggestions[ k:lower() ], config_t.CitationClass) then
utilities.set_message ('err_parameter_ignored_suggest', {k, suggestions.suggestions[ k:lower() ]});
else
utilities.set_message ('err_parameter_ignored', {k});
v = ''; -- unset value assigned to unrecognized parameters (this for the limited parameter lists)
end
end
end
end
cite_args_t[k] = v; -- save this parameter and its value
elseif not utilities.is_set (v) then -- for empty parameters
if not validate (k, config_t.CitationClass, true) then -- is this empty parameter a valid parameter
k = ('' == k) and cfg.err_msg_supl.empty_str or k; -- when k is empty string (or was space(s) trimmed to empty string), replace with descriptive text
table.insert (empty_unknowns, utilities.wrap_style ('parameter', k)); -- format for error message and add to the list
end
end
end
if 0 ~= #empty_unknowns then -- create empty unknown error message
utilities.set_message ('err_param_unknown_empty', {
1 == #empty_unknowns and '' or 's',
utilities.make_sep_list (#empty_unknowns, empty_unknowns)
});
end
local non_url_param_t = {}; -- table of parameters and values that are not url-holding parameters
local url_param_t = {}; -- table of url-holding paramters and their values
for k, v in pairs (cite_args_t) do
if 'string' == type (k) then -- don't evaluate positional parameters
has_invisible_chars (k, v); -- look for invisible characters
end
has_extraneous_punc (k, v); -- look for extraneous terminal punctuation in parameter values
missing_pipe_check (k, v); -- do we think that there is a parameter that is missing a pipe?
cite_args_t[k] = inter_wiki_check (k, v); -- when language interwiki-linked parameter missing leading colon replace with wiki-link label
if 'string' == type (k) then -- when parameter k is not positional
if not cfg.url_skip[k] then -- and not in url skip table
non_url_param_t[k] = v; -- make a parameter/value list for extraneous url check
else -- and is in url skip table (a url-holding parameter)
url_param_t[k] = v; -- make a parameter/value list to check for values that are The Wikipedia Library url
end
end
end
if cfg.suppress_archive_today_urls then
has_archive_today_url (cite_args_t); -- look for and suppress archive.today urls and dependent parameters for all templates
end
has_extraneous_url (non_url_param_t); -- look for url in parameter values where a url does not belong
has_twl_url (url_param_t, cite_args_t); -- look for url-holding parameters that hold a The Wikipedia Library url
misc_url_detect (url_param_t); -- look for url-holding parameters that hold certain miscellaneous urls
return table.concat ({
frame:extensionTag ('templatestyles', '', {src='Module:Citation/CS1' .. sandbox .. '/styles.css'}),
citation0 (config_t, cite_args_t)
});
end
--[[--------------------------< C I T A T I O N >--------------------------------------------------------------
Template entry point
]]
local function citation (frame)
local config_t = {}; -- table to store parameters from the module {{#invoke:}}
local args_t = frame:getParent().args; -- get template's preset parameters
for k, v in pairs (frame.args) do -- get parameters from the {{#invoke}} frame
config_t[k] = v;
-- args_t[k] = v; -- crude debug support that allows us to render a citation from module {{#invoke:}}; skips parameter validation; TODO: keep?
end
return _citation (frame, args_t, config_t)
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
citation = citation, -- template entry point
_citation = _citation, -- module entry point
}
mzkfjlhyhvftcb93lj0ik7zu7t1myhw
Módulo:Hatnote/styles.css
828
7509
75002
71315
2026-08-09T16:48:05Z
en>Izno
0
Parsoid is now the one true parser
75002
sanitized-css
text/css
/* {{pp|small=y}} */
.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;
}
/* Templatestyles causes an 'empty' span between hatnotes.
* See also [[phab:T200206]] for later */
.hatnote + .mw-empty-elt + .hatnote {
margin-top: -0.5em;
}
@media print {
body.ns-0 .hatnote {
display: none !important;
}
}
kcpl5b33dm6ymty930mbmszl720l5oi
75003
75002
2026-08-24T00:44:40Z
Robertsky
10424
1 versaun husi [[:en:Module:Hatnote/styles.css]]
75002
sanitized-css
text/css
/* {{pp|small=y}} */
.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;
}
/* Templatestyles causes an 'empty' span between hatnotes.
* See also [[phab:T200206]] for later */
.hatnote + .mw-empty-elt + .hatnote {
margin-top: -0.5em;
}
@media print {
body.ns-0 .hatnote {
display: none !important;
}
}
kcpl5b33dm6ymty930mbmszl720l5oi
Template:Documentation subpage
10
7524
74782
71363
2026-07-26T21:53:49Z
en>Jlwoodwa
0
[[mw:Help:Magic words#EXPECTED_UNCONNECTED_PAGE|__EXPECTED_UNCONNECTED_PAGE__]]
74782
wikitext
text/x-wiki
<includeonly><!--
-->{{#ifeq:{{lc:{{SUBPAGENAME}}}} |{{{override|doc}}}
| <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->
</includeonly><!--
-->{{#ifeq:{{{doc-notice|show}}} |show
| {{Mbox
| type = notice
| style = margin-bottom:1.0em;
| image = [[File:Edit-copy green.svg|40px|alt=icon]]
| text =
{{strong|This is a [[Wikipedia:Template documentation|documentation subpage]]}} for {{terminate sentence|{{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}}}<br />It may contain usage information, [[Wikipedia:Categorization|categories]] and other content that is not part of the original {{#if:{{{text2|}}} |{{{text2}}} |{{#if:{{{text1|}}} |{{{text1}}} |{{#ifeq:{{SUBJECTSPACE}} |{{ns:User}} |{{lc:{{SUBJECTSPACE}}}} template page |{{#if:{{SUBJECTSPACE}} |{{lc:{{SUBJECTSPACE}}}} page|article}}}}}}}}.
}}
}}<!--
-->{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}<!--
--><includeonly>__EXPECTED_UNCONNECTED_PAGE__</includeonly><!--
-->{{#if:{{{nocat|}}}{{{inhibit|}}}|<!--(don't categorize)-->
|<includeonly><!--
-->{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}}
| [[Category:{{#switch:{{SUBJECTSPACE}} |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
| [[Category:Documentation subpages without corresponding pages]]
}}<!--
--></includeonly>
}}<!--
(completing initial #ifeq: at start of template:)
--><includeonly>
| <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
}}<!--
--></includeonly><noinclude>{{Documentation}}</noinclude>
iwz7dreef73y68fx96yxyj3ry6l1x58
74783
74782
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Template:Documentation_subpage]]
74782
wikitext
text/x-wiki
<includeonly><!--
-->{{#ifeq:{{lc:{{SUBPAGENAME}}}} |{{{override|doc}}}
| <!--(this template has been transcluded on a /doc or /{{{override}}} page)-->
</includeonly><!--
-->{{#ifeq:{{{doc-notice|show}}} |show
| {{Mbox
| type = notice
| style = margin-bottom:1.0em;
| image = [[File:Edit-copy green.svg|40px|alt=icon]]
| text =
{{strong|This is a [[Wikipedia:Template documentation|documentation subpage]]}} for {{terminate sentence|{{{1|[[:{{SUBJECTSPACE}}:{{BASEPAGENAME}}]]}}}}}<br />It may contain usage information, [[Wikipedia:Categorization|categories]] and other content that is not part of the original {{#if:{{{text2|}}} |{{{text2}}} |{{#if:{{{text1|}}} |{{{text1}}} |{{#ifeq:{{SUBJECTSPACE}} |{{ns:User}} |{{lc:{{SUBJECTSPACE}}}} template page |{{#if:{{SUBJECTSPACE}} |{{lc:{{SUBJECTSPACE}}}} page|article}}}}}}}}.
}}
}}<!--
-->{{DEFAULTSORT:{{{defaultsort|{{PAGENAME}}}}}}}<!--
--><includeonly>__EXPECTED_UNCONNECTED_PAGE__</includeonly><!--
-->{{#if:{{{nocat|}}}{{{inhibit|}}}|<!--(don't categorize)-->
|<includeonly><!--
-->{{#ifexist:{{NAMESPACE}}:{{BASEPAGENAME}}
| [[Category:{{#switch:{{SUBJECTSPACE}} |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]]
| [[Category:Documentation subpages without corresponding pages]]
}}<!--
--></includeonly>
}}<!--
(completing initial #ifeq: at start of template:)
--><includeonly>
| <!--(this template has not been transcluded on a /doc or /{{{override}}} page)-->
}}<!--
--></includeonly><noinclude>{{Documentation}}</noinclude>
iwz7dreef73y68fx96yxyj3ry6l1x58
Módulo:High-use
828
7530
74786
71375
2026-07-30T21:52:39Z
en>Andrybak
0
Set `approx_num_total_pages = 66000000` (66 million). [[Special:Statistics]] shows 65,988,696 right now. We don't need a lot of precision here. Next update can be at 67 million.
74786
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local _fetch = require('Module:Transclusion_count')._fetch -- _fetch looks at the 'demo' argument
local yesno = require('Module:Yesno')
local lang_obj = mw.getContentLanguage() -- this here because the language object is used multiple places in the module
local large_count_cutoff = 100000
local approx_num_total_pages = 66000000
local user_subpage_info_page = 'Wikipedia:User pages#SUB'
local sandbox_module_page = 'Module:Sandbox'
local system_messages_cat = 'Pages used in system messages needing protection'
local sandbox_word = 'sandbox'
local testcases_word = 'testcases'
local doc_word = 'doc'
local function count_from_args(args)
if tonumber(args.count) then -- check if function has already been used
return tonumber(args.count) -- early exit if so
end
local count
if yesno(args['fetch']) ~= false then
count = _fetch(args) -- fetch transclusion count
end
-- use explicitly-provided count when fetch fails
if count == nil and args[1] ~= nil and args[1] ~= '' then
-- convert local language number string to a number understandable by Lua
count = mw.ustring.gsub(args[1], '+$', '')
count = lang_obj:parseFormattedNumber(args[1])
end
-- in case someone writes a non-positive number
if count and count > 0 then
return count
end
return nil
end
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
local function risk_boolean(args)
if args.risk == true or args.risk == false then
return args.risk
elseif args[1] == 'risk' then
return true
else
local count = count_from_args(args)
if count and count >= large_count_cutoff then
return true
end
end
return false
end
-- function retained for backwards compatibility
function p._risk(args)
return risk_boolean(args) and 'risk' or ''
end
-- function retained for backwards compatibility
function p.risk(frame)
return p._risk(getArgs(frame))
end
-- count and no_percent arguments retained for backwards compatibility
function p._num(args, count, no_percent)
if count == nil then
count = count_from_args(args)
end
args.count = count
args.risk = risk_boolean(args)
-- Build output string
local return_value = ''
if args.count == nil and args.risk then
return 'a very large number of'
elseif args.count == nil then
return 'many'
else
-- Use 2 significant figures for smaller numbers and 3 for larger ones
local sigfig = 2
if args.count >= large_count_cutoff then
sigfig = 3
end
-- Prepare to round to appropriate number of sigfigs
local f = math.floor(math.log10(args.count)) - sigfig + 1
-- Round and insert 'approximately' or '+' when appropriate
if yesno(args[2]) == true or (type(args[1]) == 'string' and (mw.ustring.sub(args[1], -1) == '+')) then
-- Round down
return_value = string.format('%s+', lang_obj:formatNum(math.floor( (args.count / 10^(f)) ) * (10^(f))) )
else
-- Round to nearest
return_value = string.format('approximately %s', lang_obj:formatNum(math.floor( (args.count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes
no_percent = yesno(no_percent or args['no-percent'])
if args.count and args.count >= approx_num_total_pages/100 and not no_percent then
local num_total_pages = mw.getCurrentFrame():callParserFunction('NUMBEROFPAGES', 'R')
local total_percent = math.floor( ( ( args.count/num_total_pages ) * 100) + 0.5)
if total_percent >= 1 then
return_value = string.format('%s pages, or roughly %s%% of all', return_value, total_percent)
end
end
end
return return_value
end
-- used by [[Template:Stub documentation]] and other pages
-- count argument retained for backwards compatibility
function p.num(frame, count)
return p._num(getArgs(frame), count)
end
-- count argument retained for backwards compatibility
function p._text(args, count)
--[=[
Only show the information about how this template gets updated
if someone is actually editing the page and maybe trying to update the count.
]=]
local bot_text = (mw.getCurrentFrame():preprocess('{{REVISIONID}}') == '') and ("\n\n----\n'''Preview message''':" .. ' Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]]).') or ''
if count == nil then
count = count_from_args(args)
end
args.count = count
args.risk = risk_boolean(args)
-- trim /doc, /sandbox and /testcases
local title = args.title or (args.demo and args.demo ~= '' and mw.title.new(args.demo, 'Template')) or mw.title.getCurrentTitle()
if title.subpageText == doc_word or title.subpageText == sandbox_word or title.subpageText == testcases_word then
title = title.basePageTitle
end
-- use /testcases of base template
local testcases_page = mw.title.new(title.prefixedText .. '/' .. testcases_word)
-- exists is expensive
while testcases_page.basePageTitle.isSubpage and not testcases_page.exists do
testcases_page = mw.title.new(testcases_page.basePageTitle.basePageTitle.prefixedText .. '/' .. testcases_word)
end
local systemMessages = (args['system'] or '') ~= ''
-- This retrieves the project URL automatically to simplify localization.
local templateCount = ('on [https://linkcount.toolforge.org/?project=%s&page=%s#transclusions %s pages]'):format(
title:fullUrl():gsub('//(.-)/.*', '%1'),
mw.uri.encode(title.fullText), p._num(args))
local used_on_text = "'''This " .. (title:inNamespace('Module') and 'Lua module' or 'template') .. ' is used '
if systemMessages then
used_on_text = used_on_text .. args['system'] ..
((args.count and args.count > 2000) and ("''', and " .. templateCount) or ("'''"))
else
used_on_text = used_on_text .. templateCount .. "'''"
end
local sandbox_text = ('%s\'s [[%s/sandbox|/sandbox]] or [[%s|/testcases]] subpages, or in your own [[%s]]. '):format(
title:inNamespace('Module') and 'module' or 'template',
title.fullText,
testcases_page.fullText,
title:inNamespace('Module') and (sandbox_module_page .. '|module sandbox') or (user_subpage_info_page .. '|user subpage')
)
local infoArg = args['info'] ~= '' and args['info']
if (systemMessages or args.risk) then
local info = '.'
if systemMessages then
info = info .. '<br />Changes to it can cause immediate changes to the ' .. mw.site.namespaces.Project.name .. ' user interface.'
end
if infoArg then
info = info .. '<br />' .. infoArg
end
sandbox_text = info .. '<br /> To avoid major disruption' ..
(args.count and args.count >= large_count_cutoff and ' and server load' or '') .. -- should this use args.risk?
', any changes should be tested in the ' .. sandbox_text ..
'The tested changes can be added to this page in a single edit. '
else
sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') ..
'hanges may be widely noticed. Test changes in the ' .. sandbox_text
end
local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '
if args[2] ~= nil and args[2] ~= '' and yesno(args[2]) == nil then
discussion_text = string.format('%sat [[%s]]', discussion_text, args[2])
else
discussion_text = string.format('%son the [[%s|talk page]]', discussion_text, title.talkPageTitle.fullText)
end
return used_on_text .. sandbox_text .. discussion_text .. ' before implementing them.' .. bot_text
end
-- used by [[Template:R from high-use template]]
-- count argument retained for backwards compatibility
function p.text(frame, count)
return p._text(getArgs(frame), count)
end
-- nocat argument retained for backwards compatibility
function p._main(args, nocat)
args.count = count_from_args(args)
args.risk = risk_boolean(args)
args.title = (args.demo and args.demo ~= '' and mw.title.new(args.demo, 'Template')) or mw.title.getCurrentTitle()
local image = 'Ambox warning yellow.svg'
local type_param = 'style'
local epilogue = ''
if args['system'] and args['system'] ~= '' then
image = 'Ambox important.svg'
type_param = 'content'
if yesno(nocat or args['nocat']) ~= true and not args.title.isRedirect then
local protection_action = (args.title:inNamespace('File') and 'upload') or 'edit'
local protection_level = require('Module:Effective protection level')._main(protection_action, args.title.fullText)
if protection_level ~= 'sysop' and protection_level ~= 'templateeditor' and protection_level ~= 'interfaceadmin' then
epilogue = mw.getCurrentFrame():expandTemplate {
title = 'sandbox other',
args = {
[2] = '[[Category:' .. system_messages_cat .. ']]'
}
}
end
end
elseif args.risk then
image = 'Ambox warning orange.svg'
type_param = 'content'
end
image = '[[File:' .. image .. '|40px|alt=Warning|link=]]'
if args['form'] == 'editnotice' then
return mw.getCurrentFrame():expandTemplate{
title = 'editnotice',
args = {
['image'] = image,
['text'] = p._text(args),
['expiry'] = (args['expiry'] or '')
}
} .. epilogue
else
return require('Module:Message box').main('ombox', {
type = type_param,
image = image,
text = p._text(args),
expiry = (args['expiry'] or '')
}) .. epilogue
end
end
function p.main(frame)
return p._main(getArgs(frame))
end
return p
qkt57qdst1ol2kbo88d4jxkr0ibiuy4
74787
74786
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Module:High-use]]
74786
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local _fetch = require('Module:Transclusion_count')._fetch -- _fetch looks at the 'demo' argument
local yesno = require('Module:Yesno')
local lang_obj = mw.getContentLanguage() -- this here because the language object is used multiple places in the module
local large_count_cutoff = 100000
local approx_num_total_pages = 66000000
local user_subpage_info_page = 'Wikipedia:User pages#SUB'
local sandbox_module_page = 'Module:Sandbox'
local system_messages_cat = 'Pages used in system messages needing protection'
local sandbox_word = 'sandbox'
local testcases_word = 'testcases'
local doc_word = 'doc'
local function count_from_args(args)
if tonumber(args.count) then -- check if function has already been used
return tonumber(args.count) -- early exit if so
end
local count
if yesno(args['fetch']) ~= false then
count = _fetch(args) -- fetch transclusion count
end
-- use explicitly-provided count when fetch fails
if count == nil and args[1] ~= nil and args[1] ~= '' then
-- convert local language number string to a number understandable by Lua
count = mw.ustring.gsub(args[1], '+$', '')
count = lang_obj:parseFormattedNumber(args[1])
end
-- in case someone writes a non-positive number
if count and count > 0 then
return count
end
return nil
end
-- Actions if there is a large (greater than or equal to 100,000) transclusion count
local function risk_boolean(args)
if args.risk == true or args.risk == false then
return args.risk
elseif args[1] == 'risk' then
return true
else
local count = count_from_args(args)
if count and count >= large_count_cutoff then
return true
end
end
return false
end
-- function retained for backwards compatibility
function p._risk(args)
return risk_boolean(args) and 'risk' or ''
end
-- function retained for backwards compatibility
function p.risk(frame)
return p._risk(getArgs(frame))
end
-- count and no_percent arguments retained for backwards compatibility
function p._num(args, count, no_percent)
if count == nil then
count = count_from_args(args)
end
args.count = count
args.risk = risk_boolean(args)
-- Build output string
local return_value = ''
if args.count == nil and args.risk then
return 'a very large number of'
elseif args.count == nil then
return 'many'
else
-- Use 2 significant figures for smaller numbers and 3 for larger ones
local sigfig = 2
if args.count >= large_count_cutoff then
sigfig = 3
end
-- Prepare to round to appropriate number of sigfigs
local f = math.floor(math.log10(args.count)) - sigfig + 1
-- Round and insert 'approximately' or '+' when appropriate
if yesno(args[2]) == true or (type(args[1]) == 'string' and (mw.ustring.sub(args[1], -1) == '+')) then
-- Round down
return_value = string.format('%s+', lang_obj:formatNum(math.floor( (args.count / 10^(f)) ) * (10^(f))) )
else
-- Round to nearest
return_value = string.format('approximately %s', lang_obj:formatNum(math.floor( (args.count / 10^(f)) + 0.5) * (10^(f))) )
end
-- Insert percentage of pages if that is likely to be >= 1% and when |no-percent= not set to yes
no_percent = yesno(no_percent or args['no-percent'])
if args.count and args.count >= approx_num_total_pages/100 and not no_percent then
local num_total_pages = mw.getCurrentFrame():callParserFunction('NUMBEROFPAGES', 'R')
local total_percent = math.floor( ( ( args.count/num_total_pages ) * 100) + 0.5)
if total_percent >= 1 then
return_value = string.format('%s pages, or roughly %s%% of all', return_value, total_percent)
end
end
end
return return_value
end
-- used by [[Template:Stub documentation]] and other pages
-- count argument retained for backwards compatibility
function p.num(frame, count)
return p._num(getArgs(frame), count)
end
-- count argument retained for backwards compatibility
function p._text(args, count)
--[=[
Only show the information about how this template gets updated
if someone is actually editing the page and maybe trying to update the count.
]=]
local bot_text = (mw.getCurrentFrame():preprocess('{{REVISIONID}}') == '') and ("\n\n----\n'''Preview message''':" .. ' Transclusion count updated automatically ([[Template:High-use/doc#Technical details|see documentation]]).') or ''
if count == nil then
count = count_from_args(args)
end
args.count = count
args.risk = risk_boolean(args)
-- trim /doc, /sandbox and /testcases
local title = args.title or (args.demo and args.demo ~= '' and mw.title.new(args.demo, 'Template')) or mw.title.getCurrentTitle()
if title.subpageText == doc_word or title.subpageText == sandbox_word or title.subpageText == testcases_word then
title = title.basePageTitle
end
-- use /testcases of base template
local testcases_page = mw.title.new(title.prefixedText .. '/' .. testcases_word)
-- exists is expensive
while testcases_page.basePageTitle.isSubpage and not testcases_page.exists do
testcases_page = mw.title.new(testcases_page.basePageTitle.basePageTitle.prefixedText .. '/' .. testcases_word)
end
local systemMessages = (args['system'] or '') ~= ''
-- This retrieves the project URL automatically to simplify localization.
local templateCount = ('on [https://linkcount.toolforge.org/?project=%s&page=%s#transclusions %s pages]'):format(
title:fullUrl():gsub('//(.-)/.*', '%1'),
mw.uri.encode(title.fullText), p._num(args))
local used_on_text = "'''This " .. (title:inNamespace('Module') and 'Lua module' or 'template') .. ' is used '
if systemMessages then
used_on_text = used_on_text .. args['system'] ..
((args.count and args.count > 2000) and ("''', and " .. templateCount) or ("'''"))
else
used_on_text = used_on_text .. templateCount .. "'''"
end
local sandbox_text = ('%s\'s [[%s/sandbox|/sandbox]] or [[%s|/testcases]] subpages, or in your own [[%s]]. '):format(
title:inNamespace('Module') and 'module' or 'template',
title.fullText,
testcases_page.fullText,
title:inNamespace('Module') and (sandbox_module_page .. '|module sandbox') or (user_subpage_info_page .. '|user subpage')
)
local infoArg = args['info'] ~= '' and args['info']
if (systemMessages or args.risk) then
local info = '.'
if systemMessages then
info = info .. '<br />Changes to it can cause immediate changes to the ' .. mw.site.namespaces.Project.name .. ' user interface.'
end
if infoArg then
info = info .. '<br />' .. infoArg
end
sandbox_text = info .. '<br /> To avoid major disruption' ..
(args.count and args.count >= large_count_cutoff and ' and server load' or '') .. -- should this use args.risk?
', any changes should be tested in the ' .. sandbox_text ..
'The tested changes can be added to this page in a single edit. '
else
sandbox_text = (infoArg and ('.<br />' .. infoArg .. ' C') or ' and c') ..
'hanges may be widely noticed. Test changes in the ' .. sandbox_text
end
local discussion_text = systemMessages and 'Please discuss changes ' or 'Consider discussing changes '
if args[2] ~= nil and args[2] ~= '' and yesno(args[2]) == nil then
discussion_text = string.format('%sat [[%s]]', discussion_text, args[2])
else
discussion_text = string.format('%son the [[%s|talk page]]', discussion_text, title.talkPageTitle.fullText)
end
return used_on_text .. sandbox_text .. discussion_text .. ' before implementing them.' .. bot_text
end
-- used by [[Template:R from high-use template]]
-- count argument retained for backwards compatibility
function p.text(frame, count)
return p._text(getArgs(frame), count)
end
-- nocat argument retained for backwards compatibility
function p._main(args, nocat)
args.count = count_from_args(args)
args.risk = risk_boolean(args)
args.title = (args.demo and args.demo ~= '' and mw.title.new(args.demo, 'Template')) or mw.title.getCurrentTitle()
local image = 'Ambox warning yellow.svg'
local type_param = 'style'
local epilogue = ''
if args['system'] and args['system'] ~= '' then
image = 'Ambox important.svg'
type_param = 'content'
if yesno(nocat or args['nocat']) ~= true and not args.title.isRedirect then
local protection_action = (args.title:inNamespace('File') and 'upload') or 'edit'
local protection_level = require('Module:Effective protection level')._main(protection_action, args.title.fullText)
if protection_level ~= 'sysop' and protection_level ~= 'templateeditor' and protection_level ~= 'interfaceadmin' then
epilogue = mw.getCurrentFrame():expandTemplate {
title = 'sandbox other',
args = {
[2] = '[[Category:' .. system_messages_cat .. ']]'
}
}
end
end
elseif args.risk then
image = 'Ambox warning orange.svg'
type_param = 'content'
end
image = '[[File:' .. image .. '|40px|alt=Warning|link=]]'
if args['form'] == 'editnotice' then
return mw.getCurrentFrame():expandTemplate{
title = 'editnotice',
args = {
['image'] = image,
['text'] = p._text(args),
['expiry'] = (args['expiry'] or '')
}
} .. epilogue
else
return require('Module:Message box').main('ombox', {
type = type_param,
image = image,
text = p._text(args),
expiry = (args['expiry'] or '')
}) .. epilogue
end
end
function p.main(frame)
return p._main(getArgs(frame))
end
return p
qkt57qdst1ol2kbo88d4jxkr0ibiuy4
Template:Lua
10
7535
74788
71385
2026-07-25T03:53:06Z
en>Zackmann08
0
[[Wikipedia:Templates for discussion/Log/2026 July 24#Template:Lua]] closed as Withdrawn ([[WP:XFDC#4.0.16|XFDcloser]])
71384
wikitext
text/x-wiki
<includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude>
{{Lua|Module:Lua banner}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
pnmjp3f3fl321yf2jpg5syebi412n7b
74789
74788
2026-08-24T00:15:11Z
Robertsky
10424
1 versaun husi [[:en:Template:Lua]]
71384
wikitext
text/x-wiki
<includeonly>{{#invoke:Lua banner|main}}</includeonly><noinclude>
{{Lua|Module:Lua banner}}
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
pnmjp3f3fl321yf2jpg5syebi412n7b
Módulo:Transclusion count/data/I
828
7540
74790
73728
2026-08-23T05:08:45Z
en>Ahechtbot
0
[[Wikipedia:BOT|Bot]]: Updated page.
74790
Scribunto
text/plain
return {
["IAST"] = 6300,
["IA_SCOTUS_URL"] = 3300,
["IBDB_name"] = 9800,
["ICD10"] = 5000,
["ICD9"] = 4400,
["ICS"] = 3500,
["ICS_flag"] = 3500,
["IDN"] = 3800,
["IMDb_episode"] = 11000,
["IMDb_episodes"] = 4200,
["IMDb_name"] = 173000,
["IMDb_title"] = 211000,
["IMO_Number"] = 4500,
["IMSLP"] = 9200,
["INA"] = 2400,
["IND"] = 8600,
["INR"] = 6500,
["INRConvert"] = 6700,
["INRConvert/CurrentRate"] = 6700,
["INRConvert/USD"] = 6600,
["INRConvert/out"] = 6700,
["IOBDB_name"] = 2100,
["IP"] = 2800,
["IPA"] = 182000,
["IPA_audio_link"] = 5100,
["IPA_link"] = 5100,
["IPAblink"] = 2600,
["IPAc-cmn"] = 2800,
["IPAc-en"] = 56000,
["IPAc-pl"] = 51000,
["IPSummary"] = 82000,
["IP_summary"] = 83000,
["IPtalk"] = 18000,
["IPuser"] = 7600,
["IPvandal"] = 2800,
["IRC"] = 7100,
["IRI"] = 2500,
["IRL"] = 6100,
["IRN"] = 4000,
["ISBN"] = 475000,
["ISBN?"] = 2500,
["ISBNT"] = 46000,
["ISBN_missing"] = 3200,
["ISFDB_name"] = 4300,
["ISFDB_title"] = 5100,
["ISL"] = 2300,
["ISO_15924/script-example-character"] = 3100,
["ISO_15924/wp-article"] = 3100,
["ISO_15924/wp-article/format"] = 3100,
["ISO_15924/wp-article/label"] = 3000,
["ISO_3166_code"] = 240000,
["ISO_3166_name"] = 16000,
["ISO_639_name"] = 28000,
["ISP"] = 3700,
["ISR"] = 5800,
["ISSN"] = 12000,
["ISSN_link"] = 33000,
["ISTAT"] = 8100,
["ISU_figure_skater"] = 2300,
["ITA"] = 20000,
["ITF"] = 6800,
["ITF_profile"] = 2600,
["ITIS"] = 5900,
["ITN_talk"] = 13000,
["ITN_talk/date"] = 13000,
["IUCN_banner"] = 15000,
["I_sup"] = 4900,
["Ice_hockey_box"] = 2000,
["Ice_hockey_stats"] = 20000,
["Icehockeystats"] = 11000,
["Icelandic_name"] = 2100,
["Icon"] = 666000,
["If"] = 433000,
["If_all"] = 7800,
["If_autoconfirmed"] = 2200,
["If_between"] = 4800,
["If_both"] = 208000,
["If_dark"] = 4000,
["If_dark/styles.css"] = 4000,
["If_either"] = 22000,
["If_empty"] = 6720000,
["If_first_display_both"] = 122000,
["If_in_category"] = 164000,
["If_in_page"] = 22000,
["If_last_display_both"] = 38000,
["If_mobile"] = 2100,
["If_mobile/styles.css"] = 3000,
["If_preview"] = 66000,
["If_then_show"] = 135000,
["Ifempty"] = 943000,
["Ifeq"] = 83000,
["Iferror_then_show"] = 4000,
["Ifexist_not_redirect"] = 1910000,
["Ifnotempty"] = 18000,
["Ifnoteq_then_show"] = 2300,
["Ifnumber"] = 75000,
["Ifsubst"] = 1020000,
["Ih"] = 8100,
["Ill"] = 255000,
["Illm"] = 5900,
["Image_frame"] = 6200,
["Image_label"] = 4700,
["Image_label_begin"] = 4100,
["Image_label_end"] = 4100,
["Image_label_small"] = 2600,
["Image_needed"] = 4500,
["Image_other"] = 190000,
["Image_requested"] = 136000,
["Image_requested/Category_helper"] = 126000,
["Imbox"] = 998000,
["Imdb_name"] = 5300,
["Imdb_title"] = 2800,
["Importance"] = 15000,
["Importance/colour"] = 30000,
["Importance_mask"] = 621000,
["Improve_categories"] = 7500,
["Improve_documentation"] = 4200,
["Improve_plot"] = 4100,
["In_class"] = 5600,
["In_lang"] = 388000,
["In_progress"] = 3800,
["In_string"] = 307000,
["In_title"] = 30000,
["Inactive_userpage_blanked"] = 3900,
["Inaturalist_taxon"] = 3800,
["Include-USGov"] = 25000,
["Incomplete_list"] = 24000,
["Inconclusive"] = 2300,
["Increase"] = 61000,
["Incumbent_pope"] = 4400,
["Indent"] = 2300,
["Indented_plain_list"] = 2700,
["Indented_plainlist"] = 2600,
["Independent_sources"] = 10000,
["IndexFungorum"] = 2100,
["Indian_English"] = 5000,
["Indian_railway_code"] = 3600,
["Indian_rupee"] = 12000,
["Inflation"] = 27000,
["Inflation-fn"] = 5800,
["Inflation-year"] = 4300,
["Inflation/IN/startyear"] = 6700,
["Inflation/UK"] = 5500,
["Inflation/UK/dataset"] = 5500,
["Inflation/UK/startyear"] = 5500,
["Inflation/US"] = 16000,
["Inflation/US-GDP"] = 3000,
["Inflation/US-GDP/dataset"] = 3000,
["Inflation/US-GDP/startyear"] = 3000,
["Inflation/US/dataset"] = 16000,
["Inflation/US/startyear"] = 16000,
["Inflation/fn"] = 7500,
["Inflation/year"] = 34000,
["Info"] = 5600,
["Infobox"] = 3420000,
["Infobox/Columns"] = 3300,
["Infobox/mobileviewfix.css"] = 175000,
["Infobox/styles-images.css"] = 20000,
["Infobox3cols"] = 28000,
["Infobox_AFL_biography"] = 15000,
["Infobox_Athletics_Championships"] = 3400,
["Infobox_Australian_place"] = 15000,
["Infobox_Australian_place/styles.css"] = 15000,
["Infobox_Australian_place/table"] = 11000,
["Infobox_COA_wide"] = 3700,
["Infobox_Canada_electoral_district"] = 2700,
["Infobox_Chinese"] = 23000,
["Infobox_Chinese/Chinese"] = 3200,
["Infobox_Chinese/Footer"] = 7200,
["Infobox_Chinese/Header"] = 7200,
["Infobox_Christian_leader"] = 23000,
["Infobox_French_commune"] = 38000,
["Infobox_French_subdivision"] = 2200,
["Infobox_Gaelic_games_biography"] = 5500,
["Infobox_Gaelic_games_player"] = 3000,
["Infobox_German_location"] = 11000,
["Infobox_German_place"] = 14000,
["Infobox_Grand_Prix_race_report"] = 2200,
["Infobox_Greece_place"] = 3600,
["Infobox_Greek_Dimos"] = 2900,
["Infobox_Hindu_temple"] = 2900,
["Infobox_Indian_constituency"] = 5800,
["Infobox_Indian_constituency/defaultdata"] = 5800,
["Infobox_Italian_comune"] = 8100,
["Infobox_Korean"] = 2200,
["Infobox_Korean/auto"] = 14000,
["Infobox_Korean/auto/categories"] = 14000,
["Infobox_Korean/base"] = 2300,
["Infobox_Korean/base/auto"] = 18000,
["Infobox_Korean/categories"] = 2200,
["Infobox_Korean_name"] = 2200,
["Infobox_Korean_name/auto"] = 14000,
["Infobox_Korean_television_name"] = 3400,
["Infobox_NASCAR_driver"] = 2400,
["Infobox_NASCAR_race_report"] = 2700,
["Infobox_NCAA_basketball_conference_tournament"] = 2100,
["Infobox_NCAA_team_season"] = 10000,
["Infobox_NFL_biography"] = 27000,
["Infobox_NFL_team_season"] = 2300,
["Infobox_NRHP"] = 74000,
["Infobox_NRHP/conv"] = 19000,
["Infobox_NRHP/locmapin2region"] = 68000,
["Infobox_Olympic_event"] = 8100,
["Infobox_Olympic_event/event_link"] = 8100,
["Infobox_Olympic_event/games_text"] = 8100,
["Infobox_Pan_American_Games_event"] = 2900,
["Infobox_Paralympic_event"] = 2900,
["Infobox_Paralympic_event/games_text"] = 2900,
["Infobox_Romanian_subdivision"] = 3200,
["Infobox_Russian_district"] = 2100,
["Infobox_Russian_inhabited_locality"] = 4700,
["Infobox_Russian_inhabited_locality/PosMapFS"] = 4200,
["Infobox_Russian_inhabited_locality/federal_subject"] = 4600,
["Infobox_SCOTUS_case"] = 4600,
["Infobox_SSSI"] = 2000,
["Infobox_Site_of_Special_Scientific_Interest"] = 2100,
["Infobox_Slovak_place"] = 3000,
["Infobox_Swiss_town"] = 2900,
["Infobox_Switzerland_municipality"] = 2900,
["Infobox_Turkey_place"] = 20000,
["Infobox_U.S._county"] = 3000,
["Infobox_U.S._county/district"] = 3000,
["Infobox_U.S._legislation"] = 2100,
["Infobox_UK_constituency"] = 2200,
["Infobox_UK_constituency/year"] = 2200,
["Infobox_UK_legislation"] = 6400,
["Infobox_UK_place"] = 27000,
["Infobox_UK_place/NoDialCode"] = 8200,
["Infobox_UK_place/NoPostCode"] = 3600,
["Infobox_UK_place/area"] = 2700,
["Infobox_UK_place/dens"] = 2300,
["Infobox_UK_place/dist"] = 2800,
["Infobox_UK_place/local"] = 27000,
["Infobox_UK_place/styles.css"] = 27000,
["Infobox_UNESCO_World_Heritage_Site"] = 2100,
["Infobox_UN_resolution"] = 2300,
["Infobox_US_Supreme_Court_case"] = 4800,
["Infobox_US_Supreme_Court_case/courts"] = 4800,
["Infobox_United_States_legislative_district"] = 2700,
["Infobox_United_States_legislative_district/representative"] = 2700,
["Infobox_Wikipedia_user"] = 12000,
["Infobox_academic"] = 27000,
["Infobox_aircraft"] = 13000,
["Infobox_aircraft/styles.css"] = 14000,
["Infobox_aircraft_occurrence"] = 2900,
["Infobox_airline"] = 4800,
["Infobox_airline/styles.css"] = 4800,
["Infobox_airport"] = 14000,
["Infobox_airport/datatable"] = 13000,
["Infobox_airport/styles.css"] = 14000,
["Infobox_album"] = 169000,
["Infobox_album/color"] = 208000,
["Infobox_album/link"] = 169000,
["Infobox_anatomy"] = 4500,
["Infobox_animanga/Footer"] = 7800,
["Infobox_animanga/Header"] = 7800,
["Infobox_animanga/Print"] = 6700,
["Infobox_animanga/Video"] = 5100,
["Infobox_architect"] = 4500,
["Infobox_artist"] = 35000,
["Infobox_artist_discography"] = 6500,
["Infobox_artwork"] = 16000,
["Infobox_automobile"] = 9300,
["Infobox_award"] = 16000,
["Infobox_badminton_player"] = 3300,
["Infobox_baseball_biography"] = 30000,
["Infobox_baseball_biography/style"] = 30000,
["Infobox_baseball_biography/styles.css"] = 30000,
["Infobox_baseball_team_season"] = 3300,
["Infobox_baseball_team_season/leagueseason"] = 3300,
["Infobox_baseball_team_season/season"] = 3300,
["Infobox_baseball_team_season/styles.css"] = 3300,
["Infobox_basketball_biography"] = 23000,
["Infobox_basketball_biography/style"] = 23000,
["Infobox_basketball_club"] = 3300,
["Infobox_basketball_club/styles.css"] = 3300,
["Infobox_beauty_pageant"] = 2200,
["Infobox_bilateral_relations"] = 5000,
["Infobox_bishop_styles"] = 2500,
["Infobox_body_of_water"] = 19000,
["Infobox_book"] = 63000,
["Infobox_book/styles.css"] = 63000,
["Infobox_boxer"] = 6500,
["Infobox_brand"] = 2200,
["Infobox_brand/styles.css"] = 2200,
["Infobox_bridge"] = 6800,
["Infobox_building"] = 34000,
["Infobox_bus_company"] = 2000,
["Infobox_cemetery"] = 2100,
["Infobox_character"] = 8400,
["Infobox_character/styles.css"] = 8500,
["Infobox_chess_biography"] = 4800,
["Infobox_chess_player"] = 3800,
["Infobox_church"] = 17000,
["Infobox_church/denomination"] = 17000,
["Infobox_church/font_color"] = 17000,
["Infobox_civil_conflict"] = 3200,
["Infobox_civilian_attack"] = 7700,
["Infobox_college_coach"] = 13000,
["Infobox_college_football_game"] = 2300,
["Infobox_college_football_player"] = 2600,
["Infobox_college_sports_team_season"] = 45000,
["Infobox_college_sports_team_season/link"] = 45000,
["Infobox_college_sports_team_season/name"] = 45000,
["Infobox_college_sports_team_season/succession"] = 45000,
["Infobox_college_sports_team_season/team"] = 45000,
["Infobox_comedian"] = 2200,
["Infobox_comic_book_title"] = 3200,
["Infobox_comics_character"] = 3500,
["Infobox_comics_creator"] = 3600,
["Infobox_comics_creator/styles.css"] = 3600,
["Infobox_company"] = 93000,
["Infobox_company/styles.css"] = 93000,
["Infobox_computing_device"] = 2600,
["Infobox_concert"] = 3900,
["Infobox_constituency"] = 7900,
["Infobox_country"] = 7200,
["Infobox_country/formernext"] = 6700,
["Infobox_country/imagetable"] = 5700,
["Infobox_country/multirow"] = 9300,
["Infobox_country/status_text"] = 3100,
["Infobox_country/styles.css"] = 7300,
["Infobox_country_at_games"] = 17000,
["Infobox_country_at_games/core"] = 17000,
["Infobox_country_at_games/see_also"] = 14000,
["Infobox_court_case"] = 5300,
["Infobox_court_case/images"] = 2900,
["Infobox_court_case/styles.css"] = 5300,
["Infobox_cricket_tournament"] = 2800,
["Infobox_cricketer"] = 32000,
["Infobox_cricketer/career"] = 32000,
["Infobox_cricketer/national_side"] = 7700,
["Infobox_criminal"] = 7800,
["Infobox_curler"] = 2800,
["Infobox_cycling_race_report"] = 5000,
["Infobox_cyclist"] = 17000,
["Infobox_dam"] = 5900,
["Infobox_deity"] = 2300,
["Infobox_deity/color"] = 2300,
["Infobox_designation_list"] = 32000,
["Infobox_designation_list/entry"] = 23000,
["Infobox_dim"] = 6400,
["Infobox_diocese"] = 4100,
["Infobox_drug"] = 12000,
["Infobox_drug/chemical_formula"] = 12000,
["Infobox_drug/data_page_link"] = 12000,
["Infobox_drug/formatATC"] = 12000,
["Infobox_drug/formatCASnumber"] = 12000,
["Infobox_drug/formatChEBI"] = 12000,
["Infobox_drug/formatChEMBL"] = 12000,
["Infobox_drug/formatChemDBNIAID"] = 12000,
["Infobox_drug/formatChemSpider"] = 12000,
["Infobox_drug/formatCompTox"] = 12000,
["Infobox_drug/formatDrugBank"] = 12000,
["Infobox_drug/formatIUPHARBPS"] = 12000,
["Infobox_drug/formatJmol"] = 12000,
["Infobox_drug/formatKEGG"] = 12000,
["Infobox_drug/formatPDBligand"] = 11000,
["Infobox_drug/formatPubChemCID"] = 12000,
["Infobox_drug/formatPubChemSID"] = 12000,
["Infobox_drug/formatUNII"] = 12000,
["Infobox_drug/legal_status"] = 12000,
["Infobox_drug/licence"] = 12000,
["Infobox_drug/maintenance_categories"] = 12000,
["Infobox_drug/non-ref-space"] = 4000,
["Infobox_drug/pregnancy_category"] = 12000,
["Infobox_drug/styles.css"] = 12000,
["Infobox_drug/title"] = 12000,
["Infobox_economist"] = 2000,
["Infobox_election"] = 41000,
["Infobox_election/shortname"] = 2600,
["Infobox_election/styles.css"] = 41000,
["Infobox_enzyme"] = 5100,
["Infobox_ethnic_group"] = 8100,
["Infobox_event"] = 7800,
["Infobox_family"] = 2800,
["Infobox_field_hockey_player"] = 2600,
["Infobox_figure_skater"] = 4000,
["Infobox_film"] = 170000,
["Infobox_film/short_description"] = 166000,
["Infobox_film_awards"] = 3200,
["Infobox_film_awards/link"] = 3200,
["Infobox_film_awards/style"] = 3200,
["Infobox_film_or_theatre_festival"] = 2100,
["Infobox_food"] = 7700,
["Infobox_football_biography"] = 219000,
["Infobox_football_club"] = 30000,
["Infobox_football_club_season"] = 24000,
["Infobox_football_league"] = 2800,
["Infobox_football_league_season"] = 22000,
["Infobox_football_match"] = 6800,
["Infobox_football_tournament"] = 2200,
["Infobox_football_tournament_season"] = 9400,
["Infobox_former_subdivision"] = 3700,
["Infobox_former_subdivision/styles.css"] = 3700,
["Infobox_galaxy"] = 3400,
["Infobox_game"] = 3100,
["Infobox_game_score"] = 3800,
["Infobox_games"] = 2100,
["Infobox_gene"] = 13000,
["Infobox_given_name"] = 4100,
["Infobox_golfer"] = 4900,
["Infobox_golfer/highest_ranking"] = 4900,
["Infobox_government_agency"] = 13000,
["Infobox_government_cabinet"] = 3600,
["Infobox_gridiron_football_biography"] = 40000,
["Infobox_gridiron_football_biography/position"] = 39000,
["Infobox_gridiron_football_team_season"] = 4100,
["Infobox_gymnast"] = 5900,
["Infobox_handball_biography"] = 5600,
["Infobox_historic_site"] = 22000,
["Infobox_holiday"] = 2200,
["Infobox_holiday/date"] = 2200,
["Infobox_horseraces"] = 2700,
["Infobox_hospital"] = 7000,
["Infobox_hospital/care_system"] = 7000,
["Infobox_hospital/lists"] = 7000,
["Infobox_hurling_championship"] = 2700,
["Infobox_ice_hockey_biography"] = 21000,
["Infobox_ice_hockey_player"] = 18000,
["Infobox_ice_hockey_team"] = 3300,
["Infobox_ice_hockey_team_season"] = 2200,
["Infobox_international_football_competition"] = 6800,
["Infobox_islands"] = 9700,
["Infobox_islands/area"] = 10000,
["Infobox_islands/density"] = 10000,
["Infobox_islands/length"] = 9700,
["Infobox_islands/styles.css"] = 9700,
["Infobox_journal"] = 10000,
["Infobox_journal/Abbreviation_search"] = 10000,
["Infobox_journal/Bluebook_check"] = 9900,
["Infobox_journal/Former_check"] = 9900,
["Infobox_journal/ISO_4_check"] = 9900,
["Infobox_journal/ISSN-eISSN"] = 9900,
["Infobox_journal/Indexing_search"] = 10000,
["Infobox_journal/MathSciNet_check"] = 9900,
["Infobox_journal/NLM_check"] = 9900,
["Infobox_journal/frequency"] = 9100,
["Infobox_journal/openaccess"] = 2700,
["Infobox_judoka"] = 2800,
["Infobox_lake"] = 3800,
["Infobox_language"] = 10000,
["Infobox_language/family-color"] = 12000,
["Infobox_language/genetic"] = 7000,
["Infobox_language/lingualist"] = 11000,
["Infobox_language/linguistlist"] = 10000,
["Infobox_language/ref"] = 7400,
["Infobox_law_enforcement_agency"] = 2200,
["Infobox_legislation"] = 2800,
["Infobox_legislative_district"] = 2300,
["Infobox_legislative_election"] = 2700,
["Infobox_legislative_election/row"] = 2600,
["Infobox_legislative_election/styles.css"] = 2700,
["Infobox_legislative_term"] = 2100,
["Infobox_legislature"] = 4400,
["Infobox_library"] = 2500,
["Infobox_lighthouse"] = 2600,
["Infobox_lighthouse/light"] = 2700,
["Infobox_locomotive"] = 5000,
["Infobox_magazine"] = 8300,
["Infobox_manner_of_address"] = 4200,
["Infobox_martial_artist"] = 6300,
["Infobox_martial_artist/record"] = 6300,
["Infobox_medal_templates"] = 478000,
["Infobox_medical_condition"] = 9900,
["Infobox_medical_condition_(new)"] = 6300,
["Infobox_medical_details"] = 2600,
["Infobox_medical_person"] = 2400,
["Infobox_militant_organization"] = 2200,
["Infobox_military_conflict"] = 28000,
["Infobox_military_installation"] = 11000,
["Infobox_military_person"] = 54000,
["Infobox_military_unit"] = 29000,
["Infobox_mine"] = 2300,
["Infobox_mineral"] = 2000,
["Infobox_mobile_phone"] = 2500,
["Infobox_mobile_phone/size"] = 2100,
["Infobox_mobile_phone/weight"] = 2200,
["Infobox_model"] = 2300,
["Infobox_monument"] = 2800,
["Infobox_mountain"] = 30000,
["Infobox_multi-sport_competition_event"] = 2800,
["Infobox_museum"] = 12000,
["Infobox_musical_artist"] = 131000,
["Infobox_musical_artist/hCard_class"] = 122000,
["Infobox_musical_composition"] = 3700,
["Infobox_name"] = 8800,
["Infobox_name_module"] = 9500,
["Infobox_newspaper"] = 11000,
["Infobox_newspaper/styles.css"] = 11000,
["Infobox_noble"] = 7800,
["Infobox_officeholder"] = 281000,
["Infobox_officeholder/office"] = 288000,
["Infobox_official_post"] = 9900,
["Infobox_organization"] = 43000,
["Infobox_pageant_titleholder"] = 3100,
["Infobox_park"] = 9900,
["Infobox_person"] = 623000,
["Infobox_person/Wikidata"] = 5000,
["Infobox_person/height"] = 116000,
["Infobox_person/length"] = 7700,
["Infobox_person/weight"] = 74000,
["Infobox_philosopher"] = 3800,
["Infobox_planet"] = 4800,
["Infobox_play"] = 4600,
["Infobox_political_party"] = 16000,
["Infobox_power_station"] = 3400,
["Infobox_prepared_food"] = 2500,
["Infobox_professional_wrestler"] = 4800,
["Infobox_professional_wrestling_event"] = 3400,
["Infobox_protected_area"] = 15000,
["Infobox_protein_family"] = 2200,
["Infobox_publisher"] = 2600,
["Infobox_racehorse"] = 6000,
["Infobox_racing_driver"] = 5900,
["Infobox_racing_driver_series_section"] = 2900,
["Infobox_radio_station"] = 22000,
["Infobox_radio_station/styles.css"] = 22000,
["Infobox_rail"] = 3200,
["Infobox_rail_line"] = 8100,
["Infobox_rail_service"] = 3300,
["Infobox_reality_competition_season"] = 4300,
["Infobox_record_label"] = 4200,
["Infobox_recurring_event"] = 8100,
["Infobox_religious_biography"] = 7200,
["Infobox_religious_building"] = 15000,
["Infobox_religious_building/color"] = 21000,
["Infobox_restaurant"] = 4700,
["Infobox_river"] = 32000,
["Infobox_river/calcunit"] = 32000,
["Infobox_river/discharge"] = 32000,
["Infobox_river/row-style"] = 32000,
["Infobox_river/source"] = 32000,
["Infobox_road"] = 25000,
["Infobox_road/meta/mask/category"] = 24000,
["Infobox_road/meta/mask/country"] = 25000,
["Infobox_road/styles.css"] = 26000,
["Infobox_road_small"] = 2500,
["Infobox_rockunit"] = 6500,
["Infobox_royalty"] = 26000,
["Infobox_royalty/short_description"] = 8800,
["Infobox_rugby_biography"] = 19000,
["Infobox_rugby_biography/correct_date"] = 19000,
["Infobox_rugby_biography/depcheck"] = 19000,
["Infobox_rugby_league_biography"] = 11000,
["Infobox_rugby_league_biography/PLAYER"] = 11000,
["Infobox_rugby_team"] = 2700,
["Infobox_sailboat_specifications"] = 2300,
["Infobox_saint"] = 5500,
["Infobox_school"] = 40000,
["Infobox_school/short_description"] = 40000,
["Infobox_school/styles.css"] = 40000,
["Infobox_school_district"] = 6500,
["Infobox_school_district/styles.css"] = 6500,
["Infobox_scientist"] = 57000,
["Infobox_settlement"] = 597000,
["Infobox_settlement/areadisp"] = 259000,
["Infobox_settlement/columns"] = 108000,
["Infobox_settlement/columns/styles.css"] = 108000,
["Infobox_settlement/densdisp"] = 457000,
["Infobox_settlement/lengthdisp"] = 182000,
["Infobox_settlement/link"] = 108000,
["Infobox_settlement/styles.css"] = 597000,
["Infobox_ship"] = 43000,
["Infobox_ship/career"] = 39000,
["Infobox_ship/characteristics"] = 43000,
["Infobox_ship/class_overview"] = 4400,
["Infobox_ship/image"] = 42000,
["Infobox_ship/service_record"] = 2500,
["Infobox_shopping_mall"] = 3800,
["Infobox_short_story"] = 2700,
["Infobox_skier"] = 2700,
["Infobox_soap_character"] = 3100,
["Infobox_social_media_personality"] = 4400,
["Infobox_software"] = 14000,
["Infobox_software/simple"] = 15000,
["Infobox_song"] = 84000,
["Infobox_song/color"] = 84000,
["Infobox_song/link"] = 84000,
["Infobox_song_contest_national_year"] = 2000,
["Infobox_song_contest_national_year/Year"] = 2100,
["Infobox_spaceflight"] = 4100,
["Infobox_spaceflight/styles.css"] = 4100,
["Infobox_speed_skater"] = 2000,
["Infobox_sport_event"] = 2800,
["Infobox_sports_competition_event"] = 24000,
["Infobox_sports_competition_event/medalrow"] = 15000,
["Infobox_sports_league"] = 5700,
["Infobox_sports_season"] = 7000,
["Infobox_sports_team"] = 2300,
["Infobox_sportsperson"] = 160000,
["Infobox_stadium"] = 2600,
["Infobox_station"] = 58000,
["Infobox_station/services"] = 58000,
["Infobox_station/styles.css"] = 58000,
["Infobox_street"] = 4500,
["Infobox_swimmer"] = 11000,
["Infobox_television"] = 64000,
["Infobox_television/Short_description"] = 62000,
["Infobox_television/styles.css"] = 64000,
["Infobox_television_channel"] = 6700,
["Infobox_television_channel/styles.css"] = 6700,
["Infobox_television_episode"] = 13000,
["Infobox_television_episode/styles.css"] = 14000,
["Infobox_television_season"] = 11000,
["Infobox_television_station"] = 3200,
["Infobox_television_station/styles.css"] = 3300,
["Infobox_tennis_biography"] = 11000,
["Infobox_tennis_event"] = 3400,
["Infobox_tennis_tournament"] = 2000,
["Infobox_tennis_tournament/heading"] = 2000,
["Infobox_tennis_tournament/style"] = 2000,
["Infobox_tennis_tournament_event"] = 22000,
["Infobox_tennis_tournament_year"] = 11000,
["Infobox_tennis_tournament_year/color"] = 33000,
["Infobox_tennis_tournament_year/footer"] = 33000,
["Infobox_tournament_season"] = 13000,
["Infobox_train"] = 2600,
["Infobox_university"] = 26000,
["Infobox_user"] = 3000,
["Infobox_venue"] = 20000,
["Infobox_video_game"] = 30000,
["Infobox_video_game/styles.css"] = 30000,
["Infobox_volleyball_biography"] = 5900,
["Infobox_weapon"] = 8100,
["Infobox_weather_event"] = 3500,
["Infobox_weather_event/Effects"] = 3300,
["Infobox_weather_event/Footer"] = 3400,
["Infobox_weather_event/History"] = 3300,
["Infobox_weather_event/SSHWS"] = 2000,
["Infobox_weather_event/meteorology"] = 3200,
["Infobox_weather_event/scale"] = 2100,
["Infobox_weather_event/styles.css"] = 3500,
["Infobox_website"] = 8300,
["Infobox_writer"] = 45000,
["Information"] = 98000,
["Information/styles.css"] = 98000,
["Inlang"] = 2400,
["Inline"] = 3800,
["Inline_block"] = 5400,
["Inprogress"] = 2600,
["Input_link"] = 32000,
["Instagram"] = 20000,
["InterSportStats"] = 5900,
["Interlanguage_link"] = 302000,
["Interlanguage_link_multi"] = 9400,
["International_Paralympic_Committee"] = 4300,
["International_football_primary_link"] = 3500,
["International_football_primary_style"] = 3600,
["International_football_secondary_style"] = 3400,
["Internet_Archive"] = 2200,
["Internet_Archive_SCOTUS_URL"] = 3300,
["Internet_Archive_author"] = 19000,
["Internet_Archive_film"] = 2600,
["Intitle"] = 22000,
["Ip"] = 2100,
["Iptalk"] = 18000,
["IranCensus2006"] = 29000,
["IranNCSGN"] = 3100,
["Iran_Census_2006"] = 30000,
["Irish_place_name"] = 3000,
["IsIPAddress"] = 45000,
["IsValidPageName"] = 3400,
["Is_MLB_league"] = 3300,
["Is_NPB_league"] = 3300,
["Is_continent"] = 13000,
["Is_country_in_Central_America"] = 17000,
["Is_country_in_the_Caribbean"] = 17000,
["Is_interwiki_link"] = 6500,
["Is_italic_taxon"] = 654000,
["Is_redirect"] = 383000,
["Is_time"] = 6700,
["Is_valid_page_name"] = 3400,
["Isbn"] = 10000,
["Isnum"] = 3000,
["Isnumeric"] = 120000,
["Iso2continent"] = 84000,
["Iso2country"] = 26000,
["Iso2country/article"] = 25000,
["Iso2country/data"] = 26000,
["Issubst"] = 64000,
["Italic_dab2"] = 5900,
["Italic_disambiguation"] = 2400,
["Italic_title"] = 258000,
["Italic_title_prefixed"] = 8800,
["Italictitle"] = 3000,
["Ivmbox"] = 142000,
["Ivory_messagebox"] = 189000,
["Ivory_messagebox/styles.css"] = 189000,
["Module:I18n/complex_date"] = 48000,
["Module:IP"] = 148000,
["Module:IPA"] = 184000,
["Module:IPA/data"] = 166000,
["Module:IPA/styles.css"] = 151000,
["Module:IPA_symbol"] = 6800,
["Module:IPA_symbol/data"] = 6800,
["Module:IPAc-en"] = 56000,
["Module:IPAc-en/data"] = 56000,
["Module:IPAc-en/phonemes"] = 56000,
["Module:IPAc-en/pronunciation"] = 56000,
["Module:IPAddress"] = 253000,
["Module:ISO_3166"] = 910000,
["Module:ISO_3166/data/AT"] = 2500,
["Module:ISO_3166/data/BA"] = 3400,
["Module:ISO_3166/data/CA"] = 2600,
["Module:ISO_3166/data/CH"] = 4200,
["Module:ISO_3166/data/CN"] = 2800,
["Module:ISO_3166/data/CZ"] = 6600,
["Module:ISO_3166/data/DE"] = 15000,
["Module:ISO_3166/data/ES"] = 3700,
["Module:ISO_3166/data/FR"] = 38000,
["Module:ISO_3166/data/GB"] = 7200,
["Module:ISO_3166/data/GR"] = 3500,
["Module:ISO_3166/data/IN"] = 29000,
["Module:ISO_3166/data/IR"] = 24000,
["Module:ISO_3166/data/IT"] = 2500,
["Module:ISO_3166/data/National"] = 910000,
["Module:ISO_3166/data/PL"] = 7600,
["Module:ISO_3166/data/RS"] = 3200,
["Module:ISO_3166/data/RU"] = 27000,
["Module:ISO_3166/data/UA"] = 2200,
["Module:ISO_3166/data/US"] = 87000,
["Module:ISO_639_name"] = 34000,
["Module:ISO_639_name/ISO_639-1"] = 29000,
["Module:ISO_639_name/ISO_639-2"] = 21000,
["Module:ISO_639_name/ISO_639-2B"] = 20000,
["Module:ISO_639_name/ISO_639-3"] = 20000,
["Module:ISO_639_name/ISO_639-3_(dep)"] = 34000,
["Module:ISO_639_name/ISO_639-5"] = 19000,
["Module:ISO_639_name/ISO_639_deprecated"] = 34000,
["Module:ISO_639_name/ISO_639_name_to_code"] = 4600,
["Module:ISO_639_name/ISO_639_override"] = 34000,
["Module:ISOdate"] = 48000,
["Module:Ice_hockey_box"] = 2000,
["Module:Icon"] = 678000,
["Module:Icon/data"] = 678000,
["Module:Icon_box"] = 261000,
["Module:Icon_box/data"] = 261000,
["Module:If_any_equal"] = 254000,
["Module:If_empty"] = 6750000,
["Module:If_in_category"] = 164000,
["Module:If_in_page"] = 22000,
["Module:If_not_given_or_empty"] = 90000,
["Module:If_preview"] = 1780000,
["Module:If_preview/configuration"] = 1780000,
["Module:If_preview/styles.css"] = 1780000,
["Module:In_lang"] = 389000,
["Module:Indent"] = 2300,
["Module:Infobox"] = 4690000,
["Module:Infobox/dates"] = 78000,
["Module:Infobox/styles.css"] = 4960000,
["Module:Infobox/utilities"] = 2600,
["Module:Infobox3cols"] = 321000,
["Module:InfoboxBuilder"] = 2600,
["Module:InfoboxImage"] = 5620000,
["Module:InfoboxImage/data"] = 3360000,
["Module:Infobox_body_of_water_tracking"] = 19000,
["Module:Infobox_cyclist_tracking"] = 17000,
["Module:Infobox_dim"] = 380000,
["Module:Infobox_dim/data"] = 233000,
["Module:Infobox_election"] = 42000,
["Module:Infobox_gene"] = 13000,
["Module:Infobox_gene/orthologs"] = 13000,
["Module:Infobox_mapframe"] = 1680000,
["Module:Infobox_military_conflict"] = 28000,
["Module:Infobox_military_conflict/styles.css"] = 28000,
["Module:Infobox_multi-lingual_name"] = 23000,
["Module:Infobox_multi-lingual_name/data"] = 23000,
["Module:Infobox_power_station"] = 3400,
["Module:Infobox_road"] = 26000,
["Module:Infobox_road/browselinks"] = 26000,
["Module:Infobox_road/errors"] = 25000,
["Module:Infobox_road/length"] = 26000,
["Module:Infobox_road/locations"] = 25000,
["Module:Infobox_road/map"] = 25000,
["Module:Infobox_road/route"] = 26000,
["Module:Infobox_road/sections"] = 25000,
["Module:Infobox_ship"] = 43000,
["Module:Infobox_ship/data"] = 43000,
["Module:Infobox_ship/styles.css"] = 43000,
["Module:Infobox_television"] = 64000,
["Module:Infobox_television_disambiguation_check"] = 72000,
["Module:Infobox_television_episode"] = 13000,
["Module:Infobox_television_season_disambiguation_check"] = 10000,
["Module:Infobox_television_season_name"] = 11000,
["Module:Internet_Archive"] = 22000,
["Module:Is_article"] = 2400,
["Module:Is_infobox_in_lead"] = 462000,
["Module:Is_instance"] = 354000,
["Module:Iso2nationality"] = 96000,
["Module:Italic_title"] = 1260000,
["Module:Italic_title2"] = 5900,
}
f59r1v4rv06727mvk0ay21dkv2ts0ev
74791
74790
2026-08-24T00:15:11Z
Robertsky
10424
1 versaun husi [[:en:Module:Transclusion_count/data/I]]
74790
Scribunto
text/plain
return {
["IAST"] = 6300,
["IA_SCOTUS_URL"] = 3300,
["IBDB_name"] = 9800,
["ICD10"] = 5000,
["ICD9"] = 4400,
["ICS"] = 3500,
["ICS_flag"] = 3500,
["IDN"] = 3800,
["IMDb_episode"] = 11000,
["IMDb_episodes"] = 4200,
["IMDb_name"] = 173000,
["IMDb_title"] = 211000,
["IMO_Number"] = 4500,
["IMSLP"] = 9200,
["INA"] = 2400,
["IND"] = 8600,
["INR"] = 6500,
["INRConvert"] = 6700,
["INRConvert/CurrentRate"] = 6700,
["INRConvert/USD"] = 6600,
["INRConvert/out"] = 6700,
["IOBDB_name"] = 2100,
["IP"] = 2800,
["IPA"] = 182000,
["IPA_audio_link"] = 5100,
["IPA_link"] = 5100,
["IPAblink"] = 2600,
["IPAc-cmn"] = 2800,
["IPAc-en"] = 56000,
["IPAc-pl"] = 51000,
["IPSummary"] = 82000,
["IP_summary"] = 83000,
["IPtalk"] = 18000,
["IPuser"] = 7600,
["IPvandal"] = 2800,
["IRC"] = 7100,
["IRI"] = 2500,
["IRL"] = 6100,
["IRN"] = 4000,
["ISBN"] = 475000,
["ISBN?"] = 2500,
["ISBNT"] = 46000,
["ISBN_missing"] = 3200,
["ISFDB_name"] = 4300,
["ISFDB_title"] = 5100,
["ISL"] = 2300,
["ISO_15924/script-example-character"] = 3100,
["ISO_15924/wp-article"] = 3100,
["ISO_15924/wp-article/format"] = 3100,
["ISO_15924/wp-article/label"] = 3000,
["ISO_3166_code"] = 240000,
["ISO_3166_name"] = 16000,
["ISO_639_name"] = 28000,
["ISP"] = 3700,
["ISR"] = 5800,
["ISSN"] = 12000,
["ISSN_link"] = 33000,
["ISTAT"] = 8100,
["ISU_figure_skater"] = 2300,
["ITA"] = 20000,
["ITF"] = 6800,
["ITF_profile"] = 2600,
["ITIS"] = 5900,
["ITN_talk"] = 13000,
["ITN_talk/date"] = 13000,
["IUCN_banner"] = 15000,
["I_sup"] = 4900,
["Ice_hockey_box"] = 2000,
["Ice_hockey_stats"] = 20000,
["Icehockeystats"] = 11000,
["Icelandic_name"] = 2100,
["Icon"] = 666000,
["If"] = 433000,
["If_all"] = 7800,
["If_autoconfirmed"] = 2200,
["If_between"] = 4800,
["If_both"] = 208000,
["If_dark"] = 4000,
["If_dark/styles.css"] = 4000,
["If_either"] = 22000,
["If_empty"] = 6720000,
["If_first_display_both"] = 122000,
["If_in_category"] = 164000,
["If_in_page"] = 22000,
["If_last_display_both"] = 38000,
["If_mobile"] = 2100,
["If_mobile/styles.css"] = 3000,
["If_preview"] = 66000,
["If_then_show"] = 135000,
["Ifempty"] = 943000,
["Ifeq"] = 83000,
["Iferror_then_show"] = 4000,
["Ifexist_not_redirect"] = 1910000,
["Ifnotempty"] = 18000,
["Ifnoteq_then_show"] = 2300,
["Ifnumber"] = 75000,
["Ifsubst"] = 1020000,
["Ih"] = 8100,
["Ill"] = 255000,
["Illm"] = 5900,
["Image_frame"] = 6200,
["Image_label"] = 4700,
["Image_label_begin"] = 4100,
["Image_label_end"] = 4100,
["Image_label_small"] = 2600,
["Image_needed"] = 4500,
["Image_other"] = 190000,
["Image_requested"] = 136000,
["Image_requested/Category_helper"] = 126000,
["Imbox"] = 998000,
["Imdb_name"] = 5300,
["Imdb_title"] = 2800,
["Importance"] = 15000,
["Importance/colour"] = 30000,
["Importance_mask"] = 621000,
["Improve_categories"] = 7500,
["Improve_documentation"] = 4200,
["Improve_plot"] = 4100,
["In_class"] = 5600,
["In_lang"] = 388000,
["In_progress"] = 3800,
["In_string"] = 307000,
["In_title"] = 30000,
["Inactive_userpage_blanked"] = 3900,
["Inaturalist_taxon"] = 3800,
["Include-USGov"] = 25000,
["Incomplete_list"] = 24000,
["Inconclusive"] = 2300,
["Increase"] = 61000,
["Incumbent_pope"] = 4400,
["Indent"] = 2300,
["Indented_plain_list"] = 2700,
["Indented_plainlist"] = 2600,
["Independent_sources"] = 10000,
["IndexFungorum"] = 2100,
["Indian_English"] = 5000,
["Indian_railway_code"] = 3600,
["Indian_rupee"] = 12000,
["Inflation"] = 27000,
["Inflation-fn"] = 5800,
["Inflation-year"] = 4300,
["Inflation/IN/startyear"] = 6700,
["Inflation/UK"] = 5500,
["Inflation/UK/dataset"] = 5500,
["Inflation/UK/startyear"] = 5500,
["Inflation/US"] = 16000,
["Inflation/US-GDP"] = 3000,
["Inflation/US-GDP/dataset"] = 3000,
["Inflation/US-GDP/startyear"] = 3000,
["Inflation/US/dataset"] = 16000,
["Inflation/US/startyear"] = 16000,
["Inflation/fn"] = 7500,
["Inflation/year"] = 34000,
["Info"] = 5600,
["Infobox"] = 3420000,
["Infobox/Columns"] = 3300,
["Infobox/mobileviewfix.css"] = 175000,
["Infobox/styles-images.css"] = 20000,
["Infobox3cols"] = 28000,
["Infobox_AFL_biography"] = 15000,
["Infobox_Athletics_Championships"] = 3400,
["Infobox_Australian_place"] = 15000,
["Infobox_Australian_place/styles.css"] = 15000,
["Infobox_Australian_place/table"] = 11000,
["Infobox_COA_wide"] = 3700,
["Infobox_Canada_electoral_district"] = 2700,
["Infobox_Chinese"] = 23000,
["Infobox_Chinese/Chinese"] = 3200,
["Infobox_Chinese/Footer"] = 7200,
["Infobox_Chinese/Header"] = 7200,
["Infobox_Christian_leader"] = 23000,
["Infobox_French_commune"] = 38000,
["Infobox_French_subdivision"] = 2200,
["Infobox_Gaelic_games_biography"] = 5500,
["Infobox_Gaelic_games_player"] = 3000,
["Infobox_German_location"] = 11000,
["Infobox_German_place"] = 14000,
["Infobox_Grand_Prix_race_report"] = 2200,
["Infobox_Greece_place"] = 3600,
["Infobox_Greek_Dimos"] = 2900,
["Infobox_Hindu_temple"] = 2900,
["Infobox_Indian_constituency"] = 5800,
["Infobox_Indian_constituency/defaultdata"] = 5800,
["Infobox_Italian_comune"] = 8100,
["Infobox_Korean"] = 2200,
["Infobox_Korean/auto"] = 14000,
["Infobox_Korean/auto/categories"] = 14000,
["Infobox_Korean/base"] = 2300,
["Infobox_Korean/base/auto"] = 18000,
["Infobox_Korean/categories"] = 2200,
["Infobox_Korean_name"] = 2200,
["Infobox_Korean_name/auto"] = 14000,
["Infobox_Korean_television_name"] = 3400,
["Infobox_NASCAR_driver"] = 2400,
["Infobox_NASCAR_race_report"] = 2700,
["Infobox_NCAA_basketball_conference_tournament"] = 2100,
["Infobox_NCAA_team_season"] = 10000,
["Infobox_NFL_biography"] = 27000,
["Infobox_NFL_team_season"] = 2300,
["Infobox_NRHP"] = 74000,
["Infobox_NRHP/conv"] = 19000,
["Infobox_NRHP/locmapin2region"] = 68000,
["Infobox_Olympic_event"] = 8100,
["Infobox_Olympic_event/event_link"] = 8100,
["Infobox_Olympic_event/games_text"] = 8100,
["Infobox_Pan_American_Games_event"] = 2900,
["Infobox_Paralympic_event"] = 2900,
["Infobox_Paralympic_event/games_text"] = 2900,
["Infobox_Romanian_subdivision"] = 3200,
["Infobox_Russian_district"] = 2100,
["Infobox_Russian_inhabited_locality"] = 4700,
["Infobox_Russian_inhabited_locality/PosMapFS"] = 4200,
["Infobox_Russian_inhabited_locality/federal_subject"] = 4600,
["Infobox_SCOTUS_case"] = 4600,
["Infobox_SSSI"] = 2000,
["Infobox_Site_of_Special_Scientific_Interest"] = 2100,
["Infobox_Slovak_place"] = 3000,
["Infobox_Swiss_town"] = 2900,
["Infobox_Switzerland_municipality"] = 2900,
["Infobox_Turkey_place"] = 20000,
["Infobox_U.S._county"] = 3000,
["Infobox_U.S._county/district"] = 3000,
["Infobox_U.S._legislation"] = 2100,
["Infobox_UK_constituency"] = 2200,
["Infobox_UK_constituency/year"] = 2200,
["Infobox_UK_legislation"] = 6400,
["Infobox_UK_place"] = 27000,
["Infobox_UK_place/NoDialCode"] = 8200,
["Infobox_UK_place/NoPostCode"] = 3600,
["Infobox_UK_place/area"] = 2700,
["Infobox_UK_place/dens"] = 2300,
["Infobox_UK_place/dist"] = 2800,
["Infobox_UK_place/local"] = 27000,
["Infobox_UK_place/styles.css"] = 27000,
["Infobox_UNESCO_World_Heritage_Site"] = 2100,
["Infobox_UN_resolution"] = 2300,
["Infobox_US_Supreme_Court_case"] = 4800,
["Infobox_US_Supreme_Court_case/courts"] = 4800,
["Infobox_United_States_legislative_district"] = 2700,
["Infobox_United_States_legislative_district/representative"] = 2700,
["Infobox_Wikipedia_user"] = 12000,
["Infobox_academic"] = 27000,
["Infobox_aircraft"] = 13000,
["Infobox_aircraft/styles.css"] = 14000,
["Infobox_aircraft_occurrence"] = 2900,
["Infobox_airline"] = 4800,
["Infobox_airline/styles.css"] = 4800,
["Infobox_airport"] = 14000,
["Infobox_airport/datatable"] = 13000,
["Infobox_airport/styles.css"] = 14000,
["Infobox_album"] = 169000,
["Infobox_album/color"] = 208000,
["Infobox_album/link"] = 169000,
["Infobox_anatomy"] = 4500,
["Infobox_animanga/Footer"] = 7800,
["Infobox_animanga/Header"] = 7800,
["Infobox_animanga/Print"] = 6700,
["Infobox_animanga/Video"] = 5100,
["Infobox_architect"] = 4500,
["Infobox_artist"] = 35000,
["Infobox_artist_discography"] = 6500,
["Infobox_artwork"] = 16000,
["Infobox_automobile"] = 9300,
["Infobox_award"] = 16000,
["Infobox_badminton_player"] = 3300,
["Infobox_baseball_biography"] = 30000,
["Infobox_baseball_biography/style"] = 30000,
["Infobox_baseball_biography/styles.css"] = 30000,
["Infobox_baseball_team_season"] = 3300,
["Infobox_baseball_team_season/leagueseason"] = 3300,
["Infobox_baseball_team_season/season"] = 3300,
["Infobox_baseball_team_season/styles.css"] = 3300,
["Infobox_basketball_biography"] = 23000,
["Infobox_basketball_biography/style"] = 23000,
["Infobox_basketball_club"] = 3300,
["Infobox_basketball_club/styles.css"] = 3300,
["Infobox_beauty_pageant"] = 2200,
["Infobox_bilateral_relations"] = 5000,
["Infobox_bishop_styles"] = 2500,
["Infobox_body_of_water"] = 19000,
["Infobox_book"] = 63000,
["Infobox_book/styles.css"] = 63000,
["Infobox_boxer"] = 6500,
["Infobox_brand"] = 2200,
["Infobox_brand/styles.css"] = 2200,
["Infobox_bridge"] = 6800,
["Infobox_building"] = 34000,
["Infobox_bus_company"] = 2000,
["Infobox_cemetery"] = 2100,
["Infobox_character"] = 8400,
["Infobox_character/styles.css"] = 8500,
["Infobox_chess_biography"] = 4800,
["Infobox_chess_player"] = 3800,
["Infobox_church"] = 17000,
["Infobox_church/denomination"] = 17000,
["Infobox_church/font_color"] = 17000,
["Infobox_civil_conflict"] = 3200,
["Infobox_civilian_attack"] = 7700,
["Infobox_college_coach"] = 13000,
["Infobox_college_football_game"] = 2300,
["Infobox_college_football_player"] = 2600,
["Infobox_college_sports_team_season"] = 45000,
["Infobox_college_sports_team_season/link"] = 45000,
["Infobox_college_sports_team_season/name"] = 45000,
["Infobox_college_sports_team_season/succession"] = 45000,
["Infobox_college_sports_team_season/team"] = 45000,
["Infobox_comedian"] = 2200,
["Infobox_comic_book_title"] = 3200,
["Infobox_comics_character"] = 3500,
["Infobox_comics_creator"] = 3600,
["Infobox_comics_creator/styles.css"] = 3600,
["Infobox_company"] = 93000,
["Infobox_company/styles.css"] = 93000,
["Infobox_computing_device"] = 2600,
["Infobox_concert"] = 3900,
["Infobox_constituency"] = 7900,
["Infobox_country"] = 7200,
["Infobox_country/formernext"] = 6700,
["Infobox_country/imagetable"] = 5700,
["Infobox_country/multirow"] = 9300,
["Infobox_country/status_text"] = 3100,
["Infobox_country/styles.css"] = 7300,
["Infobox_country_at_games"] = 17000,
["Infobox_country_at_games/core"] = 17000,
["Infobox_country_at_games/see_also"] = 14000,
["Infobox_court_case"] = 5300,
["Infobox_court_case/images"] = 2900,
["Infobox_court_case/styles.css"] = 5300,
["Infobox_cricket_tournament"] = 2800,
["Infobox_cricketer"] = 32000,
["Infobox_cricketer/career"] = 32000,
["Infobox_cricketer/national_side"] = 7700,
["Infobox_criminal"] = 7800,
["Infobox_curler"] = 2800,
["Infobox_cycling_race_report"] = 5000,
["Infobox_cyclist"] = 17000,
["Infobox_dam"] = 5900,
["Infobox_deity"] = 2300,
["Infobox_deity/color"] = 2300,
["Infobox_designation_list"] = 32000,
["Infobox_designation_list/entry"] = 23000,
["Infobox_dim"] = 6400,
["Infobox_diocese"] = 4100,
["Infobox_drug"] = 12000,
["Infobox_drug/chemical_formula"] = 12000,
["Infobox_drug/data_page_link"] = 12000,
["Infobox_drug/formatATC"] = 12000,
["Infobox_drug/formatCASnumber"] = 12000,
["Infobox_drug/formatChEBI"] = 12000,
["Infobox_drug/formatChEMBL"] = 12000,
["Infobox_drug/formatChemDBNIAID"] = 12000,
["Infobox_drug/formatChemSpider"] = 12000,
["Infobox_drug/formatCompTox"] = 12000,
["Infobox_drug/formatDrugBank"] = 12000,
["Infobox_drug/formatIUPHARBPS"] = 12000,
["Infobox_drug/formatJmol"] = 12000,
["Infobox_drug/formatKEGG"] = 12000,
["Infobox_drug/formatPDBligand"] = 11000,
["Infobox_drug/formatPubChemCID"] = 12000,
["Infobox_drug/formatPubChemSID"] = 12000,
["Infobox_drug/formatUNII"] = 12000,
["Infobox_drug/legal_status"] = 12000,
["Infobox_drug/licence"] = 12000,
["Infobox_drug/maintenance_categories"] = 12000,
["Infobox_drug/non-ref-space"] = 4000,
["Infobox_drug/pregnancy_category"] = 12000,
["Infobox_drug/styles.css"] = 12000,
["Infobox_drug/title"] = 12000,
["Infobox_economist"] = 2000,
["Infobox_election"] = 41000,
["Infobox_election/shortname"] = 2600,
["Infobox_election/styles.css"] = 41000,
["Infobox_enzyme"] = 5100,
["Infobox_ethnic_group"] = 8100,
["Infobox_event"] = 7800,
["Infobox_family"] = 2800,
["Infobox_field_hockey_player"] = 2600,
["Infobox_figure_skater"] = 4000,
["Infobox_film"] = 170000,
["Infobox_film/short_description"] = 166000,
["Infobox_film_awards"] = 3200,
["Infobox_film_awards/link"] = 3200,
["Infobox_film_awards/style"] = 3200,
["Infobox_film_or_theatre_festival"] = 2100,
["Infobox_food"] = 7700,
["Infobox_football_biography"] = 219000,
["Infobox_football_club"] = 30000,
["Infobox_football_club_season"] = 24000,
["Infobox_football_league"] = 2800,
["Infobox_football_league_season"] = 22000,
["Infobox_football_match"] = 6800,
["Infobox_football_tournament"] = 2200,
["Infobox_football_tournament_season"] = 9400,
["Infobox_former_subdivision"] = 3700,
["Infobox_former_subdivision/styles.css"] = 3700,
["Infobox_galaxy"] = 3400,
["Infobox_game"] = 3100,
["Infobox_game_score"] = 3800,
["Infobox_games"] = 2100,
["Infobox_gene"] = 13000,
["Infobox_given_name"] = 4100,
["Infobox_golfer"] = 4900,
["Infobox_golfer/highest_ranking"] = 4900,
["Infobox_government_agency"] = 13000,
["Infobox_government_cabinet"] = 3600,
["Infobox_gridiron_football_biography"] = 40000,
["Infobox_gridiron_football_biography/position"] = 39000,
["Infobox_gridiron_football_team_season"] = 4100,
["Infobox_gymnast"] = 5900,
["Infobox_handball_biography"] = 5600,
["Infobox_historic_site"] = 22000,
["Infobox_holiday"] = 2200,
["Infobox_holiday/date"] = 2200,
["Infobox_horseraces"] = 2700,
["Infobox_hospital"] = 7000,
["Infobox_hospital/care_system"] = 7000,
["Infobox_hospital/lists"] = 7000,
["Infobox_hurling_championship"] = 2700,
["Infobox_ice_hockey_biography"] = 21000,
["Infobox_ice_hockey_player"] = 18000,
["Infobox_ice_hockey_team"] = 3300,
["Infobox_ice_hockey_team_season"] = 2200,
["Infobox_international_football_competition"] = 6800,
["Infobox_islands"] = 9700,
["Infobox_islands/area"] = 10000,
["Infobox_islands/density"] = 10000,
["Infobox_islands/length"] = 9700,
["Infobox_islands/styles.css"] = 9700,
["Infobox_journal"] = 10000,
["Infobox_journal/Abbreviation_search"] = 10000,
["Infobox_journal/Bluebook_check"] = 9900,
["Infobox_journal/Former_check"] = 9900,
["Infobox_journal/ISO_4_check"] = 9900,
["Infobox_journal/ISSN-eISSN"] = 9900,
["Infobox_journal/Indexing_search"] = 10000,
["Infobox_journal/MathSciNet_check"] = 9900,
["Infobox_journal/NLM_check"] = 9900,
["Infobox_journal/frequency"] = 9100,
["Infobox_journal/openaccess"] = 2700,
["Infobox_judoka"] = 2800,
["Infobox_lake"] = 3800,
["Infobox_language"] = 10000,
["Infobox_language/family-color"] = 12000,
["Infobox_language/genetic"] = 7000,
["Infobox_language/lingualist"] = 11000,
["Infobox_language/linguistlist"] = 10000,
["Infobox_language/ref"] = 7400,
["Infobox_law_enforcement_agency"] = 2200,
["Infobox_legislation"] = 2800,
["Infobox_legislative_district"] = 2300,
["Infobox_legislative_election"] = 2700,
["Infobox_legislative_election/row"] = 2600,
["Infobox_legislative_election/styles.css"] = 2700,
["Infobox_legislative_term"] = 2100,
["Infobox_legislature"] = 4400,
["Infobox_library"] = 2500,
["Infobox_lighthouse"] = 2600,
["Infobox_lighthouse/light"] = 2700,
["Infobox_locomotive"] = 5000,
["Infobox_magazine"] = 8300,
["Infobox_manner_of_address"] = 4200,
["Infobox_martial_artist"] = 6300,
["Infobox_martial_artist/record"] = 6300,
["Infobox_medal_templates"] = 478000,
["Infobox_medical_condition"] = 9900,
["Infobox_medical_condition_(new)"] = 6300,
["Infobox_medical_details"] = 2600,
["Infobox_medical_person"] = 2400,
["Infobox_militant_organization"] = 2200,
["Infobox_military_conflict"] = 28000,
["Infobox_military_installation"] = 11000,
["Infobox_military_person"] = 54000,
["Infobox_military_unit"] = 29000,
["Infobox_mine"] = 2300,
["Infobox_mineral"] = 2000,
["Infobox_mobile_phone"] = 2500,
["Infobox_mobile_phone/size"] = 2100,
["Infobox_mobile_phone/weight"] = 2200,
["Infobox_model"] = 2300,
["Infobox_monument"] = 2800,
["Infobox_mountain"] = 30000,
["Infobox_multi-sport_competition_event"] = 2800,
["Infobox_museum"] = 12000,
["Infobox_musical_artist"] = 131000,
["Infobox_musical_artist/hCard_class"] = 122000,
["Infobox_musical_composition"] = 3700,
["Infobox_name"] = 8800,
["Infobox_name_module"] = 9500,
["Infobox_newspaper"] = 11000,
["Infobox_newspaper/styles.css"] = 11000,
["Infobox_noble"] = 7800,
["Infobox_officeholder"] = 281000,
["Infobox_officeholder/office"] = 288000,
["Infobox_official_post"] = 9900,
["Infobox_organization"] = 43000,
["Infobox_pageant_titleholder"] = 3100,
["Infobox_park"] = 9900,
["Infobox_person"] = 623000,
["Infobox_person/Wikidata"] = 5000,
["Infobox_person/height"] = 116000,
["Infobox_person/length"] = 7700,
["Infobox_person/weight"] = 74000,
["Infobox_philosopher"] = 3800,
["Infobox_planet"] = 4800,
["Infobox_play"] = 4600,
["Infobox_political_party"] = 16000,
["Infobox_power_station"] = 3400,
["Infobox_prepared_food"] = 2500,
["Infobox_professional_wrestler"] = 4800,
["Infobox_professional_wrestling_event"] = 3400,
["Infobox_protected_area"] = 15000,
["Infobox_protein_family"] = 2200,
["Infobox_publisher"] = 2600,
["Infobox_racehorse"] = 6000,
["Infobox_racing_driver"] = 5900,
["Infobox_racing_driver_series_section"] = 2900,
["Infobox_radio_station"] = 22000,
["Infobox_radio_station/styles.css"] = 22000,
["Infobox_rail"] = 3200,
["Infobox_rail_line"] = 8100,
["Infobox_rail_service"] = 3300,
["Infobox_reality_competition_season"] = 4300,
["Infobox_record_label"] = 4200,
["Infobox_recurring_event"] = 8100,
["Infobox_religious_biography"] = 7200,
["Infobox_religious_building"] = 15000,
["Infobox_religious_building/color"] = 21000,
["Infobox_restaurant"] = 4700,
["Infobox_river"] = 32000,
["Infobox_river/calcunit"] = 32000,
["Infobox_river/discharge"] = 32000,
["Infobox_river/row-style"] = 32000,
["Infobox_river/source"] = 32000,
["Infobox_road"] = 25000,
["Infobox_road/meta/mask/category"] = 24000,
["Infobox_road/meta/mask/country"] = 25000,
["Infobox_road/styles.css"] = 26000,
["Infobox_road_small"] = 2500,
["Infobox_rockunit"] = 6500,
["Infobox_royalty"] = 26000,
["Infobox_royalty/short_description"] = 8800,
["Infobox_rugby_biography"] = 19000,
["Infobox_rugby_biography/correct_date"] = 19000,
["Infobox_rugby_biography/depcheck"] = 19000,
["Infobox_rugby_league_biography"] = 11000,
["Infobox_rugby_league_biography/PLAYER"] = 11000,
["Infobox_rugby_team"] = 2700,
["Infobox_sailboat_specifications"] = 2300,
["Infobox_saint"] = 5500,
["Infobox_school"] = 40000,
["Infobox_school/short_description"] = 40000,
["Infobox_school/styles.css"] = 40000,
["Infobox_school_district"] = 6500,
["Infobox_school_district/styles.css"] = 6500,
["Infobox_scientist"] = 57000,
["Infobox_settlement"] = 597000,
["Infobox_settlement/areadisp"] = 259000,
["Infobox_settlement/columns"] = 108000,
["Infobox_settlement/columns/styles.css"] = 108000,
["Infobox_settlement/densdisp"] = 457000,
["Infobox_settlement/lengthdisp"] = 182000,
["Infobox_settlement/link"] = 108000,
["Infobox_settlement/styles.css"] = 597000,
["Infobox_ship"] = 43000,
["Infobox_ship/career"] = 39000,
["Infobox_ship/characteristics"] = 43000,
["Infobox_ship/class_overview"] = 4400,
["Infobox_ship/image"] = 42000,
["Infobox_ship/service_record"] = 2500,
["Infobox_shopping_mall"] = 3800,
["Infobox_short_story"] = 2700,
["Infobox_skier"] = 2700,
["Infobox_soap_character"] = 3100,
["Infobox_social_media_personality"] = 4400,
["Infobox_software"] = 14000,
["Infobox_software/simple"] = 15000,
["Infobox_song"] = 84000,
["Infobox_song/color"] = 84000,
["Infobox_song/link"] = 84000,
["Infobox_song_contest_national_year"] = 2000,
["Infobox_song_contest_national_year/Year"] = 2100,
["Infobox_spaceflight"] = 4100,
["Infobox_spaceflight/styles.css"] = 4100,
["Infobox_speed_skater"] = 2000,
["Infobox_sport_event"] = 2800,
["Infobox_sports_competition_event"] = 24000,
["Infobox_sports_competition_event/medalrow"] = 15000,
["Infobox_sports_league"] = 5700,
["Infobox_sports_season"] = 7000,
["Infobox_sports_team"] = 2300,
["Infobox_sportsperson"] = 160000,
["Infobox_stadium"] = 2600,
["Infobox_station"] = 58000,
["Infobox_station/services"] = 58000,
["Infobox_station/styles.css"] = 58000,
["Infobox_street"] = 4500,
["Infobox_swimmer"] = 11000,
["Infobox_television"] = 64000,
["Infobox_television/Short_description"] = 62000,
["Infobox_television/styles.css"] = 64000,
["Infobox_television_channel"] = 6700,
["Infobox_television_channel/styles.css"] = 6700,
["Infobox_television_episode"] = 13000,
["Infobox_television_episode/styles.css"] = 14000,
["Infobox_television_season"] = 11000,
["Infobox_television_station"] = 3200,
["Infobox_television_station/styles.css"] = 3300,
["Infobox_tennis_biography"] = 11000,
["Infobox_tennis_event"] = 3400,
["Infobox_tennis_tournament"] = 2000,
["Infobox_tennis_tournament/heading"] = 2000,
["Infobox_tennis_tournament/style"] = 2000,
["Infobox_tennis_tournament_event"] = 22000,
["Infobox_tennis_tournament_year"] = 11000,
["Infobox_tennis_tournament_year/color"] = 33000,
["Infobox_tennis_tournament_year/footer"] = 33000,
["Infobox_tournament_season"] = 13000,
["Infobox_train"] = 2600,
["Infobox_university"] = 26000,
["Infobox_user"] = 3000,
["Infobox_venue"] = 20000,
["Infobox_video_game"] = 30000,
["Infobox_video_game/styles.css"] = 30000,
["Infobox_volleyball_biography"] = 5900,
["Infobox_weapon"] = 8100,
["Infobox_weather_event"] = 3500,
["Infobox_weather_event/Effects"] = 3300,
["Infobox_weather_event/Footer"] = 3400,
["Infobox_weather_event/History"] = 3300,
["Infobox_weather_event/SSHWS"] = 2000,
["Infobox_weather_event/meteorology"] = 3200,
["Infobox_weather_event/scale"] = 2100,
["Infobox_weather_event/styles.css"] = 3500,
["Infobox_website"] = 8300,
["Infobox_writer"] = 45000,
["Information"] = 98000,
["Information/styles.css"] = 98000,
["Inlang"] = 2400,
["Inline"] = 3800,
["Inline_block"] = 5400,
["Inprogress"] = 2600,
["Input_link"] = 32000,
["Instagram"] = 20000,
["InterSportStats"] = 5900,
["Interlanguage_link"] = 302000,
["Interlanguage_link_multi"] = 9400,
["International_Paralympic_Committee"] = 4300,
["International_football_primary_link"] = 3500,
["International_football_primary_style"] = 3600,
["International_football_secondary_style"] = 3400,
["Internet_Archive"] = 2200,
["Internet_Archive_SCOTUS_URL"] = 3300,
["Internet_Archive_author"] = 19000,
["Internet_Archive_film"] = 2600,
["Intitle"] = 22000,
["Ip"] = 2100,
["Iptalk"] = 18000,
["IranCensus2006"] = 29000,
["IranNCSGN"] = 3100,
["Iran_Census_2006"] = 30000,
["Irish_place_name"] = 3000,
["IsIPAddress"] = 45000,
["IsValidPageName"] = 3400,
["Is_MLB_league"] = 3300,
["Is_NPB_league"] = 3300,
["Is_continent"] = 13000,
["Is_country_in_Central_America"] = 17000,
["Is_country_in_the_Caribbean"] = 17000,
["Is_interwiki_link"] = 6500,
["Is_italic_taxon"] = 654000,
["Is_redirect"] = 383000,
["Is_time"] = 6700,
["Is_valid_page_name"] = 3400,
["Isbn"] = 10000,
["Isnum"] = 3000,
["Isnumeric"] = 120000,
["Iso2continent"] = 84000,
["Iso2country"] = 26000,
["Iso2country/article"] = 25000,
["Iso2country/data"] = 26000,
["Issubst"] = 64000,
["Italic_dab2"] = 5900,
["Italic_disambiguation"] = 2400,
["Italic_title"] = 258000,
["Italic_title_prefixed"] = 8800,
["Italictitle"] = 3000,
["Ivmbox"] = 142000,
["Ivory_messagebox"] = 189000,
["Ivory_messagebox/styles.css"] = 189000,
["Module:I18n/complex_date"] = 48000,
["Module:IP"] = 148000,
["Module:IPA"] = 184000,
["Module:IPA/data"] = 166000,
["Module:IPA/styles.css"] = 151000,
["Module:IPA_symbol"] = 6800,
["Module:IPA_symbol/data"] = 6800,
["Module:IPAc-en"] = 56000,
["Module:IPAc-en/data"] = 56000,
["Module:IPAc-en/phonemes"] = 56000,
["Module:IPAc-en/pronunciation"] = 56000,
["Module:IPAddress"] = 253000,
["Module:ISO_3166"] = 910000,
["Module:ISO_3166/data/AT"] = 2500,
["Module:ISO_3166/data/BA"] = 3400,
["Module:ISO_3166/data/CA"] = 2600,
["Module:ISO_3166/data/CH"] = 4200,
["Module:ISO_3166/data/CN"] = 2800,
["Module:ISO_3166/data/CZ"] = 6600,
["Module:ISO_3166/data/DE"] = 15000,
["Module:ISO_3166/data/ES"] = 3700,
["Module:ISO_3166/data/FR"] = 38000,
["Module:ISO_3166/data/GB"] = 7200,
["Module:ISO_3166/data/GR"] = 3500,
["Module:ISO_3166/data/IN"] = 29000,
["Module:ISO_3166/data/IR"] = 24000,
["Module:ISO_3166/data/IT"] = 2500,
["Module:ISO_3166/data/National"] = 910000,
["Module:ISO_3166/data/PL"] = 7600,
["Module:ISO_3166/data/RS"] = 3200,
["Module:ISO_3166/data/RU"] = 27000,
["Module:ISO_3166/data/UA"] = 2200,
["Module:ISO_3166/data/US"] = 87000,
["Module:ISO_639_name"] = 34000,
["Module:ISO_639_name/ISO_639-1"] = 29000,
["Module:ISO_639_name/ISO_639-2"] = 21000,
["Module:ISO_639_name/ISO_639-2B"] = 20000,
["Module:ISO_639_name/ISO_639-3"] = 20000,
["Module:ISO_639_name/ISO_639-3_(dep)"] = 34000,
["Module:ISO_639_name/ISO_639-5"] = 19000,
["Module:ISO_639_name/ISO_639_deprecated"] = 34000,
["Module:ISO_639_name/ISO_639_name_to_code"] = 4600,
["Module:ISO_639_name/ISO_639_override"] = 34000,
["Module:ISOdate"] = 48000,
["Module:Ice_hockey_box"] = 2000,
["Module:Icon"] = 678000,
["Module:Icon/data"] = 678000,
["Module:Icon_box"] = 261000,
["Module:Icon_box/data"] = 261000,
["Module:If_any_equal"] = 254000,
["Module:If_empty"] = 6750000,
["Module:If_in_category"] = 164000,
["Module:If_in_page"] = 22000,
["Module:If_not_given_or_empty"] = 90000,
["Module:If_preview"] = 1780000,
["Module:If_preview/configuration"] = 1780000,
["Module:If_preview/styles.css"] = 1780000,
["Module:In_lang"] = 389000,
["Module:Indent"] = 2300,
["Module:Infobox"] = 4690000,
["Module:Infobox/dates"] = 78000,
["Module:Infobox/styles.css"] = 4960000,
["Module:Infobox/utilities"] = 2600,
["Module:Infobox3cols"] = 321000,
["Module:InfoboxBuilder"] = 2600,
["Module:InfoboxImage"] = 5620000,
["Module:InfoboxImage/data"] = 3360000,
["Module:Infobox_body_of_water_tracking"] = 19000,
["Module:Infobox_cyclist_tracking"] = 17000,
["Module:Infobox_dim"] = 380000,
["Module:Infobox_dim/data"] = 233000,
["Module:Infobox_election"] = 42000,
["Module:Infobox_gene"] = 13000,
["Module:Infobox_gene/orthologs"] = 13000,
["Module:Infobox_mapframe"] = 1680000,
["Module:Infobox_military_conflict"] = 28000,
["Module:Infobox_military_conflict/styles.css"] = 28000,
["Module:Infobox_multi-lingual_name"] = 23000,
["Module:Infobox_multi-lingual_name/data"] = 23000,
["Module:Infobox_power_station"] = 3400,
["Module:Infobox_road"] = 26000,
["Module:Infobox_road/browselinks"] = 26000,
["Module:Infobox_road/errors"] = 25000,
["Module:Infobox_road/length"] = 26000,
["Module:Infobox_road/locations"] = 25000,
["Module:Infobox_road/map"] = 25000,
["Module:Infobox_road/route"] = 26000,
["Module:Infobox_road/sections"] = 25000,
["Module:Infobox_ship"] = 43000,
["Module:Infobox_ship/data"] = 43000,
["Module:Infobox_ship/styles.css"] = 43000,
["Module:Infobox_television"] = 64000,
["Module:Infobox_television_disambiguation_check"] = 72000,
["Module:Infobox_television_episode"] = 13000,
["Module:Infobox_television_season_disambiguation_check"] = 10000,
["Module:Infobox_television_season_name"] = 11000,
["Module:Internet_Archive"] = 22000,
["Module:Is_article"] = 2400,
["Module:Is_infobox_in_lead"] = 462000,
["Module:Is_instance"] = 354000,
["Module:Iso2nationality"] = 96000,
["Module:Italic_title"] = 1260000,
["Module:Italic_title2"] = 5900,
}
f59r1v4rv06727mvk0ay21dkv2ts0ev
Módulo:Citation/CS1/Configuration
828
7642
74988
74400
2026-08-11T19:05:25Z
en>Trappist the monk
0
synch from sandbox;
74988
Scribunto
text/plain
local lang_obj = mw.getContentLanguage(); -- make a language object for the local language; used here for languages and dates
--[[--------------------------< S E T T I N G S >--------------------------------------------------------------
boolean settings used to control various things. these setting located here to make them easy to find
]]
-- these settings local to this module only
local local_digits_from_mediawiki = false; -- for i18n; when true, module fills date_names['local_digits'] from MediaWiki; manual fill required else; always false at en.wiki
-- these settings exported to other modules
local use_identifier_redirects = true; -- when true use redirect name for identifier label links; always true at en.wiki
local local_lang_cat_enable = false; -- when true categorizes pages where |language=<local wiki's language>; always false at en.wiki
local date_name_auto_xlate_enable = false; -- when true translates English month-names to the local-wiki's language month names; always false at en.wiki
local date_digit_auto_xlate_enable = false; -- when true translates Western date digit to the local-wiki's language digits (date_names['local_digits']); always false at en.wiki
local enable_sort_keys = true; -- when true module adds namespace sort keys to error and maintenance category links
local suppress_archive_today_urls = true; -- when true module suppresses all parameters with an archive.today url and any deprendent parameters
--[[--------------------------< U N C A T E G O R I Z E D _ N A M E S P A C E S >------------------------------
List of namespaces identifiers for namespaces that will not be included in citation error categories.
Same as setting notracking = true by default.
For wikis that have a current version of Module:cs1 documentation support, this #invoke will return an unordered
list of namespace names and their associated identifiers:
{{#invoke:cs1 documentation support|uncategorized_namespace_lister|all=<anything>}}
]]
local uncategorized_namespaces_t = {[2]=true}; -- init with user namespace id
for k, _ in pairs (mw.site.talkNamespaces) do -- add all talk namespace ids
uncategorized_namespaces_t[k] = true;
end
local uncategorized_subpages = {'/[Ss]andbox', '/[Tt]estcases', '/[^/]*[Ll]og', '/[Aa]rchive'}; -- list of Lua patterns found in page names of pages we should not categorize
--[[
at en.wiki Greek characters are used as sort keys for certain items in a category so that those items are
placed at the end of a category page. See Wikipedia:Categorization#Sort_keys. That works well for en.wiki
because English is written using the Latn script. This may not work well for other languages. At en.wiki it
is desireable to place content from certain namespaces at the end of a category listing so the module adds sort
keys to error and maintenance category links when rendering a cs1|2 template on a page in that namespace.
i18n: if this does not work well for your language, set <enable_sort_keys> to false.
]]
local name_space_sort_keys = { -- sort keys to be used with these namespaces:
[4] = 'ω', -- wikipedia; omega
[10] = 'τ', -- template; tau
[118] = 'Δ', -- draft; delta
['other'] = 'ο', -- all other non-talk namespaces except main (article); omicron
}
--[[--------------------------< M E S S A G E S >--------------------------------------------------------------
Translation table
The following contains fixed text that may be output as part of a citation.
This is separated from the main body to aid in future translations of this
module.
]]
local messages = {
['agency'] = '$1 $2', -- $1 is sepc, $2 is agency
['archived-dead'] = 'Archived from $1 on $2',
['archived-live'] = '$1 from the original on $2',
['archived-unfit'] = 'Archived from the original on $1',
['archived'] = 'Archived',
['by'] = 'By', -- contributions to authored works: introduction, foreword, afterword
['cartography'] = 'Cartography by $1',
['collaboration'] = '$1 ($2)', -- $1 is author with et al, $2 is collaboration
['editor'] = 'ed.',
['editors'] = 'eds.',
['edition'] = '($1 ed.)',
['episode'] = 'Episode $1',
['et al'] = 'et al.',
['in'] = 'In', -- edited works
['inactive'] = ' (inactive $1)', -- $1 is date which the doi was found to be broken in
['inset'] = '$1 inset',
['interview'] = 'Interviewed by $1',
invisible_1 = '$1 $2', -- $1 stripmarker name; $2 is text from <invisible_chars[1]>
invisible_2 = '$1 character', -- $1 character name from <invisible_chars[1]>
['mismatch'] = '<code class="cs1-code">|$1=</code> / <code class="cs1-code">|$2=</code> mismatch', -- $1 is year param name; $2 is date param name
['newsgroup'] = '[[Usenet newsgroup|Newsgroup]]: $1',
['notitle'] = 'No title', -- for |title=(()) and (in the future) |title=none
['original'] = 'the original',
['origdate'] = ' [$1]',
['published'] = ' (published $1)',
['retrieved'] = 'Retrieved $1',
['season'] = 'Season $1',
['section'] = '§ $1',
['sections'] = '§§ $1',
['series'] = '$1 $2', -- $1 is sepc, $2 is series
['seriesnum'] = 'Series $1',
['translated'] = 'Translated by $1',
['type'] = ' ($1)', -- for titletype
wikidata = 'Wikidata', -- these used for interwikilinked author/editor/... names
wikipedia = 'Wikipedia',
wikisource = 'Wikisource',
['written'] = 'Written at $1',
['vol'] = '$1 Vol. $2', -- $1 is sepc; bold journal style volume is in presentation{}
['vol-no'] = '$1 Vol. $2, no. $3', -- sepc, volume, issue (alternatively insert $1 after $2, but then we'd also have to change capitalization)
['issue'] = '$1 No. $2', -- $1 is sepc
['art'] = '$1 Art. $2', -- $1 is sepc; for {{cite conference}} only
['vol-art'] = '$1 Vol. $2, art. $3', -- sepc, volume, article-number; for {{cite conference}} only
['j-vol'] = '$1 $2', -- sepc, volume; bold journal volume is in presentation{}
['j-issue'] = ' ($1)',
['j-article-num'] = ' $1', -- TODO: any punctuation here? static text?
['nopp'] = '$1 $2'; -- page(s) without prefix; $1 is sepc
['p-prefix'] = "$1 p. $2", -- $1 is sepc
['pp-prefix'] = "$1 pp. $2", -- $1 is sepc
['j-page(s)'] = ': $1', -- same for page and pages
['sheet'] = '$1 Sheet $2', -- $1 is sepc
['sheets'] = '$1 Sheets $2', -- $1 is sepc
['j-sheet'] = ': Sheet $1',
['j-sheets'] = ': Sheets $1',
['language'] = '(in $1)',
['via'] = " – via $1",
['event'] = 'Event occurs at',
['minutes'] = ' $1 minutes in', -- $1 is the number of minutes
-- Determines the location of the help page
['help page link'] = 'Help:CS1 errors',
['help page label'] = 'help',
-- categories
['cat wikilink'] = '[[Category:$1]]', -- $1 is the category name
['cat wikilink sk'] = '[[Category:$1|$2]]', -- $1 is the category name; $2 is namespace sort key
[':cat wikilink'] = '[[:Category:$1|link]]', -- category name as maintenance message wikilink; $1 is the category name
-- Internal errors (should only occur if configuration is bad)
['undefined_error'] = 'Called with an undefined error condition',
['unknown_ID_key'] = 'Unrecognized ID key: ', -- an ID key in id_handlers not found in ~/Identifiers func_map{}
['unknown_ID_access'] = 'Unrecognized ID access keyword: ', -- an ID access keyword in id_handlers not found in keywords_lists['id-access']{}
['unknown_argument_map'] = 'Argument map not defined for this variable',
['bare_url_no_origin'] = 'Bare URL found but origin indicator is nil or empty',
['warning_msg_e'] = '<span style="color:#d33"><code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code>: this [[#$2|reference]] has errors</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link; $2 is anchor ID
['warning_msg_m'] = '<span style="color:#085"><code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code>: this [[#$2|reference]] has maintenance messages</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link; $2 is anchor ID
}
--[[--------------------------< C I T A T I O N _ C L A S S _ M A P >------------------------------------------
this table maps the value assigned to |CitationClass= in the cs1|2 templates to the canonical template name when
the value assigned to |CitationClass= is different from the canonical template name. |CitationClass= values are
used as class attributes in the <cite> tag that encloses the citation so these names may not contain spaces while
the canonical template name may. These names are used in warning_msg_e and warning_msg_m to create links to the
template's documentation when an article is displayed in preview mode.
]]
local citation_class_map_t = { -- TODO: in Module:Cite/config write a function to use this table
arxiv = 'cite arXiv', -- as the source for known_templates_t and citation_classes_t
['audio-visual'] = 'cite AV media',
['AV-media-notes'] = 'cite AV media notes',
biorxiv = 'cite bioRxiv',
book = 'cite book',
citation = 'citation',
citeseerx = 'cite CiteSeerX',
conference = 'cite conference',
document = 'cite document',
encyclopaedia = 'cite encyclopedia',
episode = 'cite episode',
interview = 'cite interview',
journal = 'cite journal',
magazine = 'cite magazine',
mailinglist = 'cite mailing list',
map = 'cite map',
medrxiv = 'cite medRxiv',
news = 'cite news',
newsgroup = 'cite newsgroup',
podcast = 'cite podcast',
pressrelease = 'cite press release',
report = 'cite report',
serial = 'cite serial',
sign = 'cite sign',
speech = 'cite speech',
ssrn = 'cite SSRN',
techreport = 'cite tech report',
thesis = 'cite thesis',
web = 'cite web',
}
--[=[-------------------------< E T _ A L _ P A T T E R N S >--------------------------------------------------
This table provides Lua patterns for the phrase "et al" and variants in name text
(author, editor, etc.). The main module uses these to identify and emit the 'etal' message.
]=]
local et_al_patterns = {
"[;,]? *[\"']*%f[%a][Ee][Tt]%.? *[Aa][Ll][%.;,\"']*$", -- variations on the 'et al' theme
"[;,]? *[\"']*%f[%a][Ee][Tt]%.? *[Aa][Ll][Ii][AaIi][Ee]?[%.;,\"']*$", -- variations on the 'et alia', 'et alii' and 'et aliae' themes (false positive 'et aliie' unlikely to match)
"[;,]? *%f[%a]and [Oo]thers", -- an alternative to et al.
"%[%[ *[Ee][Tt]%.? *[Aa][Ll]%.? *%]%]", -- a wikilinked form
"%(%( *[Ee][Tt]%.? *[Aa][Ll]%.? *%)%)", -- a double-bracketed form (to counter partial removal of ((...)) syntax)
"[%(%[] *[Ee][Tt]%.? *[Aa][Ll]%.? *[%)%]]", -- a bracketed form
}
--[[--------------------------< P R E S E N T A T I O N >------------------------
Fixed presentation markup. Originally part of citation_config.messages it has
been moved into its own, more semantically correct place.
]]
local presentation =
{
-- .citation-comment class is specified at Help:CS1_errors#Controlling_error_message_display
['hidden-error'] = '<span class="cs1-hidden-error citation-comment">$1</span>',
['visible-error'] = '<span class="cs1-visible-error citation-comment">$1</span>',
['hidden-maint'] = '<span class="cs1-maint citation-comment">$1</span>',
['accessdate'] = '<span class="reference-accessdate">$1$2</span>', -- to allow editors to hide accessdate using personal CSS
['bdi'] = '<bdi$1>$2</bdi>', -- bidirectional isolation used with |script-title= and the like
['cite'] = '<cite class="$1">$2</cite>'; -- for use when citation does not have a namelist and |ref= not set so no id="..." attribute
['cite-id'] = '<cite id="$1" class="$2">$3</cite>'; -- for use when when |ref= is set or when citation has a namelist
['format'] = ' <span class="cs1-format">($1)</span>', -- for |format=, |chapter-format=, etc.
['interwiki'] = ' <span class="cs1-format">[in $1]</span>', -- for interwiki-language-linked author, editor, etc
['interproj'] = ' <span class="cs1-format">[at $1]</span>', -- for interwiki-project-linked author, editor, etc (:d: and :s: supported; :w: ignored)
-- various access levels, for |access=, |doi-access=, |arxiv=, ...
-- narrow no-break space   may work better than nowrap CSS. Or not? Browser support?
['ext-link-access-signal'] = '<span class="$1" title="$2">$3</span>', -- external link with appropriate lock icon
['free'] = {class='id-lock-free', title='Freely accessible'}, -- classes defined in Module:Citation/CS1/styles.css
['registration'] = {class='id-lock-registration', title='Free registration required'},
['limited'] = {class='id-lock-limited', title='Free access subject to limited trial, subscription normally required'},
['subscription'] = {class='id-lock-subscription', title='Paid subscription required'},
['interwiki-icon'] = '<span class="$1" title="$2">$3</span>',
['class-wikisource'] = 'cs1-ws-icon',
['italic-title'] = "''$1''",
['kern-left'] = '<span class="cs1-kern-left"></span>$1', -- spacing to use when title contains leading single or double quote mark
['kern-right'] = '$1<span class="cs1-kern-right"></span>', -- spacing to use when title contains trailing single or double quote mark
['nowrap1'] = '<span class="nowrap">$1</span>', -- for nowrapping an item: <span ...>yyyy-mm-dd</span>
['nowrap2'] = '<span class="nowrap">$1</span> $2', -- for nowrapping portions of an item: <span ...>dd mmmm</span> yyyy (note white space)
['ocins'] = '<span title="$1" class="Z3988"></span>',
['parameter'] = '<code class="cs1-code">|$1=</code>',
['ps_cs1'] = '.'; -- CS1 style postscript (terminal) character
['ps_cs2'] = ''; -- CS2 style postscript (terminal) character (empty string)
['quoted-text'] = '<q>$1</q>', -- for wrapping |quote= content
['quoted-title'] = '"$1"',
['sep_cs1'] = '.', -- CS1 element separator
['sep_cs2'] = ',', -- CS2 separator
['sep_nl'] = ';', -- CS1|2 style name-list separator between names is a semicolon
['sep_nl_and'] = ' and ', -- used as last nl sep when |name-list-style=and and list has 2 items
['sep_nl_end'] = '; and ', -- used as last nl sep when |name-list-style=and and list has 3+ names
['sep_name'] = ', ', -- CS1|2 style last/first separator is <comma><space>
['sep_nl_vanc'] = ',', -- Vancouver style name-list separator between authors is a comma
['sep_name_vanc'] = ' ', -- Vancouver style last/first separator is a space
['sep_list'] = ', ', -- used for |language= when list has 3+ items except for last sep which uses sep_list_end
['sep_list_pair'] = ' and ', -- used for |language= when list has 2 items
['sep_list_end'] = ', and ', -- used as last list sep for |language= when list has 3+ items
['trans-italic-title'] = "[''$1'']",
['trans-quoted-title'] = "[$1]", -- for |trans-title= and |trans-quote=
['vol-bold'] = '$1 <b>$2</b>', -- sepc, volume; for bold journal cites; for other cites ['vol'] in messages{}
}
--[[--------------------------< A L I A S E S >---------------------------------
Aliases table for commonly passed parameters.
Parameter names on the right side in the assignments in this table must have been
defined in the Whitelist before they will be recognized as valid parameter names
]]
local aliases = {
['AccessDate'] = {'access-date', 'accessdate'}, -- Used by InternetArchiveBot
['Agency'] = 'agency',
['ArchiveDate'] = {'archive-date', 'archivedate'}, -- Used by InternetArchiveBot
['ArchiveFormat'] = 'archive-format',
['ArchiveURL'] = {'archive-url', 'archiveurl'}, -- Used by InternetArchiveBot
['ArticleNumber'] = 'article-number',
['ASINTLD'] = 'asin-tld',
['At'] = 'at', -- Used by InternetArchiveBot
['Authors'] = {'people', 'credits'},
['BookTitle'] = {'book-title', 'booktitle'},
['Cartography'] = 'cartography',
['Chapter'] = {'chapter', 'contribution', 'entry', 'article', 'section'},
['ChapterFormat'] = {'chapter-format', 'contribution-format', 'entry-format',
'article-format', 'section-format'};
['ChapterURL'] = {'chapter-url', 'contribution-url', 'entry-url', 'article-url', 'section-url'}, -- Used by InternetArchiveBot
['ChapterUrlAccess'] = {'chapter-url-access', 'contribution-url-access',
'entry-url-access', 'article-url-access', 'section-url-access'}, -- Used by InternetArchiveBot
['Class'] = 'class', -- cite arxiv and arxiv identifier
['Collaboration'] = 'collaboration',
['Conference'] = {'conference', 'event'},
['ConferenceFormat'] = 'conference-format',
['ConferenceURL'] = 'conference-url', -- Used by InternetArchiveBot
['Date'] = {'date', 'air-date', 'airdate'}, -- air-date and airdate for cite episode and cite serial only
['Degree'] = 'degree',
['DF'] = 'df',
['DisplayAuthors'] = {'display-authors', 'display-subjects'},
['DisplayContributors'] = 'display-contributors',
['DisplayEditors'] = 'display-editors',
['DisplayInterviewers'] = 'display-interviewers',
['DisplayTranslators'] = 'display-translators',
['Docket'] = 'docket',
['DoiBroken'] = 'doi-broken-date',
['Edition'] = 'edition',
['Embargo'] = 'pmc-embargo-date',
['Encyclopedia'] = {'encyclopedia', 'encyclopaedia', 'dictionary'}, -- cite encyclopedia only
['Episode'] = 'episode', -- cite serial only TODO: make available to cite episode?
['Format'] = 'format',
['ID'] = {'id', 'ID'},
['Inset'] = 'inset',
['Issue'] = {'issue', 'number'},
['Language'] = {'language', 'lang'},
['MailingList'] = {'mailing-list', 'mailinglist'}, -- cite mailing list only
['Map'] = 'map', -- cite map only
['MapFormat'] = 'map-format', -- cite map only
['MapURL'] = {'map-url', 'mapurl'}, -- cite map only -- Used by InternetArchiveBot
['MapUrlAccess'] = 'map-url-access', -- cite map only -- Used by InternetArchiveBot
['Minutes'] = 'minutes',
['Mode'] = 'mode',
['NameListStyle'] = 'name-list-style',
['Network'] = 'network',
['Newsgroup'] = 'newsgroup', -- cite newsgroup only
['NoPP'] = {'no-pp', 'nopp'},
['NoTracking'] = {'no-tracking', 'template-doc-demo'},
['Number'] = 'number', -- this case only for cite techreport
['OrigDate'] = {'orig-date', 'orig-year', 'origyear'},
['Others'] = 'others',
['Page'] = {'page', 'p'}, -- Used by InternetArchiveBot
['Pages'] = {'pages', 'pp'}, -- Used by InternetArchiveBot
['Periodical'] = {'journal', 'magazine', 'newspaper', 'periodical', 'website', 'work'},
['Place'] = {'place', 'location'},
['PostScript'] = 'postscript',
['PublicationDate'] = {'publication-date', 'publicationdate'},
['PublicationPlace'] = {'publication-place', 'publicationplace'},
['PublisherName'] = {'publisher', 'institution'},
['Quote'] = {'quote', 'quotation'},
['QuotePage'] = 'quote-page',
['QuotePages'] = 'quote-pages',
['Ref'] = 'ref',
['Scale'] = 'scale',
['ScriptChapter'] = {'script-chapter', 'script-contribution', 'script-entry',
'script-article', 'script-section'},
['ScriptEncyclopedia'] = {'script-encyclopedia', 'script-encyclopaedia'}, -- cite encyclopedia only
['ScriptMap'] = 'script-map',
['ScriptPeriodical'] = {'script-journal', 'script-magazine', 'script-newspaper',
'script-periodical', 'script-website', 'script-work'},
['ScriptQuote'] = 'script-quote',
['ScriptTitle'] = 'script-title', -- Used by InternetArchiveBot
['Season'] = 'season',
['Sections'] = 'sections', -- cite map only
['Series'] = {'series', 'version'},
['SeriesLink'] = {'series-link', 'serieslink'},
['SeriesNumber'] = {'series-number', 'series-no'},
['Sheet'] = 'sheet', -- cite map only
['Sheets'] = 'sheets', -- cite map only
['Station'] = 'station',
['Time'] = 'time',
['TimeCaption'] = 'time-caption',
['Title'] = 'title', -- Used by InternetArchiveBot
['TitleLink'] = {'title-link', 'episode-link', 'episodelink'}, -- Used by InternetArchiveBot
['TitleNote'] = {'title-note', 'department'},
['TitleType'] = {'type', 'medium'},
['TransChapter'] = {'trans-article', 'trans-chapter', 'trans-contribution',
'trans-entry', 'trans-section'},
['Transcript'] = 'transcript',
['TranscriptFormat'] = 'transcript-format',
['TranscriptURL'] = 'transcript-url', -- Used by InternetArchiveBot
['TransEncyclopedia'] = {'trans-encyclopedia', 'trans-encyclopaedia'}, -- cite encyclopedia only
['TransMap'] = 'trans-map', -- cite map only
['TransPeriodical'] = {'trans-journal', 'trans-magazine', 'trans-newspaper',
'trans-periodical', 'trans-website', 'trans-work'},
['TransQuote'] = 'trans-quote',
['TransTitle'] = 'trans-title', -- Used by InternetArchiveBot
['URL'] = {'url', 'URL'}, -- Used by InternetArchiveBot
['UrlAccess'] = 'url-access', -- Used by InternetArchiveBot
['UrlStatus'] = 'url-status', -- Used by InternetArchiveBot
['Vauthors'] = 'vauthors',
['Veditors'] = 'veditors',
['Via'] = 'via',
['Volume'] = 'volume',
['Year'] = 'year',
['AuthorList-First'] = {"first#", "author-first#", "author#-first", "author-given#", "author#-given",
"subject-first#", "subject#-first", "subject-given#", "subject#-given",
"given#"},
['AuthorList-Last'] = {"last#", "author-last#", "author#-last", "author-surname#", "author#-surname",
"subject-last#", "subject#-last", "subject-surname#", "subject#-surname",
"author#", 'host#', "subject#", "surname#"},
['AuthorList-Link'] = {"author-link#", "author#-link", "subject-link#",
"subject#-link", "authorlink#", "author#link"},
['AuthorList-Mask'] = {"author-mask#", "author#-mask", "subject-mask#", "subject#-mask"},
['ContributorList-First'] = {'contributor-first#', 'contributor#-first',
'contributor-given#', 'contributor#-given'},
['ContributorList-Last'] = {'contributor-last#', 'contributor#-last',
'contributor-surname#', 'contributor#-surname', 'contributor#'},
['ContributorList-Link'] = {'contributor-link#', 'contributor#-link'},
['ContributorList-Mask'] = {'contributor-mask#', 'contributor#-mask'},
['EditorList-First'] = {"editor-first#", "editor#-first", "editor-given#", "editor#-given"},
['EditorList-Last'] = {"editor-last#", "editor#-last", "editor-surname#",
"editor#-surname", "editor#"},
['EditorList-Link'] = {"editor-link#", "editor#-link"},
['EditorList-Mask'] = {"editor-mask#", "editor#-mask"},
['InterviewerList-First'] = {'interviewer-first#', 'interviewer#-first',
'interviewer-given#', 'interviewer#-given'},
['InterviewerList-Last'] = {'interviewer-last#', 'interviewer#-last',
'interviewer-surname#', 'interviewer#-surname', 'interviewer#'},
['InterviewerList-Link'] = {'interviewer-link#', 'interviewer#-link'},
['InterviewerList-Mask'] = {'interviewer-mask#', 'interviewer#-mask'},
['TranslatorList-First'] = {'translator-first#', 'translator#-first',
'translator-given#', 'translator#-given'},
['TranslatorList-Last'] = {'translator-last#', 'translator#-last',
'translator-surname#', 'translator#-surname', 'translator#'},
['TranslatorList-Link'] = {'translator-link#', 'translator#-link'},
['TranslatorList-Mask'] = {'translator-mask#', 'translator#-mask'},
}
--[[--------------------------< D E P E N D E N C I E S _ T >--------------------------------------------------
a table of url-holding parameters upon which other parameters are dependent.
this table is used by has_archive_today_url() to suppress parameters that are dependant upon a url-holding parameter
that has as a value an archive.today (or alternate tld) url.
archive.today is deprecated at en.wiki; see Wikipedia:Requests_for_comment/Archive.is_RFC_5
]]
local url_dependency_map_t = { -- table of url-holding parameters and the meta-parameters that are dependent on them
['url'] = {'AccessDate', 'ArchiveURL', 'Format', 'UrlAccess'},
['archive-url'] = {'ArchiveDate', 'ArchiveFormat', 'UrlStatus'},
['archiveurl'] = {'ArchiveDate', 'ArchiveFormat', 'UrlStatus'},
['article-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['chapter-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['conference-url'] = {'ConferenceFormat'},
['contribution-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['entry-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['map-url'] = {'MapFormat', 'MapUrlAccess'},
['section-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['transcript-url'] = {'TranscriptFormat'},
};
local dependencies_t = {}; -- the table of url-holding parameters and their dependent parameters
for url_param, meta_parameters_t in pairs (url_dependency_map_t) do -- sequence of meta-parameters (indexes) into <aliases> table
local dependant_params_t = {}; -- collection of parameters that are dependent on this <url_param>
for _, meta_parameter in ipairs (meta_parameters_t) do -- for each <aliases> meta-parameter (index)
if 'string' == type (aliases[meta_parameter]) then -- for single parameter names (no aliases), <aliases[meta_parameter]> will be a string
table.insert (dependant_params_t, aliases[meta_parameter]); -- add to this <url_param>'s dependency sequence
else
for _, alias in ipairs (aliases[meta_parameter]) do -- for each alias in aliases[meta_parameter] (aliases['AccessDate'] for example)
table.insert (dependant_params_t, alias); -- add to this <url_param>'s dependency sequence
end
end
end
dependencies_t[url_param] = dependant_params_t; -- add the <url_param> and its dependent parameters
end
--[[--------------------------< P U N C T _ S K I P >---------------------------
builds a table of parameter names that the extraneous terminal punctuation check should not check.
]]
local punct_meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
'BookTitle', 'Chapter', 'ScriptChapter', 'ScriptTitle', 'Title', 'TransChapter', 'Transcript', 'TransMap', 'TransTitle', -- title-holding parameters
'AuthorList-Mask', 'ContributorList-Mask', 'EditorList-Mask', 'InterviewerList-Mask', 'TranslatorList-Mask', -- name-list mask may have name separators
'PostScript', 'Quote', 'ScriptQuote', 'TransQuote', 'Ref', -- miscellaneous
'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'MapURL', 'TranscriptURL', 'URL', -- URL-holding parameters
}
local url_meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'ID', 'MapURL', 'TranscriptURL', 'URL', -- parameters allowed to hold urls
'Page', 'Pages', 'At', 'QuotePage', 'QuotePages', -- insource locators allowed to hold urls
}
local function build_skip_table (skip_t, meta_params)
for _, meta_param in ipairs (meta_params) do -- for each meta parameter key
local params = aliases[meta_param]; -- get the parameter or the table of parameters associated with the meta parameter name
if 'string' == type (params) then
skip_t[params] = 1; -- just a single parameter
else
for _, param in ipairs (params) do -- get the parameter name
skip_t[param] = 1; -- add the parameter name to the skip table
local count;
param, count = param:gsub ('#', ''); -- remove enumerator marker from enumerated parameters
if 0 ~= count then -- if removed
skip_t[param] = 1; -- add param name without enumerator marker
end
end
end
end
return skip_t;
end
local punct_skip = {};
local url_skip = {};
--[[--------------------------< U R L _ A C C E S S _ M A P >--------------------------------------------------
this table used by the wikipedia library url test, has_twl_url(), which automatically sets a url-access parameter
to 'subscription' when it discovers a wikipedia library url in any of the url-holding paramters used as keys in
this table.
translators: if your wiki uses parameter names for these url-holding parameters and their matching -access parameters,
add your wiki's parameters to this list. Leave the English parameters in place.
TODO: is there a better way to do this?
]]
local url_access_map_t = {
['chapter-url'] = 'chapter-url-access',
['contribution-url'] = 'contribution-url-access',
['entry-url'] = 'entry-url-access',
['article-url'] = 'article-url-access',
['section-url'] = 'section-url-access',
['map-url'] = 'map-url-access',
['mapurl'] = 'map-url-access',
['url'] = 'url-access',
['URL'] = 'url-access'
}
--[[--------------------------< S I N G L E - L E T T E R S E C O N D - L E V E L D O M A I N S >----------
this is a list of tlds that are known to have single-letter second-level domain names. This list does not include
ccTLDs which are accepted in is_domain_name().
]]
local single_letter_2nd_lvl_domains_t = {'cash', 'company', 'foundation', 'media', 'org', 'today'};
--[[-----------< S P E C I A L C A S E T R A N S L A T I O N S >------------
This table is primarily here to support internationalization. Translations in
this table are used, for example, when an error message, category name, etc.,
is extracted from the English alias key. There may be other cases where
this translation table may be useful.
]]
local is_Latn = 'A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191';
local special_case_translation = {
author = 'author',
editor = 'editor',
name_list_params = '$1-name-list parameters', -- $1 is 'author' or 'editor'; used with err_redundant_parameters
['AuthorList'] = 'authors list', -- used to assemble maintenance category names
['ContributorList'] = 'contributors list', -- translation of these names plus translation of the base maintenance category names in maint_cats{} table below
['EditorList'] = 'editors list', -- must match the names of the actual categories
['InterviewerList'] = 'interviewers list', -- this group or translations used by name_has_ed_markup() and name_has_mult_names()
['TranslatorList'] = 'translators list',
-- Lua patterns to match pseudo-titles used by InternetArchiveBot and others as placeholder for unknown |title= value
['archived_copy'] = { -- used with CS1 maint: Archive[d] copy as title
['en'] = '^archived?%s+copy$', -- for English; translators: keep this because templates imported from en.wiki
['local'] = nil, -- translators: replace ['local'] = nil with lowercase translation only when bots or tools create generic titles in your language
},
-- Lua patterns to match generic titles; usually created by bots or reference filling tools
-- translators: replace ['local'] = nil with lowercase translation only when bots or tools create generic titles in your language
-- generic titles and patterns in this table should be lowercase only
-- leave ['local'] nil except when there is a matching generic title in your language
-- boolean 'true' for plain-text searches; 'false' for pattern searches
['generic_titles'] = {
['accept'] = {
},
['reject'] = {
{['en'] = {'^wayback%s+machine$', false}, ['local'] = nil},
{['en'] = {'are you a robot', true}, ['local'] = nil},
{['en'] = {'hugedomains', true}, ['local'] = nil},
{['en'] = {'^[%(%[{<]?no +title[>}%]%)]?$', false}, ['local'] = nil},
{['en'] = {'page not found', true}, ['local'] = nil},
{['en'] = {'subscribe to read', true}, ['local'] = nil},
{['en'] = {'^[%(%[{<]?unknown[>}%]%)]?$', false}, ['local'] = nil},
{['en'] = {'website is for sale', true}, ['local'] = nil},
{['en'] = {'^404', false}, ['local'] = nil},
{['en'] = {'error[ %-]404', false}, ['local'] = nil},
{['en'] = {'internet archive wayback machine', true}, ['local'] = nil},
{['en'] = {'log into facebook', true}, ['local'] = nil},
{['en'] = {'login • instagram', true}, ['local'] = nil},
{['en'] = {'redirecting...', true}, ['local'] = nil},
{['en'] = {'usurped title', true}, ['local'] = nil}, -- added by a GreenC bot
{['en'] = {'wayback machine', true}, ['local'] = nil},
{['en'] = {'webcite query result', true}, ['local'] = nil},
{['en'] = {'wikiwix\'s cache', true}, ['local'] = nil},
{['en'] = {'bot verification', true}, ['local'] = nil},
}
},
-- boolean 'true' for plain-text searches, search string must be lowercase only
-- boolean 'false' for pattern searches
-- leave ['local'] nil except when there is a matching generic name in your language
['generic_names'] = {
['accept'] = {
{['en'] = {'%[%[[^|]*%(author%) *|[^%]]*%]%]', false}, ['local'] = nil},
},
['reject'] = {
{['en'] = {'about us', true}, ['local'] = nil},
{['en'] = {'%f[%a][Aa]dvisor%f[%A]', false}, ['local'] = nil},
{['en'] = {'allmusic', true}, ['local'] = nil},
{['en'] = {'%f[%a][Aa]uthor%f[%A]', false}, ['local'] = nil},
{['en'] = {'^[Bb]ureau$', false}, ['local'] = nil},
{['en'] = {'business', true}, ['local'] = nil},
{['en'] = {'cnn', true}, ['local'] = nil},
{['en'] = {'collaborator', true}, ['local'] = nil},
{['en'] = {'^[Cc]ompany$', false}, ['local'] = nil},
{['en'] = {'contributor', true}, ['local'] = nil},
{['en'] = {'contact us', true}, ['local'] = nil},
{['en'] = {'correspondent', true}, ['local'] = nil},
{['en'] = {'^[Dd]esk$', false}, ['local'] = nil},
{['en'] = {'directory', true}, ['local'] = nil},
{['en'] = {'%f[%(%[][%(%[]%s*eds?%.?%s*[%)%]]?$', false}, ['local'] = nil},
{['en'] = {'[,%.%s]%f[e]eds?%.?$', false}, ['local'] = nil},
{['en'] = {'^eds?[%.,;]', false}, ['local'] = nil},
{['en'] = {'^[%(%[]%s*[Ee][Dd][Ss]?%.?%s*[%)%]]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]dited%f[%A]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]ditors?%f[%A]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]mail%f[%A]', false}, ['local'] = nil},
{['en'] = {'facebook', true}, ['local'] = nil},
{['en'] = {'google', true}, ['local'] = nil},
{['en'] = {'^[Gg]roup$', false}, ['local'] = nil},
{['en'] = {'home page', true}, ['local'] = nil},
{['en'] = {'^[Ii]nc%.?$', false}, ['local'] = nil},
{['en'] = {'instagram', true}, ['local'] = nil},
{['en'] = {'interviewer', true}, ['local'] = nil},
{['en'] = {'^[Ll]imited$', false}, ['local'] = nil},
{['en'] = {'linkedIn', true}, ['local'] = nil},
{['en'] = {'^[Nn]ews$', false}, ['local'] = nil},
{['en'] = {'[Nn]ews[ %-]?[Rr]oom', false}, ['local'] = nil},
{['en'] = {'pinterest', true}, ['local'] = nil},
{['en'] = {'policy', true}, ['local'] = nil},
{['en'] = {'privacy', true}, ['local'] = nil},
{['en'] = {'reuters', true}, ['local'] = nil},
{['en'] = {'translator', true}, ['local'] = nil},
{['en'] = {'tumblr', true}, ['local'] = nil},
{['en'] = {'twitter', true}, ['local'] = nil},
{['en'] = {'site name', true}, ['local'] = nil},
{['en'] = {'statement', true}, ['local'] = nil},
{['en'] = {'submitted', true}, ['local'] = nil},
{['en'] = {'super.?user', false}, ['local'] = nil},
{['en'] = {'%f['..is_Latn..'][Uu]ser%f[^'..is_Latn..']', false}, ['local'] = nil},
{['en'] = {'updated', true}, ['local'] = nil},
{['en'] = {'verfasser', true}, ['local'] = nil},
}
}
}
--[[--------------------------< D A T E _ N A M E S >----------------------------------------------------------
This table of tables lists local language date names and fallback English date names.
The code in Date_validation will look first in the local table for valid date names.
If date names are not found in the local table, the code will look in the English table.
Because citations can be copied to the local wiki from en.wiki, the English is
required when the date-name translation function date_name_xlate() is used.
In these tables, season numbering is defined by
Extended Date/Time Format (EDTF) Specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard
defines various divisions using numbers 21-41. CS1|2 only supports generic seasons.
EDTF does support the distinction between north and south hemisphere seasons
but CS1|2 has no way to make that distinction.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
The standard does not address 'named' dates so, for the purposes of CS1|2,
Easter and Christmas are defined here as 98 and 99, which should be out of the
ISO 8601 (EDTF) range of uses for a while.
local_date_names_from_mediawiki is a boolean. When set to:
true – module will fetch local month names from MediaWiki for both date_names['local']['long'] and date_names['local']['short']; this will unconditionally overwrite manual translations
false – module will *not* fetch local month names from MediaWiki
Caveat lector: There is no guarantee that MediaWiki will provide short month names. At your wiki you can test
the results of the MediaWiki fetch in the debug console with this command (the result is alpha sorted):
=mw.dumpObject (p.date_names['local'])
While the module can fetch month names from MediaWiki, it cannot fetch the quarter, season, and named date names
from MediaWiki. Those must be translated manually.
]]
local local_date_names_from_mediawiki = true; -- when false, manual translation required for date_names['local']['long'] and date_names['local']['short']; overwrites manual translations
-- when true, module fetches long and short month names from MediaWiki
local date_names = {
['en'] = { -- English
['long'] = {['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12},
['short'] = {['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12},
['quarter'] = {['First Quarter'] = 33, ['Second Quarter'] = 34, ['Third Quarter'] = 35, ['Fourth Quarter'] = 36},
['season'] = {['Winter'] = 24, ['Spring'] = 21, ['Summer'] = 22, ['Fall'] = 23, ['Autumn'] = 23},
['named'] = {['Easter'] = 98, ['Christmas'] = 99},
},
-- when local_date_names_from_mediawiki = false
['local'] = { -- replace these English date names with the local language equivalents
['long'] = {['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12},
['short'] = {['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12},
['quarter'] = {['First Quarter'] = 33, ['Second Quarter'] = 34, ['Third Quarter'] = 35, ['Fourth Quarter'] = 36},
['season'] = {['Winter'] = 24, ['Spring'] = 21, ['Summer'] = 22, ['Fall'] = 23, ['Autumn'] = 23},
['named'] = {['Easter'] = 98, ['Christmas'] = 99},
},
['inv_local_long'] = {}, -- used in date reformatting & translation; copy of date_names['local'].long where k/v are inverted: [1]='<local name>' etc.
['inv_local_short'] = {}, -- used in date reformatting & translation; copy of date_names['local'].short where k/v are inverted: [1]='<local name>' etc.
['inv_local_quarter'] = {}, -- used in date translation; copy of date_names['local'].quarter where k/v are inverted: [1]='<local name>' etc.
['inv_local_season'] = {}, -- used in date translation; copy of date_names['local'].season where k/v are inverted: [1]='<local name>' etc.
['inv_local_named'] = {}, -- used in date translation; copy of date_names['local'].named where k/v are inverted: [1]='<local name>' etc.
['local_digits'] = {['0'] = '0', ['1'] = '1', ['2'] = '2', ['3'] = '3', ['4'] = '4', ['5'] = '5', ['6'] = '6', ['7'] = '7', ['8'] = '8', ['9'] = '9'}, -- used to convert local language digits to Western 0-9
['xlate_digits'] = {},
}
if local_date_names_from_mediawiki then -- if fetching local month names from MediaWiki is enabled
local long_t = {};
local short_t = {};
for i=1, 12 do -- loop 12x and
local name = lang_obj:formatDate('F', '2022-' .. i .. '-1'); -- get long month name for each i
long_t[name] = i; -- save it
name = lang_obj:formatDate('M', '2022-' .. i .. '-1'); -- get short month name for each i
short_t[name] = i; -- save it
end
date_names['local']['long'] = long_t; -- write the long table – overwrites manual translation
date_names['local']['short'] = short_t; -- write the short table – overwrites manual translation
end
-- create inverted date-name tables for reformatting and/or translation
for _, invert_t in pairs {{'long', 'inv_local_long'}, {'short', 'inv_local_short'}, {'quarter', 'inv_local_quarter'}, {'season', 'inv_local_season'}, {'named', 'inv_local_named'}} do
for name, i in pairs (date_names['local'][invert_t[1]]) do -- this table is ['name'] = i
date_names[invert_t[2]][i] = name; -- invert to get [i] = 'name' for conversions from ymd
end
end
if local_digits_from_mediawiki then -- if fetching local digits from MediaWiki is enabled
local digits_t = {};
for i=0, 9 do -- loop 10x and
digits_t [lang_obj:formatNum (i)] = tostring (i); -- format the loop indexer as local lang table index and assign loop indexer (a string) as the value
end
date_names['local_digits'] = digits_t;
end
for ld, ed in pairs (date_names.local_digits) do -- make a digit translation table for simple date translation from en to local language using local_digits table
date_names.xlate_digits [ed] = ld; -- en digit becomes index with local digit as the value
end
local df_template_patterns = { -- table of redirects to {{Use dmy dates}} and {{Use mdy dates}}
'{{ *[Uu]se +(dmy) +dates *[|}]', -- 1159k -- sorted by approximate transclusion count
'{{ *[Uu]se +(mdy) +dates *[|}]', -- 212k
'{{ *[Uu]se +(MDY) +dates *[|}]', -- 788
'{{ *[Uu]se +(DMY) +dates *[|}]', -- 343
'{{ *([Mm]dy) *[|}]', -- 176
'{{ *[Uu]se *(dmy) *[|}]', -- 156 + 18
'{{ *[Uu]se *(mdy) *[|}]', -- 149 + 11
'{{ *([Dd]my) *[|}]', -- 56
'{{ *[Uu]se +(MDY) *[|}]', -- 5
'{{ *([Dd]MY) *[|}]', -- 3
'{{ *[Uu]se(mdy)dates *[|}]', -- 1
'{{ *[Uu]se +(DMY) *[|}]', -- 0
'{{ *([Mm]DY) *[|}]', -- 0
}
local title_object = mw.title.getCurrentTitle();
local content; -- done this way so that unused templates appear in unused-template-reports; self-transcluded makes them look like they are used
if 10 ~= title_object.namespace then -- all namespaces except Template
content = title_object:getContent() or ''; -- get the content of the article or ''; new pages edited w/ve do not have 'content' until saved; ve does not preview; phab:T221625
end
local function get_date_format ()
if not content then -- nil content when we're in template
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
for _, pattern in ipairs (df_template_patterns) do -- loop through the patterns looking for {{Use dmy dates}} or {{Use mdy dates}} or any of their redirects
local start, _, match = content:find(pattern); -- match is the three letters indicating desired date format
if match then
local use_dates_template = content:match ('%b{}', start); -- get the whole template
if use_dates_template:match ('| *cs1%-dates *= *[lsy][sy]?') then -- look for |cs1-dates=publication date length access-/archive-date length
return match:lower() .. '-' .. use_dates_template:match ('| *cs1%-dates *= *([lsy][sy]?)');
else
return match:lower() .. '-all'; -- no |cs1-dates= k/v pair; return value appropriate for use in |df=
end
end
end
end
--[[-----------------< V O L U M E , I S S U E , P A G E S >------------------
These tables hold cite class values (from the template invocation) and identify those templates that support
|volume=, |issue=, and |page(s)= parameters. Cite conference and cite map require further qualification which
is handled in the main module.
]]
local templates_using_volume = {'citation', 'audio-visual', 'book', 'conference', 'encyclopaedia', 'interview', 'journal', 'magazine', 'map', 'news', 'report', 'techreport', 'thesis'}
local templates_using_issue = {'citation', 'conference', 'episode', 'interview', 'journal', 'magazine', 'map', 'news', 'podcast'}
local templates_not_using_page = {'audio-visual', 'episode', 'mailinglist', 'newsgroup', 'podcast', 'serial', 'sign', 'speech'}
--[[
These tables control when it is appropriate for {{citation}} to render |volume= and/or |issue=. The parameter
names in the tables constrain {{citation}} so that its renderings match the renderings of the equivalent cs1
templates. For example, {{cite web}} does not support |volume= so the equivalent {{citation |website=...}} must
not support |volume=.
]]
local citation_no_volume_t = { -- {{citation}} does not render |volume= when these parameters are used
'website', 'mailinglist', 'script-website',
}
local citation_issue_t = { -- {{citation}} may render |issue= when these parameters are used
'journal', 'magazine', 'newspaper', 'periodical', 'work',
'script-journal', 'script-magazine', 'script-newspaper', 'script-periodical', 'script-work',
}
--[[
Patterns for finding extra text in |volume=, |issue=, |page=, |pages=
]]
local vol_iss_pg_patterns = {
good_ppattern = '^P[^%.PpGg]', -- OK to begin with uppercase P: P7 (page 7 of section P), but not p123 (page 123); TODO: this allows 'Pages' which it should not
bad_ppatterns = { -- patterns for |page= and |pages=
'^[Pp][PpGg]?%.?[ %d]',
'^[Pp][Pp]?%. ', -- from {{p.}} and {{pp.}} templates
'^[Pp]ages?',
'^[Pp]gs.?',
},
vi_patterns_t = { -- combined to catch volume-like text in |issue= and issue-like text in |volume=
'^volumes?', -- volume-like text
'^vols?[%.:=]?',
'^issues?', --issue-like text
'^iss[%.:=]?',
'^numbers?',
'^nos?%A', -- don't match 'november' or 'nostradamus'
'^nr[%.:=]?',
'^n[%.:= ]', -- might be a valid issue without separator (space char is sep char here)
'^n°', -- 'n' with degree sign (U+00B0)
'^№', -- precomposed unicode numero character (U+2116)
},
}
--[[--------------------------< K E Y W O R D S >-------------------------------
These tables hold keywords for those parameters that have defined sets of acceptable keywords.
]]
--[[-------------------< K E Y W O R D S T A B L E >--------------------------
this is a list of keywords; each key in the list is associated with a table of
synonymous keywords possibly from different languages.
for I18N: add local-language keywords to value table; do not change the key.
For example, adding the German keyword 'ja':
['affirmative'] = {'yes', 'true', 'y', 'ja'},
Because CS1|2 templates from en.wiki articles are often copied to other local wikis,
it is recommended that the English keywords remain in these tables.
]]
local keywords = {
['amp'] = {'&', 'amp', 'ampersand'}, -- |name-list-style=
['and'] = {'and', 'serial'}, -- |name-list-style=
['affirmative'] = {'yes', 'true', 'y'}, -- |no-tracking=, |no-pp= -- Used by InternetArchiveBot
['afterword'] = {'afterword'}, -- |contribution=
['bot: unknown'] = {'bot: unknown'}, -- |url-status= -- Used by InternetArchiveBot
['cs1'] = {'cs1'}, -- |mode=
['cs2'] = {'cs2'}, -- |mode=
['dead'] = {'dead', 'deviated'}, -- |url-status= -- Used by InternetArchiveBot
['dmy'] = {'dmy'}, -- |df=
['dmy-all'] = {'dmy-all'}, -- |df=
etal = {'etal'}, -- |display-authors=, etc
['foreword'] = {'foreword'}, -- |contribution=
['free'] = {'free'}, -- |<id>-access= -- Used by InternetArchiveBot
['harv'] = {'harv'}, -- |ref=; this no longer supported; is_valid_parameter_value() called with <invert> = true
['introduction'] = {'introduction'}, -- |contribution=
['limited'] = {'limited'}, -- |url-access= -- Used by InternetArchiveBot
['live'] = {'live'}, -- |url-status= -- Used by InternetArchiveBot
['mdy'] = {'mdy'}, -- |df=
['mdy-all'] = {'mdy-all'}, -- |df=
['none'] = {'none'}, -- |postscript=, |ref=, |title=, |type= -- Used by InternetArchiveBot
['off'] = {'off'}, -- |title= (potentially also: |title-link=, |postscript=, |ref=, |type=)
['preface'] = {'preface'}, -- |contribution=
['registration'] = {'registration'}, -- |url-access= -- Used by InternetArchiveBot
['subscription'] = {'subscription'}, -- |url-access= -- Used by InternetArchiveBot
['unfit'] = {'unfit'}, -- |url-status= -- Used by InternetArchiveBot
['usurped'] = {'usurped'}, -- |url-status= -- Used by InternetArchiveBot
['vanc'] = {'vanc'}, -- |name-list-style=
['ymd'] = {'ymd'}, -- |df=
['ymd-all'] = {'ymd-all'}, -- |df=
-- ['yMd'] = {'yMd'}, -- |df=; not supported at en.wiki
-- ['yMd-all'] = {'yMd-all'}, -- |df=; not supported at en.wiki
}
--[[------------------------< X L A T E _ K E Y W O R D S >---------------------
this function builds a list, keywords_xlate{}, of the keywords found in keywords{} where the values from keywords{}
become the keys in keywords_xlate{} and the keys from keywords{} become the values in keywords_xlate{}:
['affirmative'] = {'yes', 'true', 'y'}, -- in keywords{}
becomes
['yes'] = 'affirmative', -- in keywords_xlate{}
['true'] = 'affirmative',
['y'] = 'affirmative',
the purpose of this function is to act as a translator between a non-English keyword and its English equivalent
that may be used in other modules of this suite
]]
local function xlate_keywords ()
local out_table = {}; -- output goes here
for k, keywords_t in pairs (keywords) do -- spin through the keywords table
for _, keyword in ipairs (keywords_t) do -- for each keyword
out_table[keyword] = k; -- create an entry in the output table where keyword is the key
end
end
return out_table;
end
local keywords_xlate = xlate_keywords (); -- the list of translated keywords
--[[----------------< M A K E _ K E Y W O R D S _ L I S T >---------------------
this function assembles, for parameter-value validation, the list of keywords appropriate to that parameter.
keywords_lists{}, is a table of tables from keywords{}
]]
local function make_keywords_list (keywords_lists)
local out_table = {}; -- output goes here
for _, keyword_list in ipairs (keywords_lists) do -- spin through keywords_lists{} and get a table of keywords
for _, keyword in ipairs (keyword_list) do -- spin through keyword_list{} and add each keyword, ...
table.insert (out_table, keyword); -- ... as plain text, to the output list
end
end
return out_table;
end
--[[----------------< K E Y W O R D S _ L I S T S >-----------------------------
this is a list of lists of valid keywords for the various parameters in [key].
Generally the keys in this table are the canonical en.wiki parameter names though
some are contrived because of use in multiple differently named parameters:
['yes_true_y'], ['id-access'].
The function make_keywords_list() extracts the individual keywords from the
appropriate list in keywords{}.
The lists in this table are used to validate the keyword assignment for the
parameters named in this table's keys.
]]
local keywords_lists = {
['yes_true_y'] = make_keywords_list ({keywords.affirmative}),
['contribution'] = make_keywords_list ({keywords.afterword, keywords.foreword, keywords.introduction, keywords.preface}),
['df'] = make_keywords_list ({keywords.dmy, keywords['dmy-all'], keywords.mdy, keywords['mdy-all'], keywords.ymd, keywords['ymd-all']}),
-- ['df'] = make_keywords_list ({keywords.dmy, keywords['dmy-all'], keywords.mdy, keywords['mdy-all'], keywords.ymd, keywords['ymd-all'], keywords.yMd, keywords['yMd-all']}), -- not supported at en.wiki
['mode'] = make_keywords_list ({keywords.cs1, keywords.cs2}),
['name-list-style'] = make_keywords_list ({keywords.amp, keywords['and'], keywords.vanc}),
['ref'] = make_keywords_list ({keywords.harv}), -- inverted check; |ref=harv no longer supported
['url-access'] = make_keywords_list ({keywords.subscription, keywords.limited, keywords.registration}),
['url-status'] = make_keywords_list ({keywords.dead, keywords.live, keywords.unfit, keywords.usurped, keywords['bot: unknown']}),
['id-access'] = make_keywords_list ({keywords.free}),
}
--[[--------------------------< C S 1 _ C O N F I G _ G E T >--------------------------------------------------
fetch and validate values from {{cs1 config}} template to fill <global_cs1_config_t>
no error messages; when errors are detected, the parameter value from {{cs1 config}} is blanked.
Supports all parameters and aliases associated with the metaparameters: DisplayAuthors, DisplayContributors,
DisplayEditors, DisplayInterviewers, DisplayTranslators, NameListStyle, and Mode. The DisplayWhatever metaparameters
accept numeric values only (|display-authors=etal and the like is not supported).
]]
local global_cs1_config_t = {}; -- TODO: add value returned from get_date_format() to this table?
local function get_cs1_config ()
if not content then -- nil content when we're in template
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
local start = content:find('{{ *[Cc][Ss]1 config *[|}]'); -- <start> is offset into <content> when {{cs1 config}} found; nil else
if start then
local cs1_config_template = content:match ('%b{}', start); -- get the whole template
if not cs1_config_template then
return nil;
end
local params_t = mw.text.split (cs1_config_template:gsub ('^{{%s*', ''):gsub ('%s*}}$', ''), '%s*|%s*'); -- remove '{{' and '}}'; make a sequence of parameter/value pairs (split on the pipe)
table.remove (params_t, 1); -- remove the template name because it isn't a parameter/value pair
local config_meta_params_t = {'DisplayAuthors', 'DisplayContributors', 'DisplayEditors', 'DisplayInterviewers', 'DisplayTranslators', 'NameListStyle', 'Mode'};
local meta_param_map_t = {}; -- list of accepted parameter names usable in {{cs1 config}} goes here
for _, meta_param in ipairs (config_meta_params_t) do -- for i18n using <config_meta_params_t>, map template parameter names to their metaparameter equivalents
if 'table' == type (aliases[meta_param]) then -- if <meta_param> is a sequence,
for _, param in ipairs (aliases[meta_param]) do -- extract its contents
meta_param_map_t[param] = meta_param; -- and add to <meta_param_map_t>
end
else
meta_param_map_t[aliases[meta_param]] = meta_param; -- not a sequence so just add the parameter to <meta_param_map_t>
end
end
local keywords_t = {}; -- map valid keywords to their associate metaparameter; reverse form of <keyword_lists[key] for these metaparameters
for _, metaparam_t in ipairs ({{'NameListStyle', 'name-list-style'}, {'Mode', 'mode'}}) do -- only these metaparameter / keywords_lists key pairs
for _, keyword in ipairs (keywords_lists[metaparam_t[2]]) do -- spin through the list of keywords
keywords_t[keyword] = metaparam_t[1]; -- add [keyword] = metaparameter to the map
end
end
for _, param in ipairs (params_t) do -- spin through the {{cs1 config}} parameters and fill <global_cs1_config_t>
local k, v = param:match ('([^=]-)%s*=%s*(.+)'); -- <k> is the parameter name; <v> is parameter's assigned value
if k then
if k:find ('^display') then -- if <k> is one of the |display-<namelist>= parameters
if v:match ('%d+') then -- the assigned value must be digits; doesn't accept 'etal'
global_cs1_config_t[meta_param_map_t[k]]=v; -- add the display param and its value to globals table
end
else
if keywords_t[v] == meta_param_map_t[k] then -- keywords_t[v] returns nil or the metaparam name; these must be the same
global_cs1_config_t[meta_param_map_t[k]]=v; -- add the parameter and its value to globals table
end
end
end
end
end
end
get_cs1_config (); -- fill <global_cs1_config_t>
--[[---------------------< S T R I P M A R K E R S >----------------------------
Common pattern definition location for stripmarkers so that we don't have to go
hunting for them if (when) MediaWiki changes their form.
]]
local stripmarkers = {
['any'] = '\127[^\127]*UNIQ%-%-(%a+)%-[%a%d]+%-QINU[^\127]*\127', -- capture returns name of stripmarker
['math'] = '\127[^\127]*UNIQ%-%-math%-[%a%d]+%-QINU[^\127]*\127' -- math stripmarkers used in coins_cleanup() and coins_replace_math_stripmarker()
}
--[[------------< I N V I S I B L E _ C H A R A C T E R S >---------------------
This table holds non-printing or invisible characters indexed either by name or
by Unicode group. Values are decimal representations of UTF-8 codes. The table
is organized as a table of tables because the Lua pairs keyword returns table
data in an arbitrary order. Here, we want to process the table from top to bottom
because the entries at the top of the table are also found in the ranges specified
by the entries at the bottom of the table.
Also here is a pattern that recognizes stripmarkers that begin and end with the
delete characters. The nowiki stripmarker is not an error but some others are
because the parameter values that include them become part of the template's
metadata before stripmarker replacement.
]]
local invisible_defs = {
del = '\127', -- used to distinguish between stripmarker and del char
zwj = '\226\128\141', -- used with capture because zwj may be allowed
}
local invisible_chars = {
{'replacement', '\239\191\189'}, -- U+FFFD, EF BF BD
{'zero width joiner', '('.. invisible_defs.zwj .. ')'}, -- U+200D, E2 80 8D; capture because zwj may be allowed
{'zero width space', '\226\128\139'}, -- U+200B, E2 80 8B
{'hair space', '\226\128\138'}, -- U+200A, E2 80 8A
{'soft hyphen', '\194\173'}, -- U+00AD, C2 AD
{'horizontal tab', '\009'}, -- U+0009 (HT), 09
{'line feed', '\010'}, -- U+000A (LF), 0A
{'no-break space', '\194\160'}, -- U+00A0 (NBSP), C2 A0
{'carriage return', '\013'}, -- U+000D (CR), 0D
{'stripmarker', stripmarkers.any}, -- stripmarker; may or may not be an error; capture returns the stripmaker type
{'delete', '('.. invisible_defs.del .. ')'}, -- U+007F (DEL), 7F; must be done after stripmarker test; capture to distinguish isolated del chars not part of stripmarker
{'C0 control', '[\000-\008\011\012\014-\031]'}, -- U+0000–U+001F (NULL–US), 00–1F (except HT, LF, CR (09, 0A, 0D))
{'C1 control', '[\194\128-\194\159]'}, -- U+0080–U+009F (XXX–APC), C2 80 – C2 9F
-- {'Specials', '[\239\191\185-\239\191\191]'}, -- U+FFF9-U+FFFF, EF BF B9 – EF BF BF
-- {'Private use area', '[\238\128\128-\239\163\191]'}, -- U+E000–U+F8FF, EE 80 80 – EF A3 BF
-- {'Supplementary Private Use Area-A', '[\243\176\128\128-\243\191\191\189]'}, -- U+F0000–U+FFFFD, F3 B0 80 80 – F3 BF BF BD
-- {'Supplementary Private Use Area-B', '[\244\128\128\128-\244\143\191\189]'}, -- U+100000–U+10FFFD, F4 80 80 80 – F4 8F BF BD
}
--[[
Indic script makes use of zero width joiner as a character modifier so zwj
characters must be left in. This pattern covers all of the unicode characters
for these languages:
Devanagari 0900–097F – https://unicode.org/charts/PDF/U0900.pdf
Devanagari extended A8E0–A8FF – https://unicode.org/charts/PDF/UA8E0.pdf
Bengali 0980–09FF – https://unicode.org/charts/PDF/U0980.pdf
Gurmukhi 0A00–0A7F – https://unicode.org/charts/PDF/U0A00.pdf
Gujarati 0A80–0AFF – https://unicode.org/charts/PDF/U0A80.pdf
Oriya 0B00–0B7F – https://unicode.org/charts/PDF/U0B00.pdf
Tamil 0B80–0BFF – https://unicode.org/charts/PDF/U0B80.pdf
Telugu 0C00–0C7F – https://unicode.org/charts/PDF/U0C00.pdf
Kannada 0C80–0CFF – https://unicode.org/charts/PDF/U0C80.pdf
Malayalam 0D00–0D7F – https://unicode.org/charts/PDF/U0D00.pdf
plus the not-necessarily Indic scripts for Sinhala and Burmese:
Sinhala 0D80-0DFF - https://unicode.org/charts/PDF/U0D80.pdf
Myanmar 1000-109F - https://unicode.org/charts/PDF/U1000.pdf
Myanmar extended A AA60-AA7F - https://unicode.org/charts/PDF/UAA60.pdf
Myanmar extended B A9E0-A9FF - https://unicode.org/charts/PDF/UA9E0.pdf
the pattern is used by has_invisible_chars() and coins_cleanup()
]]
local indic_script = '[\224\164\128-\224\181\191\224\163\160-\224\183\191\225\128\128-\225\130\159\234\167\160-\234\167\191\234\169\160-\234\169\191]';
-- list of emoji that use a zwj character (U+200D) to combine with another emoji
-- from: https://unicode.org/Public/emoji/17.0/emoji-zwj-sequences.txt; version: 17.0; 2025-01-08
-- table created by: [[:en:Module:Make emoji zwj table]]
local emoji_t = { -- indexes are decimal forms of the hex values in U+xxxx
[8596] = true, -- U+2194 ↔ left right arrow
[8597] = true, -- U+2195 ↕ up down arrow
[9760] = true, -- U+2620 ☠ skull and crossbones
[9792] = true, -- U+2640 ♀ female sign
[9794] = true, -- U+2642 ♂ male sign
[9877] = true, -- U+2695 ⚕ staff of aesculapius
[9878] = true, -- U+2696 ⚖ scales
[9895] = true, -- U+26A7 ⚧ male with stroke and male and female sign
[9992] = true, -- U+2708 ✈ airplane
[10052] = true, -- U+2744 ❄ snowflake
[10084] = true, -- U+2764 ❤ heavy black heart
[10145] = true, -- U+27A1 ➡ black rightwards arrow
[11035] = true, -- U+2B1B ⬛ black large square
[127752] = true, -- U+1F308 🌈 rainbow
[127787] = true, -- U+1F32B 🌫 fog
[127806] = true, -- U+1F33E 🌾 ear of rice
[127859] = true, -- U+1F373 🍳 cooking
[127868] = true, -- U+1F37C 🍼 baby bottle
[127876] = true, -- U+1F384 🎄 christmas tree
[127891] = true, -- U+1F393 🎓 graduation cap
[127908] = true, -- U+1F3A4 🎤 microphone
[127912] = true, -- U+1F3A8 🎨 artist palette
[127979] = true, -- U+1F3EB 🏫 school
[127981] = true, -- U+1F3ED 🏭 factory
[128048] = true, -- U+1F430 🐰 rabbit face
[128102] = true, -- U+1F466 👦 boy
[128103] = true, -- U+1F467 👧 girl
[128104] = true, -- U+1F468 👨 man
[128105] = true, -- U+1F469 👩 woman
[128139] = true, -- U+1F48B 💋 kiss mark
[128165] = true, -- U+1F4A5 💥 collision symbol
[128168] = true, -- U+1F4A8 💨 dash symbol
[128171] = true, -- U+1F4AB 💫 dizzy symbol
[128187] = true, -- U+1F4BB 💻 personal computer
[128188] = true, -- U+1F4BC 💼 brief case
[128293] = true, -- U+1F525 🔥 fire
[128295] = true, -- U+1F527 🔧 wrench
[128300] = true, -- U+1F52C 🔬 microscope
[128488] = true, -- U+1F5E8 🗨 left speech bubble
[128640] = true, -- U+1F680 🚀 rocket
[128658] = true, -- U+1F692 🚒 fire engine
[129001] = true, -- U+1F7E9 🟩 large green square
[129003] = true, -- U+1F7EB 🟫 large brown square
[129309] = true, -- U+1F91D 🤝 handshake
[129455] = true, -- U+1F9AF 🦯 probing cane
[129456] = true, -- U+1F9B0 🦰 emoji component red hair
[129457] = true, -- U+1F9B1 🦱 emoji component curly hair
[129458] = true, -- U+1F9B2 🦲 emoji component bald
[129459] = true, -- U+1F9B3 🦳 emoji component white hair
[129466] = true, -- U+1F9BA 🦺 safety vest
[129468] = true, -- U+1F9BC 🦼 motorized wheelchair
[129469] = true, -- U+1F9BD 🦽 manual wheelchair
[129489] = true, -- U+1F9D1 🧑 adult
[129490] = true, -- U+1F9D2 🧒 child
[129648] = true, -- U+1FA70 🩰 ballet shoes
[129657] = true, -- U+1FA79 🩹 adhesive bandage
[129775] = true, -- U+1FAEF fight cloud
[129778] = true, -- U+1FAF2 🫲 leftwards hand
}
--[[----------------------< L A N G U A G E S U P P O R T >-------------------
These tables and constants support various language-specific functionality.
]]
--local this_wiki_code = mw.getContentLanguage():getCode(); -- get this wiki's language code
local this_wiki_code = lang_obj:getCode(); -- get this wiki's language code
if string.match (mw.site.server, 'wikidata') then
this_wiki_code = mw.getCurrentFrame():callParserFunction('int', {'lang'}); -- on Wikidata so use interface language setting instead
end
local mw_languages_by_tag_t = mw.language.fetchLanguageNames (this_wiki_code, 'all'); -- get a table of language tag/name pairs known to Wikimedia; used for interwiki tests
local mw_languages_by_name_t = {};
for k, v in pairs (mw_languages_by_tag_t) do -- build a 'reversed' table name/tag language pairs know to MediaWiki; used for |language=
v = mw.ustring.lower (v); -- lowercase for tag fetch; get name's proper case from mw_languages_by_tag_t[<tag>]
if mw_languages_by_name_t[v] then -- when name already in the table
if 2 == #k or 3 == #k then -- if tag does not have subtags
mw_languages_by_name_t[v] = k; -- prefer the shortest tag for this name
end
else -- here when name not in the table
mw_languages_by_name_t[v] = k; -- so add name and matching tag
end
end
local inter_wiki_map = {}; -- map of interwiki prefixes that are language-code prefixes
for k, v in pairs (mw.site.interwikiMap ('local')) do -- spin through the base interwiki map (limited to local)
if mw_languages_by_tag_t[v["prefix"]] then -- if the prefix matches a known language tag
inter_wiki_map[v["prefix"]] = true; -- add it to our local map
end
end
--[[--------------------< S C R I P T _ L A N G _ C O D E S >-------------------
This table is used to hold ISO 639-1 two-character and ISO 639-3 three-character
language codes that apply only to |script-title= and |script-chapter=
]]
local script_lang_codes = {
'ab', 'am', 'ar', 'as', 'az', 'be', 'bg', 'bn', 'bo', 'bs', 'ce', 'chr',
'cu', 'dv', 'dz', 'el', 'fa', 'grc', 'gu', 'he', 'hi', 'hy', 'ja', 'ka',
'kaa', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'lo', 'mk', 'ml', 'mn', 'mni',
'mr', 'my', 'ne', 'or', 'ota', 'pa', 'ps', 'ru', 'sd', 'si', 'sr', 'syc',
'ta', 'te', 'tg', 'th', 'ti', 'tkr', 'tt', 'ug', 'uk', 'ur', 'uz', 'yi',
'yue', 'zh', 'zgh'
};
--[[---------------< L A N G U A G E R E M A P P I N G >----------------------
These tables hold language information that is different (correct) from MediaWiki's definitions
For each ['<tag>'] = 'language name' in lang_code_remap{} there must be a matching ['language name'] = {'language name', '<tag>'} in lang_name_remap{}
lang_tag_remap{}:
key is always lowercase ISO 639-1, -2, -3 language tag or a valid lowercase IETF language tag
value is properly spelled and capitalized language name associated with <tag>
only one language name per <tag>;
key/value pair must have matching entry in lang_name_remap{}
lang_name_remap{}:
key is always lowercase language name
value is a table the holds correctly spelled and capitalized language name [1] and associated tag [2] (tag must match a tag key in lang_tag_remap{})
may have multiple keys referring to a common preferred name and tag; For example:
['kolsch'] and ['kölsch'] both refer to 'Kölsch' and 'ksh'
]]
local lang_tag_remap = { -- used for |language= and |script-title= / |script-chapter=
['als'] = 'Tosk Albanian', -- MediaWiki returns Alemannisch
['bh'] = 'Bihari', -- MediaWiki uses 'bh' as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org
['bla'] = 'Blackfoot', -- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name
['bn'] = 'Bengali', -- MediaWiki returns Bangla
['ca-valencia'] = 'Valencian', -- IETF variant of Catalan
['fkv'] = 'Kven', -- MediaWiki returns Kvensk
['gsw'] = 'Swiss German',
['ilo'] = 'Ilocano', -- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name
['ksh'] = 'Kölsch', -- MediaWiki: Colognian; use IANA/ISO 639 preferred name
['ksh-x-colog'] = 'Colognian', -- override MediaWiki ksh; no IANA/ISO 639 code for Colognian; IETF private code created at Module:Lang/data
['mis-x-ripuar'] = 'Ripuarian', -- override MediaWiki ksh; no IANA/ISO 639 code for Ripuarian; IETF private code created at Module:Lang/data
['nan-tw'] = 'Taiwanese Hokkien', -- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese and support en.wiki preferred name
['sr-ec'] = 'Serbian (Cyrillic script)', -- MediaWiki returns српски (ћирилица)
['sr-el'] = 'Serbian (Latin script)', -- MediaWiki returns srpski (latinica)
}
local lang_name_remap = { -- used for |language=; names require proper capitalization; tags must be lowercase
['alemannic'] = {'Swiss German', 'gsw'}, -- ISO 639-2, -3 alternate for Swiss German; MediaWiki mediawiki returns Alemannic for gsw; en.wiki preferred name
['alemannisch'] = {'Swiss German', 'gsw'}, -- not an ISO or IANA language name; MediaWiki uses 'als' as a subdomain name for Alemannic Wikipedia: als.wikipedia.org
['bangla'] = {'Bengali', 'bn'}, -- MediaWiki returns Bangla (the endonym) but we want Bengali (the exonym); here we remap
['bengali'] = {'Bengali', 'bn'}, -- MediaWiki doesn't use exonym so here we provide correct language name and 639-1 code
['bhojpuri'] = {'Bhojpuri', 'bho'}, -- MediaWiki uses 'bh' as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org
['bihari'] = {'Bihari', 'bh'}, -- MediaWiki replaces 'Bihari' with 'Bhojpuri' so 'Bihari' cannot be found
['blackfoot'] = {'Blackfoot', 'bla'}, -- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name
['colognian'] = {'Colognian', 'ksh-x-colog'}, -- MediaWiki preferred name for ksh
['ilocano'] = {'Ilocano', 'ilo'}, -- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name
['kolsch'] = {'Kölsch', 'ksh'}, -- use IANA/ISO 639 preferred name (use non-diacritical o instead of umlaut ö)
['kölsch'] = {'Kölsch', 'ksh'}, -- use IANA/ISO 639 preferred name
['kven'] = {'Kven', 'fkv'}, -- Unicode CLDR have decided not to support English language name for these two...
['kvensk'] = {'Kven', 'fkv'}, -- ...they say to refer to IANA registry for English names
['ripuarian'] = {'Ripuarian', 'mis-x-ripuar'}, -- group of dialects; no code in MediaWiki or in IANA/ISO 639
['serbian (cyrillic script)'] = {'Serbian (Cyrillic script)', 'sr-cyrl'}, -- special case to get correct tag when |language=sr-ec
['serbian (latin script)'] = {'Serbian (Latin script)', 'sr-latn'}, -- special case to get correct tag when |language=sr-el
['swiss german'] = {'Swiss German', 'gsw'},
['taiwanese hokkien'] = {'Taiwanese Hokkien', 'nan-tw'}, -- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese
['tosk albanian'] = {'Tosk Albanian', 'als'}, -- MediaWiki replaces 'Tosk Albanian' with 'Alemannisch' so 'Tosk Albanian' cannot be found
['valencian'] = {'Valencian', 'ca-valencia'}, -- variant of Catalan; categorizes as Valencian
}
--[[---------------< P R O P E R T I E S _ C A T E G O R I E S >----------------
Properties categories. These are used for investigating qualities of citations.
]]
local prop_cats = {
['foreign-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is foreign-language name, $2 is ISO639-1 code
['foreign-lang-source-2'] = 'CS1 foreign language sources (ISO 639-2)|$1', -- |language= category; a cat for ISO639-2 languages; $1 is the ISO 639-2 code used as a sort key
['interproj-linked-name'] = 'CS1 interproject-linked names|$1', -- any author, editor, etc that has an interproject link; $1 is interproject tag used as a sort key
['interwiki-linked-name'] = 'CS1 interwiki-linked names|$1', -- any author, editor, etc that has an interwiki link; $1 is interwiki tag used as a sort key; yeilds to interproject
['local-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is local-language name, $2 is ISO639-1 code; not emitted when local_lang_cat_enable is false
['location-test'] = 'CS1 location test',
['long-vol'] = 'CS1: long volume value', -- probably temporary cat to identify scope of |volume= values longer than 4 characters
['script'] = 'CS1 uses $1-language script ($2)', -- |script-title=xx: has matching category; $1 is language name, $2 is language tag
['tracked-param'] = 'CS1 tracked parameter: $1', -- $1 is base (enumerators removed) parameter name
['unfit'] = 'CS1: unfit URL', -- |url-status=unfit or |url-status=usurped; used to be a maint cat
['vanc-accept'] = 'CS1:Vancouver names with accept markup', -- for |vauthors=/|veditors= with accept-as-written markup
['year-range-abbreviated'] = 'CS1: abbreviated year range', -- probably temporary cat to identify scope of |date=, |year= values using YYYY–YY form
}
--[[-------------------< T I T L E _ T Y P E S >--------------------------------
Here we map a template's CitationClass to TitleType (default values for |type= parameter)
]]
local title_types = {
['AV-media-notes'] = 'Media notes',
['document'] = 'Document',
['interview'] = 'Interview',
['mailinglist'] = 'Mailing list',
['map'] = 'Map',
['podcast'] = 'Podcast',
['pressrelease'] = 'Press release',
['report'] = 'Report',
['speech'] = 'Speech',
['techreport'] = 'Technical report',
['thesis'] = 'Thesis',
}
--[[--------------------------< B U I L D _ K N O W N _ F R E E _ D O I _ R E G I S T R A N T S _ T A B L E >--
build a table of doi registrants known to be free-to-read In a doi, the registrant ID is the series of digits
between the '10.' and the first '/': in doi 10.1100/sommat, 1100 is the registrant ID
see §3.2.2 DOI prefix of the Doi Handbook p. 43
https://www.doi.org/doi-handbook/DOI_Handbook_Final.pdf#page=43
]]
local function build_free_doi_registrants_table()
local registrants_t = {};
for _, v in ipairs ({
'1045', '1074', '1096', '1100', '1155', '1186', '1194', '1371', '1613', '1629', '1989', '1999', '2147', '2196', '3114', '3285',
'3389', '3390', '3767', '3906', '3748', '3814', '3847', '3897', '4061', '4089', '4103', '4172', '4175', '4230', '4236', '4239',
'4240', '4249', '4251', '4252', '4253', '4254', '4291', '4292', '4312', '4329', '4330', '4331', '5074', '5086', '5194',
'5210', '5306', '5312', '5313', '5314', '5315', '5316', '5317', '5318', '5319', '5320', '5321', '5334', '5402', '5409',
'5410', '5411', '5412', '5492', '5493', '5494', '5495', '5496', '5497', '5498', '5499', '5500', '5501', '5527', '5528',
'5662', '6064', '6219', '7167', '7217', '7287', '7482', '7490', '7554', '7717', '7759', '7766', '9778',
'11131', '11569', '11647', '11648', '12688', '12703', '12715', '12942', '12998', '13105', '14256', '14293', '14303', '14502', '14720',
'15215', '15227', '15292', '15458', '15347', '15412', '15560', '16995', '17573', '17645', '18553', '18637', '18757', '19080', '19173', '20419',
'20944', '21037', '21105', '21468', '21767', '21425', '22261', '22323', '22459', '24105', '24196', '24404', '24413', '24966', '26529',
'26614', '26775', '26873', '30845', '32545', '34291', '34641', '35711', '35712', '35713', '35995', '36648', '37126', '37532', '37871',
'47128', '47622', '47959', '48438', '51741', '51746', '51935', '51936', '51937', '51938', '51939', '51940', '52165', '52437', '52975',
'53288', '53347', '54081', '54947', '55295', '55667', '55741', '55914', '57009', '58647', '58782', '59081', '59490', '61375', '66183', '70587',
}) do
registrants_t[v] = true; -- build a k/v table of known free-to-read doi registrants
end
return registrants_t;
end
-- known free registrants identifiable by the doi suffix incipit
local extended_registrants_t = { -- doi suffix incipits are evaluated as lua patterns
['1001'] = {'jamanetworkopen'}, -- JAMA Network Open
['1002'] = {'1878-0261', '2056-4538', '2211-5463', '2475-8876', '2688-8319', 'aaai%.', 'aac2%.', 'ache%.', 'acm2%.', 'acn3%.', 'acr2%.', 'admi%.', 'adpr%.', 'adrr%.', 'adsr%.', 'advs%.', 'ael2%.', 'aelm%.', 'aesr%.', 'aff2%.', 'agf2%.', 'agg2%.', 'agm2%.', 'ags3%.', 'agt2%.', 'aidi%.', 'ail2%.', 'aisy%.', 'aiv2%.', 'alz%.', 'ame2%.', 'ams2%.', 'anbr%.', 'ansa%.', 'apj%.', 'app5%.', 'aps3%.', 'apxr%.', 'aro2%.', 'ars2%.', 'asl2%.', 'atn2%.', 'bco2%.', 'bes2%.', 'bmm2%.', 'bod2%.', 'brb3%.', 'brh2%.', 'brx2%.', 'bsa3%.', 'bte2%.', 'btm2%.', 'cai2%.', 'cam4%.', 'cbh2%.', 'ccr3%.', 'ccs3%.', 'cdt3%.', 'celc%.', 'cep4%.', 'ces2%.', 'cesm%.', 'ceur%.', 'cey2%.', 'cfch%.', 'cfp2%.', 'cin4%.', 'clc%.', 'clem%.', 'cli2%.', 'clt2%.', 'cmt2%.', 'cmtd%.', 'cnl2%.', 'cnr2%.', 'cns%.', 'cns3%.', 'cnx2%.', 'cre2%.', 'csc3%.', 'cso2%.', 'ctd2%.', 'cti2%.', 'ctm2%.', 'dad2%.', 'deo2%.', 'dep2%.', 'dni2%.', 'dro2%.', 'dug2%.', 'dvr2%.', 'eas2%.', 'ece2%.', 'ece3%.', 'ecog%.', 'ecs2%.', 'edm2%.', 'edn3%.', 'eem2%.', 'eer3%.', 'efd2%.', 'ejsc%.', 'elsa%.', 'elt2%.', 'eng2%.', 'eom2%.', 'epi4%.', 'epr2%.', 'ese3%.', 'exp%.', 'fbe2%.', 'fci2%.', 'fer3%.', 'fes3%.', 'fft2%.', 'fhu2%.', 'fle2%.', 'flm2%.', 'fob2%.', 'fpf2%.', 'fsh3%.', 'fsn3%.', 'gcb4%.', 'gch2%.', 'gdj3%.', 'geo2%.', 'ggn2%.', 'gin2%.', 'glr2%.', 'gps3%.', 'gtm2%.', 'hbm%.', 'hcs2%.', 'hem3%.', 'hkj2%.', 'hsr2%.', 'ibra%.', 'idm2%.', 'ifm2%.', 'iid3%.', 'iju5%.', 'ila2%.', 'imed%.', 'imm3%.', 'imo2%.', 'imt2%.', 'inc2%.', 'inc3%.', 'inf2%.', 'inm3%.', 'inmd%.', 'ird3%.', 'ise3%.', 'jaa2%.', 'jav%.', 'jbt%.', 'jcc5%.', 'jcla%.', 'jcsm%.', 'jcv2%.', 'jeo2%.', 'jev2%.', 'jex2%.', 'jfa2%.', 'jgf2%.', 'jgh3%.', 'jha2%.', 'jia2%.', 'jmd2%.', 'jmrs%.', 'joa3%.', 'jpr3%.', 'jsf2%.', 'jsp2%.', 'jvc2%.', 'kjm2%.', 'kot2%.', 'lci2%.', 'ldr%.', 'leap%.', 'leg3%.', 'lim2%.', 'lio2%.', 'loe2%.', 'lol2%.', 'lrh2%.', 'mame%.', 'mba2%.', 'mbo3%.', 'mco2%.', 'mdb2%.', 'mdr2%.', 'med4%.', 'mef2%.', 'met%.', 'metm%.', 'mgea%.', 'mgg3%.', 'mhs2%.', 'mlf2%.', 'mmr3%.', 'moda%.', 'mog2%.', 'mpr%.', 'mps2%.', 'msd2%.', 'nam2%.', 'nano%.', 'nap2%.', 'neo2%.', 'nep3%.', 'njb%.', 'nop2%.', 'npp2%.', 'npr2%.', 'ntls%.', 'open%.', 'orm2%.', 'osp4%.', 'oto2%.', 'pan3%.', 'pchj%.', 'pcn5%.', 'pdi3%.', 'ped4%.', 'pei3%.', 'pfm2%.', 'pgr2%.', 'phmt%.', 'pld3%.', 'pls2%.', 'pmf2%.', 'pne2%.', 'pnp%.', 'poh2%.', 'ppj2%.', 'ppp3%.', 'prm2%.', 'pro6%.', 'prp2%.', 'psp4%.', 'puh2%.', 'pul2%.', 'qub2%.', 'rai2%.', 'rar2%.', 'rco2%.', 'rcr2%.', 'rfc2%.', 'rmb2%.', 'rpm2%.', 'rse2%.', 'rvr2%.', 'sae2%.', 'sen2%.', 'sfp2%.', 'smb2%.', 'smm2%.', 'smmd%.', 'smo2%.', 'smsc%.', 'sst2%.', 'sst3%.', 'sstr%.', 'sus2%.', 'tch2%.', 'tcr4%.', 'tpg2%.', 'trc2%.', 'tre%.', 'uar2%.', 'ueg2%.', 'uro2%.', 'viw2%.', 'vms3%.', 'vro2%.', 'vzj2%.', 'we%.', 'wjo2%.', 'wlb3%.', 'wll2%.', 'wsb%.'}, -- Elsevier journals https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&oldid=1364310578#Wikipedia:Bot_requests/Archive_88#Web_scrapping_v2
['1016'] = {'j%.aace', 'j%.aed', 'j%.aiopen', 'j%.animal', 'j%.apsb', 'j%.addicn', -- AACE Endocrinology and Diabetes, AACE Endocrinology and Diabetes, AI Open, Animal, Acta Pharmaceutica Sinica B, Addiction Neuroscience
'j%.abrep', 'j%.fob', 'j%.gpb', 'j%.heliyon', 'j%.mucimm%.', 'j%.nlp', 'j%.patter', 'j%.proche', -- Addictive Behaviors Reports, FEBS Open Bio, Genomics, Proteomics & Bioinformatics after 2015, Heliyon, Mucosal Immunology, Natural Language Processing, Patterns, Procedia Chemistry
'j%.vgie', 'S1672-0229', 'S1933-0219'}, -- VideoGIE, Genomics, Proteomics & Bioinformatics before 2015, Mucosal Immunology
['1017'] = {'apj%.', 'nlp', 'mdh', 'S15574660'}, -- Natural Language Processing Journal, Medical History, Asia Pacific Journal
['1021'] = {'acscentsci', 'acsomega'}, -- ACS Central Science, ACS Omega
['1029'] = {'2025cn', '2025csj', '2025ea', '2025gc', '2025gh', '2025ms', '2025sw', '2025wr', '2026ef', '2026gl', '2026jh', 'aga2.70129'}, -- Elsevier journals https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&oldid=1364310578#Wikipedia:Bot_requests/Archive_88#Web_scrapping_v2
['1038'] = {'41541%.', '43246%.', 'asiamat%.', 'boneres%.', 'cddis%.', 'cddiscovery%.', 'celldisc%.', 'mi%.', 'nutd%.', 'oncsis%.', 's40494', 's41377', 's41392', 's41396', 's41398', 's41405', 's41407', 's41408', 's41439', 's41467', 's41514', 's41522', 's41523', 's41524', 's41525', 's41526', 's41528', 's41529', 's41531', 's41533', 's41534', 's41535', 's41536', 's41537', 's41538', 's41539', 's41540', 's41545', 's41598', 's41612', 's41698', 's41699', 's41746', 's42003', 's42004', 's42005', 's42949', 's43247', 's43705', 's43856', 's44168', 's44172', 's44182', 's44183', 's44184', 's44185', 's44259', 's44260', 's44264', 's44271', 's44276', 's44294', 's44296', 's44298', 's44303', 's44304', 's44306', 's44310', 's44323', 's44324', 's44325', 's44328', 's44333', 's44334', 's44335', 's44341', 's44355', 's44383', 's44384', 's44385', 's44386', 's44387', 's44400', 's44401', 's44406', 's44407', 's44431', 's44432', 's44433', 's44434', 's44435', 's44440', 's44453', 's44454', 's44455', 's44456', 's44458', 's44459', 's44482', 's44484', 's44485', 's44488', 's44513', 's44528', 'sdata%.'}, -- Nature journals (npj series, Communications series, and many others, see https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&diff=prev&oldid=1368822567 and https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&diff=next&oldid=1368822567)
['1046'] = {'j%.1365-8711', 'j%.1365-246x'}, -- MNRAS, GJI
['1049'] = {'aie2%.', 'blc2%.', 'bme2', 'bsb2%.', 'ccs2%.', 'cds2', 'cdt2', 'cim2%.', 'cit2%.', 'cmu2%.', 'cps2%.', 'csy2%.', 'cth2%.', 'cvi2%.', 'dgt2%.', 'ein2%.', 'ell2%.', 'elp2%.', 'els2', 'ema3%.', 'enb2%.', 'enc2%.', 'esi2%.', 'gtd2%.', 'htl2%.', 'hve2%.', 'ipr2%.', 'ise2', 'itr2%.', 'mia2%.', 'mna2%.', 'nbt2', 'nde2%.', 'ntw2%.', 'ote2%.', 'pel2%.', 'qtc2%.', 'rpg2%.', 'rsn2%.', 'ses2%.', 'sfw2', 'sil2', 'smc2%.', 'smt2%.', 'stg2%.', 'syb2%.', 'tje2%.', 'wss2%.'}, -- Elsevier journals https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&oldid=1364310578#Wikipedia:Bot_requests/Archive_88#Web_scrapping_v2
['1051'] = {'parasite'}, -- Parasite
['1057'] = {'s41599'}, -- Humanities and Social Sciences Communications
['1093'] = {'mnras', 'mnrasl', 'gji', 'pnasnexus', 'rasti', 'ismeco', 'ismejo'}, -- MNRAS, MNRAS Letters, GJI, PNAS Nexus, RASTI, ISME Communications, ISME Journal
['1096'] = {'fba%.'}, -- FASEB BioAdvances
['1098'] = {'rsbm', 'rsob', 'rsos'}, -- Biographical Memoirs of Fellows of the Royal Society, Open Biology, Royal Society Open Science
['1099'] = {'acmi', 'mic', '00221287', 'mgen'}, -- Access Microbiology, Microbiology, Journal of General Microbiology, Microbial Genomics
['1107'] = {'S20569890', 'S20522525', 'S16005775', 'S24143146'}, -- Acta Crystallographica E, IUCrJ, Journal of Synchrotron Radiation, IUCrData
['1109'] = {'access', 'oa', 'oj'}, -- IEEE Access, IEEE Open Access..., IEEE Open Journal...
['1111'] = {'1365-2435', '1442-1984', '1751-7915', '1753-0407', '1755-0998', '1758-2229', '1759-7714', '2041-210x', 'j%.1365-2966', 'j%.1745-3933', 'j%.1365-246X','acel%.', 'adb%.', 'anec%.', 'aogs%.', 'bor%.', 'bpa%.', 'cas%.', 'con4%.', 'cpr%.', 'crj%.', 'csp2%.', 'cts%.', 'ddi%.', 'ejed%.', 'ene%.', 'eva%.', 'gbb%.', 'gcbb%.', 'hex%.', 'irv%.', 'iwj%.', 'jch%.', 'jcmm%.', 'jdi%.', 'jfr3%.', 'jocd%.', 'jwas%.', 'mcn%.', 'mpp%.', 'myc%.', 'nrm%.', 'os%.', 'pbi%.', 'srt%.'}, -- Elsevier journals https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&oldid=1364310578#Wikipedia:Bot_requests/Archive_88#Web_scrapping_v2
['1112'] = {'tlm3%.'}, -- Transactions of the London Mathematical Society
['1113'] = {'ep'}, -- Experimental Physiology
['1128'] = {'asmcr', 'jmbe', 'mbio', 'mra', 'spectrum', 'msphere', 'msystems'}, --ASM Case Reports, Journal of Microbiology & Biology Education, mBio, Microbiology Resource Announcements, Microbiology Spectrum, mSphere, mSystems
['1136'] = {'bmjopen'}, -- BMJ Open
['1140'] = {'epjconf'}, -- EPJ Web of Conferences
['1161'] = {'jaha%.'},
['1176'] = {'appi%.prcp%.'},
['1192'] = {'bjo'}, -- BJPsych Open
['1210'] = {'jendso','jcemcr'}, -- Journal of the Endocrine Society, JCEM Case Reports
['1215'] = {'21573689', '21573698'}, -- L&O Fluids
['1257'] = {'jep'}, -- Journal of Economic Perspectives
['1590'] = {'0102-3306'}, -- Acta Botanica Brasilica
['2903'] = {'j%.efsa%.'},
['3322'] = {'caac%.'},
['3982'] = {'qw', 'te'},
['4171'] = {'dm','mag'}, -- Documenta Mathematica, EMS Magazine
['4319'] = {'lo%.', 'lol%.', 'lom%.'}, -- L&O, L&O e-Lectures, L&O Methods
['5852'] = {'ejt'}, -- European Journal of Taxonomy
['7155'] = {'jgaa'}, -- Journal of Graph Algorithms and Applications
['7758'] = {'rsf'}, -- RSJ Journal
['11158'] = {'saasp'}, -- Systematic and Applied Acarology Special Publications
['11646'] = {'megataxa', 'mesozoic'}, -- Megataxa, Mesozoic
['14231'] = {'ag'}, -- Algebraic Geometry
['14814'] = {'phy2%.'},
['15302'] = {'vr%.'},
['15446'] = {'abc'}, -- Acta Biológica Colombiana
['17239'] = {'jowr'}, -- Journal of Writing Research
['22073'] = {'pja'}, -- Persian Journal of Acarology
['24310'] = {'abm'}, -- Acta Botanica Malacitana
['24425'] = {'agp'}, -- Acta Geologica Polonica
['35249'] = {'rche'}, -- Revista Chilena de Entomología
['37520'] = {'fi'}, -- Fossil Imprint
['53562'] = {'ajcb'} -- Asian Journal of Conservation Biology
}
--[[===================<< E R R O R M E S S A G I N G >>======================
]]
--[[----------< E R R O R M E S S A G E S U P P L E M E N T S >-------------
I18N for those messages that are supplemented with additional specific text that
describes the reason for the error
TODO: merge this with special_case_translations{}?
]]
local err_msg_supl = {
['char'] = 'invalid character', -- |isbn=, |sbn=
['check'] = 'checksum', -- |isbn=, |sbn=
empty_str = '(empty string)', -- empty unknown parameter check when cite has |=
['flag'] = 'flag', -- |archive-url=
['form'] = 'invalid form', -- |isbn=, |sbn=
['group'] = 'invalid group id', -- |isbn=
['initials'] = 'initials', -- Vancouver
['invalid language code'] = 'invalid language code', -- |script-<param>=
['journal'] = 'journal', -- |bibcode=
['length'] = 'length', -- |isbn=, |bibcode=, |sbn=
['liveweb'] = 'liveweb', -- |archive-url=
['missing comma'] = 'missing comma', -- Vancouver
['missing prefix'] = 'missing prefix', -- |script-<param>=
['missing title part'] = 'missing title part', -- |script-<param>=
['name'] = 'name', -- Vancouver
['non-Latin char'] = 'non-Latin character', -- Vancouver
['path'] = 'path', -- |archive-url=
['prefix'] = 'invalid prefix', -- |isbn=
['punctuation'] = 'punctuation', -- Vancouver
['save'] = 'save command', -- |archive-url=
['suffix'] = 'suffix', -- Vancouver
['timestamp'] = 'timestamp', -- |archive-url=
['unknown language code'] = 'unknown language code', -- |script-<param>=
['value'] = 'value', -- |bibcode=
['year'] = 'year', -- |bibcode=
}
--[[--------------< E R R O R _ C O N D I T I O N S >---------------------------
Error condition table. This table has two sections: errors at the top, maintenance
at the bottom. Maint 'messaging' does not have a 'message' (message=nil)
The following contains a list of IDs for various error conditions defined in the
code. For each ID, we specify a text message to display, an error category to
include, and whether the error message should be wrapped as a hidden comment.
Anchor changes require identical changes to matching anchor in Help:CS1 errors
TODO: rename error_conditions{} to something more generic; create separate error
and maint tables inside that?
]]
local error_conditions = {
err_accessdate_missing_url = {
message = '<code class="cs1-code">|access-date=</code> requires <code class="cs1-code">|url=</code>',
anchor = 'accessdate_missing_url',
category = 'CS1 errors: access-date without URL',
hidden = false
},
err_apostrophe_markup = {
message = 'Italic or bold markup not allowed in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'apostrophe_markup',
category = 'CS1 errors: markup',
hidden = false
},
err_archive_date_missing_url = {
message = '<code class="cs1-code">|archive-date=</code> requires <code class="cs1-code">|archive-url=</code>',
anchor = 'archive_date_missing_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_date_url_ts_mismatch = {
message = '<code class="cs1-code">|archive-date=</code> / <code class="cs1-code">|archive-url=</code> timestamp mismatch; $1 suggested',
anchor = 'archive_date_url_ts_mismatch',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_missing_date = {
message = '<code class="cs1-code">|archive-url=</code> requires <code class="cs1-code">|archive-date=</code>',
anchor = 'archive_missing_date',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_missing_url = {
message = '<code class="cs1-code">|archive-url=</code> requires <code class="cs1-code">|url=</code>',
anchor = 'archive_missing_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_url = {
message = '<code class="cs1-code">|archive-url=</code> is malformed: $1', -- $1 is error message detail
anchor = 'archive_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_arxiv_missing = {
message = '<code class="cs1-code">|arxiv=</code> required',
anchor = 'arxiv_missing',
category = 'CS1 errors: arXiv', -- same as bad arxiv
hidden = false
},
err_asintld_missing_asin = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|asin=</code>', -- $1 is parameter name
anchor = 'asintld_missing_asin',
category = 'CS1 errors: ASIN TLD',
hidden = false
},
err_bad_arxiv = {
message = 'Check <code class="cs1-code">|arxiv=</code> value',
anchor = 'bad_arxiv',
category = 'CS1 errors: arXiv',
hidden = false
},
err_bad_asin = {
message = 'Check <code class="cs1-code">|asin=</code> value',
anchor = 'bad_asin',
category ='CS1 errors: ASIN',
hidden = false
},
err_bad_asin_tld = {
message = 'Check <code class="cs1-code">|asin-tld=</code> value',
anchor = 'bad_asin_tld',
category ='CS1 errors: ASIN TLD',
hidden = false
},
err_bad_bibcode = {
message = 'Check <code class="cs1-code">|bibcode=</code> $1', -- $1 is error message detail
anchor = 'bad_bibcode',
category = 'CS1 errors: bibcode',
hidden = false
},
err_bad_biorxiv = {
message = 'Check <code class="cs1-code">|biorxiv=</code> value',
anchor = 'bad_biorxiv',
category = 'CS1 errors: bioRxiv',
hidden = false
},
err_bad_citeseerx = {
message = 'Check <code class="cs1-code">|citeseerx=</code> value',
anchor = 'bad_citeseerx',
category = 'CS1 errors: citeseerx',
hidden = false
},
err_bad_date = {
message = 'Check date values in: $1', -- $1 is a parameter name list
anchor = 'bad_date',
category = 'CS1 errors: dates',
hidden = false
},
err_bad_doi = {
message = 'Check <code class="cs1-code">|doi=</code> value',
anchor = 'bad_doi',
category = 'CS1 errors: DOI',
hidden = false
},
err_bad_hdl = {
message = 'Check <code class="cs1-code">|hdl=</code> value',
anchor = 'bad_hdl',
category = 'CS1 errors: HDL',
hidden = false
},
err_bad_isbn = {
message = 'Check <code class="cs1-code">|isbn=</code> value: $1', -- $1 is error message detail
anchor = 'bad_isbn',
category = 'CS1 errors: ISBN',
hidden = false
},
err_bad_ismn = {
message = 'Check <code class="cs1-code">|ismn=</code> value',
anchor = 'bad_ismn',
category = 'CS1 errors: ISMN',
hidden = false
},
err_bad_issn = {
message = 'Check <code class="cs1-code">|$1issn=</code> value', -- $1 is 'e' or '' for eissn or issn
anchor = 'bad_issn',
category = 'CS1 errors: ISSN',
hidden = false
},
err_bad_jfm = {
message = 'Check <code class="cs1-code">|jfm=</code> value',
anchor = 'bad_jfm',
category = 'CS1 errors: JFM',
hidden = false
},
err_bad_jstor = {
message = 'Check <code class="cs1-code">|jstor=</code> value',
anchor = 'bad_jstor',
category = 'CS1 errors: JSTOR',
hidden = false
},
err_bad_lccn = {
message = 'Check <code class="cs1-code">|lccn=</code> value',
anchor = 'bad_lccn',
category = 'CS1 errors: LCCN',
hidden = false
},
err_bad_medrxiv = {
message = 'Check <code class="cs1-code">|medrxiv=</code> value',
anchor = 'bad_medrxiv',
category = 'CS1 errors: medRxiv',
hidden = false
},
err_bad_mr = {
message = 'Check <code class="cs1-code">|mr=</code> value',
anchor = 'bad_mr',
category = 'CS1 errors: MR',
hidden = false
},
err_bad_oclc = {
message = 'Check <code class="cs1-code">|oclc=</code> value',
anchor = 'bad_oclc',
category = 'CS1 errors: OCLC',
hidden = false
},
err_bad_ol = {
message = 'Check <code class="cs1-code">|ol=</code> value',
anchor = 'bad_ol',
category = 'CS1 errors: OL',
hidden = false
},
err_bad_osti = {
message = 'Check <code class="cs1-code">|osti=</code> value',
anchor = 'bad_osti',
category = 'CS1 errors: OSTI',
hidden = false
},
err_bad_paramlink = { -- for |title-link=, |author/editor/translator-link=, |series-link=, |episode-link=
message = 'Check <code class="cs1-code">|$1=</code> value', -- $1 is parameter name
anchor = 'bad_paramlink',
category = 'CS1 errors: parameter link',
hidden = false
},
err_bad_pmc = {
message = 'Check <code class="cs1-code">|pmc=</code> value',
anchor = 'bad_pmc',
category = 'CS1 errors: PMC',
hidden = false
},
err_bad_pmid = {
message = 'Check <code class="cs1-code">|pmid=</code> value',
anchor = 'bad_pmid',
category = 'CS1 errors: PMID',
hidden = false
},
err_bad_rfc = {
message = 'Check <code class="cs1-code">|rfc=</code> value',
anchor = 'bad_rfc',
category = 'CS1 errors: RFC',
hidden = false
},
err_bad_s2cid = {
message = 'Check <code class="cs1-code">|s2cid=</code> value',
anchor = 'bad_s2cid',
category = 'CS1 errors: S2CID',
hidden = false
},
err_bad_sbn = {
message = 'Check <code class="cs1-code">|sbn=</code> value: $1', -- $1 is error message detail
anchor = 'bad_sbn',
category = 'CS1 errors: SBN',
hidden = false
},
err_bad_ssrn = {
message = 'Check <code class="cs1-code">|ssrn=</code> value',
anchor = 'bad_ssrn',
category = 'CS1 errors: SSRN',
hidden = false
},
err_bad_url = {
message = 'Check $1 value', -- $1 is parameter name
anchor = 'bad_url',
category = 'CS1 errors: URL',
hidden = false
},
err_bad_usenet_id = {
message = 'Check <code class="cs1-code">|message-id=</code> value',
anchor = 'bad_message_id',
category = 'CS1 errors: message-id',
hidden = false
},
err_bad_zbl = {
message = 'Check <code class="cs1-code">|zbl=</code> value',
anchor = 'bad_zbl',
category = 'CS1 errors: Zbl',
hidden = false
},
err_bare_url_missing_title = {
message = '$1 missing title', -- $1 is parameter name
anchor = 'bare_url_missing_title',
category = 'CS1 errors: bare URL',
hidden = false
},
err_biorxiv_missing = {
message = '<code class="cs1-code">|biorxiv=</code> required',
anchor = 'biorxiv_missing',
category = 'CS1 errors: bioRxiv', -- same as bad bioRxiv
hidden = false
},
err_chapter_ignored = {
message = '<code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'chapter_ignored',
category = 'CS1 errors: chapter ignored',
hidden = false
},
err_citation_missing_title = {
message = 'Missing or empty <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'citation_missing_title',
category = 'CS1 errors: missing title',
hidden = false
},
err_citeseerx_missing = {
message = '<code class="cs1-code">|citeseerx=</code> required',
anchor = 'citeseerx_missing',
category = 'CS1 errors: citeseerx', -- same as bad citeseerx
hidden = false
},
err_cite_web_url = { -- this error applies to cite web and to cite podcast
message = 'Missing or empty <code class="cs1-code">|url=</code>',
anchor = 'cite_web_url',
category = 'CS1 errors: requires URL',
hidden = false
},
err_class_ignored = {
message = '<code class="cs1-code">|class=</code> ignored',
anchor = 'class_ignored',
category = 'CS1 errors: class',
hidden = false
},
err_contributor_ignored = {
message = '<code class="cs1-code">|contributor=</code> ignored',
anchor = 'contributor_ignored',
category = 'CS1 errors: contributor',
hidden = false
},
err_contributor_missing_required_param = {
message = '<code class="cs1-code">|contributor=</code> requires <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'contributor_missing_required_param',
category = 'CS1 errors: contributor',
hidden = false
},
err_deprecated_params = {
message = 'Cite uses deprecated parameter <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'deprecated_params',
category = 'CS1 errors: deprecated parameters',
hidden = false
},
err_disp_name = {
message = 'Invalid <code class="cs1-code">|$1=$2</code>', -- $1 is parameter name; $2 is the assigned value
anchor = 'disp_name',
category = 'CS1 errors: display-names',
hidden = false,
},
err_doibroken_missing_doi = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|doi=</code>', -- $1 is parameter name
anchor = 'doibroken_missing_doi',
category = 'CS1 errors: DOI',
hidden = false
},
err_embargo_missing_pmc = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|pmc=</code>', -- $1 is parameter name
anchor = 'embargo_missing_pmc',
category = 'CS1 errors: PMC embargo',
hidden = false
},
err_empty_citation = {
message = 'Empty citation',
anchor = 'empty_citation',
category = 'CS1 errors: empty citation',
hidden = false
},
err_etal = {
message = 'Explicit use of et al. in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'explicit_et_al',
category = 'CS1 errors: explicit use of et al.',
hidden = false
},
err_extra_text_edition = {
message = '<code class="cs1-code">|edition=</code> has extra text',
anchor = 'extra_text_edition',
category = 'CS1 errors: extra text: edition',
hidden = false,
},
err_extra_text_issue = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_issue',
category = 'CS1 errors: extra text: issue',
hidden = false,
},
err_extra_text_pages = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_pages',
category = 'CS1 errors: extra text: pages',
hidden = false,
},
err_extra_text_volume = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_volume',
category = 'CS1 errors: extra text: volume',
hidden = false,
},
err_first_missing_last = {
message = '<code class="cs1-code">|$1=</code> missing <code class="cs1-code">|$2=</code>', -- $1 is first alias, $2 is matching last alias
anchor = 'first_missing_last',
category = 'CS1 errors: missing name', -- author, contributor, editor, interviewer, translator
hidden = false
},
err_format_missing_url = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|$2=</code>', -- $1 is format parameter $2 is url parameter
anchor = 'format_missing_url',
category = 'CS1 errors: format without URL',
hidden = false
},
err_generic_name = {
message = '<code class="cs1-code">|$1=</code> has generic name', -- $1 is parameter name
anchor = 'generic_name',
category = 'CS1 errors: generic name',
hidden = false,
},
err_generic_title = {
message = 'Cite uses generic title',
anchor = 'generic_title',
category = 'CS1 errors: generic title',
hidden = false,
},
err_invalid_isbn_date = {
message = 'ISBN / Date incompatibility',
anchor = 'invalid_isbn_date',
category = 'CS1 errors: ISBN date',
hidden = true
},
err_invalid_param_val = {
message = 'Invalid <code class="cs1-code">|$1=$2</code>', -- $1 is parameter name $2 is parameter value
anchor = 'invalid_param_val',
category = 'CS1 errors: invalid parameter value',
hidden = false
},
err_invisible_char = {
message = '$1 in $2 at position $3', -- $1 is invisible char $2 is parameter name $3 is position number
anchor = 'invisible_char',
category = 'CS1 errors: invisible characters',
hidden = false
},
err_medrxiv_missing = {
message = '<code class="cs1-code">|medrxiv=</code> required',
anchor = 'medrxiv_missing',
category = 'CS1 errors: medRxiv', -- same as bad medRxiv
hidden = false
},
err_missing_name = {
message = 'Missing <code class="cs1-code">|$1$2=</code>', -- $1 is modified NameList; $2 is enumerator
anchor = 'missing_name',
category = 'CS1 errors: missing name', -- author, contributor, editor, interviewer, translator
hidden = false
},
err_missing_periodical = {
message = 'Cite $1 requires <code class="cs1-code">|$2=</code>', -- $1 is cs1 template name; $2 is canonical periodical parameter name for cite $1
anchor = 'missing_periodical',
category = 'CS1 errors: missing periodical',
hidden = false
},
err_missing_pipe = {
message = 'Missing pipe in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'missing_pipe',
category = 'CS1 errors: missing pipe',
hidden = false
},
err_missing_publisher = {
message = 'Cite $1 requires <code class="cs1-code">|$2=</code>', -- $1 is cs1 template name; $2 is canonical publisher parameter name for cite $1
anchor = 'missing_publisher',
category = 'CS1 errors: missing publisher',
hidden = false
},
err_numeric_names = {
message = '<code class="cs1-code">|$1=</code> has numeric name', -- $1 is parameter name',
anchor = 'numeric_names',
category = 'CS1 errors: numeric name',
hidden = false,
},
err_param_access_requires_param = {
message = '<code class="cs1-code">|$1-access=</code> requires <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'param_access_requires_param',
category = 'CS1 errors: param-access',
hidden = false
},
err_param_has_ext_link = {
message = 'External link in <code class="cs1-code">$1</code>', -- $1 is parameter name
anchor = 'param_has_ext_link',
category = 'CS1 errors: external links',
hidden = false
},
err_param_has_twl_url = {
message = 'Wikipedia Library link in <code class="cs1-code">$1</code>', -- $1 is parameter name
anchor = 'param_has_twl_url',
category = 'CS1 errors: URL',
hidden = false
},
err_parameter_ignored = {
message = 'Unknown parameter <code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'parameter_ignored',
category = 'CS1 errors: unsupported parameter',
hidden = false
},
err_parameter_ignored_suggest = {
message = 'Unknown parameter <code class="cs1-code">|$1=</code> ignored (<code class="cs1-code">|$2=</code> suggested)', -- $1 is unknown parameter $2 is suggested parameter name
anchor = 'parameter_ignored_suggest',
category = 'CS1 errors: unsupported parameter',
hidden = false
},
err_periodical_ignored = {
message = '<code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'periodical_ignored',
category = 'CS1 errors: periodical ignored',
hidden = false
},
err_redundant_parameters = {
message = 'More than one of $1 specified', -- $1 is error message detail
anchor = 'redundant_parameters',
category = 'CS1 errors: redundant parameter',
hidden = false
},
err_script_parameter = {
message = 'Invalid <code class="cs1-code">|$1=</code>: $2', -- $1 is parameter name $2 is script language code or error detail
anchor = 'script_parameter',
category = 'CS1 errors: script parameters',
hidden = false
},
err_ssrn_missing = {
message = '<code class="cs1-code">|ssrn=</code> required',
anchor = 'ssrn_missing',
category = 'CS1 errors: SSRN',
hidden = false
},
err_text_ignored = {
message = 'Text "$1" ignored', -- $1 is ignored text
anchor = 'text_ignored',
category = 'CS1 errors: unrecognized parameter',
hidden = false
},
err_trans_missing_title = {
message = '<code class="cs1-code">|trans-$1=</code> requires <code class="cs1-code">|$1=</code> or <code class="cs1-code">|script-$1=</code>', -- $1 is base parameter name
anchor = 'trans_missing_title',
category = 'CS1 errors: translated title',
hidden = false
},
err_param_unknown_empty = {
message = 'Cite has empty unknown parameter$1: $2', -- $1 is 's' or empty space; $2 is emty unknown param list
anchor = 'param_unknown_empty',
category = 'CS1 errors: empty unknown parameters',
hidden = false
},
err_vancouver = {
message = 'Vancouver style error: $1 in name $2', -- $1 is error detail, $2 is the nth name
anchor = 'vancouver',
category = 'CS1 errors: Vancouver style',
hidden = false
},
err_wikilink_in_url = {
message = 'URL–wikilink conflict', -- uses ndash
anchor = 'wikilink_in_url',
category = 'CS1 errors: URL–wikilink conflict', -- uses ndash
hidden = false
},
--[[--------------------------< M A I N T >-------------------------------------
maint messages do not have a message (message = nil); otherwise the structure
is the same as error messages
]]
maint_archive_origin = {
message = nil,
anchor = 'archive_origin',
category = 'CS1 maint: archive origin',
hidden = true,
},
maint_archived_copy = {
message = nil,
anchor = 'archived_copy',
category = 'CS1 maint: archived copy as title',
hidden = true,
},
maint_bibcode = {
message = nil,
anchor = 'bibcode',
category = 'CS1 maint: bibcode',
hidden = true,
},
maint_location_no_publisher = { -- cite book, conference, encyclopedia; citation as book cite or encyclopedia cite
message = nil,
anchor = 'location_no_publisher',
category = 'CS1 maint: location missing publisher',
hidden = true,
},
maint_bot_unknown = {
message = nil,
anchor = 'bot:_unknown',
category = 'CS1 maint: bot: original URL status unknown',
hidden = true,
},
maint_date_auto_xlated = { -- date auto-translation not supported by en.wiki
message = nil,
anchor = 'date_auto_xlated',
category = 'CS1 maint: date auto-translated',
hidden = true,
},
maint_date_format = {
message = nil,
anchor = 'date_format',
category = 'CS1 maint: date format',
hidden = true,
},
maint_date_year = {
message = nil,
anchor = 'date_year',
category = 'CS1 maint: date and year',
hidden = true,
},
maint_deprecated_archive = {
message = nil,
anchor = 'deprecated_archive',
category = 'CS1 maint: deprecated archival service',
hidden = true,
},
maint_doi_ignore = {
message = nil,
anchor = 'doi_ignore',
category = 'CS1 maint: ignored DOI errors',
hidden = true,
},
maint_doi_inactive = {
message = nil,
anchor = 'doi_inactive',
category = 'CS1 maint: DOI inactive',
hidden = true,
},
maint_doi_inactive_dated = {
message = nil,
anchor = 'doi_inactive_dated',
category = 'CS1 maint: DOI inactive as of $2$3$1', -- $1 is year, $2 is month-name or empty string, $3 is space or empty string
hidden = true,
},
maint_doi_unflagged_free = {
message = nil,
anchor = 'doi_unflagged_free',
category = 'CS1 maint: unflagged free DOI',
hidden = true,
},
maint_extra_punct = {
message = nil,
anchor = 'extra_punct',
category = 'CS1 maint: extra punctuation',
hidden = true,
},
maint_id_limit_load_fail = { -- applies to all cs1|2 templates on a page;
message = nil, -- maint message (category link) never emitted
anchor = 'id_limit_load_fail',
category = 'CS1 maint: ID limit load fail',
hidden = true,
},
maint_isbn_ignore = {
message = nil,
anchor = 'ignore_isbn_err',
category = 'CS1 maint: ignored ISBN errors',
hidden = true,
},
maint_issn_ignore = {
message = nil,
anchor = 'ignore_issn',
category = 'CS1 maint: ignored ISSN errors',
hidden = true,
},
maint_jfm_format = {
message = nil,
anchor = 'jfm_format',
category = 'CS1 maint: JFM format',
hidden = true,
},
maint_location = {
message = nil,
anchor = 'location',
category = 'CS1 maint: location',
hidden = true,
},
maint_misc_url = {
message = nil,
anchor = 'misc_url',
category = 'CS1 maint: miscellaneous url',
hidden = true,
},
maint_missing_class = {
message = nil,
anchor = 'missing_class',
category = 'CS1 maint: missing class',
hidden = true,
},
maint_mr_format = {
message = nil,
anchor = 'mr_format',
category = 'CS1 maint: MR format',
hidden = true,
},
maint_mult_names = {
message = nil,
anchor = 'mult_names',
category = 'CS1 maint: multiple names: $1', -- $1 is '<name>s list'; gets value from special_case_translation table
hidden = true,
},
maint_numeric_names = {
message = nil,
anchor = 'numeric_names',
category = 'CS1 maint: numeric names: $1', -- $1 is '<name>s list'; gets value from special_case_translation table
hidden = true,
},
maint_others = {
message = nil,
anchor = 'others',
category = 'CS1 maint: others',
hidden = true,
},
maint_others_avm = {
message = nil,
anchor = 'others_avm',
category = 'CS1 maint: others in cite AV media (notes)',
hidden = true,
},
maint_overridden_setting = {
message = nil,
anchor = 'overridden',
category = 'CS1 maint: overridden setting',
hidden = true,
},
maint_page_art_num = {
message = nil,
anchor = 'page_art_num',
category = 'CS1 maint: article number as page number',
hidden = true,
},
maint_periodical_has_isbn = {
message = nil,
anchor = 'periodical_has_isbn',
category = 'CS1 maint: periodical has ISBN',
hidden = true,
},
maint_pmc_embargo = {
message = nil,
anchor = 'embargo',
category = 'CS1 maint: PMC embargo expired',
hidden = true,
},
maint_pmc_format = {
message = nil,
anchor = 'pmc_format',
category = 'CS1 maint: PMC format',
hidden = true,
},
maint_postscript = {
message = nil,
anchor = 'postscript',
category = 'CS1 maint: postscript',
hidden = true,
},
maint_publisher_location = {
message = nil,
anchor = 'publisher_location',
category = 'CS1 maint: publisher location',
hidden = true,
},
maint_ref_duplicates_default = {
message = nil,
anchor = 'ref_default',
category = 'CS1 maint: ref duplicates default',
hidden = true,
},
maint_shortened_archive_url = {
message = nil,
anchor = 'shortened_archive_url',
category = 'CS1 maint: shortened archive url',
hidden = true,
},
maint_unknown_lang = {
message = nil,
anchor = 'unknown_lang',
category = 'CS1 maint: unrecognized language',
hidden = true,
},
maint_untitled = {
message = nil,
anchor = 'untitled',
category = 'CS1 maint: untitled periodical',
hidden = true,
},
maint_url_status = {
message = nil,
anchor = 'url_status',
category = 'CS1 maint: url-status',
hidden = true,
},
maint_work_isbn = {
message = nil,
anchor = 'work_isbn',
category = 'CS1 maint: work parameter with ISBN',
hidden = true,
},
maint_year= {
message = nil,
anchor = 'year',
category = 'CS1 maint: year',
hidden = true,
},
maint_zbl = {
message = nil,
anchor = 'zbl',
category = 'CS1 maint: Zbl',
hidden = true,
},
}
--[[--------------------------< I D _ L I M I T S _ D A T A _ T >----------------------------------------------
fetch id limits for certain identifiers from c:Data:CS1/Identifier limits.tab. This source is a json tabular
data file maintained at wikipedia commons. Convert the json format to a table of k/v pairs.
The values from <id_limits_data_t> are used to set handle.id_limit.
From 2025-02-21, MediaWiki is broken. Use this link to edit the tablular data file:
https://commons.wikimedia.org/w/index.php?title=Data:CS1/Identifier_limits.tab&action=edit
See Phab:T389105
]]
local id_limits_data_t;
local id_limits_data_load_fail = false; -- flag; assume that we will be successful when loading json id limit tabular data
local use_commons_data = true; -- set to false if your wiki does not have access to mediawiki commons; then,
if false == use_commons_data then -- update this table from https://commons.wikimedia.org/wiki/Data:CS1/Identifier_limits.tab; last update: 2026-08-02
id_limits_data_t = {['OCLC'] = 11160000000, ['OSTI'] = 23010000, ['PMC'] = 13500000, ['PMID'] = 42900000, ['RFC'] = 9300, ['SSRN'] = 7500000, ['S2CID'] = 290000000}; -- this table must be maintained locally
else -- here for wikis that do have access to mediawiki commons
local load_fail_limit = 99999999999; -- very high number to avoid error messages on load failure
id_limits_data_t = {['OCLC'] = load_fail_limit, ['OSTI'] = load_fail_limit, ['PMC'] = load_fail_limit, ['PMID'] = load_fail_limit, ['RFC'] = load_fail_limit, ['SSRN'] = load_fail_limit, ['S2CID'] = load_fail_limit};
if mw.ext.data == nil then
id_limits_data_load_fail = true; -- safeguard against Lua errors if mw.ext.data is not available for some reason
else
local tab_data_t = mw.ext.data.get ('CS1/Identifier limits.tab'); -- attempt to load the tabular data from commons into <tab_data_t>
if false == tab_data_t then -- undocumented 'feature': mw.ext.data.get() sometimes returns false
id_limits_data_load_fail = true; -- set the flag so that Module:Citation/CS1 can create an unannotated maint category
else
for _, limit_t in ipairs (tab_data_t.data) do -- overwrite default <load_fail_limit> values from the data table in the tabular data
id_limits_data_t[limit_t[1]] = limit_t[2]; -- <limit[1]> is identifier; <limit[2]> is upper limit for that identifier
end
end
end
end
--[[--------------------------< I D _ H A N D L E R S >--------------------------------------------------------
The following contains a list of values for various defined identifiers. For each
identifier we specify a variety of information necessary to properly render the
identifier in the citation.
parameters: a list of parameter aliases for this identifier; first in the list is the canonical form
link: Wikipedia article name
redirect: a local redirect to a local Wikipedia article name; at en.wiki, 'ISBN (identifier)' is a redirect to 'International Standard Book Number'
q: Wikidata q number for the identifier
label: the label preceding the identifier; label is linked to a Wikipedia article (in this order):
redirect from id_handlers['<id>'].redirect when use_identifier_redirects is true
Wikidata-supplied article name for the local wiki from id_handlers['<id>'].q
local article name from id_handlers['<id>'].link
prefix: the first part of a URL that will be concatenated with a second part which usually contains the identifier
suffix: optional third part to be added after the identifier
encode: true if URI should be percent-encoded; otherwise false
COinS: identifier link or keyword for use in COinS:
for identifiers registered at info-uri.info use: info:.... where '...' is the appropriate identifier label
for identifiers that have COinS keywords, use the keyword: rft.isbn, rft.issn, rft.eissn
for |asin= and |ol=, which require assembly, use the keyword: url
for others make a URL using the value in prefix/suffix and #label, use the keyword: pre (not checked; any text other than 'info', 'rft', or 'url' works here)
set to nil to leave the identifier out of the COinS
separator: character or text between label and the identifier in the rendered citation
id_limit: for those identifiers with established limits, this property holds the upper limit
access: use this parameter to set the access level for all instances of this identifier.
the value must be a valid access level for an identifier (see ['id-access'] in this file).
custom_access: to enable custom access level for an identifier, set this parameter
to the parameter that should control it (normally 'id-access')
]]
local id_handlers = {
['ARXIV'] = {
parameters = {'arxiv', 'eprint'},
link = 'arXiv',
redirect = 'arXiv (identifier)',
q = 'Q118398',
label = 'arXiv',
prefix = 'https://arxiv.org/abs/',
encode = false,
COinS = 'info:arxiv',
separator = ':',
access = 'free', -- free to read
},
['ASIN'] = {
parameters = { 'asin', 'ASIN' },
link = 'Amazon Standard Identification Number',
redirect = 'ASIN (identifier)',
q = 'Q1753278',
label = 'ASIN',
prefix = 'https://www.amazon.',
COinS = 'url',
separator = ' ',
encode = false;
},
['BIBCODE'] = {
parameters = {'bibcode'},
link = 'Bibcode',
redirect = 'Bibcode (identifier)',
q = 'Q25754',
label = 'Bibcode',
prefix = 'https://ui.adsabs.harvard.edu/abs/',
encode = false,
COinS = 'info:bibcode',
separator = ':',
custom_access = 'bibcode-access',
},
['BIORXIV'] = {
parameters = {'biorxiv'},
link = 'bioRxiv',
redirect = 'bioRxiv (identifier)',
q = 'Q19835482',
label = 'bioRxiv',
prefix = 'https://doi.org/',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = true,
separator = ' ',
},
['CITESEERX'] = {
parameters = {'citeseerx'},
link = 'CiteSeerX',
redirect = 'CiteSeerX (identifier)',
q = 'Q2715061',
label = 'CiteSeerX',
prefix = 'https://citeseerx.ist.psu.edu/viewdoc/summary?doi=',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = true,
separator = ' ',
},
['DOI'] = { -- Used by InternetArchiveBot
parameters = { 'doi', 'DOI'},
link = 'Digital object identifier',
redirect = 'doi (identifier)',
q = 'Q25670',
label = 'doi',
prefix = 'https://doi.org/',
COinS = 'info:doi',
separator = ':',
encode = true,
custom_access = 'doi-access',
},
['EISSN'] = {
parameters = {'eissn', 'EISSN'},
link = 'International Standard Serial Number#Electronic ISSN',
redirect = 'eISSN (identifier)',
q = 'Q46339674',
label = 'eISSN',
prefix = 'https://search.worldcat.org/issn/',
COinS = 'rft.eissn',
encode = false,
separator = ' ',
},
['HDL'] = {
parameters = { 'hdl', 'HDL' },
link = 'Handle System',
redirect = 'hdl (identifier)',
q = 'Q3126718',
label = 'hdl',
prefix = 'https://hdl.handle.net/',
COinS = 'info:hdl',
separator = ':',
encode = true,
custom_access = 'hdl-access',
},
['ISBN'] = { -- Used by InternetArchiveBot
parameters = {'isbn', 'ISBN'},
link = 'International Standard Book Number',
redirect = 'ISBN (identifier)',
q = 'Q33057',
label = 'ISBN',
prefix = 'Special:BookSources/',
COinS = 'rft.isbn',
separator = ' ',
},
['ISMN'] = {
parameters = {'ismn', 'ISMN'},
link = 'International Standard Music Number',
redirect = 'ISMN (identifier)',
q = 'Q1666938',
label = 'ISMN',
prefix = '', -- not currently used;
COinS = nil, -- nil because we can't use pre or rft or info:
separator = ' ',
},
['ISSN'] = {
parameters = {'issn', 'ISSN'},
link = 'International Standard Serial Number',
redirect = 'ISSN (identifier)',
q = 'Q131276',
label = 'ISSN',
prefix = 'https://search.worldcat.org/issn/',
COinS = 'rft.issn',
encode = false,
separator = ' ',
},
['JFM'] = {
parameters = {'jfm', 'JFM'},
link = 'Jahrbuch über die Fortschritte der Mathematik',
redirect = 'JFM (identifier)',
q = '',
label = 'JFM',
prefix = 'https://zbmath.org/?format=complete&q=an:',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['JSTOR'] = {
parameters = {'jstor', 'JSTOR'},
link = 'JSTOR',
redirect = 'JSTOR (identifier)',
q = 'Q1420342',
label = 'JSTOR',
prefix = 'https://www.jstor.org/stable/',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
custom_access = 'jstor-access',
},
['LCCN'] = {
parameters = {'lccn', 'LCCN'},
link = 'Library of Congress Control Number',
redirect = 'LCCN (identifier)',
q = 'Q620946',
label = 'LCCN',
prefix = 'https://lccn.loc.gov/',
COinS = 'info:lccn',
encode = false,
separator = ' ',
},
['MEDRXIV'] = {
parameters = {'medrxiv'},
link = 'medRxiv',
redirect = 'medRxiv (identifier)',
q = 'Q58465838',
label = 'medRxiv',
prefix = 'https://www.medrxiv.org/content/',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = false,
separator = ' ',
},
['MR'] = {
parameters = {'mr', 'MR'},
link = 'Mathematical Reviews',
redirect = 'MR (identifier)',
q = 'Q211172',
label = 'MR',
prefix = 'https://mathscinet.ams.org/mathscinet-getitem?mr=',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['OCLC'] = {
parameters = {'oclc', 'OCLC'},
link = 'OCLC',
redirect = 'OCLC (identifier)',
q = 'Q190593',
label = 'OCLC',
prefix = 'https://search.worldcat.org/oclc/',
COinS = 'info:oclcnum',
encode = true,
separator = ' ',
id_limit = id_limits_data_t.OCLC or 0,
},
['OL'] = {
parameters = { 'ol', 'OL' },
link = 'Open Library',
redirect = 'OL (identifier)',
q = 'Q1201876',
label = 'OL',
prefix = 'https://openlibrary.org/',
COinS = 'url',
separator = ' ',
encode = true,
custom_access = 'ol-access',
},
['OSTI'] = {
parameters = {'osti', 'OSTI'},
link = 'Office of Scientific and Technical Information',
redirect = 'OSTI (identifier)',
q = 'Q2015776',
label = 'OSTI',
prefix = 'https://www.osti.gov/biblio/',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = id_limits_data_t.OSTI or 0,
custom_access = 'osti-access',
},
['PMC'] = {
parameters = {'pmc', 'PMC'},
link = 'PubMed Central',
redirect = 'PMC (identifier)',
q = 'Q229883',
label = 'PMC',
prefix = 'https://www.ncbi.nlm.nih.gov/pmc/articles/PMC',
suffix = '',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = id_limits_data_t.PMC or 0,
access = 'free', -- free to read
},
['PMID'] = {
parameters = {'pmid', 'PMID'},
link = 'PubMed Identifier',
redirect = 'PMID (identifier)',
q = 'Q2082879',
label = 'PMID',
prefix = 'https://pubmed.ncbi.nlm.nih.gov/',
COinS = 'info:pmid',
encode = false,
separator = ' ',
id_limit = id_limits_data_t.PMID or 0,
},
['RFC'] = {
parameters = {'rfc', 'RFC'},
link = 'Request for Comments',
redirect = 'RFC (identifier)',
q = 'Q212971',
label = 'RFC',
prefix = 'https://tools.ietf.org/html/rfc',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = id_limits_data_t.RFC or 0,
access = 'free', -- free to read
},
['SBN'] = {
parameters = {'sbn', 'SBN'},
link = 'Standard Book Number', -- redirect to International_Standard_Book_Number#History
redirect = 'SBN (identifier)',
label = 'SBN',
prefix = 'Special:BookSources/0-', -- prefix has leading zero necessary to make 9-digit sbn a 10-digit isbn
COinS = nil, -- nil because we can't use pre or rft or info:
separator = ' ',
},
['SSRN'] = {
parameters = {'ssrn', 'SSRN'},
link = 'Social Science Research Network',
redirect = 'SSRN (identifier)',
q = 'Q7550801',
label = 'SSRN',
prefix = 'https://papers.ssrn.com/sol3/papers.cfm?abstract_id=',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = id_limits_data_t.SSRN or 0,
custom_access = 'ssrn-access',
},
['S2CID'] = {
parameters = {'s2cid', 'S2CID'},
link = 'Semantic Scholar',
redirect = 'S2CID (identifier)',
q = 'Q22908627',
label = 'S2CID',
prefix = 'https://api.semanticscholar.org/CorpusID:',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = id_limits_data_t.S2CID or 0,
custom_access = 's2cid-access',
},
['USENETID'] = {
parameters = {'message-id'},
link = 'Usenet',
redirect = 'Usenet (identifier)',
q = 'Q193162',
label = 'Usenet:',
prefix = 'news:',
encode = false,
COinS = 'pre', -- use prefix value
separator = ' ',
},
['ZBL'] = {
parameters = {'zbl', 'ZBL' },
link = 'Zentralblatt MATH',
redirect = 'Zbl (identifier)',
q = 'Q190269',
label = 'Zbl',
prefix = 'https://zbmath.org/?format=complete&q=an:',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
}
--[[--------------------------< E X P O R T S >---------------------------------
]]
return {
use_identifier_redirects = use_identifier_redirects, -- booleans defined in the settings at the top of this module
local_lang_cat_enable = local_lang_cat_enable,
date_name_auto_xlate_enable = date_name_auto_xlate_enable,
date_digit_auto_xlate_enable = date_digit_auto_xlate_enable,
enable_sort_keys = enable_sort_keys,
suppress_archive_today_urls = suppress_archive_today_urls,
-- tables and variables created when this module is loaded
dependencies_t = dependencies_t, -- used to suppress parameters dependent on url-holding parameters holding archive.today urls
enum_needs_xlation = '1' ~= date_names.xlate_digits['1'], -- to avoid unnecessary enumerator translation
global_df = get_date_format (), -- this line can be replaced with "global_df = 'dmy-all'," to have all dates auto translated to dmy format.
global_cs1_config_t = global_cs1_config_t, -- global settings from {{cs1 config}}
id_limits_data_load_fail = id_limits_data_load_fail, -- true when commons tabular identifier-limit data fails to load
known_free_doi_registrants_t = build_free_doi_registrants_table(),
punct_skip = build_skip_table (punct_skip, punct_meta_params),
url_skip = build_skip_table (url_skip, url_meta_params),
archive_today_tlds_t = {['today'] = true, ['ph'] = true, ['is'] = true, ['md'] = true, ['li'] = true, ['fo'] = true, ['vn'] = true}; -- used by is_archive_today_url()
name_space_sort_keys = name_space_sort_keys,
aliases = aliases,
special_case_translation = special_case_translation,
date_names = date_names,
err_msg_supl = err_msg_supl,
error_conditions = error_conditions,
et_al_patterns = et_al_patterns,
extended_registrants_t = extended_registrants_t,
id_handlers = id_handlers,
keywords_lists = keywords_lists,
keywords_xlate = keywords_xlate,
stripmarkers = stripmarkers,
invisible_chars = invisible_chars,
invisible_defs = invisible_defs,
indic_script = indic_script,
emoji_t = emoji_t,
messages = messages,
presentation = presentation,
prop_cats = prop_cats,
script_lang_codes = script_lang_codes,
lang_tag_remap = lang_tag_remap,
lang_name_remap = lang_name_remap,
this_wiki_code = this_wiki_code,
title_types = title_types,
uncategorized_namespaces = uncategorized_namespaces_t,
uncategorized_subpages = uncategorized_subpages,
templates_using_volume = templates_using_volume,
templates_using_issue = templates_using_issue,
templates_not_using_page = templates_not_using_page,
vol_iss_pg_patterns = vol_iss_pg_patterns,
single_letter_2nd_lvl_domains_t = single_letter_2nd_lvl_domains_t,
url_access_map_t = url_access_map_t,
inter_wiki_map = inter_wiki_map,
mw_languages_by_tag_t = mw_languages_by_tag_t,
mw_languages_by_name_t = mw_languages_by_name_t,
citation_class_map_t = citation_class_map_t,
citation_issue_t = citation_issue_t,
citation_no_volume_t = citation_no_volume_t,
}
e7w2jpc8m3hf485c54y7d0wmq4zi17p
74989
74988
2026-08-24T00:44:39Z
Robertsky
10424
1 versaun husi [[:en:Module:Citation/CS1/Configuration]]
74988
Scribunto
text/plain
local lang_obj = mw.getContentLanguage(); -- make a language object for the local language; used here for languages and dates
--[[--------------------------< S E T T I N G S >--------------------------------------------------------------
boolean settings used to control various things. these setting located here to make them easy to find
]]
-- these settings local to this module only
local local_digits_from_mediawiki = false; -- for i18n; when true, module fills date_names['local_digits'] from MediaWiki; manual fill required else; always false at en.wiki
-- these settings exported to other modules
local use_identifier_redirects = true; -- when true use redirect name for identifier label links; always true at en.wiki
local local_lang_cat_enable = false; -- when true categorizes pages where |language=<local wiki's language>; always false at en.wiki
local date_name_auto_xlate_enable = false; -- when true translates English month-names to the local-wiki's language month names; always false at en.wiki
local date_digit_auto_xlate_enable = false; -- when true translates Western date digit to the local-wiki's language digits (date_names['local_digits']); always false at en.wiki
local enable_sort_keys = true; -- when true module adds namespace sort keys to error and maintenance category links
local suppress_archive_today_urls = true; -- when true module suppresses all parameters with an archive.today url and any deprendent parameters
--[[--------------------------< U N C A T E G O R I Z E D _ N A M E S P A C E S >------------------------------
List of namespaces identifiers for namespaces that will not be included in citation error categories.
Same as setting notracking = true by default.
For wikis that have a current version of Module:cs1 documentation support, this #invoke will return an unordered
list of namespace names and their associated identifiers:
{{#invoke:cs1 documentation support|uncategorized_namespace_lister|all=<anything>}}
]]
local uncategorized_namespaces_t = {[2]=true}; -- init with user namespace id
for k, _ in pairs (mw.site.talkNamespaces) do -- add all talk namespace ids
uncategorized_namespaces_t[k] = true;
end
local uncategorized_subpages = {'/[Ss]andbox', '/[Tt]estcases', '/[^/]*[Ll]og', '/[Aa]rchive'}; -- list of Lua patterns found in page names of pages we should not categorize
--[[
at en.wiki Greek characters are used as sort keys for certain items in a category so that those items are
placed at the end of a category page. See Wikipedia:Categorization#Sort_keys. That works well for en.wiki
because English is written using the Latn script. This may not work well for other languages. At en.wiki it
is desireable to place content from certain namespaces at the end of a category listing so the module adds sort
keys to error and maintenance category links when rendering a cs1|2 template on a page in that namespace.
i18n: if this does not work well for your language, set <enable_sort_keys> to false.
]]
local name_space_sort_keys = { -- sort keys to be used with these namespaces:
[4] = 'ω', -- wikipedia; omega
[10] = 'τ', -- template; tau
[118] = 'Δ', -- draft; delta
['other'] = 'ο', -- all other non-talk namespaces except main (article); omicron
}
--[[--------------------------< M E S S A G E S >--------------------------------------------------------------
Translation table
The following contains fixed text that may be output as part of a citation.
This is separated from the main body to aid in future translations of this
module.
]]
local messages = {
['agency'] = '$1 $2', -- $1 is sepc, $2 is agency
['archived-dead'] = 'Archived from $1 on $2',
['archived-live'] = '$1 from the original on $2',
['archived-unfit'] = 'Archived from the original on $1',
['archived'] = 'Archived',
['by'] = 'By', -- contributions to authored works: introduction, foreword, afterword
['cartography'] = 'Cartography by $1',
['collaboration'] = '$1 ($2)', -- $1 is author with et al, $2 is collaboration
['editor'] = 'ed.',
['editors'] = 'eds.',
['edition'] = '($1 ed.)',
['episode'] = 'Episode $1',
['et al'] = 'et al.',
['in'] = 'In', -- edited works
['inactive'] = ' (inactive $1)', -- $1 is date which the doi was found to be broken in
['inset'] = '$1 inset',
['interview'] = 'Interviewed by $1',
invisible_1 = '$1 $2', -- $1 stripmarker name; $2 is text from <invisible_chars[1]>
invisible_2 = '$1 character', -- $1 character name from <invisible_chars[1]>
['mismatch'] = '<code class="cs1-code">|$1=</code> / <code class="cs1-code">|$2=</code> mismatch', -- $1 is year param name; $2 is date param name
['newsgroup'] = '[[Usenet newsgroup|Newsgroup]]: $1',
['notitle'] = 'No title', -- for |title=(()) and (in the future) |title=none
['original'] = 'the original',
['origdate'] = ' [$1]',
['published'] = ' (published $1)',
['retrieved'] = 'Retrieved $1',
['season'] = 'Season $1',
['section'] = '§ $1',
['sections'] = '§§ $1',
['series'] = '$1 $2', -- $1 is sepc, $2 is series
['seriesnum'] = 'Series $1',
['translated'] = 'Translated by $1',
['type'] = ' ($1)', -- for titletype
wikidata = 'Wikidata', -- these used for interwikilinked author/editor/... names
wikipedia = 'Wikipedia',
wikisource = 'Wikisource',
['written'] = 'Written at $1',
['vol'] = '$1 Vol. $2', -- $1 is sepc; bold journal style volume is in presentation{}
['vol-no'] = '$1 Vol. $2, no. $3', -- sepc, volume, issue (alternatively insert $1 after $2, but then we'd also have to change capitalization)
['issue'] = '$1 No. $2', -- $1 is sepc
['art'] = '$1 Art. $2', -- $1 is sepc; for {{cite conference}} only
['vol-art'] = '$1 Vol. $2, art. $3', -- sepc, volume, article-number; for {{cite conference}} only
['j-vol'] = '$1 $2', -- sepc, volume; bold journal volume is in presentation{}
['j-issue'] = ' ($1)',
['j-article-num'] = ' $1', -- TODO: any punctuation here? static text?
['nopp'] = '$1 $2'; -- page(s) without prefix; $1 is sepc
['p-prefix'] = "$1 p. $2", -- $1 is sepc
['pp-prefix'] = "$1 pp. $2", -- $1 is sepc
['j-page(s)'] = ': $1', -- same for page and pages
['sheet'] = '$1 Sheet $2', -- $1 is sepc
['sheets'] = '$1 Sheets $2', -- $1 is sepc
['j-sheet'] = ': Sheet $1',
['j-sheets'] = ': Sheets $1',
['language'] = '(in $1)',
['via'] = " – via $1",
['event'] = 'Event occurs at',
['minutes'] = ' $1 minutes in', -- $1 is the number of minutes
-- Determines the location of the help page
['help page link'] = 'Help:CS1 errors',
['help page label'] = 'help',
-- categories
['cat wikilink'] = '[[Category:$1]]', -- $1 is the category name
['cat wikilink sk'] = '[[Category:$1|$2]]', -- $1 is the category name; $2 is namespace sort key
[':cat wikilink'] = '[[:Category:$1|link]]', -- category name as maintenance message wikilink; $1 is the category name
-- Internal errors (should only occur if configuration is bad)
['undefined_error'] = 'Called with an undefined error condition',
['unknown_ID_key'] = 'Unrecognized ID key: ', -- an ID key in id_handlers not found in ~/Identifiers func_map{}
['unknown_ID_access'] = 'Unrecognized ID access keyword: ', -- an ID access keyword in id_handlers not found in keywords_lists['id-access']{}
['unknown_argument_map'] = 'Argument map not defined for this variable',
['bare_url_no_origin'] = 'Bare URL found but origin indicator is nil or empty',
['warning_msg_e'] = '<span style="color:#d33"><code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code>: this [[#$2|reference]] has errors</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link; $2 is anchor ID
['warning_msg_m'] = '<span style="color:#085"><code style="color: inherit; background: inherit; border: none; padding: inherit;">{{$1}}</code>: this [[#$2|reference]] has maintenance messages</span>; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).'; -- $1 is template link; $2 is anchor ID
}
--[[--------------------------< C I T A T I O N _ C L A S S _ M A P >------------------------------------------
this table maps the value assigned to |CitationClass= in the cs1|2 templates to the canonical template name when
the value assigned to |CitationClass= is different from the canonical template name. |CitationClass= values are
used as class attributes in the <cite> tag that encloses the citation so these names may not contain spaces while
the canonical template name may. These names are used in warning_msg_e and warning_msg_m to create links to the
template's documentation when an article is displayed in preview mode.
]]
local citation_class_map_t = { -- TODO: in Module:Cite/config write a function to use this table
arxiv = 'cite arXiv', -- as the source for known_templates_t and citation_classes_t
['audio-visual'] = 'cite AV media',
['AV-media-notes'] = 'cite AV media notes',
biorxiv = 'cite bioRxiv',
book = 'cite book',
citation = 'citation',
citeseerx = 'cite CiteSeerX',
conference = 'cite conference',
document = 'cite document',
encyclopaedia = 'cite encyclopedia',
episode = 'cite episode',
interview = 'cite interview',
journal = 'cite journal',
magazine = 'cite magazine',
mailinglist = 'cite mailing list',
map = 'cite map',
medrxiv = 'cite medRxiv',
news = 'cite news',
newsgroup = 'cite newsgroup',
podcast = 'cite podcast',
pressrelease = 'cite press release',
report = 'cite report',
serial = 'cite serial',
sign = 'cite sign',
speech = 'cite speech',
ssrn = 'cite SSRN',
techreport = 'cite tech report',
thesis = 'cite thesis',
web = 'cite web',
}
--[=[-------------------------< E T _ A L _ P A T T E R N S >--------------------------------------------------
This table provides Lua patterns for the phrase "et al" and variants in name text
(author, editor, etc.). The main module uses these to identify and emit the 'etal' message.
]=]
local et_al_patterns = {
"[;,]? *[\"']*%f[%a][Ee][Tt]%.? *[Aa][Ll][%.;,\"']*$", -- variations on the 'et al' theme
"[;,]? *[\"']*%f[%a][Ee][Tt]%.? *[Aa][Ll][Ii][AaIi][Ee]?[%.;,\"']*$", -- variations on the 'et alia', 'et alii' and 'et aliae' themes (false positive 'et aliie' unlikely to match)
"[;,]? *%f[%a]and [Oo]thers", -- an alternative to et al.
"%[%[ *[Ee][Tt]%.? *[Aa][Ll]%.? *%]%]", -- a wikilinked form
"%(%( *[Ee][Tt]%.? *[Aa][Ll]%.? *%)%)", -- a double-bracketed form (to counter partial removal of ((...)) syntax)
"[%(%[] *[Ee][Tt]%.? *[Aa][Ll]%.? *[%)%]]", -- a bracketed form
}
--[[--------------------------< P R E S E N T A T I O N >------------------------
Fixed presentation markup. Originally part of citation_config.messages it has
been moved into its own, more semantically correct place.
]]
local presentation =
{
-- .citation-comment class is specified at Help:CS1_errors#Controlling_error_message_display
['hidden-error'] = '<span class="cs1-hidden-error citation-comment">$1</span>',
['visible-error'] = '<span class="cs1-visible-error citation-comment">$1</span>',
['hidden-maint'] = '<span class="cs1-maint citation-comment">$1</span>',
['accessdate'] = '<span class="reference-accessdate">$1$2</span>', -- to allow editors to hide accessdate using personal CSS
['bdi'] = '<bdi$1>$2</bdi>', -- bidirectional isolation used with |script-title= and the like
['cite'] = '<cite class="$1">$2</cite>'; -- for use when citation does not have a namelist and |ref= not set so no id="..." attribute
['cite-id'] = '<cite id="$1" class="$2">$3</cite>'; -- for use when when |ref= is set or when citation has a namelist
['format'] = ' <span class="cs1-format">($1)</span>', -- for |format=, |chapter-format=, etc.
['interwiki'] = ' <span class="cs1-format">[in $1]</span>', -- for interwiki-language-linked author, editor, etc
['interproj'] = ' <span class="cs1-format">[at $1]</span>', -- for interwiki-project-linked author, editor, etc (:d: and :s: supported; :w: ignored)
-- various access levels, for |access=, |doi-access=, |arxiv=, ...
-- narrow no-break space   may work better than nowrap CSS. Or not? Browser support?
['ext-link-access-signal'] = '<span class="$1" title="$2">$3</span>', -- external link with appropriate lock icon
['free'] = {class='id-lock-free', title='Freely accessible'}, -- classes defined in Module:Citation/CS1/styles.css
['registration'] = {class='id-lock-registration', title='Free registration required'},
['limited'] = {class='id-lock-limited', title='Free access subject to limited trial, subscription normally required'},
['subscription'] = {class='id-lock-subscription', title='Paid subscription required'},
['interwiki-icon'] = '<span class="$1" title="$2">$3</span>',
['class-wikisource'] = 'cs1-ws-icon',
['italic-title'] = "''$1''",
['kern-left'] = '<span class="cs1-kern-left"></span>$1', -- spacing to use when title contains leading single or double quote mark
['kern-right'] = '$1<span class="cs1-kern-right"></span>', -- spacing to use when title contains trailing single or double quote mark
['nowrap1'] = '<span class="nowrap">$1</span>', -- for nowrapping an item: <span ...>yyyy-mm-dd</span>
['nowrap2'] = '<span class="nowrap">$1</span> $2', -- for nowrapping portions of an item: <span ...>dd mmmm</span> yyyy (note white space)
['ocins'] = '<span title="$1" class="Z3988"></span>',
['parameter'] = '<code class="cs1-code">|$1=</code>',
['ps_cs1'] = '.'; -- CS1 style postscript (terminal) character
['ps_cs2'] = ''; -- CS2 style postscript (terminal) character (empty string)
['quoted-text'] = '<q>$1</q>', -- for wrapping |quote= content
['quoted-title'] = '"$1"',
['sep_cs1'] = '.', -- CS1 element separator
['sep_cs2'] = ',', -- CS2 separator
['sep_nl'] = ';', -- CS1|2 style name-list separator between names is a semicolon
['sep_nl_and'] = ' and ', -- used as last nl sep when |name-list-style=and and list has 2 items
['sep_nl_end'] = '; and ', -- used as last nl sep when |name-list-style=and and list has 3+ names
['sep_name'] = ', ', -- CS1|2 style last/first separator is <comma><space>
['sep_nl_vanc'] = ',', -- Vancouver style name-list separator between authors is a comma
['sep_name_vanc'] = ' ', -- Vancouver style last/first separator is a space
['sep_list'] = ', ', -- used for |language= when list has 3+ items except for last sep which uses sep_list_end
['sep_list_pair'] = ' and ', -- used for |language= when list has 2 items
['sep_list_end'] = ', and ', -- used as last list sep for |language= when list has 3+ items
['trans-italic-title'] = "[''$1'']",
['trans-quoted-title'] = "[$1]", -- for |trans-title= and |trans-quote=
['vol-bold'] = '$1 <b>$2</b>', -- sepc, volume; for bold journal cites; for other cites ['vol'] in messages{}
}
--[[--------------------------< A L I A S E S >---------------------------------
Aliases table for commonly passed parameters.
Parameter names on the right side in the assignments in this table must have been
defined in the Whitelist before they will be recognized as valid parameter names
]]
local aliases = {
['AccessDate'] = {'access-date', 'accessdate'}, -- Used by InternetArchiveBot
['Agency'] = 'agency',
['ArchiveDate'] = {'archive-date', 'archivedate'}, -- Used by InternetArchiveBot
['ArchiveFormat'] = 'archive-format',
['ArchiveURL'] = {'archive-url', 'archiveurl'}, -- Used by InternetArchiveBot
['ArticleNumber'] = 'article-number',
['ASINTLD'] = 'asin-tld',
['At'] = 'at', -- Used by InternetArchiveBot
['Authors'] = {'people', 'credits'},
['BookTitle'] = {'book-title', 'booktitle'},
['Cartography'] = 'cartography',
['Chapter'] = {'chapter', 'contribution', 'entry', 'article', 'section'},
['ChapterFormat'] = {'chapter-format', 'contribution-format', 'entry-format',
'article-format', 'section-format'};
['ChapterURL'] = {'chapter-url', 'contribution-url', 'entry-url', 'article-url', 'section-url'}, -- Used by InternetArchiveBot
['ChapterUrlAccess'] = {'chapter-url-access', 'contribution-url-access',
'entry-url-access', 'article-url-access', 'section-url-access'}, -- Used by InternetArchiveBot
['Class'] = 'class', -- cite arxiv and arxiv identifier
['Collaboration'] = 'collaboration',
['Conference'] = {'conference', 'event'},
['ConferenceFormat'] = 'conference-format',
['ConferenceURL'] = 'conference-url', -- Used by InternetArchiveBot
['Date'] = {'date', 'air-date', 'airdate'}, -- air-date and airdate for cite episode and cite serial only
['Degree'] = 'degree',
['DF'] = 'df',
['DisplayAuthors'] = {'display-authors', 'display-subjects'},
['DisplayContributors'] = 'display-contributors',
['DisplayEditors'] = 'display-editors',
['DisplayInterviewers'] = 'display-interviewers',
['DisplayTranslators'] = 'display-translators',
['Docket'] = 'docket',
['DoiBroken'] = 'doi-broken-date',
['Edition'] = 'edition',
['Embargo'] = 'pmc-embargo-date',
['Encyclopedia'] = {'encyclopedia', 'encyclopaedia', 'dictionary'}, -- cite encyclopedia only
['Episode'] = 'episode', -- cite serial only TODO: make available to cite episode?
['Format'] = 'format',
['ID'] = {'id', 'ID'},
['Inset'] = 'inset',
['Issue'] = {'issue', 'number'},
['Language'] = {'language', 'lang'},
['MailingList'] = {'mailing-list', 'mailinglist'}, -- cite mailing list only
['Map'] = 'map', -- cite map only
['MapFormat'] = 'map-format', -- cite map only
['MapURL'] = {'map-url', 'mapurl'}, -- cite map only -- Used by InternetArchiveBot
['MapUrlAccess'] = 'map-url-access', -- cite map only -- Used by InternetArchiveBot
['Minutes'] = 'minutes',
['Mode'] = 'mode',
['NameListStyle'] = 'name-list-style',
['Network'] = 'network',
['Newsgroup'] = 'newsgroup', -- cite newsgroup only
['NoPP'] = {'no-pp', 'nopp'},
['NoTracking'] = {'no-tracking', 'template-doc-demo'},
['Number'] = 'number', -- this case only for cite techreport
['OrigDate'] = {'orig-date', 'orig-year', 'origyear'},
['Others'] = 'others',
['Page'] = {'page', 'p'}, -- Used by InternetArchiveBot
['Pages'] = {'pages', 'pp'}, -- Used by InternetArchiveBot
['Periodical'] = {'journal', 'magazine', 'newspaper', 'periodical', 'website', 'work'},
['Place'] = {'place', 'location'},
['PostScript'] = 'postscript',
['PublicationDate'] = {'publication-date', 'publicationdate'},
['PublicationPlace'] = {'publication-place', 'publicationplace'},
['PublisherName'] = {'publisher', 'institution'},
['Quote'] = {'quote', 'quotation'},
['QuotePage'] = 'quote-page',
['QuotePages'] = 'quote-pages',
['Ref'] = 'ref',
['Scale'] = 'scale',
['ScriptChapter'] = {'script-chapter', 'script-contribution', 'script-entry',
'script-article', 'script-section'},
['ScriptEncyclopedia'] = {'script-encyclopedia', 'script-encyclopaedia'}, -- cite encyclopedia only
['ScriptMap'] = 'script-map',
['ScriptPeriodical'] = {'script-journal', 'script-magazine', 'script-newspaper',
'script-periodical', 'script-website', 'script-work'},
['ScriptQuote'] = 'script-quote',
['ScriptTitle'] = 'script-title', -- Used by InternetArchiveBot
['Season'] = 'season',
['Sections'] = 'sections', -- cite map only
['Series'] = {'series', 'version'},
['SeriesLink'] = {'series-link', 'serieslink'},
['SeriesNumber'] = {'series-number', 'series-no'},
['Sheet'] = 'sheet', -- cite map only
['Sheets'] = 'sheets', -- cite map only
['Station'] = 'station',
['Time'] = 'time',
['TimeCaption'] = 'time-caption',
['Title'] = 'title', -- Used by InternetArchiveBot
['TitleLink'] = {'title-link', 'episode-link', 'episodelink'}, -- Used by InternetArchiveBot
['TitleNote'] = {'title-note', 'department'},
['TitleType'] = {'type', 'medium'},
['TransChapter'] = {'trans-article', 'trans-chapter', 'trans-contribution',
'trans-entry', 'trans-section'},
['Transcript'] = 'transcript',
['TranscriptFormat'] = 'transcript-format',
['TranscriptURL'] = 'transcript-url', -- Used by InternetArchiveBot
['TransEncyclopedia'] = {'trans-encyclopedia', 'trans-encyclopaedia'}, -- cite encyclopedia only
['TransMap'] = 'trans-map', -- cite map only
['TransPeriodical'] = {'trans-journal', 'trans-magazine', 'trans-newspaper',
'trans-periodical', 'trans-website', 'trans-work'},
['TransQuote'] = 'trans-quote',
['TransTitle'] = 'trans-title', -- Used by InternetArchiveBot
['URL'] = {'url', 'URL'}, -- Used by InternetArchiveBot
['UrlAccess'] = 'url-access', -- Used by InternetArchiveBot
['UrlStatus'] = 'url-status', -- Used by InternetArchiveBot
['Vauthors'] = 'vauthors',
['Veditors'] = 'veditors',
['Via'] = 'via',
['Volume'] = 'volume',
['Year'] = 'year',
['AuthorList-First'] = {"first#", "author-first#", "author#-first", "author-given#", "author#-given",
"subject-first#", "subject#-first", "subject-given#", "subject#-given",
"given#"},
['AuthorList-Last'] = {"last#", "author-last#", "author#-last", "author-surname#", "author#-surname",
"subject-last#", "subject#-last", "subject-surname#", "subject#-surname",
"author#", 'host#', "subject#", "surname#"},
['AuthorList-Link'] = {"author-link#", "author#-link", "subject-link#",
"subject#-link", "authorlink#", "author#link"},
['AuthorList-Mask'] = {"author-mask#", "author#-mask", "subject-mask#", "subject#-mask"},
['ContributorList-First'] = {'contributor-first#', 'contributor#-first',
'contributor-given#', 'contributor#-given'},
['ContributorList-Last'] = {'contributor-last#', 'contributor#-last',
'contributor-surname#', 'contributor#-surname', 'contributor#'},
['ContributorList-Link'] = {'contributor-link#', 'contributor#-link'},
['ContributorList-Mask'] = {'contributor-mask#', 'contributor#-mask'},
['EditorList-First'] = {"editor-first#", "editor#-first", "editor-given#", "editor#-given"},
['EditorList-Last'] = {"editor-last#", "editor#-last", "editor-surname#",
"editor#-surname", "editor#"},
['EditorList-Link'] = {"editor-link#", "editor#-link"},
['EditorList-Mask'] = {"editor-mask#", "editor#-mask"},
['InterviewerList-First'] = {'interviewer-first#', 'interviewer#-first',
'interviewer-given#', 'interviewer#-given'},
['InterviewerList-Last'] = {'interviewer-last#', 'interviewer#-last',
'interviewer-surname#', 'interviewer#-surname', 'interviewer#'},
['InterviewerList-Link'] = {'interviewer-link#', 'interviewer#-link'},
['InterviewerList-Mask'] = {'interviewer-mask#', 'interviewer#-mask'},
['TranslatorList-First'] = {'translator-first#', 'translator#-first',
'translator-given#', 'translator#-given'},
['TranslatorList-Last'] = {'translator-last#', 'translator#-last',
'translator-surname#', 'translator#-surname', 'translator#'},
['TranslatorList-Link'] = {'translator-link#', 'translator#-link'},
['TranslatorList-Mask'] = {'translator-mask#', 'translator#-mask'},
}
--[[--------------------------< D E P E N D E N C I E S _ T >--------------------------------------------------
a table of url-holding parameters upon which other parameters are dependent.
this table is used by has_archive_today_url() to suppress parameters that are dependant upon a url-holding parameter
that has as a value an archive.today (or alternate tld) url.
archive.today is deprecated at en.wiki; see Wikipedia:Requests_for_comment/Archive.is_RFC_5
]]
local url_dependency_map_t = { -- table of url-holding parameters and the meta-parameters that are dependent on them
['url'] = {'AccessDate', 'ArchiveURL', 'Format', 'UrlAccess'},
['archive-url'] = {'ArchiveDate', 'ArchiveFormat', 'UrlStatus'},
['archiveurl'] = {'ArchiveDate', 'ArchiveFormat', 'UrlStatus'},
['article-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['chapter-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['conference-url'] = {'ConferenceFormat'},
['contribution-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['entry-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['map-url'] = {'MapFormat', 'MapUrlAccess'},
['section-url'] = {'ChapterFormat', 'ChapterUrlAccess'},
['transcript-url'] = {'TranscriptFormat'},
};
local dependencies_t = {}; -- the table of url-holding parameters and their dependent parameters
for url_param, meta_parameters_t in pairs (url_dependency_map_t) do -- sequence of meta-parameters (indexes) into <aliases> table
local dependant_params_t = {}; -- collection of parameters that are dependent on this <url_param>
for _, meta_parameter in ipairs (meta_parameters_t) do -- for each <aliases> meta-parameter (index)
if 'string' == type (aliases[meta_parameter]) then -- for single parameter names (no aliases), <aliases[meta_parameter]> will be a string
table.insert (dependant_params_t, aliases[meta_parameter]); -- add to this <url_param>'s dependency sequence
else
for _, alias in ipairs (aliases[meta_parameter]) do -- for each alias in aliases[meta_parameter] (aliases['AccessDate'] for example)
table.insert (dependant_params_t, alias); -- add to this <url_param>'s dependency sequence
end
end
end
dependencies_t[url_param] = dependant_params_t; -- add the <url_param> and its dependent parameters
end
--[[--------------------------< P U N C T _ S K I P >---------------------------
builds a table of parameter names that the extraneous terminal punctuation check should not check.
]]
local punct_meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
'BookTitle', 'Chapter', 'ScriptChapter', 'ScriptTitle', 'Title', 'TransChapter', 'Transcript', 'TransMap', 'TransTitle', -- title-holding parameters
'AuthorList-Mask', 'ContributorList-Mask', 'EditorList-Mask', 'InterviewerList-Mask', 'TranslatorList-Mask', -- name-list mask may have name separators
'PostScript', 'Quote', 'ScriptQuote', 'TransQuote', 'Ref', -- miscellaneous
'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'MapURL', 'TranscriptURL', 'URL', -- URL-holding parameters
}
local url_meta_params = { -- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value
'ArchiveURL', 'ChapterURL', 'ConferenceURL', 'ID', 'MapURL', 'TranscriptURL', 'URL', -- parameters allowed to hold urls
'Page', 'Pages', 'At', 'QuotePage', 'QuotePages', -- insource locators allowed to hold urls
}
local function build_skip_table (skip_t, meta_params)
for _, meta_param in ipairs (meta_params) do -- for each meta parameter key
local params = aliases[meta_param]; -- get the parameter or the table of parameters associated with the meta parameter name
if 'string' == type (params) then
skip_t[params] = 1; -- just a single parameter
else
for _, param in ipairs (params) do -- get the parameter name
skip_t[param] = 1; -- add the parameter name to the skip table
local count;
param, count = param:gsub ('#', ''); -- remove enumerator marker from enumerated parameters
if 0 ~= count then -- if removed
skip_t[param] = 1; -- add param name without enumerator marker
end
end
end
end
return skip_t;
end
local punct_skip = {};
local url_skip = {};
--[[--------------------------< U R L _ A C C E S S _ M A P >--------------------------------------------------
this table used by the wikipedia library url test, has_twl_url(), which automatically sets a url-access parameter
to 'subscription' when it discovers a wikipedia library url in any of the url-holding paramters used as keys in
this table.
translators: if your wiki uses parameter names for these url-holding parameters and their matching -access parameters,
add your wiki's parameters to this list. Leave the English parameters in place.
TODO: is there a better way to do this?
]]
local url_access_map_t = {
['chapter-url'] = 'chapter-url-access',
['contribution-url'] = 'contribution-url-access',
['entry-url'] = 'entry-url-access',
['article-url'] = 'article-url-access',
['section-url'] = 'section-url-access',
['map-url'] = 'map-url-access',
['mapurl'] = 'map-url-access',
['url'] = 'url-access',
['URL'] = 'url-access'
}
--[[--------------------------< S I N G L E - L E T T E R S E C O N D - L E V E L D O M A I N S >----------
this is a list of tlds that are known to have single-letter second-level domain names. This list does not include
ccTLDs which are accepted in is_domain_name().
]]
local single_letter_2nd_lvl_domains_t = {'cash', 'company', 'foundation', 'media', 'org', 'today'};
--[[-----------< S P E C I A L C A S E T R A N S L A T I O N S >------------
This table is primarily here to support internationalization. Translations in
this table are used, for example, when an error message, category name, etc.,
is extracted from the English alias key. There may be other cases where
this translation table may be useful.
]]
local is_Latn = 'A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191';
local special_case_translation = {
author = 'author',
editor = 'editor',
name_list_params = '$1-name-list parameters', -- $1 is 'author' or 'editor'; used with err_redundant_parameters
['AuthorList'] = 'authors list', -- used to assemble maintenance category names
['ContributorList'] = 'contributors list', -- translation of these names plus translation of the base maintenance category names in maint_cats{} table below
['EditorList'] = 'editors list', -- must match the names of the actual categories
['InterviewerList'] = 'interviewers list', -- this group or translations used by name_has_ed_markup() and name_has_mult_names()
['TranslatorList'] = 'translators list',
-- Lua patterns to match pseudo-titles used by InternetArchiveBot and others as placeholder for unknown |title= value
['archived_copy'] = { -- used with CS1 maint: Archive[d] copy as title
['en'] = '^archived?%s+copy$', -- for English; translators: keep this because templates imported from en.wiki
['local'] = nil, -- translators: replace ['local'] = nil with lowercase translation only when bots or tools create generic titles in your language
},
-- Lua patterns to match generic titles; usually created by bots or reference filling tools
-- translators: replace ['local'] = nil with lowercase translation only when bots or tools create generic titles in your language
-- generic titles and patterns in this table should be lowercase only
-- leave ['local'] nil except when there is a matching generic title in your language
-- boolean 'true' for plain-text searches; 'false' for pattern searches
['generic_titles'] = {
['accept'] = {
},
['reject'] = {
{['en'] = {'^wayback%s+machine$', false}, ['local'] = nil},
{['en'] = {'are you a robot', true}, ['local'] = nil},
{['en'] = {'hugedomains', true}, ['local'] = nil},
{['en'] = {'^[%(%[{<]?no +title[>}%]%)]?$', false}, ['local'] = nil},
{['en'] = {'page not found', true}, ['local'] = nil},
{['en'] = {'subscribe to read', true}, ['local'] = nil},
{['en'] = {'^[%(%[{<]?unknown[>}%]%)]?$', false}, ['local'] = nil},
{['en'] = {'website is for sale', true}, ['local'] = nil},
{['en'] = {'^404', false}, ['local'] = nil},
{['en'] = {'error[ %-]404', false}, ['local'] = nil},
{['en'] = {'internet archive wayback machine', true}, ['local'] = nil},
{['en'] = {'log into facebook', true}, ['local'] = nil},
{['en'] = {'login • instagram', true}, ['local'] = nil},
{['en'] = {'redirecting...', true}, ['local'] = nil},
{['en'] = {'usurped title', true}, ['local'] = nil}, -- added by a GreenC bot
{['en'] = {'wayback machine', true}, ['local'] = nil},
{['en'] = {'webcite query result', true}, ['local'] = nil},
{['en'] = {'wikiwix\'s cache', true}, ['local'] = nil},
{['en'] = {'bot verification', true}, ['local'] = nil},
}
},
-- boolean 'true' for plain-text searches, search string must be lowercase only
-- boolean 'false' for pattern searches
-- leave ['local'] nil except when there is a matching generic name in your language
['generic_names'] = {
['accept'] = {
{['en'] = {'%[%[[^|]*%(author%) *|[^%]]*%]%]', false}, ['local'] = nil},
},
['reject'] = {
{['en'] = {'about us', true}, ['local'] = nil},
{['en'] = {'%f[%a][Aa]dvisor%f[%A]', false}, ['local'] = nil},
{['en'] = {'allmusic', true}, ['local'] = nil},
{['en'] = {'%f[%a][Aa]uthor%f[%A]', false}, ['local'] = nil},
{['en'] = {'^[Bb]ureau$', false}, ['local'] = nil},
{['en'] = {'business', true}, ['local'] = nil},
{['en'] = {'cnn', true}, ['local'] = nil},
{['en'] = {'collaborator', true}, ['local'] = nil},
{['en'] = {'^[Cc]ompany$', false}, ['local'] = nil},
{['en'] = {'contributor', true}, ['local'] = nil},
{['en'] = {'contact us', true}, ['local'] = nil},
{['en'] = {'correspondent', true}, ['local'] = nil},
{['en'] = {'^[Dd]esk$', false}, ['local'] = nil},
{['en'] = {'directory', true}, ['local'] = nil},
{['en'] = {'%f[%(%[][%(%[]%s*eds?%.?%s*[%)%]]?$', false}, ['local'] = nil},
{['en'] = {'[,%.%s]%f[e]eds?%.?$', false}, ['local'] = nil},
{['en'] = {'^eds?[%.,;]', false}, ['local'] = nil},
{['en'] = {'^[%(%[]%s*[Ee][Dd][Ss]?%.?%s*[%)%]]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]dited%f[%A]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]ditors?%f[%A]', false}, ['local'] = nil},
{['en'] = {'%f[%a][Ee]mail%f[%A]', false}, ['local'] = nil},
{['en'] = {'facebook', true}, ['local'] = nil},
{['en'] = {'google', true}, ['local'] = nil},
{['en'] = {'^[Gg]roup$', false}, ['local'] = nil},
{['en'] = {'home page', true}, ['local'] = nil},
{['en'] = {'^[Ii]nc%.?$', false}, ['local'] = nil},
{['en'] = {'instagram', true}, ['local'] = nil},
{['en'] = {'interviewer', true}, ['local'] = nil},
{['en'] = {'^[Ll]imited$', false}, ['local'] = nil},
{['en'] = {'linkedIn', true}, ['local'] = nil},
{['en'] = {'^[Nn]ews$', false}, ['local'] = nil},
{['en'] = {'[Nn]ews[ %-]?[Rr]oom', false}, ['local'] = nil},
{['en'] = {'pinterest', true}, ['local'] = nil},
{['en'] = {'policy', true}, ['local'] = nil},
{['en'] = {'privacy', true}, ['local'] = nil},
{['en'] = {'reuters', true}, ['local'] = nil},
{['en'] = {'translator', true}, ['local'] = nil},
{['en'] = {'tumblr', true}, ['local'] = nil},
{['en'] = {'twitter', true}, ['local'] = nil},
{['en'] = {'site name', true}, ['local'] = nil},
{['en'] = {'statement', true}, ['local'] = nil},
{['en'] = {'submitted', true}, ['local'] = nil},
{['en'] = {'super.?user', false}, ['local'] = nil},
{['en'] = {'%f['..is_Latn..'][Uu]ser%f[^'..is_Latn..']', false}, ['local'] = nil},
{['en'] = {'updated', true}, ['local'] = nil},
{['en'] = {'verfasser', true}, ['local'] = nil},
}
}
}
--[[--------------------------< D A T E _ N A M E S >----------------------------------------------------------
This table of tables lists local language date names and fallback English date names.
The code in Date_validation will look first in the local table for valid date names.
If date names are not found in the local table, the code will look in the English table.
Because citations can be copied to the local wiki from en.wiki, the English is
required when the date-name translation function date_name_xlate() is used.
In these tables, season numbering is defined by
Extended Date/Time Format (EDTF) Specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard
defines various divisions using numbers 21-41. CS1|2 only supports generic seasons.
EDTF does support the distinction between north and south hemisphere seasons
but CS1|2 has no way to make that distinction.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
The standard does not address 'named' dates so, for the purposes of CS1|2,
Easter and Christmas are defined here as 98 and 99, which should be out of the
ISO 8601 (EDTF) range of uses for a while.
local_date_names_from_mediawiki is a boolean. When set to:
true – module will fetch local month names from MediaWiki for both date_names['local']['long'] and date_names['local']['short']; this will unconditionally overwrite manual translations
false – module will *not* fetch local month names from MediaWiki
Caveat lector: There is no guarantee that MediaWiki will provide short month names. At your wiki you can test
the results of the MediaWiki fetch in the debug console with this command (the result is alpha sorted):
=mw.dumpObject (p.date_names['local'])
While the module can fetch month names from MediaWiki, it cannot fetch the quarter, season, and named date names
from MediaWiki. Those must be translated manually.
]]
local local_date_names_from_mediawiki = true; -- when false, manual translation required for date_names['local']['long'] and date_names['local']['short']; overwrites manual translations
-- when true, module fetches long and short month names from MediaWiki
local date_names = {
['en'] = { -- English
['long'] = {['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12},
['short'] = {['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12},
['quarter'] = {['First Quarter'] = 33, ['Second Quarter'] = 34, ['Third Quarter'] = 35, ['Fourth Quarter'] = 36},
['season'] = {['Winter'] = 24, ['Spring'] = 21, ['Summer'] = 22, ['Fall'] = 23, ['Autumn'] = 23},
['named'] = {['Easter'] = 98, ['Christmas'] = 99},
},
-- when local_date_names_from_mediawiki = false
['local'] = { -- replace these English date names with the local language equivalents
['long'] = {['January'] = 1, ['February'] = 2, ['March'] = 3, ['April'] = 4, ['May'] = 5, ['June'] = 6, ['July'] = 7, ['August'] = 8, ['September'] = 9, ['October'] = 10, ['November'] = 11, ['December'] = 12},
['short'] = {['Jan'] = 1, ['Feb'] = 2, ['Mar'] = 3, ['Apr'] = 4, ['May'] = 5, ['Jun'] = 6, ['Jul'] = 7, ['Aug'] = 8, ['Sep'] = 9, ['Oct'] = 10, ['Nov'] = 11, ['Dec'] = 12},
['quarter'] = {['First Quarter'] = 33, ['Second Quarter'] = 34, ['Third Quarter'] = 35, ['Fourth Quarter'] = 36},
['season'] = {['Winter'] = 24, ['Spring'] = 21, ['Summer'] = 22, ['Fall'] = 23, ['Autumn'] = 23},
['named'] = {['Easter'] = 98, ['Christmas'] = 99},
},
['inv_local_long'] = {}, -- used in date reformatting & translation; copy of date_names['local'].long where k/v are inverted: [1]='<local name>' etc.
['inv_local_short'] = {}, -- used in date reformatting & translation; copy of date_names['local'].short where k/v are inverted: [1]='<local name>' etc.
['inv_local_quarter'] = {}, -- used in date translation; copy of date_names['local'].quarter where k/v are inverted: [1]='<local name>' etc.
['inv_local_season'] = {}, -- used in date translation; copy of date_names['local'].season where k/v are inverted: [1]='<local name>' etc.
['inv_local_named'] = {}, -- used in date translation; copy of date_names['local'].named where k/v are inverted: [1]='<local name>' etc.
['local_digits'] = {['0'] = '0', ['1'] = '1', ['2'] = '2', ['3'] = '3', ['4'] = '4', ['5'] = '5', ['6'] = '6', ['7'] = '7', ['8'] = '8', ['9'] = '9'}, -- used to convert local language digits to Western 0-9
['xlate_digits'] = {},
}
if local_date_names_from_mediawiki then -- if fetching local month names from MediaWiki is enabled
local long_t = {};
local short_t = {};
for i=1, 12 do -- loop 12x and
local name = lang_obj:formatDate('F', '2022-' .. i .. '-1'); -- get long month name for each i
long_t[name] = i; -- save it
name = lang_obj:formatDate('M', '2022-' .. i .. '-1'); -- get short month name for each i
short_t[name] = i; -- save it
end
date_names['local']['long'] = long_t; -- write the long table – overwrites manual translation
date_names['local']['short'] = short_t; -- write the short table – overwrites manual translation
end
-- create inverted date-name tables for reformatting and/or translation
for _, invert_t in pairs {{'long', 'inv_local_long'}, {'short', 'inv_local_short'}, {'quarter', 'inv_local_quarter'}, {'season', 'inv_local_season'}, {'named', 'inv_local_named'}} do
for name, i in pairs (date_names['local'][invert_t[1]]) do -- this table is ['name'] = i
date_names[invert_t[2]][i] = name; -- invert to get [i] = 'name' for conversions from ymd
end
end
if local_digits_from_mediawiki then -- if fetching local digits from MediaWiki is enabled
local digits_t = {};
for i=0, 9 do -- loop 10x and
digits_t [lang_obj:formatNum (i)] = tostring (i); -- format the loop indexer as local lang table index and assign loop indexer (a string) as the value
end
date_names['local_digits'] = digits_t;
end
for ld, ed in pairs (date_names.local_digits) do -- make a digit translation table for simple date translation from en to local language using local_digits table
date_names.xlate_digits [ed] = ld; -- en digit becomes index with local digit as the value
end
local df_template_patterns = { -- table of redirects to {{Use dmy dates}} and {{Use mdy dates}}
'{{ *[Uu]se +(dmy) +dates *[|}]', -- 1159k -- sorted by approximate transclusion count
'{{ *[Uu]se +(mdy) +dates *[|}]', -- 212k
'{{ *[Uu]se +(MDY) +dates *[|}]', -- 788
'{{ *[Uu]se +(DMY) +dates *[|}]', -- 343
'{{ *([Mm]dy) *[|}]', -- 176
'{{ *[Uu]se *(dmy) *[|}]', -- 156 + 18
'{{ *[Uu]se *(mdy) *[|}]', -- 149 + 11
'{{ *([Dd]my) *[|}]', -- 56
'{{ *[Uu]se +(MDY) *[|}]', -- 5
'{{ *([Dd]MY) *[|}]', -- 3
'{{ *[Uu]se(mdy)dates *[|}]', -- 1
'{{ *[Uu]se +(DMY) *[|}]', -- 0
'{{ *([Mm]DY) *[|}]', -- 0
}
local title_object = mw.title.getCurrentTitle();
local content; -- done this way so that unused templates appear in unused-template-reports; self-transcluded makes them look like they are used
if 10 ~= title_object.namespace then -- all namespaces except Template
content = title_object:getContent() or ''; -- get the content of the article or ''; new pages edited w/ve do not have 'content' until saved; ve does not preview; phab:T221625
end
local function get_date_format ()
if not content then -- nil content when we're in template
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
for _, pattern in ipairs (df_template_patterns) do -- loop through the patterns looking for {{Use dmy dates}} or {{Use mdy dates}} or any of their redirects
local start, _, match = content:find(pattern); -- match is the three letters indicating desired date format
if match then
local use_dates_template = content:match ('%b{}', start); -- get the whole template
if use_dates_template:match ('| *cs1%-dates *= *[lsy][sy]?') then -- look for |cs1-dates=publication date length access-/archive-date length
return match:lower() .. '-' .. use_dates_template:match ('| *cs1%-dates *= *([lsy][sy]?)');
else
return match:lower() .. '-all'; -- no |cs1-dates= k/v pair; return value appropriate for use in |df=
end
end
end
end
--[[-----------------< V O L U M E , I S S U E , P A G E S >------------------
These tables hold cite class values (from the template invocation) and identify those templates that support
|volume=, |issue=, and |page(s)= parameters. Cite conference and cite map require further qualification which
is handled in the main module.
]]
local templates_using_volume = {'citation', 'audio-visual', 'book', 'conference', 'encyclopaedia', 'interview', 'journal', 'magazine', 'map', 'news', 'report', 'techreport', 'thesis'}
local templates_using_issue = {'citation', 'conference', 'episode', 'interview', 'journal', 'magazine', 'map', 'news', 'podcast'}
local templates_not_using_page = {'audio-visual', 'episode', 'mailinglist', 'newsgroup', 'podcast', 'serial', 'sign', 'speech'}
--[[
These tables control when it is appropriate for {{citation}} to render |volume= and/or |issue=. The parameter
names in the tables constrain {{citation}} so that its renderings match the renderings of the equivalent cs1
templates. For example, {{cite web}} does not support |volume= so the equivalent {{citation |website=...}} must
not support |volume=.
]]
local citation_no_volume_t = { -- {{citation}} does not render |volume= when these parameters are used
'website', 'mailinglist', 'script-website',
}
local citation_issue_t = { -- {{citation}} may render |issue= when these parameters are used
'journal', 'magazine', 'newspaper', 'periodical', 'work',
'script-journal', 'script-magazine', 'script-newspaper', 'script-periodical', 'script-work',
}
--[[
Patterns for finding extra text in |volume=, |issue=, |page=, |pages=
]]
local vol_iss_pg_patterns = {
good_ppattern = '^P[^%.PpGg]', -- OK to begin with uppercase P: P7 (page 7 of section P), but not p123 (page 123); TODO: this allows 'Pages' which it should not
bad_ppatterns = { -- patterns for |page= and |pages=
'^[Pp][PpGg]?%.?[ %d]',
'^[Pp][Pp]?%. ', -- from {{p.}} and {{pp.}} templates
'^[Pp]ages?',
'^[Pp]gs.?',
},
vi_patterns_t = { -- combined to catch volume-like text in |issue= and issue-like text in |volume=
'^volumes?', -- volume-like text
'^vols?[%.:=]?',
'^issues?', --issue-like text
'^iss[%.:=]?',
'^numbers?',
'^nos?%A', -- don't match 'november' or 'nostradamus'
'^nr[%.:=]?',
'^n[%.:= ]', -- might be a valid issue without separator (space char is sep char here)
'^n°', -- 'n' with degree sign (U+00B0)
'^№', -- precomposed unicode numero character (U+2116)
},
}
--[[--------------------------< K E Y W O R D S >-------------------------------
These tables hold keywords for those parameters that have defined sets of acceptable keywords.
]]
--[[-------------------< K E Y W O R D S T A B L E >--------------------------
this is a list of keywords; each key in the list is associated with a table of
synonymous keywords possibly from different languages.
for I18N: add local-language keywords to value table; do not change the key.
For example, adding the German keyword 'ja':
['affirmative'] = {'yes', 'true', 'y', 'ja'},
Because CS1|2 templates from en.wiki articles are often copied to other local wikis,
it is recommended that the English keywords remain in these tables.
]]
local keywords = {
['amp'] = {'&', 'amp', 'ampersand'}, -- |name-list-style=
['and'] = {'and', 'serial'}, -- |name-list-style=
['affirmative'] = {'yes', 'true', 'y'}, -- |no-tracking=, |no-pp= -- Used by InternetArchiveBot
['afterword'] = {'afterword'}, -- |contribution=
['bot: unknown'] = {'bot: unknown'}, -- |url-status= -- Used by InternetArchiveBot
['cs1'] = {'cs1'}, -- |mode=
['cs2'] = {'cs2'}, -- |mode=
['dead'] = {'dead', 'deviated'}, -- |url-status= -- Used by InternetArchiveBot
['dmy'] = {'dmy'}, -- |df=
['dmy-all'] = {'dmy-all'}, -- |df=
etal = {'etal'}, -- |display-authors=, etc
['foreword'] = {'foreword'}, -- |contribution=
['free'] = {'free'}, -- |<id>-access= -- Used by InternetArchiveBot
['harv'] = {'harv'}, -- |ref=; this no longer supported; is_valid_parameter_value() called with <invert> = true
['introduction'] = {'introduction'}, -- |contribution=
['limited'] = {'limited'}, -- |url-access= -- Used by InternetArchiveBot
['live'] = {'live'}, -- |url-status= -- Used by InternetArchiveBot
['mdy'] = {'mdy'}, -- |df=
['mdy-all'] = {'mdy-all'}, -- |df=
['none'] = {'none'}, -- |postscript=, |ref=, |title=, |type= -- Used by InternetArchiveBot
['off'] = {'off'}, -- |title= (potentially also: |title-link=, |postscript=, |ref=, |type=)
['preface'] = {'preface'}, -- |contribution=
['registration'] = {'registration'}, -- |url-access= -- Used by InternetArchiveBot
['subscription'] = {'subscription'}, -- |url-access= -- Used by InternetArchiveBot
['unfit'] = {'unfit'}, -- |url-status= -- Used by InternetArchiveBot
['usurped'] = {'usurped'}, -- |url-status= -- Used by InternetArchiveBot
['vanc'] = {'vanc'}, -- |name-list-style=
['ymd'] = {'ymd'}, -- |df=
['ymd-all'] = {'ymd-all'}, -- |df=
-- ['yMd'] = {'yMd'}, -- |df=; not supported at en.wiki
-- ['yMd-all'] = {'yMd-all'}, -- |df=; not supported at en.wiki
}
--[[------------------------< X L A T E _ K E Y W O R D S >---------------------
this function builds a list, keywords_xlate{}, of the keywords found in keywords{} where the values from keywords{}
become the keys in keywords_xlate{} and the keys from keywords{} become the values in keywords_xlate{}:
['affirmative'] = {'yes', 'true', 'y'}, -- in keywords{}
becomes
['yes'] = 'affirmative', -- in keywords_xlate{}
['true'] = 'affirmative',
['y'] = 'affirmative',
the purpose of this function is to act as a translator between a non-English keyword and its English equivalent
that may be used in other modules of this suite
]]
local function xlate_keywords ()
local out_table = {}; -- output goes here
for k, keywords_t in pairs (keywords) do -- spin through the keywords table
for _, keyword in ipairs (keywords_t) do -- for each keyword
out_table[keyword] = k; -- create an entry in the output table where keyword is the key
end
end
return out_table;
end
local keywords_xlate = xlate_keywords (); -- the list of translated keywords
--[[----------------< M A K E _ K E Y W O R D S _ L I S T >---------------------
this function assembles, for parameter-value validation, the list of keywords appropriate to that parameter.
keywords_lists{}, is a table of tables from keywords{}
]]
local function make_keywords_list (keywords_lists)
local out_table = {}; -- output goes here
for _, keyword_list in ipairs (keywords_lists) do -- spin through keywords_lists{} and get a table of keywords
for _, keyword in ipairs (keyword_list) do -- spin through keyword_list{} and add each keyword, ...
table.insert (out_table, keyword); -- ... as plain text, to the output list
end
end
return out_table;
end
--[[----------------< K E Y W O R D S _ L I S T S >-----------------------------
this is a list of lists of valid keywords for the various parameters in [key].
Generally the keys in this table are the canonical en.wiki parameter names though
some are contrived because of use in multiple differently named parameters:
['yes_true_y'], ['id-access'].
The function make_keywords_list() extracts the individual keywords from the
appropriate list in keywords{}.
The lists in this table are used to validate the keyword assignment for the
parameters named in this table's keys.
]]
local keywords_lists = {
['yes_true_y'] = make_keywords_list ({keywords.affirmative}),
['contribution'] = make_keywords_list ({keywords.afterword, keywords.foreword, keywords.introduction, keywords.preface}),
['df'] = make_keywords_list ({keywords.dmy, keywords['dmy-all'], keywords.mdy, keywords['mdy-all'], keywords.ymd, keywords['ymd-all']}),
-- ['df'] = make_keywords_list ({keywords.dmy, keywords['dmy-all'], keywords.mdy, keywords['mdy-all'], keywords.ymd, keywords['ymd-all'], keywords.yMd, keywords['yMd-all']}), -- not supported at en.wiki
['mode'] = make_keywords_list ({keywords.cs1, keywords.cs2}),
['name-list-style'] = make_keywords_list ({keywords.amp, keywords['and'], keywords.vanc}),
['ref'] = make_keywords_list ({keywords.harv}), -- inverted check; |ref=harv no longer supported
['url-access'] = make_keywords_list ({keywords.subscription, keywords.limited, keywords.registration}),
['url-status'] = make_keywords_list ({keywords.dead, keywords.live, keywords.unfit, keywords.usurped, keywords['bot: unknown']}),
['id-access'] = make_keywords_list ({keywords.free}),
}
--[[--------------------------< C S 1 _ C O N F I G _ G E T >--------------------------------------------------
fetch and validate values from {{cs1 config}} template to fill <global_cs1_config_t>
no error messages; when errors are detected, the parameter value from {{cs1 config}} is blanked.
Supports all parameters and aliases associated with the metaparameters: DisplayAuthors, DisplayContributors,
DisplayEditors, DisplayInterviewers, DisplayTranslators, NameListStyle, and Mode. The DisplayWhatever metaparameters
accept numeric values only (|display-authors=etal and the like is not supported).
]]
local global_cs1_config_t = {}; -- TODO: add value returned from get_date_format() to this table?
local function get_cs1_config ()
if not content then -- nil content when we're in template
return nil; -- auto-formatting does not work in Template space so don't set global_df
end
local start = content:find('{{ *[Cc][Ss]1 config *[|}]'); -- <start> is offset into <content> when {{cs1 config}} found; nil else
if start then
local cs1_config_template = content:match ('%b{}', start); -- get the whole template
if not cs1_config_template then
return nil;
end
local params_t = mw.text.split (cs1_config_template:gsub ('^{{%s*', ''):gsub ('%s*}}$', ''), '%s*|%s*'); -- remove '{{' and '}}'; make a sequence of parameter/value pairs (split on the pipe)
table.remove (params_t, 1); -- remove the template name because it isn't a parameter/value pair
local config_meta_params_t = {'DisplayAuthors', 'DisplayContributors', 'DisplayEditors', 'DisplayInterviewers', 'DisplayTranslators', 'NameListStyle', 'Mode'};
local meta_param_map_t = {}; -- list of accepted parameter names usable in {{cs1 config}} goes here
for _, meta_param in ipairs (config_meta_params_t) do -- for i18n using <config_meta_params_t>, map template parameter names to their metaparameter equivalents
if 'table' == type (aliases[meta_param]) then -- if <meta_param> is a sequence,
for _, param in ipairs (aliases[meta_param]) do -- extract its contents
meta_param_map_t[param] = meta_param; -- and add to <meta_param_map_t>
end
else
meta_param_map_t[aliases[meta_param]] = meta_param; -- not a sequence so just add the parameter to <meta_param_map_t>
end
end
local keywords_t = {}; -- map valid keywords to their associate metaparameter; reverse form of <keyword_lists[key] for these metaparameters
for _, metaparam_t in ipairs ({{'NameListStyle', 'name-list-style'}, {'Mode', 'mode'}}) do -- only these metaparameter / keywords_lists key pairs
for _, keyword in ipairs (keywords_lists[metaparam_t[2]]) do -- spin through the list of keywords
keywords_t[keyword] = metaparam_t[1]; -- add [keyword] = metaparameter to the map
end
end
for _, param in ipairs (params_t) do -- spin through the {{cs1 config}} parameters and fill <global_cs1_config_t>
local k, v = param:match ('([^=]-)%s*=%s*(.+)'); -- <k> is the parameter name; <v> is parameter's assigned value
if k then
if k:find ('^display') then -- if <k> is one of the |display-<namelist>= parameters
if v:match ('%d+') then -- the assigned value must be digits; doesn't accept 'etal'
global_cs1_config_t[meta_param_map_t[k]]=v; -- add the display param and its value to globals table
end
else
if keywords_t[v] == meta_param_map_t[k] then -- keywords_t[v] returns nil or the metaparam name; these must be the same
global_cs1_config_t[meta_param_map_t[k]]=v; -- add the parameter and its value to globals table
end
end
end
end
end
end
get_cs1_config (); -- fill <global_cs1_config_t>
--[[---------------------< S T R I P M A R K E R S >----------------------------
Common pattern definition location for stripmarkers so that we don't have to go
hunting for them if (when) MediaWiki changes their form.
]]
local stripmarkers = {
['any'] = '\127[^\127]*UNIQ%-%-(%a+)%-[%a%d]+%-QINU[^\127]*\127', -- capture returns name of stripmarker
['math'] = '\127[^\127]*UNIQ%-%-math%-[%a%d]+%-QINU[^\127]*\127' -- math stripmarkers used in coins_cleanup() and coins_replace_math_stripmarker()
}
--[[------------< I N V I S I B L E _ C H A R A C T E R S >---------------------
This table holds non-printing or invisible characters indexed either by name or
by Unicode group. Values are decimal representations of UTF-8 codes. The table
is organized as a table of tables because the Lua pairs keyword returns table
data in an arbitrary order. Here, we want to process the table from top to bottom
because the entries at the top of the table are also found in the ranges specified
by the entries at the bottom of the table.
Also here is a pattern that recognizes stripmarkers that begin and end with the
delete characters. The nowiki stripmarker is not an error but some others are
because the parameter values that include them become part of the template's
metadata before stripmarker replacement.
]]
local invisible_defs = {
del = '\127', -- used to distinguish between stripmarker and del char
zwj = '\226\128\141', -- used with capture because zwj may be allowed
}
local invisible_chars = {
{'replacement', '\239\191\189'}, -- U+FFFD, EF BF BD
{'zero width joiner', '('.. invisible_defs.zwj .. ')'}, -- U+200D, E2 80 8D; capture because zwj may be allowed
{'zero width space', '\226\128\139'}, -- U+200B, E2 80 8B
{'hair space', '\226\128\138'}, -- U+200A, E2 80 8A
{'soft hyphen', '\194\173'}, -- U+00AD, C2 AD
{'horizontal tab', '\009'}, -- U+0009 (HT), 09
{'line feed', '\010'}, -- U+000A (LF), 0A
{'no-break space', '\194\160'}, -- U+00A0 (NBSP), C2 A0
{'carriage return', '\013'}, -- U+000D (CR), 0D
{'stripmarker', stripmarkers.any}, -- stripmarker; may or may not be an error; capture returns the stripmaker type
{'delete', '('.. invisible_defs.del .. ')'}, -- U+007F (DEL), 7F; must be done after stripmarker test; capture to distinguish isolated del chars not part of stripmarker
{'C0 control', '[\000-\008\011\012\014-\031]'}, -- U+0000–U+001F (NULL–US), 00–1F (except HT, LF, CR (09, 0A, 0D))
{'C1 control', '[\194\128-\194\159]'}, -- U+0080–U+009F (XXX–APC), C2 80 – C2 9F
-- {'Specials', '[\239\191\185-\239\191\191]'}, -- U+FFF9-U+FFFF, EF BF B9 – EF BF BF
-- {'Private use area', '[\238\128\128-\239\163\191]'}, -- U+E000–U+F8FF, EE 80 80 – EF A3 BF
-- {'Supplementary Private Use Area-A', '[\243\176\128\128-\243\191\191\189]'}, -- U+F0000–U+FFFFD, F3 B0 80 80 – F3 BF BF BD
-- {'Supplementary Private Use Area-B', '[\244\128\128\128-\244\143\191\189]'}, -- U+100000–U+10FFFD, F4 80 80 80 – F4 8F BF BD
}
--[[
Indic script makes use of zero width joiner as a character modifier so zwj
characters must be left in. This pattern covers all of the unicode characters
for these languages:
Devanagari 0900–097F – https://unicode.org/charts/PDF/U0900.pdf
Devanagari extended A8E0–A8FF – https://unicode.org/charts/PDF/UA8E0.pdf
Bengali 0980–09FF – https://unicode.org/charts/PDF/U0980.pdf
Gurmukhi 0A00–0A7F – https://unicode.org/charts/PDF/U0A00.pdf
Gujarati 0A80–0AFF – https://unicode.org/charts/PDF/U0A80.pdf
Oriya 0B00–0B7F – https://unicode.org/charts/PDF/U0B00.pdf
Tamil 0B80–0BFF – https://unicode.org/charts/PDF/U0B80.pdf
Telugu 0C00–0C7F – https://unicode.org/charts/PDF/U0C00.pdf
Kannada 0C80–0CFF – https://unicode.org/charts/PDF/U0C80.pdf
Malayalam 0D00–0D7F – https://unicode.org/charts/PDF/U0D00.pdf
plus the not-necessarily Indic scripts for Sinhala and Burmese:
Sinhala 0D80-0DFF - https://unicode.org/charts/PDF/U0D80.pdf
Myanmar 1000-109F - https://unicode.org/charts/PDF/U1000.pdf
Myanmar extended A AA60-AA7F - https://unicode.org/charts/PDF/UAA60.pdf
Myanmar extended B A9E0-A9FF - https://unicode.org/charts/PDF/UA9E0.pdf
the pattern is used by has_invisible_chars() and coins_cleanup()
]]
local indic_script = '[\224\164\128-\224\181\191\224\163\160-\224\183\191\225\128\128-\225\130\159\234\167\160-\234\167\191\234\169\160-\234\169\191]';
-- list of emoji that use a zwj character (U+200D) to combine with another emoji
-- from: https://unicode.org/Public/emoji/17.0/emoji-zwj-sequences.txt; version: 17.0; 2025-01-08
-- table created by: [[:en:Module:Make emoji zwj table]]
local emoji_t = { -- indexes are decimal forms of the hex values in U+xxxx
[8596] = true, -- U+2194 ↔ left right arrow
[8597] = true, -- U+2195 ↕ up down arrow
[9760] = true, -- U+2620 ☠ skull and crossbones
[9792] = true, -- U+2640 ♀ female sign
[9794] = true, -- U+2642 ♂ male sign
[9877] = true, -- U+2695 ⚕ staff of aesculapius
[9878] = true, -- U+2696 ⚖ scales
[9895] = true, -- U+26A7 ⚧ male with stroke and male and female sign
[9992] = true, -- U+2708 ✈ airplane
[10052] = true, -- U+2744 ❄ snowflake
[10084] = true, -- U+2764 ❤ heavy black heart
[10145] = true, -- U+27A1 ➡ black rightwards arrow
[11035] = true, -- U+2B1B ⬛ black large square
[127752] = true, -- U+1F308 🌈 rainbow
[127787] = true, -- U+1F32B 🌫 fog
[127806] = true, -- U+1F33E 🌾 ear of rice
[127859] = true, -- U+1F373 🍳 cooking
[127868] = true, -- U+1F37C 🍼 baby bottle
[127876] = true, -- U+1F384 🎄 christmas tree
[127891] = true, -- U+1F393 🎓 graduation cap
[127908] = true, -- U+1F3A4 🎤 microphone
[127912] = true, -- U+1F3A8 🎨 artist palette
[127979] = true, -- U+1F3EB 🏫 school
[127981] = true, -- U+1F3ED 🏭 factory
[128048] = true, -- U+1F430 🐰 rabbit face
[128102] = true, -- U+1F466 👦 boy
[128103] = true, -- U+1F467 👧 girl
[128104] = true, -- U+1F468 👨 man
[128105] = true, -- U+1F469 👩 woman
[128139] = true, -- U+1F48B 💋 kiss mark
[128165] = true, -- U+1F4A5 💥 collision symbol
[128168] = true, -- U+1F4A8 💨 dash symbol
[128171] = true, -- U+1F4AB 💫 dizzy symbol
[128187] = true, -- U+1F4BB 💻 personal computer
[128188] = true, -- U+1F4BC 💼 brief case
[128293] = true, -- U+1F525 🔥 fire
[128295] = true, -- U+1F527 🔧 wrench
[128300] = true, -- U+1F52C 🔬 microscope
[128488] = true, -- U+1F5E8 🗨 left speech bubble
[128640] = true, -- U+1F680 🚀 rocket
[128658] = true, -- U+1F692 🚒 fire engine
[129001] = true, -- U+1F7E9 🟩 large green square
[129003] = true, -- U+1F7EB 🟫 large brown square
[129309] = true, -- U+1F91D 🤝 handshake
[129455] = true, -- U+1F9AF 🦯 probing cane
[129456] = true, -- U+1F9B0 🦰 emoji component red hair
[129457] = true, -- U+1F9B1 🦱 emoji component curly hair
[129458] = true, -- U+1F9B2 🦲 emoji component bald
[129459] = true, -- U+1F9B3 🦳 emoji component white hair
[129466] = true, -- U+1F9BA 🦺 safety vest
[129468] = true, -- U+1F9BC 🦼 motorized wheelchair
[129469] = true, -- U+1F9BD 🦽 manual wheelchair
[129489] = true, -- U+1F9D1 🧑 adult
[129490] = true, -- U+1F9D2 🧒 child
[129648] = true, -- U+1FA70 🩰 ballet shoes
[129657] = true, -- U+1FA79 🩹 adhesive bandage
[129775] = true, -- U+1FAEF fight cloud
[129778] = true, -- U+1FAF2 🫲 leftwards hand
}
--[[----------------------< L A N G U A G E S U P P O R T >-------------------
These tables and constants support various language-specific functionality.
]]
--local this_wiki_code = mw.getContentLanguage():getCode(); -- get this wiki's language code
local this_wiki_code = lang_obj:getCode(); -- get this wiki's language code
if string.match (mw.site.server, 'wikidata') then
this_wiki_code = mw.getCurrentFrame():callParserFunction('int', {'lang'}); -- on Wikidata so use interface language setting instead
end
local mw_languages_by_tag_t = mw.language.fetchLanguageNames (this_wiki_code, 'all'); -- get a table of language tag/name pairs known to Wikimedia; used for interwiki tests
local mw_languages_by_name_t = {};
for k, v in pairs (mw_languages_by_tag_t) do -- build a 'reversed' table name/tag language pairs know to MediaWiki; used for |language=
v = mw.ustring.lower (v); -- lowercase for tag fetch; get name's proper case from mw_languages_by_tag_t[<tag>]
if mw_languages_by_name_t[v] then -- when name already in the table
if 2 == #k or 3 == #k then -- if tag does not have subtags
mw_languages_by_name_t[v] = k; -- prefer the shortest tag for this name
end
else -- here when name not in the table
mw_languages_by_name_t[v] = k; -- so add name and matching tag
end
end
local inter_wiki_map = {}; -- map of interwiki prefixes that are language-code prefixes
for k, v in pairs (mw.site.interwikiMap ('local')) do -- spin through the base interwiki map (limited to local)
if mw_languages_by_tag_t[v["prefix"]] then -- if the prefix matches a known language tag
inter_wiki_map[v["prefix"]] = true; -- add it to our local map
end
end
--[[--------------------< S C R I P T _ L A N G _ C O D E S >-------------------
This table is used to hold ISO 639-1 two-character and ISO 639-3 three-character
language codes that apply only to |script-title= and |script-chapter=
]]
local script_lang_codes = {
'ab', 'am', 'ar', 'as', 'az', 'be', 'bg', 'bn', 'bo', 'bs', 'ce', 'chr',
'cu', 'dv', 'dz', 'el', 'fa', 'grc', 'gu', 'he', 'hi', 'hy', 'ja', 'ka',
'kaa', 'kk', 'km', 'kn', 'ko', 'ku', 'ky', 'lo', 'mk', 'ml', 'mn', 'mni',
'mr', 'my', 'ne', 'or', 'ota', 'pa', 'ps', 'ru', 'sd', 'si', 'sr', 'syc',
'ta', 'te', 'tg', 'th', 'ti', 'tkr', 'tt', 'ug', 'uk', 'ur', 'uz', 'yi',
'yue', 'zh', 'zgh'
};
--[[---------------< L A N G U A G E R E M A P P I N G >----------------------
These tables hold language information that is different (correct) from MediaWiki's definitions
For each ['<tag>'] = 'language name' in lang_code_remap{} there must be a matching ['language name'] = {'language name', '<tag>'} in lang_name_remap{}
lang_tag_remap{}:
key is always lowercase ISO 639-1, -2, -3 language tag or a valid lowercase IETF language tag
value is properly spelled and capitalized language name associated with <tag>
only one language name per <tag>;
key/value pair must have matching entry in lang_name_remap{}
lang_name_remap{}:
key is always lowercase language name
value is a table the holds correctly spelled and capitalized language name [1] and associated tag [2] (tag must match a tag key in lang_tag_remap{})
may have multiple keys referring to a common preferred name and tag; For example:
['kolsch'] and ['kölsch'] both refer to 'Kölsch' and 'ksh'
]]
local lang_tag_remap = { -- used for |language= and |script-title= / |script-chapter=
['als'] = 'Tosk Albanian', -- MediaWiki returns Alemannisch
['bh'] = 'Bihari', -- MediaWiki uses 'bh' as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org
['bla'] = 'Blackfoot', -- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name
['bn'] = 'Bengali', -- MediaWiki returns Bangla
['ca-valencia'] = 'Valencian', -- IETF variant of Catalan
['fkv'] = 'Kven', -- MediaWiki returns Kvensk
['gsw'] = 'Swiss German',
['ilo'] = 'Ilocano', -- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name
['ksh'] = 'Kölsch', -- MediaWiki: Colognian; use IANA/ISO 639 preferred name
['ksh-x-colog'] = 'Colognian', -- override MediaWiki ksh; no IANA/ISO 639 code for Colognian; IETF private code created at Module:Lang/data
['mis-x-ripuar'] = 'Ripuarian', -- override MediaWiki ksh; no IANA/ISO 639 code for Ripuarian; IETF private code created at Module:Lang/data
['nan-tw'] = 'Taiwanese Hokkien', -- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese and support en.wiki preferred name
['sr-ec'] = 'Serbian (Cyrillic script)', -- MediaWiki returns српски (ћирилица)
['sr-el'] = 'Serbian (Latin script)', -- MediaWiki returns srpski (latinica)
}
local lang_name_remap = { -- used for |language=; names require proper capitalization; tags must be lowercase
['alemannic'] = {'Swiss German', 'gsw'}, -- ISO 639-2, -3 alternate for Swiss German; MediaWiki mediawiki returns Alemannic for gsw; en.wiki preferred name
['alemannisch'] = {'Swiss German', 'gsw'}, -- not an ISO or IANA language name; MediaWiki uses 'als' as a subdomain name for Alemannic Wikipedia: als.wikipedia.org
['bangla'] = {'Bengali', 'bn'}, -- MediaWiki returns Bangla (the endonym) but we want Bengali (the exonym); here we remap
['bengali'] = {'Bengali', 'bn'}, -- MediaWiki doesn't use exonym so here we provide correct language name and 639-1 code
['bhojpuri'] = {'Bhojpuri', 'bho'}, -- MediaWiki uses 'bh' as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org
['bihari'] = {'Bihari', 'bh'}, -- MediaWiki replaces 'Bihari' with 'Bhojpuri' so 'Bihari' cannot be found
['blackfoot'] = {'Blackfoot', 'bla'}, -- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name
['colognian'] = {'Colognian', 'ksh-x-colog'}, -- MediaWiki preferred name for ksh
['ilocano'] = {'Ilocano', 'ilo'}, -- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name
['kolsch'] = {'Kölsch', 'ksh'}, -- use IANA/ISO 639 preferred name (use non-diacritical o instead of umlaut ö)
['kölsch'] = {'Kölsch', 'ksh'}, -- use IANA/ISO 639 preferred name
['kven'] = {'Kven', 'fkv'}, -- Unicode CLDR have decided not to support English language name for these two...
['kvensk'] = {'Kven', 'fkv'}, -- ...they say to refer to IANA registry for English names
['ripuarian'] = {'Ripuarian', 'mis-x-ripuar'}, -- group of dialects; no code in MediaWiki or in IANA/ISO 639
['serbian (cyrillic script)'] = {'Serbian (Cyrillic script)', 'sr-cyrl'}, -- special case to get correct tag when |language=sr-ec
['serbian (latin script)'] = {'Serbian (Latin script)', 'sr-latn'}, -- special case to get correct tag when |language=sr-el
['swiss german'] = {'Swiss German', 'gsw'},
['taiwanese hokkien'] = {'Taiwanese Hokkien', 'nan-tw'}, -- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese
['tosk albanian'] = {'Tosk Albanian', 'als'}, -- MediaWiki replaces 'Tosk Albanian' with 'Alemannisch' so 'Tosk Albanian' cannot be found
['valencian'] = {'Valencian', 'ca-valencia'}, -- variant of Catalan; categorizes as Valencian
}
--[[---------------< P R O P E R T I E S _ C A T E G O R I E S >----------------
Properties categories. These are used for investigating qualities of citations.
]]
local prop_cats = {
['foreign-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is foreign-language name, $2 is ISO639-1 code
['foreign-lang-source-2'] = 'CS1 foreign language sources (ISO 639-2)|$1', -- |language= category; a cat for ISO639-2 languages; $1 is the ISO 639-2 code used as a sort key
['interproj-linked-name'] = 'CS1 interproject-linked names|$1', -- any author, editor, etc that has an interproject link; $1 is interproject tag used as a sort key
['interwiki-linked-name'] = 'CS1 interwiki-linked names|$1', -- any author, editor, etc that has an interwiki link; $1 is interwiki tag used as a sort key; yeilds to interproject
['local-lang-source'] = 'CS1 $1-language sources ($2)', -- |language= categories; $1 is local-language name, $2 is ISO639-1 code; not emitted when local_lang_cat_enable is false
['location-test'] = 'CS1 location test',
['long-vol'] = 'CS1: long volume value', -- probably temporary cat to identify scope of |volume= values longer than 4 characters
['script'] = 'CS1 uses $1-language script ($2)', -- |script-title=xx: has matching category; $1 is language name, $2 is language tag
['tracked-param'] = 'CS1 tracked parameter: $1', -- $1 is base (enumerators removed) parameter name
['unfit'] = 'CS1: unfit URL', -- |url-status=unfit or |url-status=usurped; used to be a maint cat
['vanc-accept'] = 'CS1:Vancouver names with accept markup', -- for |vauthors=/|veditors= with accept-as-written markup
['year-range-abbreviated'] = 'CS1: abbreviated year range', -- probably temporary cat to identify scope of |date=, |year= values using YYYY–YY form
}
--[[-------------------< T I T L E _ T Y P E S >--------------------------------
Here we map a template's CitationClass to TitleType (default values for |type= parameter)
]]
local title_types = {
['AV-media-notes'] = 'Media notes',
['document'] = 'Document',
['interview'] = 'Interview',
['mailinglist'] = 'Mailing list',
['map'] = 'Map',
['podcast'] = 'Podcast',
['pressrelease'] = 'Press release',
['report'] = 'Report',
['speech'] = 'Speech',
['techreport'] = 'Technical report',
['thesis'] = 'Thesis',
}
--[[--------------------------< B U I L D _ K N O W N _ F R E E _ D O I _ R E G I S T R A N T S _ T A B L E >--
build a table of doi registrants known to be free-to-read In a doi, the registrant ID is the series of digits
between the '10.' and the first '/': in doi 10.1100/sommat, 1100 is the registrant ID
see §3.2.2 DOI prefix of the Doi Handbook p. 43
https://www.doi.org/doi-handbook/DOI_Handbook_Final.pdf#page=43
]]
local function build_free_doi_registrants_table()
local registrants_t = {};
for _, v in ipairs ({
'1045', '1074', '1096', '1100', '1155', '1186', '1194', '1371', '1613', '1629', '1989', '1999', '2147', '2196', '3114', '3285',
'3389', '3390', '3767', '3906', '3748', '3814', '3847', '3897', '4061', '4089', '4103', '4172', '4175', '4230', '4236', '4239',
'4240', '4249', '4251', '4252', '4253', '4254', '4291', '4292', '4312', '4329', '4330', '4331', '5074', '5086', '5194',
'5210', '5306', '5312', '5313', '5314', '5315', '5316', '5317', '5318', '5319', '5320', '5321', '5334', '5402', '5409',
'5410', '5411', '5412', '5492', '5493', '5494', '5495', '5496', '5497', '5498', '5499', '5500', '5501', '5527', '5528',
'5662', '6064', '6219', '7167', '7217', '7287', '7482', '7490', '7554', '7717', '7759', '7766', '9778',
'11131', '11569', '11647', '11648', '12688', '12703', '12715', '12942', '12998', '13105', '14256', '14293', '14303', '14502', '14720',
'15215', '15227', '15292', '15458', '15347', '15412', '15560', '16995', '17573', '17645', '18553', '18637', '18757', '19080', '19173', '20419',
'20944', '21037', '21105', '21468', '21767', '21425', '22261', '22323', '22459', '24105', '24196', '24404', '24413', '24966', '26529',
'26614', '26775', '26873', '30845', '32545', '34291', '34641', '35711', '35712', '35713', '35995', '36648', '37126', '37532', '37871',
'47128', '47622', '47959', '48438', '51741', '51746', '51935', '51936', '51937', '51938', '51939', '51940', '52165', '52437', '52975',
'53288', '53347', '54081', '54947', '55295', '55667', '55741', '55914', '57009', '58647', '58782', '59081', '59490', '61375', '66183', '70587',
}) do
registrants_t[v] = true; -- build a k/v table of known free-to-read doi registrants
end
return registrants_t;
end
-- known free registrants identifiable by the doi suffix incipit
local extended_registrants_t = { -- doi suffix incipits are evaluated as lua patterns
['1001'] = {'jamanetworkopen'}, -- JAMA Network Open
['1002'] = {'1878-0261', '2056-4538', '2211-5463', '2475-8876', '2688-8319', 'aaai%.', 'aac2%.', 'ache%.', 'acm2%.', 'acn3%.', 'acr2%.', 'admi%.', 'adpr%.', 'adrr%.', 'adsr%.', 'advs%.', 'ael2%.', 'aelm%.', 'aesr%.', 'aff2%.', 'agf2%.', 'agg2%.', 'agm2%.', 'ags3%.', 'agt2%.', 'aidi%.', 'ail2%.', 'aisy%.', 'aiv2%.', 'alz%.', 'ame2%.', 'ams2%.', 'anbr%.', 'ansa%.', 'apj%.', 'app5%.', 'aps3%.', 'apxr%.', 'aro2%.', 'ars2%.', 'asl2%.', 'atn2%.', 'bco2%.', 'bes2%.', 'bmm2%.', 'bod2%.', 'brb3%.', 'brh2%.', 'brx2%.', 'bsa3%.', 'bte2%.', 'btm2%.', 'cai2%.', 'cam4%.', 'cbh2%.', 'ccr3%.', 'ccs3%.', 'cdt3%.', 'celc%.', 'cep4%.', 'ces2%.', 'cesm%.', 'ceur%.', 'cey2%.', 'cfch%.', 'cfp2%.', 'cin4%.', 'clc%.', 'clem%.', 'cli2%.', 'clt2%.', 'cmt2%.', 'cmtd%.', 'cnl2%.', 'cnr2%.', 'cns%.', 'cns3%.', 'cnx2%.', 'cre2%.', 'csc3%.', 'cso2%.', 'ctd2%.', 'cti2%.', 'ctm2%.', 'dad2%.', 'deo2%.', 'dep2%.', 'dni2%.', 'dro2%.', 'dug2%.', 'dvr2%.', 'eas2%.', 'ece2%.', 'ece3%.', 'ecog%.', 'ecs2%.', 'edm2%.', 'edn3%.', 'eem2%.', 'eer3%.', 'efd2%.', 'ejsc%.', 'elsa%.', 'elt2%.', 'eng2%.', 'eom2%.', 'epi4%.', 'epr2%.', 'ese3%.', 'exp%.', 'fbe2%.', 'fci2%.', 'fer3%.', 'fes3%.', 'fft2%.', 'fhu2%.', 'fle2%.', 'flm2%.', 'fob2%.', 'fpf2%.', 'fsh3%.', 'fsn3%.', 'gcb4%.', 'gch2%.', 'gdj3%.', 'geo2%.', 'ggn2%.', 'gin2%.', 'glr2%.', 'gps3%.', 'gtm2%.', 'hbm%.', 'hcs2%.', 'hem3%.', 'hkj2%.', 'hsr2%.', 'ibra%.', 'idm2%.', 'ifm2%.', 'iid3%.', 'iju5%.', 'ila2%.', 'imed%.', 'imm3%.', 'imo2%.', 'imt2%.', 'inc2%.', 'inc3%.', 'inf2%.', 'inm3%.', 'inmd%.', 'ird3%.', 'ise3%.', 'jaa2%.', 'jav%.', 'jbt%.', 'jcc5%.', 'jcla%.', 'jcsm%.', 'jcv2%.', 'jeo2%.', 'jev2%.', 'jex2%.', 'jfa2%.', 'jgf2%.', 'jgh3%.', 'jha2%.', 'jia2%.', 'jmd2%.', 'jmrs%.', 'joa3%.', 'jpr3%.', 'jsf2%.', 'jsp2%.', 'jvc2%.', 'kjm2%.', 'kot2%.', 'lci2%.', 'ldr%.', 'leap%.', 'leg3%.', 'lim2%.', 'lio2%.', 'loe2%.', 'lol2%.', 'lrh2%.', 'mame%.', 'mba2%.', 'mbo3%.', 'mco2%.', 'mdb2%.', 'mdr2%.', 'med4%.', 'mef2%.', 'met%.', 'metm%.', 'mgea%.', 'mgg3%.', 'mhs2%.', 'mlf2%.', 'mmr3%.', 'moda%.', 'mog2%.', 'mpr%.', 'mps2%.', 'msd2%.', 'nam2%.', 'nano%.', 'nap2%.', 'neo2%.', 'nep3%.', 'njb%.', 'nop2%.', 'npp2%.', 'npr2%.', 'ntls%.', 'open%.', 'orm2%.', 'osp4%.', 'oto2%.', 'pan3%.', 'pchj%.', 'pcn5%.', 'pdi3%.', 'ped4%.', 'pei3%.', 'pfm2%.', 'pgr2%.', 'phmt%.', 'pld3%.', 'pls2%.', 'pmf2%.', 'pne2%.', 'pnp%.', 'poh2%.', 'ppj2%.', 'ppp3%.', 'prm2%.', 'pro6%.', 'prp2%.', 'psp4%.', 'puh2%.', 'pul2%.', 'qub2%.', 'rai2%.', 'rar2%.', 'rco2%.', 'rcr2%.', 'rfc2%.', 'rmb2%.', 'rpm2%.', 'rse2%.', 'rvr2%.', 'sae2%.', 'sen2%.', 'sfp2%.', 'smb2%.', 'smm2%.', 'smmd%.', 'smo2%.', 'smsc%.', 'sst2%.', 'sst3%.', 'sstr%.', 'sus2%.', 'tch2%.', 'tcr4%.', 'tpg2%.', 'trc2%.', 'tre%.', 'uar2%.', 'ueg2%.', 'uro2%.', 'viw2%.', 'vms3%.', 'vro2%.', 'vzj2%.', 'we%.', 'wjo2%.', 'wlb3%.', 'wll2%.', 'wsb%.'}, -- Elsevier journals https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&oldid=1364310578#Wikipedia:Bot_requests/Archive_88#Web_scrapping_v2
['1016'] = {'j%.aace', 'j%.aed', 'j%.aiopen', 'j%.animal', 'j%.apsb', 'j%.addicn', -- AACE Endocrinology and Diabetes, AACE Endocrinology and Diabetes, AI Open, Animal, Acta Pharmaceutica Sinica B, Addiction Neuroscience
'j%.abrep', 'j%.fob', 'j%.gpb', 'j%.heliyon', 'j%.mucimm%.', 'j%.nlp', 'j%.patter', 'j%.proche', -- Addictive Behaviors Reports, FEBS Open Bio, Genomics, Proteomics & Bioinformatics after 2015, Heliyon, Mucosal Immunology, Natural Language Processing, Patterns, Procedia Chemistry
'j%.vgie', 'S1672-0229', 'S1933-0219'}, -- VideoGIE, Genomics, Proteomics & Bioinformatics before 2015, Mucosal Immunology
['1017'] = {'apj%.', 'nlp', 'mdh', 'S15574660'}, -- Natural Language Processing Journal, Medical History, Asia Pacific Journal
['1021'] = {'acscentsci', 'acsomega'}, -- ACS Central Science, ACS Omega
['1029'] = {'2025cn', '2025csj', '2025ea', '2025gc', '2025gh', '2025ms', '2025sw', '2025wr', '2026ef', '2026gl', '2026jh', 'aga2.70129'}, -- Elsevier journals https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&oldid=1364310578#Wikipedia:Bot_requests/Archive_88#Web_scrapping_v2
['1038'] = {'41541%.', '43246%.', 'asiamat%.', 'boneres%.', 'cddis%.', 'cddiscovery%.', 'celldisc%.', 'mi%.', 'nutd%.', 'oncsis%.', 's40494', 's41377', 's41392', 's41396', 's41398', 's41405', 's41407', 's41408', 's41439', 's41467', 's41514', 's41522', 's41523', 's41524', 's41525', 's41526', 's41528', 's41529', 's41531', 's41533', 's41534', 's41535', 's41536', 's41537', 's41538', 's41539', 's41540', 's41545', 's41598', 's41612', 's41698', 's41699', 's41746', 's42003', 's42004', 's42005', 's42949', 's43247', 's43705', 's43856', 's44168', 's44172', 's44182', 's44183', 's44184', 's44185', 's44259', 's44260', 's44264', 's44271', 's44276', 's44294', 's44296', 's44298', 's44303', 's44304', 's44306', 's44310', 's44323', 's44324', 's44325', 's44328', 's44333', 's44334', 's44335', 's44341', 's44355', 's44383', 's44384', 's44385', 's44386', 's44387', 's44400', 's44401', 's44406', 's44407', 's44431', 's44432', 's44433', 's44434', 's44435', 's44440', 's44453', 's44454', 's44455', 's44456', 's44458', 's44459', 's44482', 's44484', 's44485', 's44488', 's44513', 's44528', 'sdata%.'}, -- Nature journals (npj series, Communications series, and many others, see https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&diff=prev&oldid=1368822567 and https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&diff=next&oldid=1368822567)
['1046'] = {'j%.1365-8711', 'j%.1365-246x'}, -- MNRAS, GJI
['1049'] = {'aie2%.', 'blc2%.', 'bme2', 'bsb2%.', 'ccs2%.', 'cds2', 'cdt2', 'cim2%.', 'cit2%.', 'cmu2%.', 'cps2%.', 'csy2%.', 'cth2%.', 'cvi2%.', 'dgt2%.', 'ein2%.', 'ell2%.', 'elp2%.', 'els2', 'ema3%.', 'enb2%.', 'enc2%.', 'esi2%.', 'gtd2%.', 'htl2%.', 'hve2%.', 'ipr2%.', 'ise2', 'itr2%.', 'mia2%.', 'mna2%.', 'nbt2', 'nde2%.', 'ntw2%.', 'ote2%.', 'pel2%.', 'qtc2%.', 'rpg2%.', 'rsn2%.', 'ses2%.', 'sfw2', 'sil2', 'smc2%.', 'smt2%.', 'stg2%.', 'syb2%.', 'tje2%.', 'wss2%.'}, -- Elsevier journals https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&oldid=1364310578#Wikipedia:Bot_requests/Archive_88#Web_scrapping_v2
['1051'] = {'parasite'}, -- Parasite
['1057'] = {'s41599'}, -- Humanities and Social Sciences Communications
['1093'] = {'mnras', 'mnrasl', 'gji', 'pnasnexus', 'rasti', 'ismeco', 'ismejo'}, -- MNRAS, MNRAS Letters, GJI, PNAS Nexus, RASTI, ISME Communications, ISME Journal
['1096'] = {'fba%.'}, -- FASEB BioAdvances
['1098'] = {'rsbm', 'rsob', 'rsos'}, -- Biographical Memoirs of Fellows of the Royal Society, Open Biology, Royal Society Open Science
['1099'] = {'acmi', 'mic', '00221287', 'mgen'}, -- Access Microbiology, Microbiology, Journal of General Microbiology, Microbial Genomics
['1107'] = {'S20569890', 'S20522525', 'S16005775', 'S24143146'}, -- Acta Crystallographica E, IUCrJ, Journal of Synchrotron Radiation, IUCrData
['1109'] = {'access', 'oa', 'oj'}, -- IEEE Access, IEEE Open Access..., IEEE Open Journal...
['1111'] = {'1365-2435', '1442-1984', '1751-7915', '1753-0407', '1755-0998', '1758-2229', '1759-7714', '2041-210x', 'j%.1365-2966', 'j%.1745-3933', 'j%.1365-246X','acel%.', 'adb%.', 'anec%.', 'aogs%.', 'bor%.', 'bpa%.', 'cas%.', 'con4%.', 'cpr%.', 'crj%.', 'csp2%.', 'cts%.', 'ddi%.', 'ejed%.', 'ene%.', 'eva%.', 'gbb%.', 'gcbb%.', 'hex%.', 'irv%.', 'iwj%.', 'jch%.', 'jcmm%.', 'jdi%.', 'jfr3%.', 'jocd%.', 'jwas%.', 'mcn%.', 'mpp%.', 'myc%.', 'nrm%.', 'os%.', 'pbi%.', 'srt%.'}, -- Elsevier journals https://en.wikipedia.org/w/index.php?title=User_talk:DreamRimmer&oldid=1364310578#Wikipedia:Bot_requests/Archive_88#Web_scrapping_v2
['1112'] = {'tlm3%.'}, -- Transactions of the London Mathematical Society
['1113'] = {'ep'}, -- Experimental Physiology
['1128'] = {'asmcr', 'jmbe', 'mbio', 'mra', 'spectrum', 'msphere', 'msystems'}, --ASM Case Reports, Journal of Microbiology & Biology Education, mBio, Microbiology Resource Announcements, Microbiology Spectrum, mSphere, mSystems
['1136'] = {'bmjopen'}, -- BMJ Open
['1140'] = {'epjconf'}, -- EPJ Web of Conferences
['1161'] = {'jaha%.'},
['1176'] = {'appi%.prcp%.'},
['1192'] = {'bjo'}, -- BJPsych Open
['1210'] = {'jendso','jcemcr'}, -- Journal of the Endocrine Society, JCEM Case Reports
['1215'] = {'21573689', '21573698'}, -- L&O Fluids
['1257'] = {'jep'}, -- Journal of Economic Perspectives
['1590'] = {'0102-3306'}, -- Acta Botanica Brasilica
['2903'] = {'j%.efsa%.'},
['3322'] = {'caac%.'},
['3982'] = {'qw', 'te'},
['4171'] = {'dm','mag'}, -- Documenta Mathematica, EMS Magazine
['4319'] = {'lo%.', 'lol%.', 'lom%.'}, -- L&O, L&O e-Lectures, L&O Methods
['5852'] = {'ejt'}, -- European Journal of Taxonomy
['7155'] = {'jgaa'}, -- Journal of Graph Algorithms and Applications
['7758'] = {'rsf'}, -- RSJ Journal
['11158'] = {'saasp'}, -- Systematic and Applied Acarology Special Publications
['11646'] = {'megataxa', 'mesozoic'}, -- Megataxa, Mesozoic
['14231'] = {'ag'}, -- Algebraic Geometry
['14814'] = {'phy2%.'},
['15302'] = {'vr%.'},
['15446'] = {'abc'}, -- Acta Biológica Colombiana
['17239'] = {'jowr'}, -- Journal of Writing Research
['22073'] = {'pja'}, -- Persian Journal of Acarology
['24310'] = {'abm'}, -- Acta Botanica Malacitana
['24425'] = {'agp'}, -- Acta Geologica Polonica
['35249'] = {'rche'}, -- Revista Chilena de Entomología
['37520'] = {'fi'}, -- Fossil Imprint
['53562'] = {'ajcb'} -- Asian Journal of Conservation Biology
}
--[[===================<< E R R O R M E S S A G I N G >>======================
]]
--[[----------< E R R O R M E S S A G E S U P P L E M E N T S >-------------
I18N for those messages that are supplemented with additional specific text that
describes the reason for the error
TODO: merge this with special_case_translations{}?
]]
local err_msg_supl = {
['char'] = 'invalid character', -- |isbn=, |sbn=
['check'] = 'checksum', -- |isbn=, |sbn=
empty_str = '(empty string)', -- empty unknown parameter check when cite has |=
['flag'] = 'flag', -- |archive-url=
['form'] = 'invalid form', -- |isbn=, |sbn=
['group'] = 'invalid group id', -- |isbn=
['initials'] = 'initials', -- Vancouver
['invalid language code'] = 'invalid language code', -- |script-<param>=
['journal'] = 'journal', -- |bibcode=
['length'] = 'length', -- |isbn=, |bibcode=, |sbn=
['liveweb'] = 'liveweb', -- |archive-url=
['missing comma'] = 'missing comma', -- Vancouver
['missing prefix'] = 'missing prefix', -- |script-<param>=
['missing title part'] = 'missing title part', -- |script-<param>=
['name'] = 'name', -- Vancouver
['non-Latin char'] = 'non-Latin character', -- Vancouver
['path'] = 'path', -- |archive-url=
['prefix'] = 'invalid prefix', -- |isbn=
['punctuation'] = 'punctuation', -- Vancouver
['save'] = 'save command', -- |archive-url=
['suffix'] = 'suffix', -- Vancouver
['timestamp'] = 'timestamp', -- |archive-url=
['unknown language code'] = 'unknown language code', -- |script-<param>=
['value'] = 'value', -- |bibcode=
['year'] = 'year', -- |bibcode=
}
--[[--------------< E R R O R _ C O N D I T I O N S >---------------------------
Error condition table. This table has two sections: errors at the top, maintenance
at the bottom. Maint 'messaging' does not have a 'message' (message=nil)
The following contains a list of IDs for various error conditions defined in the
code. For each ID, we specify a text message to display, an error category to
include, and whether the error message should be wrapped as a hidden comment.
Anchor changes require identical changes to matching anchor in Help:CS1 errors
TODO: rename error_conditions{} to something more generic; create separate error
and maint tables inside that?
]]
local error_conditions = {
err_accessdate_missing_url = {
message = '<code class="cs1-code">|access-date=</code> requires <code class="cs1-code">|url=</code>',
anchor = 'accessdate_missing_url',
category = 'CS1 errors: access-date without URL',
hidden = false
},
err_apostrophe_markup = {
message = 'Italic or bold markup not allowed in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'apostrophe_markup',
category = 'CS1 errors: markup',
hidden = false
},
err_archive_date_missing_url = {
message = '<code class="cs1-code">|archive-date=</code> requires <code class="cs1-code">|archive-url=</code>',
anchor = 'archive_date_missing_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_date_url_ts_mismatch = {
message = '<code class="cs1-code">|archive-date=</code> / <code class="cs1-code">|archive-url=</code> timestamp mismatch; $1 suggested',
anchor = 'archive_date_url_ts_mismatch',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_missing_date = {
message = '<code class="cs1-code">|archive-url=</code> requires <code class="cs1-code">|archive-date=</code>',
anchor = 'archive_missing_date',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_missing_url = {
message = '<code class="cs1-code">|archive-url=</code> requires <code class="cs1-code">|url=</code>',
anchor = 'archive_missing_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_archive_url = {
message = '<code class="cs1-code">|archive-url=</code> is malformed: $1', -- $1 is error message detail
anchor = 'archive_url',
category = 'CS1 errors: archive-url',
hidden = false
},
err_arxiv_missing = {
message = '<code class="cs1-code">|arxiv=</code> required',
anchor = 'arxiv_missing',
category = 'CS1 errors: arXiv', -- same as bad arxiv
hidden = false
},
err_asintld_missing_asin = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|asin=</code>', -- $1 is parameter name
anchor = 'asintld_missing_asin',
category = 'CS1 errors: ASIN TLD',
hidden = false
},
err_bad_arxiv = {
message = 'Check <code class="cs1-code">|arxiv=</code> value',
anchor = 'bad_arxiv',
category = 'CS1 errors: arXiv',
hidden = false
},
err_bad_asin = {
message = 'Check <code class="cs1-code">|asin=</code> value',
anchor = 'bad_asin',
category ='CS1 errors: ASIN',
hidden = false
},
err_bad_asin_tld = {
message = 'Check <code class="cs1-code">|asin-tld=</code> value',
anchor = 'bad_asin_tld',
category ='CS1 errors: ASIN TLD',
hidden = false
},
err_bad_bibcode = {
message = 'Check <code class="cs1-code">|bibcode=</code> $1', -- $1 is error message detail
anchor = 'bad_bibcode',
category = 'CS1 errors: bibcode',
hidden = false
},
err_bad_biorxiv = {
message = 'Check <code class="cs1-code">|biorxiv=</code> value',
anchor = 'bad_biorxiv',
category = 'CS1 errors: bioRxiv',
hidden = false
},
err_bad_citeseerx = {
message = 'Check <code class="cs1-code">|citeseerx=</code> value',
anchor = 'bad_citeseerx',
category = 'CS1 errors: citeseerx',
hidden = false
},
err_bad_date = {
message = 'Check date values in: $1', -- $1 is a parameter name list
anchor = 'bad_date',
category = 'CS1 errors: dates',
hidden = false
},
err_bad_doi = {
message = 'Check <code class="cs1-code">|doi=</code> value',
anchor = 'bad_doi',
category = 'CS1 errors: DOI',
hidden = false
},
err_bad_hdl = {
message = 'Check <code class="cs1-code">|hdl=</code> value',
anchor = 'bad_hdl',
category = 'CS1 errors: HDL',
hidden = false
},
err_bad_isbn = {
message = 'Check <code class="cs1-code">|isbn=</code> value: $1', -- $1 is error message detail
anchor = 'bad_isbn',
category = 'CS1 errors: ISBN',
hidden = false
},
err_bad_ismn = {
message = 'Check <code class="cs1-code">|ismn=</code> value',
anchor = 'bad_ismn',
category = 'CS1 errors: ISMN',
hidden = false
},
err_bad_issn = {
message = 'Check <code class="cs1-code">|$1issn=</code> value', -- $1 is 'e' or '' for eissn or issn
anchor = 'bad_issn',
category = 'CS1 errors: ISSN',
hidden = false
},
err_bad_jfm = {
message = 'Check <code class="cs1-code">|jfm=</code> value',
anchor = 'bad_jfm',
category = 'CS1 errors: JFM',
hidden = false
},
err_bad_jstor = {
message = 'Check <code class="cs1-code">|jstor=</code> value',
anchor = 'bad_jstor',
category = 'CS1 errors: JSTOR',
hidden = false
},
err_bad_lccn = {
message = 'Check <code class="cs1-code">|lccn=</code> value',
anchor = 'bad_lccn',
category = 'CS1 errors: LCCN',
hidden = false
},
err_bad_medrxiv = {
message = 'Check <code class="cs1-code">|medrxiv=</code> value',
anchor = 'bad_medrxiv',
category = 'CS1 errors: medRxiv',
hidden = false
},
err_bad_mr = {
message = 'Check <code class="cs1-code">|mr=</code> value',
anchor = 'bad_mr',
category = 'CS1 errors: MR',
hidden = false
},
err_bad_oclc = {
message = 'Check <code class="cs1-code">|oclc=</code> value',
anchor = 'bad_oclc',
category = 'CS1 errors: OCLC',
hidden = false
},
err_bad_ol = {
message = 'Check <code class="cs1-code">|ol=</code> value',
anchor = 'bad_ol',
category = 'CS1 errors: OL',
hidden = false
},
err_bad_osti = {
message = 'Check <code class="cs1-code">|osti=</code> value',
anchor = 'bad_osti',
category = 'CS1 errors: OSTI',
hidden = false
},
err_bad_paramlink = { -- for |title-link=, |author/editor/translator-link=, |series-link=, |episode-link=
message = 'Check <code class="cs1-code">|$1=</code> value', -- $1 is parameter name
anchor = 'bad_paramlink',
category = 'CS1 errors: parameter link',
hidden = false
},
err_bad_pmc = {
message = 'Check <code class="cs1-code">|pmc=</code> value',
anchor = 'bad_pmc',
category = 'CS1 errors: PMC',
hidden = false
},
err_bad_pmid = {
message = 'Check <code class="cs1-code">|pmid=</code> value',
anchor = 'bad_pmid',
category = 'CS1 errors: PMID',
hidden = false
},
err_bad_rfc = {
message = 'Check <code class="cs1-code">|rfc=</code> value',
anchor = 'bad_rfc',
category = 'CS1 errors: RFC',
hidden = false
},
err_bad_s2cid = {
message = 'Check <code class="cs1-code">|s2cid=</code> value',
anchor = 'bad_s2cid',
category = 'CS1 errors: S2CID',
hidden = false
},
err_bad_sbn = {
message = 'Check <code class="cs1-code">|sbn=</code> value: $1', -- $1 is error message detail
anchor = 'bad_sbn',
category = 'CS1 errors: SBN',
hidden = false
},
err_bad_ssrn = {
message = 'Check <code class="cs1-code">|ssrn=</code> value',
anchor = 'bad_ssrn',
category = 'CS1 errors: SSRN',
hidden = false
},
err_bad_url = {
message = 'Check $1 value', -- $1 is parameter name
anchor = 'bad_url',
category = 'CS1 errors: URL',
hidden = false
},
err_bad_usenet_id = {
message = 'Check <code class="cs1-code">|message-id=</code> value',
anchor = 'bad_message_id',
category = 'CS1 errors: message-id',
hidden = false
},
err_bad_zbl = {
message = 'Check <code class="cs1-code">|zbl=</code> value',
anchor = 'bad_zbl',
category = 'CS1 errors: Zbl',
hidden = false
},
err_bare_url_missing_title = {
message = '$1 missing title', -- $1 is parameter name
anchor = 'bare_url_missing_title',
category = 'CS1 errors: bare URL',
hidden = false
},
err_biorxiv_missing = {
message = '<code class="cs1-code">|biorxiv=</code> required',
anchor = 'biorxiv_missing',
category = 'CS1 errors: bioRxiv', -- same as bad bioRxiv
hidden = false
},
err_chapter_ignored = {
message = '<code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'chapter_ignored',
category = 'CS1 errors: chapter ignored',
hidden = false
},
err_citation_missing_title = {
message = 'Missing or empty <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'citation_missing_title',
category = 'CS1 errors: missing title',
hidden = false
},
err_citeseerx_missing = {
message = '<code class="cs1-code">|citeseerx=</code> required',
anchor = 'citeseerx_missing',
category = 'CS1 errors: citeseerx', -- same as bad citeseerx
hidden = false
},
err_cite_web_url = { -- this error applies to cite web and to cite podcast
message = 'Missing or empty <code class="cs1-code">|url=</code>',
anchor = 'cite_web_url',
category = 'CS1 errors: requires URL',
hidden = false
},
err_class_ignored = {
message = '<code class="cs1-code">|class=</code> ignored',
anchor = 'class_ignored',
category = 'CS1 errors: class',
hidden = false
},
err_contributor_ignored = {
message = '<code class="cs1-code">|contributor=</code> ignored',
anchor = 'contributor_ignored',
category = 'CS1 errors: contributor',
hidden = false
},
err_contributor_missing_required_param = {
message = '<code class="cs1-code">|contributor=</code> requires <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'contributor_missing_required_param',
category = 'CS1 errors: contributor',
hidden = false
},
err_deprecated_params = {
message = 'Cite uses deprecated parameter <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'deprecated_params',
category = 'CS1 errors: deprecated parameters',
hidden = false
},
err_disp_name = {
message = 'Invalid <code class="cs1-code">|$1=$2</code>', -- $1 is parameter name; $2 is the assigned value
anchor = 'disp_name',
category = 'CS1 errors: display-names',
hidden = false,
},
err_doibroken_missing_doi = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|doi=</code>', -- $1 is parameter name
anchor = 'doibroken_missing_doi',
category = 'CS1 errors: DOI',
hidden = false
},
err_embargo_missing_pmc = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|pmc=</code>', -- $1 is parameter name
anchor = 'embargo_missing_pmc',
category = 'CS1 errors: PMC embargo',
hidden = false
},
err_empty_citation = {
message = 'Empty citation',
anchor = 'empty_citation',
category = 'CS1 errors: empty citation',
hidden = false
},
err_etal = {
message = 'Explicit use of et al. in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'explicit_et_al',
category = 'CS1 errors: explicit use of et al.',
hidden = false
},
err_extra_text_edition = {
message = '<code class="cs1-code">|edition=</code> has extra text',
anchor = 'extra_text_edition',
category = 'CS1 errors: extra text: edition',
hidden = false,
},
err_extra_text_issue = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_issue',
category = 'CS1 errors: extra text: issue',
hidden = false,
},
err_extra_text_pages = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_pages',
category = 'CS1 errors: extra text: pages',
hidden = false,
},
err_extra_text_volume = {
message = '<code class="cs1-code">|$1=</code> has extra text', -- $1 is parameter name
anchor = 'extra_text_volume',
category = 'CS1 errors: extra text: volume',
hidden = false,
},
err_first_missing_last = {
message = '<code class="cs1-code">|$1=</code> missing <code class="cs1-code">|$2=</code>', -- $1 is first alias, $2 is matching last alias
anchor = 'first_missing_last',
category = 'CS1 errors: missing name', -- author, contributor, editor, interviewer, translator
hidden = false
},
err_format_missing_url = {
message = '<code class="cs1-code">|$1=</code> requires <code class="cs1-code">|$2=</code>', -- $1 is format parameter $2 is url parameter
anchor = 'format_missing_url',
category = 'CS1 errors: format without URL',
hidden = false
},
err_generic_name = {
message = '<code class="cs1-code">|$1=</code> has generic name', -- $1 is parameter name
anchor = 'generic_name',
category = 'CS1 errors: generic name',
hidden = false,
},
err_generic_title = {
message = 'Cite uses generic title',
anchor = 'generic_title',
category = 'CS1 errors: generic title',
hidden = false,
},
err_invalid_isbn_date = {
message = 'ISBN / Date incompatibility',
anchor = 'invalid_isbn_date',
category = 'CS1 errors: ISBN date',
hidden = true
},
err_invalid_param_val = {
message = 'Invalid <code class="cs1-code">|$1=$2</code>', -- $1 is parameter name $2 is parameter value
anchor = 'invalid_param_val',
category = 'CS1 errors: invalid parameter value',
hidden = false
},
err_invisible_char = {
message = '$1 in $2 at position $3', -- $1 is invisible char $2 is parameter name $3 is position number
anchor = 'invisible_char',
category = 'CS1 errors: invisible characters',
hidden = false
},
err_medrxiv_missing = {
message = '<code class="cs1-code">|medrxiv=</code> required',
anchor = 'medrxiv_missing',
category = 'CS1 errors: medRxiv', -- same as bad medRxiv
hidden = false
},
err_missing_name = {
message = 'Missing <code class="cs1-code">|$1$2=</code>', -- $1 is modified NameList; $2 is enumerator
anchor = 'missing_name',
category = 'CS1 errors: missing name', -- author, contributor, editor, interviewer, translator
hidden = false
},
err_missing_periodical = {
message = 'Cite $1 requires <code class="cs1-code">|$2=</code>', -- $1 is cs1 template name; $2 is canonical periodical parameter name for cite $1
anchor = 'missing_periodical',
category = 'CS1 errors: missing periodical',
hidden = false
},
err_missing_pipe = {
message = 'Missing pipe in: <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'missing_pipe',
category = 'CS1 errors: missing pipe',
hidden = false
},
err_missing_publisher = {
message = 'Cite $1 requires <code class="cs1-code">|$2=</code>', -- $1 is cs1 template name; $2 is canonical publisher parameter name for cite $1
anchor = 'missing_publisher',
category = 'CS1 errors: missing publisher',
hidden = false
},
err_numeric_names = {
message = '<code class="cs1-code">|$1=</code> has numeric name', -- $1 is parameter name',
anchor = 'numeric_names',
category = 'CS1 errors: numeric name',
hidden = false,
},
err_param_access_requires_param = {
message = '<code class="cs1-code">|$1-access=</code> requires <code class="cs1-code">|$1=</code>', -- $1 is parameter name
anchor = 'param_access_requires_param',
category = 'CS1 errors: param-access',
hidden = false
},
err_param_has_ext_link = {
message = 'External link in <code class="cs1-code">$1</code>', -- $1 is parameter name
anchor = 'param_has_ext_link',
category = 'CS1 errors: external links',
hidden = false
},
err_param_has_twl_url = {
message = 'Wikipedia Library link in <code class="cs1-code">$1</code>', -- $1 is parameter name
anchor = 'param_has_twl_url',
category = 'CS1 errors: URL',
hidden = false
},
err_parameter_ignored = {
message = 'Unknown parameter <code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'parameter_ignored',
category = 'CS1 errors: unsupported parameter',
hidden = false
},
err_parameter_ignored_suggest = {
message = 'Unknown parameter <code class="cs1-code">|$1=</code> ignored (<code class="cs1-code">|$2=</code> suggested)', -- $1 is unknown parameter $2 is suggested parameter name
anchor = 'parameter_ignored_suggest',
category = 'CS1 errors: unsupported parameter',
hidden = false
},
err_periodical_ignored = {
message = '<code class="cs1-code">|$1=</code> ignored', -- $1 is parameter name
anchor = 'periodical_ignored',
category = 'CS1 errors: periodical ignored',
hidden = false
},
err_redundant_parameters = {
message = 'More than one of $1 specified', -- $1 is error message detail
anchor = 'redundant_parameters',
category = 'CS1 errors: redundant parameter',
hidden = false
},
err_script_parameter = {
message = 'Invalid <code class="cs1-code">|$1=</code>: $2', -- $1 is parameter name $2 is script language code or error detail
anchor = 'script_parameter',
category = 'CS1 errors: script parameters',
hidden = false
},
err_ssrn_missing = {
message = '<code class="cs1-code">|ssrn=</code> required',
anchor = 'ssrn_missing',
category = 'CS1 errors: SSRN',
hidden = false
},
err_text_ignored = {
message = 'Text "$1" ignored', -- $1 is ignored text
anchor = 'text_ignored',
category = 'CS1 errors: unrecognized parameter',
hidden = false
},
err_trans_missing_title = {
message = '<code class="cs1-code">|trans-$1=</code> requires <code class="cs1-code">|$1=</code> or <code class="cs1-code">|script-$1=</code>', -- $1 is base parameter name
anchor = 'trans_missing_title',
category = 'CS1 errors: translated title',
hidden = false
},
err_param_unknown_empty = {
message = 'Cite has empty unknown parameter$1: $2', -- $1 is 's' or empty space; $2 is emty unknown param list
anchor = 'param_unknown_empty',
category = 'CS1 errors: empty unknown parameters',
hidden = false
},
err_vancouver = {
message = 'Vancouver style error: $1 in name $2', -- $1 is error detail, $2 is the nth name
anchor = 'vancouver',
category = 'CS1 errors: Vancouver style',
hidden = false
},
err_wikilink_in_url = {
message = 'URL–wikilink conflict', -- uses ndash
anchor = 'wikilink_in_url',
category = 'CS1 errors: URL–wikilink conflict', -- uses ndash
hidden = false
},
--[[--------------------------< M A I N T >-------------------------------------
maint messages do not have a message (message = nil); otherwise the structure
is the same as error messages
]]
maint_archive_origin = {
message = nil,
anchor = 'archive_origin',
category = 'CS1 maint: archive origin',
hidden = true,
},
maint_archived_copy = {
message = nil,
anchor = 'archived_copy',
category = 'CS1 maint: archived copy as title',
hidden = true,
},
maint_bibcode = {
message = nil,
anchor = 'bibcode',
category = 'CS1 maint: bibcode',
hidden = true,
},
maint_location_no_publisher = { -- cite book, conference, encyclopedia; citation as book cite or encyclopedia cite
message = nil,
anchor = 'location_no_publisher',
category = 'CS1 maint: location missing publisher',
hidden = true,
},
maint_bot_unknown = {
message = nil,
anchor = 'bot:_unknown',
category = 'CS1 maint: bot: original URL status unknown',
hidden = true,
},
maint_date_auto_xlated = { -- date auto-translation not supported by en.wiki
message = nil,
anchor = 'date_auto_xlated',
category = 'CS1 maint: date auto-translated',
hidden = true,
},
maint_date_format = {
message = nil,
anchor = 'date_format',
category = 'CS1 maint: date format',
hidden = true,
},
maint_date_year = {
message = nil,
anchor = 'date_year',
category = 'CS1 maint: date and year',
hidden = true,
},
maint_deprecated_archive = {
message = nil,
anchor = 'deprecated_archive',
category = 'CS1 maint: deprecated archival service',
hidden = true,
},
maint_doi_ignore = {
message = nil,
anchor = 'doi_ignore',
category = 'CS1 maint: ignored DOI errors',
hidden = true,
},
maint_doi_inactive = {
message = nil,
anchor = 'doi_inactive',
category = 'CS1 maint: DOI inactive',
hidden = true,
},
maint_doi_inactive_dated = {
message = nil,
anchor = 'doi_inactive_dated',
category = 'CS1 maint: DOI inactive as of $2$3$1', -- $1 is year, $2 is month-name or empty string, $3 is space or empty string
hidden = true,
},
maint_doi_unflagged_free = {
message = nil,
anchor = 'doi_unflagged_free',
category = 'CS1 maint: unflagged free DOI',
hidden = true,
},
maint_extra_punct = {
message = nil,
anchor = 'extra_punct',
category = 'CS1 maint: extra punctuation',
hidden = true,
},
maint_id_limit_load_fail = { -- applies to all cs1|2 templates on a page;
message = nil, -- maint message (category link) never emitted
anchor = 'id_limit_load_fail',
category = 'CS1 maint: ID limit load fail',
hidden = true,
},
maint_isbn_ignore = {
message = nil,
anchor = 'ignore_isbn_err',
category = 'CS1 maint: ignored ISBN errors',
hidden = true,
},
maint_issn_ignore = {
message = nil,
anchor = 'ignore_issn',
category = 'CS1 maint: ignored ISSN errors',
hidden = true,
},
maint_jfm_format = {
message = nil,
anchor = 'jfm_format',
category = 'CS1 maint: JFM format',
hidden = true,
},
maint_location = {
message = nil,
anchor = 'location',
category = 'CS1 maint: location',
hidden = true,
},
maint_misc_url = {
message = nil,
anchor = 'misc_url',
category = 'CS1 maint: miscellaneous url',
hidden = true,
},
maint_missing_class = {
message = nil,
anchor = 'missing_class',
category = 'CS1 maint: missing class',
hidden = true,
},
maint_mr_format = {
message = nil,
anchor = 'mr_format',
category = 'CS1 maint: MR format',
hidden = true,
},
maint_mult_names = {
message = nil,
anchor = 'mult_names',
category = 'CS1 maint: multiple names: $1', -- $1 is '<name>s list'; gets value from special_case_translation table
hidden = true,
},
maint_numeric_names = {
message = nil,
anchor = 'numeric_names',
category = 'CS1 maint: numeric names: $1', -- $1 is '<name>s list'; gets value from special_case_translation table
hidden = true,
},
maint_others = {
message = nil,
anchor = 'others',
category = 'CS1 maint: others',
hidden = true,
},
maint_others_avm = {
message = nil,
anchor = 'others_avm',
category = 'CS1 maint: others in cite AV media (notes)',
hidden = true,
},
maint_overridden_setting = {
message = nil,
anchor = 'overridden',
category = 'CS1 maint: overridden setting',
hidden = true,
},
maint_page_art_num = {
message = nil,
anchor = 'page_art_num',
category = 'CS1 maint: article number as page number',
hidden = true,
},
maint_periodical_has_isbn = {
message = nil,
anchor = 'periodical_has_isbn',
category = 'CS1 maint: periodical has ISBN',
hidden = true,
},
maint_pmc_embargo = {
message = nil,
anchor = 'embargo',
category = 'CS1 maint: PMC embargo expired',
hidden = true,
},
maint_pmc_format = {
message = nil,
anchor = 'pmc_format',
category = 'CS1 maint: PMC format',
hidden = true,
},
maint_postscript = {
message = nil,
anchor = 'postscript',
category = 'CS1 maint: postscript',
hidden = true,
},
maint_publisher_location = {
message = nil,
anchor = 'publisher_location',
category = 'CS1 maint: publisher location',
hidden = true,
},
maint_ref_duplicates_default = {
message = nil,
anchor = 'ref_default',
category = 'CS1 maint: ref duplicates default',
hidden = true,
},
maint_shortened_archive_url = {
message = nil,
anchor = 'shortened_archive_url',
category = 'CS1 maint: shortened archive url',
hidden = true,
},
maint_unknown_lang = {
message = nil,
anchor = 'unknown_lang',
category = 'CS1 maint: unrecognized language',
hidden = true,
},
maint_untitled = {
message = nil,
anchor = 'untitled',
category = 'CS1 maint: untitled periodical',
hidden = true,
},
maint_url_status = {
message = nil,
anchor = 'url_status',
category = 'CS1 maint: url-status',
hidden = true,
},
maint_work_isbn = {
message = nil,
anchor = 'work_isbn',
category = 'CS1 maint: work parameter with ISBN',
hidden = true,
},
maint_year= {
message = nil,
anchor = 'year',
category = 'CS1 maint: year',
hidden = true,
},
maint_zbl = {
message = nil,
anchor = 'zbl',
category = 'CS1 maint: Zbl',
hidden = true,
},
}
--[[--------------------------< I D _ L I M I T S _ D A T A _ T >----------------------------------------------
fetch id limits for certain identifiers from c:Data:CS1/Identifier limits.tab. This source is a json tabular
data file maintained at wikipedia commons. Convert the json format to a table of k/v pairs.
The values from <id_limits_data_t> are used to set handle.id_limit.
From 2025-02-21, MediaWiki is broken. Use this link to edit the tablular data file:
https://commons.wikimedia.org/w/index.php?title=Data:CS1/Identifier_limits.tab&action=edit
See Phab:T389105
]]
local id_limits_data_t;
local id_limits_data_load_fail = false; -- flag; assume that we will be successful when loading json id limit tabular data
local use_commons_data = true; -- set to false if your wiki does not have access to mediawiki commons; then,
if false == use_commons_data then -- update this table from https://commons.wikimedia.org/wiki/Data:CS1/Identifier_limits.tab; last update: 2026-08-02
id_limits_data_t = {['OCLC'] = 11160000000, ['OSTI'] = 23010000, ['PMC'] = 13500000, ['PMID'] = 42900000, ['RFC'] = 9300, ['SSRN'] = 7500000, ['S2CID'] = 290000000}; -- this table must be maintained locally
else -- here for wikis that do have access to mediawiki commons
local load_fail_limit = 99999999999; -- very high number to avoid error messages on load failure
id_limits_data_t = {['OCLC'] = load_fail_limit, ['OSTI'] = load_fail_limit, ['PMC'] = load_fail_limit, ['PMID'] = load_fail_limit, ['RFC'] = load_fail_limit, ['SSRN'] = load_fail_limit, ['S2CID'] = load_fail_limit};
if mw.ext.data == nil then
id_limits_data_load_fail = true; -- safeguard against Lua errors if mw.ext.data is not available for some reason
else
local tab_data_t = mw.ext.data.get ('CS1/Identifier limits.tab'); -- attempt to load the tabular data from commons into <tab_data_t>
if false == tab_data_t then -- undocumented 'feature': mw.ext.data.get() sometimes returns false
id_limits_data_load_fail = true; -- set the flag so that Module:Citation/CS1 can create an unannotated maint category
else
for _, limit_t in ipairs (tab_data_t.data) do -- overwrite default <load_fail_limit> values from the data table in the tabular data
id_limits_data_t[limit_t[1]] = limit_t[2]; -- <limit[1]> is identifier; <limit[2]> is upper limit for that identifier
end
end
end
end
--[[--------------------------< I D _ H A N D L E R S >--------------------------------------------------------
The following contains a list of values for various defined identifiers. For each
identifier we specify a variety of information necessary to properly render the
identifier in the citation.
parameters: a list of parameter aliases for this identifier; first in the list is the canonical form
link: Wikipedia article name
redirect: a local redirect to a local Wikipedia article name; at en.wiki, 'ISBN (identifier)' is a redirect to 'International Standard Book Number'
q: Wikidata q number for the identifier
label: the label preceding the identifier; label is linked to a Wikipedia article (in this order):
redirect from id_handlers['<id>'].redirect when use_identifier_redirects is true
Wikidata-supplied article name for the local wiki from id_handlers['<id>'].q
local article name from id_handlers['<id>'].link
prefix: the first part of a URL that will be concatenated with a second part which usually contains the identifier
suffix: optional third part to be added after the identifier
encode: true if URI should be percent-encoded; otherwise false
COinS: identifier link or keyword for use in COinS:
for identifiers registered at info-uri.info use: info:.... where '...' is the appropriate identifier label
for identifiers that have COinS keywords, use the keyword: rft.isbn, rft.issn, rft.eissn
for |asin= and |ol=, which require assembly, use the keyword: url
for others make a URL using the value in prefix/suffix and #label, use the keyword: pre (not checked; any text other than 'info', 'rft', or 'url' works here)
set to nil to leave the identifier out of the COinS
separator: character or text between label and the identifier in the rendered citation
id_limit: for those identifiers with established limits, this property holds the upper limit
access: use this parameter to set the access level for all instances of this identifier.
the value must be a valid access level for an identifier (see ['id-access'] in this file).
custom_access: to enable custom access level for an identifier, set this parameter
to the parameter that should control it (normally 'id-access')
]]
local id_handlers = {
['ARXIV'] = {
parameters = {'arxiv', 'eprint'},
link = 'arXiv',
redirect = 'arXiv (identifier)',
q = 'Q118398',
label = 'arXiv',
prefix = 'https://arxiv.org/abs/',
encode = false,
COinS = 'info:arxiv',
separator = ':',
access = 'free', -- free to read
},
['ASIN'] = {
parameters = { 'asin', 'ASIN' },
link = 'Amazon Standard Identification Number',
redirect = 'ASIN (identifier)',
q = 'Q1753278',
label = 'ASIN',
prefix = 'https://www.amazon.',
COinS = 'url',
separator = ' ',
encode = false;
},
['BIBCODE'] = {
parameters = {'bibcode'},
link = 'Bibcode',
redirect = 'Bibcode (identifier)',
q = 'Q25754',
label = 'Bibcode',
prefix = 'https://ui.adsabs.harvard.edu/abs/',
encode = false,
COinS = 'info:bibcode',
separator = ':',
custom_access = 'bibcode-access',
},
['BIORXIV'] = {
parameters = {'biorxiv'},
link = 'bioRxiv',
redirect = 'bioRxiv (identifier)',
q = 'Q19835482',
label = 'bioRxiv',
prefix = 'https://doi.org/',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = true,
separator = ' ',
},
['CITESEERX'] = {
parameters = {'citeseerx'},
link = 'CiteSeerX',
redirect = 'CiteSeerX (identifier)',
q = 'Q2715061',
label = 'CiteSeerX',
prefix = 'https://citeseerx.ist.psu.edu/viewdoc/summary?doi=',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = true,
separator = ' ',
},
['DOI'] = { -- Used by InternetArchiveBot
parameters = { 'doi', 'DOI'},
link = 'Digital object identifier',
redirect = 'doi (identifier)',
q = 'Q25670',
label = 'doi',
prefix = 'https://doi.org/',
COinS = 'info:doi',
separator = ':',
encode = true,
custom_access = 'doi-access',
},
['EISSN'] = {
parameters = {'eissn', 'EISSN'},
link = 'International Standard Serial Number#Electronic ISSN',
redirect = 'eISSN (identifier)',
q = 'Q46339674',
label = 'eISSN',
prefix = 'https://search.worldcat.org/issn/',
COinS = 'rft.eissn',
encode = false,
separator = ' ',
},
['HDL'] = {
parameters = { 'hdl', 'HDL' },
link = 'Handle System',
redirect = 'hdl (identifier)',
q = 'Q3126718',
label = 'hdl',
prefix = 'https://hdl.handle.net/',
COinS = 'info:hdl',
separator = ':',
encode = true,
custom_access = 'hdl-access',
},
['ISBN'] = { -- Used by InternetArchiveBot
parameters = {'isbn', 'ISBN'},
link = 'International Standard Book Number',
redirect = 'ISBN (identifier)',
q = 'Q33057',
label = 'ISBN',
prefix = 'Special:BookSources/',
COinS = 'rft.isbn',
separator = ' ',
},
['ISMN'] = {
parameters = {'ismn', 'ISMN'},
link = 'International Standard Music Number',
redirect = 'ISMN (identifier)',
q = 'Q1666938',
label = 'ISMN',
prefix = '', -- not currently used;
COinS = nil, -- nil because we can't use pre or rft or info:
separator = ' ',
},
['ISSN'] = {
parameters = {'issn', 'ISSN'},
link = 'International Standard Serial Number',
redirect = 'ISSN (identifier)',
q = 'Q131276',
label = 'ISSN',
prefix = 'https://search.worldcat.org/issn/',
COinS = 'rft.issn',
encode = false,
separator = ' ',
},
['JFM'] = {
parameters = {'jfm', 'JFM'},
link = 'Jahrbuch über die Fortschritte der Mathematik',
redirect = 'JFM (identifier)',
q = '',
label = 'JFM',
prefix = 'https://zbmath.org/?format=complete&q=an:',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['JSTOR'] = {
parameters = {'jstor', 'JSTOR'},
link = 'JSTOR',
redirect = 'JSTOR (identifier)',
q = 'Q1420342',
label = 'JSTOR',
prefix = 'https://www.jstor.org/stable/',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
custom_access = 'jstor-access',
},
['LCCN'] = {
parameters = {'lccn', 'LCCN'},
link = 'Library of Congress Control Number',
redirect = 'LCCN (identifier)',
q = 'Q620946',
label = 'LCCN',
prefix = 'https://lccn.loc.gov/',
COinS = 'info:lccn',
encode = false,
separator = ' ',
},
['MEDRXIV'] = {
parameters = {'medrxiv'},
link = 'medRxiv',
redirect = 'medRxiv (identifier)',
q = 'Q58465838',
label = 'medRxiv',
prefix = 'https://www.medrxiv.org/content/',
COinS = 'pre', -- use prefix value
access = 'free', -- free to read
encode = false,
separator = ' ',
},
['MR'] = {
parameters = {'mr', 'MR'},
link = 'Mathematical Reviews',
redirect = 'MR (identifier)',
q = 'Q211172',
label = 'MR',
prefix = 'https://mathscinet.ams.org/mathscinet-getitem?mr=',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
['OCLC'] = {
parameters = {'oclc', 'OCLC'},
link = 'OCLC',
redirect = 'OCLC (identifier)',
q = 'Q190593',
label = 'OCLC',
prefix = 'https://search.worldcat.org/oclc/',
COinS = 'info:oclcnum',
encode = true,
separator = ' ',
id_limit = id_limits_data_t.OCLC or 0,
},
['OL'] = {
parameters = { 'ol', 'OL' },
link = 'Open Library',
redirect = 'OL (identifier)',
q = 'Q1201876',
label = 'OL',
prefix = 'https://openlibrary.org/',
COinS = 'url',
separator = ' ',
encode = true,
custom_access = 'ol-access',
},
['OSTI'] = {
parameters = {'osti', 'OSTI'},
link = 'Office of Scientific and Technical Information',
redirect = 'OSTI (identifier)',
q = 'Q2015776',
label = 'OSTI',
prefix = 'https://www.osti.gov/biblio/',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = id_limits_data_t.OSTI or 0,
custom_access = 'osti-access',
},
['PMC'] = {
parameters = {'pmc', 'PMC'},
link = 'PubMed Central',
redirect = 'PMC (identifier)',
q = 'Q229883',
label = 'PMC',
prefix = 'https://www.ncbi.nlm.nih.gov/pmc/articles/PMC',
suffix = '',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = id_limits_data_t.PMC or 0,
access = 'free', -- free to read
},
['PMID'] = {
parameters = {'pmid', 'PMID'},
link = 'PubMed Identifier',
redirect = 'PMID (identifier)',
q = 'Q2082879',
label = 'PMID',
prefix = 'https://pubmed.ncbi.nlm.nih.gov/',
COinS = 'info:pmid',
encode = false,
separator = ' ',
id_limit = id_limits_data_t.PMID or 0,
},
['RFC'] = {
parameters = {'rfc', 'RFC'},
link = 'Request for Comments',
redirect = 'RFC (identifier)',
q = 'Q212971',
label = 'RFC',
prefix = 'https://tools.ietf.org/html/rfc',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = id_limits_data_t.RFC or 0,
access = 'free', -- free to read
},
['SBN'] = {
parameters = {'sbn', 'SBN'},
link = 'Standard Book Number', -- redirect to International_Standard_Book_Number#History
redirect = 'SBN (identifier)',
label = 'SBN',
prefix = 'Special:BookSources/0-', -- prefix has leading zero necessary to make 9-digit sbn a 10-digit isbn
COinS = nil, -- nil because we can't use pre or rft or info:
separator = ' ',
},
['SSRN'] = {
parameters = {'ssrn', 'SSRN'},
link = 'Social Science Research Network',
redirect = 'SSRN (identifier)',
q = 'Q7550801',
label = 'SSRN',
prefix = 'https://papers.ssrn.com/sol3/papers.cfm?abstract_id=',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
id_limit = id_limits_data_t.SSRN or 0,
custom_access = 'ssrn-access',
},
['S2CID'] = {
parameters = {'s2cid', 'S2CID'},
link = 'Semantic Scholar',
redirect = 'S2CID (identifier)',
q = 'Q22908627',
label = 'S2CID',
prefix = 'https://api.semanticscholar.org/CorpusID:',
COinS = 'pre', -- use prefix value
encode = false,
separator = ' ',
id_limit = id_limits_data_t.S2CID or 0,
custom_access = 's2cid-access',
},
['USENETID'] = {
parameters = {'message-id'},
link = 'Usenet',
redirect = 'Usenet (identifier)',
q = 'Q193162',
label = 'Usenet:',
prefix = 'news:',
encode = false,
COinS = 'pre', -- use prefix value
separator = ' ',
},
['ZBL'] = {
parameters = {'zbl', 'ZBL' },
link = 'Zentralblatt MATH',
redirect = 'Zbl (identifier)',
q = 'Q190269',
label = 'Zbl',
prefix = 'https://zbmath.org/?format=complete&q=an:',
COinS = 'pre', -- use prefix value
encode = true,
separator = ' ',
},
}
--[[--------------------------< E X P O R T S >---------------------------------
]]
return {
use_identifier_redirects = use_identifier_redirects, -- booleans defined in the settings at the top of this module
local_lang_cat_enable = local_lang_cat_enable,
date_name_auto_xlate_enable = date_name_auto_xlate_enable,
date_digit_auto_xlate_enable = date_digit_auto_xlate_enable,
enable_sort_keys = enable_sort_keys,
suppress_archive_today_urls = suppress_archive_today_urls,
-- tables and variables created when this module is loaded
dependencies_t = dependencies_t, -- used to suppress parameters dependent on url-holding parameters holding archive.today urls
enum_needs_xlation = '1' ~= date_names.xlate_digits['1'], -- to avoid unnecessary enumerator translation
global_df = get_date_format (), -- this line can be replaced with "global_df = 'dmy-all'," to have all dates auto translated to dmy format.
global_cs1_config_t = global_cs1_config_t, -- global settings from {{cs1 config}}
id_limits_data_load_fail = id_limits_data_load_fail, -- true when commons tabular identifier-limit data fails to load
known_free_doi_registrants_t = build_free_doi_registrants_table(),
punct_skip = build_skip_table (punct_skip, punct_meta_params),
url_skip = build_skip_table (url_skip, url_meta_params),
archive_today_tlds_t = {['today'] = true, ['ph'] = true, ['is'] = true, ['md'] = true, ['li'] = true, ['fo'] = true, ['vn'] = true}; -- used by is_archive_today_url()
name_space_sort_keys = name_space_sort_keys,
aliases = aliases,
special_case_translation = special_case_translation,
date_names = date_names,
err_msg_supl = err_msg_supl,
error_conditions = error_conditions,
et_al_patterns = et_al_patterns,
extended_registrants_t = extended_registrants_t,
id_handlers = id_handlers,
keywords_lists = keywords_lists,
keywords_xlate = keywords_xlate,
stripmarkers = stripmarkers,
invisible_chars = invisible_chars,
invisible_defs = invisible_defs,
indic_script = indic_script,
emoji_t = emoji_t,
messages = messages,
presentation = presentation,
prop_cats = prop_cats,
script_lang_codes = script_lang_codes,
lang_tag_remap = lang_tag_remap,
lang_name_remap = lang_name_remap,
this_wiki_code = this_wiki_code,
title_types = title_types,
uncategorized_namespaces = uncategorized_namespaces_t,
uncategorized_subpages = uncategorized_subpages,
templates_using_volume = templates_using_volume,
templates_using_issue = templates_using_issue,
templates_not_using_page = templates_not_using_page,
vol_iss_pg_patterns = vol_iss_pg_patterns,
single_letter_2nd_lvl_domains_t = single_letter_2nd_lvl_domains_t,
url_access_map_t = url_access_map_t,
inter_wiki_map = inter_wiki_map,
mw_languages_by_tag_t = mw_languages_by_tag_t,
mw_languages_by_name_t = mw_languages_by_name_t,
citation_class_map_t = citation_class_map_t,
citation_issue_t = citation_issue_t,
citation_no_volume_t = citation_no_volume_t,
}
e7w2jpc8m3hf485c54y7d0wmq4zi17p
Módulo:Citation/CS1/Whitelist
828
7643
74990
71642
2026-08-08T13:56:52Z
en>Trappist the monk
0
synch from sandbox;
74990
Scribunto
text/plain
--[[--------------------------< S U P P O R T E D P A R A M E T E R S >--------------------------------------
Because a steady-state signal conveys no useful information, whitelist.basic_arguments[] list items can have three values:
true - these parameters are valid and supported parameters
false - these parameters are deprecated but still supported
tracked - these parameters are valid and supported parameters tracked in an eponymous properties category
nil - these parameters are no longer supported. remove entirely
]]
local basic_arguments_t = {
['accessdate'] = true,
['access-date'] = true,
['agency'] = true,
['archivedate'] = true,
['archive-date'] = true,
['archive-format'] = true,
['archiveurl'] = true,
['archive-url'] = true,
['article'] = true,
['article-format'] = true,
['article-number'] = true, -- {{cite journal}}, {{cite conference}}; {{citation}} when |journal= has a value
['article-url'] = true,
['article-url-access'] = true,
['arxiv'] = true, -- cite arxiv; here because allowed in cite ... as identifier
['asin'] = true,
['ASIN'] = true,
['asin-tld'] = true,
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['authorlink'] = true,
['author-link'] = true,
['author-mask'] = true,
['bibcode'] = true,
['bibcode-access'] = true,
['biorxiv'] = true, -- cite biorxiv; here because allowed in cite ... as identifier
['chapter'] = true,
['chapter-format'] = true,
['chapter-url'] = true,
['chapter-url-access'] = true,
['citeseerx'] = false, -- cite citeseerx; here because allowed in cite ... as identifier
['collaboration'] = true,
['contribution'] = true,
['contribution-format'] = true,
['contribution-url'] = true,
['contribution-url-access'] = true,
['contributor'] = true,
['contributor-first'] = true,
['contributor-given'] = true,
['contributor-last'] = true,
['contributor-surname'] = true,
['contributor-link'] = true,
['contributor-mask'] = true,
['date'] = true,
['department'] = true,
['df'] = true,
['dictionary'] = true,
['display-authors'] = true,
['display-contributors'] = true,
['display-editors'] = true,
['display-interviewers'] = true,
['display-subjects'] = true,
['display-translators'] = true,
['doi'] = true,
['DOI'] = true,
['doi-access'] = true,
['doi-broken-date'] = true,
['edition'] = true,
['editor'] = true,
['editor-first'] = true,
['editor-given'] = true,
['editor-last'] = true,
['editor-surname'] = true,
['editor-link'] = true,
['editor-mask'] = true,
['eissn'] = true,
['EISSN'] = true,
['encyclopaedia'] = true,
['encyclopedia'] = true,
['entry'] = true,
['entry-format'] = true,
['entry-url'] = true,
['entry-url-access'] = true,
['eprint'] = true, -- cite arxiv; here because allowed in cite ... as identifier
['first'] = true,
['format'] = true,
['given'] = true,
['hdl'] = true,
['HDL'] = true,
['hdl-access'] = true,
['host'] = true, -- unique to certain templates?
['id'] = true,
['ID'] = true,
['institution'] = true, -- constrain to cite thesis?
['interviewer'] = true,
['interviewer-first'] = true,
['interviewer-given'] = true,
['interviewer-last'] = true,
['interviewer-surname'] = true,
['interviewer-link'] = true,
['interviewer-mask'] = true,
['isbn'] = true,
['ISBN'] = true,
['ismn'] = true,
['ISMN'] = true,
['issn'] = true,
['ISSN'] = true,
['issue'] = true,
['jfm'] = true,
['JFM'] = true,
['journal'] = true,
['jstor'] = true,
['JSTOR'] = true,
['jstor-access'] = true,
['lang'] = true,
['language'] = true,
['last'] = true,
['lccn'] = true,
['LCCN'] = true,
['location'] = true,
['magazine'] = true,
['medium'] = true,
['medrxiv'] = true, -- cite medrxiv; here because allowed in cite ... as identifier
['minutes'] = true, -- constrain to cite AV media and podcast?
['mode'] = true,
['mr'] = true,
['MR'] = true,
['name-list-style'] = true,
['newspaper'] = true,
['no-pp'] = true,
['no-tracking'] = true,
['number'] = true,
['oclc'] = true,
['OCLC'] = true,
['ol'] = true,
['OL'] = true,
['ol-access'] = true,
['orig-date'] = true,
['origyear'] = true,
['orig-year'] = true,
['osti'] = true,
['OSTI'] = true,
['osti-access'] = true,
['others'] = true,
['p'] = true,
['page'] = true,
['pages'] = true,
['periodical'] = true,
['place'] = true,
['pmc'] = true,
['PMC'] = true,
['pmc-embargo-date'] = true,
['pmid'] = true,
['PMID'] = true,
['postscript'] = true,
['pp'] = true,
['publication-date'] = true,
['publication-place'] = true,
['publisher'] = true,
['quotation'] = true,
['quote'] = true,
['quote-page'] = true,
['quote-pages'] = true,
['ref'] = true,
['rfc'] = true,
['RFC'] = true,
['sbn'] = true,
['SBN'] = true,
['scale'] = true,
['script-article'] = true,
['script-chapter'] = true,
['script-contribution'] = true,
['script-encyclopaedia'] = true,
['script-encyclopedia'] = true,
['script-entry'] = true,
['script-journal'] = true,
['script-magazine'] = true,
['script-newspaper'] = true,
['script-periodical'] = true,
['script-quote'] = true,
['script-section'] = true,
['script-title'] = true,
['script-website'] = true,
['script-work'] = true,
['section'] = true,
['section-format'] = true,
['section-url'] = true,
['section-url-access'] = true,
['series'] = true,
['ssrn'] = true, -- cite ssrn; these three here because allowed in cite ... as identifier
['SSRN'] = true,
['ssrn-access'] = true,
['subject'] = true,
['subject-first'] = true,
['subject-given'] = true,
['subject-last'] = true,
['subject-link'] = true,
['subject-mask'] = true,
['subject-surname'] = true,
['surname'] = true,
['s2cid'] = true,
['S2CID'] = true,
['s2cid-access'] = true,
['template-doc-demo'] = true,
['time'] = true, -- constrain to cite av media and podcast?
['time-caption'] = true, -- constrain to cite av media and podcast?
['title'] = true,
['title-link'] = true,
['title-note'] = true,
['translator'] = true,
['translator-first'] = true,
['translator-given'] = true,
['translator-last'] = true,
['translator-surname'] = true,
['translator-link'] = true,
['translator-mask'] = true,
['trans-article'] = true,
['trans-chapter'] = true,
['trans-contribution'] = true,
['trans-encyclopaedia'] = true,
['trans-encyclopedia'] = true,
['trans-entry'] = true,
['trans-journal'] = true,
['trans-magazine'] = true,
['trans-newspaper'] = true,
['trans-periodical'] = true,
['trans-quote'] = true,
['trans-section'] = true,
['trans-title'] = true,
['trans-website'] = true,
['trans-work'] = true,
['type'] = true,
['url'] = true,
['URL'] = true,
['url-access'] = true,
['url-status'] = true,
['vauthors'] = true,
['veditors'] = true,
['version'] = true,
['via'] = true,
['volume'] = true,
['website'] = true,
['work'] = true,
['year'] = true,
['zbl'] = true,
['ZBL'] = true,
}
local numbered_arguments_t = {
['author#'] = true,
['author-first#'] = true,
['author#-first'] = true,
['author-given#'] = true,
['author#-given'] = true,
['author-last#'] = true,
['author#-last'] = true,
['author-surname#'] = true,
['author#-surname'] = true,
['author-link#'] = true,
['author#-link'] = true,
['authorlink#'] = true,
['author#link'] = true,
['author-mask#'] = true,
['author#-mask'] = true,
['contributor#'] = true,
['contributor-first#'] = true,
['contributor#-first'] = true,
['contributor-given#'] = true,
['contributor#-given'] = true,
['contributor-last#'] = true,
['contributor#-last'] = true,
['contributor-surname#'] = true,
['contributor#-surname'] = true,
['contributor-link#'] = true,
['contributor#-link'] = true,
['contributor-mask#'] = true,
['contributor#-mask'] = true,
['editor#'] = true,
['editor-first#'] = true,
['editor#-first'] = true,
['editor-given#'] = true,
['editor#-given'] = true,
['editor-last#'] = true,
['editor#-last'] = true,
['editor-surname#'] = true,
['editor#-surname'] = true,
['editor-link#'] = true,
['editor#-link'] = true,
['editor-mask#'] = true,
['editor#-mask'] = true,
['first#'] = true,
['given#'] = true,
['host#'] = true,
['interviewer#'] = true,
['interviewer-first#'] = true,
['interviewer#-first'] = true,
['interviewer-given#'] = true,
['interviewer#-given'] = true,
['interviewer-last#'] = true,
['interviewer#-last'] = true,
['interviewer-surname#'] = true,
['interviewer#-surname'] = true,
['interviewer-link#'] = true,
['interviewer#-link'] = true,
['interviewer-mask#'] = true,
['interviewer#-mask'] = true,
['last#'] = true,
['subject#'] = true,
['subject-first#'] = true,
['subject#-first'] = true,
['subject-given#'] = true,
['subject#-given'] = true,
['subject-last#'] = true,
['subject#-last'] = true,
['subject-link#'] = true,
['subject#-link'] = true,
['subject-mask#'] = true,
['subject#-mask'] = true,
['subject-surname#'] = true,
['subject#-surname'] = true,
['surname#'] = true,
['translator#'] = true,
['translator-first#'] = true,
['translator#-first'] = true,
['translator-given#'] = true,
['translator#-given'] = true,
['translator-last#'] = true,
['translator#-last'] = true,
['translator-surname#'] = true,
['translator#-surname'] = true,
['translator-link#'] = true,
['translator#-link'] = true,
['translator-mask#'] = true,
['translator#-mask'] = true,
}
--[[--------------------------< P R E P R I N T S U P P O R T E D P A R A M E T E R S >--------------------
Cite arXiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn are preprint templates that use the limited
set of parameters defined in the limited_basic_arguments and limited_numbered_arguments tables. Those lists are
supplemented with a template-specific list of parameters that are required by the particular template and may be
exclusive to one of the preprint templates. Some of these parameters may also be available to the general cs1|2
templates.
Same conventions for true/false/tracked/nil as above.
]]
local preprint_arguments_t = {
arxiv = {
['arxiv'] = true, -- cite arxiv and arxiv identifiers
['class'] = true,
['eprint'] = true, -- cite arxiv and arxiv identifiers
},
biorxiv = {
['biorxiv'] = true,
},
citeseerx = {
['citeseerx'] = false,
},
medrxiv = {
['medrxiv'] = true,
},
ssrn = {
['ssrn'] = true,
['SSRN'] = true,
['ssrn-access'] = true,
},
}
--[[--------------------------< L I M I T E D S U P P O R T E D P A R A M E T E R S >----------------------
cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn templates are preprint templates so are
allowed only a limited subset of parameters allowed to all other cs1|2 templates. The limited subset is defined
here.
This list of parameters also used by {{cite document}}
Same conventions for true/false/tracked/nil as above.
]]
local limited_basic_arguments_t = {
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['author-link'] = true,
['authorlink'] = true,
['author-mask'] = true,
['collaboration'] = true,
['date'] = true,
['df'] = true,
['display-authors'] = true,
['first'] = true,
['given'] = true,
['language'] = true,
['last'] = true,
['mode'] = true,
['name-list-style'] = true,
['no-tracking'] = true,
['p'] = true,
['page'] = true,
['pages'] = true,
['postscript'] = true,
['pp'] = true,
['quotation'] = true,
['quote'] = true,
['ref'] = true,
['surname'] = true,
['template-doc-demo'] = true,
['title'] = true,
['trans-title'] = true,
['vauthors'] = true,
['year'] = true,
}
local limited_numbered_arguments_t = {
['author#'] = true,
['author-first#'] = true,
['author#-first'] = true,
['author-given#'] = true,
['author#-given'] = true,
['author-last#'] = true,
['author#-last'] = true,
['author-surname#'] = true,
['author#-surname'] = true,
['author-link#'] = true,
['author#-link'] = true,
['authorlink#'] = true,
['author#link'] = true,
['author-mask#'] = true,
['author#-mask'] = true,
['first#'] = true,
['given#'] = true,
['last#'] = true,
['surname#'] = true,
}
--[[--------------------------< U N I Q U E _ A R G U M E N T S >----------------------------------------------
Some templates have unique parameters. Those templates and their unique parameters are listed here. Keys in this
table are the template's CitationClass parameter value
Same conventions for true/false/tracked/nil as above.
]]
local unique_arguments_t = {
['audio-visual'] = {
['people'] = true,
['transcript'] = true,
['transcript-format'] = true,
['transcript-url'] = true,
},
conference = {
['book-title'] = true,
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
episode = {
['airdate'] = true,
['air-date'] = true,
['credits'] = true,
['episode-link'] = true, -- alias of |title-link=
['network'] = true,
['people'] = true,
['season'] = true,
['series-link'] = true,
['series-no'] = true,
['series-number'] = true,
['station'] = true,
['transcript'] = true,
['transcript-format'] = true,
['transcript-url'] = true,
},
mailinglist = {
['mailing-list'] = true,
},
map = {
['cartography'] = true,
['inset'] = true,
['map'] = true,
['map-format'] = true,
['map-url'] = true,
['map-url-access'] = true,
['script-map'] = true,
['sections'] = true,
['sheet'] = true,
['sheets'] = true,
['trans-map'] = true,
},
newsgroup = {
['message-id'] = true,
['newsgroup'] = true,
},
report = {
['docket'] = true,
},
serial = {
['airdate'] = true,
['air-date'] = true,
['credits'] = true,
['episode'] = true, -- cite serial only TODO: make available to cite episode?
['episode-link'] = true, -- alias of |title-link=
['network'] = true,
['people'] = true,
['series-link'] = true,
['station'] = true,
},
speech = {
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
thesis = {
['degree'] = true,
['docket'] = true,
},
}
--[[--------------------------< C I T E _ D O C U M E N T >----------------------------------------------------
Special case for cite document. This template takes the limited basic and limited enumerated parameters plus
others that are apply only to standalone published sources that cannot be cited any other way; no url, book,
periodical, etc parameters; limited support for name lists and named identifiers.
when validating parameters in {{cite document}} templates, the basic and
]]
local document_arguments_t = {
['bibcode'] = true,
['bibcode-access'] = true,
['doi'] = true,
['DOI'] = true,
['doi-access'] = true,
['doi-broken-date'] = true,
['hdl'] = true,
['HDL'] = true,
['hdl-access'] = true,
['id'] = true,
['ID'] = true,
['jfm'] = true,
['JFM'] = true,
['lang'] = true,
['location'] = true,
['mr'] = true,
['MR'] = true,
['no-pp'] = true,
['orig-date'] = true,
['origyear'] = true,
['orig-year'] = true,
['osti'] = true,
['OSTI'] = true,
['osti-access'] = true,
['place'] = true,
['publisher'] = true,
['quote-page'] = true,
['quote-pages'] = true,
['script-quote'] = true,
['script-title'] = true,
['title-link'] = true,
['translator'] = true,
['translator-first'] = true,
['translator-given'] = true,
['translator-last'] = true,
['translator-surname'] = true,
['translator-link'] = true,
['translator-mask'] = true,
['trans-quote'] = true,
['type'] = true,
['zbl'] = true,
['ZBL'] = true,
}
local document_numbered_arguments_t = {
['translator#'] = true,
['translator-first#'] = true,
['translator#-first'] = true,
['translator-given#'] = true,
['translator#-given'] = true,
['translator-last#'] = true,
['translator#-last'] = true,
['translator-surname#'] = true,
['translator#-surname'] = true,
['translator-link#'] = true,
['translator#-link'] = true,
['translator-mask#'] = true,
['translator#-mask'] = true,
}
--[[--------------------------< L I S T _ C O M B I N E >------------------------------------------------------
makes one table from a list of tables. <lists_t> is a sequence of tables to be combined
]]
local function list_combine (lists_t)
local out_t = {};
for _, list_t in ipairs (lists_t) do -- for each list in <lists_t>
for k, v in pairs (list_t) do -- extract each k/v pair
out_t[k] = v; -- add to <out_t>
end
end
return out_t; -- and done
end
--[[--------------------------< T E M P L A T E _ L I S T _ G E T >--------------------------------------------
gets a list of the templates from table t
]]
local function template_list_get (t)
local out_t = {}; -- a table for output
for k, _ in pairs (t) do -- spin through the table and collect the keys
table.insert (out_t, k) -- add each key to the output table
end
return out_t; -- and done
end
--[[--------------------------< E X P O R T E D T A B L E S >------------------------------------------------
]]
return {
preprint_arguments_t = preprint_arguments_t,
preprint_template_list_t = template_list_get (preprint_arguments_t), -- make a template list from preprint_arguments{} table
unique_arguments_t = unique_arguments_t,
unique_param_template_list_t = template_list_get (unique_arguments_t), -- make a template list from unique_arguments{} table
document_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t, document_arguments_t, document_numbered_arguments_t});
common_parameters_t = list_combine ({basic_arguments_t, numbered_arguments_t});
limited_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t});
};
1livvij6p41ygpz0myvp2ov8j5lfzcj
74991
74990
2026-08-24T00:44:39Z
Robertsky
10424
1 versaun husi [[:en:Module:Citation/CS1/Whitelist]]
74990
Scribunto
text/plain
--[[--------------------------< S U P P O R T E D P A R A M E T E R S >--------------------------------------
Because a steady-state signal conveys no useful information, whitelist.basic_arguments[] list items can have three values:
true - these parameters are valid and supported parameters
false - these parameters are deprecated but still supported
tracked - these parameters are valid and supported parameters tracked in an eponymous properties category
nil - these parameters are no longer supported. remove entirely
]]
local basic_arguments_t = {
['accessdate'] = true,
['access-date'] = true,
['agency'] = true,
['archivedate'] = true,
['archive-date'] = true,
['archive-format'] = true,
['archiveurl'] = true,
['archive-url'] = true,
['article'] = true,
['article-format'] = true,
['article-number'] = true, -- {{cite journal}}, {{cite conference}}; {{citation}} when |journal= has a value
['article-url'] = true,
['article-url-access'] = true,
['arxiv'] = true, -- cite arxiv; here because allowed in cite ... as identifier
['asin'] = true,
['ASIN'] = true,
['asin-tld'] = true,
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['authorlink'] = true,
['author-link'] = true,
['author-mask'] = true,
['bibcode'] = true,
['bibcode-access'] = true,
['biorxiv'] = true, -- cite biorxiv; here because allowed in cite ... as identifier
['chapter'] = true,
['chapter-format'] = true,
['chapter-url'] = true,
['chapter-url-access'] = true,
['citeseerx'] = false, -- cite citeseerx; here because allowed in cite ... as identifier
['collaboration'] = true,
['contribution'] = true,
['contribution-format'] = true,
['contribution-url'] = true,
['contribution-url-access'] = true,
['contributor'] = true,
['contributor-first'] = true,
['contributor-given'] = true,
['contributor-last'] = true,
['contributor-surname'] = true,
['contributor-link'] = true,
['contributor-mask'] = true,
['date'] = true,
['department'] = true,
['df'] = true,
['dictionary'] = true,
['display-authors'] = true,
['display-contributors'] = true,
['display-editors'] = true,
['display-interviewers'] = true,
['display-subjects'] = true,
['display-translators'] = true,
['doi'] = true,
['DOI'] = true,
['doi-access'] = true,
['doi-broken-date'] = true,
['edition'] = true,
['editor'] = true,
['editor-first'] = true,
['editor-given'] = true,
['editor-last'] = true,
['editor-surname'] = true,
['editor-link'] = true,
['editor-mask'] = true,
['eissn'] = true,
['EISSN'] = true,
['encyclopaedia'] = true,
['encyclopedia'] = true,
['entry'] = true,
['entry-format'] = true,
['entry-url'] = true,
['entry-url-access'] = true,
['eprint'] = true, -- cite arxiv; here because allowed in cite ... as identifier
['first'] = true,
['format'] = true,
['given'] = true,
['hdl'] = true,
['HDL'] = true,
['hdl-access'] = true,
['host'] = true, -- unique to certain templates?
['id'] = true,
['ID'] = true,
['institution'] = true, -- constrain to cite thesis?
['interviewer'] = true,
['interviewer-first'] = true,
['interviewer-given'] = true,
['interviewer-last'] = true,
['interviewer-surname'] = true,
['interviewer-link'] = true,
['interviewer-mask'] = true,
['isbn'] = true,
['ISBN'] = true,
['ismn'] = true,
['ISMN'] = true,
['issn'] = true,
['ISSN'] = true,
['issue'] = true,
['jfm'] = true,
['JFM'] = true,
['journal'] = true,
['jstor'] = true,
['JSTOR'] = true,
['jstor-access'] = true,
['lang'] = true,
['language'] = true,
['last'] = true,
['lccn'] = true,
['LCCN'] = true,
['location'] = true,
['magazine'] = true,
['medium'] = true,
['medrxiv'] = true, -- cite medrxiv; here because allowed in cite ... as identifier
['minutes'] = true, -- constrain to cite AV media and podcast?
['mode'] = true,
['mr'] = true,
['MR'] = true,
['name-list-style'] = true,
['newspaper'] = true,
['no-pp'] = true,
['no-tracking'] = true,
['number'] = true,
['oclc'] = true,
['OCLC'] = true,
['ol'] = true,
['OL'] = true,
['ol-access'] = true,
['orig-date'] = true,
['origyear'] = true,
['orig-year'] = true,
['osti'] = true,
['OSTI'] = true,
['osti-access'] = true,
['others'] = true,
['p'] = true,
['page'] = true,
['pages'] = true,
['periodical'] = true,
['place'] = true,
['pmc'] = true,
['PMC'] = true,
['pmc-embargo-date'] = true,
['pmid'] = true,
['PMID'] = true,
['postscript'] = true,
['pp'] = true,
['publication-date'] = true,
['publication-place'] = true,
['publisher'] = true,
['quotation'] = true,
['quote'] = true,
['quote-page'] = true,
['quote-pages'] = true,
['ref'] = true,
['rfc'] = true,
['RFC'] = true,
['sbn'] = true,
['SBN'] = true,
['scale'] = true,
['script-article'] = true,
['script-chapter'] = true,
['script-contribution'] = true,
['script-encyclopaedia'] = true,
['script-encyclopedia'] = true,
['script-entry'] = true,
['script-journal'] = true,
['script-magazine'] = true,
['script-newspaper'] = true,
['script-periodical'] = true,
['script-quote'] = true,
['script-section'] = true,
['script-title'] = true,
['script-website'] = true,
['script-work'] = true,
['section'] = true,
['section-format'] = true,
['section-url'] = true,
['section-url-access'] = true,
['series'] = true,
['ssrn'] = true, -- cite ssrn; these three here because allowed in cite ... as identifier
['SSRN'] = true,
['ssrn-access'] = true,
['subject'] = true,
['subject-first'] = true,
['subject-given'] = true,
['subject-last'] = true,
['subject-link'] = true,
['subject-mask'] = true,
['subject-surname'] = true,
['surname'] = true,
['s2cid'] = true,
['S2CID'] = true,
['s2cid-access'] = true,
['template-doc-demo'] = true,
['time'] = true, -- constrain to cite av media and podcast?
['time-caption'] = true, -- constrain to cite av media and podcast?
['title'] = true,
['title-link'] = true,
['title-note'] = true,
['translator'] = true,
['translator-first'] = true,
['translator-given'] = true,
['translator-last'] = true,
['translator-surname'] = true,
['translator-link'] = true,
['translator-mask'] = true,
['trans-article'] = true,
['trans-chapter'] = true,
['trans-contribution'] = true,
['trans-encyclopaedia'] = true,
['trans-encyclopedia'] = true,
['trans-entry'] = true,
['trans-journal'] = true,
['trans-magazine'] = true,
['trans-newspaper'] = true,
['trans-periodical'] = true,
['trans-quote'] = true,
['trans-section'] = true,
['trans-title'] = true,
['trans-website'] = true,
['trans-work'] = true,
['type'] = true,
['url'] = true,
['URL'] = true,
['url-access'] = true,
['url-status'] = true,
['vauthors'] = true,
['veditors'] = true,
['version'] = true,
['via'] = true,
['volume'] = true,
['website'] = true,
['work'] = true,
['year'] = true,
['zbl'] = true,
['ZBL'] = true,
}
local numbered_arguments_t = {
['author#'] = true,
['author-first#'] = true,
['author#-first'] = true,
['author-given#'] = true,
['author#-given'] = true,
['author-last#'] = true,
['author#-last'] = true,
['author-surname#'] = true,
['author#-surname'] = true,
['author-link#'] = true,
['author#-link'] = true,
['authorlink#'] = true,
['author#link'] = true,
['author-mask#'] = true,
['author#-mask'] = true,
['contributor#'] = true,
['contributor-first#'] = true,
['contributor#-first'] = true,
['contributor-given#'] = true,
['contributor#-given'] = true,
['contributor-last#'] = true,
['contributor#-last'] = true,
['contributor-surname#'] = true,
['contributor#-surname'] = true,
['contributor-link#'] = true,
['contributor#-link'] = true,
['contributor-mask#'] = true,
['contributor#-mask'] = true,
['editor#'] = true,
['editor-first#'] = true,
['editor#-first'] = true,
['editor-given#'] = true,
['editor#-given'] = true,
['editor-last#'] = true,
['editor#-last'] = true,
['editor-surname#'] = true,
['editor#-surname'] = true,
['editor-link#'] = true,
['editor#-link'] = true,
['editor-mask#'] = true,
['editor#-mask'] = true,
['first#'] = true,
['given#'] = true,
['host#'] = true,
['interviewer#'] = true,
['interviewer-first#'] = true,
['interviewer#-first'] = true,
['interviewer-given#'] = true,
['interviewer#-given'] = true,
['interviewer-last#'] = true,
['interviewer#-last'] = true,
['interviewer-surname#'] = true,
['interviewer#-surname'] = true,
['interviewer-link#'] = true,
['interviewer#-link'] = true,
['interviewer-mask#'] = true,
['interviewer#-mask'] = true,
['last#'] = true,
['subject#'] = true,
['subject-first#'] = true,
['subject#-first'] = true,
['subject-given#'] = true,
['subject#-given'] = true,
['subject-last#'] = true,
['subject#-last'] = true,
['subject-link#'] = true,
['subject#-link'] = true,
['subject-mask#'] = true,
['subject#-mask'] = true,
['subject-surname#'] = true,
['subject#-surname'] = true,
['surname#'] = true,
['translator#'] = true,
['translator-first#'] = true,
['translator#-first'] = true,
['translator-given#'] = true,
['translator#-given'] = true,
['translator-last#'] = true,
['translator#-last'] = true,
['translator-surname#'] = true,
['translator#-surname'] = true,
['translator-link#'] = true,
['translator#-link'] = true,
['translator-mask#'] = true,
['translator#-mask'] = true,
}
--[[--------------------------< P R E P R I N T S U P P O R T E D P A R A M E T E R S >--------------------
Cite arXiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn are preprint templates that use the limited
set of parameters defined in the limited_basic_arguments and limited_numbered_arguments tables. Those lists are
supplemented with a template-specific list of parameters that are required by the particular template and may be
exclusive to one of the preprint templates. Some of these parameters may also be available to the general cs1|2
templates.
Same conventions for true/false/tracked/nil as above.
]]
local preprint_arguments_t = {
arxiv = {
['arxiv'] = true, -- cite arxiv and arxiv identifiers
['class'] = true,
['eprint'] = true, -- cite arxiv and arxiv identifiers
},
biorxiv = {
['biorxiv'] = true,
},
citeseerx = {
['citeseerx'] = false,
},
medrxiv = {
['medrxiv'] = true,
},
ssrn = {
['ssrn'] = true,
['SSRN'] = true,
['ssrn-access'] = true,
},
}
--[[--------------------------< L I M I T E D S U P P O R T E D P A R A M E T E R S >----------------------
cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn templates are preprint templates so are
allowed only a limited subset of parameters allowed to all other cs1|2 templates. The limited subset is defined
here.
This list of parameters also used by {{cite document}}
Same conventions for true/false/tracked/nil as above.
]]
local limited_basic_arguments_t = {
['at'] = true,
['author'] = true,
['author-first'] = true,
['author-given'] = true,
['author-last'] = true,
['author-surname'] = true,
['author-link'] = true,
['authorlink'] = true,
['author-mask'] = true,
['collaboration'] = true,
['date'] = true,
['df'] = true,
['display-authors'] = true,
['first'] = true,
['given'] = true,
['language'] = true,
['last'] = true,
['mode'] = true,
['name-list-style'] = true,
['no-tracking'] = true,
['p'] = true,
['page'] = true,
['pages'] = true,
['postscript'] = true,
['pp'] = true,
['quotation'] = true,
['quote'] = true,
['ref'] = true,
['surname'] = true,
['template-doc-demo'] = true,
['title'] = true,
['trans-title'] = true,
['vauthors'] = true,
['year'] = true,
}
local limited_numbered_arguments_t = {
['author#'] = true,
['author-first#'] = true,
['author#-first'] = true,
['author-given#'] = true,
['author#-given'] = true,
['author-last#'] = true,
['author#-last'] = true,
['author-surname#'] = true,
['author#-surname'] = true,
['author-link#'] = true,
['author#-link'] = true,
['authorlink#'] = true,
['author#link'] = true,
['author-mask#'] = true,
['author#-mask'] = true,
['first#'] = true,
['given#'] = true,
['last#'] = true,
['surname#'] = true,
}
--[[--------------------------< U N I Q U E _ A R G U M E N T S >----------------------------------------------
Some templates have unique parameters. Those templates and their unique parameters are listed here. Keys in this
table are the template's CitationClass parameter value
Same conventions for true/false/tracked/nil as above.
]]
local unique_arguments_t = {
['audio-visual'] = {
['people'] = true,
['transcript'] = true,
['transcript-format'] = true,
['transcript-url'] = true,
},
conference = {
['book-title'] = true,
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
episode = {
['airdate'] = true,
['air-date'] = true,
['credits'] = true,
['episode-link'] = true, -- alias of |title-link=
['network'] = true,
['people'] = true,
['season'] = true,
['series-link'] = true,
['series-no'] = true,
['series-number'] = true,
['station'] = true,
['transcript'] = true,
['transcript-format'] = true,
['transcript-url'] = true,
},
mailinglist = {
['mailing-list'] = true,
},
map = {
['cartography'] = true,
['inset'] = true,
['map'] = true,
['map-format'] = true,
['map-url'] = true,
['map-url-access'] = true,
['script-map'] = true,
['sections'] = true,
['sheet'] = true,
['sheets'] = true,
['trans-map'] = true,
},
newsgroup = {
['message-id'] = true,
['newsgroup'] = true,
},
report = {
['docket'] = true,
},
serial = {
['airdate'] = true,
['air-date'] = true,
['credits'] = true,
['episode'] = true, -- cite serial only TODO: make available to cite episode?
['episode-link'] = true, -- alias of |title-link=
['network'] = true,
['people'] = true,
['series-link'] = true,
['station'] = true,
},
speech = {
['conference'] = true,
['conference-format'] = true,
['conference-url'] = true,
['event'] = true,
},
thesis = {
['degree'] = true,
['docket'] = true,
},
}
--[[--------------------------< C I T E _ D O C U M E N T >----------------------------------------------------
Special case for cite document. This template takes the limited basic and limited enumerated parameters plus
others that are apply only to standalone published sources that cannot be cited any other way; no url, book,
periodical, etc parameters; limited support for name lists and named identifiers.
when validating parameters in {{cite document}} templates, the basic and
]]
local document_arguments_t = {
['bibcode'] = true,
['bibcode-access'] = true,
['doi'] = true,
['DOI'] = true,
['doi-access'] = true,
['doi-broken-date'] = true,
['hdl'] = true,
['HDL'] = true,
['hdl-access'] = true,
['id'] = true,
['ID'] = true,
['jfm'] = true,
['JFM'] = true,
['lang'] = true,
['location'] = true,
['mr'] = true,
['MR'] = true,
['no-pp'] = true,
['orig-date'] = true,
['origyear'] = true,
['orig-year'] = true,
['osti'] = true,
['OSTI'] = true,
['osti-access'] = true,
['place'] = true,
['publisher'] = true,
['quote-page'] = true,
['quote-pages'] = true,
['script-quote'] = true,
['script-title'] = true,
['title-link'] = true,
['translator'] = true,
['translator-first'] = true,
['translator-given'] = true,
['translator-last'] = true,
['translator-surname'] = true,
['translator-link'] = true,
['translator-mask'] = true,
['trans-quote'] = true,
['type'] = true,
['zbl'] = true,
['ZBL'] = true,
}
local document_numbered_arguments_t = {
['translator#'] = true,
['translator-first#'] = true,
['translator#-first'] = true,
['translator-given#'] = true,
['translator#-given'] = true,
['translator-last#'] = true,
['translator#-last'] = true,
['translator-surname#'] = true,
['translator#-surname'] = true,
['translator-link#'] = true,
['translator#-link'] = true,
['translator-mask#'] = true,
['translator#-mask'] = true,
}
--[[--------------------------< L I S T _ C O M B I N E >------------------------------------------------------
makes one table from a list of tables. <lists_t> is a sequence of tables to be combined
]]
local function list_combine (lists_t)
local out_t = {};
for _, list_t in ipairs (lists_t) do -- for each list in <lists_t>
for k, v in pairs (list_t) do -- extract each k/v pair
out_t[k] = v; -- add to <out_t>
end
end
return out_t; -- and done
end
--[[--------------------------< T E M P L A T E _ L I S T _ G E T >--------------------------------------------
gets a list of the templates from table t
]]
local function template_list_get (t)
local out_t = {}; -- a table for output
for k, _ in pairs (t) do -- spin through the table and collect the keys
table.insert (out_t, k) -- add each key to the output table
end
return out_t; -- and done
end
--[[--------------------------< E X P O R T E D T A B L E S >------------------------------------------------
]]
return {
preprint_arguments_t = preprint_arguments_t,
preprint_template_list_t = template_list_get (preprint_arguments_t), -- make a template list from preprint_arguments{} table
unique_arguments_t = unique_arguments_t,
unique_param_template_list_t = template_list_get (unique_arguments_t), -- make a template list from unique_arguments{} table
document_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t, document_arguments_t, document_numbered_arguments_t});
common_parameters_t = list_combine ({basic_arguments_t, numbered_arguments_t});
limited_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t});
};
1livvij6p41ygpz0myvp2ov8j5lfzcj
Módulo:Citation/CS1/Utilities
828
7644
74992
71644
2026-08-08T13:56:45Z
en>Trappist the monk
0
synch from sandbox;
74992
Scribunto
text/plain
local z = {
error_cats_t = {}; -- for categorizing citations that contain errors
error_ids_t = {}; -- list of error identifiers; used to prevent duplication of certain errors; local to this module
error_msgs_t = {}; -- sequence table of error messages
maint_cats_t = {}; -- for categorizing citations that aren't erroneous per se, but could use a little work
prop_cats_t = {}; -- for categorizing citations based on certain properties, language of source for instance
prop_keys_t = {}; -- for adding classes to the citation's <cite> tag
};
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.
]]
local function is_set (var)
return not (var == nil or var == '');
end
--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
Whether needle is in haystack
]]
local function in_array (needle, haystack)
if needle == nil then
return false;
end
for n, v in ipairs (haystack) do
if v == needle then
return n;
end
end
return false;
end
--[[--------------------------< H A S _ A C C E P T _ A S _ W R I T T E N >------------------------------------
When <str> is wholly wrapped in accept-as-written markup, return <str> without markup and true; return <str> and false else
with allow_empty = false, <str> must have at least one character inside the markup
with allow_empty = true, <str> the markup frame can be empty like (()) to distinguish an empty template parameter from the specific condition "has no applicable value" in citation-context.
After further evaluation the two cases might be merged at a later stage, but should be kept separated for now.
]]
local function has_accept_as_written (str, allow_empty)
if not is_set (str) then
return str, false;
end
local count;
if true == allow_empty then
str, count = str:gsub ('^%(%((.*)%)%)$', '%1'); -- allows (()) to be an empty set
else
str, count = str:gsub ('^%(%((.+)%)%)$', '%1');
end
return str, 0 ~= count;
end
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
Populates numbered arguments in a message string using an argument table. <args> may be a single string or a
sequence table of multiple strings.
]]
local function substitute (msg, args)
return args and mw.message.newRawMessage (msg, args):plain() or msg;
end
--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------
Wraps error messages with CSS markup according to the state of hidden. <content> may be a single string or a
sequence table of multiple strings.
]]
local function error_comment (content, hidden)
return substitute (hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content);
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen, endash, emdash to endash under certain conditions. The hyphen/en/em must separate
like items; unlike items are returned unmodified. These forms are modified:
letter - letter (A-B)
digit - digit (4-5)
digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
letterdigit - letterdigit (A1-A5) (an optional separator between letter and
digit is supported – a.1-a.5 or a-1-a-5)
digitletter - digitletter (5a-5d) (an optional separator between letter and
digit is supported – 5.a-5.d or 5-a-5-d)
any other forms are returned unmodified.
str may be a comma- or semicolon-separated list of page ranges with/without single pages
]]
local function hyphen_to_dash (str)
if not is_set (str) then
return str;
end
str = str:gsub ("(%(%(.-%)%))", function(m) return m:gsub(",", ","):gsub(";", ";") end) -- replace commas and semicolons in accept-as-written markup with similar unicode characters so they'll be ignored during the split
str = str:gsub ('&[nm]dash;', {['–'] = '–', ['—'] = '—'}); -- replace — and – entities with their characters; semicolon mucks up the text.split
str = str:gsub ('-', '-'); -- replace HTML numeric entity with hyphen character
str = str:gsub (' ', ' '); -- replace entity with generic keyboard space character
local out = {};
local list = mw.text.split (str, '%s*[,;]%s*'); -- split str at comma or semicolon separators if there are any
local accept; -- boolean
for _, item in ipairs (list) do -- for each item in the list
item, accept = has_accept_as_written (item); -- remove accept-this-as-written markup when it wraps all of item
if not accept and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[—–-]%s*%w*[%.%-]?%w+$') then -- if pagination uses <hyphen|dot> separators with hyphen/endash/emdash <range separator>
if mw.ustring.match (item, '^%a+[%.%-]%d+%s*[—–-]%s*%a+[%.%-]%d+$') or -- letter<hyphen|dot>digit <range separator> letter<hyphen|dot>digit (requires <hyphen|dot> separator between letter and digit)
mw.ustring.match (item, '^%d+[%.%-]%a+%s*[—–-]%s*%d+[%.%-]%a+$') or -- digit<hyphen|dot>letter <range separator> digit<hyphen|dot>letter (requires <hyphen|dot> separator between digit and letter)
mw.ustring.match (item, '^%d+[%.%-]%d+%s*[—–-]%s*%d+[%.%-]%d+$') then -- digit<hyphen|dot>digit <range separator> digit<hyphen|dot>digit (requires <hyphen|dot> separator between digit and digit)
item = mw.ustring.gsub (item, '(%w*[%.%-]%w+)%s*[—–-]%s*(%w*[%.%-]%w+)', '<span class="nowrap">%1 –</span> <span class="nowrap">%2</span>'); -- replace <range separator>, with spaced endash
elseif mw.ustring.match (item, '^%d+%a+%s*[—–-]%s*%d+%a+$') or -- digitletter <range separator> digitletter
mw.ustring.match (item, '^%a+%d+%s*[—–-]%s*%a+%d+$') or -- letterdigit <range separator> letterdigit
mw.ustring.match (item, '^%d+%s*[—–-]%s*%d+$') or -- digit <range separator> digit
mw.ustring.match (item, '^%a+%s*[—–-]%s*%a+$') then -- letter<range separator> letter
item = mw.ustring.gsub (item, '(%w+)%s*[—–-]%s*(%w+)', '<span class="nowrap">%1–</span>%2'); -- replace <range separator> with endash, remove extraneous space characters
else
-- item = mw.ustring.gsub (item, '%s*[—–-]%s*', '–'); -- disabled; here when 'unlike' items so return <item> as is
end
end
table.insert (out, item); -- add the (possibly modified) item to the output table
end
local temp_str; -- concatenate the output table into a comma separated string
temp_str, accept = has_accept_as_written (table.concat (out, ', ')); -- remove accept-this-as-written markup when it wraps all of concatenated out
if accept then
temp_str = has_accept_as_written (str); -- when global markup removed, return original str; do it this way to suppress boolean second return value
return temp_str:gsub(",", ","):gsub(";", ";");
else
return temp_str:gsub(",", ","):gsub(";", ";"); -- else, return assembled temp_str
end
end
--[=[-------------------------< M A K E _ W I K I L I N K >----------------------------------------------------
Makes a wikilink; when both link and display text is provided, returns a wikilink in the form [[L|D]]; if only
link is provided (or link and display are the same), returns a wikilink in the form [[L]]; if neither are
provided or link is omitted, returns an empty string.
]=]
local function make_wikilink (link, display)
if not is_set (link) then return '' end
if is_set (display) and link ~= display then
return table.concat ({'[[', link, '|', display, ']]'});
else
return table.concat ({'[[', link, ']]'});
end
end
--[[--------------------------< S E T _ M E S S A G E >----------------------------------------------------------
Sets an error message using the ~/Configuration error_conditions{} table along with arguments supplied in the function
call, inserts the resulting message in z.error_msgs_t{} sequence table, and returns the error message.
<error_id> – key value for appropriate error handler in ~/Configuration error_conditions{} table
<arguments> – may be a single string or a sequence table of multiple strings to be subsititued into error_conditions[error_id].message
<raw> – boolean
true – causes this function to return the error message not wrapped in visible-error, hidden-error span tag;
returns error_conditions[error_id].hidden as a second return value
does not add message to z.error_msgs_t sequence table
false, nil – adds message wrapped in visible-error, hidden-error span tag to z.error_msgs_t
returns the error message wrapped in visible-error, hidden-error span tag; there is no second return value
<prefix> – string to be prepended to <message> -- TODO: remove support for these unused(?) arguments?
<suffix> – string to be appended to <message>
TODO: change z.error_cats_t and z.maint_cats_t to have the form cat_name = true? this to avoid dups without having to have an extra table
]]
local added_maint_cats = {} -- list of maintenance categories that have been added to z.maint_cats_t; TODO: figure out how to delete this table
local function set_message (error_id, arguments, raw, prefix, suffix)
local error_state = cfg.error_conditions[error_id];
prefix = prefix or '';
suffix = suffix or '';
if error_state == nil then
error (cfg.messages['undefined_error'] .. ': ' .. error_id); -- because missing error handler in Module:Citation/CS1/Configuration
elseif is_set (error_state.category) then
if error_state.message then -- when error_state.message defined, this is an error message
table.insert (z.error_cats_t, error_state.category);
else
if not added_maint_cats[error_id] then
added_maint_cats[error_id] = true; -- note that we've added this category
table.insert (z.maint_cats_t, substitute (error_state.category, arguments)); -- make cat name then add to table
end
return; -- because no message, nothing more to do
end
end
local message = substitute (error_state.message, arguments);
message = table.concat (
{
message,
' (',
make_wikilink (
table.concat (
{
cfg.messages['help page link'],
'#',
error_state.anchor
}),
cfg.messages['help page label']),
')'
});
z.error_ids_t[error_id] = true;
if z.error_ids_t['err_citation_missing_title'] and -- if missing-title error already noted
in_array (error_id, {'err_bare_url_missing_title', 'err_trans_missing_title'}) then -- and this error is one of these
return '', false; -- don't bother because one flavor of missing title is sufficient
end
message = table.concat ({prefix, message, suffix});
if true == raw then
return message, error_state.hidden; -- return message not wrapped in visible-error, hidden-error span tag
end
message = error_comment (message, error_state.hidden); -- wrap message in visible-error, hidden-error span tag
table.insert (z.error_msgs_t, message); -- add it to the messages sequence table
return message; -- and done; return value generally not used but is used as a flag in various functions of ~/Identifiers
end
--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------
This function is used by select_one() to determine if one of a list of alias parameters is in the argument list
provided by the template.
Input:
args – pointer to the arguments table from calling template
alias – one of the list of possible aliases in the aliases lists from Module:Citation/CS1/Configuration
index – for enumerated parameters, identifies which one
enumerated – true/false flag used to choose how enumerated aliases are examined
value – value associated with an alias that has previously been selected; nil if not yet selected
selected – the alias that has previously been selected; nil if not yet selected
error_list – list of aliases that are duplicates of the alias already selected
Returns:
value – value associated with alias we selected or that was previously selected or nil if an alias not yet selected
selected – the alias we selected or the alias that was previously selected or nil if an alias not yet selected
]]
local function is_alias_used (args, alias, index, enumerated, value, selected, error_list)
if enumerated then -- is this a test for an enumerated parameters?
alias = alias:gsub ('#', index); -- replace '#' with the value in index
else
alias = alias:gsub ('#', ''); -- remove '#' if it exists
end
if is_set (args[alias]) then -- alias is in the template's argument list
if value ~= nil and selected ~= alias then -- if we have already selected one of the aliases
local skip;
for _, v in ipairs (error_list) do -- spin through the error list to see if we've added this alias
if v == alias then
skip = true;
break; -- has been added so stop looking
end
end
if not skip then -- has not been added so
table.insert (error_list, alias); -- add error alias to the error list
end
else
value = args[alias]; -- not yet selected an alias, so select this one
selected = alias;
end
end
return value, selected; -- return newly selected alias, or previously selected alias
end
--[[--------------------------< A D D _ M A I N T _ C A T >------------------------------------------------------
Adds a category to z.maint_cats_t using names from the configuration file with additional text if any.
To prevent duplication, the added_maint_cats table lists the categories by key that have been added to z.maint_cats_t.
]]
local function add_maint_cat (key, arguments)
if not added_maint_cats [key] then
added_maint_cats [key] = true; -- note that we've added this category
table.insert (z.maint_cats_t, substitute (cfg.maint_cats [key], arguments)); -- make name then add to table
end
end
--[[--------------------------< A D D _ P R O P _ C A T >--------------------------------------------------------
Adds a category to z.prop_cats_t using names from the configuration file with additional text if any.
foreign_lang_source and foreign_lang_source_2 keys have a language code appended to them so that multiple languages
may be categorized but multiples of the same language are not categorized.
added_prop_cats is a table declared in page scope variables above
]]
local added_prop_cats = {}; -- list of property categories that have been added to z.prop_cats_t
local function add_prop_cat (key, arguments, key_modifier)
local key_modified = key .. ((key_modifier and key_modifier) or ''); -- modify <key> with <key_modifier> if present and not nil
if not added_prop_cats [key_modified] then
added_prop_cats [key_modified] = true; -- note that we've added this category
table.insert (z.prop_cats_t, substitute (cfg.prop_cats [key], arguments)); -- make name then add to table
table.insert (z.prop_keys_t, 'cs1-prop-' .. key); -- convert key to class for use in the citation's <cite> tag
end
end
--[[--------------------------< S A F E _ F O R _ I T A L I C S >----------------------------------------------
Protects a string that will be wrapped in wiki italic markup '' ... ''
Note: We cannot use <i> for italics, as the expected behavior for italics specified by ''...'' in the title is that
they will be inverted (i.e. unitalicized) in the resulting references. In addition, <i> and '' tend to interact
poorly under Mediawiki's HTML tidy.
]]
local function safe_for_italics (str)
if not is_set (str) then return str end
if str:sub (1, 1) == "'" then str = "<span></span>" .. str; end
if str:sub (-1, -1) == "'" then str = str .. "<span></span>"; end
return str:gsub ('\n', ' '); -- Remove newlines as they break italics.
end
--[[--------------------------< W R A P _ S T Y L E >----------------------------------------------------------
Applies styling to various parameters. Supplied string is wrapped using a message_list configuration taking one
argument; protects italic styled parameters. Additional text taken from citation_config.presentation - the reason
this function is similar to but separate from wrap_msg().
]]
local function wrap_style (key, str)
if not is_set (str) then
return "";
elseif in_array (key, {'italic-title', 'trans-italic-title'}) then
str = safe_for_italics (str);
end
return substitute (cfg.presentation[key], {str});
end
--[[--------------------------< M A K E _ S E P _ L I S T >------------------------------------------------------------
make a separated list of items using provided separators.
<sep_list> - typically '<comma><space>'
<sep_list_pair> - typically '<space>and<space>'
<sep_list_end> - typically '<comma><space>and<space>' or '<comma><space>&<space>'
defaults to cfg.presentation['sep_list'], cfg.presentation['sep_list_pair'], and cfg.presentation['sep_list_end']
if <sep_list_end> is specified, <sep_list> and <sep_list_pair> must also be supplied
]]
local function make_sep_list (count, list_seq, sep_list, sep_list_pair, sep_list_end)
local list = '';
if not sep_list then -- set the defaults
sep_list = cfg.presentation['sep_list'];
sep_list_pair = cfg.presentation['sep_list_pair'];
sep_list_end = cfg.presentation['sep_list_end'];
end
if 2 >= count then
list = table.concat (list_seq, sep_list_pair); -- insert separator between two items; returns list_seq[1] then only one item
elseif 2 < count then
list = table.concat (list_seq, sep_list, 1, count - 1); -- concatenate all but last item with plain list separator
list = table.concat ({list, list_seq[count]}, sep_list_end); -- concatenate last item onto end of <list> with final separator
end
return list;
end
--[[--------------------------< S E L E C T _ O N E >----------------------------------------------------------
Chooses one matching parameter from a list of parameters to consider. The list of parameters to consider is just
names. For parameters that may be enumerated, the position of the numerator in the parameter name is identified
by the '#' so |author-last1= and |author1-last= are represented as 'author-last#' and 'author#-last'.
Because enumerated parameter |<param>1= is an alias of |<param>= we must test for both possibilities.
Generates an error if more than one match is present.
]]
local function select_one (args, aliases_list, error_condition, index)
local value = nil; -- the value assigned to the selected parameter
local selected = ''; -- the name of the parameter we have chosen
local error_list = {};
if index ~= nil then index = tostring(index); end
for _, alias in ipairs (aliases_list) do -- for each alias in the aliases list
if alias:match ('#') then -- if this alias can be enumerated
if '1' == index then -- when index is 1 test for enumerated and non-enumerated aliases
value, selected = is_alias_used (args, alias, index, false, value, selected, error_list); -- first test for non-enumerated alias
end
value, selected = is_alias_used (args, alias, index, true, value, selected, error_list); -- test for enumerated alias
else
value, selected = is_alias_used (args, alias, index, false, value, selected, error_list); -- test for non-enumerated alias
end
end
if #error_list > 0 and 'none' ~= error_condition then -- for cases where this code is used outside of extract_names()
for i, v in ipairs (error_list) do
error_list[i] = wrap_style ('parameter', v);
end
table.insert (error_list, wrap_style ('parameter', selected));
set_message (error_condition, {make_sep_list (#error_list, error_list)});
end
return value, selected;
end
--[=[-------------------------< R E M O V E _ W I K I _ L I N K >----------------------------------------------
Gets the display text from a wikilink like [[A|B]] or [[B]] gives B
The str:gsub() returns either A|B froma [[A|B]] or B from [[B]] or B from B (no wikilink markup).
In l(), l:gsub() removes the link and pipe (if they exist); the second :gsub() trims whitespace from the label
if str was wrapped in wikilink markup. Presumably, this is because without wikimarkup in str, there is no match
in the initial gsub, the replacement function l() doesn't get called.
]=]
local function remove_wiki_link (str)
return (str:gsub ("%[%[([^%[%]]*)%]%]", function(l)
return l:gsub ("^[^|]*|(.*)$", "%1" ):gsub ("^%s*(.-)%s*$", "%1");
end));
end
--[=[-------------------------< I S _ W I K I L I N K >--------------------------------------------------------
Determines if str is a wikilink, extracts, and returns the wikilink type, link text, and display text parts.
If str is a complex wikilink ([[L|D]]):
returns wl_type 2 and D and L from [[L|D]];
if str is a simple wikilink ([[D]])
returns wl_type 1 and D from [[D]] and L as empty string;
if not a wikilink:
returns wl_type 0, str as D, and L as empty string.
trims leading and trailing whitespace and pipes from L and D ([[L|]] and [[|D]] are accepted by MediaWiki and
treated like [[D]]; while [[|D|]] is not accepted by MediaWiki, here, we accept it and return D without the pipes).
]=]
local function is_wikilink (str)
local D, L
local wl_type = 2; -- assume that str is a complex wikilink [[L|D]]
if not str:match ('^%[%[[^%]]+%]%]$') then -- is str some sort of a wikilink (must have some sort of content)
return 0, str, ''; -- not a wikilink; return wl_type as 0, str as D, and empty string as L
end
L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$'); -- get L and D from [[L|D]]
if not is_set (D) then -- if no separate display
D = str:match ('^%[%[([^%]]*)|*%]%]$'); -- get D from [[D]] or [[D|]]
wl_type = 1;
end
D = mw.text.trim (D, '%s|'); -- trim white space and pipe characters
return wl_type, D, L or '';
end
--[[--------------------------< S T R I P _ A P O S T R O P H E _ M A R K U P >--------------------------------
Strip wiki italic and bold markup from argument so that it doesn't contaminate COinS metadata.
This function strips common patterns of apostrophe markup. We presume that editors who have taken the time to
markup a title have, as a result, provided valid markup. When they don't, some single apostrophes are left behind.
Returns the argument without wiki markup and a number; the number is more-or-less meaningless except as a flag
to indicate that markup was replaced; do not rely on it as an indicator of how many of any kind of markup was
removed; returns the argument and nil when no markup removed
]]
local function strip_apostrophe_markup (argument)
if not is_set (argument) then
return argument, nil; -- no argument, nothing to do
end
if nil == argument:find ( "''", 1, true ) then -- Is there at least one double apostrophe? If not, exit.
return argument, nil;
end
local flag;
while true do
if argument:find ("'''''", 1, true) then -- bold italic (5)
argument, flag = argument:gsub ("%'%'%'%'%'", ""); -- remove all instances of it
elseif argument:find ("''''", 1, true) then -- italic start and end without content (4)
argument, flag=argument:gsub ("%'%'%'%'", "");
elseif argument:find ("'''", 1, true) then -- bold (3)
argument, flag=argument:gsub ("%'%'%'", "");
elseif argument:find ("''", 1, true) then -- italic (2)
argument, flag = argument:gsub ("%'%'", "");
else
break;
end
end
return argument, flag; -- done
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr)
cfg = cfg_table_ptr;
end
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return {
add_maint_cat = add_maint_cat, -- exported functions
add_prop_cat = add_prop_cat,
error_comment = error_comment,
has_accept_as_written = has_accept_as_written,
hyphen_to_dash = hyphen_to_dash,
in_array = in_array,
is_set = is_set,
is_wikilink = is_wikilink,
make_sep_list = make_sep_list,
make_wikilink = make_wikilink,
remove_wiki_link = remove_wiki_link,
safe_for_italics = safe_for_italics,
select_one = select_one,
set_message = set_message,
set_selected_modules = set_selected_modules,
strip_apostrophe_markup = strip_apostrophe_markup,
substitute = substitute,
wrap_style = wrap_style,
z = z, -- exported table
}
bvyfrlfh7kkrrt2v6jk2f3z13girav4
74993
74992
2026-08-24T00:44:39Z
Robertsky
10424
1 versaun husi [[:en:Module:Citation/CS1/Utilities]]
74992
Scribunto
text/plain
local z = {
error_cats_t = {}; -- for categorizing citations that contain errors
error_ids_t = {}; -- list of error identifiers; used to prevent duplication of certain errors; local to this module
error_msgs_t = {}; -- sequence table of error messages
maint_cats_t = {}; -- for categorizing citations that aren't erroneous per se, but could use a little work
prop_cats_t = {}; -- for categorizing citations based on certain properties, language of source for instance
prop_keys_t = {}; -- for adding classes to the citation's <cite> tag
};
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.
]]
local function is_set (var)
return not (var == nil or var == '');
end
--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
Whether needle is in haystack
]]
local function in_array (needle, haystack)
if needle == nil then
return false;
end
for n, v in ipairs (haystack) do
if v == needle then
return n;
end
end
return false;
end
--[[--------------------------< H A S _ A C C E P T _ A S _ W R I T T E N >------------------------------------
When <str> is wholly wrapped in accept-as-written markup, return <str> without markup and true; return <str> and false else
with allow_empty = false, <str> must have at least one character inside the markup
with allow_empty = true, <str> the markup frame can be empty like (()) to distinguish an empty template parameter from the specific condition "has no applicable value" in citation-context.
After further evaluation the two cases might be merged at a later stage, but should be kept separated for now.
]]
local function has_accept_as_written (str, allow_empty)
if not is_set (str) then
return str, false;
end
local count;
if true == allow_empty then
str, count = str:gsub ('^%(%((.*)%)%)$', '%1'); -- allows (()) to be an empty set
else
str, count = str:gsub ('^%(%((.+)%)%)$', '%1');
end
return str, 0 ~= count;
end
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
Populates numbered arguments in a message string using an argument table. <args> may be a single string or a
sequence table of multiple strings.
]]
local function substitute (msg, args)
return args and mw.message.newRawMessage (msg, args):plain() or msg;
end
--[[--------------------------< E R R O R _ C O M M E N T >----------------------------------------------------
Wraps error messages with CSS markup according to the state of hidden. <content> may be a single string or a
sequence table of multiple strings.
]]
local function error_comment (content, hidden)
return substitute (hidden and cfg.presentation['hidden-error'] or cfg.presentation['visible-error'], content);
end
--[[--------------------------< H Y P H E N _ T O _ D A S H >--------------------------------------------------
Converts a hyphen, endash, emdash to endash under certain conditions. The hyphen/en/em must separate
like items; unlike items are returned unmodified. These forms are modified:
letter - letter (A-B)
digit - digit (4-5)
digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)
letterdigit - letterdigit (A1-A5) (an optional separator between letter and
digit is supported – a.1-a.5 or a-1-a-5)
digitletter - digitletter (5a-5d) (an optional separator between letter and
digit is supported – 5.a-5.d or 5-a-5-d)
any other forms are returned unmodified.
str may be a comma- or semicolon-separated list of page ranges with/without single pages
]]
local function hyphen_to_dash (str)
if not is_set (str) then
return str;
end
str = str:gsub ("(%(%(.-%)%))", function(m) return m:gsub(",", ","):gsub(";", ";") end) -- replace commas and semicolons in accept-as-written markup with similar unicode characters so they'll be ignored during the split
str = str:gsub ('&[nm]dash;', {['–'] = '–', ['—'] = '—'}); -- replace — and – entities with their characters; semicolon mucks up the text.split
str = str:gsub ('-', '-'); -- replace HTML numeric entity with hyphen character
str = str:gsub (' ', ' '); -- replace entity with generic keyboard space character
local out = {};
local list = mw.text.split (str, '%s*[,;]%s*'); -- split str at comma or semicolon separators if there are any
local accept; -- boolean
for _, item in ipairs (list) do -- for each item in the list
item, accept = has_accept_as_written (item); -- remove accept-this-as-written markup when it wraps all of item
if not accept and mw.ustring.match (item, '^%w*[%.%-]?%w+%s*[—–-]%s*%w*[%.%-]?%w+$') then -- if pagination uses <hyphen|dot> separators with hyphen/endash/emdash <range separator>
if mw.ustring.match (item, '^%a+[%.%-]%d+%s*[—–-]%s*%a+[%.%-]%d+$') or -- letter<hyphen|dot>digit <range separator> letter<hyphen|dot>digit (requires <hyphen|dot> separator between letter and digit)
mw.ustring.match (item, '^%d+[%.%-]%a+%s*[—–-]%s*%d+[%.%-]%a+$') or -- digit<hyphen|dot>letter <range separator> digit<hyphen|dot>letter (requires <hyphen|dot> separator between digit and letter)
mw.ustring.match (item, '^%d+[%.%-]%d+%s*[—–-]%s*%d+[%.%-]%d+$') then -- digit<hyphen|dot>digit <range separator> digit<hyphen|dot>digit (requires <hyphen|dot> separator between digit and digit)
item = mw.ustring.gsub (item, '(%w*[%.%-]%w+)%s*[—–-]%s*(%w*[%.%-]%w+)', '<span class="nowrap">%1 –</span> <span class="nowrap">%2</span>'); -- replace <range separator>, with spaced endash
elseif mw.ustring.match (item, '^%d+%a+%s*[—–-]%s*%d+%a+$') or -- digitletter <range separator> digitletter
mw.ustring.match (item, '^%a+%d+%s*[—–-]%s*%a+%d+$') or -- letterdigit <range separator> letterdigit
mw.ustring.match (item, '^%d+%s*[—–-]%s*%d+$') or -- digit <range separator> digit
mw.ustring.match (item, '^%a+%s*[—–-]%s*%a+$') then -- letter<range separator> letter
item = mw.ustring.gsub (item, '(%w+)%s*[—–-]%s*(%w+)', '<span class="nowrap">%1–</span>%2'); -- replace <range separator> with endash, remove extraneous space characters
else
-- item = mw.ustring.gsub (item, '%s*[—–-]%s*', '–'); -- disabled; here when 'unlike' items so return <item> as is
end
end
table.insert (out, item); -- add the (possibly modified) item to the output table
end
local temp_str; -- concatenate the output table into a comma separated string
temp_str, accept = has_accept_as_written (table.concat (out, ', ')); -- remove accept-this-as-written markup when it wraps all of concatenated out
if accept then
temp_str = has_accept_as_written (str); -- when global markup removed, return original str; do it this way to suppress boolean second return value
return temp_str:gsub(",", ","):gsub(";", ";");
else
return temp_str:gsub(",", ","):gsub(";", ";"); -- else, return assembled temp_str
end
end
--[=[-------------------------< M A K E _ W I K I L I N K >----------------------------------------------------
Makes a wikilink; when both link and display text is provided, returns a wikilink in the form [[L|D]]; if only
link is provided (or link and display are the same), returns a wikilink in the form [[L]]; if neither are
provided or link is omitted, returns an empty string.
]=]
local function make_wikilink (link, display)
if not is_set (link) then return '' end
if is_set (display) and link ~= display then
return table.concat ({'[[', link, '|', display, ']]'});
else
return table.concat ({'[[', link, ']]'});
end
end
--[[--------------------------< S E T _ M E S S A G E >----------------------------------------------------------
Sets an error message using the ~/Configuration error_conditions{} table along with arguments supplied in the function
call, inserts the resulting message in z.error_msgs_t{} sequence table, and returns the error message.
<error_id> – key value for appropriate error handler in ~/Configuration error_conditions{} table
<arguments> – may be a single string or a sequence table of multiple strings to be subsititued into error_conditions[error_id].message
<raw> – boolean
true – causes this function to return the error message not wrapped in visible-error, hidden-error span tag;
returns error_conditions[error_id].hidden as a second return value
does not add message to z.error_msgs_t sequence table
false, nil – adds message wrapped in visible-error, hidden-error span tag to z.error_msgs_t
returns the error message wrapped in visible-error, hidden-error span tag; there is no second return value
<prefix> – string to be prepended to <message> -- TODO: remove support for these unused(?) arguments?
<suffix> – string to be appended to <message>
TODO: change z.error_cats_t and z.maint_cats_t to have the form cat_name = true? this to avoid dups without having to have an extra table
]]
local added_maint_cats = {} -- list of maintenance categories that have been added to z.maint_cats_t; TODO: figure out how to delete this table
local function set_message (error_id, arguments, raw, prefix, suffix)
local error_state = cfg.error_conditions[error_id];
prefix = prefix or '';
suffix = suffix or '';
if error_state == nil then
error (cfg.messages['undefined_error'] .. ': ' .. error_id); -- because missing error handler in Module:Citation/CS1/Configuration
elseif is_set (error_state.category) then
if error_state.message then -- when error_state.message defined, this is an error message
table.insert (z.error_cats_t, error_state.category);
else
if not added_maint_cats[error_id] then
added_maint_cats[error_id] = true; -- note that we've added this category
table.insert (z.maint_cats_t, substitute (error_state.category, arguments)); -- make cat name then add to table
end
return; -- because no message, nothing more to do
end
end
local message = substitute (error_state.message, arguments);
message = table.concat (
{
message,
' (',
make_wikilink (
table.concat (
{
cfg.messages['help page link'],
'#',
error_state.anchor
}),
cfg.messages['help page label']),
')'
});
z.error_ids_t[error_id] = true;
if z.error_ids_t['err_citation_missing_title'] and -- if missing-title error already noted
in_array (error_id, {'err_bare_url_missing_title', 'err_trans_missing_title'}) then -- and this error is one of these
return '', false; -- don't bother because one flavor of missing title is sufficient
end
message = table.concat ({prefix, message, suffix});
if true == raw then
return message, error_state.hidden; -- return message not wrapped in visible-error, hidden-error span tag
end
message = error_comment (message, error_state.hidden); -- wrap message in visible-error, hidden-error span tag
table.insert (z.error_msgs_t, message); -- add it to the messages sequence table
return message; -- and done; return value generally not used but is used as a flag in various functions of ~/Identifiers
end
--[[-------------------------< I S _ A L I A S _ U S E D >-----------------------------------------------------
This function is used by select_one() to determine if one of a list of alias parameters is in the argument list
provided by the template.
Input:
args – pointer to the arguments table from calling template
alias – one of the list of possible aliases in the aliases lists from Module:Citation/CS1/Configuration
index – for enumerated parameters, identifies which one
enumerated – true/false flag used to choose how enumerated aliases are examined
value – value associated with an alias that has previously been selected; nil if not yet selected
selected – the alias that has previously been selected; nil if not yet selected
error_list – list of aliases that are duplicates of the alias already selected
Returns:
value – value associated with alias we selected or that was previously selected or nil if an alias not yet selected
selected – the alias we selected or the alias that was previously selected or nil if an alias not yet selected
]]
local function is_alias_used (args, alias, index, enumerated, value, selected, error_list)
if enumerated then -- is this a test for an enumerated parameters?
alias = alias:gsub ('#', index); -- replace '#' with the value in index
else
alias = alias:gsub ('#', ''); -- remove '#' if it exists
end
if is_set (args[alias]) then -- alias is in the template's argument list
if value ~= nil and selected ~= alias then -- if we have already selected one of the aliases
local skip;
for _, v in ipairs (error_list) do -- spin through the error list to see if we've added this alias
if v == alias then
skip = true;
break; -- has been added so stop looking
end
end
if not skip then -- has not been added so
table.insert (error_list, alias); -- add error alias to the error list
end
else
value = args[alias]; -- not yet selected an alias, so select this one
selected = alias;
end
end
return value, selected; -- return newly selected alias, or previously selected alias
end
--[[--------------------------< A D D _ M A I N T _ C A T >------------------------------------------------------
Adds a category to z.maint_cats_t using names from the configuration file with additional text if any.
To prevent duplication, the added_maint_cats table lists the categories by key that have been added to z.maint_cats_t.
]]
local function add_maint_cat (key, arguments)
if not added_maint_cats [key] then
added_maint_cats [key] = true; -- note that we've added this category
table.insert (z.maint_cats_t, substitute (cfg.maint_cats [key], arguments)); -- make name then add to table
end
end
--[[--------------------------< A D D _ P R O P _ C A T >--------------------------------------------------------
Adds a category to z.prop_cats_t using names from the configuration file with additional text if any.
foreign_lang_source and foreign_lang_source_2 keys have a language code appended to them so that multiple languages
may be categorized but multiples of the same language are not categorized.
added_prop_cats is a table declared in page scope variables above
]]
local added_prop_cats = {}; -- list of property categories that have been added to z.prop_cats_t
local function add_prop_cat (key, arguments, key_modifier)
local key_modified = key .. ((key_modifier and key_modifier) or ''); -- modify <key> with <key_modifier> if present and not nil
if not added_prop_cats [key_modified] then
added_prop_cats [key_modified] = true; -- note that we've added this category
table.insert (z.prop_cats_t, substitute (cfg.prop_cats [key], arguments)); -- make name then add to table
table.insert (z.prop_keys_t, 'cs1-prop-' .. key); -- convert key to class for use in the citation's <cite> tag
end
end
--[[--------------------------< S A F E _ F O R _ I T A L I C S >----------------------------------------------
Protects a string that will be wrapped in wiki italic markup '' ... ''
Note: We cannot use <i> for italics, as the expected behavior for italics specified by ''...'' in the title is that
they will be inverted (i.e. unitalicized) in the resulting references. In addition, <i> and '' tend to interact
poorly under Mediawiki's HTML tidy.
]]
local function safe_for_italics (str)
if not is_set (str) then return str end
if str:sub (1, 1) == "'" then str = "<span></span>" .. str; end
if str:sub (-1, -1) == "'" then str = str .. "<span></span>"; end
return str:gsub ('\n', ' '); -- Remove newlines as they break italics.
end
--[[--------------------------< W R A P _ S T Y L E >----------------------------------------------------------
Applies styling to various parameters. Supplied string is wrapped using a message_list configuration taking one
argument; protects italic styled parameters. Additional text taken from citation_config.presentation - the reason
this function is similar to but separate from wrap_msg().
]]
local function wrap_style (key, str)
if not is_set (str) then
return "";
elseif in_array (key, {'italic-title', 'trans-italic-title'}) then
str = safe_for_italics (str);
end
return substitute (cfg.presentation[key], {str});
end
--[[--------------------------< M A K E _ S E P _ L I S T >------------------------------------------------------------
make a separated list of items using provided separators.
<sep_list> - typically '<comma><space>'
<sep_list_pair> - typically '<space>and<space>'
<sep_list_end> - typically '<comma><space>and<space>' or '<comma><space>&<space>'
defaults to cfg.presentation['sep_list'], cfg.presentation['sep_list_pair'], and cfg.presentation['sep_list_end']
if <sep_list_end> is specified, <sep_list> and <sep_list_pair> must also be supplied
]]
local function make_sep_list (count, list_seq, sep_list, sep_list_pair, sep_list_end)
local list = '';
if not sep_list then -- set the defaults
sep_list = cfg.presentation['sep_list'];
sep_list_pair = cfg.presentation['sep_list_pair'];
sep_list_end = cfg.presentation['sep_list_end'];
end
if 2 >= count then
list = table.concat (list_seq, sep_list_pair); -- insert separator between two items; returns list_seq[1] then only one item
elseif 2 < count then
list = table.concat (list_seq, sep_list, 1, count - 1); -- concatenate all but last item with plain list separator
list = table.concat ({list, list_seq[count]}, sep_list_end); -- concatenate last item onto end of <list> with final separator
end
return list;
end
--[[--------------------------< S E L E C T _ O N E >----------------------------------------------------------
Chooses one matching parameter from a list of parameters to consider. The list of parameters to consider is just
names. For parameters that may be enumerated, the position of the numerator in the parameter name is identified
by the '#' so |author-last1= and |author1-last= are represented as 'author-last#' and 'author#-last'.
Because enumerated parameter |<param>1= is an alias of |<param>= we must test for both possibilities.
Generates an error if more than one match is present.
]]
local function select_one (args, aliases_list, error_condition, index)
local value = nil; -- the value assigned to the selected parameter
local selected = ''; -- the name of the parameter we have chosen
local error_list = {};
if index ~= nil then index = tostring(index); end
for _, alias in ipairs (aliases_list) do -- for each alias in the aliases list
if alias:match ('#') then -- if this alias can be enumerated
if '1' == index then -- when index is 1 test for enumerated and non-enumerated aliases
value, selected = is_alias_used (args, alias, index, false, value, selected, error_list); -- first test for non-enumerated alias
end
value, selected = is_alias_used (args, alias, index, true, value, selected, error_list); -- test for enumerated alias
else
value, selected = is_alias_used (args, alias, index, false, value, selected, error_list); -- test for non-enumerated alias
end
end
if #error_list > 0 and 'none' ~= error_condition then -- for cases where this code is used outside of extract_names()
for i, v in ipairs (error_list) do
error_list[i] = wrap_style ('parameter', v);
end
table.insert (error_list, wrap_style ('parameter', selected));
set_message (error_condition, {make_sep_list (#error_list, error_list)});
end
return value, selected;
end
--[=[-------------------------< R E M O V E _ W I K I _ L I N K >----------------------------------------------
Gets the display text from a wikilink like [[A|B]] or [[B]] gives B
The str:gsub() returns either A|B froma [[A|B]] or B from [[B]] or B from B (no wikilink markup).
In l(), l:gsub() removes the link and pipe (if they exist); the second :gsub() trims whitespace from the label
if str was wrapped in wikilink markup. Presumably, this is because without wikimarkup in str, there is no match
in the initial gsub, the replacement function l() doesn't get called.
]=]
local function remove_wiki_link (str)
return (str:gsub ("%[%[([^%[%]]*)%]%]", function(l)
return l:gsub ("^[^|]*|(.*)$", "%1" ):gsub ("^%s*(.-)%s*$", "%1");
end));
end
--[=[-------------------------< I S _ W I K I L I N K >--------------------------------------------------------
Determines if str is a wikilink, extracts, and returns the wikilink type, link text, and display text parts.
If str is a complex wikilink ([[L|D]]):
returns wl_type 2 and D and L from [[L|D]];
if str is a simple wikilink ([[D]])
returns wl_type 1 and D from [[D]] and L as empty string;
if not a wikilink:
returns wl_type 0, str as D, and L as empty string.
trims leading and trailing whitespace and pipes from L and D ([[L|]] and [[|D]] are accepted by MediaWiki and
treated like [[D]]; while [[|D|]] is not accepted by MediaWiki, here, we accept it and return D without the pipes).
]=]
local function is_wikilink (str)
local D, L
local wl_type = 2; -- assume that str is a complex wikilink [[L|D]]
if not str:match ('^%[%[[^%]]+%]%]$') then -- is str some sort of a wikilink (must have some sort of content)
return 0, str, ''; -- not a wikilink; return wl_type as 0, str as D, and empty string as L
end
L, D = str:match ('^%[%[([^|]+)|([^%]]+)%]%]$'); -- get L and D from [[L|D]]
if not is_set (D) then -- if no separate display
D = str:match ('^%[%[([^%]]*)|*%]%]$'); -- get D from [[D]] or [[D|]]
wl_type = 1;
end
D = mw.text.trim (D, '%s|'); -- trim white space and pipe characters
return wl_type, D, L or '';
end
--[[--------------------------< S T R I P _ A P O S T R O P H E _ M A R K U P >--------------------------------
Strip wiki italic and bold markup from argument so that it doesn't contaminate COinS metadata.
This function strips common patterns of apostrophe markup. We presume that editors who have taken the time to
markup a title have, as a result, provided valid markup. When they don't, some single apostrophes are left behind.
Returns the argument without wiki markup and a number; the number is more-or-less meaningless except as a flag
to indicate that markup was replaced; do not rely on it as an indicator of how many of any kind of markup was
removed; returns the argument and nil when no markup removed
]]
local function strip_apostrophe_markup (argument)
if not is_set (argument) then
return argument, nil; -- no argument, nothing to do
end
if nil == argument:find ( "''", 1, true ) then -- Is there at least one double apostrophe? If not, exit.
return argument, nil;
end
local flag;
while true do
if argument:find ("'''''", 1, true) then -- bold italic (5)
argument, flag = argument:gsub ("%'%'%'%'%'", ""); -- remove all instances of it
elseif argument:find ("''''", 1, true) then -- italic start and end without content (4)
argument, flag=argument:gsub ("%'%'%'%'", "");
elseif argument:find ("'''", 1, true) then -- bold (3)
argument, flag=argument:gsub ("%'%'%'", "");
elseif argument:find ("''", 1, true) then -- italic (2)
argument, flag = argument:gsub ("%'%'", "");
else
break;
end
end
return argument, flag; -- done
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr)
cfg = cfg_table_ptr;
end
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return {
add_maint_cat = add_maint_cat, -- exported functions
add_prop_cat = add_prop_cat,
error_comment = error_comment,
has_accept_as_written = has_accept_as_written,
hyphen_to_dash = hyphen_to_dash,
in_array = in_array,
is_set = is_set,
is_wikilink = is_wikilink,
make_sep_list = make_sep_list,
make_wikilink = make_wikilink,
remove_wiki_link = remove_wiki_link,
safe_for_italics = safe_for_italics,
select_one = select_one,
set_message = set_message,
set_selected_modules = set_selected_modules,
strip_apostrophe_markup = strip_apostrophe_markup,
substitute = substitute,
wrap_style = wrap_style,
z = z, -- exported table
}
bvyfrlfh7kkrrt2v6jk2f3z13girav4
Módulo:Citation/CS1/Date validation
828
7645
74994
71646
2026-08-08T13:56:49Z
en>Trappist the monk
0
synch from sandbox;
74994
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local add_prop_cat, is_set, in_array, set_message, substitute, wrap_style; -- imported functions from selected Module:Citation/CS1/Utilities
local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration
--[[--------------------------< F I L E - S C O P E D E C L A R A T I O N S >--------------------------------
File-scope variables are declared here
]]
local lang_obj = mw.getContentLanguage(); -- used by is_valid_accessdate(), is_valid_year(), date_name_xlate();
local year_limit; -- used by is_valid_year()
--[=[-------------------------< I S _ V A L I D _ A C C E S S D A T E >----------------------------------------
returns true if:
Wikipedia start date <= accessdate < today + 2 days
Wikipedia start date is 2001-01-15T00:00:00 UTC which is 979516800 seconds after 1970-01-01T00:00:00 UTC (the start of Unix time)
accessdate is the date provided in |access-date= at time 00:00:00 UTC
today is the current date at time 00:00:00 UTC plus 48 hours
if today is 2015-01-01T00:00:00 then
adding 24 hours gives 2015-01-02T00:00:00 – one second more than today
adding 24 hours gives 2015-01-03T00:00:00 – one second more than tomorrow
This function does not work if it is fed month names for languages other than English. Wikimedia #time: parser
apparently doesn't understand non-English date month names. This function will always return false when the date
contains a non-English month name because good1 is false after the call to lang.formatDate(). To get around that
call this function with YYYY-MM-DD format dates.
]=]
local function is_valid_accessdate (accessdate)
local good1, good2;
local access_ts, tomorrow_ts; -- to hold Unix time stamps representing the dates
good1, access_ts = pcall (lang_obj.formatDate, lang_obj, 'U', accessdate ); -- convert accessdate value to Unix timestamp
good2, tomorrow_ts = pcall (lang_obj.formatDate, lang_obj, 'U', 'today + 2 days' ); -- today midnight + 2 days is one second more than all day tomorrow
if good1 and good2 then -- lang.formatDate() returns a timestamp in the local script which which tonumber() may not understand
access_ts = tonumber (access_ts) or lang_obj:parseFormattedNumber (access_ts); -- convert to numbers for the comparison;
tomorrow_ts = tonumber (tomorrow_ts) or lang_obj:parseFormattedNumber (tomorrow_ts);
else
return false; -- one or both failed to convert to Unix time stamp
end
if 979516800 <= access_ts and access_ts < tomorrow_ts then -- Wikipedia start date <= accessdate < tomorrow's date
return true;
else
return false; -- accessdate out of range
end
end
--[[--------------------------< G E T _ M O N T H _ N U M B E R >----------------------------------------------
returns a number according to the month in a date: 1 for January, etc. Capitalization and spelling must be correct.
If not a valid month, returns 0
]]
local function get_month_number (month)
return cfg.date_names['local'].long[month] or cfg.date_names['local'].short[month] or -- look for local names first
cfg.date_names['en'].long[month] or cfg.date_names['en'].short[month] or -- failing that, look for English names
0; -- not a recognized month name
end
--[[--------------------------< G E T _ S E A S O N _ N U M B E R >--------------------------------------------
returns a number according to the sequence of seasons in a year: 21 for Spring, etc. Capitalization and spelling
must be correct. If not a valid season, returns 0.
21-24 = Spring, Summer, Autumn, Winter, independent of “Hemisphere”
returns 0 when <param> is not |date=
Season numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard defines various divisions using
numbers 21-41. cs1|2 only supports generic seasons. EDTF does support the distinction between north and south
hemisphere seasons but cs1|2 has no way to make that distinction.
These additional divisions not currently supported:
25-28 = Spring - Northern Hemisphere, Summer- Northern Hemisphere, Autumn - Northern Hemisphere, Winter - Northern Hemisphere
29-32 = Spring – Southern Hemisphere, Summer– Southern Hemisphere, Autumn – Southern Hemisphere, Winter - Southern Hemisphere
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)
40-41 = Semestral 1, Semestral-2 (6 months each)
]]
local function get_season_number (season, param)
if 'date' ~= param then
return 0; -- season dates only supported by |date=
end
return cfg.date_names['local'].season[season] or -- look for local names first
cfg.date_names['en'].season[season] or -- failing that, look for English names
0; -- not a recognized season name
end
--[[--------------------------< G E T _ Q U A R T E R _ N U M B E R >------------------------------------------
returns a number according to the sequence of quarters in a year: 33 for first quarter, etc. Capitalization and spelling
must be correct. If not a valid quarter, returns 0.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
returns 0 when <param> is not |date=
Quarter numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard defines various divisions using
numbers 21-41. cs1|2 only supports generic seasons and quarters.
These additional divisions not currently supported:
37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)
40-41 = Semestral 1, Semestral-2 (6 months each)
]]
local function get_quarter_number (quarter, param)
if 'date' ~= param then
return 0; -- quarter dates only supported by |date=
end
quarter = mw.ustring.gsub (quarter, ' +', ' '); -- special case replace multiple space chars with a single space char
return cfg.date_names['local'].quarter[quarter] or -- look for local names first
cfg.date_names['en'].quarter[quarter] or -- failing that, look for English names
0; -- not a recognized quarter name
end
--[[--------------------------< G E T _ P R O P E R _ N A M E _ N U M B E R >----------------------------------
returns a non-zero number if date contains a recognized proper-name. Capitalization and spelling must be correct.
returns 0 when <param> is not |date=
]]
local function get_proper_name_number (name, param)
if 'date' ~= param then
return 0; -- proper-name dates only supported by |date=
end
return cfg.date_names['local'].named[name] or -- look for local names dates first
cfg.date_names['en'].named[name] or -- failing that, look for English names
0; -- not a recognized named date
end
--[[--------------------------< G E T _ E L E M E N T _ N U M B E R <------------------------------------------
returns true if month or season or quarter or proper name is valid (properly spelled, capitalized, abbreviated)
]]
local function get_element_number (element, param)
local num;
local funcs = {get_month_number, get_season_number, get_quarter_number, get_proper_name_number}; -- list of functions to execute in order
for _, func in ipairs (funcs) do -- spin through the function list
num = func (element, param); -- call the function and get the returned number
if 0 ~= num then -- non-zero when valid month season quarter
return num; -- return that number
end
end
return nil; -- not valid
end
--[[--------------------------< I S _ V A L I D _ Y E A R >----------------------------------------------------
Function gets current year from the server and compares it to year from a citation parameter. Years more than one
year in the future are not acceptable.
Special case for |pmc-embargo-date=: years more than two years in the future are not acceptable
]]
local function is_valid_year (year, param)
if not is_set (year_limit) then
year_limit = tonumber(os.date("%Y"))+1; -- global variable so we only have to fetch it once
end
year = tonumber (year) or lang_obj:parseFormattedNumber (year); -- convert to number for the comparison
if year and (100 > year) then -- years less than 100 not supported
return false;
end
if 'pmc-embargo-date' == param then -- special case for |pmc-embargo-date=
return year and (year <= tonumber(os.date("%Y"))+2) or false; -- years more than two years in the future are not accepted
end
return year and (year <= year_limit) or false;
end
--[[--------------------------< I S _ V A L I D _ D A T E >----------------------------------------------------
Returns true if day is less than or equal to the number of days in month and year is no farther into the future
than next year; else returns false.
Assumes Julian calendar prior to year 1582 and Gregorian calendar thereafter. Accounts for Julian calendar leap
years before 1582 and Gregorian leap years after 1582. Where the two calendars overlap (1582 to approximately
1923) dates are assumed to be Gregorian.
]]
local function is_valid_date (year, month, day, param)
local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
local month_length;
if not is_valid_year (year, param) then -- no farther into the future than next year except |pmc-embargo-date= no more than two years in the future
return false;
end
month = tonumber (month); -- required for YYYY-MM-DD dates
if (2 == month) then -- if February
month_length = 28; -- then 28 days unless
if 1582 > tonumber(year) then -- Julian calendar
if 0 == (year%4) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
else -- Gregorian calendar
if (0 == (year%4) and (0 ~= (year%100) or 0 == (year%400))) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
end
else
month_length = days_in_month[month] or 0; -- invalid month number is nil so default <month_length> to 0
end
if tonumber (day) > month_length then
return false;
end
return true;
end
--[[--------------------------< I S _ V A L I D _ M O N T H _ R A N G E _ S T Y L E >--------------------------
Months in a range are expected to have the same style: Jan–Mar or October–December but not February–Mar or Jul–August.
This function looks in cfg.date_names{} to see if both month names are listed in the long subtable or both are
listed in the short subtable. When both have the same style (both are listed in the same table), returns true; false else
]]
local function is_valid_month_range_style (month1, month2)
if (cfg.date_names.en.long[month1] and cfg.date_names.en.long[month2]) or -- are both English names listed in the long subtable?
(cfg.date_names.en.short[month1] and cfg.date_names.en.short[month2]) or -- are both English names listed in the short subtable?
(cfg.date_names['local'].long[month1] and cfg.date_names['local'].long[month2]) or -- are both local names listed in the long subtable?
(cfg.date_names['local'].short[month1] and cfg.date_names['local'].short[month2]) then -- are both local names listed in the short subtable?
return true;
end
return false; -- names are mixed
end
--[[--------------------------< I S _ V A L I D _ M O N T H _ S E A S O N _ R A N G E >------------------------
Check a pair of months or seasons to see if both are valid members of a month or season pair.
Month pairs are expected to be left to right, earliest to latest in time.
All season ranges are accepted as valid because there are publishers out there who have published a Summer–Spring YYYY issue, hence treat as ok
]]
local function is_valid_month_season_range(range_start, range_end, param)
local range_start_number = get_month_number (range_start);
local range_end_number;
if 0 == range_start_number then -- is this a month range?
range_start_number = get_season_number (range_start, param); -- not a month; is it a season? get start season number
range_end_number = get_season_number (range_end, param); -- get end season number
if (0 ~= range_start_number) and (0 ~= range_end_number) and (range_start_number ~= range_end_number) then
return true; -- any season pairing is accepted except when both are the same
end
return false; -- range_start and/or range_end is not a season
end
-- here when range_start is a month
range_end_number = get_month_number (range_end); -- get end month number
if range_start_number < range_end_number and -- range_start is a month; does range_start precede range_end?
is_valid_month_range_style (range_start, range_end) then -- do months have the same style?
return true; -- proper order and same style
end
return false; -- range_start month number is greater than or equal to range end number; or range end isn't a month
end
--[[--------------------------< M A K E _ C O I N S _ D A T E >------------------------------------------------
This function receives a table of date parts for one or two dates and an empty table reference declared in
Module:Citation/CS1. The function is called only for |date= parameters and only if the |date=<value> is
determined to be a valid date format. The question of what to do with invalid date formats is not answered here.
The date parts in the input table are converted to an ISO 8601 conforming date string:
single whole dates: yyyy-mm-dd
month and year dates: yyyy-mm
year dates: yyyy
ranges: yyyy-mm-dd/yyyy-mm-dd
yyyy-mm/yyyy-mm
yyyy/yyyy
Dates in the Julian calendar are reduced to year or year/year so that we don't have to do calendar conversion from
Julian to Proleptic Gregorian.
The input table has:
year, year2 – always present; if before 1582, ignore months and days if present
month, month2 – 0 if not provided, 1-12 for months, 21-24 for seasons; 99 Christmas
day, day2 – 0 if not provided, 1-31 for days
the output table receives:
rftdate: an ISO 8601 formatted date
rftchron: a free-form version of the date, usually without year which is in rftdate (season ranges and proper-name dates)
rftssn: one of four season keywords: winter, spring, summer, fall (lowercase)
rftquarter: one of four values: 1, 2, 3, 4
]]
local function make_COinS_date (input, COinS_date_t)
local date; -- one date or first date in a range
local date2 = ''; -- end of range date
input.year = tonumber (input.year) or lang_obj:parseFormattedNumber (input.year); -- language-aware tonumber()
input.year2 = tonumber (input.year2) or lang_obj:parseFormattedNumber (input.year2); -- COinS dates are pseudo-ISO 8601 so convert to Arabic numerals
if ((1582 == input.year) and (10 > tonumber(input.month))) or (1582 > input.year) then -- if a Julian calendar date
COinS_date_t.rftdate = tostring (input.year); -- &rft.date gets year only
return; -- done
end
-- here for all forms of Gregorian dates
if 20 < tonumber (input.month) then -- if season, quarter, or proper-name date
date = input.year; -- &rft.date gets year only
if 0 ~= input.year2 and input.year ~= input.year2 then -- if a range, only the second year portion when not the same as range start year
date = string.format ('%.4d/%.4d', input.year, input.year2) -- assemble the date range
end
local season = {[24] = 'winter', [21] = 'spring', [22] = 'summer', [23] = 'fall', [33] = '1', [34] = '2', [35] = '3', [36] = '4', [98] = 'Easter', [99] = 'Christmas'}; -- seasons lowercase, no autumn; proper-names use title case
if 0 == input.month2 then -- single season, quarter, or proper-name date
if 40 < tonumber(input.month) then
COinS_date_t.rftchron = season[input.month]; -- proper-name date; used in journal metadata only
elseif 30 < tonumber(input.month) then
COinS_date_t.rftquarter = season[input.month]; -- quarter date; used in journal metadata only
else
COinS_date_t.rftssn = season[input.month]; -- season date; used in journal metadata only
end
else -- season ranges are lumped into &rft.chron; &rft.ssn and &rft.quarter are left blank
if input.year ~= input.year2 then -- season year – season year range or season year–year
if 0 ~= input.month2 then
COinS_date_t.rftchron = string.format ('%s %s – %s %s', season[input.month], input.year, season[input.month2], input.year2); -- used in journal metadata only
end
else -- season–season year range
COinS_date_t.rftchron = season[input.month] .. '–' .. season[input.month2]; -- season–season year range; used in journal metadata only
end
end
COinS_date_t.rftdate = tostring (date);
return; -- done
end
-- here for gregorian calendar dates
if 0 ~= input.day then
date = string.format ('%s-%.2d-%.2d', input.year, tonumber(input.month), tonumber(input.day)); -- whole date
elseif 0 ~= input.month then
date = string.format ('%s-%.2d', input.year, tonumber(input.month)); -- year and month
else
date = string.format ('%s', input.year); -- just year
end
if 0 ~= input.year2 then
if 0 ~= input.day2 then
date2 = string.format ('/%s-%.2d-%.2d', input.year2, tonumber(input.month2), tonumber(input.day2)); -- whole date
elseif 0 ~= input.month2 then
date2 = string.format ('/%s-%.2d', input.year2, tonumber(input.month2)); -- year and month
else
date2 = string.format ('/%s', input.year2); -- just year
end
end
COinS_date_t.rftdate = date .. date2; -- date2 has the '/' separator
return;
end
--[[--------------------------< P A T T E R N S _ T >----------------------------------------------------------
this is the list of patterns for date formats that this module recognizes. Approximately the first half of these
patterns represent formats that might be reformatted into another format. Those that might be reformatted have
'indicator' letters that identify the content of the matching capture: 'd' (day), 'm' (month), 'a' (anchor year),
'y' (year); second day, month, year have a '2' suffix.
These patterns are used for both date validation and for reformatting. This table should not be moved to ~/Configuration
because changes to this table require changes to check_date() and to reformatter() and reformat_date()
]]
local patterns_t = {
-- year-initial numerical year-month-day
['ymd'] = {'^([1-9]%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'},
-- month-initial: month day, year
['Mdy'] = {'^(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%l?)$', 'm', 'd', 'a', 'y'},
-- month-initial day range: month day–day, year; days are separated by endash
['Md-dy'] = {'^(%D-) +([1-9]%d?)[%-–]([1-9]%d?), +(([1-9]%d%d%d?)%l?)$', 'm', 'd', 'd2', 'a', 'y'},
-- day-initial: day month year
['dMy'] = {'^([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%l?)$', 'd', 'm', 'a', 'y'},
-- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed; not supported at en.wiki
-- ['yMd'] = {'^(([1-9]%d%d%d?)%l?) +(%D-) +(%d%d?)$', 'a', 'y', 'm', 'd'},
-- day-range-initial: day–day month year; days are separated by endash
['d-dMy'] = {'^([1-9]%d?)[%-–]([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%l?)$', 'd', 'd2', 'm', 'a', 'y'},
-- day initial month-day-range: day month - day month year; uses spaced endash
['dM-dMy'] = {'^([1-9]%d?) +(%D-) +[%-–] +([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%l?)$', 'd', 'm', 'd2', 'm2', 'a', 'y'},
-- month initial month-day-range: month day – month day, year; uses spaced endash
['Md-Mdy'] = {'^(%D-) +([1-9]%d?) +[%-–] +(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%l?)$','m', 'd', 'm2', 'd2', 'a', 'y'},
-- day initial month-day-year-range: day month year - day month year; uses spaced endash
['dMy-dMy'] = {'^([1-9]%d?) +(%D-) +([1-9]%d%d%d?) +[%-–] +([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%l?)$', 'd', 'm', 'y', 'd2', 'm2', 'a', 'y2'},
-- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
['Mdy-Mdy'] = {'^(%D-) +([1-9]%d?), +([1-9]%d%d%d?) +[%-–] +(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%l?)$', 'm', 'd', 'y', 'm2', 'd2', 'a', 'y2'},
-- these date formats cannot be converted, per se, but month name can be rendered short or long
-- month/season year - month/season year; separated by spaced endash
['My-My'] = {'^(%D-) +([1-9]%d%d%d?) +[%-–] +(%D-) +(([1-9]%d%d%d?)%l?)$', 'm', 'y', 'm2', 'a', 'y2'},
-- month/season range year; months separated by endash
['M-My'] = {'^(%D-)[%-–](%D-) +(([1-9]%d%d%d?)%l?)$', 'm', 'm2', 'a', 'y'},
-- month/season year or proper-name year; quarter year when First Quarter YYYY etc.
['My'] = {'^([^%d–]-) +(([1-9]%d%d%d?)%l?)$', 'm', 'a', 'y'}, -- this way because endash is a member of %D; %D- will match January–March 2019 when it shouldn't
-- these date formats cannot be converted
['Sy4-y2'] = {'^(%D-) +(([1-9]%d)%d%d)[%-–]((%d%d)%l?)$'}, -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
['Sy-y'] = {'^(%D-) +([1-9]%d%d%d?)[%-–](([1-9]%d%d%d?)%l?)$'}, -- special case Winter/Summer year-year; year separated with unspaced endash
['y-y'] = {'^([1-9]%d%d%d?)[%-–](([1-9]%d%d%d?)%l?)$'}, -- year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
['y4-y2'] = {'^(([1-9]%d)%d%d)[%-–]((%d%d)%l?)$'}, -- year range: YYYY–YY; separated by unspaced endash
['y'] = {'^(([1-9]%d%d%d?)%l?)$'}, -- year; here accept either YYY or YYYY
-- these date formats cannot be converted
['n.d.'] = {'^((n%.d%.)%l?)$'}, -- no date with dots
['nd'] = {'^((nd)%l?)$'}, -- no date
}
--[[--------------------------< I S _ V A L I D _ E M B A R G O _ D A T E >------------------------------------
returns true and date value if that value has proper dmy, mdy, ymd format.
returns false and 9999 (embargoed forever) when date value is not proper format; assumes that when |pmc-embargo-date= is
set, the editor intended to embargo a PMC but |pmc-embargo-date= does not hold a single date.
]]
local function is_valid_embargo_date (v)
if v:match (patterns_t['ymd'][1]) or -- ymd
v:match (patterns_t['Mdy'][1]) or -- dmy
v:match (patterns_t['dMy'][1]) then -- mdy
return true, v;
end
return false, '9999'; -- if here not good date so return false and set embargo date to long time in future
end
--[[--------------------------< C H E C K _ D A T E >----------------------------------------------------------
Check date format to see that it is one of the formats approved by WP:DATESNO or WP:DATERANGE. Exception: only
allowed range separator is endash. Additionally, check the date to see that it is a real date: no 31 in 30-day
months; no 29 February when not a leap year. Months, both long-form and three character abbreviations, and seasons
must be spelled correctly. Future years beyond next year are not allowed.
If the date fails the format tests, this function returns false and does not return values for anchor_year and
COinS_date. When this happens, the date parameter is (DEBUG: not?) used in the COinS metadata and the CITEREF identifier gets
its year from the year parameter if present otherwise CITEREF does not get a date value.
Inputs:
date_string - date string from date-holding parameters (date, year, publication-date, access-date, pmc-embargo-date, archive-date, lay-date)
Returns:
false if date string is not a real date; else
true, anchor_year, COinS_date
anchor_year can be used in CITEREF anchors
COinS_date is ISO 8601 format date; see make_COInS_date()
]]
local function check_date (date_string, param, COinS_date_t)
local year; -- assume that year2, months, and days are not used;
local year2 = 0; -- second year in a year range
local month = 0;
local month2 = 0; -- second month in a month range
local day = 0;
local day2 = 0; -- second day in a day range
local anchor_year;
-- local coins_date;
if date_string:match (patterns_t['ymd'][1]) then -- year-initial numerical year month day format
year, month, day = date_string:match (patterns_t['ymd'][1]);
if 12 < tonumber(month) or 1 > tonumber(month) or 1582 > tonumber(year) or 0 == tonumber(day) then return false; end -- month or day number not valid or not Gregorian calendar
anchor_year = year;
elseif mw.ustring.match(date_string, patterns_t['Mdy'][1]) then -- month-initial: month day, year
month, day, anchor_year, year = mw.ustring.match(date_string, patterns_t['Mdy'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
elseif mw.ustring.match(date_string, patterns_t['Md-dy'][1]) then -- month-initial day range: month day–day, year; days are separated by endash
month, day, day2, anchor_year, year = mw.ustring.match(date_string, patterns_t['Md-dy'][1]);
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
month2=month; -- for metadata
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['dMy'][1]) then -- day-initial: day month year
day, month, anchor_year, year = mw.ustring.match(date_string, patterns_t['dMy'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
--[[ NOT supported at en.wiki
elseif mw.ustring.match(date_string, patterns_t['yMd'][1]) then -- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed
anchor_year, year, month, day = mw.ustring.match(date_string, patterns_t['yMd'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
-- end NOT supported at en.wiki ]]
elseif mw.ustring.match(date_string, patterns_t['d-dMy'][1]) then -- day-range-initial: day–day month year; days are separated by endash
day, day2, month, anchor_year, year = mw.ustring.match(date_string, patterns_t['d-dMy'][1]);
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
month2 = month; -- for metadata
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['dM-dMy'][1]) then -- day initial month-day-range: day month - day month year; uses spaced endash
day, month, day2, month2, anchor_year, year = mw.ustring.match(date_string, patterns_t['dM-dMy'][1]);
if (not is_valid_month_season_range(month, month2)) or not is_valid_year(year) then return false; end -- date range order is left to right: earlier to later;
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['Md-Mdy'][1]) then -- month initial month-day-range: month day – month day, year; uses spaced endash
month, day, month2, day2, anchor_year, year = mw.ustring.match(date_string, patterns_t['Md-Mdy'][1]);
if (not is_valid_month_season_range(month, month2, param)) or not is_valid_year(year) then return false; end
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['dMy-dMy'][1]) then -- day initial month-day-year-range: day month year - day month year; uses spaced endash
day, month, year, day2, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['dMy-dMy'][1]);
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
if 0 == month or 0 == month2 then return false; end -- both must be valid
elseif mw.ustring.match(date_string, patterns_t['Mdy-Mdy'][1]) then -- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
month, day, year, month2, day2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['Mdy-Mdy'][1]);
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month = get_month_number (month); -- for metadata
month2 = get_month_number(month2);
if 0 == month or 0 == month2 then return false; end -- both must be valid
elseif mw.ustring.match(date_string, patterns_t['Sy4-y2'][1]) then -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
local century;
month, year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['Sy4-y2'][1]);
if 'Winter' ~= month and 'Summer' ~= month then return false end; -- 'month' can only be Winter or Summer
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
year2 = century..year2; -- add the century to year2 for comparisons
if 1 ~= tonumber(year2) - tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
month = get_season_number(month, param);
elseif mw.ustring.match(date_string, patterns_t['Sy-y'][1]) then -- special case Winter/Summer year-year; year separated with unspaced endash
month, year, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['Sy-y'][1]);
month = get_season_number (month, param); -- <month> can only be winter or summer; also for metadata
if (month ~= cfg.date_names['en'].season['Winter']) and (month ~= cfg.date_names['en'].season['Summer']) then
return false; -- not Summer or Winter; abandon
end
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
if 1 ~= tonumber(year2) - tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
elseif mw.ustring.match(date_string, patterns_t['My-My'][1]) then -- month/season year - month/season year; separated by spaced endash
month, year, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['My-My'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if 0 ~= get_month_number(month) and 0 ~= get_month_number(month2) and is_valid_month_range_style(month, month2) then -- both must be month year, same month style
month = get_month_number(month);
month2 = get_month_number(month2);
elseif 0 ~= get_season_number(month, param) and 0 ~= get_season_number(month2, param) then -- both must be season year, not mixed
month = get_season_number(month, param);
month2 = get_season_number(month2, param);
else
return false;
end
elseif mw.ustring.match(date_string, patterns_t['M-My'][1]) then -- month/season range year; months separated by endash
month, month2, anchor_year, year = mw.ustring.match(date_string, patterns_t['M-My'][1]);
if (not is_valid_month_season_range(month, month2, param)) or (not is_valid_year(year)) then return false; end
if 0 ~= get_month_number(month) then -- determined to be a valid range so just check this one to know if month or season
month = get_month_number(month);
month2 = get_month_number(month2);
if 0 == month or 0 == month2 then return false; end
else
month = get_season_number(month, param);
month2 = get_season_number(month2, param);
end
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['My'][1]) then -- month/season/quarter/proper-name year
month, anchor_year, year = mw.ustring.match(date_string, patterns_t['My'][1]);
if not is_valid_year(year) then return false; end
month = get_element_number(month, param); -- get month season quarter proper-name number or nil
if not month then return false; end -- not valid whatever it is
elseif mw.ustring.match(date_string, patterns_t['y-y'][1]) then -- Year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
year, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['y-y'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
elseif mw.ustring.match(date_string, patterns_t['y4-y2'][1]) then -- Year range: YYYY–YY; separated by unspaced endash
local century;
year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['y4-y2'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if 13 > tonumber(year2) then return false; end -- don't allow 2003-05 which might be May 2003
year2 = century .. year2; -- add the century to year2 for comparisons
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if in_array (param, {'date', 'publication-date', 'year'}) then -- here when 'valid' abbreviated year range; if one of these parameters
add_prop_cat ('year-range-abbreviated'); -- add properties cat
end
elseif mw.ustring.match(date_string, patterns_t['y'][1]) then -- year; here accept either YYY or YYYY
anchor_year, year = mw.ustring.match(date_string, patterns_t['y'][1]);
if false == is_valid_year(year) then
return false;
end
else
return false; -- date format not one of the MOS:DATE approved formats
end
if param ~= 'date' then -- CITEREF disambiguation only allowed in |date=; |year= & |publication-date= promote to date
if anchor_year:match ('%l$') then
return false;
end
end
if 'access-date' == param then -- test access-date here because we have numerical date parts
if 0 ~= year and 0 ~= month and 0 ~= day and -- all parts of a single date required
0 == year2 and 0 == month2 and 0 == day2 then -- none of these; access-date must not be a range
if not is_valid_accessdate(year .. '-' .. month .. '-' .. day) then
return false; -- return false when access-date out of bounds
end
else
return false; -- return false when access-date is a range of two dates
end
end
if 'archive-date' == param then -- test archive-date here because we have numerical date parts
if not (0 ~= year and 0 ~= month and 0 ~= day and -- all parts of a single date required
0 == year2 and 0 == month2 and 0 == day2) then -- none of these; archive-date must not be a range
return false; -- return false when archive-date is a range of two dates
end
end
local result=true; -- check whole dates for validity; assume true because not all dates will go through this test
if 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 == day2 then -- YMD (simple whole date)
result = is_valid_date (year, month, day, param); -- <param> for |pmc-embargo-date=
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 ~= day2 then -- YMD-d (day range)
result = is_valid_date (year, month, day);
result = result and is_valid_date (year, month, day2);
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 ~= month2 and 0 ~= day2 then -- YMD-md (day month range)
result = is_valid_date (year, month, day);
result = result and is_valid_date (year, month2, day2);
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 ~= year2 and 0 ~= month2 and 0 ~= day2 then -- YMD-ymd (day month year range)
result = is_valid_date(year, month, day);
result = result and is_valid_date(year2, month2, day2);
end
if false == result then return false; end
if nil ~= COinS_date_t then -- this table only passed into this function when testing |date= parameter values
make_COinS_date ({year = year, month = month, day = day, year2 = year2, month2 = month2, day2 = day2}, COinS_date_t); -- make an ISO 8601 date string for COinS
end
return true, anchor_year; -- format is good and date string represents a real date
end
--[[--------------------------< D A T E S >--------------------------------------------------------------------
Cycle the date-holding parameters in passed table date_parameters_list through check_date() to check compliance with MOS:DATE. For all valid dates, check_date() returns
true. The |date= parameter test is unique, it is the only date holding parameter from which values for anchor_year (used in CITEREF identifiers) and COinS_date (used in
the COinS metadata) are derived. The |date= parameter is the only date-holding parameter that is allowed to contain the no-date keywords "n.d." or "nd" (without quotes).
Unlike most error messages created in this module, only one error message is created by this function. Because all of the date holding parameters are processed serially,
parameters with errors are added to the <error_list> sequence table as the dates are tested.
]]
local function dates(date_parameters_list, COinS_date_t, error_list)
local anchor_year; -- will return as nil if the date being tested is not |date=
local embargo_date; -- if embargo date is a good dmy, mdy, ymd date then holds original value else reset to 9999
local good_date;
for k, v in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(v.val) then -- if the parameter has a value
v.val = mw.ustring.gsub(v.val, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9
if v.val:match("^c%. [1-9]%d%d%d?%l?$") then -- special case for c. year or with or without CITEREF disambiguator - only |date= and |year=
local year = v.val:match("c%. ([1-9]%d%d%d?)%l?"); -- get the year portion so it can be tested
if 'date' == k then
anchor_year = v.val:match ('(c%. [1-9]%d%d%d?%l?)'); -- anchor year only from |date= parameter
good_date = is_valid_year(year);
elseif 'year' == k then
good_date = is_valid_year(year);
else
good_date = false;
end
elseif 'date' == k then -- if the parameter is |date=
if v.val:match (patterns_t['n.d.'][1]) then -- if |date=n.d. with or without a CITEREF disambiguator
good_date, anchor_year = true, v.val:match (patterns_t['n.d.'][1]); -- "n.d."; no error when date parameter is set to no date
elseif v.val:match (patterns_t.nd[1]) then -- if |date=nd with or without a CITEREF disambiguator
good_date, anchor_year = true, v.val:match (patterns_t.nd[1]); -- "nd"; no error when date parameter is set to no date
else
good_date, anchor_year = check_date (v.val, k, COinS_date_t); -- go test the date
end
elseif 'year' == k then -- if the parameter is |year= it should hold only a year value
if v.val:match("^[1-9]%d%d%d?%l?$") then -- if |year = 3 or 4 digits only with or without a CITEREF disambiguator
good_date, anchor_year = true, v.val:match ("((%d+)%l?)");
else
good_date = false;
end
elseif 'pmc-embargo-date' == k then -- if the parameter is |pmc-embargo-date=
good_date = check_date (v.val, k); -- go test the date
if true == good_date then -- if the date is a valid date
good_date, embargo_date = is_valid_embargo_date (v.val); -- is |pmc-embargo-date= date a single dmy, mdy, or ymd formatted date? yes: returns embargo date; no: returns 9999
end
else -- any other date-holding parameter
good_date = check_date (v.val, k); -- go test the date
end
if false == good_date then -- assemble one error message so we don't add the tracking category multiple times
table.insert (error_list, wrap_style ('parameter', v.name)); -- make parameter name suitable for error message list
end
end
end
return anchor_year, embargo_date; -- and done
end
--[[--------------------------< Y E A R _ C H E C K >----------------------------------------------------------
Temporary function to test |year= for acceptable values:
YYY, YYYY, year-only ranges, their circa forms, with or without CITEREF disambiguators.
When |year= holds some form of date that is not one of these year-only dates, emit a maintenance message.
This function necessary because many non-cs1|2 templates have a |year= parameter so cirrus searches are more-or-
less useless
]]
local function year_check (year)
year = year:gsub ('c%. *', ''); -- remove circa annotation (if present) before testing <year>
for _, index in ipairs ({'y-y', 'y4-y2', 'y'}) do -- spin through these indexes into patterns_t
if mw.ustring.match (year, patterns_t[index][1]) then
return; -- if a match then |year= holds a valid 'year'
end
end
set_message ('maint_year'); -- if here, |year= value is not an accepted value; add a maint cat
end
--[[--------------------------< Y E A R _ D A T E _ C H E C K >------------------------------------------------
Compare the value provided in |year= with the year value(s) provided in |date=. This function sets a local numeric value:
0 - year value does not match the year value in date
1 - (default) year value matches the year value in date or one of the year values when date contains two years
2 - year value matches the year value in date when date is in the form YYYY-MM-DD and year is disambiguated (|year=YYYYx)
the numeric value in <result> determines the 'output' if any from this function:
0 – adds error message to error_list sequence table
1 – adds maint cat
2 – does nothing
]]
local function year_date_check (year_string, year_origin, date_string, date_origin, error_list)
local year;
local date1;
local date2;
local result = 1; -- result of the test; assume that the test passes
year = year_string:match ('(%d%d%d%d?)');
if date_string:match ('%d%d%d%d%-%d%d%-%d%d') then --special case where both date and year are required YYYY-MM-DD and YYYYx
date1 = date_string:match ('(%d%d%d%d)');
year = year_string:match ('(%d%d%d%d)');
if year ~= date1 then
result = 0; -- years don't match
elseif year_string:match ('%d%d%d%d%a') then
result = 2; -- years match; but because disambiguated, don't add to maint cat
end
elseif date_string:match ("%d%d%d%d?.-%d%d%d%d?") then -- any of the standard range formats of date with two three- or four-digit years
date1, date2 = date_string:match ("(%d%d%d%d?).-(%d%d%d%d?)");
if year ~= date1 and year ~= date2 then
result = 0;
end
elseif mw.ustring.match(date_string, "%d%d%d%d[%-–]%d%d") then -- YYYY-YY date ranges
local century;
date1, century, date2 = mw.ustring.match(date_string, "((%d%d)%d%d)[%-–]+(%d%d)");
date2 = century..date2; -- convert YY to YYYY
if year ~= date1 and year ~= date2 then
result = 0;
end
elseif date_string:match ("%d%d%d%d?") then -- any of the standard formats of date with one year
date1 = date_string:match ("(%d%d%d%d?)");
if year ~= date1 then
result = 0;
end
else -- should never get here; this function called only when no other date errors
result = 0; -- no recognizable year in date
end
if 0 == result then -- year / date mismatch
table.insert (error_list, substitute (cfg.messages['mismatch'], {year_origin, date_origin})); -- add error message to error_list sequence table
elseif 1 == result then -- redundant year / date
set_message ('maint_date_year'); -- add a maint cat
end
end
--[[--------------------------< R E F O R M A T T E R >--------------------------------------------------------
reformat 'date' into new format specified by format_param if pattern_idx (the current format of 'date') can be
reformatted. Does the grunt work for reformat_dates().
The table re_formats maps pattern_idx (current format) and format_param (desired format) to a table that holds:
format string used by string.format()
identifier letters ('d', 'm', 'y', 'd2', 'm2', 'y2') that serve as indexes into a table t{} that holds captures
from mw.ustring.match() for the various date parts specified by patterns_t[pattern_idx][1]
Items in patterns_t{} have the general form:
['ymd'] = {'^(%d%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'}, where:
['ymd'] is pattern_idx
patterns_t['ymd'][1] is the match pattern with captures for mw.ustring.match()
patterns_t['ymd'][2] is an indicator letter identifying the content of the first capture
patterns_t['ymd'][3] ... the second capture etc.
when a pattern matches a date, the captures are loaded into table t{} in capture order using the idemtifier
characters as indexes into t{} For the above, a ymd date is in t{} as:
t.y = first capture (year), t.m = second capture (month), t.d = third capture (day)
To reformat, this function is called with the pattern_idx that matches the current format of the date and with
format_param set to the desired format. This function loads table t{} as described and then calls string.format()
with the format string specified by re_format[pattern_idx][format_param][1] using values taken from t{} according
to the capture identifier letters specified by patterns_t[pattern_idx][format_param][n] where n is 2..
]]
local re_formats = {
['ymd'] = { -- date format is ymd; reformat to:
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['Mdy'] = { -- date format is Mdy; reformat to:
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- for long/short reformatting
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['dMy'] = { -- date format is dMy; reformat to:
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['Md-dy'] = { -- date format is Md-dy; reformat to:
['mdy'] = {'%s %s–%s, %s', 'm', 'd', 'd2', 'y'}, -- for long/short reformatting
['dmy'] = {'%s–%s %s %s', 'd', 'd2', 'm', 'y'}, -- |df=dmy -> d-dMy
},
['d-dMy'] = { -- date format is d-d>y; reformat to:
['dmy'] = {'%s–%s %s %s', 'd', 'd2', 'm', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s–%s, %s', 'm', 'd', 'd2', 'y'}, -- |df=mdy -> Md-dy
},
['dM-dMy'] = { -- date format is dM-dMy; reformat to:
['dmy'] = {'%s %s – %s %s %s', 'd', 'm', 'd2', 'm2', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s – %s %s, %s', 'm', 'd', 'm2', 'd2', 'y'}, -- |df=mdy -> Md-Mdy
},
['Md-Mdy'] = { -- date format is Md-Mdy; reformat to:
['mdy'] = {'%s %s – %s %s, %s', 'm', 'd', 'm2', 'd2', 'y'}, -- for long/short reformatting
['dmy'] = {'%s %s – %s %s %s', 'd', 'm', 'd2', 'm2', 'y'}, -- |df=dmy -> dM-dMy
},
['dMy-dMy'] = { -- date format is dMy-dMy; reformat to:
['dmy'] = {'%s %s %s – %s %s %s', 'd', 'm', 'y', 'd2', 'm2', 'y2'}, -- for long/short reformatting
['mdy'] = {'%s %s, %s – %s %s, %s', 'm', 'd', 'y', 'm2', 'd2', 'y2'}, -- |df=mdy -> Mdy-Mdy
},
['Mdy-Mdy'] = { -- date format is Mdy-Mdy; reformat to:
['mdy'] = {'%s %s, %s – %s %s, %s', 'm', 'd', 'y', 'm2', 'd2', 'y2'}, -- for long/short reformatting
['dmy'] = {'%s %s %s – %s %s %s', 'd', 'm', 'y', 'd2', 'm2', 'y2'}, -- |df=dmy -> dMy-dMy
},
['My-My'] = { -- these for long/short reformatting
['any'] = {'%s %s – %s %s', 'm', 'y', 'm2', 'y2'}, -- dmy/mdy agnostic
},
['M-My'] = { -- these for long/short reformatting
['any'] = {'%s–%s %s', 'm', 'm2', 'y'}, -- dmy/mdy agnostic
},
['My'] = { -- these for long/short reformatting
['any'] = {'%s %s', 'm', 'y'}, -- dmy/mdy agnostic
},
-- ['yMd'] = { -- not supported at en.wiki
-- ['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
-- ['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
-- ['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- },
}
local function reformatter (date, pattern_idx, format_param, mon_len)
if not in_array (pattern_idx, {'ymd', 'Mdy', 'Md-dy', 'dMy', 'yMd', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy', 'My-My', 'M-My', 'My'}) then
return; -- not in this set of date format patterns_t then not a reformattable date
end
if 'ymd' == format_param and in_array (pattern_idx, {'ymd', 'Md-dy', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy', 'My-My', 'M-My', 'My'}) then
return; -- ymd date ranges not supported at en.wiki; no point in reformatting ymd to ymd
end
if in_array (pattern_idx, {'My', 'M-My', 'My-My'}) then -- these are not dmy/mdy so can't be 'reformatted' into either
format_param = 'any'; -- so format-agnostic
end
-- yMd is not supported at en.wiki; when yMd is supported at your wiki, uncomment the next line
-- if 'yMd' == format_param and in_array (pattern_idx, {'yMd', 'Md-dy', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy'}) then -- these formats not convertable; yMd not supported at en.wiki
if 'yMd' == format_param then -- yMd not supported at en.wiki; when yMd is supported at your wiki, remove or comment-out this line
return; -- not a reformattable date
end
local c1, c2, c3, c4, c5, c6, c7; -- these hold the captures specified in patterns_t[pattern_idx][1]
c1, c2, c3, c4, c5, c6, c7 = mw.ustring.match (date, patterns_t[pattern_idx][1]); -- get the captures
local t = { -- table that holds k/v pairs of date parts from the captures and patterns_t[pattern_idx][2..]
[patterns_t[pattern_idx][2]] = c1; -- at minimum there is always one capture with a matching indicator letter
[patterns_t[pattern_idx][3] or 'x'] = c2; -- patterns_t can have a variable number of captures; each capture requires an indicator letter;
[patterns_t[pattern_idx][4] or 'x'] = c3; -- where there is no capture, there is no indicator letter so n in patterns_t[pattern_idx][n] will be nil;
[patterns_t[pattern_idx][5] or 'x'] = c4; -- the 'x' here spoofs an indicator letter to prevent 'table index is nil' error
[patterns_t[pattern_idx][6] or 'x'] = c5;
[patterns_t[pattern_idx][7] or 'x'] = c6;
[patterns_t[pattern_idx][8] or 'x'] = c7;
};
if t.a then -- if this date has an anchor year capture (all convertable date formats except ymd)
if t.y2 then -- for year range date formats
t.y2 = t.a; -- use the anchor year capture when reassembling the date
else -- here for single date formats (except ymd)
t.y = t.a; -- use the anchor year capture when reassembling the date
end
end
if tonumber(t.m) then -- if raw month is a number (converting from ymd)
if 's' == mon_len then -- if we are to use abbreviated month names
t.m = cfg.date_names['inv_local_short'][tonumber(t.m)]; -- convert it to a month name
else
t.m = cfg.date_names['inv_local_long'][tonumber(t.m)]; -- convert it to a month name
end
t.d = t.d:gsub ('0(%d)', '%1'); -- strip leading '0' from day if present
elseif 'ymd' == format_param then -- when converting to ymd
t.y = t.y:gsub ('%a', ''); -- strip CITREF disambiguator if present; anchor year already known so process can proceed; TODO: maint message?
if 1582 > tonumber (t.y) then -- ymd format dates not allowed before 1582
return;
end
t.m = string.format ('%02d', get_month_number (t.m)); -- make sure that month and day are two digits
t.d = string.format ('%02d', t.d);
elseif mon_len then -- if mon_len is set to either 'short' or 'long'
for _, mon in ipairs ({'m', 'm2'}) do -- because there can be two month names, check both
if t[mon] then
t[mon] = get_month_number (t[mon]); -- get the month number for this month (is length agnostic)
if 0 == t[mon] then return; end -- seasons and named dates can't be converted
t[mon] = (('s' == mon_len) and cfg.date_names['inv_local_short'][t[mon]]) or cfg.date_names['inv_local_long'][t[mon]]; -- fetch month name according to length
end
end
end
local new_date = string.format (re_formats[pattern_idx][format_param][1], -- format string
t[re_formats[pattern_idx][format_param][2]], -- named captures from t{}
t[re_formats[pattern_idx][format_param][3]],
t[re_formats[pattern_idx][format_param][4]],
t[re_formats[pattern_idx][format_param][5]],
t[re_formats[pattern_idx][format_param][6]],
t[re_formats[pattern_idx][format_param][7]],
t[re_formats[pattern_idx][format_param][8]]
);
return new_date;
end
--[[-------------------------< R E F O R M A T _ D A T E S >--------------------------------------------------
Reformats existing dates into the format specified by format.
format is one of several manual keywords: dmy, dmy-all, mdy, mdy-all, ymd, ymd-all. The -all version includes
access- and archive-dates; otherwise these dates are not reformatted.
This function allows automatic date formatting. In ~/Configuration, the article source is searched for one of
the {{use xxx dates}} templates. If found, xxx becomes the global date format as xxx-all. If |cs1-dates= in
{{use xxx dates}} has legitimate value then that value determines how cs1|2 dates will be rendered. Legitimate
values for |cs1-dates= are:
l - all dates are rendered with long month names
ls - publication dates use long month names; access-/archive-dates use abbreviated month names
ly - publication dates use long month names; access-/archive-dates rendered in ymd format
s - all dates are rendered with abbreviated (short) month names
sy - publication dates use abbreviated month names; access-/archive-dates rendered in ymd format
y - all dates are rendered in ymd format
the format argument for automatic date formatting will be the format specified by {{use xxx dates}} with the
value supplied by |cs1-dates so one of: xxx-l, xxx-ls, xxx-ly, xxx-s, xxx-sy, xxx-y, or simply xxx (|cs1-dates=
empty, omitted, or invalid) where xxx shall be either of dmy or mdy.
dates are extracted from date_parameters_list, reformatted (if appropriate), and then written back into the
list in the new format. Dates in date_parameters_list are presumed here to be valid (no errors). This function
returns true when a date has been reformatted, false else. Actual reformatting is done by reformatter().
]]
local function reformat_dates (date_parameters_list, format)
local all = false; -- set to false to skip access- and archive-dates
local len_p = 'l'; -- default publication date length shall be long
local len_a = 'l'; -- default access-/archive-date length shall be long
local result = false;
local new_date;
if format:match('%a+%-all') then -- manual df keyword; auto df keyword when length not specified in {{use xxx dates}};
format = format:match('(%a+)%-all'); -- extract the format
all = true; -- all dates are long format dates because this keyword doesn't specify length
elseif format:match('%a+%-[lsy][sy]?') then -- auto df keywords; internal only
all = true; -- auto df applies to all dates; use length specified by capture len_p for all dates
format, len_p, len_a = format:match('(%a+)%-([lsy])([sy]?)'); -- extract the format and length keywords
if 'y' == len_p then -- because allowed by MOS:DATEUNIFY (sort of) range dates and My dates not reformatted
format = 'ymd'; -- override {{use xxx dates}}
elseif (not is_set(len_a)) or (len_p == len_a) then -- no access-/archive-date length specified or same length as publication dates then
len_a = len_p; -- in case len_a not set
end
end -- else only publication dates and they are long
for param_name, param_val in pairs (date_parameters_list) do -- for each date-holding parameter in the list
if is_set (param_val.val) then -- if the parameter has a value
if not (not all and in_array (param_name, {'access-date', 'archive-date'})) then -- skip access- or archive-date unless format is xxx-all; yeah, ugly; TODO: find a better way
for pattern_idx, pattern in pairs (patterns_t) do
if mw.ustring.match (param_val.val, pattern[1]) then
if all and in_array (param_name, {'access-date', 'archive-date'}) then -- if this date is an access- or archive-date
new_date = reformatter (param_val.val, pattern_idx, (('y' == len_a) and 'ymd') or format, len_a); -- choose ymd or dmy/mdy according to len_a setting
else -- all other dates
new_date = reformatter (param_val.val, pattern_idx, format, len_p);
end
if new_date then -- set when date was reformatted
date_parameters_list[param_name].val = new_date; -- update date in date list
result = true; -- and announce that changes have been made
break;
end
end -- if
end -- for
end -- if
end -- if
end -- for
return result; -- declare boolean result and done
end
--[[--------------------------< D A T E _ H Y P H E N _ T O _ D A S H >----------------------------------------
Loops through the list of date-holding parameters and converts any hyphen to an ndash. Not called if the cs1|2
template has any date errors.
Modifies the date_parameters_list and returns true if hyphens are replaced, else returns false.
]]
local function date_hyphen_to_dash (date_parameters_list)
local result = false;
local n;
for param_name, param_val in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set (param_val.val) and
not mw.ustring.match (param_val.val, patterns_t.ymd[1]) then -- for those that are not ymd dates (ustring because here digits may not be Western)
param_val.val, n = param_val.val:gsub ('%-', '–'); -- replace any hyphen with ndash
if 0 ~= n then
date_parameters_list[param_name].val = param_val.val; -- update the list
result = true;
end
end
end
return result; -- so we know if any hyphens were replaced
end
--[[-------------------------< D A T E _ N A M E _ X L A T E >------------------------------------------------
Attempts to translate English date names to local-language date names using names supplied by MediaWiki's
date parser function. This is simple name-for-name replacement and may not work for all languages.
if xlat_dig is true, this function will also translate Western (English) digits to the local language's digits.
This will also translate ymd dates.
]]
local function date_name_xlate (date_parameters_list, xlt_dig)
local xlate;
local modified = false;
local date;
local sources_t = {
{cfg.date_names.en.long, cfg.date_names.inv_local_long}, -- for translating long English month names to long local month names
{cfg.date_names.en.short, cfg.date_names.inv_local_short}, -- short month names
{cfg.date_names.en.quarter, cfg.date_names.inv_local_quarter}, -- quarter date names
{cfg.date_names.en.season, cfg.date_names.inv_local_season}, -- season date nam
{cfg.date_names.en.named, cfg.date_names.inv_local_named}, -- named dates
}
local function is_xlateable (month) -- local function to get local date name that replaces existing English-language date name
for _, date_names_t in ipairs (sources_t) do -- for each sequence table in date_names_t
if date_names_t[1][month] then -- if date name is English month (long or short), quarter, season or named and
if date_names_t[2][date_names_t[1][month]] then -- if there is a matching local date name
return date_names_t[2][date_names_t[1][month]]; -- return the local date name
end
end
end
end
for param_name, param_val in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(param_val.val) then -- if the parameter has a value
date = param_val.val;
for month in mw.ustring.gmatch (date, '[%a ]+') do -- iterate through all date names in the date (single date or date range)
month = mw.text.trim (month); -- this because quarterly dates contain whitespace
xlate = is_xlateable (month); -- get translate <month>; returns translation or nil
if xlate then
date = mw.ustring.gsub (date, month, xlate); -- replace the English with the translation
date_parameters_list[param_name].val = date; -- save the translated date
modified = true;
end
end
if xlt_dig then -- shall we also translate digits?
date = date:gsub ('%d', cfg.date_names.xlate_digits); -- translate digits from Western to 'local digits'
date_parameters_list[param_name].val = date; -- save the translated date
modified = true;
end
end
end
return modified;
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
add_prop_cat = utilities_page_ptr.add_prop_cat ; -- import functions from selected Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
set_message = utilities_page_ptr.set_message;
substitute = utilities_page_ptr.substitute;
wrap_style = utilities_page_ptr.wrap_style;
cfg = cfg_table_ptr; -- import tables from selected Module:Citation/CS1/Configuration
end
--[[--------------------------< A R C H I V E _ D A T E _ C H E C K >------------------------------------------
Compare value in |archive-date= with the timestamp in Wayback machine urls. Emits an error message with suggested
date from the |archive-url= timestamp in an appropriate format when the value in |archive-date= does not match
the timestamp.
this function never called when any date in a cs1|2 template has errors
error message suggests new |archive-date= value in an appropriate format specified by <df>. <df> is either
|df= or cfg.global_df in that order. If <df> is nil, suggested date has format from |archive-date=. There is
a caveat: when |df=dmy or |df=mdy, the reformatter leaves |access-date= and |archive-date= formats as they are.
The error message suggested date is passed to the formatter as YYYY-MM-DD so when |df=dmy or |df=mdy, the format
is not changed.
]]
local function archive_date_check (archive_date, archive_url_timestamp, df)
local archive_date_format = 'dmy-y'; -- holds the date format of date in |archive-date; default to ymd; 'dmy' used here to spoof reformat_dates()
for _, v_t in ipairs ({{'dMy', 'dmy-all'}, {'Mdy', 'mdy-all'}}) do -- is |archive-date= format dmy or mdy?
if archive_date:match (patterns_t[v_t[1]][1]) then -- does the pattern match?
archive_date_format = cfg.keywords_xlate[v_t[2]]; -- get appropriate |df= supported keyword from the i18n translator table
break;
end
end
local dates_t = {};
dates_t['archive-date'] = {val=archive_date, name=''}; -- setup to call reformat_dates(); never called when errors so <name> unset as not needed
reformat_dates (dates_t, 'dmy-y'); -- reformat |archive-date= to ymd; 'dmy' used here to spoof reformat_dates()
local archive_url_date = archive_url_timestamp:gsub ('(%d%d%d%d)(%d%d)(%d%d)%d*', '%1-%2-%3'); -- make ymd format date from timestamp
if dates_t['archive-date'].val == archive_url_date then -- are the two dates the same
return; -- yes, done
else
dates_t['archive-date'] = {val=archive_url_date, name=''}; -- setup to call reformat_dates() with the timestamp date
reformat_dates (dates_t, df or archive_date_format); -- reformat timestamp to format specified by <df> or format used in |archive-date=
archive_url_date = dates_t['archive-date'].val;
set_message ('err_archive_date_url_ts_mismatch', archive_url_date); -- emit an error message
end
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return { -- return exported functions
archive_date_check = archive_date_check,
date_hyphen_to_dash = date_hyphen_to_dash,
date_name_xlate = date_name_xlate,
dates = dates,
is_valid_date = is_valid_date,
reformat_dates = reformat_dates,
set_selected_modules = set_selected_modules,
year_check = year_check,
year_date_check = year_date_check,
}
t2d5ocm3ym8yza0dgkl1tstgc2yr6dq
74995
74994
2026-08-24T00:44:39Z
Robertsky
10424
1 versaun husi [[:en:Module:Citation/CS1/Date_validation]]
74994
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local add_prop_cat, is_set, in_array, set_message, substitute, wrap_style; -- imported functions from selected Module:Citation/CS1/Utilities
local cfg; -- table of tables imported from selected Module:Citation/CS1/Configuration
--[[--------------------------< F I L E - S C O P E D E C L A R A T I O N S >--------------------------------
File-scope variables are declared here
]]
local lang_obj = mw.getContentLanguage(); -- used by is_valid_accessdate(), is_valid_year(), date_name_xlate();
local year_limit; -- used by is_valid_year()
--[=[-------------------------< I S _ V A L I D _ A C C E S S D A T E >----------------------------------------
returns true if:
Wikipedia start date <= accessdate < today + 2 days
Wikipedia start date is 2001-01-15T00:00:00 UTC which is 979516800 seconds after 1970-01-01T00:00:00 UTC (the start of Unix time)
accessdate is the date provided in |access-date= at time 00:00:00 UTC
today is the current date at time 00:00:00 UTC plus 48 hours
if today is 2015-01-01T00:00:00 then
adding 24 hours gives 2015-01-02T00:00:00 – one second more than today
adding 24 hours gives 2015-01-03T00:00:00 – one second more than tomorrow
This function does not work if it is fed month names for languages other than English. Wikimedia #time: parser
apparently doesn't understand non-English date month names. This function will always return false when the date
contains a non-English month name because good1 is false after the call to lang.formatDate(). To get around that
call this function with YYYY-MM-DD format dates.
]=]
local function is_valid_accessdate (accessdate)
local good1, good2;
local access_ts, tomorrow_ts; -- to hold Unix time stamps representing the dates
good1, access_ts = pcall (lang_obj.formatDate, lang_obj, 'U', accessdate ); -- convert accessdate value to Unix timestamp
good2, tomorrow_ts = pcall (lang_obj.formatDate, lang_obj, 'U', 'today + 2 days' ); -- today midnight + 2 days is one second more than all day tomorrow
if good1 and good2 then -- lang.formatDate() returns a timestamp in the local script which which tonumber() may not understand
access_ts = tonumber (access_ts) or lang_obj:parseFormattedNumber (access_ts); -- convert to numbers for the comparison;
tomorrow_ts = tonumber (tomorrow_ts) or lang_obj:parseFormattedNumber (tomorrow_ts);
else
return false; -- one or both failed to convert to Unix time stamp
end
if 979516800 <= access_ts and access_ts < tomorrow_ts then -- Wikipedia start date <= accessdate < tomorrow's date
return true;
else
return false; -- accessdate out of range
end
end
--[[--------------------------< G E T _ M O N T H _ N U M B E R >----------------------------------------------
returns a number according to the month in a date: 1 for January, etc. Capitalization and spelling must be correct.
If not a valid month, returns 0
]]
local function get_month_number (month)
return cfg.date_names['local'].long[month] or cfg.date_names['local'].short[month] or -- look for local names first
cfg.date_names['en'].long[month] or cfg.date_names['en'].short[month] or -- failing that, look for English names
0; -- not a recognized month name
end
--[[--------------------------< G E T _ S E A S O N _ N U M B E R >--------------------------------------------
returns a number according to the sequence of seasons in a year: 21 for Spring, etc. Capitalization and spelling
must be correct. If not a valid season, returns 0.
21-24 = Spring, Summer, Autumn, Winter, independent of “Hemisphere”
returns 0 when <param> is not |date=
Season numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard defines various divisions using
numbers 21-41. cs1|2 only supports generic seasons. EDTF does support the distinction between north and south
hemisphere seasons but cs1|2 has no way to make that distinction.
These additional divisions not currently supported:
25-28 = Spring - Northern Hemisphere, Summer- Northern Hemisphere, Autumn - Northern Hemisphere, Winter - Northern Hemisphere
29-32 = Spring – Southern Hemisphere, Summer– Southern Hemisphere, Autumn – Southern Hemisphere, Winter - Southern Hemisphere
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)
40-41 = Semestral 1, Semestral-2 (6 months each)
]]
local function get_season_number (season, param)
if 'date' ~= param then
return 0; -- season dates only supported by |date=
end
return cfg.date_names['local'].season[season] or -- look for local names first
cfg.date_names['en'].season[season] or -- failing that, look for English names
0; -- not a recognized season name
end
--[[--------------------------< G E T _ Q U A R T E R _ N U M B E R >------------------------------------------
returns a number according to the sequence of quarters in a year: 33 for first quarter, etc. Capitalization and spelling
must be correct. If not a valid quarter, returns 0.
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)
returns 0 when <param> is not |date=
Quarter numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)
which became part of ISO 8601 in 2019. See '§Sub-year groupings'. The standard defines various divisions using
numbers 21-41. cs1|2 only supports generic seasons and quarters.
These additional divisions not currently supported:
37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)
40-41 = Semestral 1, Semestral-2 (6 months each)
]]
local function get_quarter_number (quarter, param)
if 'date' ~= param then
return 0; -- quarter dates only supported by |date=
end
quarter = mw.ustring.gsub (quarter, ' +', ' '); -- special case replace multiple space chars with a single space char
return cfg.date_names['local'].quarter[quarter] or -- look for local names first
cfg.date_names['en'].quarter[quarter] or -- failing that, look for English names
0; -- not a recognized quarter name
end
--[[--------------------------< G E T _ P R O P E R _ N A M E _ N U M B E R >----------------------------------
returns a non-zero number if date contains a recognized proper-name. Capitalization and spelling must be correct.
returns 0 when <param> is not |date=
]]
local function get_proper_name_number (name, param)
if 'date' ~= param then
return 0; -- proper-name dates only supported by |date=
end
return cfg.date_names['local'].named[name] or -- look for local names dates first
cfg.date_names['en'].named[name] or -- failing that, look for English names
0; -- not a recognized named date
end
--[[--------------------------< G E T _ E L E M E N T _ N U M B E R <------------------------------------------
returns true if month or season or quarter or proper name is valid (properly spelled, capitalized, abbreviated)
]]
local function get_element_number (element, param)
local num;
local funcs = {get_month_number, get_season_number, get_quarter_number, get_proper_name_number}; -- list of functions to execute in order
for _, func in ipairs (funcs) do -- spin through the function list
num = func (element, param); -- call the function and get the returned number
if 0 ~= num then -- non-zero when valid month season quarter
return num; -- return that number
end
end
return nil; -- not valid
end
--[[--------------------------< I S _ V A L I D _ Y E A R >----------------------------------------------------
Function gets current year from the server and compares it to year from a citation parameter. Years more than one
year in the future are not acceptable.
Special case for |pmc-embargo-date=: years more than two years in the future are not acceptable
]]
local function is_valid_year (year, param)
if not is_set (year_limit) then
year_limit = tonumber(os.date("%Y"))+1; -- global variable so we only have to fetch it once
end
year = tonumber (year) or lang_obj:parseFormattedNumber (year); -- convert to number for the comparison
if year and (100 > year) then -- years less than 100 not supported
return false;
end
if 'pmc-embargo-date' == param then -- special case for |pmc-embargo-date=
return year and (year <= tonumber(os.date("%Y"))+2) or false; -- years more than two years in the future are not accepted
end
return year and (year <= year_limit) or false;
end
--[[--------------------------< I S _ V A L I D _ D A T E >----------------------------------------------------
Returns true if day is less than or equal to the number of days in month and year is no farther into the future
than next year; else returns false.
Assumes Julian calendar prior to year 1582 and Gregorian calendar thereafter. Accounts for Julian calendar leap
years before 1582 and Gregorian leap years after 1582. Where the two calendars overlap (1582 to approximately
1923) dates are assumed to be Gregorian.
]]
local function is_valid_date (year, month, day, param)
local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
local month_length;
if not is_valid_year (year, param) then -- no farther into the future than next year except |pmc-embargo-date= no more than two years in the future
return false;
end
month = tonumber (month); -- required for YYYY-MM-DD dates
if (2 == month) then -- if February
month_length = 28; -- then 28 days unless
if 1582 > tonumber(year) then -- Julian calendar
if 0 == (year%4) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
else -- Gregorian calendar
if (0 == (year%4) and (0 ~= (year%100) or 0 == (year%400))) then -- is a leap year?
month_length = 29; -- if leap year then 29 days in February
end
end
else
month_length = days_in_month[month] or 0; -- invalid month number is nil so default <month_length> to 0
end
if tonumber (day) > month_length then
return false;
end
return true;
end
--[[--------------------------< I S _ V A L I D _ M O N T H _ R A N G E _ S T Y L E >--------------------------
Months in a range are expected to have the same style: Jan–Mar or October–December but not February–Mar or Jul–August.
This function looks in cfg.date_names{} to see if both month names are listed in the long subtable or both are
listed in the short subtable. When both have the same style (both are listed in the same table), returns true; false else
]]
local function is_valid_month_range_style (month1, month2)
if (cfg.date_names.en.long[month1] and cfg.date_names.en.long[month2]) or -- are both English names listed in the long subtable?
(cfg.date_names.en.short[month1] and cfg.date_names.en.short[month2]) or -- are both English names listed in the short subtable?
(cfg.date_names['local'].long[month1] and cfg.date_names['local'].long[month2]) or -- are both local names listed in the long subtable?
(cfg.date_names['local'].short[month1] and cfg.date_names['local'].short[month2]) then -- are both local names listed in the short subtable?
return true;
end
return false; -- names are mixed
end
--[[--------------------------< I S _ V A L I D _ M O N T H _ S E A S O N _ R A N G E >------------------------
Check a pair of months or seasons to see if both are valid members of a month or season pair.
Month pairs are expected to be left to right, earliest to latest in time.
All season ranges are accepted as valid because there are publishers out there who have published a Summer–Spring YYYY issue, hence treat as ok
]]
local function is_valid_month_season_range(range_start, range_end, param)
local range_start_number = get_month_number (range_start);
local range_end_number;
if 0 == range_start_number then -- is this a month range?
range_start_number = get_season_number (range_start, param); -- not a month; is it a season? get start season number
range_end_number = get_season_number (range_end, param); -- get end season number
if (0 ~= range_start_number) and (0 ~= range_end_number) and (range_start_number ~= range_end_number) then
return true; -- any season pairing is accepted except when both are the same
end
return false; -- range_start and/or range_end is not a season
end
-- here when range_start is a month
range_end_number = get_month_number (range_end); -- get end month number
if range_start_number < range_end_number and -- range_start is a month; does range_start precede range_end?
is_valid_month_range_style (range_start, range_end) then -- do months have the same style?
return true; -- proper order and same style
end
return false; -- range_start month number is greater than or equal to range end number; or range end isn't a month
end
--[[--------------------------< M A K E _ C O I N S _ D A T E >------------------------------------------------
This function receives a table of date parts for one or two dates and an empty table reference declared in
Module:Citation/CS1. The function is called only for |date= parameters and only if the |date=<value> is
determined to be a valid date format. The question of what to do with invalid date formats is not answered here.
The date parts in the input table are converted to an ISO 8601 conforming date string:
single whole dates: yyyy-mm-dd
month and year dates: yyyy-mm
year dates: yyyy
ranges: yyyy-mm-dd/yyyy-mm-dd
yyyy-mm/yyyy-mm
yyyy/yyyy
Dates in the Julian calendar are reduced to year or year/year so that we don't have to do calendar conversion from
Julian to Proleptic Gregorian.
The input table has:
year, year2 – always present; if before 1582, ignore months and days if present
month, month2 – 0 if not provided, 1-12 for months, 21-24 for seasons; 99 Christmas
day, day2 – 0 if not provided, 1-31 for days
the output table receives:
rftdate: an ISO 8601 formatted date
rftchron: a free-form version of the date, usually without year which is in rftdate (season ranges and proper-name dates)
rftssn: one of four season keywords: winter, spring, summer, fall (lowercase)
rftquarter: one of four values: 1, 2, 3, 4
]]
local function make_COinS_date (input, COinS_date_t)
local date; -- one date or first date in a range
local date2 = ''; -- end of range date
input.year = tonumber (input.year) or lang_obj:parseFormattedNumber (input.year); -- language-aware tonumber()
input.year2 = tonumber (input.year2) or lang_obj:parseFormattedNumber (input.year2); -- COinS dates are pseudo-ISO 8601 so convert to Arabic numerals
if ((1582 == input.year) and (10 > tonumber(input.month))) or (1582 > input.year) then -- if a Julian calendar date
COinS_date_t.rftdate = tostring (input.year); -- &rft.date gets year only
return; -- done
end
-- here for all forms of Gregorian dates
if 20 < tonumber (input.month) then -- if season, quarter, or proper-name date
date = input.year; -- &rft.date gets year only
if 0 ~= input.year2 and input.year ~= input.year2 then -- if a range, only the second year portion when not the same as range start year
date = string.format ('%.4d/%.4d', input.year, input.year2) -- assemble the date range
end
local season = {[24] = 'winter', [21] = 'spring', [22] = 'summer', [23] = 'fall', [33] = '1', [34] = '2', [35] = '3', [36] = '4', [98] = 'Easter', [99] = 'Christmas'}; -- seasons lowercase, no autumn; proper-names use title case
if 0 == input.month2 then -- single season, quarter, or proper-name date
if 40 < tonumber(input.month) then
COinS_date_t.rftchron = season[input.month]; -- proper-name date; used in journal metadata only
elseif 30 < tonumber(input.month) then
COinS_date_t.rftquarter = season[input.month]; -- quarter date; used in journal metadata only
else
COinS_date_t.rftssn = season[input.month]; -- season date; used in journal metadata only
end
else -- season ranges are lumped into &rft.chron; &rft.ssn and &rft.quarter are left blank
if input.year ~= input.year2 then -- season year – season year range or season year–year
if 0 ~= input.month2 then
COinS_date_t.rftchron = string.format ('%s %s – %s %s', season[input.month], input.year, season[input.month2], input.year2); -- used in journal metadata only
end
else -- season–season year range
COinS_date_t.rftchron = season[input.month] .. '–' .. season[input.month2]; -- season–season year range; used in journal metadata only
end
end
COinS_date_t.rftdate = tostring (date);
return; -- done
end
-- here for gregorian calendar dates
if 0 ~= input.day then
date = string.format ('%s-%.2d-%.2d', input.year, tonumber(input.month), tonumber(input.day)); -- whole date
elseif 0 ~= input.month then
date = string.format ('%s-%.2d', input.year, tonumber(input.month)); -- year and month
else
date = string.format ('%s', input.year); -- just year
end
if 0 ~= input.year2 then
if 0 ~= input.day2 then
date2 = string.format ('/%s-%.2d-%.2d', input.year2, tonumber(input.month2), tonumber(input.day2)); -- whole date
elseif 0 ~= input.month2 then
date2 = string.format ('/%s-%.2d', input.year2, tonumber(input.month2)); -- year and month
else
date2 = string.format ('/%s', input.year2); -- just year
end
end
COinS_date_t.rftdate = date .. date2; -- date2 has the '/' separator
return;
end
--[[--------------------------< P A T T E R N S _ T >----------------------------------------------------------
this is the list of patterns for date formats that this module recognizes. Approximately the first half of these
patterns represent formats that might be reformatted into another format. Those that might be reformatted have
'indicator' letters that identify the content of the matching capture: 'd' (day), 'm' (month), 'a' (anchor year),
'y' (year); second day, month, year have a '2' suffix.
These patterns are used for both date validation and for reformatting. This table should not be moved to ~/Configuration
because changes to this table require changes to check_date() and to reformatter() and reformat_date()
]]
local patterns_t = {
-- year-initial numerical year-month-day
['ymd'] = {'^([1-9]%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'},
-- month-initial: month day, year
['Mdy'] = {'^(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%l?)$', 'm', 'd', 'a', 'y'},
-- month-initial day range: month day–day, year; days are separated by endash
['Md-dy'] = {'^(%D-) +([1-9]%d?)[%-–]([1-9]%d?), +(([1-9]%d%d%d?)%l?)$', 'm', 'd', 'd2', 'a', 'y'},
-- day-initial: day month year
['dMy'] = {'^([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%l?)$', 'd', 'm', 'a', 'y'},
-- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed; not supported at en.wiki
-- ['yMd'] = {'^(([1-9]%d%d%d?)%l?) +(%D-) +(%d%d?)$', 'a', 'y', 'm', 'd'},
-- day-range-initial: day–day month year; days are separated by endash
['d-dMy'] = {'^([1-9]%d?)[%-–]([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%l?)$', 'd', 'd2', 'm', 'a', 'y'},
-- day initial month-day-range: day month - day month year; uses spaced endash
['dM-dMy'] = {'^([1-9]%d?) +(%D-) +[%-–] +([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%l?)$', 'd', 'm', 'd2', 'm2', 'a', 'y'},
-- month initial month-day-range: month day – month day, year; uses spaced endash
['Md-Mdy'] = {'^(%D-) +([1-9]%d?) +[%-–] +(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%l?)$','m', 'd', 'm2', 'd2', 'a', 'y'},
-- day initial month-day-year-range: day month year - day month year; uses spaced endash
['dMy-dMy'] = {'^([1-9]%d?) +(%D-) +([1-9]%d%d%d?) +[%-–] +([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%l?)$', 'd', 'm', 'y', 'd2', 'm2', 'a', 'y2'},
-- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
['Mdy-Mdy'] = {'^(%D-) +([1-9]%d?), +([1-9]%d%d%d?) +[%-–] +(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%l?)$', 'm', 'd', 'y', 'm2', 'd2', 'a', 'y2'},
-- these date formats cannot be converted, per se, but month name can be rendered short or long
-- month/season year - month/season year; separated by spaced endash
['My-My'] = {'^(%D-) +([1-9]%d%d%d?) +[%-–] +(%D-) +(([1-9]%d%d%d?)%l?)$', 'm', 'y', 'm2', 'a', 'y2'},
-- month/season range year; months separated by endash
['M-My'] = {'^(%D-)[%-–](%D-) +(([1-9]%d%d%d?)%l?)$', 'm', 'm2', 'a', 'y'},
-- month/season year or proper-name year; quarter year when First Quarter YYYY etc.
['My'] = {'^([^%d–]-) +(([1-9]%d%d%d?)%l?)$', 'm', 'a', 'y'}, -- this way because endash is a member of %D; %D- will match January–March 2019 when it shouldn't
-- these date formats cannot be converted
['Sy4-y2'] = {'^(%D-) +(([1-9]%d)%d%d)[%-–]((%d%d)%l?)$'}, -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
['Sy-y'] = {'^(%D-) +([1-9]%d%d%d?)[%-–](([1-9]%d%d%d?)%l?)$'}, -- special case Winter/Summer year-year; year separated with unspaced endash
['y-y'] = {'^([1-9]%d%d%d?)[%-–](([1-9]%d%d%d?)%l?)$'}, -- year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
['y4-y2'] = {'^(([1-9]%d)%d%d)[%-–]((%d%d)%l?)$'}, -- year range: YYYY–YY; separated by unspaced endash
['y'] = {'^(([1-9]%d%d%d?)%l?)$'}, -- year; here accept either YYY or YYYY
-- these date formats cannot be converted
['n.d.'] = {'^((n%.d%.)%l?)$'}, -- no date with dots
['nd'] = {'^((nd)%l?)$'}, -- no date
}
--[[--------------------------< I S _ V A L I D _ E M B A R G O _ D A T E >------------------------------------
returns true and date value if that value has proper dmy, mdy, ymd format.
returns false and 9999 (embargoed forever) when date value is not proper format; assumes that when |pmc-embargo-date= is
set, the editor intended to embargo a PMC but |pmc-embargo-date= does not hold a single date.
]]
local function is_valid_embargo_date (v)
if v:match (patterns_t['ymd'][1]) or -- ymd
v:match (patterns_t['Mdy'][1]) or -- dmy
v:match (patterns_t['dMy'][1]) then -- mdy
return true, v;
end
return false, '9999'; -- if here not good date so return false and set embargo date to long time in future
end
--[[--------------------------< C H E C K _ D A T E >----------------------------------------------------------
Check date format to see that it is one of the formats approved by WP:DATESNO or WP:DATERANGE. Exception: only
allowed range separator is endash. Additionally, check the date to see that it is a real date: no 31 in 30-day
months; no 29 February when not a leap year. Months, both long-form and three character abbreviations, and seasons
must be spelled correctly. Future years beyond next year are not allowed.
If the date fails the format tests, this function returns false and does not return values for anchor_year and
COinS_date. When this happens, the date parameter is (DEBUG: not?) used in the COinS metadata and the CITEREF identifier gets
its year from the year parameter if present otherwise CITEREF does not get a date value.
Inputs:
date_string - date string from date-holding parameters (date, year, publication-date, access-date, pmc-embargo-date, archive-date, lay-date)
Returns:
false if date string is not a real date; else
true, anchor_year, COinS_date
anchor_year can be used in CITEREF anchors
COinS_date is ISO 8601 format date; see make_COInS_date()
]]
local function check_date (date_string, param, COinS_date_t)
local year; -- assume that year2, months, and days are not used;
local year2 = 0; -- second year in a year range
local month = 0;
local month2 = 0; -- second month in a month range
local day = 0;
local day2 = 0; -- second day in a day range
local anchor_year;
-- local coins_date;
if date_string:match (patterns_t['ymd'][1]) then -- year-initial numerical year month day format
year, month, day = date_string:match (patterns_t['ymd'][1]);
if 12 < tonumber(month) or 1 > tonumber(month) or 1582 > tonumber(year) or 0 == tonumber(day) then return false; end -- month or day number not valid or not Gregorian calendar
anchor_year = year;
elseif mw.ustring.match(date_string, patterns_t['Mdy'][1]) then -- month-initial: month day, year
month, day, anchor_year, year = mw.ustring.match(date_string, patterns_t['Mdy'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
elseif mw.ustring.match(date_string, patterns_t['Md-dy'][1]) then -- month-initial day range: month day–day, year; days are separated by endash
month, day, day2, anchor_year, year = mw.ustring.match(date_string, patterns_t['Md-dy'][1]);
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
month2=month; -- for metadata
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['dMy'][1]) then -- day-initial: day month year
day, month, anchor_year, year = mw.ustring.match(date_string, patterns_t['dMy'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
--[[ NOT supported at en.wiki
elseif mw.ustring.match(date_string, patterns_t['yMd'][1]) then -- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed
anchor_year, year, month, day = mw.ustring.match(date_string, patterns_t['yMd'][1]);
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
-- end NOT supported at en.wiki ]]
elseif mw.ustring.match(date_string, patterns_t['d-dMy'][1]) then -- day-range-initial: day–day month year; days are separated by endash
day, day2, month, anchor_year, year = mw.ustring.match(date_string, patterns_t['d-dMy'][1]);
if tonumber(day) >= tonumber(day2) then return false; end -- date range order is left to right: earlier to later; dates may not be the same;
month = get_month_number (month);
if 0 == month then return false; end -- return false if month text isn't one of the twelve months
month2 = month; -- for metadata
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['dM-dMy'][1]) then -- day initial month-day-range: day month - day month year; uses spaced endash
day, month, day2, month2, anchor_year, year = mw.ustring.match(date_string, patterns_t['dM-dMy'][1]);
if (not is_valid_month_season_range(month, month2)) or not is_valid_year(year) then return false; end -- date range order is left to right: earlier to later;
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['Md-Mdy'][1]) then -- month initial month-day-range: month day – month day, year; uses spaced endash
month, day, month2, day2, anchor_year, year = mw.ustring.match(date_string, patterns_t['Md-Mdy'][1]);
if (not is_valid_month_season_range(month, month2, param)) or not is_valid_year(year) then return false; end
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['dMy-dMy'][1]) then -- day initial month-day-year-range: day month year - day month year; uses spaced endash
day, month, year, day2, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['dMy-dMy'][1]);
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month = get_month_number (month); -- for metadata
month2 = get_month_number (month2);
if 0 == month or 0 == month2 then return false; end -- both must be valid
elseif mw.ustring.match(date_string, patterns_t['Mdy-Mdy'][1]) then -- month initial month-day-year-range: month day, year – month day, year; uses spaced endash
month, day, year, month2, day2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['Mdy-Mdy'][1]);
if tonumber(year2) <= tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end -- year2 no more than one year in the future; months same style
month = get_month_number (month); -- for metadata
month2 = get_month_number(month2);
if 0 == month or 0 == month2 then return false; end -- both must be valid
elseif mw.ustring.match(date_string, patterns_t['Sy4-y2'][1]) then -- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash
local century;
month, year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['Sy4-y2'][1]);
if 'Winter' ~= month and 'Summer' ~= month then return false end; -- 'month' can only be Winter or Summer
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
year2 = century..year2; -- add the century to year2 for comparisons
if 1 ~= tonumber(year2) - tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
month = get_season_number(month, param);
elseif mw.ustring.match(date_string, patterns_t['Sy-y'][1]) then -- special case Winter/Summer year-year; year separated with unspaced endash
month, year, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['Sy-y'][1]);
month = get_season_number (month, param); -- <month> can only be winter or summer; also for metadata
if (month ~= cfg.date_names['en'].season['Winter']) and (month ~= cfg.date_names['en'].season['Summer']) then
return false; -- not Summer or Winter; abandon
end
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
if 1 ~= tonumber(year2) - tonumber(year) then return false; end -- must be sequential years, left to right, earlier to later
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
elseif mw.ustring.match(date_string, patterns_t['My-My'][1]) then -- month/season year - month/season year; separated by spaced endash
month, year, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['My-My'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor_year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if 0 ~= get_month_number(month) and 0 ~= get_month_number(month2) and is_valid_month_range_style(month, month2) then -- both must be month year, same month style
month = get_month_number(month);
month2 = get_month_number(month2);
elseif 0 ~= get_season_number(month, param) and 0 ~= get_season_number(month2, param) then -- both must be season year, not mixed
month = get_season_number(month, param);
month2 = get_season_number(month2, param);
else
return false;
end
elseif mw.ustring.match(date_string, patterns_t['M-My'][1]) then -- month/season range year; months separated by endash
month, month2, anchor_year, year = mw.ustring.match(date_string, patterns_t['M-My'][1]);
if (not is_valid_month_season_range(month, month2, param)) or (not is_valid_year(year)) then return false; end
if 0 ~= get_month_number(month) then -- determined to be a valid range so just check this one to know if month or season
month = get_month_number(month);
month2 = get_month_number(month2);
if 0 == month or 0 == month2 then return false; end
else
month = get_season_number(month, param);
month2 = get_season_number(month2, param);
end
year2 = year;
elseif mw.ustring.match(date_string, patterns_t['My'][1]) then -- month/season/quarter/proper-name year
month, anchor_year, year = mw.ustring.match(date_string, patterns_t['My'][1]);
if not is_valid_year(year) then return false; end
month = get_element_number(month, param); -- get month season quarter proper-name number or nil
if not month then return false; end -- not valid whatever it is
elseif mw.ustring.match(date_string, patterns_t['y-y'][1]) then -- Year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999
year, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['y-y'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
elseif mw.ustring.match(date_string, patterns_t['y4-y2'][1]) then -- Year range: YYYY–YY; separated by unspaced endash
local century;
year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns_t['y4-y2'][1]);
anchor_year = year .. '–' .. anchor_year; -- assemble anchor year from both years
if 13 > tonumber(year2) then return false; end -- don't allow 2003-05 which might be May 2003
year2 = century .. year2; -- add the century to year2 for comparisons
if tonumber(year) >= tonumber(year2) then return false; end -- left to right, earlier to later, not the same
if not is_valid_year(year2) then return false; end -- no year farther in the future than next year
if in_array (param, {'date', 'publication-date', 'year'}) then -- here when 'valid' abbreviated year range; if one of these parameters
add_prop_cat ('year-range-abbreviated'); -- add properties cat
end
elseif mw.ustring.match(date_string, patterns_t['y'][1]) then -- year; here accept either YYY or YYYY
anchor_year, year = mw.ustring.match(date_string, patterns_t['y'][1]);
if false == is_valid_year(year) then
return false;
end
else
return false; -- date format not one of the MOS:DATE approved formats
end
if param ~= 'date' then -- CITEREF disambiguation only allowed in |date=; |year= & |publication-date= promote to date
if anchor_year:match ('%l$') then
return false;
end
end
if 'access-date' == param then -- test access-date here because we have numerical date parts
if 0 ~= year and 0 ~= month and 0 ~= day and -- all parts of a single date required
0 == year2 and 0 == month2 and 0 == day2 then -- none of these; access-date must not be a range
if not is_valid_accessdate(year .. '-' .. month .. '-' .. day) then
return false; -- return false when access-date out of bounds
end
else
return false; -- return false when access-date is a range of two dates
end
end
if 'archive-date' == param then -- test archive-date here because we have numerical date parts
if not (0 ~= year and 0 ~= month and 0 ~= day and -- all parts of a single date required
0 == year2 and 0 == month2 and 0 == day2) then -- none of these; archive-date must not be a range
return false; -- return false when archive-date is a range of two dates
end
end
local result=true; -- check whole dates for validity; assume true because not all dates will go through this test
if 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 == day2 then -- YMD (simple whole date)
result = is_valid_date (year, month, day, param); -- <param> for |pmc-embargo-date=
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 ~= day2 then -- YMD-d (day range)
result = is_valid_date (year, month, day);
result = result and is_valid_date (year, month, day2);
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 ~= month2 and 0 ~= day2 then -- YMD-md (day month range)
result = is_valid_date (year, month, day);
result = result and is_valid_date (year, month2, day2);
elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 ~= year2 and 0 ~= month2 and 0 ~= day2 then -- YMD-ymd (day month year range)
result = is_valid_date(year, month, day);
result = result and is_valid_date(year2, month2, day2);
end
if false == result then return false; end
if nil ~= COinS_date_t then -- this table only passed into this function when testing |date= parameter values
make_COinS_date ({year = year, month = month, day = day, year2 = year2, month2 = month2, day2 = day2}, COinS_date_t); -- make an ISO 8601 date string for COinS
end
return true, anchor_year; -- format is good and date string represents a real date
end
--[[--------------------------< D A T E S >--------------------------------------------------------------------
Cycle the date-holding parameters in passed table date_parameters_list through check_date() to check compliance with MOS:DATE. For all valid dates, check_date() returns
true. The |date= parameter test is unique, it is the only date holding parameter from which values for anchor_year (used in CITEREF identifiers) and COinS_date (used in
the COinS metadata) are derived. The |date= parameter is the only date-holding parameter that is allowed to contain the no-date keywords "n.d." or "nd" (without quotes).
Unlike most error messages created in this module, only one error message is created by this function. Because all of the date holding parameters are processed serially,
parameters with errors are added to the <error_list> sequence table as the dates are tested.
]]
local function dates(date_parameters_list, COinS_date_t, error_list)
local anchor_year; -- will return as nil if the date being tested is not |date=
local embargo_date; -- if embargo date is a good dmy, mdy, ymd date then holds original value else reset to 9999
local good_date;
for k, v in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(v.val) then -- if the parameter has a value
v.val = mw.ustring.gsub(v.val, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9
if v.val:match("^c%. [1-9]%d%d%d?%l?$") then -- special case for c. year or with or without CITEREF disambiguator - only |date= and |year=
local year = v.val:match("c%. ([1-9]%d%d%d?)%l?"); -- get the year portion so it can be tested
if 'date' == k then
anchor_year = v.val:match ('(c%. [1-9]%d%d%d?%l?)'); -- anchor year only from |date= parameter
good_date = is_valid_year(year);
elseif 'year' == k then
good_date = is_valid_year(year);
else
good_date = false;
end
elseif 'date' == k then -- if the parameter is |date=
if v.val:match (patterns_t['n.d.'][1]) then -- if |date=n.d. with or without a CITEREF disambiguator
good_date, anchor_year = true, v.val:match (patterns_t['n.d.'][1]); -- "n.d."; no error when date parameter is set to no date
elseif v.val:match (patterns_t.nd[1]) then -- if |date=nd with or without a CITEREF disambiguator
good_date, anchor_year = true, v.val:match (patterns_t.nd[1]); -- "nd"; no error when date parameter is set to no date
else
good_date, anchor_year = check_date (v.val, k, COinS_date_t); -- go test the date
end
elseif 'year' == k then -- if the parameter is |year= it should hold only a year value
if v.val:match("^[1-9]%d%d%d?%l?$") then -- if |year = 3 or 4 digits only with or without a CITEREF disambiguator
good_date, anchor_year = true, v.val:match ("((%d+)%l?)");
else
good_date = false;
end
elseif 'pmc-embargo-date' == k then -- if the parameter is |pmc-embargo-date=
good_date = check_date (v.val, k); -- go test the date
if true == good_date then -- if the date is a valid date
good_date, embargo_date = is_valid_embargo_date (v.val); -- is |pmc-embargo-date= date a single dmy, mdy, or ymd formatted date? yes: returns embargo date; no: returns 9999
end
else -- any other date-holding parameter
good_date = check_date (v.val, k); -- go test the date
end
if false == good_date then -- assemble one error message so we don't add the tracking category multiple times
table.insert (error_list, wrap_style ('parameter', v.name)); -- make parameter name suitable for error message list
end
end
end
return anchor_year, embargo_date; -- and done
end
--[[--------------------------< Y E A R _ C H E C K >----------------------------------------------------------
Temporary function to test |year= for acceptable values:
YYY, YYYY, year-only ranges, their circa forms, with or without CITEREF disambiguators.
When |year= holds some form of date that is not one of these year-only dates, emit a maintenance message.
This function necessary because many non-cs1|2 templates have a |year= parameter so cirrus searches are more-or-
less useless
]]
local function year_check (year)
year = year:gsub ('c%. *', ''); -- remove circa annotation (if present) before testing <year>
for _, index in ipairs ({'y-y', 'y4-y2', 'y'}) do -- spin through these indexes into patterns_t
if mw.ustring.match (year, patterns_t[index][1]) then
return; -- if a match then |year= holds a valid 'year'
end
end
set_message ('maint_year'); -- if here, |year= value is not an accepted value; add a maint cat
end
--[[--------------------------< Y E A R _ D A T E _ C H E C K >------------------------------------------------
Compare the value provided in |year= with the year value(s) provided in |date=. This function sets a local numeric value:
0 - year value does not match the year value in date
1 - (default) year value matches the year value in date or one of the year values when date contains two years
2 - year value matches the year value in date when date is in the form YYYY-MM-DD and year is disambiguated (|year=YYYYx)
the numeric value in <result> determines the 'output' if any from this function:
0 – adds error message to error_list sequence table
1 – adds maint cat
2 – does nothing
]]
local function year_date_check (year_string, year_origin, date_string, date_origin, error_list)
local year;
local date1;
local date2;
local result = 1; -- result of the test; assume that the test passes
year = year_string:match ('(%d%d%d%d?)');
if date_string:match ('%d%d%d%d%-%d%d%-%d%d') then --special case where both date and year are required YYYY-MM-DD and YYYYx
date1 = date_string:match ('(%d%d%d%d)');
year = year_string:match ('(%d%d%d%d)');
if year ~= date1 then
result = 0; -- years don't match
elseif year_string:match ('%d%d%d%d%a') then
result = 2; -- years match; but because disambiguated, don't add to maint cat
end
elseif date_string:match ("%d%d%d%d?.-%d%d%d%d?") then -- any of the standard range formats of date with two three- or four-digit years
date1, date2 = date_string:match ("(%d%d%d%d?).-(%d%d%d%d?)");
if year ~= date1 and year ~= date2 then
result = 0;
end
elseif mw.ustring.match(date_string, "%d%d%d%d[%-–]%d%d") then -- YYYY-YY date ranges
local century;
date1, century, date2 = mw.ustring.match(date_string, "((%d%d)%d%d)[%-–]+(%d%d)");
date2 = century..date2; -- convert YY to YYYY
if year ~= date1 and year ~= date2 then
result = 0;
end
elseif date_string:match ("%d%d%d%d?") then -- any of the standard formats of date with one year
date1 = date_string:match ("(%d%d%d%d?)");
if year ~= date1 then
result = 0;
end
else -- should never get here; this function called only when no other date errors
result = 0; -- no recognizable year in date
end
if 0 == result then -- year / date mismatch
table.insert (error_list, substitute (cfg.messages['mismatch'], {year_origin, date_origin})); -- add error message to error_list sequence table
elseif 1 == result then -- redundant year / date
set_message ('maint_date_year'); -- add a maint cat
end
end
--[[--------------------------< R E F O R M A T T E R >--------------------------------------------------------
reformat 'date' into new format specified by format_param if pattern_idx (the current format of 'date') can be
reformatted. Does the grunt work for reformat_dates().
The table re_formats maps pattern_idx (current format) and format_param (desired format) to a table that holds:
format string used by string.format()
identifier letters ('d', 'm', 'y', 'd2', 'm2', 'y2') that serve as indexes into a table t{} that holds captures
from mw.ustring.match() for the various date parts specified by patterns_t[pattern_idx][1]
Items in patterns_t{} have the general form:
['ymd'] = {'^(%d%d%d%d)%-(%d%d)%-(%d%d)$', 'y', 'm', 'd'}, where:
['ymd'] is pattern_idx
patterns_t['ymd'][1] is the match pattern with captures for mw.ustring.match()
patterns_t['ymd'][2] is an indicator letter identifying the content of the first capture
patterns_t['ymd'][3] ... the second capture etc.
when a pattern matches a date, the captures are loaded into table t{} in capture order using the idemtifier
characters as indexes into t{} For the above, a ymd date is in t{} as:
t.y = first capture (year), t.m = second capture (month), t.d = third capture (day)
To reformat, this function is called with the pattern_idx that matches the current format of the date and with
format_param set to the desired format. This function loads table t{} as described and then calls string.format()
with the format string specified by re_format[pattern_idx][format_param][1] using values taken from t{} according
to the capture identifier letters specified by patterns_t[pattern_idx][format_param][n] where n is 2..
]]
local re_formats = {
['ymd'] = { -- date format is ymd; reformat to:
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['Mdy'] = { -- date format is Mdy; reformat to:
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- for long/short reformatting
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['dMy'] = { -- date format is dMy; reformat to:
['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- ['yMd'] = {'%s %s %s', 'y', 'm', 'd'}, -- |df=yMd; not supported at en.wiki
},
['Md-dy'] = { -- date format is Md-dy; reformat to:
['mdy'] = {'%s %s–%s, %s', 'm', 'd', 'd2', 'y'}, -- for long/short reformatting
['dmy'] = {'%s–%s %s %s', 'd', 'd2', 'm', 'y'}, -- |df=dmy -> d-dMy
},
['d-dMy'] = { -- date format is d-d>y; reformat to:
['dmy'] = {'%s–%s %s %s', 'd', 'd2', 'm', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s–%s, %s', 'm', 'd', 'd2', 'y'}, -- |df=mdy -> Md-dy
},
['dM-dMy'] = { -- date format is dM-dMy; reformat to:
['dmy'] = {'%s %s – %s %s %s', 'd', 'm', 'd2', 'm2', 'y'}, -- for long/short reformatting
['mdy'] = {'%s %s – %s %s, %s', 'm', 'd', 'm2', 'd2', 'y'}, -- |df=mdy -> Md-Mdy
},
['Md-Mdy'] = { -- date format is Md-Mdy; reformat to:
['mdy'] = {'%s %s – %s %s, %s', 'm', 'd', 'm2', 'd2', 'y'}, -- for long/short reformatting
['dmy'] = {'%s %s – %s %s %s', 'd', 'm', 'd2', 'm2', 'y'}, -- |df=dmy -> dM-dMy
},
['dMy-dMy'] = { -- date format is dMy-dMy; reformat to:
['dmy'] = {'%s %s %s – %s %s %s', 'd', 'm', 'y', 'd2', 'm2', 'y2'}, -- for long/short reformatting
['mdy'] = {'%s %s, %s – %s %s, %s', 'm', 'd', 'y', 'm2', 'd2', 'y2'}, -- |df=mdy -> Mdy-Mdy
},
['Mdy-Mdy'] = { -- date format is Mdy-Mdy; reformat to:
['mdy'] = {'%s %s, %s – %s %s, %s', 'm', 'd', 'y', 'm2', 'd2', 'y2'}, -- for long/short reformatting
['dmy'] = {'%s %s %s – %s %s %s', 'd', 'm', 'y', 'd2', 'm2', 'y2'}, -- |df=dmy -> dMy-dMy
},
['My-My'] = { -- these for long/short reformatting
['any'] = {'%s %s – %s %s', 'm', 'y', 'm2', 'y2'}, -- dmy/mdy agnostic
},
['M-My'] = { -- these for long/short reformatting
['any'] = {'%s–%s %s', 'm', 'm2', 'y'}, -- dmy/mdy agnostic
},
['My'] = { -- these for long/short reformatting
['any'] = {'%s %s', 'm', 'y'}, -- dmy/mdy agnostic
},
-- ['yMd'] = { -- not supported at en.wiki
-- ['mdy'] = {'%s %s, %s', 'm', 'd', 'y'}, -- |df=mdy
-- ['dmy'] = {'%s %s %s', 'd', 'm', 'y'}, -- |df=dmy
-- ['ymd'] = {'%s-%s-%s', 'y', 'm', 'd'}, -- |df=ymd
-- },
}
local function reformatter (date, pattern_idx, format_param, mon_len)
if not in_array (pattern_idx, {'ymd', 'Mdy', 'Md-dy', 'dMy', 'yMd', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy', 'My-My', 'M-My', 'My'}) then
return; -- not in this set of date format patterns_t then not a reformattable date
end
if 'ymd' == format_param and in_array (pattern_idx, {'ymd', 'Md-dy', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy', 'My-My', 'M-My', 'My'}) then
return; -- ymd date ranges not supported at en.wiki; no point in reformatting ymd to ymd
end
if in_array (pattern_idx, {'My', 'M-My', 'My-My'}) then -- these are not dmy/mdy so can't be 'reformatted' into either
format_param = 'any'; -- so format-agnostic
end
-- yMd is not supported at en.wiki; when yMd is supported at your wiki, uncomment the next line
-- if 'yMd' == format_param and in_array (pattern_idx, {'yMd', 'Md-dy', 'd-dMy', 'dM-dMy', 'Md-Mdy', 'dMy-dMy', 'Mdy-Mdy'}) then -- these formats not convertable; yMd not supported at en.wiki
if 'yMd' == format_param then -- yMd not supported at en.wiki; when yMd is supported at your wiki, remove or comment-out this line
return; -- not a reformattable date
end
local c1, c2, c3, c4, c5, c6, c7; -- these hold the captures specified in patterns_t[pattern_idx][1]
c1, c2, c3, c4, c5, c6, c7 = mw.ustring.match (date, patterns_t[pattern_idx][1]); -- get the captures
local t = { -- table that holds k/v pairs of date parts from the captures and patterns_t[pattern_idx][2..]
[patterns_t[pattern_idx][2]] = c1; -- at minimum there is always one capture with a matching indicator letter
[patterns_t[pattern_idx][3] or 'x'] = c2; -- patterns_t can have a variable number of captures; each capture requires an indicator letter;
[patterns_t[pattern_idx][4] or 'x'] = c3; -- where there is no capture, there is no indicator letter so n in patterns_t[pattern_idx][n] will be nil;
[patterns_t[pattern_idx][5] or 'x'] = c4; -- the 'x' here spoofs an indicator letter to prevent 'table index is nil' error
[patterns_t[pattern_idx][6] or 'x'] = c5;
[patterns_t[pattern_idx][7] or 'x'] = c6;
[patterns_t[pattern_idx][8] or 'x'] = c7;
};
if t.a then -- if this date has an anchor year capture (all convertable date formats except ymd)
if t.y2 then -- for year range date formats
t.y2 = t.a; -- use the anchor year capture when reassembling the date
else -- here for single date formats (except ymd)
t.y = t.a; -- use the anchor year capture when reassembling the date
end
end
if tonumber(t.m) then -- if raw month is a number (converting from ymd)
if 's' == mon_len then -- if we are to use abbreviated month names
t.m = cfg.date_names['inv_local_short'][tonumber(t.m)]; -- convert it to a month name
else
t.m = cfg.date_names['inv_local_long'][tonumber(t.m)]; -- convert it to a month name
end
t.d = t.d:gsub ('0(%d)', '%1'); -- strip leading '0' from day if present
elseif 'ymd' == format_param then -- when converting to ymd
t.y = t.y:gsub ('%a', ''); -- strip CITREF disambiguator if present; anchor year already known so process can proceed; TODO: maint message?
if 1582 > tonumber (t.y) then -- ymd format dates not allowed before 1582
return;
end
t.m = string.format ('%02d', get_month_number (t.m)); -- make sure that month and day are two digits
t.d = string.format ('%02d', t.d);
elseif mon_len then -- if mon_len is set to either 'short' or 'long'
for _, mon in ipairs ({'m', 'm2'}) do -- because there can be two month names, check both
if t[mon] then
t[mon] = get_month_number (t[mon]); -- get the month number for this month (is length agnostic)
if 0 == t[mon] then return; end -- seasons and named dates can't be converted
t[mon] = (('s' == mon_len) and cfg.date_names['inv_local_short'][t[mon]]) or cfg.date_names['inv_local_long'][t[mon]]; -- fetch month name according to length
end
end
end
local new_date = string.format (re_formats[pattern_idx][format_param][1], -- format string
t[re_formats[pattern_idx][format_param][2]], -- named captures from t{}
t[re_formats[pattern_idx][format_param][3]],
t[re_formats[pattern_idx][format_param][4]],
t[re_formats[pattern_idx][format_param][5]],
t[re_formats[pattern_idx][format_param][6]],
t[re_formats[pattern_idx][format_param][7]],
t[re_formats[pattern_idx][format_param][8]]
);
return new_date;
end
--[[-------------------------< R E F O R M A T _ D A T E S >--------------------------------------------------
Reformats existing dates into the format specified by format.
format is one of several manual keywords: dmy, dmy-all, mdy, mdy-all, ymd, ymd-all. The -all version includes
access- and archive-dates; otherwise these dates are not reformatted.
This function allows automatic date formatting. In ~/Configuration, the article source is searched for one of
the {{use xxx dates}} templates. If found, xxx becomes the global date format as xxx-all. If |cs1-dates= in
{{use xxx dates}} has legitimate value then that value determines how cs1|2 dates will be rendered. Legitimate
values for |cs1-dates= are:
l - all dates are rendered with long month names
ls - publication dates use long month names; access-/archive-dates use abbreviated month names
ly - publication dates use long month names; access-/archive-dates rendered in ymd format
s - all dates are rendered with abbreviated (short) month names
sy - publication dates use abbreviated month names; access-/archive-dates rendered in ymd format
y - all dates are rendered in ymd format
the format argument for automatic date formatting will be the format specified by {{use xxx dates}} with the
value supplied by |cs1-dates so one of: xxx-l, xxx-ls, xxx-ly, xxx-s, xxx-sy, xxx-y, or simply xxx (|cs1-dates=
empty, omitted, or invalid) where xxx shall be either of dmy or mdy.
dates are extracted from date_parameters_list, reformatted (if appropriate), and then written back into the
list in the new format. Dates in date_parameters_list are presumed here to be valid (no errors). This function
returns true when a date has been reformatted, false else. Actual reformatting is done by reformatter().
]]
local function reformat_dates (date_parameters_list, format)
local all = false; -- set to false to skip access- and archive-dates
local len_p = 'l'; -- default publication date length shall be long
local len_a = 'l'; -- default access-/archive-date length shall be long
local result = false;
local new_date;
if format:match('%a+%-all') then -- manual df keyword; auto df keyword when length not specified in {{use xxx dates}};
format = format:match('(%a+)%-all'); -- extract the format
all = true; -- all dates are long format dates because this keyword doesn't specify length
elseif format:match('%a+%-[lsy][sy]?') then -- auto df keywords; internal only
all = true; -- auto df applies to all dates; use length specified by capture len_p for all dates
format, len_p, len_a = format:match('(%a+)%-([lsy])([sy]?)'); -- extract the format and length keywords
if 'y' == len_p then -- because allowed by MOS:DATEUNIFY (sort of) range dates and My dates not reformatted
format = 'ymd'; -- override {{use xxx dates}}
elseif (not is_set(len_a)) or (len_p == len_a) then -- no access-/archive-date length specified or same length as publication dates then
len_a = len_p; -- in case len_a not set
end
end -- else only publication dates and they are long
for param_name, param_val in pairs (date_parameters_list) do -- for each date-holding parameter in the list
if is_set (param_val.val) then -- if the parameter has a value
if not (not all and in_array (param_name, {'access-date', 'archive-date'})) then -- skip access- or archive-date unless format is xxx-all; yeah, ugly; TODO: find a better way
for pattern_idx, pattern in pairs (patterns_t) do
if mw.ustring.match (param_val.val, pattern[1]) then
if all and in_array (param_name, {'access-date', 'archive-date'}) then -- if this date is an access- or archive-date
new_date = reformatter (param_val.val, pattern_idx, (('y' == len_a) and 'ymd') or format, len_a); -- choose ymd or dmy/mdy according to len_a setting
else -- all other dates
new_date = reformatter (param_val.val, pattern_idx, format, len_p);
end
if new_date then -- set when date was reformatted
date_parameters_list[param_name].val = new_date; -- update date in date list
result = true; -- and announce that changes have been made
break;
end
end -- if
end -- for
end -- if
end -- if
end -- for
return result; -- declare boolean result and done
end
--[[--------------------------< D A T E _ H Y P H E N _ T O _ D A S H >----------------------------------------
Loops through the list of date-holding parameters and converts any hyphen to an ndash. Not called if the cs1|2
template has any date errors.
Modifies the date_parameters_list and returns true if hyphens are replaced, else returns false.
]]
local function date_hyphen_to_dash (date_parameters_list)
local result = false;
local n;
for param_name, param_val in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set (param_val.val) and
not mw.ustring.match (param_val.val, patterns_t.ymd[1]) then -- for those that are not ymd dates (ustring because here digits may not be Western)
param_val.val, n = param_val.val:gsub ('%-', '–'); -- replace any hyphen with ndash
if 0 ~= n then
date_parameters_list[param_name].val = param_val.val; -- update the list
result = true;
end
end
end
return result; -- so we know if any hyphens were replaced
end
--[[-------------------------< D A T E _ N A M E _ X L A T E >------------------------------------------------
Attempts to translate English date names to local-language date names using names supplied by MediaWiki's
date parser function. This is simple name-for-name replacement and may not work for all languages.
if xlat_dig is true, this function will also translate Western (English) digits to the local language's digits.
This will also translate ymd dates.
]]
local function date_name_xlate (date_parameters_list, xlt_dig)
local xlate;
local modified = false;
local date;
local sources_t = {
{cfg.date_names.en.long, cfg.date_names.inv_local_long}, -- for translating long English month names to long local month names
{cfg.date_names.en.short, cfg.date_names.inv_local_short}, -- short month names
{cfg.date_names.en.quarter, cfg.date_names.inv_local_quarter}, -- quarter date names
{cfg.date_names.en.season, cfg.date_names.inv_local_season}, -- season date nam
{cfg.date_names.en.named, cfg.date_names.inv_local_named}, -- named dates
}
local function is_xlateable (month) -- local function to get local date name that replaces existing English-language date name
for _, date_names_t in ipairs (sources_t) do -- for each sequence table in date_names_t
if date_names_t[1][month] then -- if date name is English month (long or short), quarter, season or named and
if date_names_t[2][date_names_t[1][month]] then -- if there is a matching local date name
return date_names_t[2][date_names_t[1][month]]; -- return the local date name
end
end
end
end
for param_name, param_val in pairs(date_parameters_list) do -- for each date-holding parameter in the list
if is_set(param_val.val) then -- if the parameter has a value
date = param_val.val;
for month in mw.ustring.gmatch (date, '[%a ]+') do -- iterate through all date names in the date (single date or date range)
month = mw.text.trim (month); -- this because quarterly dates contain whitespace
xlate = is_xlateable (month); -- get translate <month>; returns translation or nil
if xlate then
date = mw.ustring.gsub (date, month, xlate); -- replace the English with the translation
date_parameters_list[param_name].val = date; -- save the translated date
modified = true;
end
end
if xlt_dig then -- shall we also translate digits?
date = date:gsub ('%d', cfg.date_names.xlate_digits); -- translate digits from Western to 'local digits'
date_parameters_list[param_name].val = date; -- save the translated date
modified = true;
end
end
end
return modified;
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
add_prop_cat = utilities_page_ptr.add_prop_cat ; -- import functions from selected Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
set_message = utilities_page_ptr.set_message;
substitute = utilities_page_ptr.substitute;
wrap_style = utilities_page_ptr.wrap_style;
cfg = cfg_table_ptr; -- import tables from selected Module:Citation/CS1/Configuration
end
--[[--------------------------< A R C H I V E _ D A T E _ C H E C K >------------------------------------------
Compare value in |archive-date= with the timestamp in Wayback machine urls. Emits an error message with suggested
date from the |archive-url= timestamp in an appropriate format when the value in |archive-date= does not match
the timestamp.
this function never called when any date in a cs1|2 template has errors
error message suggests new |archive-date= value in an appropriate format specified by <df>. <df> is either
|df= or cfg.global_df in that order. If <df> is nil, suggested date has format from |archive-date=. There is
a caveat: when |df=dmy or |df=mdy, the reformatter leaves |access-date= and |archive-date= formats as they are.
The error message suggested date is passed to the formatter as YYYY-MM-DD so when |df=dmy or |df=mdy, the format
is not changed.
]]
local function archive_date_check (archive_date, archive_url_timestamp, df)
local archive_date_format = 'dmy-y'; -- holds the date format of date in |archive-date; default to ymd; 'dmy' used here to spoof reformat_dates()
for _, v_t in ipairs ({{'dMy', 'dmy-all'}, {'Mdy', 'mdy-all'}}) do -- is |archive-date= format dmy or mdy?
if archive_date:match (patterns_t[v_t[1]][1]) then -- does the pattern match?
archive_date_format = cfg.keywords_xlate[v_t[2]]; -- get appropriate |df= supported keyword from the i18n translator table
break;
end
end
local dates_t = {};
dates_t['archive-date'] = {val=archive_date, name=''}; -- setup to call reformat_dates(); never called when errors so <name> unset as not needed
reformat_dates (dates_t, 'dmy-y'); -- reformat |archive-date= to ymd; 'dmy' used here to spoof reformat_dates()
local archive_url_date = archive_url_timestamp:gsub ('(%d%d%d%d)(%d%d)(%d%d)%d*', '%1-%2-%3'); -- make ymd format date from timestamp
if dates_t['archive-date'].val == archive_url_date then -- are the two dates the same
return; -- yes, done
else
dates_t['archive-date'] = {val=archive_url_date, name=''}; -- setup to call reformat_dates() with the timestamp date
reformat_dates (dates_t, df or archive_date_format); -- reformat timestamp to format specified by <df> or format used in |archive-date=
archive_url_date = dates_t['archive-date'].val;
set_message ('err_archive_date_url_ts_mismatch', archive_url_date); -- emit an error message
end
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return { -- return exported functions
archive_date_check = archive_date_check,
date_hyphen_to_dash = date_hyphen_to_dash,
date_name_xlate = date_name_xlate,
dates = dates,
is_valid_date = is_valid_date,
reformat_dates = reformat_dates,
set_selected_modules = set_selected_modules,
year_check = year_check,
year_date_check = year_date_check,
}
t2d5ocm3ym8yza0dgkl1tstgc2yr6dq
Módulo:Citation/CS1/Identifiers
828
7646
74996
71648
2026-08-08T13:56:47Z
en>Trappist the monk
0
synch from sandbox;
74996
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local has_accept_as_written, is_set, in_array, set_message, select_one, -- functions in Module:Citation/CS1/Utilities
substitute, make_wikilink;
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
--[[--------------------------< P A G E S C O P E V A R I A B L E S >--------------------------------------
declare variables here that have page-wide scope that are not brought in from other modules; that are created here and used here
]]
local auto_link_urls = {}; -- holds identifier URLs for those identifiers that can auto-link |title=
--============================<< H E L P E R F U N C T I O N S >>============================================
--[[--------------------------< W I K I D A T A _ A R T I C L E _ N A M E _ G E T >----------------------------
as an aid to internationalizing identifier-label wikilinks, gets identifier article names from Wikidata.
returns w:<lang code>:<article title> when <q> has an <article title> for <lang code>; nil else. 'w:<lang code>'
ensures that sister project (like wiktionary) will link to the <lang code>.wikipedia article.
for identifiers that do not have <q>, returns nil
for wikis that do not have mw.wikibase installed, returns nil
]]
local function wikidata_article_name_get (q)
if not is_set (q) or (q and not mw.wikibase) then -- when no q number or when a q number but mw.wikibase not installed on this wiki
return nil; -- abandon
end
local wd_article;
local this_wiki_code = cfg.this_wiki_code; -- Wikipedia subdomain; 'en' for en.wikipedia.org
wd_article = mw.wikibase.getSitelink (q, this_wiki_code .. 'wiki'); -- fetch article title from WD; nil when no title available at this wiki
if wd_article then
wd_article = table.concat ({'w:', this_wiki_code, ':', wd_article}); -- interwiki-style link without brackets if taken from WD; leading 'w:' required
end
return wd_article; -- article title from WD; nil else
end
--[[--------------------------< L A B E L _ L I N K _ M A K E >------------------------------------------------
common function to create a link for an identifier label from handler table or from Wikidata
returns the first available of:
1. redirect from local wiki's handler table (if enabled)
2. Wikidata sitelink to the local language wikipedia article (if there is a Wikidata entry for this identifier in the local language)
3. link to wikipedia article specified in the local wiki's handler table
]]
local function label_link_make (handler)
local wd_article;
if not (cfg.use_identifier_redirects and is_set (handler.redirect)) then -- redirect has priority so if enabled and available don't fetch from Wikidata because expensive
wd_article = wikidata_article_name_get (handler.q); -- if Wikidata has an article title for this wiki, get it;
end
return (cfg.use_identifier_redirects and is_set (handler.redirect) and handler.redirect) or wd_article or handler.link;
end
--[[--------------------------< E X T E R N A L _ L I N K _ I D >----------------------------------------------
Formats a wiki-style external link
]]
local function external_link_id (options)
local url_string = options.id;
local ext_link;
if options.encode == true or options.encode == nil then
url_string = mw.uri.encode (url_string, 'PATH');
end
if options.auto_link and is_set (options.access) then
auto_link_urls[options.auto_link] = table.concat ({options.prefix, url_string, options.suffix});
end
ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or "", mw.text.nowiki (options.id));
if is_set (options.access) then
ext_link = substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[options.access].class, cfg.presentation[options.access].title, ext_link}); -- add the free-to-read / paywall lock
end
return table.concat ({
make_wikilink (label_link_make (options), options.label), -- redirect, Wikidata link, or locally specified link (in that order)
options.separator or ' ',
ext_link
});
end
--[[--------------------------< I N T E R N A L _ L I N K _ I D >----------------------------------------------
Formats a wiki-style internal link
TODO: Does not currently need to support options.access, options.encode, auto-linking and COinS (as in external_link_id),
but may be needed in the future for :m:Interwiki_map custom-prefixes like :arxiv:, :bibcode:, :DOI:, :hdl:, :ISSN:,
:JSTOR:, :Openlibrary:, :PMID:, :RFC:.
]]
local function internal_link_id (options)
local id = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9
return table.concat (
{
make_wikilink (label_link_make (options), options.label), -- wiki-link the identifier label
options.separator or ' ', -- add the separator
make_wikilink (
table.concat (
{
options.prefix,
id, -- translated to Western digits
options.suffix or ''
}),
substitute (cfg.presentation['bdi'], {'', mw.text.nowiki (options.id)}) -- bdi tags to prevent Latin script identifiers from being reversed at RTL language wikis
); -- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?
});
end
--[[--------------------------< I S _ E M B A R G O E D >------------------------------------------------------
Determines if a PMC identifier's online version is embargoed. Compares the date in |pmc-embargo-date= against
today's date. If embargo date is in the future, returns the content of |pmc-embargo-date=; otherwise, returns
an empty string because the embargo has expired or because |pmc-embargo-date= was not set in this cite.
]]
local function is_embargoed (embargo)
if is_set (embargo) then
local lang = mw.getContentLanguage();
local good1, embargo_date, todays_date;
good1, embargo_date = pcall (lang.formatDate, lang, 'U', embargo);
todays_date = lang:formatDate ('U');
if good1 then -- if embargo date is a good date
if tonumber (embargo_date) >= tonumber (todays_date) then -- is embargo date is in the future?
return embargo; -- still embargoed
else
set_message ('maint_pmc_embargo'); -- embargo has expired; add main cat
return ''; -- unset because embargo has expired
end
end
end
return ''; -- |pmc-embargo-date= not set return empty string
end
--[=[-------------------------< I S _ V A L I D _ R X I V _ D A T E >------------------------------------------
for biorxiv, returns true if:
2019-12-11T00:00Z <= biorxiv_date < today + 2 days
for medrxiv, returns true if:
2020-01-01T00:00Z <= medrxiv_date < today + 2 days
The dated form of biorxiv identifier has a start date of 2019-12-11. The Unix timestamp for that date is {{#time:U|2019-12-11}} = 1576022400
The medrxiv identifier has a start date of 2020-01-01. The Unix timestamp for that date is {{#time:U|2020-01-01}} = 1577836800
<rxiv_date> is the date provided in those |biorxiv= parameter values that are dated and in |medrxiv= parameter values at time 00:00:00 UTC
<today> is the current date at time 00:00:00 UTC plus 48 hours
if today's date is 2023-01-01T00:00:00 then
adding 24 hours gives 2023-01-02T00:00:00 – one second more than today
adding 24 hours gives 2023-01-03T00:00:00 – one second more than tomorrow
inputs:
<y>, <m>, <d> – year, month, day parts of the date from the birxiv or medrxiv identifier
<select> 'b' for biorxiv, 'm' for medrxiv; defaults to 'b'
]=]
local function is_valid_rxiv_date (y, m, d, select)
if 0 == tonumber (m) and 12 < tonumber (m) then -- <m> must be a number 1–12
return false;
end
if 0 == tonumber (d) and 31 < tonumber (d) then -- <d> must be a number 1–31; TODO: account for month length and leap yer?
return false;
end
local rxiv_date = table.concat ({y, m, d}, '-'); -- make ymd date string
local good1, good2;
local rxiv_ts, tomorrow_ts; -- to hold Unix timestamps representing the dates
local lang_object = mw.getContentLanguage();
good1, rxiv_ts = pcall (lang_object.formatDate, lang_object, 'U', rxiv_date); -- convert rxiv_date value to Unix timestamp
good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, 'U', 'today + 2 days' ); -- today midnight + 2 days is one second more than all day tomorrow
if good1 and good2 then -- lang.formatDate() returns a timestamp in the local script which tonumber() may not understand
rxiv_ts = tonumber (rxiv_ts) or lang_object:parseFormattedNumber (rxiv_ts); -- convert to numbers for the comparison;
tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);
else
return false; -- one or both failed to convert to Unix timestamp
end
local limit_ts = ((select and ('m' == select)) and 1577836800) or 1576022400; -- choose the appropriate limit timesatmp
return ((limit_ts <= rxiv_ts) and (rxiv_ts < tomorrow_ts)) -- limit_ts <= rxiv_date < tomorrow's date
end
--[[--------------------------< IS _ V A L I D _ I S X N >-----------------------------------------------------
ISBN-10 and ISSN validator code calculates checksum across all ISBN/ISSN digits including the check digit.
ISBN-13 is checked in isbn().
If the number is valid the result will be 0. Before calling this function, ISBN/ISSN must be checked for length
and stripped of dashes, spaces and other non-ISxN characters.
]]
local function is_valid_isxn (isxn_str, len)
local temp = 0;
isxn_str = { isxn_str:byte(1, len) }; -- make a table of byte values '0' → 0x30 .. '9' → 0x39, 'X' → 0x58
len = len + 1; -- adjust to be a loop counter
for i, v in ipairs (isxn_str) do -- loop through all of the bytes and calculate the checksum
if v == string.byte ("X" ) then -- if checkdigit is X (compares the byte value of 'X' which is 0x58)
temp = temp + 10 * (len - i); -- it represents 10 decimal
else
temp = temp + tonumber (string.char (v) )*(len-i);
end
end
return temp % 11 == 0; -- returns true if calculation result is zero
end
--[[--------------------------< IS _ V A L I D _ I S X N _ 1 3 >-----------------------------------------------
ISBN-13 and ISMN validator code calculates checksum across all 13 ISBN/ISMN digits including the check digit.
If the number is valid, the result will be 0. Before calling this function, ISBN-13/ISMN must be checked for length
and stripped of dashes, spaces and other non-ISxN-13 characters.
]]
local function is_valid_isxn_13 (isxn_str)
local temp=0;
isxn_str = { isxn_str:byte(1, 13) }; -- make a table of byte values '0' → 0x30 .. '9' → 0x39
for i, v in ipairs (isxn_str) do
temp = temp + (3 - 2*(i % 2)) * tonumber (string.char (v) ); -- multiply odd index digits by 1, even index digits by 3 and sum; includes check digit
end
return temp % 10 == 0; -- sum modulo 10 is zero when ISBN-13/ISMN is correct
end
--[[--------------------------< N O R M A L I Z E _ L C C N >--------------------------------------------------
LCCN normalization (https://www.loc.gov/marc/lccn-namespace.html#normalization)
1. Remove all blanks.
2. If there is a forward slash (/) in the string, remove it, and remove all characters to the right of the forward slash.
3. If there is a hyphen in the string:
a. Remove it.
b. Inspect the substring following (to the right of) the (removed) hyphen. Then (and assuming that steps 1 and 2 have been carried out):
1. All these characters should be digits, and there should be six or less. (not done in this function)
2. If the length of the substring is less than 6, left-fill the substring with zeroes until the length is six.
Returns a normalized LCCN for lccn() to validate. There is no error checking (step 3.b.1) performed in this function.
]]
local function normalize_lccn (lccn)
lccn = lccn:gsub ("%s", ""); -- 1. strip whitespace
if nil ~= string.find (lccn, '/') then
lccn = lccn:match ("(.-)/"); -- 2. remove forward slash and all character to the right of it
end
local prefix
local suffix
prefix, suffix = lccn:match ("(.+)%-(.+)"); -- 3.a remove hyphen by splitting the string into prefix and suffix
if nil ~= suffix then -- if there was a hyphen
suffix = string.rep("0", 6-string.len (suffix)) .. suffix; -- 3.b.2 left fill the suffix with 0s if suffix length less than 6
lccn = prefix..suffix; -- reassemble the LCCN
end
return lccn;
end
--============================<< I D E N T I F I E R F U N C T I O N S >>====================================
--[[--------------------------< A R X I V >--------------------------------------------------------------------
See: https://arxiv.org/help/arxiv_identifier
format and error check arXiv identifier. There are three valid forms of the identifier:
the first form, valid only between date codes 9107 and 0703, is:
arXiv:<archive>.<class>/<date code><number><version>
where:
<archive> is a string of alpha characters - may be hyphenated; no other punctuation
<class> is a string of alpha characters - may be hyphenated; no other punctuation; not the same as |class= parameter which is not supported in this form
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
first digit of YY for this form can only 9 and 0
<number> is a three-digit number
<version> is a 1 or more digit number preceded with a lowercase v; no spaces (undocumented)
the second form, valid from April 2007 through December 2014 is:
arXiv:<date code>.<number><version>
where:
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
<number> is a four-digit number
<version> is a 1 or more digit number preceded with a lowercase v; no spaces
the third form, valid from January 2015 is:
arXiv:<date code>.<number><version>
where:
<date code> and <version> are as defined for 0704-1412
<number> is a five-digit number
]]
local function arxiv (options)
local id = options.id;
local class = options.Class; -- TODO: lowercase?
local handler = options.handler;
local year, month;
local err_msg = false; -- assume no error message
local text; -- output text
if id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%d$") or id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%dv%d+$") then -- test for the 9107-0703 format with or without version
year, month = id:match("^%a[%a%.%-]+/([90]%d)([01]%d)%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((not (90 < year or 8 > year)) or (1 > month or 12 < month)) or -- if invalid year or invalid month
((91 == year and 7 > month) or (7 == year and 3 < month)) then -- if years ok, are starting and ending months ok?
err_msg = true; -- flag for error message
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%dv%d+$") then -- test for the 0704-1412 with or without version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((7 > year) or (14 < year) or (1 > month or 12 < month)) or -- is year invalid or is month invalid? (doesn't test for future years)
((7 == year) and (4 > month)) then -- when year is 07, is month invalid (before April)?
err_msg = true; -- flag for error message
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%d%dv%d+$") then -- test for the 1501- format with or without version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((15 > year) or (1 > month or 12 < month)) then -- is year invalid or is month invalid? (doesn't test for future years)
err_msg = true; -- flag for error message
end
else
err_msg = true; -- not a recognized format; flag for error message
end
if err_msg then
options.coins_list_t['ARXIV'] = nil; -- when error, unset so not included in COinS
end
if err_msg then
set_message ('err_bad_arxiv');
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});
if is_set (class) then
if id:match ('^%d+') then
text = table.concat ({text, ' [[https://arxiv.org/archive/', class, ' ', class, ']]'}); -- external link within square brackets, not wikilink
else
set_message ('err_class_ignored');
end
else -- class not set
if id:match ('^%d+') and options.CitationClass == 'arxiv' then -- new (post 2007) format; {{cite arxiv}} only
set_message ('maint_missing_class'); -- add maint cat
end
end
return text;
end
--[[--------------------------< B I B C O D E >--------------------------------------------------------------------
Validates (sort of) and formats a bibcode ID.
Format for bibcodes is specified here: https://adsabs.harvard.edu/abs_doc/help_pages/data.html#bibcodes
But, this: 2015arXiv151206696F is apparently valid so apparently, the only things that really matter are length, 19 characters
and first four digits must be a year. This function makes these tests:
length must be 19 characters
characters in position
1–4 must be digits and must represent a year in the range of 1000 – next year
5 must be a letter
6–8 must be letter, digit, ampersand, or dot (ampersand cannot directly precede a dot; &. )
9–18 must be letter, digit, or dot
19 must be a letter or dot
]]
local function bibcode (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local ignore_invalid = options.accept;
local err_type;
local year;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,
access = access});
if 19 ~= id:len() then
err_type = cfg.err_msg_supl.length;
else
year = id:match ("^(%d%d%d%d)[%a][%w&%.][%w&%.][%w&%.][%w.]+[%a%.]$");
if not year then -- if nil then no pattern match
err_type = cfg.err_msg_supl.value; -- so value error
else
local next_year = tonumber (os.date ('%Y')) + 1; -- get the current year as a number and add one for next year
year = tonumber (year); -- convert year portion of bibcode to a number
if (1000 > year) or (year > next_year) then
err_type = cfg.err_msg_supl.year; -- year out of bounds
end
if id:find('&%.') then
err_type = cfg.err_msg_supl.journal; -- journal abbreviation must not have '&.' (if it does it's missing a letter)
end
if id:match ('.........%.tmp%.') then -- temporary bibcodes when positions 10–14 are '.tmp.'
set_message ('maint_bibcode');
end
end
end
if is_set (err_type) and not ignore_invalid then -- if there was an error detected and accept-as-written markup not used
set_message ('err_bad_bibcode', {err_type});
options.coins_list_t['BIBCODE'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< B I O R X I V >-----------------------------------------------------------------
Format bioRxiv ID and do simple error checking. Before 2019-12-11, biorXiv IDs were 10.1101/ followed by exactly
6 digits. After 2019-12-11, biorXiv IDs retained the six-digit identifier but prefixed that with a yyyy.mm.dd.
date and suffixed with an optional version identifier.
From December 2025 biorxiv added a new 'doi' prefix: 10.64898:
10.64898/2025.12.10.693067
The bioRxiv ID is the string of characters:
https://doi.org/10.1101/078733 -> 10.1101/078733
or a date followed by a six-digit number followed by an optional version indicator 'v' and one or more digits:
https://www.biorxiv.org/content/10.1101/2019.12.11.123456v2 -> 10.1101/2019.12.11.123456v2
see https://www.biorxiv.org/about-biorxiv
]]
local function biorxiv (options)
local id = options.id;
local handler = options.handler;
local err_msg = true; -- flag; assume that there will be an error
local patterns = {
'^10%.1101/%d%d%d%d%d%d$', -- simple 6-digit identifier (before 2019-12-11)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%dv%d+$', -- y.m.d. date + 6-digit identifier + version (after 2019-12-11)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d$', -- y.m.d. date + 6-digit identifier (after 2019-12-11)
'^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%dv%d+$', -- y.m.d. date + 6-digit identifier + version (from December 2025)
'^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d$', -- y.m.d. date + 6-digit identifier (from December 2025)
}
for _, pattern in ipairs (patterns) do -- spin through the patterns looking for a match
if id:match (pattern) then
local y, m, d = id:match (pattern); -- found a match, attempt to get year, month and date from the identifier
if m then -- m is nil when id is the six-digit form
if not is_valid_rxiv_date (y, m, d, 'b') then -- validate the encoded date; 'b' for biorxiv limit
break; -- date fail; break out early so we don't unset the error message
end
end
err_msg = nil; -- we found a match so unset the error message
break; -- and done
end
end -- err_cat remains set here when no match
if err_msg then
options.coins_list_t['BIORXIV'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_biorxiv'); -- and set the error message
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator,
encode = handler.encode, access = handler.access});
end
--[[--------------------------< C I T E S E E R X >------------------------------------------------------------
CiteSeerX use their own notion of "doi" (not to be confused with the identifiers resolved via doi.org).
The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure
]]
local function citeseerx (options)
local id = options.id;
local handler = options.handler;
local matched;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,
access = handler.access});
matched = id:match ("^10%.1%.1%.[1-9]%d?%d?%d?%.[1-9]%d?%d?%d?$");
if not matched then
set_message ('err_bad_citeseerx' );
options.coins_list_t['CITESEERX'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< D O I >------------------------------------------------------------------------
Formats a DOI and checks for DOI errors.
DOI names contain two parts: prefix and suffix separated by a forward slash.
Prefix: directory indicator '10.' followed by a registrant code
Suffix: character string of any length chosen by the registrant
This function checks a DOI name for: prefix/suffix. If the DOI name contains spaces or endashes, or, if it ends
with a period or a comma, this function will emit a bad_doi error message.
DOI names are case-insensitive and can incorporate any printable Unicode characters so the test for spaces, endash,
and terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in DOI names.
https://www.doi.org/doi_handbook/2_Numbering.html -- 2.2 Syntax of a DOI name
https://www.doi.org/doi_handbook/2_Numbering.html#2.2.2 -- 2.2.2 DOI prefix
]]
local function doi (options)
local id = options.id;
local inactive = options.DoiBroken
local access = options.access;
local ignore_invalid = options.accept;
local handler = options.handler;
local err_flag; -- error flag for errors that may not be ignored
local ignorable_err_flag; -- error flag for ((ignorable)) errors
local function is_extended_free (registrant, suffix) -- local function to check those few registrants that are mixed; identifiable by the doi suffix <incipit>
suffix = suffix:lower(); -- ascii [a-z] same as [A-Z] in doi names; see §3.4.4 Case Insensitivity of the Doi Name
if cfg.extended_registrants_t[registrant] then -- if this registrant has known free-to-read extentions
for _, incipit in ipairs (cfg.extended_registrants_t[registrant]) do -- loop through the registrant's incipits
if mw.ustring.find (suffix, '^' .. incipit:lower()) then -- ascii [a-z] same as [A-Z] in doi names
return true; -- if found done
end
end
end
end
local text;
if is_set (inactive) then
local inactive_year = inactive:match("%d%d%d%d"); -- try to get the year portion from the inactive date
local inactive_month, good;
if is_set (inactive_year) then
if 4 < inactive:len() then -- inactive date has more than just a year (could be anything)
local lang_obj = mw.getContentLanguage(); -- get a language object for this wiki
good, inactive_month = pcall (lang_obj.formatDate, lang_obj, 'F', inactive); -- try to get the month name from the inactive date
if not good then
inactive_month = nil; -- something went wrong so make sure this is unset
end
end
end -- otherwise, |doi-broken-date= has something but it isn't a date
if is_set (inactive_year) and is_set (inactive_month) then
set_message ('maint_doi_inactive_dated', {inactive_year, inactive_month, ' '});
elseif is_set (inactive_year) then
set_message ('maint_doi_inactive_dated', {inactive_year, '', ''});
else
set_message ('maint_doi_inactive');
end
inactive = substitute (cfg.messages['inactive'], inactive );
end
local registrant, suffix = mw.ustring.match (id, '^10%.([^/]+)/([^%s–]+)$'); -- registrant and suffix set when DOI has the proper basic form; both nil else
if suffix then
if suffix:match ('[%.,]$') then -- |doi= has basic form but suffix has trailing dot or comma
ignorable_err_flag = true; -- set the flag so that we can emit an error message if not ignored
end
else -- here when |doi= does not have proper basic form
err_flag = true; -- set the non-ignorable error flag
ignore_invalid = false; -- unset because this error may not be ignored
end
local registrant_err_patterns = { -- these patterns are for code ranges that are not supported
'^[^1-3]%d%d%d%d%.%d+$', -- 5 digits with subcode (reject 0xxxx, 40000+); accepts: 10000–39999
'^[^1-8]%d%d%d%d$', -- 5 digits without subcode (reject 0xxxx, 90000+); accepts: 10000–89999
'^[^1-9]%d%d%d%.%d+$', -- 4 digits with subcode (reject 0xxx); accepts: 1000–9999
'^[^1-9]%d%d%d$', -- 4 digits without subcode (reject 0xxx); accepts: 1000–9999
'^%d%d%d%d%d%d+', -- 6 or more digits
'^%d%d?%d?$', -- less than 4 digits without subcode (3 digits with subcode is legitimate)
'^%d%d?%.[%d%.]+', -- 1 or 2 digits with subcode
'^5555$', -- test registrant will never resolve
'[^%d%.]', -- any character that isn't a digit or a dot
}
if not err_flag then -- when DOI has proper form; <err_flag> is true when |doi= is malformed
if not ignore_invalid then -- when we're not ignoring errors
if registrant then -- when DOI has proper form
for i, pattern in ipairs (registrant_err_patterns) do -- spin through error patterns
if registrant:match (pattern) then -- to validate registrant codes
ignorable_err_flag = true; -- when found, mark this DOI as bad
break; -- and done
end
end
end
else -- here when ignoring invalid |doi= values
ignorable_err_flag = false; -- unset so we don't emit an error message for ignorable errors
set_message ('maint_doi_ignore'); -- add maint message when doi is properly formatted
end
end
if err_flag or ignorable_err_flag then
set_message ('err_bad_doi'); -- invalid |doi= value; emit an error message
options.coins_list_t['DOI'] = nil; -- when in error, unset so |doi= value not included in COinS
else -- here when doi has no errors or has been wrapped in accept-as-written markup
suffix = mw.ustring.match (id, '^10%.[^/]+/(.+)'); -- refetch suffix because doi may have been wrapped in accept-as-written markup
if not access and (cfg.known_free_doi_registrants_t[registrant] or is_extended_free (registrant, suffix)) then -- |doi-access=free not set and <registrant> is known to be free
set_message ('maint_doi_unflagged_free'); -- set a maint cat
end
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access,
auto_link = not (err_flag or is_set (inactive) or ignore_invalid) and 'doi' or nil -- do not auto-link when |doi-broken-date= has a value or when there is a DOI error or (to play it safe, after all, auto-linking is not essential) when invalid DOIs are ignored
}) .. (inactive or '');
return text;
end
--[[--------------------------< H D L >------------------------------------------------------------------------
Formats an HDL with minor error checking.
HDL names contain two parts: prefix and suffix separated by a forward slash.
Prefix: character string using any character in the UCS-2 character set except '/'
Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant
This function checks a HDL name for: prefix/suffix. If the HDL name contains spaces, endashes, or, if it ends
with a period or a comma, this function will emit a bad_hdl error message.
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in HDLs.
Query string parameters are named here: https://www.handle.net/proxy_servlet.html. query strings are not displayed
but since '?' is an allowed character in an HDL, '?' followed by one of the query parameters is the only way we
have to detect the query string so that it isn't URL-encoded with the rest of the identifier.
]]
local function hdl (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local query_params_t = { -- list of known query parameters from https://www.handle.net/proxy_servlet.html
'noredirect',
'ignore_aliases',
'auth',
'cert',
'index',
'type',
'urlappend',
'locatt',
'action',
}
local handle, suffix, param = id:match ('(.-)(%?(%a+).+)$'); -- look for query string
local found;
if handle then -- when there are query strings, this is the handle identifier portion
for _, q in ipairs (query_params_t) do -- spin through the list of query parameters
if param:match ('^' .. q) then -- if the query string begins with one of the parameters
found = true; -- announce a find
break; -- and stop looking
end
end
end
if found then
id = handle; -- found so replace id with the handle portion; this will be URL-encoded, suffix will not
else
suffix = ''; -- make sure suffix is empty string for concatenation else
end
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, suffix = suffix, separator = handler.separator, encode = handler.encode, access = access})
if nil == id:match("^[^%s–]-/[^%s–]-[^%.,]$") then -- HDL must contain a forward slash, must not contain spaces, endashes, and must not end with period or comma
set_message ('err_bad_hdl' );
options.coins_list_t['HDL'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< I S B N >----------------------------------------------------------------------
Determines whether an ISBN string is valid
]]
local function isbn (options_t)
local isbn_str = options_t.id;
local ignore_invalid = options_t.accept;
local handler = options_t.handler;
local year = options_t.Year; -- when set, valid anchor_year; may have a disambiguator which must be removed
local function return_result (check, err_type) -- local function to handle the various returns
local ISBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = isbn_str, separator = handler.separator});
if ignore_invalid then -- if ignoring ISBN errors
set_message ('maint_isbn_ignore'); -- add a maint category even when there is no error
else -- here when not ignoring
if not check then -- and there is an error
options_t.coins_list_t['ISBN'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_isbn', err_type); -- set an error message
return ISBN; -- return id text
end
end
return ISBN; -- return id text
end
if year and not ignore_invalid then --
year = year:match ('%d%d%d%d?'); -- strip disambiguator if present
if year and (1965 > tonumber(year)) then -- <year> will be nil here when |year=n.d. or |year=nd
set_message ('err_invalid_isbn_date'); -- set an error message
return internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = isbn_str, separator = handler.separator});
end
end
if nil ~= isbn_str:match ('[^%s-0-9X]') then
return return_result (false, cfg.err_msg_supl.char); -- fail if isbn_str contains anything but digits, hyphens, or the uppercase X
end
local id = isbn_str:gsub ('[%s-]', ''); -- remove hyphens and whitespace
local len = id:len();
if len ~= 10 and len ~= 13 then
return return_result (false, cfg.err_msg_supl.length); -- fail if incorrect length
end
if len == 10 then
if id:match ('^%d*X?$') == nil then -- fail if isbn_str has 'X' anywhere but last position
return return_result (false, cfg.err_msg_supl.form);
end
if not is_valid_isxn (id, 10) then -- test isbn-10 for numerical validity
return return_result (false, cfg.err_msg_supl.check); -- fail if isbn-10 is not numerically valid
end
if id:find ('^63[01]') then -- 630xxxxxxx and 631xxxxxxx are (apparently) not valid isbn group ids but are used by amazon as numeric identifiers (asin)
return return_result (false, cfg.err_msg_supl.group); -- fail if isbn-10 begins with 630/1
end
return return_result (true, cfg.err_msg_supl.check); -- pass if isbn-10 is numerically valid
else
if id:match ('^%d+$') == nil then
return return_result (false, cfg.err_msg_supl.char); -- fail if ISBN-13 is not all digits
end
if id:match ('^97[89]%d*$') == nil then
return return_result (false, cfg.err_msg_supl.prefix); -- fail when ISBN-13 does not begin with 978 or 979
end
if id:match ('^9790') then
return return_result (false, cfg.err_msg_supl.group); -- group identifier '0' is reserved to ISMN
end
return return_result (is_valid_isxn_13 (id), cfg.err_msg_supl.check);
end
end
--[[--------------------------< A S I N >----------------------------------------------------------------------
Formats a link to Amazon. Do simple error checking: ASIN must be mix of 10 numeric or uppercase alpha
characters. If a mix, first character must be uppercase alpha; if all numeric, ASINs must be 10-digit
ISBN. If 10-digit ISBN, add a maintenance category so a bot or AWB script can replace |asin= with |isbn=.
Error message if not 10 characters, if not ISBN-10, if mixed and first character is a digit.
|asin=630....... and |asin=631....... are (apparently) not a legitimate ISBN though it checksums as one; these
do not cause this function to emit the maint_asin message
This function is positioned here because it calls isbn()
]]
local function asin (options)
local id = options.id;
local domain = options.ASINTLD;
local err_flag = nil; -- must be explicitly initialized
if not id:match("^[%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u]$") then
err_flag = set_message ('err_bad_asin'); -- ASIN is not a mix of 10 uppercase alpha and numeric characters
else
if id:match("^%d%d%d%d%d%d%d%d%d[%dX]$") then -- if 10-digit numeric (or 9 digits with terminal X)
if is_valid_isxn (id, 10) then -- see if ASIN value is or validates as ISBN-10
if not id:find ('^63[01]') then -- 630xxxxxxx and 631xxxxxxx are (apparently) not a valid isbn prefixes but are used by amazon as a numeric identifier
err_flag = set_message ('err_bad_asin'); -- ASIN has ISBN-10 form but begins with something other than 630/1 so probably an isbn
end
elseif not is_set (err_flag) then
err_flag = set_message ('err_bad_asin'); -- ASIN is not ISBN-10
end
elseif not id:match("^%u[%d%u]+$") then
err_flag = set_message ('err_bad_asin'); -- asin doesn't begin with uppercase alpha
end
end
if (not is_set (domain)) or in_array (domain, {'us'}) then -- default: United States
domain = "com";
elseif in_array (domain, {'jp', 'uk', 'za'}) then -- Japan, United Kingdom, South Africa
domain = "co." .. domain;
elseif in_array (domain, {'z.cn'}) then -- China
domain = "cn";
elseif in_array (domain, {'au', 'be', 'br', 'mx', 'sg', 'tr'}) then -- Australia, Belgium, Brazil, Mexico, Singapore, Turkey
domain = "com." .. domain;
elseif not in_array (domain, {'ae', 'ca', 'cn', 'de', 'eg', 'es', 'fr', 'ie', 'in', 'it', 'nl', 'pl', 'sa', 'se', 'co.jp', 'co.uk', 'com', 'com.au', 'com.br', 'com.mx', 'com.sg', 'com.tr'}) then -- Arabic Emirates, Canada, China, Germany, Egypt, Spain, France, Ireland, Indonesia, Italy, Netherlands, Poland, Saudi Arabia, Sweden (as of 2021-03 Austria (.at), Liechtenstein (.li) and Switzerland (.ch) still redirect to the German site (.de) with special settings, so don't maintain local ASINs for them)
err_flag = set_message ('err_bad_asin_tld'); -- unsupported asin-tld value
end
local handler = options.handler;
if not is_set (err_flag) then
options.coins_list_t['ASIN'] = handler.prefix .. domain .. "/dp/" .. id; -- asin for coins
else
options.coins_list_t['ASIN'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix .. domain .. "/dp/",
id = id, encode = handler.encode, separator = handler.separator})
end
--[[--------------------------< I S M N >----------------------------------------------------------------------
Determines whether an ISMN string is valid. Similar to ISBN-13, ISMN is 13 digits beginning 979-0-... and uses the
same check digit calculations. See https://www.ismn-international.org/download/Web_ISMN_Users_Manual_2008-6.pdf
section 2, pages 9–12.
ismn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)
or an identifier registered at info-uri.info (info:)
]]
local function ismn (options)
local id = options.id;
local handler = options.handler;
local text;
local valid_ismn;
local id_copy;
id_copy = id; -- save a copy because this testing is destructive
id = id:gsub ('[%s-]', ''); -- remove hyphens and white space
if 13 ~= id:len() or id:match ("^9790%d*$" ) == nil then -- ISMN must be 13 digits and begin with 9790
valid_ismn = false;
else
valid_ismn=is_valid_isxn_13 (id); -- validate ISMN
end
-- text = internal_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, -- use this (or external version) when there is some place to link to
-- prefix = handler.prefix, id = id_copy, separator = handler.separator, encode = handler.encode})
text = table.concat ( -- because no place to link to yet
{
make_wikilink (label_link_make (handler), handler.label),
handler.separator,
id_copy
});
if false == valid_ismn then
options.coins_list_t['ISMN'] = nil; -- when error, unset so not included in COinS; not really necessary here because ismn not made part of COinS
set_message ('err_bad_ismn'); -- create an error message if the ISMN is invalid
end
return text;
end
--[[--------------------------< I S S N >----------------------------------------------------------------------
Validate and format an ISSN. This code fixes the case where an editor has included an ISSN in the citation but
has separated the two groups of four digits with a space. When that condition occurred, the resulting link looked
like this:
|issn=0819 4327 gives: [https://www.worldcat.org/issn/0819 4327 0819 4327] -- can't have spaces in an external link
This code now prevents that by inserting a hyphen at the ISSN midpoint. It also validates the ISSN for length
and makes sure that the checkdigit agrees with the calculated value. Incorrect length (8 digits), characters
other than 0-9 and X, or checkdigit / calculated value mismatch will all cause a check ISSN error message. The
ISSN is always displayed with a hyphen, even if the ISSN was given as a single group of 8 digits.
]]
local function issn (options)
local id = options.id;
local handler = options.handler;
local ignore_invalid = options.accept;
local issn_copy = id; -- save a copy of unadulterated ISSN; use this version for display if ISSN does not validate
local text;
local valid_issn;
id = id:gsub ('[%s-]', ''); -- remove hyphens and whitespace
if 8 ~= id:len() or nil == id:match ("^%d*X?$" ) then -- validate the ISSN: 8 digits long, containing only 0-9 or X in the last position
valid_issn = false; -- wrong length or improper character
else
valid_issn = is_valid_isxn (id, 8); -- validate ISSN
end
if true == valid_issn then
id = string.sub (id, 1, 4 ) .. "-" .. string.sub (id, 5 ); -- if valid, display correctly formatted version
else
id = issn_copy; -- if not valid, show the invalid ISSN with error message
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})
if ignore_invalid then
set_message ('maint_issn_ignore');
else
if false == valid_issn then
options.coins_list_t['ISSN'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_issn', (options.hkey == 'EISSN') and 'e' or ''); -- create an error message if the ISSN is invalid
end
end
return text;
end
--[[--------------------------< J F M >-----------------------------------------------------------------------
A numerical identifier in the form nn.nnnn.nn
]]
local function jfm (options)
local id = options.id;
local handler = options.handler;
local id_num;
id_num = id:match ('^[Jj][Ff][Mm](.*)$'); -- identifier with jfm prefix; extract identifier
if is_set (id_num) then
set_message ('maint_jfm_format');
else -- plain number without JFM prefix
id_num = id; -- if here id does not have prefix
end
if id_num and id_num:match('^%d%d%.%d%d%d%d%.%d%d$') then
id = id_num; -- jfm matches pattern
else
set_message ('err_bad_jfm' ); -- set an error message
options.coins_list_t['JFM'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< J S T O R >--------------------------------------------------------------------
Format a JSTOR with some error checking
]]
local function jstor (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
if id:find ('[Jj][Ss][Tt][Oo][Rr]') or id:find ('^https?://') or id:find ('%s') then
set_message ('err_bad_jstor'); -- set an error message
options.coins_list_t['JSTOR'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
end
--[[--------------------------< L C C N >----------------------------------------------------------------------
Format LCCN link and do simple error checking. LCCN is a character string 8-12 characters long. The length of
the LCCN dictates the character type of the first 1-3 characters; the rightmost eight are always digits.
https://oclc-research.github.io/infoURI-Frozen/info-uri.info/info:lccn/reg.html
length = 8 then all digits
length = 9 then lccn[1] is lowercase alpha
length = 10 then lccn[1] and lccn[2] are both lowercase alpha or both digits
length = 11 then lccn[1] is lower case alpha, lccn[2] and lccn[3] are both lowercase alpha or both digits
length = 12 then lccn[1] and lccn[2] are both lowercase alpha
]]
local function lccn (options)
local id = options.id; -- local copy of the LCCN
local lccn_id = id;
local handler = options.handler;
local err_flag; -- presume that LCCN is valid
id = normalize_lccn (id); -- get canonical form (no whitespace, hyphens, forward slashes)
local len = id:len(); -- get the length of the LCCN
if 8 == len then
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits)
err_flag = set_message ('err_bad_lccn'); -- set an error message
end
elseif 9 == len then -- LCCN should be adddddddd
if nil == id:match("%l%d%d%d%d%d%d%d%d") then -- does it match our pattern?
err_flag = set_message ('err_bad_lccn'); -- set an error message
end
elseif 10 == len then -- LCCN should be aadddddddd or dddddddddd
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits) ...
if nil == id:match("^%l%l%d%d%d%d%d%d%d%d") then -- ... see if it matches our pattern
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
end
elseif 11 == len then -- LCCN should be aaadddddddd or adddddddddd
if not (id:match("^%l%l%l%d%d%d%d%d%d%d%d") or id:match("^%l%d%d%d%d%d%d%d%d%d%d")) then -- see if it matches one of our patterns
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
elseif 12 == len then -- LCCN should be aadddddddddd
if not id:match("^%l%l%d%d%d%d%d%d%d%d%d%d") then -- see if it matches our pattern
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
else
err_flag = set_message ('err_bad_lccn'); -- wrong length, set an error message
end
if not is_set (err_flag) and nil ~= lccn_id:find ('%s') then
err_flag = set_message ('err_bad_lccn'); -- lccn contains a space, set an error message
end
if is_set (err_flag) then
options.coins_list_t['LCCN'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = lccn_id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< M E D R X I V >-----------------------------------------------------------------
Format medRxiv ID and do simple error checking. Similar to later bioRxiv IDs, medRxiv IDs are prefixed with a
yyyy.mm.dd. date and suffixed with an optional version identifier. Ealiest date accepted is 2020.01.01
The medRxiv ID is a date followed by an eight-digit number followed by an optional version indicator 'v' and one or more digits:
https://www.medrxiv.org/content/10.1101/2020.11.16.20232009v2 -> 10.1101/2020.11.16.20232009v2
]]
local function medrxiv (options)
local id = options.id;
local handler = options.handler;
local err_msg_flag = true; -- flag; assume that there will be an error
local patterns = {
'^%d%d%d%d%d%d%d%d$', -- simple 8-digit identifier; these should be relatively rare
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%dv%d+$', -- y.m.d. date + 8-digit identifier + version (2020-01-01 and later)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%d$', -- y.m.d. date + 8-digit identifier (2020-01-01 and later)
'^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%dv%d+$', -- y.m.d. date + 8-digit identifier + version (2025-12-01 and later)
'^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%d$', -- y.m.d. date + 8-digit identifier (2025-12-01 and later)
}
for _, pattern in ipairs (patterns) do -- spin through the patterns looking for a match
if id:match (pattern) then
local y, m, d = id:match (pattern); -- found a match, attempt to get year, month and date from the identifier
if m then -- m is nil when id is the 8-digit form
if not is_valid_rxiv_date (y, m, d, 'b') then -- validate the encoded date; 'b' for medrxiv limit
break; -- date fail; break out early so we don't unset the error message
end
end
err_msg_flag = nil; -- we found a match so unset the error message
break; -- and done
end
end -- <err_msg_flag> remains set here when no match
if err_msg_flag then
options.coins_list_t['MEDRXIV'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_medrxiv'); -- and set the error message
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator,
encode = handler.encode, access = handler.access});
end
--[[--------------------------< M R >--------------------------------------------------------------------------
A seven digit number; if not seven digits, zero-fill leading digits to make seven digits.
]]
local function mr (options)
local id = options.id;
local handler = options.handler;
local id_num;
local id_len;
id_num = id:match ('^[Mm][Rr](%d+)$'); -- identifier with mr prefix
if is_set (id_num) then
set_message ('maint_mr_format'); -- add maint cat
else -- plain number without mr prefix
id_num = id:match ('^%d+$'); -- if here id is all digits
end
id_len = id_num and id_num:len() or 0;
if (7 >= id_len) and (0 ~= id_len) then
id = string.rep ('0', 7-id_len) .. id_num; -- zero-fill leading digits
else
set_message ('err_bad_mr'); -- set an error message
options.coins_list_t['MR'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< O C L C >----------------------------------------------------------------------
Validate and format an OCLC ID. https://www.oclc.org/batchload/controlnumber.en.html {{dead link}}
archived at: https://web.archive.org/web/20161228233804/https://www.oclc.org/batchload/controlnumber.en.html
]]
local function oclc (options)
local id = options.id;
local handler = options.handler;
local number;
if id:match('^ocm%d%d%d%d%d%d%d%d$') then -- ocm prefix and 8 digits; 001 field (12 characters)
number = id:match('ocm(%d+)'); -- get the number
elseif id:match('^ocn%d%d%d%d%d%d%d%d%d$') then -- ocn prefix and 9 digits; 001 field (12 characters)
number = id:match('ocn(%d+)'); -- get the number
elseif id:match('^on%d%d%d%d%d%d%d%d%d%d+$') then -- on prefix and 10 or more digits; 001 field (12 characters)
number = id:match('^on(%d%d%d%d%d%d%d%d%d%d+)$'); -- get the number
elseif id:match('^%(OCoLC%)[1-9]%d*$') then -- (OCoLC) prefix and variable number digits; no leading zeros; 035 field
number = id:match('%(OCoLC%)([1-9]%d*)'); -- get the number
if 9 < number:len() then
number = nil; -- constrain to 1 to 9 digits; change this when OCLC issues 10-digit numbers
end
elseif id:match('^%d+$') then -- no prefix
number = id; -- get the number
if tonumber (id) > handler.id_limit then
number = nil; -- unset when id value exceeds the limit
end
end
if number then -- proper format
id = number; -- exclude prefix, if any, from external link
else
set_message ('err_bad_oclc') -- add an error message if the id is malformed
options.coins_list_t['OCLC'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< O P E N L I B R A R Y >--------------------------------------------------------
Formats an OpenLibrary link, and checks for associated errors.
]]
local function openlibrary (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local ident, code = id:gsub('^OL', ''):match("^(%d+([AMW]))$"); -- strip optional OL prefix followed immediately by digits followed by 'A', 'M', or 'W';
local err_flag;
local prefix = { -- these are appended to the handler.prefix according to code
['A']='authors/OL',
['M']='books/OL',
['W']='works/OL',
['X']='OL' -- not a code; spoof when 'code' in id is invalid
};
if not ident then
code = 'X'; -- no code or id completely invalid
ident = id; -- copy id to ident so that we display the flawed identifier
err_flag = set_message ('err_bad_ol');
end
if not is_set (err_flag) then
options.coins_list_t['OL'] = handler.prefix .. prefix[code] .. ident; -- experiment for ol coins
else
options.coins_list_t['OL'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix .. prefix[code],
id = ident, separator = handler.separator, encode = handler.encode,
access = access});
end
--[[--------------------------< O S T I >----------------------------------------------------------------------
Format OSTI and do simple error checking. OSTIs are sequential numbers beginning at 1 and counting up. This
code checks the OSTI to see that it contains only digits and is less than test_limit specified in the configuration;
the value in test_limit will need to be updated periodically as more OSTIs are issued.
NB. 1018 is the lowest OSTI number found in the wild (so far) and resolving OK on the OSTI site
]]
local function osti (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
if id:match("[^%d]") then -- if OSTI has anything but digits
set_message ('err_bad_osti'); -- set an error message
options.coins_list_t['OSTI'] = nil; -- when error, unset so not included in COinS
else -- OSTI is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1018 > id_num or handler.id_limit < id_num then -- if OSTI is outside test limit boundaries
set_message ('err_bad_osti'); -- set an error message
options.coins_list_t['OSTI'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
end
--[[--------------------------< P M C >------------------------------------------------------------------------
Format a PMC, do simple error checking, and check for embargoed articles.
The embargo parameter takes a date for a value. If the embargo date is in the future the PMC identifier will not
be linked to the article. If the embargo date is today or in the past, or if it is empty or omitted, then the
PMC identifier is linked to the article through the link at cfg.id_handlers['PMC'].prefix.
PMC embargo date testing is done in function is_embargoed () which is called earlier because when the citation
has |pmc=<value> but does not have a |url= then |title= is linked with the PMC link. Function is_embargoed ()
returns the embargo date if the PMC article is still embargoed, otherwise it returns an empty string.
PMCs are sequential numbers beginning at 1 and counting up. This code checks the PMC to see that it contains only digits and is less
than test_limit; the value in local variable test_limit will need to be updated periodically as more PMCs are issued.
]]
local function pmc (options)
local id = options.id;
local embargo = options.Embargo; -- TODO: lowercase?
local handler = options.handler;
local err_flag;
local id_num;
local text;
id_num = id:match ('^[Pp][Mm][Cc](%d+)$'); -- identifier with PMC prefix
if is_set (id_num) then
set_message ('maint_pmc_format');
else -- plain number without PMC prefix
id_num = id:match ('^%d+$'); -- if here id is all digits
end
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if PMC is outside test limit boundaries
err_flag = set_message ('err_bad_pmc'); -- set an error message
else
id = tostring (id_num); -- make sure id is a string
end
else -- when id format incorrect
err_flag = set_message ('err_bad_pmc'); -- set an error message
end
if is_set (embargo) and is_set (is_embargoed (embargo)) then -- is PMC is still embargoed?
text = table.concat ( -- still embargoed so no external link
{
make_wikilink (label_link_make (handler), handler.label),
handler.separator,
id,
});
else
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, -- no embargo date or embargo has expired, ok to link to article
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access,
auto_link = not err_flag and 'pmc' or nil -- do not auto-link when PMC has error
});
end
if err_flag then
options.coins_list_t['PMC'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< P M I D >----------------------------------------------------------------------
Format PMID and do simple error checking. PMIDs are sequential numbers beginning at 1 and counting up. This
code checks the PMID to see that it contains only digits and is less than test_limit; the value in local variable
test_limit will need to be updated periodically as more PMIDs are issued.
]]
local function pmid (options)
local id = options.id;
local handler = options.handler;
if id:match("[^%d]") then -- if PMID has anything but digits
set_message ('err_bad_pmid'); -- set an error message
options.coins_list_t['PMID'] = nil; -- when error, unset so not included in COinS
else -- PMID is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if PMID is outside test limit boundaries
set_message ('err_bad_pmid'); -- set an error message
options.coins_list_t['PMID'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< R F C >------------------------------------------------------------------------
Format RFC and do simple error checking. RFCs are sequential numbers beginning at 1 and counting up. This
code checks the RFC to see that it contains only digits and is less than test_limit specified in the configuration;
the value in test_limit will need to be updated periodically as more RFCs are issued.
An index of all RFCs is here: https://tools.ietf.org/rfc/
]]
local function rfc (options)
local id = options.id;
local handler = options.handler;
if id:match("[^%d]") then -- if RFC has anything but digits
set_message ('err_bad_rfc'); -- set an error message
options.coins_list_t['RFC'] = nil; -- when error, unset so not included in COinS
else -- RFC is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if RFC is outside test limit boundaries
set_message ('err_bad_rfc'); -- set an error message
options.coins_list_t['RFC'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});
end
--[[--------------------------< S 2 C I D >--------------------------------------------------------------------
Format an S2CID, do simple error checking
S2CIDs are sequential numbers beginning at 1 and counting up. This code checks the S2CID to see that it is only
digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically
as more S2CIDs are issued.
]]
local function s2cid (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local id_num;
local text;
id_num = id:match ('^[1-9]%d*$'); -- id must be all digits; must not begin with 0; no open access flag
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if handler.id_limit < id_num then -- if S2CID is outside test limit boundaries
set_message ('err_bad_s2cid'); -- set an error message
options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS
end
else -- when id format incorrect
set_message ('err_bad_s2cid'); -- set an error message
options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
return text;
end
--[[--------------------------< S B N >------------------------------------------------------------------------
9-digit form of ISBN-10; uses same check-digit validation when SBN is prefixed with an additional '0' to make 10 digits
sbn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)
or an identifier registered at info-uri.info (info:)
]]
local function sbn (options)
local id = options.id;
local ignore_invalid = options.accept;
local handler = options.handler;
local function return_result (check, err_type) -- local function to handle the various returns
local SBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator});
if not ignore_invalid then -- if not ignoring SBN errors
if not check then
options.coins_list_t['SBN'] = nil; -- when error, unset so not included in COinS; not really necessary here because sbn not made part of COinS
set_message ('err_bad_sbn', {err_type}); -- display an error message
return SBN;
end
else
set_message ('maint_isbn_ignore'); -- add a maint category even when there is no error (ToDo: Possibly switch to separate message for SBNs only)
end
return SBN;
end
if id:match ('[^%s-0-9X]') then
return return_result (false, cfg.err_msg_supl.char); -- fail if SBN contains anything but digits, hyphens, or the uppercase X
end
local ident = id:gsub ('[%s-]', ''); -- remove hyphens and whitespace; they interfere with the rest of the tests
if 9 ~= ident:len() then
return return_result (false, cfg.err_msg_supl.length); -- fail if incorrect length
end
if ident:match ('^%d*X?$') == nil then
return return_result (false, cfg.err_msg_supl.form); -- fail if SBN has 'X' anywhere but last position
end
return return_result (is_valid_isxn ('0' .. ident, 10), cfg.err_msg_supl.check);
end
--[[--------------------------< S S R N >----------------------------------------------------------------------
Format an SSRN, do simple error checking
SSRNs are sequential numbers beginning at 100? and counting up. This code checks the SSRN to see that it is
only digits and is greater than 99 and less than test_limit; the value in local variable test_limit will need
to be updated periodically as more SSRNs are issued.
]]
local function ssrn (options)
local id = options.id;
local handler = options.handler;
local id_num;
local text;
id_num = id:match ('^%d+$'); -- id must be all digits
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if 100 > id_num or handler.id_limit < id_num then -- if SSRN is outside test limit boundaries
set_message ('err_bad_ssrn'); -- set an error message
options.coins_list_t['SSRN'] = nil; -- when error, unset so not included in COinS
end
else -- when id format incorrect
set_message ('err_bad_ssrn'); -- set an error message
options.coins_list_t['SSRN'] = nil; -- when error, unset so not included in COinS
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = options.access});
return text;
end
--[[--------------------------< U S E N E T _ I D >------------------------------------------------------------
Validate and format a usenet message id. Simple error checking, looks for 'id-left@id-right' not enclosed in
'<' and/or '>' angle brackets.
]]
local function usenet_id (options)
local id = options.id;
local handler = options.handler;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})
if not id:match('^.+@.+$') or not id:match('^[^<].*[^>]$') then -- doesn't have '@' or has one or first or last character is '< or '>'
set_message ('err_bad_usenet_id') -- add an error message if the message id is invalid
options.coins_list_t['USENETID'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< Z B L >-----------------------------------------------------------------------
A numerical identifier in the form nnnn.nnnnn - leading zeros in the first quartet optional
format described here: http://emis.mi.sanu.ac.rs/ZMATH/zmath/en/help/search/
temporary format is apparently eight digits. Anything else is an error
]]
local function zbl (options)
local id = options.id;
local handler = options.handler;
if id:match('^%d%d%d%d%d%d%d%d$') then -- is this identifier using temporary format?
set_message ('maint_zbl'); -- yes, add maint cat
elseif not id:match('^%d?%d?%d?%d%.%d%d%d%d%d$') then -- not temporary, is it normal format?
set_message ('err_bad_zbl'); -- no, set an error message
options.coins_list_t['ZBL'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--============================<< I N T E R F A C E F U N C T I O N S >>==========================================
--[[--------------------------< E X T R A C T _ I D S >------------------------------------------------------------
Populates ID table from arguments using configuration settings. Loops through cfg.id_handlers and searches args for
any of the parameters listed in each cfg.id_handlers['...'].parameters. If found, adds the parameter and value to
the identifier list. Emits redundant error message if more than one alias exists in args
]]
local function extract_ids (args)
local id_list = {}; -- list of identifiers found in args
for k, v in pairs (cfg.id_handlers) do -- k is uppercase identifier name as index to cfg.id_handlers; e.g. cfg.id_handlers['ISBN'], v is a table
v = select_one (args, v.parameters, 'err_redundant_parameters' ); -- v.parameters is a table of aliases for k; here we pick one from args if present
if is_set (v) then id_list[k] = v; end -- if found in args, add identifier to our list
end
return id_list;
end
--[[--------------------------< E X T R A C T _ I D _ A C C E S S _ L E V E L S >--------------------------------------
Fetches custom id access levels from arguments using configuration settings. Parameters which have a predefined access
level (e.g. arxiv) do not use this function as they are directly rendered as free without using an additional parameter.
returns a table of k/v pairs where k is same as the identifier's key in cfg.id_handlers and v is the assigned (valid) keyword
access-level values must match the case used in cfg.keywords_lists['id-access'] (lowercase unless there is some special reason for something else)
]]
local function extract_id_access_levels (args, id_list)
local id_accesses_list = {};
for k, v in pairs (cfg.id_handlers) do
local access_param = v.custom_access; -- name of identifier's access-level parameter
if is_set (access_param) then
local access_level = args[access_param]; -- get the assigned value if there is one
if is_set (access_level) then
if not in_array (access_level, cfg.keywords_lists['id-access']) then -- exact match required
set_message ('err_invalid_param_val', {access_param, access_level});
access_level = nil; -- invalid so unset
end
if not is_set (id_list[k]) then -- identifier access-level must have a matching identifier
set_message ('err_param_access_requires_param', {k:lower()}); -- parameter name is uppercase in cfg.id_handlers (k); lowercase for error message
end
id_accesses_list[k] = cfg.keywords_xlate[access_level]; -- get translated keyword
end
end
end
return id_accesses_list;
end
--[[--------------------------< B U I L D _ I D _ L I S T >----------------------------------------------------
render the identifiers into a sorted sequence table
<ID_list_coins_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value
<options_t> is a table of various k/v option pairs provided in the call to new_build_id_list();
modified by this function and passed to all identifier rendering functions
<access_levels_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value (if valid)
returns a sequence table of sorted (by hkey - 'handler' key) rendered identifier strings
]]
local function build_id_list (ID_list_coins_t, options_t, access_levels_t)
local ID_list_t = {};
local accept;
local func_map = { --function map points to functions associated with hkey identifier
['ARXIV'] = arxiv,
['ASIN'] = asin,
['BIBCODE'] = bibcode,
['BIORXIV'] = biorxiv,
['CITESEERX'] = citeseerx,
['DOI'] = doi,
['EISSN'] = issn,
['HDL'] = hdl,
['ISBN'] = isbn,
['ISMN'] = ismn,
['ISSN'] = issn,
['JFM'] = jfm,
['JSTOR'] = jstor,
['LCCN'] = lccn,
['MEDRXIV'] = medrxiv,
['MR'] = mr,
['OCLC'] = oclc,
['OL'] = openlibrary,
['OSTI'] = osti,
['PMC'] = pmc,
['PMID'] = pmid,
['RFC'] = rfc,
['S2CID'] = s2cid,
['SBN'] = sbn,
['SSRN'] = ssrn,
['USENETID'] = usenet_id,
['ZBL'] = zbl,
}
for hkey, v in pairs (ID_list_coins_t) do
v, accept = has_accept_as_written (v); -- remove accept-as-written markup if present; accept is boolean true when markup removed; false else
-- every function gets the options table with value v and accept boolean
options_t.hkey = hkey; -- ~/Configuration handler key
options_t.id = v; -- add that identifier value to the options table
options_t.accept = accept; -- add the accept boolean flag
options_t.access = access_levels_t[hkey]; -- add the access level for those that have an |<identifier-access= parameter
options_t.handler = cfg.id_handlers[hkey];
options_t.coins_list_t = ID_list_coins_t; -- pointer to ID_list_coins_t; for |asin= and |ol=; also to keep erroneous values out of the citation's metadata
options_t.coins_list_t[hkey] = v; -- id value without accept-as-written markup for metadata
if options_t.handler.access and not in_array (options_t.handler.access, cfg.keywords_lists['id-access']) then
error (cfg.messages['unknown_ID_access'] .. options_t.handler.access); -- here when handler access key set to a value not listed in list of allowed id access keywords
end
if func_map[hkey] then
local id_text = func_map[hkey] (options_t); -- call the function to get identifier text and any error message
table.insert (ID_list_t, {hkey, id_text}); -- add identifier text to the output sequence table
else
error (cfg.messages['unknown_ID_key'] .. hkey); -- here when func_map doesn't have a function for hkey
end
end
local function comp (a, b) -- used by following table.sort()
return a[1]:lower() < b[1]:lower(); -- sort by hkey
end
table.sort (ID_list_t, comp); -- sequence table of tables sort
for k, v in ipairs (ID_list_t) do -- convert sequence table of tables to simple sequence table of strings
ID_list_t[k] = v[2]; -- v[2] is the identifier rendering from the call to the various functions in func_map{}
end
return ID_list_t;
end
--[[--------------------------< O P T I O N S _ C H E C K >----------------------------------------------------
check that certain option parameters have their associated identifier parameters with values
<ID_list_coins_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value
<ID_support_t> is a sequence table of tables created in citation0() where each subtable has four elements:
[1] is the support parameter's assigned value; empty string if not set
[2] is a text string same as key in cfg.id_handlers
[3] is cfg.error_conditions key used to create error message
[4] is original ID support parameter name used to create error message
returns nothing; on error emits an appropriate error message
]]
local function options_check (ID_list_coins_t, ID_support_t)
for _, v in ipairs (ID_support_t) do
if is_set (v[1]) and not ID_list_coins_t[v[2]] then -- when support parameter has a value but matching identifier parameter is missing or empty
set_message (v[3], (v[4])); -- emit the appropriate error message
end
end
end
--[[--------------------------< I D E N T I F I E R _ L I S T S _ G E T >--------------------------------------
Creates two identifier lists: a k/v table of identifiers and their values to be used locally and for use in the
COinS metadata, and a sequence table of the rendered identifier strings that will be included in the rendered
citation.
]]
local function identifier_lists_get (args_t, options_t, ID_support_t)
local ID_list_coins_t = extract_ids (args_t); -- get a table of identifiers and their values for use locally and for use in COinS
options_check (ID_list_coins_t, ID_support_t); -- ID support parameters must have matching identifier parameters
local ID_access_levels_t = extract_id_access_levels (args_t, ID_list_coins_t); -- get a table of identifier access levels
local ID_list_t = build_id_list (ID_list_coins_t, options_t, ID_access_levels_t); -- get a sequence table of rendered identifier strings
return ID_list_t, ID_list_coins_t; -- return the tables
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
cfg = cfg_table_ptr;
has_accept_as_written = utilities_page_ptr.has_accept_as_written; -- import functions from select Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
set_message = utilities_page_ptr.set_message;
select_one = utilities_page_ptr.select_one;
substitute = utilities_page_ptr.substitute;
make_wikilink = utilities_page_ptr.make_wikilink;
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
auto_link_urls = auto_link_urls, -- table of identifier URLs to be used when auto-linking |title=
identifier_lists_get = identifier_lists_get, -- experiment to replace individual calls to build_id_list(), extract_ids, extract_id_access_levels
is_embargoed = is_embargoed;
set_selected_modules = set_selected_modules;
}
5bj1u7sbno5vyrz0hztvhaip3uwhy2w
74997
74996
2026-08-24T00:44:39Z
Robertsky
10424
1 versaun husi [[:en:Module:Citation/CS1/Identifiers]]
74996
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local has_accept_as_written, is_set, in_array, set_message, select_one, -- functions in Module:Citation/CS1/Utilities
substitute, make_wikilink;
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
--[[--------------------------< P A G E S C O P E V A R I A B L E S >--------------------------------------
declare variables here that have page-wide scope that are not brought in from other modules; that are created here and used here
]]
local auto_link_urls = {}; -- holds identifier URLs for those identifiers that can auto-link |title=
--============================<< H E L P E R F U N C T I O N S >>============================================
--[[--------------------------< W I K I D A T A _ A R T I C L E _ N A M E _ G E T >----------------------------
as an aid to internationalizing identifier-label wikilinks, gets identifier article names from Wikidata.
returns w:<lang code>:<article title> when <q> has an <article title> for <lang code>; nil else. 'w:<lang code>'
ensures that sister project (like wiktionary) will link to the <lang code>.wikipedia article.
for identifiers that do not have <q>, returns nil
for wikis that do not have mw.wikibase installed, returns nil
]]
local function wikidata_article_name_get (q)
if not is_set (q) or (q and not mw.wikibase) then -- when no q number or when a q number but mw.wikibase not installed on this wiki
return nil; -- abandon
end
local wd_article;
local this_wiki_code = cfg.this_wiki_code; -- Wikipedia subdomain; 'en' for en.wikipedia.org
wd_article = mw.wikibase.getSitelink (q, this_wiki_code .. 'wiki'); -- fetch article title from WD; nil when no title available at this wiki
if wd_article then
wd_article = table.concat ({'w:', this_wiki_code, ':', wd_article}); -- interwiki-style link without brackets if taken from WD; leading 'w:' required
end
return wd_article; -- article title from WD; nil else
end
--[[--------------------------< L A B E L _ L I N K _ M A K E >------------------------------------------------
common function to create a link for an identifier label from handler table or from Wikidata
returns the first available of:
1. redirect from local wiki's handler table (if enabled)
2. Wikidata sitelink to the local language wikipedia article (if there is a Wikidata entry for this identifier in the local language)
3. link to wikipedia article specified in the local wiki's handler table
]]
local function label_link_make (handler)
local wd_article;
if not (cfg.use_identifier_redirects and is_set (handler.redirect)) then -- redirect has priority so if enabled and available don't fetch from Wikidata because expensive
wd_article = wikidata_article_name_get (handler.q); -- if Wikidata has an article title for this wiki, get it;
end
return (cfg.use_identifier_redirects and is_set (handler.redirect) and handler.redirect) or wd_article or handler.link;
end
--[[--------------------------< E X T E R N A L _ L I N K _ I D >----------------------------------------------
Formats a wiki-style external link
]]
local function external_link_id (options)
local url_string = options.id;
local ext_link;
if options.encode == true or options.encode == nil then
url_string = mw.uri.encode (url_string, 'PATH');
end
if options.auto_link and is_set (options.access) then
auto_link_urls[options.auto_link] = table.concat ({options.prefix, url_string, options.suffix});
end
ext_link = mw.ustring.format ('[%s%s%s %s]', options.prefix, url_string, options.suffix or "", mw.text.nowiki (options.id));
if is_set (options.access) then
ext_link = substitute (cfg.presentation['ext-link-access-signal'], {cfg.presentation[options.access].class, cfg.presentation[options.access].title, ext_link}); -- add the free-to-read / paywall lock
end
return table.concat ({
make_wikilink (label_link_make (options), options.label), -- redirect, Wikidata link, or locally specified link (in that order)
options.separator or ' ',
ext_link
});
end
--[[--------------------------< I N T E R N A L _ L I N K _ I D >----------------------------------------------
Formats a wiki-style internal link
TODO: Does not currently need to support options.access, options.encode, auto-linking and COinS (as in external_link_id),
but may be needed in the future for :m:Interwiki_map custom-prefixes like :arxiv:, :bibcode:, :DOI:, :hdl:, :ISSN:,
:JSTOR:, :Openlibrary:, :PMID:, :RFC:.
]]
local function internal_link_id (options)
local id = mw.ustring.gsub (options.id, '%d', cfg.date_names.local_digits); -- translate 'local' digits to Western 0-9
return table.concat (
{
make_wikilink (label_link_make (options), options.label), -- wiki-link the identifier label
options.separator or ' ', -- add the separator
make_wikilink (
table.concat (
{
options.prefix,
id, -- translated to Western digits
options.suffix or ''
}),
substitute (cfg.presentation['bdi'], {'', mw.text.nowiki (options.id)}) -- bdi tags to prevent Latin script identifiers from being reversed at RTL language wikis
); -- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?
});
end
--[[--------------------------< I S _ E M B A R G O E D >------------------------------------------------------
Determines if a PMC identifier's online version is embargoed. Compares the date in |pmc-embargo-date= against
today's date. If embargo date is in the future, returns the content of |pmc-embargo-date=; otherwise, returns
an empty string because the embargo has expired or because |pmc-embargo-date= was not set in this cite.
]]
local function is_embargoed (embargo)
if is_set (embargo) then
local lang = mw.getContentLanguage();
local good1, embargo_date, todays_date;
good1, embargo_date = pcall (lang.formatDate, lang, 'U', embargo);
todays_date = lang:formatDate ('U');
if good1 then -- if embargo date is a good date
if tonumber (embargo_date) >= tonumber (todays_date) then -- is embargo date is in the future?
return embargo; -- still embargoed
else
set_message ('maint_pmc_embargo'); -- embargo has expired; add main cat
return ''; -- unset because embargo has expired
end
end
end
return ''; -- |pmc-embargo-date= not set return empty string
end
--[=[-------------------------< I S _ V A L I D _ R X I V _ D A T E >------------------------------------------
for biorxiv, returns true if:
2019-12-11T00:00Z <= biorxiv_date < today + 2 days
for medrxiv, returns true if:
2020-01-01T00:00Z <= medrxiv_date < today + 2 days
The dated form of biorxiv identifier has a start date of 2019-12-11. The Unix timestamp for that date is {{#time:U|2019-12-11}} = 1576022400
The medrxiv identifier has a start date of 2020-01-01. The Unix timestamp for that date is {{#time:U|2020-01-01}} = 1577836800
<rxiv_date> is the date provided in those |biorxiv= parameter values that are dated and in |medrxiv= parameter values at time 00:00:00 UTC
<today> is the current date at time 00:00:00 UTC plus 48 hours
if today's date is 2023-01-01T00:00:00 then
adding 24 hours gives 2023-01-02T00:00:00 – one second more than today
adding 24 hours gives 2023-01-03T00:00:00 – one second more than tomorrow
inputs:
<y>, <m>, <d> – year, month, day parts of the date from the birxiv or medrxiv identifier
<select> 'b' for biorxiv, 'm' for medrxiv; defaults to 'b'
]=]
local function is_valid_rxiv_date (y, m, d, select)
if 0 == tonumber (m) and 12 < tonumber (m) then -- <m> must be a number 1–12
return false;
end
if 0 == tonumber (d) and 31 < tonumber (d) then -- <d> must be a number 1–31; TODO: account for month length and leap yer?
return false;
end
local rxiv_date = table.concat ({y, m, d}, '-'); -- make ymd date string
local good1, good2;
local rxiv_ts, tomorrow_ts; -- to hold Unix timestamps representing the dates
local lang_object = mw.getContentLanguage();
good1, rxiv_ts = pcall (lang_object.formatDate, lang_object, 'U', rxiv_date); -- convert rxiv_date value to Unix timestamp
good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, 'U', 'today + 2 days' ); -- today midnight + 2 days is one second more than all day tomorrow
if good1 and good2 then -- lang.formatDate() returns a timestamp in the local script which tonumber() may not understand
rxiv_ts = tonumber (rxiv_ts) or lang_object:parseFormattedNumber (rxiv_ts); -- convert to numbers for the comparison;
tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);
else
return false; -- one or both failed to convert to Unix timestamp
end
local limit_ts = ((select and ('m' == select)) and 1577836800) or 1576022400; -- choose the appropriate limit timesatmp
return ((limit_ts <= rxiv_ts) and (rxiv_ts < tomorrow_ts)) -- limit_ts <= rxiv_date < tomorrow's date
end
--[[--------------------------< IS _ V A L I D _ I S X N >-----------------------------------------------------
ISBN-10 and ISSN validator code calculates checksum across all ISBN/ISSN digits including the check digit.
ISBN-13 is checked in isbn().
If the number is valid the result will be 0. Before calling this function, ISBN/ISSN must be checked for length
and stripped of dashes, spaces and other non-ISxN characters.
]]
local function is_valid_isxn (isxn_str, len)
local temp = 0;
isxn_str = { isxn_str:byte(1, len) }; -- make a table of byte values '0' → 0x30 .. '9' → 0x39, 'X' → 0x58
len = len + 1; -- adjust to be a loop counter
for i, v in ipairs (isxn_str) do -- loop through all of the bytes and calculate the checksum
if v == string.byte ("X" ) then -- if checkdigit is X (compares the byte value of 'X' which is 0x58)
temp = temp + 10 * (len - i); -- it represents 10 decimal
else
temp = temp + tonumber (string.char (v) )*(len-i);
end
end
return temp % 11 == 0; -- returns true if calculation result is zero
end
--[[--------------------------< IS _ V A L I D _ I S X N _ 1 3 >-----------------------------------------------
ISBN-13 and ISMN validator code calculates checksum across all 13 ISBN/ISMN digits including the check digit.
If the number is valid, the result will be 0. Before calling this function, ISBN-13/ISMN must be checked for length
and stripped of dashes, spaces and other non-ISxN-13 characters.
]]
local function is_valid_isxn_13 (isxn_str)
local temp=0;
isxn_str = { isxn_str:byte(1, 13) }; -- make a table of byte values '0' → 0x30 .. '9' → 0x39
for i, v in ipairs (isxn_str) do
temp = temp + (3 - 2*(i % 2)) * tonumber (string.char (v) ); -- multiply odd index digits by 1, even index digits by 3 and sum; includes check digit
end
return temp % 10 == 0; -- sum modulo 10 is zero when ISBN-13/ISMN is correct
end
--[[--------------------------< N O R M A L I Z E _ L C C N >--------------------------------------------------
LCCN normalization (https://www.loc.gov/marc/lccn-namespace.html#normalization)
1. Remove all blanks.
2. If there is a forward slash (/) in the string, remove it, and remove all characters to the right of the forward slash.
3. If there is a hyphen in the string:
a. Remove it.
b. Inspect the substring following (to the right of) the (removed) hyphen. Then (and assuming that steps 1 and 2 have been carried out):
1. All these characters should be digits, and there should be six or less. (not done in this function)
2. If the length of the substring is less than 6, left-fill the substring with zeroes until the length is six.
Returns a normalized LCCN for lccn() to validate. There is no error checking (step 3.b.1) performed in this function.
]]
local function normalize_lccn (lccn)
lccn = lccn:gsub ("%s", ""); -- 1. strip whitespace
if nil ~= string.find (lccn, '/') then
lccn = lccn:match ("(.-)/"); -- 2. remove forward slash and all character to the right of it
end
local prefix
local suffix
prefix, suffix = lccn:match ("(.+)%-(.+)"); -- 3.a remove hyphen by splitting the string into prefix and suffix
if nil ~= suffix then -- if there was a hyphen
suffix = string.rep("0", 6-string.len (suffix)) .. suffix; -- 3.b.2 left fill the suffix with 0s if suffix length less than 6
lccn = prefix..suffix; -- reassemble the LCCN
end
return lccn;
end
--============================<< I D E N T I F I E R F U N C T I O N S >>====================================
--[[--------------------------< A R X I V >--------------------------------------------------------------------
See: https://arxiv.org/help/arxiv_identifier
format and error check arXiv identifier. There are three valid forms of the identifier:
the first form, valid only between date codes 9107 and 0703, is:
arXiv:<archive>.<class>/<date code><number><version>
where:
<archive> is a string of alpha characters - may be hyphenated; no other punctuation
<class> is a string of alpha characters - may be hyphenated; no other punctuation; not the same as |class= parameter which is not supported in this form
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
first digit of YY for this form can only 9 and 0
<number> is a three-digit number
<version> is a 1 or more digit number preceded with a lowercase v; no spaces (undocumented)
the second form, valid from April 2007 through December 2014 is:
arXiv:<date code>.<number><version>
where:
<date code> is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01
<number> is a four-digit number
<version> is a 1 or more digit number preceded with a lowercase v; no spaces
the third form, valid from January 2015 is:
arXiv:<date code>.<number><version>
where:
<date code> and <version> are as defined for 0704-1412
<number> is a five-digit number
]]
local function arxiv (options)
local id = options.id;
local class = options.Class; -- TODO: lowercase?
local handler = options.handler;
local year, month;
local err_msg = false; -- assume no error message
local text; -- output text
if id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%d$") or id:match("^%a[%a%.%-]+/[90]%d[01]%d%d%d%dv%d+$") then -- test for the 9107-0703 format with or without version
year, month = id:match("^%a[%a%.%-]+/([90]%d)([01]%d)%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((not (90 < year or 8 > year)) or (1 > month or 12 < month)) or -- if invalid year or invalid month
((91 == year and 7 > month) or (7 == year and 3 < month)) then -- if years ok, are starting and ending months ok?
err_msg = true; -- flag for error message
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%dv%d+$") then -- test for the 0704-1412 with or without version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((7 > year) or (14 < year) or (1 > month or 12 < month)) or -- is year invalid or is month invalid? (doesn't test for future years)
((7 == year) and (4 > month)) then -- when year is 07, is month invalid (before April)?
err_msg = true; -- flag for error message
end
elseif id:match("^%d%d[01]%d%.%d%d%d%d%d$") or id:match("^%d%d[01]%d%.%d%d%d%d%dv%d+$") then -- test for the 1501- format with or without version
year, month = id:match("^(%d%d)([01]%d)%.%d%d%d%d%d[v%d]*$");
year = tonumber (year);
month = tonumber (month);
if ((15 > year) or (1 > month or 12 < month)) then -- is year invalid or is month invalid? (doesn't test for future years)
err_msg = true; -- flag for error message
end
else
err_msg = true; -- not a recognized format; flag for error message
end
if err_msg then
options.coins_list_t['ARXIV'] = nil; -- when error, unset so not included in COinS
end
if err_msg then
set_message ('err_bad_arxiv');
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});
if is_set (class) then
if id:match ('^%d+') then
text = table.concat ({text, ' [[https://arxiv.org/archive/', class, ' ', class, ']]'}); -- external link within square brackets, not wikilink
else
set_message ('err_class_ignored');
end
else -- class not set
if id:match ('^%d+') and options.CitationClass == 'arxiv' then -- new (post 2007) format; {{cite arxiv}} only
set_message ('maint_missing_class'); -- add maint cat
end
end
return text;
end
--[[--------------------------< B I B C O D E >--------------------------------------------------------------------
Validates (sort of) and formats a bibcode ID.
Format for bibcodes is specified here: https://adsabs.harvard.edu/abs_doc/help_pages/data.html#bibcodes
But, this: 2015arXiv151206696F is apparently valid so apparently, the only things that really matter are length, 19 characters
and first four digits must be a year. This function makes these tests:
length must be 19 characters
characters in position
1–4 must be digits and must represent a year in the range of 1000 – next year
5 must be a letter
6–8 must be letter, digit, ampersand, or dot (ampersand cannot directly precede a dot; &. )
9–18 must be letter, digit, or dot
19 must be a letter or dot
]]
local function bibcode (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local ignore_invalid = options.accept;
local err_type;
local year;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,
access = access});
if 19 ~= id:len() then
err_type = cfg.err_msg_supl.length;
else
year = id:match ("^(%d%d%d%d)[%a][%w&%.][%w&%.][%w&%.][%w.]+[%a%.]$");
if not year then -- if nil then no pattern match
err_type = cfg.err_msg_supl.value; -- so value error
else
local next_year = tonumber (os.date ('%Y')) + 1; -- get the current year as a number and add one for next year
year = tonumber (year); -- convert year portion of bibcode to a number
if (1000 > year) or (year > next_year) then
err_type = cfg.err_msg_supl.year; -- year out of bounds
end
if id:find('&%.') then
err_type = cfg.err_msg_supl.journal; -- journal abbreviation must not have '&.' (if it does it's missing a letter)
end
if id:match ('.........%.tmp%.') then -- temporary bibcodes when positions 10–14 are '.tmp.'
set_message ('maint_bibcode');
end
end
end
if is_set (err_type) and not ignore_invalid then -- if there was an error detected and accept-as-written markup not used
set_message ('err_bad_bibcode', {err_type});
options.coins_list_t['BIBCODE'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< B I O R X I V >-----------------------------------------------------------------
Format bioRxiv ID and do simple error checking. Before 2019-12-11, biorXiv IDs were 10.1101/ followed by exactly
6 digits. After 2019-12-11, biorXiv IDs retained the six-digit identifier but prefixed that with a yyyy.mm.dd.
date and suffixed with an optional version identifier.
From December 2025 biorxiv added a new 'doi' prefix: 10.64898:
10.64898/2025.12.10.693067
The bioRxiv ID is the string of characters:
https://doi.org/10.1101/078733 -> 10.1101/078733
or a date followed by a six-digit number followed by an optional version indicator 'v' and one or more digits:
https://www.biorxiv.org/content/10.1101/2019.12.11.123456v2 -> 10.1101/2019.12.11.123456v2
see https://www.biorxiv.org/about-biorxiv
]]
local function biorxiv (options)
local id = options.id;
local handler = options.handler;
local err_msg = true; -- flag; assume that there will be an error
local patterns = {
'^10%.1101/%d%d%d%d%d%d$', -- simple 6-digit identifier (before 2019-12-11)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%dv%d+$', -- y.m.d. date + 6-digit identifier + version (after 2019-12-11)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d$', -- y.m.d. date + 6-digit identifier (after 2019-12-11)
'^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%dv%d+$', -- y.m.d. date + 6-digit identifier + version (from December 2025)
'^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d$', -- y.m.d. date + 6-digit identifier (from December 2025)
}
for _, pattern in ipairs (patterns) do -- spin through the patterns looking for a match
if id:match (pattern) then
local y, m, d = id:match (pattern); -- found a match, attempt to get year, month and date from the identifier
if m then -- m is nil when id is the six-digit form
if not is_valid_rxiv_date (y, m, d, 'b') then -- validate the encoded date; 'b' for biorxiv limit
break; -- date fail; break out early so we don't unset the error message
end
end
err_msg = nil; -- we found a match so unset the error message
break; -- and done
end
end -- err_cat remains set here when no match
if err_msg then
options.coins_list_t['BIORXIV'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_biorxiv'); -- and set the error message
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator,
encode = handler.encode, access = handler.access});
end
--[[--------------------------< C I T E S E E R X >------------------------------------------------------------
CiteSeerX use their own notion of "doi" (not to be confused with the identifiers resolved via doi.org).
The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure
]]
local function citeseerx (options)
local id = options.id;
local handler = options.handler;
local matched;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,
access = handler.access});
matched = id:match ("^10%.1%.1%.[1-9]%d?%d?%d?%.[1-9]%d?%d?%d?$");
if not matched then
set_message ('err_bad_citeseerx' );
options.coins_list_t['CITESEERX'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< D O I >------------------------------------------------------------------------
Formats a DOI and checks for DOI errors.
DOI names contain two parts: prefix and suffix separated by a forward slash.
Prefix: directory indicator '10.' followed by a registrant code
Suffix: character string of any length chosen by the registrant
This function checks a DOI name for: prefix/suffix. If the DOI name contains spaces or endashes, or, if it ends
with a period or a comma, this function will emit a bad_doi error message.
DOI names are case-insensitive and can incorporate any printable Unicode characters so the test for spaces, endash,
and terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in DOI names.
https://www.doi.org/doi_handbook/2_Numbering.html -- 2.2 Syntax of a DOI name
https://www.doi.org/doi_handbook/2_Numbering.html#2.2.2 -- 2.2.2 DOI prefix
]]
local function doi (options)
local id = options.id;
local inactive = options.DoiBroken
local access = options.access;
local ignore_invalid = options.accept;
local handler = options.handler;
local err_flag; -- error flag for errors that may not be ignored
local ignorable_err_flag; -- error flag for ((ignorable)) errors
local function is_extended_free (registrant, suffix) -- local function to check those few registrants that are mixed; identifiable by the doi suffix <incipit>
suffix = suffix:lower(); -- ascii [a-z] same as [A-Z] in doi names; see §3.4.4 Case Insensitivity of the Doi Name
if cfg.extended_registrants_t[registrant] then -- if this registrant has known free-to-read extentions
for _, incipit in ipairs (cfg.extended_registrants_t[registrant]) do -- loop through the registrant's incipits
if mw.ustring.find (suffix, '^' .. incipit:lower()) then -- ascii [a-z] same as [A-Z] in doi names
return true; -- if found done
end
end
end
end
local text;
if is_set (inactive) then
local inactive_year = inactive:match("%d%d%d%d"); -- try to get the year portion from the inactive date
local inactive_month, good;
if is_set (inactive_year) then
if 4 < inactive:len() then -- inactive date has more than just a year (could be anything)
local lang_obj = mw.getContentLanguage(); -- get a language object for this wiki
good, inactive_month = pcall (lang_obj.formatDate, lang_obj, 'F', inactive); -- try to get the month name from the inactive date
if not good then
inactive_month = nil; -- something went wrong so make sure this is unset
end
end
end -- otherwise, |doi-broken-date= has something but it isn't a date
if is_set (inactive_year) and is_set (inactive_month) then
set_message ('maint_doi_inactive_dated', {inactive_year, inactive_month, ' '});
elseif is_set (inactive_year) then
set_message ('maint_doi_inactive_dated', {inactive_year, '', ''});
else
set_message ('maint_doi_inactive');
end
inactive = substitute (cfg.messages['inactive'], inactive );
end
local registrant, suffix = mw.ustring.match (id, '^10%.([^/]+)/([^%s–]+)$'); -- registrant and suffix set when DOI has the proper basic form; both nil else
if suffix then
if suffix:match ('[%.,]$') then -- |doi= has basic form but suffix has trailing dot or comma
ignorable_err_flag = true; -- set the flag so that we can emit an error message if not ignored
end
else -- here when |doi= does not have proper basic form
err_flag = true; -- set the non-ignorable error flag
ignore_invalid = false; -- unset because this error may not be ignored
end
local registrant_err_patterns = { -- these patterns are for code ranges that are not supported
'^[^1-3]%d%d%d%d%.%d+$', -- 5 digits with subcode (reject 0xxxx, 40000+); accepts: 10000–39999
'^[^1-8]%d%d%d%d$', -- 5 digits without subcode (reject 0xxxx, 90000+); accepts: 10000–89999
'^[^1-9]%d%d%d%.%d+$', -- 4 digits with subcode (reject 0xxx); accepts: 1000–9999
'^[^1-9]%d%d%d$', -- 4 digits without subcode (reject 0xxx); accepts: 1000–9999
'^%d%d%d%d%d%d+', -- 6 or more digits
'^%d%d?%d?$', -- less than 4 digits without subcode (3 digits with subcode is legitimate)
'^%d%d?%.[%d%.]+', -- 1 or 2 digits with subcode
'^5555$', -- test registrant will never resolve
'[^%d%.]', -- any character that isn't a digit or a dot
}
if not err_flag then -- when DOI has proper form; <err_flag> is true when |doi= is malformed
if not ignore_invalid then -- when we're not ignoring errors
if registrant then -- when DOI has proper form
for i, pattern in ipairs (registrant_err_patterns) do -- spin through error patterns
if registrant:match (pattern) then -- to validate registrant codes
ignorable_err_flag = true; -- when found, mark this DOI as bad
break; -- and done
end
end
end
else -- here when ignoring invalid |doi= values
ignorable_err_flag = false; -- unset so we don't emit an error message for ignorable errors
set_message ('maint_doi_ignore'); -- add maint message when doi is properly formatted
end
end
if err_flag or ignorable_err_flag then
set_message ('err_bad_doi'); -- invalid |doi= value; emit an error message
options.coins_list_t['DOI'] = nil; -- when in error, unset so |doi= value not included in COinS
else -- here when doi has no errors or has been wrapped in accept-as-written markup
suffix = mw.ustring.match (id, '^10%.[^/]+/(.+)'); -- refetch suffix because doi may have been wrapped in accept-as-written markup
if not access and (cfg.known_free_doi_registrants_t[registrant] or is_extended_free (registrant, suffix)) then -- |doi-access=free not set and <registrant> is known to be free
set_message ('maint_doi_unflagged_free'); -- set a maint cat
end
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access,
auto_link = not (err_flag or is_set (inactive) or ignore_invalid) and 'doi' or nil -- do not auto-link when |doi-broken-date= has a value or when there is a DOI error or (to play it safe, after all, auto-linking is not essential) when invalid DOIs are ignored
}) .. (inactive or '');
return text;
end
--[[--------------------------< H D L >------------------------------------------------------------------------
Formats an HDL with minor error checking.
HDL names contain two parts: prefix and suffix separated by a forward slash.
Prefix: character string using any character in the UCS-2 character set except '/'
Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant
This function checks a HDL name for: prefix/suffix. If the HDL name contains spaces, endashes, or, if it ends
with a period or a comma, this function will emit a bad_hdl error message.
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely
if ever used in HDLs.
Query string parameters are named here: https://www.handle.net/proxy_servlet.html. query strings are not displayed
but since '?' is an allowed character in an HDL, '?' followed by one of the query parameters is the only way we
have to detect the query string so that it isn't URL-encoded with the rest of the identifier.
]]
local function hdl (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local query_params_t = { -- list of known query parameters from https://www.handle.net/proxy_servlet.html
'noredirect',
'ignore_aliases',
'auth',
'cert',
'index',
'type',
'urlappend',
'locatt',
'action',
}
local handle, suffix, param = id:match ('(.-)(%?(%a+).+)$'); -- look for query string
local found;
if handle then -- when there are query strings, this is the handle identifier portion
for _, q in ipairs (query_params_t) do -- spin through the list of query parameters
if param:match ('^' .. q) then -- if the query string begins with one of the parameters
found = true; -- announce a find
break; -- and stop looking
end
end
end
if found then
id = handle; -- found so replace id with the handle portion; this will be URL-encoded, suffix will not
else
suffix = ''; -- make sure suffix is empty string for concatenation else
end
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, suffix = suffix, separator = handler.separator, encode = handler.encode, access = access})
if nil == id:match("^[^%s–]-/[^%s–]-[^%.,]$") then -- HDL must contain a forward slash, must not contain spaces, endashes, and must not end with period or comma
set_message ('err_bad_hdl' );
options.coins_list_t['HDL'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< I S B N >----------------------------------------------------------------------
Determines whether an ISBN string is valid
]]
local function isbn (options_t)
local isbn_str = options_t.id;
local ignore_invalid = options_t.accept;
local handler = options_t.handler;
local year = options_t.Year; -- when set, valid anchor_year; may have a disambiguator which must be removed
local function return_result (check, err_type) -- local function to handle the various returns
local ISBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = isbn_str, separator = handler.separator});
if ignore_invalid then -- if ignoring ISBN errors
set_message ('maint_isbn_ignore'); -- add a maint category even when there is no error
else -- here when not ignoring
if not check then -- and there is an error
options_t.coins_list_t['ISBN'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_isbn', err_type); -- set an error message
return ISBN; -- return id text
end
end
return ISBN; -- return id text
end
if year and not ignore_invalid then --
year = year:match ('%d%d%d%d?'); -- strip disambiguator if present
if year and (1965 > tonumber(year)) then -- <year> will be nil here when |year=n.d. or |year=nd
set_message ('err_invalid_isbn_date'); -- set an error message
return internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = isbn_str, separator = handler.separator});
end
end
if nil ~= isbn_str:match ('[^%s-0-9X]') then
return return_result (false, cfg.err_msg_supl.char); -- fail if isbn_str contains anything but digits, hyphens, or the uppercase X
end
local id = isbn_str:gsub ('[%s-]', ''); -- remove hyphens and whitespace
local len = id:len();
if len ~= 10 and len ~= 13 then
return return_result (false, cfg.err_msg_supl.length); -- fail if incorrect length
end
if len == 10 then
if id:match ('^%d*X?$') == nil then -- fail if isbn_str has 'X' anywhere but last position
return return_result (false, cfg.err_msg_supl.form);
end
if not is_valid_isxn (id, 10) then -- test isbn-10 for numerical validity
return return_result (false, cfg.err_msg_supl.check); -- fail if isbn-10 is not numerically valid
end
if id:find ('^63[01]') then -- 630xxxxxxx and 631xxxxxxx are (apparently) not valid isbn group ids but are used by amazon as numeric identifiers (asin)
return return_result (false, cfg.err_msg_supl.group); -- fail if isbn-10 begins with 630/1
end
return return_result (true, cfg.err_msg_supl.check); -- pass if isbn-10 is numerically valid
else
if id:match ('^%d+$') == nil then
return return_result (false, cfg.err_msg_supl.char); -- fail if ISBN-13 is not all digits
end
if id:match ('^97[89]%d*$') == nil then
return return_result (false, cfg.err_msg_supl.prefix); -- fail when ISBN-13 does not begin with 978 or 979
end
if id:match ('^9790') then
return return_result (false, cfg.err_msg_supl.group); -- group identifier '0' is reserved to ISMN
end
return return_result (is_valid_isxn_13 (id), cfg.err_msg_supl.check);
end
end
--[[--------------------------< A S I N >----------------------------------------------------------------------
Formats a link to Amazon. Do simple error checking: ASIN must be mix of 10 numeric or uppercase alpha
characters. If a mix, first character must be uppercase alpha; if all numeric, ASINs must be 10-digit
ISBN. If 10-digit ISBN, add a maintenance category so a bot or AWB script can replace |asin= with |isbn=.
Error message if not 10 characters, if not ISBN-10, if mixed and first character is a digit.
|asin=630....... and |asin=631....... are (apparently) not a legitimate ISBN though it checksums as one; these
do not cause this function to emit the maint_asin message
This function is positioned here because it calls isbn()
]]
local function asin (options)
local id = options.id;
local domain = options.ASINTLD;
local err_flag = nil; -- must be explicitly initialized
if not id:match("^[%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u]$") then
err_flag = set_message ('err_bad_asin'); -- ASIN is not a mix of 10 uppercase alpha and numeric characters
else
if id:match("^%d%d%d%d%d%d%d%d%d[%dX]$") then -- if 10-digit numeric (or 9 digits with terminal X)
if is_valid_isxn (id, 10) then -- see if ASIN value is or validates as ISBN-10
if not id:find ('^63[01]') then -- 630xxxxxxx and 631xxxxxxx are (apparently) not a valid isbn prefixes but are used by amazon as a numeric identifier
err_flag = set_message ('err_bad_asin'); -- ASIN has ISBN-10 form but begins with something other than 630/1 so probably an isbn
end
elseif not is_set (err_flag) then
err_flag = set_message ('err_bad_asin'); -- ASIN is not ISBN-10
end
elseif not id:match("^%u[%d%u]+$") then
err_flag = set_message ('err_bad_asin'); -- asin doesn't begin with uppercase alpha
end
end
if (not is_set (domain)) or in_array (domain, {'us'}) then -- default: United States
domain = "com";
elseif in_array (domain, {'jp', 'uk', 'za'}) then -- Japan, United Kingdom, South Africa
domain = "co." .. domain;
elseif in_array (domain, {'z.cn'}) then -- China
domain = "cn";
elseif in_array (domain, {'au', 'be', 'br', 'mx', 'sg', 'tr'}) then -- Australia, Belgium, Brazil, Mexico, Singapore, Turkey
domain = "com." .. domain;
elseif not in_array (domain, {'ae', 'ca', 'cn', 'de', 'eg', 'es', 'fr', 'ie', 'in', 'it', 'nl', 'pl', 'sa', 'se', 'co.jp', 'co.uk', 'com', 'com.au', 'com.br', 'com.mx', 'com.sg', 'com.tr'}) then -- Arabic Emirates, Canada, China, Germany, Egypt, Spain, France, Ireland, Indonesia, Italy, Netherlands, Poland, Saudi Arabia, Sweden (as of 2021-03 Austria (.at), Liechtenstein (.li) and Switzerland (.ch) still redirect to the German site (.de) with special settings, so don't maintain local ASINs for them)
err_flag = set_message ('err_bad_asin_tld'); -- unsupported asin-tld value
end
local handler = options.handler;
if not is_set (err_flag) then
options.coins_list_t['ASIN'] = handler.prefix .. domain .. "/dp/" .. id; -- asin for coins
else
options.coins_list_t['ASIN'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix .. domain .. "/dp/",
id = id, encode = handler.encode, separator = handler.separator})
end
--[[--------------------------< I S M N >----------------------------------------------------------------------
Determines whether an ISMN string is valid. Similar to ISBN-13, ISMN is 13 digits beginning 979-0-... and uses the
same check digit calculations. See https://www.ismn-international.org/download/Web_ISMN_Users_Manual_2008-6.pdf
section 2, pages 9–12.
ismn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)
or an identifier registered at info-uri.info (info:)
]]
local function ismn (options)
local id = options.id;
local handler = options.handler;
local text;
local valid_ismn;
local id_copy;
id_copy = id; -- save a copy because this testing is destructive
id = id:gsub ('[%s-]', ''); -- remove hyphens and white space
if 13 ~= id:len() or id:match ("^9790%d*$" ) == nil then -- ISMN must be 13 digits and begin with 9790
valid_ismn = false;
else
valid_ismn=is_valid_isxn_13 (id); -- validate ISMN
end
-- text = internal_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, -- use this (or external version) when there is some place to link to
-- prefix = handler.prefix, id = id_copy, separator = handler.separator, encode = handler.encode})
text = table.concat ( -- because no place to link to yet
{
make_wikilink (label_link_make (handler), handler.label),
handler.separator,
id_copy
});
if false == valid_ismn then
options.coins_list_t['ISMN'] = nil; -- when error, unset so not included in COinS; not really necessary here because ismn not made part of COinS
set_message ('err_bad_ismn'); -- create an error message if the ISMN is invalid
end
return text;
end
--[[--------------------------< I S S N >----------------------------------------------------------------------
Validate and format an ISSN. This code fixes the case where an editor has included an ISSN in the citation but
has separated the two groups of four digits with a space. When that condition occurred, the resulting link looked
like this:
|issn=0819 4327 gives: [https://www.worldcat.org/issn/0819 4327 0819 4327] -- can't have spaces in an external link
This code now prevents that by inserting a hyphen at the ISSN midpoint. It also validates the ISSN for length
and makes sure that the checkdigit agrees with the calculated value. Incorrect length (8 digits), characters
other than 0-9 and X, or checkdigit / calculated value mismatch will all cause a check ISSN error message. The
ISSN is always displayed with a hyphen, even if the ISSN was given as a single group of 8 digits.
]]
local function issn (options)
local id = options.id;
local handler = options.handler;
local ignore_invalid = options.accept;
local issn_copy = id; -- save a copy of unadulterated ISSN; use this version for display if ISSN does not validate
local text;
local valid_issn;
id = id:gsub ('[%s-]', ''); -- remove hyphens and whitespace
if 8 ~= id:len() or nil == id:match ("^%d*X?$" ) then -- validate the ISSN: 8 digits long, containing only 0-9 or X in the last position
valid_issn = false; -- wrong length or improper character
else
valid_issn = is_valid_isxn (id, 8); -- validate ISSN
end
if true == valid_issn then
id = string.sub (id, 1, 4 ) .. "-" .. string.sub (id, 5 ); -- if valid, display correctly formatted version
else
id = issn_copy; -- if not valid, show the invalid ISSN with error message
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})
if ignore_invalid then
set_message ('maint_issn_ignore');
else
if false == valid_issn then
options.coins_list_t['ISSN'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_issn', (options.hkey == 'EISSN') and 'e' or ''); -- create an error message if the ISSN is invalid
end
end
return text;
end
--[[--------------------------< J F M >-----------------------------------------------------------------------
A numerical identifier in the form nn.nnnn.nn
]]
local function jfm (options)
local id = options.id;
local handler = options.handler;
local id_num;
id_num = id:match ('^[Jj][Ff][Mm](.*)$'); -- identifier with jfm prefix; extract identifier
if is_set (id_num) then
set_message ('maint_jfm_format');
else -- plain number without JFM prefix
id_num = id; -- if here id does not have prefix
end
if id_num and id_num:match('^%d%d%.%d%d%d%d%.%d%d$') then
id = id_num; -- jfm matches pattern
else
set_message ('err_bad_jfm' ); -- set an error message
options.coins_list_t['JFM'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< J S T O R >--------------------------------------------------------------------
Format a JSTOR with some error checking
]]
local function jstor (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
if id:find ('[Jj][Ss][Tt][Oo][Rr]') or id:find ('^https?://') or id:find ('%s') then
set_message ('err_bad_jstor'); -- set an error message
options.coins_list_t['JSTOR'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
end
--[[--------------------------< L C C N >----------------------------------------------------------------------
Format LCCN link and do simple error checking. LCCN is a character string 8-12 characters long. The length of
the LCCN dictates the character type of the first 1-3 characters; the rightmost eight are always digits.
https://oclc-research.github.io/infoURI-Frozen/info-uri.info/info:lccn/reg.html
length = 8 then all digits
length = 9 then lccn[1] is lowercase alpha
length = 10 then lccn[1] and lccn[2] are both lowercase alpha or both digits
length = 11 then lccn[1] is lower case alpha, lccn[2] and lccn[3] are both lowercase alpha or both digits
length = 12 then lccn[1] and lccn[2] are both lowercase alpha
]]
local function lccn (options)
local id = options.id; -- local copy of the LCCN
local lccn_id = id;
local handler = options.handler;
local err_flag; -- presume that LCCN is valid
id = normalize_lccn (id); -- get canonical form (no whitespace, hyphens, forward slashes)
local len = id:len(); -- get the length of the LCCN
if 8 == len then
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits)
err_flag = set_message ('err_bad_lccn'); -- set an error message
end
elseif 9 == len then -- LCCN should be adddddddd
if nil == id:match("%l%d%d%d%d%d%d%d%d") then -- does it match our pattern?
err_flag = set_message ('err_bad_lccn'); -- set an error message
end
elseif 10 == len then -- LCCN should be aadddddddd or dddddddddd
if id:match("[^%d]") then -- if LCCN has anything but digits (nil if only digits) ...
if nil == id:match("^%l%l%d%d%d%d%d%d%d%d") then -- ... see if it matches our pattern
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
end
elseif 11 == len then -- LCCN should be aaadddddddd or adddddddddd
if not (id:match("^%l%l%l%d%d%d%d%d%d%d%d") or id:match("^%l%d%d%d%d%d%d%d%d%d%d")) then -- see if it matches one of our patterns
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
elseif 12 == len then -- LCCN should be aadddddddddd
if not id:match("^%l%l%d%d%d%d%d%d%d%d%d%d") then -- see if it matches our pattern
err_flag = set_message ('err_bad_lccn'); -- no match, set an error message
end
else
err_flag = set_message ('err_bad_lccn'); -- wrong length, set an error message
end
if not is_set (err_flag) and nil ~= lccn_id:find ('%s') then
err_flag = set_message ('err_bad_lccn'); -- lccn contains a space, set an error message
end
if is_set (err_flag) then
options.coins_list_t['LCCN'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = lccn_id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< M E D R X I V >-----------------------------------------------------------------
Format medRxiv ID and do simple error checking. Similar to later bioRxiv IDs, medRxiv IDs are prefixed with a
yyyy.mm.dd. date and suffixed with an optional version identifier. Ealiest date accepted is 2020.01.01
The medRxiv ID is a date followed by an eight-digit number followed by an optional version indicator 'v' and one or more digits:
https://www.medrxiv.org/content/10.1101/2020.11.16.20232009v2 -> 10.1101/2020.11.16.20232009v2
]]
local function medrxiv (options)
local id = options.id;
local handler = options.handler;
local err_msg_flag = true; -- flag; assume that there will be an error
local patterns = {
'^%d%d%d%d%d%d%d%d$', -- simple 8-digit identifier; these should be relatively rare
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%dv%d+$', -- y.m.d. date + 8-digit identifier + version (2020-01-01 and later)
'^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%d$', -- y.m.d. date + 8-digit identifier (2020-01-01 and later)
'^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%dv%d+$', -- y.m.d. date + 8-digit identifier + version (2025-12-01 and later)
'^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%d$', -- y.m.d. date + 8-digit identifier (2025-12-01 and later)
}
for _, pattern in ipairs (patterns) do -- spin through the patterns looking for a match
if id:match (pattern) then
local y, m, d = id:match (pattern); -- found a match, attempt to get year, month and date from the identifier
if m then -- m is nil when id is the 8-digit form
if not is_valid_rxiv_date (y, m, d, 'b') then -- validate the encoded date; 'b' for medrxiv limit
break; -- date fail; break out early so we don't unset the error message
end
end
err_msg_flag = nil; -- we found a match so unset the error message
break; -- and done
end
end -- <err_msg_flag> remains set here when no match
if err_msg_flag then
options.coins_list_t['MEDRXIV'] = nil; -- when error, unset so not included in COinS
set_message ('err_bad_medrxiv'); -- and set the error message
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator,
encode = handler.encode, access = handler.access});
end
--[[--------------------------< M R >--------------------------------------------------------------------------
A seven digit number; if not seven digits, zero-fill leading digits to make seven digits.
]]
local function mr (options)
local id = options.id;
local handler = options.handler;
local id_num;
local id_len;
id_num = id:match ('^[Mm][Rr](%d+)$'); -- identifier with mr prefix
if is_set (id_num) then
set_message ('maint_mr_format'); -- add maint cat
else -- plain number without mr prefix
id_num = id:match ('^%d+$'); -- if here id is all digits
end
id_len = id_num and id_num:len() or 0;
if (7 >= id_len) and (0 ~= id_len) then
id = string.rep ('0', 7-id_len) .. id_num; -- zero-fill leading digits
else
set_message ('err_bad_mr'); -- set an error message
options.coins_list_t['MR'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< O C L C >----------------------------------------------------------------------
Validate and format an OCLC ID. https://www.oclc.org/batchload/controlnumber.en.html {{dead link}}
archived at: https://web.archive.org/web/20161228233804/https://www.oclc.org/batchload/controlnumber.en.html
]]
local function oclc (options)
local id = options.id;
local handler = options.handler;
local number;
if id:match('^ocm%d%d%d%d%d%d%d%d$') then -- ocm prefix and 8 digits; 001 field (12 characters)
number = id:match('ocm(%d+)'); -- get the number
elseif id:match('^ocn%d%d%d%d%d%d%d%d%d$') then -- ocn prefix and 9 digits; 001 field (12 characters)
number = id:match('ocn(%d+)'); -- get the number
elseif id:match('^on%d%d%d%d%d%d%d%d%d%d+$') then -- on prefix and 10 or more digits; 001 field (12 characters)
number = id:match('^on(%d%d%d%d%d%d%d%d%d%d+)$'); -- get the number
elseif id:match('^%(OCoLC%)[1-9]%d*$') then -- (OCoLC) prefix and variable number digits; no leading zeros; 035 field
number = id:match('%(OCoLC%)([1-9]%d*)'); -- get the number
if 9 < number:len() then
number = nil; -- constrain to 1 to 9 digits; change this when OCLC issues 10-digit numbers
end
elseif id:match('^%d+$') then -- no prefix
number = id; -- get the number
if tonumber (id) > handler.id_limit then
number = nil; -- unset when id value exceeds the limit
end
end
if number then -- proper format
id = number; -- exclude prefix, if any, from external link
else
set_message ('err_bad_oclc') -- add an error message if the id is malformed
options.coins_list_t['OCLC'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< O P E N L I B R A R Y >--------------------------------------------------------
Formats an OpenLibrary link, and checks for associated errors.
]]
local function openlibrary (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local ident, code = id:gsub('^OL', ''):match("^(%d+([AMW]))$"); -- strip optional OL prefix followed immediately by digits followed by 'A', 'M', or 'W';
local err_flag;
local prefix = { -- these are appended to the handler.prefix according to code
['A']='authors/OL',
['M']='books/OL',
['W']='works/OL',
['X']='OL' -- not a code; spoof when 'code' in id is invalid
};
if not ident then
code = 'X'; -- no code or id completely invalid
ident = id; -- copy id to ident so that we display the flawed identifier
err_flag = set_message ('err_bad_ol');
end
if not is_set (err_flag) then
options.coins_list_t['OL'] = handler.prefix .. prefix[code] .. ident; -- experiment for ol coins
else
options.coins_list_t['OL'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix .. prefix[code],
id = ident, separator = handler.separator, encode = handler.encode,
access = access});
end
--[[--------------------------< O S T I >----------------------------------------------------------------------
Format OSTI and do simple error checking. OSTIs are sequential numbers beginning at 1 and counting up. This
code checks the OSTI to see that it contains only digits and is less than test_limit specified in the configuration;
the value in test_limit will need to be updated periodically as more OSTIs are issued.
NB. 1018 is the lowest OSTI number found in the wild (so far) and resolving OK on the OSTI site
]]
local function osti (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
if id:match("[^%d]") then -- if OSTI has anything but digits
set_message ('err_bad_osti'); -- set an error message
options.coins_list_t['OSTI'] = nil; -- when error, unset so not included in COinS
else -- OSTI is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1018 > id_num or handler.id_limit < id_num then -- if OSTI is outside test limit boundaries
set_message ('err_bad_osti'); -- set an error message
options.coins_list_t['OSTI'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
end
--[[--------------------------< P M C >------------------------------------------------------------------------
Format a PMC, do simple error checking, and check for embargoed articles.
The embargo parameter takes a date for a value. If the embargo date is in the future the PMC identifier will not
be linked to the article. If the embargo date is today or in the past, or if it is empty or omitted, then the
PMC identifier is linked to the article through the link at cfg.id_handlers['PMC'].prefix.
PMC embargo date testing is done in function is_embargoed () which is called earlier because when the citation
has |pmc=<value> but does not have a |url= then |title= is linked with the PMC link. Function is_embargoed ()
returns the embargo date if the PMC article is still embargoed, otherwise it returns an empty string.
PMCs are sequential numbers beginning at 1 and counting up. This code checks the PMC to see that it contains only digits and is less
than test_limit; the value in local variable test_limit will need to be updated periodically as more PMCs are issued.
]]
local function pmc (options)
local id = options.id;
local embargo = options.Embargo; -- TODO: lowercase?
local handler = options.handler;
local err_flag;
local id_num;
local text;
id_num = id:match ('^[Pp][Mm][Cc](%d+)$'); -- identifier with PMC prefix
if is_set (id_num) then
set_message ('maint_pmc_format');
else -- plain number without PMC prefix
id_num = id:match ('^%d+$'); -- if here id is all digits
end
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if PMC is outside test limit boundaries
err_flag = set_message ('err_bad_pmc'); -- set an error message
else
id = tostring (id_num); -- make sure id is a string
end
else -- when id format incorrect
err_flag = set_message ('err_bad_pmc'); -- set an error message
end
if is_set (embargo) and is_set (is_embargoed (embargo)) then -- is PMC is still embargoed?
text = table.concat ( -- still embargoed so no external link
{
make_wikilink (label_link_make (handler), handler.label),
handler.separator,
id,
});
else
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect, -- no embargo date or embargo has expired, ok to link to article
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access,
auto_link = not err_flag and 'pmc' or nil -- do not auto-link when PMC has error
});
end
if err_flag then
options.coins_list_t['PMC'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< P M I D >----------------------------------------------------------------------
Format PMID and do simple error checking. PMIDs are sequential numbers beginning at 1 and counting up. This
code checks the PMID to see that it contains only digits and is less than test_limit; the value in local variable
test_limit will need to be updated periodically as more PMIDs are issued.
]]
local function pmid (options)
local id = options.id;
local handler = options.handler;
if id:match("[^%d]") then -- if PMID has anything but digits
set_message ('err_bad_pmid'); -- set an error message
options.coins_list_t['PMID'] = nil; -- when error, unset so not included in COinS
else -- PMID is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if PMID is outside test limit boundaries
set_message ('err_bad_pmid'); -- set an error message
options.coins_list_t['PMID'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--[[--------------------------< R F C >------------------------------------------------------------------------
Format RFC and do simple error checking. RFCs are sequential numbers beginning at 1 and counting up. This
code checks the RFC to see that it contains only digits and is less than test_limit specified in the configuration;
the value in test_limit will need to be updated periodically as more RFCs are issued.
An index of all RFCs is here: https://tools.ietf.org/rfc/
]]
local function rfc (options)
local id = options.id;
local handler = options.handler;
if id:match("[^%d]") then -- if RFC has anything but digits
set_message ('err_bad_rfc'); -- set an error message
options.coins_list_t['RFC'] = nil; -- when error, unset so not included in COinS
else -- RFC is only digits
local id_num = tonumber (id); -- convert id to a number for range testing
if 1 > id_num or handler.id_limit < id_num then -- if RFC is outside test limit boundaries
set_message ('err_bad_rfc'); -- set an error message
options.coins_list_t['RFC'] = nil; -- when error, unset so not included in COinS
end
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});
end
--[[--------------------------< S 2 C I D >--------------------------------------------------------------------
Format an S2CID, do simple error checking
S2CIDs are sequential numbers beginning at 1 and counting up. This code checks the S2CID to see that it is only
digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically
as more S2CIDs are issued.
]]
local function s2cid (options)
local id = options.id;
local access = options.access;
local handler = options.handler;
local id_num;
local text;
id_num = id:match ('^[1-9]%d*$'); -- id must be all digits; must not begin with 0; no open access flag
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if handler.id_limit < id_num then -- if S2CID is outside test limit boundaries
set_message ('err_bad_s2cid'); -- set an error message
options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS
end
else -- when id format incorrect
set_message ('err_bad_s2cid'); -- set an error message
options.coins_list_t['S2CID'] = nil; -- when error, unset so not included in COinS
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});
return text;
end
--[[--------------------------< S B N >------------------------------------------------------------------------
9-digit form of ISBN-10; uses same check-digit validation when SBN is prefixed with an additional '0' to make 10 digits
sbn value not made part of COinS metadata because we don't have a url or isn't a COinS-defined identifier (rft.xxx)
or an identifier registered at info-uri.info (info:)
]]
local function sbn (options)
local id = options.id;
local ignore_invalid = options.accept;
local handler = options.handler;
local function return_result (check, err_type) -- local function to handle the various returns
local SBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator});
if not ignore_invalid then -- if not ignoring SBN errors
if not check then
options.coins_list_t['SBN'] = nil; -- when error, unset so not included in COinS; not really necessary here because sbn not made part of COinS
set_message ('err_bad_sbn', {err_type}); -- display an error message
return SBN;
end
else
set_message ('maint_isbn_ignore'); -- add a maint category even when there is no error (ToDo: Possibly switch to separate message for SBNs only)
end
return SBN;
end
if id:match ('[^%s-0-9X]') then
return return_result (false, cfg.err_msg_supl.char); -- fail if SBN contains anything but digits, hyphens, or the uppercase X
end
local ident = id:gsub ('[%s-]', ''); -- remove hyphens and whitespace; they interfere with the rest of the tests
if 9 ~= ident:len() then
return return_result (false, cfg.err_msg_supl.length); -- fail if incorrect length
end
if ident:match ('^%d*X?$') == nil then
return return_result (false, cfg.err_msg_supl.form); -- fail if SBN has 'X' anywhere but last position
end
return return_result (is_valid_isxn ('0' .. ident, 10), cfg.err_msg_supl.check);
end
--[[--------------------------< S S R N >----------------------------------------------------------------------
Format an SSRN, do simple error checking
SSRNs are sequential numbers beginning at 100? and counting up. This code checks the SSRN to see that it is
only digits and is greater than 99 and less than test_limit; the value in local variable test_limit will need
to be updated periodically as more SSRNs are issued.
]]
local function ssrn (options)
local id = options.id;
local handler = options.handler;
local id_num;
local text;
id_num = id:match ('^%d+$'); -- id must be all digits
if is_set (id_num) then -- id_num has a value so test it
id_num = tonumber (id_num); -- convert id_num to a number for range testing
if 100 > id_num or handler.id_limit < id_num then -- if SSRN is outside test limit boundaries
set_message ('err_bad_ssrn'); -- set an error message
options.coins_list_t['SSRN'] = nil; -- when error, unset so not included in COinS
end
else -- when id format incorrect
set_message ('err_bad_ssrn'); -- set an error message
options.coins_list_t['SSRN'] = nil; -- when error, unset so not included in COinS
end
text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = options.access});
return text;
end
--[[--------------------------< U S E N E T _ I D >------------------------------------------------------------
Validate and format a usenet message id. Simple error checking, looks for 'id-left@id-right' not enclosed in
'<' and/or '>' angle brackets.
]]
local function usenet_id (options)
local id = options.id;
local handler = options.handler;
local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})
if not id:match('^.+@.+$') or not id:match('^[^<].*[^>]$') then -- doesn't have '@' or has one or first or last character is '< or '>'
set_message ('err_bad_usenet_id') -- add an error message if the message id is invalid
options.coins_list_t['USENETID'] = nil; -- when error, unset so not included in COinS
end
return text;
end
--[[--------------------------< Z B L >-----------------------------------------------------------------------
A numerical identifier in the form nnnn.nnnnn - leading zeros in the first quartet optional
format described here: http://emis.mi.sanu.ac.rs/ZMATH/zmath/en/help/search/
temporary format is apparently eight digits. Anything else is an error
]]
local function zbl (options)
local id = options.id;
local handler = options.handler;
if id:match('^%d%d%d%d%d%d%d%d$') then -- is this identifier using temporary format?
set_message ('maint_zbl'); -- yes, add maint cat
elseif not id:match('^%d?%d?%d?%d%.%d%d%d%d%d$') then -- not temporary, is it normal format?
set_message ('err_bad_zbl'); -- no, set an error message
options.coins_list_t['ZBL'] = nil; -- when error, unset so not included in COinS
end
return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,
prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});
end
--============================<< I N T E R F A C E F U N C T I O N S >>==========================================
--[[--------------------------< E X T R A C T _ I D S >------------------------------------------------------------
Populates ID table from arguments using configuration settings. Loops through cfg.id_handlers and searches args for
any of the parameters listed in each cfg.id_handlers['...'].parameters. If found, adds the parameter and value to
the identifier list. Emits redundant error message if more than one alias exists in args
]]
local function extract_ids (args)
local id_list = {}; -- list of identifiers found in args
for k, v in pairs (cfg.id_handlers) do -- k is uppercase identifier name as index to cfg.id_handlers; e.g. cfg.id_handlers['ISBN'], v is a table
v = select_one (args, v.parameters, 'err_redundant_parameters' ); -- v.parameters is a table of aliases for k; here we pick one from args if present
if is_set (v) then id_list[k] = v; end -- if found in args, add identifier to our list
end
return id_list;
end
--[[--------------------------< E X T R A C T _ I D _ A C C E S S _ L E V E L S >--------------------------------------
Fetches custom id access levels from arguments using configuration settings. Parameters which have a predefined access
level (e.g. arxiv) do not use this function as they are directly rendered as free without using an additional parameter.
returns a table of k/v pairs where k is same as the identifier's key in cfg.id_handlers and v is the assigned (valid) keyword
access-level values must match the case used in cfg.keywords_lists['id-access'] (lowercase unless there is some special reason for something else)
]]
local function extract_id_access_levels (args, id_list)
local id_accesses_list = {};
for k, v in pairs (cfg.id_handlers) do
local access_param = v.custom_access; -- name of identifier's access-level parameter
if is_set (access_param) then
local access_level = args[access_param]; -- get the assigned value if there is one
if is_set (access_level) then
if not in_array (access_level, cfg.keywords_lists['id-access']) then -- exact match required
set_message ('err_invalid_param_val', {access_param, access_level});
access_level = nil; -- invalid so unset
end
if not is_set (id_list[k]) then -- identifier access-level must have a matching identifier
set_message ('err_param_access_requires_param', {k:lower()}); -- parameter name is uppercase in cfg.id_handlers (k); lowercase for error message
end
id_accesses_list[k] = cfg.keywords_xlate[access_level]; -- get translated keyword
end
end
end
return id_accesses_list;
end
--[[--------------------------< B U I L D _ I D _ L I S T >----------------------------------------------------
render the identifiers into a sorted sequence table
<ID_list_coins_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value
<options_t> is a table of various k/v option pairs provided in the call to new_build_id_list();
modified by this function and passed to all identifier rendering functions
<access_levels_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value (if valid)
returns a sequence table of sorted (by hkey - 'handler' key) rendered identifier strings
]]
local function build_id_list (ID_list_coins_t, options_t, access_levels_t)
local ID_list_t = {};
local accept;
local func_map = { --function map points to functions associated with hkey identifier
['ARXIV'] = arxiv,
['ASIN'] = asin,
['BIBCODE'] = bibcode,
['BIORXIV'] = biorxiv,
['CITESEERX'] = citeseerx,
['DOI'] = doi,
['EISSN'] = issn,
['HDL'] = hdl,
['ISBN'] = isbn,
['ISMN'] = ismn,
['ISSN'] = issn,
['JFM'] = jfm,
['JSTOR'] = jstor,
['LCCN'] = lccn,
['MEDRXIV'] = medrxiv,
['MR'] = mr,
['OCLC'] = oclc,
['OL'] = openlibrary,
['OSTI'] = osti,
['PMC'] = pmc,
['PMID'] = pmid,
['RFC'] = rfc,
['S2CID'] = s2cid,
['SBN'] = sbn,
['SSRN'] = ssrn,
['USENETID'] = usenet_id,
['ZBL'] = zbl,
}
for hkey, v in pairs (ID_list_coins_t) do
v, accept = has_accept_as_written (v); -- remove accept-as-written markup if present; accept is boolean true when markup removed; false else
-- every function gets the options table with value v and accept boolean
options_t.hkey = hkey; -- ~/Configuration handler key
options_t.id = v; -- add that identifier value to the options table
options_t.accept = accept; -- add the accept boolean flag
options_t.access = access_levels_t[hkey]; -- add the access level for those that have an |<identifier-access= parameter
options_t.handler = cfg.id_handlers[hkey];
options_t.coins_list_t = ID_list_coins_t; -- pointer to ID_list_coins_t; for |asin= and |ol=; also to keep erroneous values out of the citation's metadata
options_t.coins_list_t[hkey] = v; -- id value without accept-as-written markup for metadata
if options_t.handler.access and not in_array (options_t.handler.access, cfg.keywords_lists['id-access']) then
error (cfg.messages['unknown_ID_access'] .. options_t.handler.access); -- here when handler access key set to a value not listed in list of allowed id access keywords
end
if func_map[hkey] then
local id_text = func_map[hkey] (options_t); -- call the function to get identifier text and any error message
table.insert (ID_list_t, {hkey, id_text}); -- add identifier text to the output sequence table
else
error (cfg.messages['unknown_ID_key'] .. hkey); -- here when func_map doesn't have a function for hkey
end
end
local function comp (a, b) -- used by following table.sort()
return a[1]:lower() < b[1]:lower(); -- sort by hkey
end
table.sort (ID_list_t, comp); -- sequence table of tables sort
for k, v in ipairs (ID_list_t) do -- convert sequence table of tables to simple sequence table of strings
ID_list_t[k] = v[2]; -- v[2] is the identifier rendering from the call to the various functions in func_map{}
end
return ID_list_t;
end
--[[--------------------------< O P T I O N S _ C H E C K >----------------------------------------------------
check that certain option parameters have their associated identifier parameters with values
<ID_list_coins_t> is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value
<ID_support_t> is a sequence table of tables created in citation0() where each subtable has four elements:
[1] is the support parameter's assigned value; empty string if not set
[2] is a text string same as key in cfg.id_handlers
[3] is cfg.error_conditions key used to create error message
[4] is original ID support parameter name used to create error message
returns nothing; on error emits an appropriate error message
]]
local function options_check (ID_list_coins_t, ID_support_t)
for _, v in ipairs (ID_support_t) do
if is_set (v[1]) and not ID_list_coins_t[v[2]] then -- when support parameter has a value but matching identifier parameter is missing or empty
set_message (v[3], (v[4])); -- emit the appropriate error message
end
end
end
--[[--------------------------< I D E N T I F I E R _ L I S T S _ G E T >--------------------------------------
Creates two identifier lists: a k/v table of identifiers and their values to be used locally and for use in the
COinS metadata, and a sequence table of the rendered identifier strings that will be included in the rendered
citation.
]]
local function identifier_lists_get (args_t, options_t, ID_support_t)
local ID_list_coins_t = extract_ids (args_t); -- get a table of identifiers and their values for use locally and for use in COinS
options_check (ID_list_coins_t, ID_support_t); -- ID support parameters must have matching identifier parameters
local ID_access_levels_t = extract_id_access_levels (args_t, ID_list_coins_t); -- get a table of identifier access levels
local ID_list_t = build_id_list (ID_list_coins_t, options_t, ID_access_levels_t); -- get a sequence table of rendered identifier strings
return ID_list_t, ID_list_coins_t; -- return the tables
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
cfg = cfg_table_ptr;
has_accept_as_written = utilities_page_ptr.has_accept_as_written; -- import functions from select Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
set_message = utilities_page_ptr.set_message;
select_one = utilities_page_ptr.select_one;
substitute = utilities_page_ptr.substitute;
make_wikilink = utilities_page_ptr.make_wikilink;
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
auto_link_urls = auto_link_urls, -- table of identifier URLs to be used when auto-linking |title=
identifier_lists_get = identifier_lists_get, -- experiment to replace individual calls to build_id_list(), extract_ids, extract_id_access_levels
is_embargoed = is_embargoed;
set_selected_modules = set_selected_modules;
}
5bj1u7sbno5vyrz0hztvhaip3uwhy2w
Módulo:Citation/CS1/COinS
828
7647
74998
71650
2026-08-08T13:56:43Z
en>Trappist the monk
0
synch from sandbox;
74998
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local has_accept_as_written, is_set, in_array, remove_wiki_link, strip_apostrophe_markup; -- functions in Module:Citation/CS1/Utilities
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
--[[--------------------------< M A K E _ C O I N S _ T I T L E >----------------------------------------------
Makes a title for COinS from Title and / or ScriptTitle (or any other name-script pairs)
Apostrophe markup (bold, italics) is stripped from each value so that the COinS metadata isn't corrupted with strings
of %27%27...
]]
local function make_coins_title (title, script)
title = has_accept_as_written (title);
if is_set (title) then
title = strip_apostrophe_markup (title); -- strip any apostrophe markup
else
title = ''; -- if not set, make sure title is an empty string
end
if is_set (script) then
script = script:gsub ('^%l%l%s*:%s*', ''); -- remove language prefix if present (script value may now be empty string)
script = strip_apostrophe_markup (script); -- strip any apostrophe markup
else
script = ''; -- if not set, make sure script is an empty string
end
if is_set (title) and is_set (script) then
script = ' ' .. script; -- add a space before we concatenate
end
return title .. script; -- return the concatenation
end
--[[--------------------------< E S C A P E _ L U A _ M A G I C _ C H A R S >----------------------------------
Returns a string where all of Lua's magic characters have been escaped. This is important because functions like
string.gsub() treat their pattern and replace strings as patterns, not literal strings.
]]
local function escape_lua_magic_chars (argument)
argument = argument:gsub("%%", "%%%%"); -- replace % with %%
argument = argument:gsub("([%^%$%(%)%.%[%]%*%+%-%?])", "%%%1"); -- replace all other Lua magic pattern characters
return argument;
end
--[[--------------------------< G E T _ C O I N S _ P A G E S >------------------------------------------------
Extract page numbers from external wikilinks in any of the |page=, |pages=, or |at= parameters for use in COinS.
]]
local function get_coins_pages (pages)
local pattern;
if not is_set (pages) then return pages; end -- if no page numbers then we're done
while true do
pattern = pages:match("%[(%w*:?//[^ ]+%s+)[%w%d].*%]"); -- pattern is the opening bracket, the URL and following space(s): "[url "
if nil == pattern then break; end -- no more URLs
pattern = escape_lua_magic_chars (pattern); -- pattern is not a literal string; escape Lua's magic pattern characters
pages = pages:gsub(pattern, ""); -- remove as many instances of pattern as possible
end
pages = pages:gsub("[%[%]]", ""); -- remove the brackets
pages = pages:gsub("–", "-" ); -- replace endashes with hyphens
pages = pages:gsub("&%w+;", "-" ); -- and replace HTML entities (– etc.) with hyphens; do we need to replace numerical entities like   and the like?
pages = pages:gsub ('%b<>', ''); -- remove html-like tags; spans are added to <Pages> by utilities.hyphen_to_dash() which should not appear in COinS metadata
return pages;
end
--[=[-------------------------< C O I N S _ R E P L A C E _ M A T H _ S T R I P M A R K E R >------------------
There are three options for math markup rendering that depend on the editor's math preference settings. These
settings are at [[Special:Preferences#mw-prefsection-rendering]] and are
PNG images
TeX source
MathML with SVG or PNG fallback
All three are heavy with HTML and CSS which doesn't belong in the metadata.
Without this function, the metadata saved in the raw wikitext contained the rendering determined by the settings
of the last editor to save the page.
This function gets the rendered form of an equation according to the editor's preference before the page is saved. It
then searches the rendering for the text equivalent of the rendered equation and replaces the rendering with that so
that the page is saved without extraneous HTML/CSS markup and with a reasonably readable text form of the equation.
When a replacement is made, this function returns true and the value with replacement; otherwise false and the initial
value. To replace multipe equations it is necessary to call this function from within a loop.
]=]
local function coins_replace_math_stripmarker (value)
local stripmarker = cfg.stripmarkers['math'];
local rendering = value:match (stripmarker); -- is there a math stripmarker
if not rendering then -- when value doesn't have a math stripmarker, abandon this test
return false, value;
end
rendering = mw.text.unstripNoWiki (rendering); -- convert stripmarker into rendered value (or nil? ''? when math render error)
if rendering:match ('alt="[^"]+"') then -- if PNG math option
rendering = rendering:match ('alt="([^"]+)"'); -- extract just the math text
elseif rendering:match ('$%s+.+%s+%$') then -- if TeX math option; $ is legit character that is escapes as \$
rendering = rendering:match ('$%s+(.+)%s+%$') -- extract just the math text
elseif rendering:match ('<annotation[^>]+>.+</annotation>') then -- if MathML math option
rendering = rendering:match ('<annotation[^>]+>(.+)</annotation>') -- extract just the math text
else
return false, value; -- had math stripmarker but not one of the three defined forms
end
return true, value:gsub (stripmarker, rendering, 1);
end
--[[--------------------------< C O I N S _ C L E A N U P >----------------------------------------------------
Cleanup parameter values for the metadata by removing or replacing invisible characters and certain HTML entities.
2015-12-10: there is a bug in mw.text.unstripNoWiki (). It replaces math stripmarkers with the appropriate content
when it shouldn't. See https://phabricator.wikimedia.org/T121085 and Wikipedia_talk:Lua#stripmarkers_and_mw.text.unstripNoWiki.28.29
TODO: move the replacement patterns and replacement values into a table in /Configuration similar to the invisible
characters table?
]]
local function coins_cleanup (value)
local replaced = true; -- default state to get the do loop running
while replaced do -- loop until all math stripmarkers replaced
replaced, value = coins_replace_math_stripmarker (value); -- replace math stripmarker with text representation of the equation
end
value = value:gsub (cfg.stripmarkers['math'], "MATH RENDER ERROR"); -- one or more couldn't be replaced; insert vague error message
value = mw.text.unstripNoWiki (value); -- replace nowiki stripmarkers with their content
value = value:gsub ('<span class="nowrap" style="padding%-left:0%.1em;">'(s?)</span>', "'%1"); -- replace {{'}} or {{'s}} with simple apostrophe or apostrophe-s
value = value:gsub (' ', ' '); -- replace entity with plain space
value = value:gsub ('\226\128\138', ' '); -- replace hair space with plain space
if not mw.ustring.find (value, cfg.indic_script) then -- don't remove zero-width joiner characters from indic script
value = value:gsub ('‍', ''); -- remove ‍ entities
value = mw.ustring.gsub (value, '[\226\128\141\226\128\139\194\173]', ''); -- remove zero-width joiner, zero-width space, soft hyphen
end
value = value:gsub ('[\009\010\013 ]+', ' '); -- replace horizontal tab, line feed, carriage return with plain space
return value;
end
--[[--------------------------< C O I N S >--------------------------------------------------------------------
COinS metadata (see <http://ocoins.info/>) allows automated tools to parse the citation information.
]]
local function COinS(data, class)
if 'table' ~= type(data) or nil == next(data) then
return '';
end
for k, v in pairs (data) do -- spin through all of the metadata parameter values
if 'ID_list' ~= k and 'Authors' ~= k then -- except the ID_list and Author tables (author nowiki stripmarker done when Author table processed)
data[k] = coins_cleanup (v);
end
end
local ctx_ver = "Z39.88-2004";
-- treat table strictly as an array with only set values.
local OCinSoutput = setmetatable( {}, {
__newindex = function(self, key, value)
if is_set(value) then
rawset( self, #self+1, table.concat{ key, '=', mw.uri.encode( remove_wiki_link( value ) ) } );
end
end
});
if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn', 'journal', 'news', 'magazine'}) or
(in_array (class, {'conference', 'interview', 'map', 'press release', 'web'}) and is_set(data.Periodical)) or
('citation' == class and is_set(data.Periodical) and not is_set (data.Encyclopedia)) then
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:journal"; -- journal metadata identifier
if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) then -- set genre according to the type of citation template we are rendering
OCinSoutput["rft.genre"] = "preprint"; -- cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, cite ssrn
elseif 'conference' == class then
OCinSoutput["rft.genre"] = "conference"; -- cite conference (when Periodical set)
elseif 'web' == class then
OCinSoutput["rft.genre"] = "unknown"; -- cite web (when Periodical set)
else
OCinSoutput["rft.genre"] = "article"; -- journal and other 'periodical' articles
end
OCinSoutput["rft.jtitle"] = data.Periodical; -- journal only
OCinSoutput["rft.atitle"] = data.Title; -- 'periodical' article titles
-- these used only for periodicals
OCinSoutput["rft.ssn"] = data.Season; -- keywords: winter, spring, summer, fall
OCinSoutput["rft.quarter"] = data.Quarter; -- single digits 1->first quarter, etc.
OCinSoutput["rft.chron"] = data.Chron; -- free-form date components
OCinSoutput["rft.volume"] = data.Volume; -- does not apply to books
OCinSoutput["rft.issue"] = data.Issue;
OCinSoutput['rft.artnum'] = data.ArticleNumber; -- {{cite journal}} only
OCinSoutput["rft.pages"] = data.Pages; -- also used in book metadata
elseif 'thesis' ~= class then -- all others except cite thesis are treated as 'book' metadata; genre distinguishes
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:book"; -- book metadata identifier
if 'report' == class or 'techreport' == class then -- cite report and cite techreport
OCinSoutput["rft.genre"] = "report";
elseif 'conference' == class then -- cite conference when Periodical not set
OCinSoutput["rft.genre"] = "conference";
OCinSoutput["rft.atitle"] = data.Chapter; -- conference paper as chapter in proceedings (book)
elseif in_array (class, {'book', 'citation', 'encyclopaedia', 'interview', 'map'}) then
if is_set (data.Chapter) then
OCinSoutput["rft.genre"] = "bookitem";
OCinSoutput["rft.atitle"] = data.Chapter; -- book chapter, encyclopedia article, interview in a book, or map title
else
if 'map' == class or 'interview' == class then
OCinSoutput["rft.genre"] = 'unknown'; -- standalone map or interview
else
OCinSoutput["rft.genre"] = 'book'; -- book and encyclopedia
end
end
else -- {'audio-visual', 'AV-media-notes', 'DVD-notes', 'episode', 'interview', 'mailinglist', 'map', 'newsgroup', 'podcast', 'press release', 'serial', 'sign', 'speech', 'web'}
OCinSoutput["rft.genre"] = "unknown";
end
OCinSoutput["rft.btitle"] = data.Title; -- book only
OCinSoutput["rft.place"] = data.PublicationPlace; -- book only
OCinSoutput["rft.series"] = data.Series; -- book only
OCinSoutput["rft.pages"] = data.Pages; -- book, journal
OCinSoutput["rft.edition"] = data.Edition; -- book only
OCinSoutput["rft.pub"] = data.PublisherName; -- book and dissertation
else -- cite thesis
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:dissertation"; -- dissertation metadata identifier
OCinSoutput["rft.title"] = data.Title; -- dissertation (also patent but that is not yet supported)
OCinSoutput["rft.degree"] = data.Degree; -- dissertation only
OCinSoutput['rft.inst'] = data.PublisherName; -- book and dissertation
end
-- NB. Not currently supported are "info:ofi/fmt:kev:mtx:patent", "info:ofi/fmt:kev:mtx:dc", "info:ofi/fmt:kev:mtx:sch_svc", "info:ofi/fmt:kev:mtx:ctx"
-- and now common parameters (as much as possible)
OCinSoutput["rft.date"] = data.Date; -- book, journal, dissertation
for k, v in pairs( data.ID_list ) do -- what to do about these? For now assume that they are common to all?
if k == 'ISBN' then v = v:gsub( "[^-0-9X]", "" ); end
local id = cfg.id_handlers[k].COinS;
if string.sub( id or "", 1, 4 ) == 'info' then -- for ids that are in the info:registry
OCinSoutput["rft_id"] = table.concat{ id, "/", v };
elseif string.sub (id or "", 1, 3 ) == 'rft' then -- for isbn, issn, eissn, etc. that have defined COinS keywords
OCinSoutput[ id ] = v;
elseif 'url' == id then -- for urls that are assembled in ~/Identifiers; |asin= and |ol=
OCinSoutput["rft_id"] = table.concat ({data.ID_list[k], "#id-name=", cfg.id_handlers[k].label});
elseif id then -- when cfg.id_handlers[k].COinS is not nil so urls created here
OCinSoutput["rft_id"] = table.concat{ cfg.id_handlers[k].prefix, v, cfg.id_handlers[k].suffix or '', "#id-name=", cfg.id_handlers[k].label }; -- others; provide a URL and indicate identifier name as #fragment (human-readable, but transparent to browsers)
end
end
local last, first;
for k, v in ipairs( data.Authors ) do
last, first = coins_cleanup (v.last), coins_cleanup (v.first or ''); -- replace any nowiki stripmarkers, non-printing or invisible characters
if k == 1 then -- for the first author name only
if is_set(last) and is_set(first) then -- set these COinS values if |first= and |last= specify the first author name
OCinSoutput["rft.aulast"] = last; -- book, journal, dissertation
OCinSoutput["rft.aufirst"] = first; -- book, journal, dissertation
elseif is_set(last) then
OCinSoutput["rft.au"] = last; -- book, journal, dissertation -- otherwise use this form for the first name
end
else -- for all other authors
if is_set(last) and is_set(first) then
OCinSoutput["rft.au"] = table.concat{ last, ", ", first }; -- book, journal, dissertation
elseif is_set(last) then
OCinSoutput["rft.au"] = last; -- book, journal, dissertation
end
-- TODO: At present we do not report "et al.". Add anything special if this condition applies?
end
end
OCinSoutput.rft_id = data.URL;
OCinSoutput.rfr_id = table.concat{ "info:sid/", string.match (mw.site.server, "[^/]*$" ), ":", data.RawPage };
-- TODO: Add optional extra info:
-- rfr_dat=#REVISION<version> (referrer private data)
-- ctx_id=<data.RawPage>#<ref> (identifier for the context object)
-- ctx_tim=<ts> (timestamp in format yyyy-mm-ddThh:mm:ssTZD or yyyy-mm-dd)
-- ctx_enc=info:ofi/enc:UTF-8 (character encoding)
OCinSoutput = setmetatable( OCinSoutput, nil );
-- sort with version string always first, and combine.
-- table.sort( OCinSoutput );
table.insert( OCinSoutput, 1, "ctx_ver=" .. ctx_ver ); -- such as "Z39.88-2004"
return table.concat(OCinSoutput, "&");
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
cfg = cfg_table_ptr;
has_accept_as_written = utilities_page_ptr.has_accept_as_written; -- import functions from selected Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
remove_wiki_link = utilities_page_ptr.remove_wiki_link;
strip_apostrophe_markup = utilities_page_ptr.strip_apostrophe_markup;
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
make_coins_title = make_coins_title,
get_coins_pages = get_coins_pages,
COinS = COinS,
set_selected_modules = set_selected_modules,
}
eu68irewi9gjrldmcpvk6z9cf3rs6jt
74999
74998
2026-08-24T00:44:39Z
Robertsky
10424
1 versaun husi [[:en:Module:Citation/CS1/COinS]]
74998
Scribunto
text/plain
--[[--------------------------< F O R W A R D D E C L A R A T I O N S >--------------------------------------
]]
local has_accept_as_written, is_set, in_array, remove_wiki_link, strip_apostrophe_markup; -- functions in Module:Citation/CS1/Utilities
local cfg; -- table of configuration tables that are defined in Module:Citation/CS1/Configuration
--[[--------------------------< M A K E _ C O I N S _ T I T L E >----------------------------------------------
Makes a title for COinS from Title and / or ScriptTitle (or any other name-script pairs)
Apostrophe markup (bold, italics) is stripped from each value so that the COinS metadata isn't corrupted with strings
of %27%27...
]]
local function make_coins_title (title, script)
title = has_accept_as_written (title);
if is_set (title) then
title = strip_apostrophe_markup (title); -- strip any apostrophe markup
else
title = ''; -- if not set, make sure title is an empty string
end
if is_set (script) then
script = script:gsub ('^%l%l%s*:%s*', ''); -- remove language prefix if present (script value may now be empty string)
script = strip_apostrophe_markup (script); -- strip any apostrophe markup
else
script = ''; -- if not set, make sure script is an empty string
end
if is_set (title) and is_set (script) then
script = ' ' .. script; -- add a space before we concatenate
end
return title .. script; -- return the concatenation
end
--[[--------------------------< E S C A P E _ L U A _ M A G I C _ C H A R S >----------------------------------
Returns a string where all of Lua's magic characters have been escaped. This is important because functions like
string.gsub() treat their pattern and replace strings as patterns, not literal strings.
]]
local function escape_lua_magic_chars (argument)
argument = argument:gsub("%%", "%%%%"); -- replace % with %%
argument = argument:gsub("([%^%$%(%)%.%[%]%*%+%-%?])", "%%%1"); -- replace all other Lua magic pattern characters
return argument;
end
--[[--------------------------< G E T _ C O I N S _ P A G E S >------------------------------------------------
Extract page numbers from external wikilinks in any of the |page=, |pages=, or |at= parameters for use in COinS.
]]
local function get_coins_pages (pages)
local pattern;
if not is_set (pages) then return pages; end -- if no page numbers then we're done
while true do
pattern = pages:match("%[(%w*:?//[^ ]+%s+)[%w%d].*%]"); -- pattern is the opening bracket, the URL and following space(s): "[url "
if nil == pattern then break; end -- no more URLs
pattern = escape_lua_magic_chars (pattern); -- pattern is not a literal string; escape Lua's magic pattern characters
pages = pages:gsub(pattern, ""); -- remove as many instances of pattern as possible
end
pages = pages:gsub("[%[%]]", ""); -- remove the brackets
pages = pages:gsub("–", "-" ); -- replace endashes with hyphens
pages = pages:gsub("&%w+;", "-" ); -- and replace HTML entities (– etc.) with hyphens; do we need to replace numerical entities like   and the like?
pages = pages:gsub ('%b<>', ''); -- remove html-like tags; spans are added to <Pages> by utilities.hyphen_to_dash() which should not appear in COinS metadata
return pages;
end
--[=[-------------------------< C O I N S _ R E P L A C E _ M A T H _ S T R I P M A R K E R >------------------
There are three options for math markup rendering that depend on the editor's math preference settings. These
settings are at [[Special:Preferences#mw-prefsection-rendering]] and are
PNG images
TeX source
MathML with SVG or PNG fallback
All three are heavy with HTML and CSS which doesn't belong in the metadata.
Without this function, the metadata saved in the raw wikitext contained the rendering determined by the settings
of the last editor to save the page.
This function gets the rendered form of an equation according to the editor's preference before the page is saved. It
then searches the rendering for the text equivalent of the rendered equation and replaces the rendering with that so
that the page is saved without extraneous HTML/CSS markup and with a reasonably readable text form of the equation.
When a replacement is made, this function returns true and the value with replacement; otherwise false and the initial
value. To replace multipe equations it is necessary to call this function from within a loop.
]=]
local function coins_replace_math_stripmarker (value)
local stripmarker = cfg.stripmarkers['math'];
local rendering = value:match (stripmarker); -- is there a math stripmarker
if not rendering then -- when value doesn't have a math stripmarker, abandon this test
return false, value;
end
rendering = mw.text.unstripNoWiki (rendering); -- convert stripmarker into rendered value (or nil? ''? when math render error)
if rendering:match ('alt="[^"]+"') then -- if PNG math option
rendering = rendering:match ('alt="([^"]+)"'); -- extract just the math text
elseif rendering:match ('$%s+.+%s+%$') then -- if TeX math option; $ is legit character that is escapes as \$
rendering = rendering:match ('$%s+(.+)%s+%$') -- extract just the math text
elseif rendering:match ('<annotation[^>]+>.+</annotation>') then -- if MathML math option
rendering = rendering:match ('<annotation[^>]+>(.+)</annotation>') -- extract just the math text
else
return false, value; -- had math stripmarker but not one of the three defined forms
end
return true, value:gsub (stripmarker, rendering, 1);
end
--[[--------------------------< C O I N S _ C L E A N U P >----------------------------------------------------
Cleanup parameter values for the metadata by removing or replacing invisible characters and certain HTML entities.
2015-12-10: there is a bug in mw.text.unstripNoWiki (). It replaces math stripmarkers with the appropriate content
when it shouldn't. See https://phabricator.wikimedia.org/T121085 and Wikipedia_talk:Lua#stripmarkers_and_mw.text.unstripNoWiki.28.29
TODO: move the replacement patterns and replacement values into a table in /Configuration similar to the invisible
characters table?
]]
local function coins_cleanup (value)
local replaced = true; -- default state to get the do loop running
while replaced do -- loop until all math stripmarkers replaced
replaced, value = coins_replace_math_stripmarker (value); -- replace math stripmarker with text representation of the equation
end
value = value:gsub (cfg.stripmarkers['math'], "MATH RENDER ERROR"); -- one or more couldn't be replaced; insert vague error message
value = mw.text.unstripNoWiki (value); -- replace nowiki stripmarkers with their content
value = value:gsub ('<span class="nowrap" style="padding%-left:0%.1em;">'(s?)</span>', "'%1"); -- replace {{'}} or {{'s}} with simple apostrophe or apostrophe-s
value = value:gsub (' ', ' '); -- replace entity with plain space
value = value:gsub ('\226\128\138', ' '); -- replace hair space with plain space
if not mw.ustring.find (value, cfg.indic_script) then -- don't remove zero-width joiner characters from indic script
value = value:gsub ('‍', ''); -- remove ‍ entities
value = mw.ustring.gsub (value, '[\226\128\141\226\128\139\194\173]', ''); -- remove zero-width joiner, zero-width space, soft hyphen
end
value = value:gsub ('[\009\010\013 ]+', ' '); -- replace horizontal tab, line feed, carriage return with plain space
return value;
end
--[[--------------------------< C O I N S >--------------------------------------------------------------------
COinS metadata (see <http://ocoins.info/>) allows automated tools to parse the citation information.
]]
local function COinS(data, class)
if 'table' ~= type(data) or nil == next(data) then
return '';
end
for k, v in pairs (data) do -- spin through all of the metadata parameter values
if 'ID_list' ~= k and 'Authors' ~= k then -- except the ID_list and Author tables (author nowiki stripmarker done when Author table processed)
data[k] = coins_cleanup (v);
end
end
local ctx_ver = "Z39.88-2004";
-- treat table strictly as an array with only set values.
local OCinSoutput = setmetatable( {}, {
__newindex = function(self, key, value)
if is_set(value) then
rawset( self, #self+1, table.concat{ key, '=', mw.uri.encode( remove_wiki_link( value ) ) } );
end
end
});
if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn', 'journal', 'news', 'magazine'}) or
(in_array (class, {'conference', 'interview', 'map', 'press release', 'web'}) and is_set(data.Periodical)) or
('citation' == class and is_set(data.Periodical) and not is_set (data.Encyclopedia)) then
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:journal"; -- journal metadata identifier
if in_array (class, {'arxiv', 'biorxiv', 'citeseerx', 'medrxiv', 'ssrn'}) then -- set genre according to the type of citation template we are rendering
OCinSoutput["rft.genre"] = "preprint"; -- cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, cite ssrn
elseif 'conference' == class then
OCinSoutput["rft.genre"] = "conference"; -- cite conference (when Periodical set)
elseif 'web' == class then
OCinSoutput["rft.genre"] = "unknown"; -- cite web (when Periodical set)
else
OCinSoutput["rft.genre"] = "article"; -- journal and other 'periodical' articles
end
OCinSoutput["rft.jtitle"] = data.Periodical; -- journal only
OCinSoutput["rft.atitle"] = data.Title; -- 'periodical' article titles
-- these used only for periodicals
OCinSoutput["rft.ssn"] = data.Season; -- keywords: winter, spring, summer, fall
OCinSoutput["rft.quarter"] = data.Quarter; -- single digits 1->first quarter, etc.
OCinSoutput["rft.chron"] = data.Chron; -- free-form date components
OCinSoutput["rft.volume"] = data.Volume; -- does not apply to books
OCinSoutput["rft.issue"] = data.Issue;
OCinSoutput['rft.artnum'] = data.ArticleNumber; -- {{cite journal}} only
OCinSoutput["rft.pages"] = data.Pages; -- also used in book metadata
elseif 'thesis' ~= class then -- all others except cite thesis are treated as 'book' metadata; genre distinguishes
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:book"; -- book metadata identifier
if 'report' == class or 'techreport' == class then -- cite report and cite techreport
OCinSoutput["rft.genre"] = "report";
elseif 'conference' == class then -- cite conference when Periodical not set
OCinSoutput["rft.genre"] = "conference";
OCinSoutput["rft.atitle"] = data.Chapter; -- conference paper as chapter in proceedings (book)
elseif in_array (class, {'book', 'citation', 'encyclopaedia', 'interview', 'map'}) then
if is_set (data.Chapter) then
OCinSoutput["rft.genre"] = "bookitem";
OCinSoutput["rft.atitle"] = data.Chapter; -- book chapter, encyclopedia article, interview in a book, or map title
else
if 'map' == class or 'interview' == class then
OCinSoutput["rft.genre"] = 'unknown'; -- standalone map or interview
else
OCinSoutput["rft.genre"] = 'book'; -- book and encyclopedia
end
end
else -- {'audio-visual', 'AV-media-notes', 'DVD-notes', 'episode', 'interview', 'mailinglist', 'map', 'newsgroup', 'podcast', 'press release', 'serial', 'sign', 'speech', 'web'}
OCinSoutput["rft.genre"] = "unknown";
end
OCinSoutput["rft.btitle"] = data.Title; -- book only
OCinSoutput["rft.place"] = data.PublicationPlace; -- book only
OCinSoutput["rft.series"] = data.Series; -- book only
OCinSoutput["rft.pages"] = data.Pages; -- book, journal
OCinSoutput["rft.edition"] = data.Edition; -- book only
OCinSoutput["rft.pub"] = data.PublisherName; -- book and dissertation
else -- cite thesis
OCinSoutput.rft_val_fmt = "info:ofi/fmt:kev:mtx:dissertation"; -- dissertation metadata identifier
OCinSoutput["rft.title"] = data.Title; -- dissertation (also patent but that is not yet supported)
OCinSoutput["rft.degree"] = data.Degree; -- dissertation only
OCinSoutput['rft.inst'] = data.PublisherName; -- book and dissertation
end
-- NB. Not currently supported are "info:ofi/fmt:kev:mtx:patent", "info:ofi/fmt:kev:mtx:dc", "info:ofi/fmt:kev:mtx:sch_svc", "info:ofi/fmt:kev:mtx:ctx"
-- and now common parameters (as much as possible)
OCinSoutput["rft.date"] = data.Date; -- book, journal, dissertation
for k, v in pairs( data.ID_list ) do -- what to do about these? For now assume that they are common to all?
if k == 'ISBN' then v = v:gsub( "[^-0-9X]", "" ); end
local id = cfg.id_handlers[k].COinS;
if string.sub( id or "", 1, 4 ) == 'info' then -- for ids that are in the info:registry
OCinSoutput["rft_id"] = table.concat{ id, "/", v };
elseif string.sub (id or "", 1, 3 ) == 'rft' then -- for isbn, issn, eissn, etc. that have defined COinS keywords
OCinSoutput[ id ] = v;
elseif 'url' == id then -- for urls that are assembled in ~/Identifiers; |asin= and |ol=
OCinSoutput["rft_id"] = table.concat ({data.ID_list[k], "#id-name=", cfg.id_handlers[k].label});
elseif id then -- when cfg.id_handlers[k].COinS is not nil so urls created here
OCinSoutput["rft_id"] = table.concat{ cfg.id_handlers[k].prefix, v, cfg.id_handlers[k].suffix or '', "#id-name=", cfg.id_handlers[k].label }; -- others; provide a URL and indicate identifier name as #fragment (human-readable, but transparent to browsers)
end
end
local last, first;
for k, v in ipairs( data.Authors ) do
last, first = coins_cleanup (v.last), coins_cleanup (v.first or ''); -- replace any nowiki stripmarkers, non-printing or invisible characters
if k == 1 then -- for the first author name only
if is_set(last) and is_set(first) then -- set these COinS values if |first= and |last= specify the first author name
OCinSoutput["rft.aulast"] = last; -- book, journal, dissertation
OCinSoutput["rft.aufirst"] = first; -- book, journal, dissertation
elseif is_set(last) then
OCinSoutput["rft.au"] = last; -- book, journal, dissertation -- otherwise use this form for the first name
end
else -- for all other authors
if is_set(last) and is_set(first) then
OCinSoutput["rft.au"] = table.concat{ last, ", ", first }; -- book, journal, dissertation
elseif is_set(last) then
OCinSoutput["rft.au"] = last; -- book, journal, dissertation
end
-- TODO: At present we do not report "et al.". Add anything special if this condition applies?
end
end
OCinSoutput.rft_id = data.URL;
OCinSoutput.rfr_id = table.concat{ "info:sid/", string.match (mw.site.server, "[^/]*$" ), ":", data.RawPage };
-- TODO: Add optional extra info:
-- rfr_dat=#REVISION<version> (referrer private data)
-- ctx_id=<data.RawPage>#<ref> (identifier for the context object)
-- ctx_tim=<ts> (timestamp in format yyyy-mm-ddThh:mm:ssTZD or yyyy-mm-dd)
-- ctx_enc=info:ofi/enc:UTF-8 (character encoding)
OCinSoutput = setmetatable( OCinSoutput, nil );
-- sort with version string always first, and combine.
-- table.sort( OCinSoutput );
table.insert( OCinSoutput, 1, "ctx_ver=" .. ctx_ver ); -- such as "Z39.88-2004"
return table.concat(OCinSoutput, "&");
end
--[[--------------------------< S E T _ S E L E C T E D _ M O D U L E S >--------------------------------------
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.
]]
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)
cfg = cfg_table_ptr;
has_accept_as_written = utilities_page_ptr.has_accept_as_written; -- import functions from selected Module:Citation/CS1/Utilities module
is_set = utilities_page_ptr.is_set;
in_array = utilities_page_ptr.in_array;
remove_wiki_link = utilities_page_ptr.remove_wiki_link;
strip_apostrophe_markup = utilities_page_ptr.strip_apostrophe_markup;
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
make_coins_title = make_coins_title,
get_coins_pages = get_coins_pages,
COinS = COinS,
set_selected_modules = set_selected_modules,
}
eu68irewi9gjrldmcpvk6z9cf3rs6jt
Template:Color
10
7863
74886
72122
2026-07-06T06:00:56Z
en>Izno
0
Restored revision 1240326979 by [[Special:Contributions/Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]): Revert per talk page
74886
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>ifsubst|1=<span|2=<templatestyles src="Template:Color/styles.css" /><span class="tmp-color"}} style="color:{{{1|}}}">{{{2|{{{1|}}}}}}<includeonly></span></includeonly><noinclude>{{Documentation}}<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --></noinclude>
mir66vdgg1ofukylprfapm1rh3vaahk
74887
74886
2026-08-24T00:42:42Z
Robertsky
10424
1 versaun husi [[:en:Template:Color]]
74886
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>ifsubst|1=<span|2=<templatestyles src="Template:Color/styles.css" /><span class="tmp-color"}} style="color:{{{1|}}}">{{{2|{{{1|}}}}}}<includeonly></span></includeonly><noinclude>{{Documentation}}<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --></noinclude>
mir66vdgg1ofukylprfapm1rh3vaahk
Template:Infobox mapframe/doc/parameters
10
7919
74792
72296
2026-07-27T16:48:25Z
en>Colonies Chris
0
74792
wikitext
text/x-wiki
<includeonly>{{navbar|Template:Infobox mapframe/doc/parameters|plain=y|style=float: right;}}</includeonly><nowiki></nowiki>
*Basic {{template link|Infobox mapframe}} parameters:{{#if:{{{noprefix|}}}||<nowiki></nowiki>
**'''mapframe''' – Specify yes or no to show or hide the map, overriding the default. ''Default:'' {{{mapframe|no}}}{{#if:{{{onByDefault|}}}|, ''but also modified by onByDefault''}}
*** Internal ''onByDefault'' parameter: {{{onByDefault|''not specified''}}}
**{{#if:{{{noprefix|}}}||'''mapframe-coordinates''' or '''mapframe-coord''' or}} '''coordinates''' or '''coord''' – Coordinates to use, instead of any on Wikidata. Use the {{template link|Coord}} template, e.g. {{parameter|coord|2={{template link expanded|Coord|12.34|N|56.78|E}}}}. ''Default:'' {{{mapframe-coordinates|{{{mapframe-coord|{{{coordinates|{{{coord|''coordinates from Wikidata [[d:Property:P625]]''}}}}}}}}}}}}
**'''mapframe-caption''' – Caption for the map. ''Default'': {{{mapframe-caption|''blank'' (or if {{parameter|mapframe-geomask}} is set, "Location in {{kbd|geomask's label}}")}}}
**'''mapframe-custom''' – Use a custom map instead of the automatic mapframe. Specify either a {{template link expanded|maplink}} template, or another template that generates a mapframe map, or an image name. If used, most mapframe parameters will be ignored. ''Default'': ''not specified''}}
**{{#if:{{{noprefix|}}}|'''id'''|'''mapframe-id''' or '''id''' or '''qid'''}} – Id (Q-number) of Wikidata item to use. ''Default:'' ''item for current page''
**'''{{#if:{{{noprefix|}}}||mapframe-}}wikidata''' – Set to {{code|yes}} to show all shape/line features from OpenStreetMap. ''Default:'' {{{mapframe-wikidata|''not specified''}}}
*Customise which features are displayed:
**'''{{#if:{{{noprefix|}}}||mapframe-}}point''' – Turn off display of point feature by setting to {{code|none}}. Force point marker to be displayed by setting to {{code|on}}. ''Default:'' {{{mapframe-point|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape''' – Turn off display of shape feature by setting to {{code|none}}. Force display of shape by setting to {{code|on}}. Use an inverse shape (geomask) instead of a regular shape by setting to {{code|inverse}}. ''Default:'' {{{mapframe-shape|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}line''' – Turn off display of line feature by setting to {{code|none}}. Force display of line by setting to {{code|on}}. ''Default:'' {{{mapframe-line|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask''' – Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. <code>P17</code> for {{Wikidata entity link|P17}}, <code>P131</code> for {{Wikidata entity link|P131}}). ''Default:'' {{{mapframe-geomask|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}switcher''' – set to {{code|auto}} or {{code|geomasks}} or {{code|zooms}} to enable [[Template:Switcher]]-style switching between multiple mapframes. ''Default:'' {{{mapframe-switcher|''not specified''}}}
***{{code|auto}} – switch geomasks found in {{Wikidata entity link|P276}} and {{Wikidata entity link|P131}} statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country.
***{{code|geomasks}} – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the '''{{#if:{{{noprefix|}}}||mapframe-}}geomask''' parameter
***{{code|zooms}} – switch between "zoomed in"/"zoomed midway"/"zoomed out", where "zoomed in" is the default zoom (with a minimum of {{code|3}}), "zoomed out" is {{code|1}}, and "zoomed midway" is the average
*Other optional parameters:
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-width''' or '''{{#if:{{{noprefix|}}}||mapframe-}}width''' – Frame width. ''Default:'' {{{mapframe-frame-width|270}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-height''' or '''{{#if:{{{noprefix|}}}||mapframe-}}height''' – Frame height. ''Default:'' {{{mapframe-frame-height|200}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape-fill''' – Color used to fill shape features. ''Default:'' {{{mapframe-shape-fill|#606060}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape-fill-opacity''' – Opacity level of shape fill, a number between 0 and 1. ''Default:'' {{{mapframe-shape-fill-opacity|0.1}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}stroke-colour''' – Color of line features, and outlines of shape features. ''Default:'' {{{mapframe-stroke-color|{{{mapframe-stroke-colour|#ff0000}}}}}}
***'''{{#if:{{{noprefix|}}}||mapframe-}}line-stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}line-stroke-colour''' – Color of line features. ''Default:'' {{{mapframe-line-stroke-color|{{{mapframe-line-stroke-colour|#ff0000}}}}}}
***'''{{#if:{{{noprefix|}}}||mapframe-}}shape-stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}shape-stroke-colour''' – Color of outlines of shape features. ''Default:'' {{{mapframe-shape-stroke-color|{{{mapframe-shape-stroke-colour|#ff0000}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}stroke-width''' – Width of line features, and outlines of shape features. ''Default:'' {{{mapframe-stroke-width|2}}}
***'''{{#if:{{{noprefix|}}}||mapframe-}}shape-stroke-width''' – Width of outlines of shape features. ''Default:'' {{{mapframe-shape-stroke-width|2}}}
***'''{{#if:{{{noprefix|}}}||mapframe-}}line-stroke-width''' – Width of line features. ''Default:'' {{{mapframe-line-stroke-width|5}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}marker''' – Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options. ''Default:'' {{{mapframe-marker|''not specified (i.e. blank)''}}}
***Can also be set to {{code|blank}} to override any default marker symbol
**'''{{#if:{{{noprefix|}}}||mapframe-}}marker-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}marker-colour''' – Background color for the marker. ''Default:'' {{{mapframe-marker-color|{{{mapframe-marker-colour|#5E74F3}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-colour''' – Color of outline of geomask shape. ''Default:'' {{{mapframe-geomask-stroke-color|{{{mapframe-geomask-stroke-colour|#555555}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-width''' – Width of outline of geomask shape. ''Default:'' {{{mapframe-geomask-stroke-width|1}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-fill''' – Color used to fill outside geomask features. ''Default:'' {{{mapframe-geomask-fill|#606060}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-fill-opacity''' – Opacity level of fill outside geomask features, a number between 0 and 1. ''Default:'' {{{mapframe-geomask-fill-opacity|0.25}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}zoom''' – Set the zoom level, from "1" (map of earth) to "18" (maximum zoom in), to be used if the zoom level cannot be determined automatically from object length or area. ''Default:'' {{{mapframe-zoom|10}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}length_km {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}length_mi {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}area_km2 {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}area_mi2''' – Determine zoom level by passing in object's length (in kilometres or miles) or area (in square kilometres or square miles). ''Default:'' ''{{{mapframe-length_km|not specified}}} / {{{mapframe-length_mi|not specified}}} / {{{mapframe-area_km2|not specified}}} / {{{mapframe-area_mi2|not specified}}}''
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-coordinates''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-coord''' – Alternate latitude and longitude coordinates for initial placement of map, using {{template link|coord}}. ''Default:'' ''derived from item coordinates''
**'''{{#if:{{{noprefix|}}}||mapframe-}}type''' – Set the type of the object, with the same usage as {{template link|coord}}. ''Default:'' {{{mapframe-type|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}population''' – Set the population, useful with type="city", for {{template link|Infobox dim}}. ''Default:'' {{{mapframe-population|''not specified''}}}
{{#if:{{{deprecated|}}}|<nowiki></nowiki>
*Deprecated parameters
**{{gray|1='''{{#if:{{{noprefix|}}}||mapframe-}}frame-lat''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-latitude'''}} – Alternate latitude coordinate for initial placement of map; default is derived from item coordinates
**{{gray|1='''{{#if:{{{noprefix|}}}||mapframe-}}frame-long''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-longitude'''}} – Alternate longitude coordinate for initial placement of map; default is derived from item coordinates
}}<noinclude>{{Documentation}}</noinclude>
m9i7fxps41pg486hh7627679kudsuol
74793
74792
2026-08-24T00:15:11Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mapframe/doc/parameters]]
74792
wikitext
text/x-wiki
<includeonly>{{navbar|Template:Infobox mapframe/doc/parameters|plain=y|style=float: right;}}</includeonly><nowiki></nowiki>
*Basic {{template link|Infobox mapframe}} parameters:{{#if:{{{noprefix|}}}||<nowiki></nowiki>
**'''mapframe''' – Specify yes or no to show or hide the map, overriding the default. ''Default:'' {{{mapframe|no}}}{{#if:{{{onByDefault|}}}|, ''but also modified by onByDefault''}}
*** Internal ''onByDefault'' parameter: {{{onByDefault|''not specified''}}}
**{{#if:{{{noprefix|}}}||'''mapframe-coordinates''' or '''mapframe-coord''' or}} '''coordinates''' or '''coord''' – Coordinates to use, instead of any on Wikidata. Use the {{template link|Coord}} template, e.g. {{parameter|coord|2={{template link expanded|Coord|12.34|N|56.78|E}}}}. ''Default:'' {{{mapframe-coordinates|{{{mapframe-coord|{{{coordinates|{{{coord|''coordinates from Wikidata [[d:Property:P625]]''}}}}}}}}}}}}
**'''mapframe-caption''' – Caption for the map. ''Default'': {{{mapframe-caption|''blank'' (or if {{parameter|mapframe-geomask}} is set, "Location in {{kbd|geomask's label}}")}}}
**'''mapframe-custom''' – Use a custom map instead of the automatic mapframe. Specify either a {{template link expanded|maplink}} template, or another template that generates a mapframe map, or an image name. If used, most mapframe parameters will be ignored. ''Default'': ''not specified''}}
**{{#if:{{{noprefix|}}}|'''id'''|'''mapframe-id''' or '''id''' or '''qid'''}} – Id (Q-number) of Wikidata item to use. ''Default:'' ''item for current page''
**'''{{#if:{{{noprefix|}}}||mapframe-}}wikidata''' – Set to {{code|yes}} to show all shape/line features from OpenStreetMap. ''Default:'' {{{mapframe-wikidata|''not specified''}}}
*Customise which features are displayed:
**'''{{#if:{{{noprefix|}}}||mapframe-}}point''' – Turn off display of point feature by setting to {{code|none}}. Force point marker to be displayed by setting to {{code|on}}. ''Default:'' {{{mapframe-point|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape''' – Turn off display of shape feature by setting to {{code|none}}. Force display of shape by setting to {{code|on}}. Use an inverse shape (geomask) instead of a regular shape by setting to {{code|inverse}}. ''Default:'' {{{mapframe-shape|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}line''' – Turn off display of line feature by setting to {{code|none}}. Force display of line by setting to {{code|on}}. ''Default:'' {{{mapframe-line|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask''' – Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. <code>P17</code> for {{Wikidata entity link|P17}}, <code>P131</code> for {{Wikidata entity link|P131}}). ''Default:'' {{{mapframe-geomask|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}switcher''' – set to {{code|auto}} or {{code|geomasks}} or {{code|zooms}} to enable [[Template:Switcher]]-style switching between multiple mapframes. ''Default:'' {{{mapframe-switcher|''not specified''}}}
***{{code|auto}} – switch geomasks found in {{Wikidata entity link|P276}} and {{Wikidata entity link|P131}} statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country.
***{{code|geomasks}} – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the '''{{#if:{{{noprefix|}}}||mapframe-}}geomask''' parameter
***{{code|zooms}} – switch between "zoomed in"/"zoomed midway"/"zoomed out", where "zoomed in" is the default zoom (with a minimum of {{code|3}}), "zoomed out" is {{code|1}}, and "zoomed midway" is the average
*Other optional parameters:
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-width''' or '''{{#if:{{{noprefix|}}}||mapframe-}}width''' – Frame width. ''Default:'' {{{mapframe-frame-width|270}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-height''' or '''{{#if:{{{noprefix|}}}||mapframe-}}height''' – Frame height. ''Default:'' {{{mapframe-frame-height|200}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape-fill''' – Color used to fill shape features. ''Default:'' {{{mapframe-shape-fill|#606060}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}shape-fill-opacity''' – Opacity level of shape fill, a number between 0 and 1. ''Default:'' {{{mapframe-shape-fill-opacity|0.1}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}stroke-colour''' – Color of line features, and outlines of shape features. ''Default:'' {{{mapframe-stroke-color|{{{mapframe-stroke-colour|#ff0000}}}}}}
***'''{{#if:{{{noprefix|}}}||mapframe-}}line-stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}line-stroke-colour''' – Color of line features. ''Default:'' {{{mapframe-line-stroke-color|{{{mapframe-line-stroke-colour|#ff0000}}}}}}
***'''{{#if:{{{noprefix|}}}||mapframe-}}shape-stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}shape-stroke-colour''' – Color of outlines of shape features. ''Default:'' {{{mapframe-shape-stroke-color|{{{mapframe-shape-stroke-colour|#ff0000}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}stroke-width''' – Width of line features, and outlines of shape features. ''Default:'' {{{mapframe-stroke-width|2}}}
***'''{{#if:{{{noprefix|}}}||mapframe-}}shape-stroke-width''' – Width of outlines of shape features. ''Default:'' {{{mapframe-shape-stroke-width|2}}}
***'''{{#if:{{{noprefix|}}}||mapframe-}}line-stroke-width''' – Width of line features. ''Default:'' {{{mapframe-line-stroke-width|5}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}marker''' – Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options. ''Default:'' {{{mapframe-marker|''not specified (i.e. blank)''}}}
***Can also be set to {{code|blank}} to override any default marker symbol
**'''{{#if:{{{noprefix|}}}||mapframe-}}marker-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}marker-colour''' – Background color for the marker. ''Default:'' {{{mapframe-marker-color|{{{mapframe-marker-colour|#5E74F3}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-color''' or '''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-colour''' – Color of outline of geomask shape. ''Default:'' {{{mapframe-geomask-stroke-color|{{{mapframe-geomask-stroke-colour|#555555}}}}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-stroke-width''' – Width of outline of geomask shape. ''Default:'' {{{mapframe-geomask-stroke-width|1}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-fill''' – Color used to fill outside geomask features. ''Default:'' {{{mapframe-geomask-fill|#606060}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}geomask-fill-opacity''' – Opacity level of fill outside geomask features, a number between 0 and 1. ''Default:'' {{{mapframe-geomask-fill-opacity|0.25}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}zoom''' – Set the zoom level, from "1" (map of earth) to "18" (maximum zoom in), to be used if the zoom level cannot be determined automatically from object length or area. ''Default:'' {{{mapframe-zoom|10}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}length_km {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}length_mi {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}area_km2 {{nobold|or}} {{#if:{{{noprefix|}}}||mapframe-}}area_mi2''' – Determine zoom level by passing in object's length (in kilometres or miles) or area (in square kilometres or square miles). ''Default:'' ''{{{mapframe-length_km|not specified}}} / {{{mapframe-length_mi|not specified}}} / {{{mapframe-area_km2|not specified}}} / {{{mapframe-area_mi2|not specified}}}''
**'''{{#if:{{{noprefix|}}}||mapframe-}}frame-coordinates''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-coord''' – Alternate latitude and longitude coordinates for initial placement of map, using {{template link|coord}}. ''Default:'' ''derived from item coordinates''
**'''{{#if:{{{noprefix|}}}||mapframe-}}type''' – Set the type of the object, with the same usage as {{template link|coord}}. ''Default:'' {{{mapframe-type|''not specified''}}}
**'''{{#if:{{{noprefix|}}}||mapframe-}}population''' – Set the population, useful with type="city", for {{template link|Infobox dim}}. ''Default:'' {{{mapframe-population|''not specified''}}}
{{#if:{{{deprecated|}}}|<nowiki></nowiki>
*Deprecated parameters
**{{gray|1='''{{#if:{{{noprefix|}}}||mapframe-}}frame-lat''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-latitude'''}} – Alternate latitude coordinate for initial placement of map; default is derived from item coordinates
**{{gray|1='''{{#if:{{{noprefix|}}}||mapframe-}}frame-long''' or '''{{#if:{{{noprefix|}}}||mapframe-}}frame-longitude'''}} – Alternate longitude coordinate for initial placement of map; default is derived from item coordinates
}}<noinclude>{{Documentation}}</noinclude>
m9i7fxps41pg486hh7627679kudsuol
Módulo:ConvertIB
828
7924
74873
72306
2026-07-11T19:22:17Z
en>Hike395
0
handle sigfig for cases like 0.0029 (should be 2)
74873
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
-- Function to pull out values and units from numeric args
-- Returns:
-- values: list of numeric values, or "false" if no numeric argument is given
-- units: list of units (str)
-- value: if there is a last numeric value unpaired with a unit, it becomes the precision
-- anyValue: whether there is a non-false value in the values list
local function parseValuesUnits(args)
local values = {}
local units = {}
local indx = 1
local value = nil
local anyValue = false
-- loop through numeric arguments in pairs
while args[indx] or args[indx+1] do
value = args[indx]
anyValue = anyValue or value
-- if there is a unit, save in output lists
if args[indx+1] then
table.insert(values, value or false)
table.insert(units, args[indx+1])
value = nil
end
indx = indx+2
end
return values, units, value, anyValue
end
-- Function to identify multiple units and rewrite them as new input or output groups
-- Args:
-- values, units: numeric values and units, as lists with same length
-- Returns:
-- newValues, newUnits: same lists rewritten
local function parseMultiples(values, units)
local newValues = {}
local newUnits = {}
local i = 1
-- we will search for multiples with up to 4 entries (depending on length)
local maxMultiple = math.min(4,#units-1)
local valueFound = false -- flag to suppress second (and later) input values
--- Hack for handling "stone": check if only value supplied is "lb"
local onlyPounds = true
for i = 1, #units do
if values[i] and units[i] ~= 'lb' then
onlyPounds = false
break
end
end
local multiple = mw.loadData('Module:ConvertIB/data').multiple
-- sweep through units
while i <= #units do
-- determine index of last possible unit that could contain a multiple
local last_unit = math.min(i+maxMultiple-1,#units)
local multipleFound = false
-- try from longest multiple down to double multiple (prefer longest ones)
for j = last_unit, i+1, -1 do
local key = table.concat({unpack(units,i,j)}, '')
if multiple[key] then
-- we found a multiple unit
multipleFound = true
-- Hack for "stone": add either 'lb' or multiple unit string to output units
-- depending on whether 'lb' was the only unit string with a value
if mw.ustring.sub(key,1,2) == 'st' then
table.insert(newValues, false)
table.insert(newUnits, onlyPounds and key or 'lb')
end
-- if there are any value in the span of the multiple,
-- then the multiple is an input
-- assume all missing values after the first are zero
local firstValueFound = false
for k = i, j do
firstValueFound = not valueFound and (firstValueFound or values[k])
if firstValueFound then
table.insert(newValues, values[k] or 0)
table.insert(newUnits, units[k])
end
end
valueFound = valueFound or firstValueFound
-- if no values in the span of the multiple,
-- then the multiple is an output. Insert combined string as output unit
if not firstValueFound then
table.insert(newValues, false)
table.insert(newUnits, key)
end
i = j+1
break
end
end
--- If no multiple unit was found, insert value[i] and unit[i] into rewritten lists
if not multipleFound then
if valueFound then
table.insert(newValues, false) -- skip writing value if it is a duplicate
else
table.insert(newValues,values[i])
valueFound = values[i]
end
table.insert(newUnits, units[i])
i = i+1
end
end
return newValues, newUnits
end
-- Call {{convert}} with args
local function callConvert(args)
local frame = mw.getCurrentFrame()
return frame:expandTemplate{title='Convert', args=args}
end
-- Implement {{convinfobox}}
function p._convert(args)
-- find all values and units in numeric args (and the precision, if it exists)
local values, units, precision, anyValue = parseValuesUnits(args)
-- bail if no values at all
if not anyValue then
return nil
end
-- rewrite values and units if multiple units are found
values, units = parseMultiples(values, units)
-- sort input and outputs into different buckets
local input_values = {}
local input_units = {}
local output_units = {}
for i = 1, #units do
if values[i] then
table.insert(input_values, values[i])
table.insert(input_units, units[i])
else
table.insert(output_units, units[i])
end
end
-- bail if nothing to convert
if #input_values == 0 or #output_units == 0 then
return nil
end
-- assemble argument list to {{convert}}
local innerArgs = {}
-- First, pass all input unit(s)
for i, v in ipairs(input_values) do
table.insert(innerArgs,v)
table.insert(innerArgs,input_units[i])
end
-- Then the output unit(s) [concatenated as single argument]
table.insert(innerArgs,table.concat(output_units,"+"))
if precision then
table.insert(innerArgs,precision) -- last non-nil value contains precision
end
-- now handle all non-numeric arguments, passing to {{convert}}
innerArgs.abbr = 'on' -- abbr=on by default
for k, v in pairs(args) do
if not tonumber(k) then
innerArgs[k] = v
end
end
return callConvert(innerArgs)
end
local function impUnitPref(pref,country)
--- lower case all arguments
pref = pref and mw.ustring.lower(pref)
country = country and mw.ustring.lower(country)
--- determine imperial unit by going thru arguments in priority order
if pref and pref ~= 'dunam' then
local impPref = mw.loadData('Module:ConvertIB/data').impPref
return impPref[pref]
elseif country then
return mw.ustring.find(country,"united states",1,true)
or mw.ustring.find(country,"united kingdom",1,true)
end
return false
end
local largeUnits = {km2=true,mi2=true,sqmi=true,km=true,mi=true}
-- Implement {{Infobox settlement/areadisp}}
function p._area(args)
local pref = args['pref']
local country = args['name']
local impus = impUnitPref(pref, country)
local dunam = args['dunam'] or args['dunum']
local link = args['link']
local innerArgs = {}
innerArgs.abbr = 'on'
innerArgs.order = 'out'
for _, unit in ipairs({'km2','mi2','sqmi','ha','acre'}) do
if args[unit] then
table.insert(innerArgs,args[unit])
table.insert(innerArgs,unit)
if largeUnits[unit] then
table.insert(innerArgs,impus and 'sqmi km2' or 'km2 sqmi')
else
table.insert(innerArgs,impus and 'acre ha' or 'ha acre')
end
return callConvert(innerArgs)
end
end
if dunam then
table.insert(innerArgs,dunam)
table.insert(innerArgs,'dunam')
pref = pref and mw.ustring.lower(pref)
local order = pref == 'dunam' and 'dunam ' or ''
dunam = mw.getContentLanguage():parseFormattedNumber(dunam)
if impus then
order = order..(dunam and dunam < 2589 and 'acre ha' or 'sqmi km2')
else
order = order..(dunam and dunam < 1000 and 'ha acre' or 'km2 sqmi')
end
table.insert(innerArgs,order)
local yesNo = require('Module:Yesno')
if yesNo(link,true) and link ~= 'none' then
innerArgs.lk = 'in'
end
return callConvert(innerArgs)
end
return nil
end
-- Implement {{Infobox settlement/lengthdisp}}
function p._length(args)
local pref = args['pref']
if pref == 'dunam' then -- ignore dunam pref for this function
pref = nil
end
local country = args['name']
local impus = impUnitPref(pref, country)
local innerArgs = {}
innerArgs.abbr = 'on'
innerArgs.order = 'out'
for _, unit in ipairs({'km','mi','m','ft'}) do
if args[unit] then
table.insert(innerArgs,args[unit])
table.insert(innerArgs,unit)
if largeUnits[unit] then
table.insert(innerArgs,impus and 'mi km' or 'km mi')
else
table.insert(innerArgs,impus and 'ft m' or 'm ft')
end
return callConvert(innerArgs)
end
end
return nil
end
local lang
local function parseNumeric(s)
local num_str = string.match(tostring(s), '^[+-]?%d[%d,]*%.?%d*e?[+-]?%d*')
if not num_str then
return nil
end
lang = lang or mw.getContentLanguage()
return lang:parseFormattedNumber(num_str)
end
--Compute number of significant digits in a numeric string
local function computeSigFig(s)
local num_str = string.match(tostring(s), '^[+-]?%d[%d,]*%.?%d*')
if not num_str then
return 0
end
-- Strip leading signs
num_str = string.gsub(num_str, '^[+-]', '')
-- Strip commas
num_str = string.gsub(num_str, ',', '')
-- Strip leading zeros that cross decimal point
num_str = string.gsub(num_str, '^0*%.0*','.')
-- Strip leading zeros
num_str = string.gsub(num_str, '^0*', '')
if num_str == '' then
return 0
end
-- If there's a decimal point, all trailing zeros are significant.
if string.find(num_str, '%.') then
return #string.gsub(num_str, '%.', '') -- Count all digits after removing decimal
end
-- If no decimal point, trailing zeros are not significant.
-- Count all digits up to the last non-zero one.
num_str = string.gsub(num_str, '0+$', '')
return #num_str
end
-- Implement {{Infobox settlement/densdisp}}
-- Returns table:
-- density = computed value if no error
-- error = error string if error.
-- These are only errors detected in this code, {{convert}} does its own error handling
function p._density(args)
local result = {}
local pref = args['pref']
if pref == 'dunam' then -- ignore dunam pref for this function
pref = nil
end
local country = args['name']
local per_km2 = args['/km2']
local per_mi2 = args['/mi2'] or args['/sqmi']
local impus = impUnitPref(pref, country, per_km2, per_mi2)
local per_km2_value = parseNumeric(per_km2)
local per_mi2_value = parseNumeric(per_mi2)
local innerArgs = {}
innerArgs.abbr = 'on'
if per_km2_value or per_mi2_value then
innerArgs.order = 'out'
if per_km2_value then
table.insert(innerArgs,per_km2_value)
table.insert(innerArgs,'/km2')
else
table.insert(innerArgs,per_mi2_value)
table.insert(innerArgs,'/sqmi')
end
table.insert(innerArgs,impus and '/sqmi /km2' or '/km2 /sqmi')
result.density = callConvert(innerArgs)
return result
end
if per_km2 ~= 'auto' and per_mi2 ~= 'auto' then
-- automatic computation not requested, fail silently
return result
end
if not args['pop'] then
-- fail silently if no population given
return result
end
local areaSigFig
local areaValue
local areaUnit
for _, unit in ipairs({'km2','mi2','sqmi','ha','acre','dunam','dunum'}) do
local value = parseNumeric(args[unit])
if value then
if value <= 0 then
result.error = unit.." value not positive"
return result
end
areaValue = value
areaUnit = unit
areaSigFig = computeSigFig(args[unit])
break
elseif args[unit] then
result.error = "Malformed "..unit.." value"
return result
end
end
if not areaSigFig then
-- fail silently if no area given
return result
end
if areaSigFig == 0 then
result.error = "Malformed area string"
return result
end
local popValue = parseNumeric(args['pop'])
if not popValue then
result.error = "Malformed population value"
return result
end
if popValue < 0 then
result.error = "Negative population value"
return result
end
table.insert(innerArgs,popValue/areaValue)
table.insert(innerArgs,'/'..areaUnit)
local popSigFig = computeSigFig(args['pop'])
local sigFig = popSigFig < areaSigFig and popSigFig or areaSigFig
if sigFig < 2 then
sigFig = 2
end
innerArgs.sigfig = sigFig
innerArgs.disp = 'out'
table.insert(innerArgs,'/km2')
local metric = callConvert(innerArgs)
innerArgs[3] = '/sqmi'
local imperial = callConvert(innerArgs)
if impus then
result.density = string.format("%s (%s)",imperial,metric)
else
result.density = string.format("%s (%s)",metric,imperial)
end
return result
end
function p.convert(frame)
local args = getArgs(frame)
return p._convert(args) or ""
end
function p.area(frame)
local args = getArgs(frame)
return p._area(args) or ""
end
function p.length(frame)
local args = getArgs(frame)
return p._length(args) or ""
end
function p.density(frame)
local args = getArgs(frame)
local result = p._density(args)
if result.density then
return result.density
end
if result.error then
local warning = require('Module:If_preview')._warning
local result = warning({result.error})
if mw.title.getCurrentTitle().namespace == 0 then
result = result..'[[Category:Pages using infobox settlement with bad density arguments]]'
end
return result
end
return ''
end
return p
360aq9gklckfcwwcowcpaqdl3zu5aai
74874
74873
2026-08-24T00:33:41Z
Robertsky
10424
1 versaun husi [[:en:Module:ConvertIB]]
74873
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
-- Function to pull out values and units from numeric args
-- Returns:
-- values: list of numeric values, or "false" if no numeric argument is given
-- units: list of units (str)
-- value: if there is a last numeric value unpaired with a unit, it becomes the precision
-- anyValue: whether there is a non-false value in the values list
local function parseValuesUnits(args)
local values = {}
local units = {}
local indx = 1
local value = nil
local anyValue = false
-- loop through numeric arguments in pairs
while args[indx] or args[indx+1] do
value = args[indx]
anyValue = anyValue or value
-- if there is a unit, save in output lists
if args[indx+1] then
table.insert(values, value or false)
table.insert(units, args[indx+1])
value = nil
end
indx = indx+2
end
return values, units, value, anyValue
end
-- Function to identify multiple units and rewrite them as new input or output groups
-- Args:
-- values, units: numeric values and units, as lists with same length
-- Returns:
-- newValues, newUnits: same lists rewritten
local function parseMultiples(values, units)
local newValues = {}
local newUnits = {}
local i = 1
-- we will search for multiples with up to 4 entries (depending on length)
local maxMultiple = math.min(4,#units-1)
local valueFound = false -- flag to suppress second (and later) input values
--- Hack for handling "stone": check if only value supplied is "lb"
local onlyPounds = true
for i = 1, #units do
if values[i] and units[i] ~= 'lb' then
onlyPounds = false
break
end
end
local multiple = mw.loadData('Module:ConvertIB/data').multiple
-- sweep through units
while i <= #units do
-- determine index of last possible unit that could contain a multiple
local last_unit = math.min(i+maxMultiple-1,#units)
local multipleFound = false
-- try from longest multiple down to double multiple (prefer longest ones)
for j = last_unit, i+1, -1 do
local key = table.concat({unpack(units,i,j)}, '')
if multiple[key] then
-- we found a multiple unit
multipleFound = true
-- Hack for "stone": add either 'lb' or multiple unit string to output units
-- depending on whether 'lb' was the only unit string with a value
if mw.ustring.sub(key,1,2) == 'st' then
table.insert(newValues, false)
table.insert(newUnits, onlyPounds and key or 'lb')
end
-- if there are any value in the span of the multiple,
-- then the multiple is an input
-- assume all missing values after the first are zero
local firstValueFound = false
for k = i, j do
firstValueFound = not valueFound and (firstValueFound or values[k])
if firstValueFound then
table.insert(newValues, values[k] or 0)
table.insert(newUnits, units[k])
end
end
valueFound = valueFound or firstValueFound
-- if no values in the span of the multiple,
-- then the multiple is an output. Insert combined string as output unit
if not firstValueFound then
table.insert(newValues, false)
table.insert(newUnits, key)
end
i = j+1
break
end
end
--- If no multiple unit was found, insert value[i] and unit[i] into rewritten lists
if not multipleFound then
if valueFound then
table.insert(newValues, false) -- skip writing value if it is a duplicate
else
table.insert(newValues,values[i])
valueFound = values[i]
end
table.insert(newUnits, units[i])
i = i+1
end
end
return newValues, newUnits
end
-- Call {{convert}} with args
local function callConvert(args)
local frame = mw.getCurrentFrame()
return frame:expandTemplate{title='Convert', args=args}
end
-- Implement {{convinfobox}}
function p._convert(args)
-- find all values and units in numeric args (and the precision, if it exists)
local values, units, precision, anyValue = parseValuesUnits(args)
-- bail if no values at all
if not anyValue then
return nil
end
-- rewrite values and units if multiple units are found
values, units = parseMultiples(values, units)
-- sort input and outputs into different buckets
local input_values = {}
local input_units = {}
local output_units = {}
for i = 1, #units do
if values[i] then
table.insert(input_values, values[i])
table.insert(input_units, units[i])
else
table.insert(output_units, units[i])
end
end
-- bail if nothing to convert
if #input_values == 0 or #output_units == 0 then
return nil
end
-- assemble argument list to {{convert}}
local innerArgs = {}
-- First, pass all input unit(s)
for i, v in ipairs(input_values) do
table.insert(innerArgs,v)
table.insert(innerArgs,input_units[i])
end
-- Then the output unit(s) [concatenated as single argument]
table.insert(innerArgs,table.concat(output_units,"+"))
if precision then
table.insert(innerArgs,precision) -- last non-nil value contains precision
end
-- now handle all non-numeric arguments, passing to {{convert}}
innerArgs.abbr = 'on' -- abbr=on by default
for k, v in pairs(args) do
if not tonumber(k) then
innerArgs[k] = v
end
end
return callConvert(innerArgs)
end
local function impUnitPref(pref,country)
--- lower case all arguments
pref = pref and mw.ustring.lower(pref)
country = country and mw.ustring.lower(country)
--- determine imperial unit by going thru arguments in priority order
if pref and pref ~= 'dunam' then
local impPref = mw.loadData('Module:ConvertIB/data').impPref
return impPref[pref]
elseif country then
return mw.ustring.find(country,"united states",1,true)
or mw.ustring.find(country,"united kingdom",1,true)
end
return false
end
local largeUnits = {km2=true,mi2=true,sqmi=true,km=true,mi=true}
-- Implement {{Infobox settlement/areadisp}}
function p._area(args)
local pref = args['pref']
local country = args['name']
local impus = impUnitPref(pref, country)
local dunam = args['dunam'] or args['dunum']
local link = args['link']
local innerArgs = {}
innerArgs.abbr = 'on'
innerArgs.order = 'out'
for _, unit in ipairs({'km2','mi2','sqmi','ha','acre'}) do
if args[unit] then
table.insert(innerArgs,args[unit])
table.insert(innerArgs,unit)
if largeUnits[unit] then
table.insert(innerArgs,impus and 'sqmi km2' or 'km2 sqmi')
else
table.insert(innerArgs,impus and 'acre ha' or 'ha acre')
end
return callConvert(innerArgs)
end
end
if dunam then
table.insert(innerArgs,dunam)
table.insert(innerArgs,'dunam')
pref = pref and mw.ustring.lower(pref)
local order = pref == 'dunam' and 'dunam ' or ''
dunam = mw.getContentLanguage():parseFormattedNumber(dunam)
if impus then
order = order..(dunam and dunam < 2589 and 'acre ha' or 'sqmi km2')
else
order = order..(dunam and dunam < 1000 and 'ha acre' or 'km2 sqmi')
end
table.insert(innerArgs,order)
local yesNo = require('Module:Yesno')
if yesNo(link,true) and link ~= 'none' then
innerArgs.lk = 'in'
end
return callConvert(innerArgs)
end
return nil
end
-- Implement {{Infobox settlement/lengthdisp}}
function p._length(args)
local pref = args['pref']
if pref == 'dunam' then -- ignore dunam pref for this function
pref = nil
end
local country = args['name']
local impus = impUnitPref(pref, country)
local innerArgs = {}
innerArgs.abbr = 'on'
innerArgs.order = 'out'
for _, unit in ipairs({'km','mi','m','ft'}) do
if args[unit] then
table.insert(innerArgs,args[unit])
table.insert(innerArgs,unit)
if largeUnits[unit] then
table.insert(innerArgs,impus and 'mi km' or 'km mi')
else
table.insert(innerArgs,impus and 'ft m' or 'm ft')
end
return callConvert(innerArgs)
end
end
return nil
end
local lang
local function parseNumeric(s)
local num_str = string.match(tostring(s), '^[+-]?%d[%d,]*%.?%d*e?[+-]?%d*')
if not num_str then
return nil
end
lang = lang or mw.getContentLanguage()
return lang:parseFormattedNumber(num_str)
end
--Compute number of significant digits in a numeric string
local function computeSigFig(s)
local num_str = string.match(tostring(s), '^[+-]?%d[%d,]*%.?%d*')
if not num_str then
return 0
end
-- Strip leading signs
num_str = string.gsub(num_str, '^[+-]', '')
-- Strip commas
num_str = string.gsub(num_str, ',', '')
-- Strip leading zeros that cross decimal point
num_str = string.gsub(num_str, '^0*%.0*','.')
-- Strip leading zeros
num_str = string.gsub(num_str, '^0*', '')
if num_str == '' then
return 0
end
-- If there's a decimal point, all trailing zeros are significant.
if string.find(num_str, '%.') then
return #string.gsub(num_str, '%.', '') -- Count all digits after removing decimal
end
-- If no decimal point, trailing zeros are not significant.
-- Count all digits up to the last non-zero one.
num_str = string.gsub(num_str, '0+$', '')
return #num_str
end
-- Implement {{Infobox settlement/densdisp}}
-- Returns table:
-- density = computed value if no error
-- error = error string if error.
-- These are only errors detected in this code, {{convert}} does its own error handling
function p._density(args)
local result = {}
local pref = args['pref']
if pref == 'dunam' then -- ignore dunam pref for this function
pref = nil
end
local country = args['name']
local per_km2 = args['/km2']
local per_mi2 = args['/mi2'] or args['/sqmi']
local impus = impUnitPref(pref, country, per_km2, per_mi2)
local per_km2_value = parseNumeric(per_km2)
local per_mi2_value = parseNumeric(per_mi2)
local innerArgs = {}
innerArgs.abbr = 'on'
if per_km2_value or per_mi2_value then
innerArgs.order = 'out'
if per_km2_value then
table.insert(innerArgs,per_km2_value)
table.insert(innerArgs,'/km2')
else
table.insert(innerArgs,per_mi2_value)
table.insert(innerArgs,'/sqmi')
end
table.insert(innerArgs,impus and '/sqmi /km2' or '/km2 /sqmi')
result.density = callConvert(innerArgs)
return result
end
if per_km2 ~= 'auto' and per_mi2 ~= 'auto' then
-- automatic computation not requested, fail silently
return result
end
if not args['pop'] then
-- fail silently if no population given
return result
end
local areaSigFig
local areaValue
local areaUnit
for _, unit in ipairs({'km2','mi2','sqmi','ha','acre','dunam','dunum'}) do
local value = parseNumeric(args[unit])
if value then
if value <= 0 then
result.error = unit.." value not positive"
return result
end
areaValue = value
areaUnit = unit
areaSigFig = computeSigFig(args[unit])
break
elseif args[unit] then
result.error = "Malformed "..unit.." value"
return result
end
end
if not areaSigFig then
-- fail silently if no area given
return result
end
if areaSigFig == 0 then
result.error = "Malformed area string"
return result
end
local popValue = parseNumeric(args['pop'])
if not popValue then
result.error = "Malformed population value"
return result
end
if popValue < 0 then
result.error = "Negative population value"
return result
end
table.insert(innerArgs,popValue/areaValue)
table.insert(innerArgs,'/'..areaUnit)
local popSigFig = computeSigFig(args['pop'])
local sigFig = popSigFig < areaSigFig and popSigFig or areaSigFig
if sigFig < 2 then
sigFig = 2
end
innerArgs.sigfig = sigFig
innerArgs.disp = 'out'
table.insert(innerArgs,'/km2')
local metric = callConvert(innerArgs)
innerArgs[3] = '/sqmi'
local imperial = callConvert(innerArgs)
if impus then
result.density = string.format("%s (%s)",imperial,metric)
else
result.density = string.format("%s (%s)",metric,imperial)
end
return result
end
function p.convert(frame)
local args = getArgs(frame)
return p._convert(args) or ""
end
function p.area(frame)
local args = getArgs(frame)
return p._area(args) or ""
end
function p.length(frame)
local args = getArgs(frame)
return p._length(args) or ""
end
function p.density(frame)
local args = getArgs(frame)
local result = p._density(args)
if result.density then
return result.density
end
if result.error then
local warning = require('Module:If_preview')._warning
local result = warning({result.error})
if mw.title.getCurrentTitle().namespace == 0 then
result = result..'[[Category:Pages using infobox settlement with bad density arguments]]'
end
return result
end
return ''
end
return p
360aq9gklckfcwwcowcpaqdl3zu5aai
Template:Wikidata infoboxes
10
7938
74898
72350
2026-08-03T22:51:24Z
en>Zackmann08
0
74898
wikitext
text/x-wiki
{{Navbox
| name = Wikidata infoboxes
| title = Infoboxes using Wikidata
| listclass = hlist
| state = {{{state|}}}
| list1 =
* {{t|Biota infobox/Wikidata}}
* {{t|Infobox archive/wikidata}}
* {{t|Infobox artwork/wikidata}}
* {{t|Infobox expedition/Wikidata}}
* {{t|Infobox museum/wikidata}}
* {{t|Infobox noble/Wikidata}}
* {{t|Infobox organization/Wikidata}}
* {{t|Infobox person/Wikidata}}
* {{t|Infobox power station}}
* {{t|Infobox product}}
* {{t|Infobox religious biography/Wikidata}}
* {{t|Infobox scientist/Wikidata}}
* {{t|Infobox settlement/Wikidata}}
* {{t|Infobox software}}
* {{t|Infobox sportsperson/Wikidata}}
* {{t|Infobox telescope}}
* {{t|Infobox writer/Wikidata}}
* {{t|Ordination}}
| below =
{{icon|category}} [[:Category:Infobox_templates_using_Wikidata|Category of all infoboxes that uses wikidata]]
}}
<noinclude>
[[Category:Documentation see also templates]]
</noinclude>
o5g37qfs4bnchkeetiqf982pnnincay
74899
74898
2026-08-24T00:42:44Z
Robertsky
10424
1 versaun husi [[:en:Template:Wikidata_infoboxes]]
74898
wikitext
text/x-wiki
{{Navbox
| name = Wikidata infoboxes
| title = Infoboxes using Wikidata
| listclass = hlist
| state = {{{state|}}}
| list1 =
* {{t|Biota infobox/Wikidata}}
* {{t|Infobox archive/wikidata}}
* {{t|Infobox artwork/wikidata}}
* {{t|Infobox expedition/Wikidata}}
* {{t|Infobox museum/wikidata}}
* {{t|Infobox noble/Wikidata}}
* {{t|Infobox organization/Wikidata}}
* {{t|Infobox person/Wikidata}}
* {{t|Infobox power station}}
* {{t|Infobox product}}
* {{t|Infobox religious biography/Wikidata}}
* {{t|Infobox scientist/Wikidata}}
* {{t|Infobox settlement/Wikidata}}
* {{t|Infobox software}}
* {{t|Infobox sportsperson/Wikidata}}
* {{t|Infobox telescope}}
* {{t|Infobox writer/Wikidata}}
* {{t|Ordination}}
| below =
{{icon|category}} [[:Category:Infobox_templates_using_Wikidata|Category of all infoboxes that uses wikidata]]
}}
<noinclude>
[[Category:Documentation see also templates]]
</noinclude>
o5g37qfs4bnchkeetiqf982pnnincay
Template:Protection padlock
10
7943
74982
72360
2026-08-16T14:03:04Z
en>RMCD bot
0
Notifying subject page of move discussion on [[Template talk:Protection padlock#Requested move 16 August 2026|Template talk:Protection padlock]]
74982
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Protected page|2=Template talk:Protection padlock#Requested move 16 August 2026}}
</noinclude><includeonly>{{#invoke:Protection banner|main}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
bivafhpdzqot8aqh2pxo1ns5dmt7awb
74983
74982
2026-08-24T00:44:29Z
Robertsky
10424
1 versaun husi [[:en:Template:Protection_padlock]]
74982
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Protected page|2=Template talk:Protection padlock#Requested move 16 August 2026}}
</noinclude><includeonly>{{#invoke:Protection banner|main}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
bivafhpdzqot8aqh2pxo1ns5dmt7awb
Template:Always substitute
10
7974
74814
74062
2026-08-13T09:25:48Z
en>Oshwah
0
Dummy Edit: Accidentally pressed 'Enter' while typing edit summary. The last statement should've said, "the boolean conditions for 'auto' and 'nocat' now consistently default to "no" when set to a non-true string.
74814
wikitext
text/x-wiki
{{{{{|safesubst:}}}#invoke:Unsubst|main|$B=
{{Ombox
| style = text-align: center;
| name = Subst only
| type = notice
| text = This template <strong>{{#switch:{{lc:{{{yesnomaybe|}}}}}|can|may={{lc:{{{yesnomaybe}}}}} be [[Help:Substitution|substituted]]</strong> by using <!--
--><strong>{{{actualtemplate|{{template other|{{Tls|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{BASEPAGENAME}}|#default={{PAGENAME}}}}}}|{{Tlsu|{{FULLPAGENAME}}}}}}}}}</strong><!--
-->|not|never=should <em>{{lc:{{{yesnomaybe}}}}}</em> be [[Help:Substitution|substituted]]</strong> – use <!--
--><strong>{{{actualtemplate|{{template other|{{Tl|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{BASEPAGENAME}}|#default={{PAGENAME}}}}}}|{{Tlu|{{FULLPAGENAME}}}}}}}}}</strong><!--
-->|#default=should <em>always</em> be [[Help:Substitution|substituted]]</strong> – use <!--
--><strong>{{{actualtemplate|{{template other|{{Tls|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{BASEPAGENAME}}|#default=<includeonly>{{PAGENAME}}</includeonly><noinclude>Example</noinclude>}}}}|{{Tlsu|{{FULLPAGENAME}}}}}}}}}</strong>}}. <!--
-->{{#ifeq:{{yesno-no|{{{auto|}}}}}|yes|{{#switch:{{lc:{{{yesnomaybe|}}}}}|can|may|not|never=|#default=Any accidental transclusions will be automatically substituted by a bot.{{{1|}}}{{#ifeq:{{yesno-no|{{{nocat|<noinclude>true</noinclude>}}}}}|yes|<!--no categorization-->|{{#switch:{{SUBPAGENAME}}|doc|sandbox=|#default=[[Category:Wikipedia templates to be automatically substituted]]}}}}}}}} <!--
-->{{#if:{{{alt|}}}|{{#switch:{{lc:{{{yesnomaybe|}}}}}|can|may|not|never=|#default={{#ifeq:{{{auto|}}}|yes|<br/>}}For [[Help:Transclusion|transclusion]], use <strong>{{#ifeq:{{NAMESPACE:{{{alt}}}}}|Template|{{[[{{{alt}}}|{{PAGENAME:{{{alt}}}}}]]}}|{{Tlg|{{{alt}}}}}}}</strong> instead.}}}}
}}{{#ifeq:{{yesno-no|{{{nocat|<noinclude>true</noinclude>}}}}}|yes|<!--no categorization-->|{{#switch:{{SUBPAGENAME}}|doc|sandbox=|#default={{#switch:{{lc:{{{yesnomaybe|}}}}}
|not|never=[[Category:Wikipedia never-substituted templates]]
|can|may=<!--No applicable category-->
|#default=[[Category:Wikipedia substituted templates]]{{#ifexpr: 0{{Find page text |text=<!%-%- *{{NAMESPACE}}:[{{lc:{{str left|{{Lua escape|{{{1|{{PAGENAME}}}}}}}|1}}}}{{uc:{{str left|{{Lua escape|{{{1|{{PAGENAME}}}}}}}|1}}}}]{{str right|{{Lua escape|{{{1|{{PAGENAME}}}}}}}|1}} *%-%-> |title={{FULLPAGENAME}} |plain=f}} > 0 | [[Category:Templates with matching hidden id]]}}
}}}}}}}}<includeonly>__EXPECTUNUSEDTEMPLATE__</includeonly><noinclude>
{{Documentation}}
</noinclude>
97ot5yef1a57x458n4y84wnemwq1wo3
74815
74814
2026-08-24T00:16:59Z
Robertsky
10424
1 versaun husi [[:en:Template:Always_substitute]]
74814
wikitext
text/x-wiki
{{{{{|safesubst:}}}#invoke:Unsubst|main|$B=
{{Ombox
| style = text-align: center;
| name = Subst only
| type = notice
| text = This template <strong>{{#switch:{{lc:{{{yesnomaybe|}}}}}|can|may={{lc:{{{yesnomaybe}}}}} be [[Help:Substitution|substituted]]</strong> by using <!--
--><strong>{{{actualtemplate|{{template other|{{Tls|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{BASEPAGENAME}}|#default={{PAGENAME}}}}}}|{{Tlsu|{{FULLPAGENAME}}}}}}}}}</strong><!--
-->|not|never=should <em>{{lc:{{{yesnomaybe}}}}}</em> be [[Help:Substitution|substituted]]</strong> – use <!--
--><strong>{{{actualtemplate|{{template other|{{Tl|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{BASEPAGENAME}}|#default={{PAGENAME}}}}}}|{{Tlu|{{FULLPAGENAME}}}}}}}}}</strong><!--
-->|#default=should <em>always</em> be [[Help:Substitution|substituted]]</strong> – use <!--
--><strong>{{{actualtemplate|{{template other|{{Tls|{{#switch:{{SUBPAGENAME}}|doc|sandbox={{BASEPAGENAME}}|#default=<includeonly>{{PAGENAME}}</includeonly><noinclude>Example</noinclude>}}}}|{{Tlsu|{{FULLPAGENAME}}}}}}}}}</strong>}}. <!--
-->{{#ifeq:{{yesno-no|{{{auto|}}}}}|yes|{{#switch:{{lc:{{{yesnomaybe|}}}}}|can|may|not|never=|#default=Any accidental transclusions will be automatically substituted by a bot.{{{1|}}}{{#ifeq:{{yesno-no|{{{nocat|<noinclude>true</noinclude>}}}}}|yes|<!--no categorization-->|{{#switch:{{SUBPAGENAME}}|doc|sandbox=|#default=[[Category:Wikipedia templates to be automatically substituted]]}}}}}}}} <!--
-->{{#if:{{{alt|}}}|{{#switch:{{lc:{{{yesnomaybe|}}}}}|can|may|not|never=|#default={{#ifeq:{{{auto|}}}|yes|<br/>}}For [[Help:Transclusion|transclusion]], use <strong>{{#ifeq:{{NAMESPACE:{{{alt}}}}}|Template|{{[[{{{alt}}}|{{PAGENAME:{{{alt}}}}}]]}}|{{Tlg|{{{alt}}}}}}}</strong> instead.}}}}
}}{{#ifeq:{{yesno-no|{{{nocat|<noinclude>true</noinclude>}}}}}|yes|<!--no categorization-->|{{#switch:{{SUBPAGENAME}}|doc|sandbox=|#default={{#switch:{{lc:{{{yesnomaybe|}}}}}
|not|never=[[Category:Wikipedia never-substituted templates]]
|can|may=<!--No applicable category-->
|#default=[[Category:Wikipedia substituted templates]]{{#ifexpr: 0{{Find page text |text=<!%-%- *{{NAMESPACE}}:[{{lc:{{str left|{{Lua escape|{{{1|{{PAGENAME}}}}}}}|1}}}}{{uc:{{str left|{{Lua escape|{{{1|{{PAGENAME}}}}}}}|1}}}}]{{str right|{{Lua escape|{{{1|{{PAGENAME}}}}}}}|1}} *%-%-> |title={{FULLPAGENAME}} |plain=f}} > 0 | [[Category:Templates with matching hidden id]]}}
}}}}}}}}<includeonly>__EXPECTUNUSEDTEMPLATE__</includeonly><noinclude>
{{Documentation}}
</noinclude>
97ot5yef1a57x458n4y84wnemwq1wo3
Template:Plainlist
10
7995
74968
72484
2026-08-20T02:44:58Z
en>Wbm1058
0
notify protected page of requested move
74968
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Plain list|2=Template talk:Hlist#Requested move 3 August 2026}}
</noinclude><templatestyles src="Plainlist/styles.css"/><div class="plainlist {{{class|}}}" {{safesubst<noinclude />:#if:{{{style|}}}{{{indent|}}}|style="{{safesubst<noinclude />:#if:{{{indent|}}}|margin-left: {{safesubst<noinclude />:#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{safesubst<noinclude />:#if:{{{1|}}}|
{{{1}}}
</div>}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using plainlist with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Plainlist]] with unknown parameter "_VALUE_"|ignoreblank=y| class | style | indent | 1 }}<noinclude></div>
{{documentation}}
</noinclude>
343yzr03qo8bw7sfchk7965now33h1i
74969
74968
2026-08-24T00:44:27Z
Robertsky
10424
1 versaun husi [[:en:Template:Plainlist]]
74968
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Plain list|2=Template talk:Hlist#Requested move 3 August 2026}}
</noinclude><templatestyles src="Plainlist/styles.css"/><div class="plainlist {{{class|}}}" {{safesubst<noinclude />:#if:{{{style|}}}{{{indent|}}}|style="{{safesubst<noinclude />:#if:{{{indent|}}}|margin-left: {{safesubst<noinclude />:#expr:{{{indent}}}*1.6}}em;}} {{{style|}}}"}}>{{safesubst<noinclude />:#if:{{{1|}}}|
{{{1}}}
</div>}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using plainlist with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Plainlist]] with unknown parameter "_VALUE_"|ignoreblank=y| class | style | indent | 1 }}<noinclude></div>
{{documentation}}
</noinclude>
343yzr03qo8bw7sfchk7965now33h1i
Template:Columns-list
10
8033
75028
72564
2026-08-03T09:49:49Z
en>RMCD bot
0
Notifying subject page of move discussion on [[Template talk:Hlist#Requested move 3 August 2026|Template talk:Hlist]]
75028
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Columns list|2=Template talk:Hlist#Requested move 3 August 2026}}
</noinclude>{{<includeonly>safesubst:</includeonly>#if:{{{1|}}}|{{<includeonly>safesubst:</includeonly>#invoke:Template wrapper|wrap|_template=div col|_alias-map=1:content|colwidth=30em}}}}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using columns-list with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Columns-list]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | content | colwidth | gap | rules | small | style }}<noinclude>
{{documentation}}
</noinclude>
90o7mmc9j4xxvpgdp1emyub3c8xfidy
75029
75028
2026-08-24T00:46:10Z
Robertsky
10424
1 versaun husi [[:en:Template:Columns-list]]
75028
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Columns list|2=Template talk:Hlist#Requested move 3 August 2026}}
</noinclude>{{<includeonly>safesubst:</includeonly>#if:{{{1|}}}|{{<includeonly>safesubst:</includeonly>#invoke:Template wrapper|wrap|_template=div col|_alias-map=1:content|colwidth=30em}}}}{{<includeonly>safesubst:</includeonly>#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using columns-list with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Columns-list]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | class | content | colwidth | gap | rules | small | style }}<noinclude>
{{documentation}}
</noinclude>
90o7mmc9j4xxvpgdp1emyub3c8xfidy
Módulo:Transclusion count/data/W
828
8060
74892
74049
2026-08-23T05:11:05Z
en>Ahechtbot
0
[[Wikipedia:BOT|Bot]]: Updated page.
74892
Scribunto
text/plain
return {
["WAL"] = 2200,
["WDL"] = 8100,
["WDLtot"] = 6500,
["WIA"] = 2100,
["WP1"] = 5100,
["WPB"] = 2000,
["WPBS"] = 27000,
["WPB_Announcements"] = 20000,
["WPCC"] = 258000,
["WPEUR10k"] = 9500,
["WPEUR20k"] = 16000,
["WPLA10k"] = 3200,
["WPMILHIST"] = 2200,
["WPMILHIST_Infobox_style"] = 109000,
["WPOCEANIA10k"] = 3900,
["WPSS-cat"] = 22000,
["WPTC_track_map_key"] = 2200,
["WPUKIR10k"] = 11000,
["WPUKIR20k"] = 11000,
["WPUS"] = 3100,
["WPVG_announcements"] = 118000,
["WPVG_announcements/shell"] = 118000,
["WPVG_icon"] = 36000,
["WPVG_icon_direct"] = 158000,
["WPX_action_box"] = 2900,
["WPX_block"] = 2200,
["WPX_last_updated"] = 5100,
["WPX_list_end"] = 2200,
["WPX_list_start"] = 2200,
["WPX_subheader"] = 3000,
["WP_Architecture"] = 4400,
["WP_Athletics"] = 2400,
["WP_Canada"] = 2000,
["WP_Crime"] = 2400,
["WP_Women"] = 2500,
["WP_Years"] = 5100,
["WP_banner_shell"] = 5800,
["WRMS_source"] = 2700,
["WRMS_species"] = 15000,
["WTA"] = 3900,
["Warning"] = 56000,
["Watch"] = 29000,
["Wb"] = 2100,
["Wbr"] = 2300,
["Wd"] = 2400,
["Wdib"] = 15000,
["Weather_box"] = 32000,
["Webarchive"] = 695000,
["Wednesday"] = 2800,
["Welcome_ISP"] = 4100,
["Welcome_graphical/links"] = 61000,
["Welcomeg/links"] = 61000,
["Western_name_order"] = 7700,
["What_links_here"] = 13000,
["When"] = 27000,
["Where"] = 2400,
["Which"] = 6600,
["Whisperback"] = 2700,
["White"] = 94000,
["Who"] = 11000,
["Who's_Who"] = 3800,
["Whois"] = 9500,
["Whyte"] = 2100,
["Whyte_suffix"] = 2100,
["Wide_image"] = 9600,
["WikiProjectBannerShell"] = 84000,
["WikiProjectCard"] = 3200,
["WikiProject_2010s"] = 3600,
["WikiProject_Academic_Journals"] = 36000,
["WikiProject_Afghanistan"] = 12000,
["WikiProject_Africa"] = 238000,
["WikiProject_African_diaspora"] = 26000,
["WikiProject_AfroCreatives"] = 9700,
["WikiProject_Agriculture"] = 15000,
["WikiProject_Alabama"] = 20000,
["WikiProject_Alaska"] = 12000,
["WikiProject_Albania"] = 17000,
["WikiProject_Albums"] = 408000,
["WikiProject_Algae"] = 5900,
["WikiProject_Algeria"] = 8600,
["WikiProject_Alternative_medicine"] = 2400,
["WikiProject_Alternative_music"] = 16000,
["WikiProject_Alternative_views"] = 2300,
["WikiProject_American_Open_Wheel_Racing"] = 4100,
["WikiProject_American_football"] = 12000,
["WikiProject_Amphibians_and_Reptiles"] = 36000,
["WikiProject_Amusement_Parks"] = 7300,
["WikiProject_Amusement_Parks/importance"] = 7300,
["WikiProject_Anarchism"] = 4000,
["WikiProject_Anarchism_cleanup_issue_count"] = 4100,
["WikiProject_Anatomy"] = 22000,
["WikiProject_Ancient_Egypt"] = 6100,
["WikiProject_Ancient_Near_East"] = 7500,
["WikiProject_Anglicanism"] = 13000,
["WikiProject_Anglo-Saxon_Kingdoms"] = 2300,
["WikiProject_Animal_rights"] = 2900,
["WikiProject_Animals"] = 38000,
["WikiProject_Animation"] = 43000,
["WikiProject_Animation/importance"] = 43000,
["WikiProject_Anime_and_manga"] = 44000,
["WikiProject_Antarctica"] = 18000,
["WikiProject_Anthropology"] = 12000,
["WikiProject_Anthroponymy"] = 147000,
["WikiProject_Antigua_and_Barbuda"] = 2900,
["WikiProject_Apple_Inc."] = 3400,
["WikiProject_Apps"] = 2400,
["WikiProject_Arab_world"] = 6900,
["WikiProject_Archaeology"] = 24000,
["WikiProject_Architecture"] = 178000,
["WikiProject_Arctic"] = 3200,
["WikiProject_Arena_Football_League"] = 2800,
["WikiProject_Argentina"] = 36000,
["WikiProject_Arizona"] = 6200,
["WikiProject_Armenia"] = 14000,
["WikiProject_Arthropods"] = 32000,
["WikiProject_Articles_for_creation"] = 236000,
["WikiProject_Arts"] = 14000,
["WikiProject_Asia"] = 34000,
["WikiProject_Asian_Month"] = 2700,
["WikiProject_Assyria"] = 5400,
["WikiProject_Astronomy"] = 94000,
["WikiProject_Astronomy/importance"] = 94000,
["WikiProject_Athletics"] = 90000,
["WikiProject_Auckland"] = 3200,
["WikiProject_Australia"] = 288000,
["WikiProject_Australia/ACR"] = 288000,
["WikiProject_Austria"] = 38000,
["WikiProject_Autism"] = 2500,
["WikiProject_Automobiles"] = 23000,
["WikiProject_Aviation"] = 84000,
["WikiProject_Awards"] = 45000,
["WikiProject_Azerbaijan"] = 17000,
["WikiProject_BBC"] = 9400,
["WikiProject_Badminton"] = 9200,
["WikiProject_Bahrain"] = 3600,
["WikiProject_Bangladesh"] = 32000,
["WikiProject_BannerShell"] = 3800,
["WikiProject_Banner_Shell"] = 8300,
["WikiProject_Baseball"] = 95000,
["WikiProject_Basketball"] = 72000,
["WikiProject_Basque"] = 3500,
["WikiProject_Bavaria"] = 7300,
["WikiProject_Beauty_Pageants"] = 9400,
["WikiProject_Beer"] = 4700,
["WikiProject_Beetles"] = 83000,
["WikiProject_Belarus"] = 12000,
["WikiProject_Belgium"] = 40000,
["WikiProject_Belize"] = 2700,
["WikiProject_Berkshire"] = 2400,
["WikiProject_Bhutan"] = 2900,
["WikiProject_Biathlon"] = 3100,
["WikiProject_Bible"] = 8500,
["WikiProject_Biography"] = 2910000,
["WikiProject_Biology"] = 11000,
["WikiProject_Birds"] = 33000,
["WikiProject_Bivalves"] = 3700,
["WikiProject_Board_and_table_games"] = 9800,
["WikiProject_Bolivia"] = 8300,
["WikiProject_Books"] = 85000,
["WikiProject_Bosnia_and_Herzegovina"] = 16000,
["WikiProject_Boxing"] = 20000,
["WikiProject_Brands"] = 24000,
["WikiProject_Brazil"] = 70000,
["WikiProject_Bridges_and_Tunnels"] = 14000,
["WikiProject_Bristol"] = 2600,
["WikiProject_British_Empire"] = 14000,
["WikiProject_British_Motorsport"] = 2500,
["WikiProject_British_Overseas_Territories"] = 23000,
["WikiProject_Buckinghamshire"] = 2300,
["WikiProject_Buddhism"] = 9500,
["WikiProject_Bulgaria"] = 25000,
["WikiProject_Buses"] = 7400,
["WikiProject_Business"] = 57000,
["WikiProject_COVID-19"] = 4500,
["WikiProject_California"] = 93000,
["WikiProject_Cambodia"] = 6100,
["WikiProject_Cambodia/to_do"] = 6100,
["WikiProject_Canada"] = 258000,
["WikiProject_Canada/TFtext"] = 258000,
["WikiProject_Canada_Roads"] = 2900,
["WikiProject_Canada_Roads/class"] = 2900,
["WikiProject_Canadian_football"] = 11000,
["WikiProject_Cannabis"] = 2600,
["WikiProject_Canoeing_and_Kayaking"] = 7800,
["WikiProject_Caribbean"] = 54000,
["WikiProject_Cartoon_Network"] = 2900,
["WikiProject_Catalan-speaking_countries"] = 4500,
["WikiProject_Catalonia"] = 3600,
["WikiProject_Categories"] = 6400,
["WikiProject_Catholicism"] = 66000,
["WikiProject_Caves"] = 2300,
["WikiProject_Celts"] = 2300,
["WikiProject_Cemeteries"] = 11000,
["WikiProject_Central_America"] = 9600,
["WikiProject_Central_Asia"] = 23000,
["WikiProject_Central_Asia/importance"] = 23000,
["WikiProject_Cephalopods"] = 5000,
["WikiProject_Chemicals"] = 30000,
["WikiProject_Chemistry"] = 18000,
["WikiProject_Cheshire"] = 4500,
["WikiProject_Chess"] = 9500,
["WikiProject_Chess/importance"] = 9500,
["WikiProject_Chicago"] = 42000,
["WikiProject_Children's_literature"] = 26000,
["WikiProject_Chile"] = 24000,
["WikiProject_China"] = 125000,
["WikiProject_Christian_music"] = 8100,
["WikiProject_Christianity"] = 95000,
["WikiProject_Cities"] = 541000,
["WikiProject_Civil_Rights_Movement"] = 2100,
["WikiProject_Civil_Rights_Movement/article_todolist"] = 2100,
["WikiProject_Civil_engineering"] = 23000,
["WikiProject_Classical_Greece_and_Rome"] = 33000,
["WikiProject_Classical_music"] = 35000,
["WikiProject_Cleveland"] = 3000,
["WikiProject_Climate_change"] = 5000,
["WikiProject_Climbing"] = 3100,
["WikiProject_Cold_War"] = 3400,
["WikiProject_College_Basketball"] = 36000,
["WikiProject_College_basketball"] = 63000,
["WikiProject_College_football"] = 166000,
["WikiProject_College_football/importance"] = 166000,
["WikiProject_Colombia"] = 20000,
["WikiProject_Comedy"] = 44000,
["WikiProject_Comics"] = 60000,
["WikiProject_Comics/importance"] = 60000,
["WikiProject_Companies"] = 122000,
["WikiProject_Composers"] = 20000,
["WikiProject_Computer_Security"] = 2500,
["WikiProject_Computer_science"] = 9100,
["WikiProject_Computer_security"] = 2900,
["WikiProject_Computing"] = 49000,
["WikiProject_Concerts"] = 8300,
["WikiProject_Connecticut"] = 19000,
["WikiProject_Conservatism"] = 11000,
["WikiProject_Cooperatives"] = 2400,
["WikiProject_Cornwall"] = 6300,
["WikiProject_Cornwall/guide"] = 6300,
["WikiProject_Correction_and_Detention_Facilities"] = 4900,
["WikiProject_Costa_Rica"] = 6800,
["WikiProject_Countries"] = 29000,
["WikiProject_Country_Music"] = 12000,
["WikiProject_Country_music"] = 17000,
["WikiProject_Cricket"] = 66000,
["WikiProject_Cricket/importance"] = 66000,
["WikiProject_Crime"] = 11000,
["WikiProject_Crime_and_Criminal_Biography"] = 77000,
["WikiProject_Croatia"] = 29000,
["WikiProject_Crusades"] = 3300,
["WikiProject_Cuba"] = 10000,
["WikiProject_Cue_sports"] = 2600,
["WikiProject_Culture"] = 17000,
["WikiProject_Curling"] = 7700,
["WikiProject_Current_events"] = 8400,
["WikiProject_Cycling"] = 44000,
["WikiProject_Cyprus"] = 7500,
["WikiProject_Czech_Republic"] = 38000,
["WikiProject_Dams"] = 7300,
["WikiProject_Dance"] = 17000,
["WikiProject_Darts"] = 2200,
["WikiProject_Deaf"] = 2400,
["WikiProject_Death"] = 57000,
["WikiProject_Denmark"] = 43000,
["WikiProject_Derbyshire"] = 3600,
["WikiProject_Devon"] = 5800,
["WikiProject_Dinosaurs"] = 5900,
["WikiProject_Diptera"] = 23000,
["WikiProject_Disability"] = 28000,
["WikiProject_Disambiguation"] = 351000,
["WikiProject_Disaster_management"] = 28000,
["WikiProject_Discographies"] = 7700,
["WikiProject_Discrimination"] = 8400,
["WikiProject_Disney"] = 11000,
["WikiProject_Doctor_Who"] = 4200,
["WikiProject_Dogs"] = 4200,
["WikiProject_Dorset"] = 3100,
["WikiProject_Drag_Race"] = 2100,
["WikiProject_Dungeons_&_Dragons"] = 6600,
["WikiProject_Dungeons_&_Dragons/importance"] = 6600,
["WikiProject_Earthquakes"] = 3700,
["WikiProject_EastEnders"] = 2500,
["WikiProject_East_Anglia"] = 10000,
["WikiProject_East_Timor"] = 2100,
["WikiProject_Eastern_Orthodoxy"] = 3100,
["WikiProject_Ecology"] = 4300,
["WikiProject_Economics"] = 24000,
["WikiProject_Ecoregions"] = 2800,
["WikiProject_Ecuador"] = 11000,
["WikiProject_Edit_requests"] = 4400,
["WikiProject_Education"] = 42000,
["WikiProject_Egypt"] = 18000,
["WikiProject_El_Salvador"] = 4900,
["WikiProject_Elections_and_Referendums"] = 143000,
["WikiProject_Electrical_engineering"] = 5000,
["WikiProject_Electronic_music"] = 19000,
["WikiProject_Electronics"] = 6900,
["WikiProject_Elements"] = 10000,
["WikiProject_Energy"] = 28000,
["WikiProject_Engineering"] = 16000,
["WikiProject_England"] = 124000,
["WikiProject_English_Language"] = 3200,
["WikiProject_Environment"] = 23000,
["WikiProject_Equine"] = 9000,
["WikiProject_Espionage"] = 3200,
["WikiProject_Essays"] = 2600,
["WikiProject_Estonia"] = 24000,
["WikiProject_Ethiopia"] = 7000,
["WikiProject_Ethnic_groups"] = 15000,
["WikiProject_Ethnic_groups_tasks"] = 15000,
["WikiProject_Europe"] = 43000,
["WikiProject_European_Microstates"] = 14000,
["WikiProject_European_Union"] = 10000,
["WikiProject_European_history"] = 18000,
["WikiProject_Eurovision"] = 5200,
["WikiProject_Event_Venues"] = 14000,
["WikiProject_Explosives"] = 2200,
["WikiProject_Faroe_Islands"] = 2800,
["WikiProject_Fashion"] = 14000,
["WikiProject_Feminism"] = 11000,
["WikiProject_Fencing"] = 8500,
["WikiProject_Festivals"] = 11000,
["WikiProject_Fictional_characters"] = 96000,
["WikiProject_Fictional_characters/class"] = 96000,
["WikiProject_Figure_Skating"] = 8400,
["WikiProject_Fiji"] = 5800,
["WikiProject_Film"] = 435000,
["WikiProject_Finance_&_Investment"] = 25000,
["WikiProject_Finland"] = 40000,
["WikiProject_Firearms"] = 13000,
["WikiProject_Firefighting"] = 4200,
["WikiProject_Fisheries_and_Fishing"] = 3300,
["WikiProject_Fishes"] = 45000,
["WikiProject_Florida"] = 34000,
["WikiProject_Folklore"] = 3900,
["WikiProject_Food_and_drink"] = 69000,
["WikiProject_Football"] = 528000,
["WikiProject_Forestry"] = 3500,
["WikiProject_Former_countries"] = 38000,
["WikiProject_Formula_One"] = 8400,
["WikiProject_France"] = 205000,
["WikiProject_Fraternities_and_Sororities"] = 4300,
["WikiProject_Fungi"] = 33000,
["WikiProject_Futures_studies"] = 2100,
["WikiProject_Gaelic_games"] = 22000,
["WikiProject_Gambling"] = 5300,
["WikiProject_Gastropods"] = 50000,
["WikiProject_Gender_studies"] = 5700,
["WikiProject_Genealogy"] = 7700,
["WikiProject_Geography"] = 101000,
["WikiProject_Geology"] = 36000,
["WikiProject_Georgia_(U.S._state)"] = 27000,
["WikiProject_Georgia_(country)"] = 12000,
["WikiProject_Germany"] = 189000,
["WikiProject_Ghana"] = 9100,
["WikiProject_Ghost_towns"] = 3100,
["WikiProject_Gibraltar"] = 2600,
["WikiProject_Glaciers"] = 4000,
["WikiProject_Gloucestershire"] = 3200,
["WikiProject_Golf"] = 18000,
["WikiProject_Google"] = 2200,
["WikiProject_Greater_Manchester"] = 7700,
["WikiProject_Greece"] = 59000,
["WikiProject_Green_Bay_Packers"] = 3400,
["WikiProject_Greenland"] = 3200,
["WikiProject_Guatemala"] = 5400,
["WikiProject_Guild_of_Copy_Editors"] = 12000,
["WikiProject_Guitarists"] = 4500,
["WikiProject_Gymnastics"] = 13000,
["WikiProject_Haiti"] = 6000,
["WikiProject_Hampshire"] = 4700,
["WikiProject_Handball"] = 16000,
["WikiProject_Hawaii"] = 10000,
["WikiProject_Health_and_fitness"] = 7500,
["WikiProject_Heraldry"] = 3400,
["WikiProject_Heraldry_and_vexillology"] = 19000,
["WikiProject_Hertfordshire"] = 3600,
["WikiProject_Higher_education"] = 95000,
["WikiProject_Higher_education/config"] = 95000,
["WikiProject_Highways"] = 16000,
["WikiProject_Highways/class"] = 16000,
["WikiProject_Hinduism"] = 11000,
["WikiProject_Hip-hop"] = 31000,
["WikiProject_Hip_hop"] = 20000,
["WikiProject_Historic_sites"] = 30000,
["WikiProject_History"] = 78000,
["WikiProject_History_of_Science"] = 6700,
["WikiProject_Holidays"] = 5600,
["WikiProject_Home_Living"] = 3700,
["WikiProject_Honduras"] = 3900,
["WikiProject_Hong_Kong"] = 26000,
["WikiProject_Horror"] = 20000,
["WikiProject_Horse_racing"] = 17000,
["WikiProject_Horticulture_and_Gardening"] = 5200,
["WikiProject_Hospitals"] = 13000,
["WikiProject_Hotels"] = 6200,
["WikiProject_Human_rights"] = 18000,
["WikiProject_Hungary"] = 35000,
["WikiProject_Ice_Hockey"] = 67000,
["WikiProject_Iceland"] = 12000,
["WikiProject_Illinois"] = 43000,
["WikiProject_Indexes"] = 2700,
["WikiProject_India"] = 310000,
["WikiProject_Indigenous_peoples_of_North_America"] = 20000,
["WikiProject_Indigenous_peoples_of_the_Americas"] = 5600,
["WikiProject_Indonesia"] = 38000,
["WikiProject_Industrial"] = 4600,
["WikiProject_Industrial_design"] = 3900,
["WikiProject_Industrial_tasks"] = 4600,
["WikiProject_Insects"] = 133000,
["WikiProject_International_relations"] = 95000,
["WikiProject_Internet"] = 11000,
["WikiProject_Internet_culture"] = 10000,
["WikiProject_Intertranswiki/OKA"] = 5600,
["WikiProject_Iran"] = 96000,
["WikiProject_Iraq"] = 13000,
["WikiProject_Ireland"] = 106000,
["WikiProject_Islam"] = 25000,
["WikiProject_Islands"] = 17000,
["WikiProject_Isle_of_Man"] = 3100,
["WikiProject_Israel"] = 36000,
["WikiProject_Italy"] = 131000,
["WikiProject_Japan"] = 148000,
["WikiProject_Jazz"] = 46000,
["WikiProject_Jewish_Women"] = 3600,
["WikiProject_Jewish_culture"] = 2200,
["WikiProject_Jewish_history"] = 13000,
["WikiProject_Jordan"] = 5500,
["WikiProject_Journalism"] = 51000,
["WikiProject_Judaism"] = 26000,
["WikiProject_Kansas"] = 16000,
["WikiProject_Kent"] = 5400,
["WikiProject_Kingdom_of_Naples"] = 2400,
["WikiProject_Korea"] = 69000,
["WikiProject_Kosovo"] = 5800,
["WikiProject_Kurdistan"] = 6700,
["WikiProject_Kuwait"] = 2800,
["WikiProject_Kyrgyzstan"] = 3400,
["WikiProject_LGBTQ+_studies"] = 52000,
["WikiProject_LGBT_studies"] = 23000,
["WikiProject_Lacrosse"] = 3800,
["WikiProject_Lakes"] = 23000,
["WikiProject_Lancashire_and_Cumbria"] = 9000,
["WikiProject_Languages"] = 25000,
["WikiProject_Latin"] = 2100,
["WikiProject_Latin_America"] = 3100,
["WikiProject_Latin_music"] = 20000,
["WikiProject_Latino_and_Hispanic_heritage"] = 16000,
["WikiProject_Latter_Day_Saint_movement"] = 5300,
["WikiProject_Latvia"] = 14000,
["WikiProject_Law"] = 93000,
["WikiProject_Law_Enforcement"] = 17000,
["WikiProject_Leaders_by_year"] = 2600,
["WikiProject_Lebanon"] = 11000,
["WikiProject_Lepidoptera"] = 128000,
["WikiProject_Libraries"] = 13000,
["WikiProject_Library_of_Congress"] = 2300,
["WikiProject_Lighthouses"] = 4000,
["WikiProject_Limnology_and_Oceanography"] = 2100,
["WikiProject_Lincolnshire"] = 5100,
["WikiProject_Linguistics"] = 17000,
["WikiProject_Lists"] = 222000,
["WikiProject_Lists/class"] = 222000,
["WikiProject_Literature"] = 42000,
["WikiProject_Lithuania"] = 18000,
["WikiProject_London"] = 40000,
["WikiProject_London_Transport"] = 3300,
["WikiProject_Lower_Saxony"] = 2100,
["WikiProject_Lutheranism"] = 4100,
["WikiProject_Luxembourg"] = 7300,
["WikiProject_Macau"] = 2400,
["WikiProject_Magazines"] = 23000,
["WikiProject_Maine"] = 12000,
["WikiProject_Malaysia"] = 31000,
["WikiProject_Maldives"] = 3900,
["WikiProject_Malta"] = 6200,
["WikiProject_Mammals"] = 21000,
["WikiProject_Maps"] = 11000,
["WikiProject_Marine_life"] = 17000,
["WikiProject_Marketing_&_Advertising"] = 7000,
["WikiProject_Martial_arts"] = 40000,
["WikiProject_Maryland"] = 21000,
["WikiProject_Mathematics"] = 34000,
["WikiProject_Media"] = 27000,
["WikiProject_Media_franchises"] = 3300,
["WikiProject_Medicine"] = 80000,
["WikiProject_Melanesia"] = 9700,
["WikiProject_Merseyside"] = 4500,
["WikiProject_Mesoamerica"] = 3100,
["WikiProject_Metal"] = 28000,
["WikiProject_Metalworking"] = 2700,
["WikiProject_Mexico"] = 60000,
["WikiProject_Miami"] = 2900,
["WikiProject_Michigan"] = 33000,
["WikiProject_Microbiology"] = 23000,
["WikiProject_Micronesia"] = 9200,
["WikiProject_Microsoft"] = 2900,
["WikiProject_Microsoft_Windows"] = 2500,
["WikiProject_Middle_Ages"] = 33000,
["WikiProject_Military_history"] = 346000,
["WikiProject_Military_history/Checklist_categories"] = 163000,
["WikiProject_Military_history/Class"] = 346000,
["WikiProject_Military_history/Special_project_categories"] = 346000,
["WikiProject_Military_history/Special_project_phase"] = 346000,
["WikiProject_Military_history/Task_force_categories"] = 374000,
["WikiProject_Military_history/YesNo"] = 279000,
["WikiProject_Military_history/class"] = 346000,
["WikiProject_Mills"] = 2900,
["WikiProject_Mining"] = 9400,
["WikiProject_Minnesota"] = 26000,
["WikiProject_Missouri"] = 27000,
["WikiProject_Mixed_martial_arts"] = 7300,
["WikiProject_Moldova"] = 7400,
["WikiProject_Molecular_Biology"] = 40000,
["WikiProject_Mongols"] = 6700,
["WikiProject_Montana"] = 10000,
["WikiProject_Montenegro"] = 7200,
["WikiProject_Morocco"] = 11000,
["WikiProject_Motorcycle_racing"] = 7400,
["WikiProject_Motorcycling"] = 8500,
["WikiProject_Motorsport"] = 29000,
["WikiProject_Mountains"] = 40000,
["WikiProject_Multi-sport_events"] = 51000,
["WikiProject_Museums"] = 34000,
["WikiProject_Music/Music_genres_task_force"] = 6000,
["WikiProject_Music_theory"] = 2300,
["WikiProject_Musical_Instruments"] = 5900,
["WikiProject_Musical_Theatre"] = 8200,
["WikiProject_Myanmar"] = 13000,
["WikiProject_Mythology"] = 14000,
["WikiProject_NASCAR"] = 9200,
["WikiProject_National_Basketball_Association"] = 17000,
["WikiProject_National_Football_League"] = 54000,
["WikiProject_National_Register_of_Historic_Places"] = 96000,
["WikiProject_National_Register_of_Historic_Places/importance"] = 96000,
["WikiProject_Nepal"] = 21000,
["WikiProject_Netball"] = 2100,
["WikiProject_Netherlands"] = 63000,
["WikiProject_Neuroscience"] = 5600,
["WikiProject_Nevada"] = 9600,
["WikiProject_New_Jersey"] = 28000,
["WikiProject_New_York_(state)"] = 54000,
["WikiProject_New_York_City"] = 36000,
["WikiProject_New_Zealand"] = 84000,
["WikiProject_Newspapers"] = 19000,
["WikiProject_Nicaragua"] = 3400,
["WikiProject_Nigeria"] = 26000,
["WikiProject_Normandy"] = 4700,
["WikiProject_Norse_history_and_culture"] = 3800,
["WikiProject_North_America"] = 16000,
["WikiProject_North_America/importance"] = 16000,
["WikiProject_North_East_England"] = 6700,
["WikiProject_North_Macedonia"] = 8200,
["WikiProject_Northern_Ireland"] = 23000,
["WikiProject_Norway"] = 64000,
["WikiProject_Nottinghamshire"] = 3000,
["WikiProject_Novels"] = 96000,
["WikiProject_Numismatics"] = 8200,
["WikiProject_Nursing"] = 2400,
["WikiProject_Occult"] = 2900,
["WikiProject_Occupational_Safety_and_Health"] = 3400,
["WikiProject_Occupations"] = 5900,
["WikiProject_Oceania"] = 11000,
["WikiProject_Oceans"] = 3400,
["WikiProject_Ohio"] = 9700,
["WikiProject_Oklahoma"] = 16000,
["WikiProject_Olympics"] = 212000,
["WikiProject_Oman"] = 2400,
["WikiProject_Opera"] = 18000,
["WikiProject_Orders,_decorations,_and_medals"] = 7800,
["WikiProject_Oregon"] = 28000,
["WikiProject_Oregon/errors"] = 28000,
["WikiProject_Oregon_collab"] = 28000,
["WikiProject_Organizations"] = 74000,
["WikiProject_Organized_Labour"] = 14000,
["WikiProject_Overseas_France"] = 6400,
["WikiProject_Pakistan"] = 47000,
["WikiProject_Palaeontology"] = 37000,
["WikiProject_Palestine"] = 15000,
["WikiProject_Panama"] = 4800,
["WikiProject_Papua_New_Guinea"] = 6000,
["WikiProject_Paraguay"] = 4600,
["WikiProject_Paranormal"] = 2900,
["WikiProject_Pennsylvania"] = 55000,
["WikiProject_Peru"] = 19000,
["WikiProject_Pharmacology"] = 20000,
["WikiProject_Philadelphia"] = 12000,
["WikiProject_Philately"] = 5200,
["WikiProject_Philippines"] = 6400,
["WikiProject_Philosophy"] = 25000,
["WikiProject_Photography"] = 17000,
["WikiProject_Physics"] = 30000,
["WikiProject_Physiology"] = 4200,
["WikiProject_Pittsburgh"] = 6400,
["WikiProject_Plants"] = 159000,
["WikiProject_Podcasting"] = 2800,
["WikiProject_Poetry"] = 27000,
["WikiProject_Pokémon"] = 4000,
["WikiProject_Pokémon/class"] = 4000,
["WikiProject_Poland"] = 118000,
["WikiProject_Politics"] = 287000,
["WikiProject_Politics_of_the_United_Kingdom"] = 56000,
["WikiProject_Polynesia"] = 17000,
["WikiProject_Pop_music"] = 38000,
["WikiProject_Popular_culture"] = 4000,
["WikiProject_Pornography"] = 5200,
["WikiProject_Portals"] = 2200,
["WikiProject_Portals/class"] = 2200,
["WikiProject_Portals/importance"] = 2200,
["WikiProject_Portals/importancescale"] = 2200,
["WikiProject_Portugal"] = 34000,
["WikiProject_Post-hardcore"] = 4500,
["WikiProject_Primates"] = 2800,
["WikiProject_Pritzker-GLAM"] = 3000,
["WikiProject_Professional_sound_production"] = 2600,
["WikiProject_Professional_wrestling"] = 19000,
["WikiProject_Progressive_Rock"] = 4200,
["WikiProject_Protected_areas"] = 31000,
["WikiProject_Protista"] = 5300,
["WikiProject_Psychoactive_and_Recreational_Drugs"] = 2500,
["WikiProject_Psychology"] = 21000,
["WikiProject_Puerto_Rico"] = 16000,
["WikiProject_Punk_music"] = 8700,
["WikiProject_Qatar"] = 4900,
["WikiProject_R&B_and_Soul_Music"] = 20000,
["WikiProject_Radio"] = 15000,
["WikiProject_Radio_Stations"] = 45000,
["WikiProject_Record_Charts"] = 5500,
["WikiProject_Record_Labels"] = 15000,
["WikiProject_Record_Production"] = 7500,
["WikiProject_Redirect"] = 6600,
["WikiProject_Redirect/class"] = 6600,
["WikiProject_Referees"] = 4500,
["WikiProject_Reggae"] = 3300,
["WikiProject_Regional_and_national_music"] = 11000,
["WikiProject_Religion"] = 38000,
["WikiProject_Religious_Buildings,_Architecture_and_Monasticism"] = 2000,
["WikiProject_Religious_texts"] = 2600,
["WikiProject_Retailing"] = 6000,
["WikiProject_Retailing/importance"] = 6000,
["WikiProject_Rivers"] = 60000,
["WikiProject_Robotics"] = 3600,
["WikiProject_Rock_music"] = 34000,
["WikiProject_Rocketry"] = 2600,
["WikiProject_Rocketry/importance"] = 2600,
["WikiProject_Rocks_and_minerals"] = 3300,
["WikiProject_Rodents"] = 5500,
["WikiProject_Role-playing_games"] = 7600,
["WikiProject_Romance"] = 3400,
["WikiProject_Romania"] = 45000,
["WikiProject_Rome"] = 4300,
["WikiProject_Roots_music"] = 6000,
["WikiProject_Rowing"] = 14000,
["WikiProject_Royalty_and_Nobility"] = 7000,
["WikiProject_Rugby_league"] = 21000,
["WikiProject_Rugby_union"] = 42000,
["WikiProject_Running"] = 27000,
["WikiProject_Russia"] = 135000,
["WikiProject_Sailing"] = 14000,
["WikiProject_Saints"] = 6700,
["WikiProject_San_Diego"] = 3600,
["WikiProject_Saudi_Arabia"] = 10000,
["WikiProject_Schools"] = 89000,
["WikiProject_Science"] = 21000,
["WikiProject_Science_Fiction"] = 20000,
["WikiProject_Science_fiction"] = 2400,
["WikiProject_Scotland"] = 63000,
["WikiProject_Scottish_Islands"] = 3300,
["WikiProject_Scouting"] = 8000,
["WikiProject_Screenwriters"] = 2700,
["WikiProject_Sculpture"] = 17000,
["WikiProject_Serbia"] = 31000,
["WikiProject_Sexology_and_sexuality"] = 10000,
["WikiProject_Shakespeare"] = 2200,
["WikiProject_Ships"] = 91000,
["WikiProject_Shipwrecks"] = 8200,
["WikiProject_Shopping_Centers"] = 5900,
["WikiProject_Shropshire"] = 2000,
["WikiProject_Sicily"] = 3900,
["WikiProject_Singapore"] = 16000,
["WikiProject_Skepticism"] = 6300,
["WikiProject_Skiing_and_Snowboarding"] = 22000,
["WikiProject_Skyscrapers"] = 6300,
["WikiProject_Slovakia"] = 19000,
["WikiProject_Slovenia"] = 22000,
["WikiProject_Snooker"] = 3300,
["WikiProject_Soap_Operas"] = 22000,
["WikiProject_Socialism"] = 27000,
["WikiProject_Sociology"] = 51000,
["WikiProject_Softball"] = 5600,
["WikiProject_Software"] = 16000,
["WikiProject_Somalia"] = 3300,
["WikiProject_Somerset"] = 5000,
["WikiProject_Song_Contests"] = 9300,
["WikiProject_Songs"] = 238000,
["WikiProject_South_Africa"] = 51000,
["WikiProject_South_America"] = 37000,
["WikiProject_South_Dakota"] = 9300,
["WikiProject_Southeast_Asia"] = 16000,
["WikiProject_Soviet_Union"] = 28000,
["WikiProject_Spaceflight"] = 14000,
["WikiProject_Spain"] = 98000,
["WikiProject_Speed_Skating"] = 6100,
["WikiProject_Spiders"] = 17000,
["WikiProject_Sports"] = 181000,
["WikiProject_Sports_Car_Racing"] = 5500,
["WikiProject_Squash"] = 2800,
["WikiProject_Sri_Lanka"] = 31000,
["WikiProject_St._Louis"] = 3300,
["WikiProject_Star_Trek"] = 4200,
["WikiProject_Star_Wars"] = 6100,
["WikiProject_Statistics"] = 7400,
["WikiProject_Stub_sorting"] = 68000,
["WikiProject_Stub_sorting_category"] = 22000,
["WikiProject_Stub_sorting_category/styles.css"] = 22000,
["WikiProject_Surrey"] = 2800,
["WikiProject_Sussex"] = 4500,
["WikiProject_Sweden"] = 74000,
["WikiProject_Swimming"] = 40000,
["WikiProject_Switzerland"] = 50000,
["WikiProject_Syria"] = 14000,
["WikiProject_Systems"] = 4900,
["WikiProject_Table_tennis"] = 4700,
["WikiProject_Taiwan"] = 22000,
["WikiProject_Tajikistan"] = 2700,
["WikiProject_Tambayan_Philippines"] = 60000,
["WikiProject_Taxation"] = 2300,
["WikiProject_Technology"] = 19000,
["WikiProject_Telecommunications"] = 11000,
["WikiProject_Television"] = 334000,
["WikiProject_Television/config"] = 334000,
["WikiProject_Templates"] = 33000,
["WikiProject_Tennessee"] = 21000,
["WikiProject_Tennis"] = 64000,
["WikiProject_Textile_Arts"] = 2800,
["WikiProject_Textile_arts"] = 3700,
["WikiProject_Thailand"] = 29000,
["WikiProject_The_Beatles"] = 5100,
["WikiProject_The_Simpsons"] = 2400,
["WikiProject_Theatre"] = 41000,
["WikiProject_Theology"] = 2500,
["WikiProject_Tibet"] = 4100,
["WikiProject_Time"] = 19000,
["WikiProject_Timor-Leste"] = 2300,
["WikiProject_Toys"] = 4000,
["WikiProject_Trade"] = 3000,
["WikiProject_Trains"] = 153000,
["WikiProject_Trains/portalbox"] = 153000,
["WikiProject_Translation_studies"] = 2600,
["WikiProject_Transport"] = 34000,
["WikiProject_Travel_and_Tourism"] = 16000,
["WikiProject_Tree_of_Life"] = 10000,
["WikiProject_Trinidad_and_Tobago"] = 5200,
["WikiProject_Tunisia"] = 5800,
["WikiProject_Turkey"] = 68000,
["WikiProject_Turkmenistan"] = 2400,
["WikiProject_Turtles"] = 3700,
["WikiProject_Typography"] = 2900,
["WikiProject_U.S._Congress"] = 25000,
["WikiProject_U.S._Roads"] = 37000,
["WikiProject_U.S._Roads/StateName"] = 36000,
["WikiProject_U.S._Roads/articletest"] = 37000,
["WikiProject_U.S._Roads/cats"] = 37000,
["WikiProject_U.S._Roads/cats/core"] = 37000,
["WikiProject_U.S._Roads/cats/istemplate"] = 37000,
["WikiProject_U.S._Roads/class"] = 37000,
["WikiProject_U.S._Roads/overcat"] = 36000,
["WikiProject_U.S._Supreme_Court_cases"] = 6400,
["WikiProject_UK_Parliament_constituencies"] = 2300,
["WikiProject_UK_geography"] = 38000,
["WikiProject_Ukraine"] = 44000,
["WikiProject_Ukraine/class"] = 44000,
["WikiProject_Underwater_diving"] = 3900,
["WikiProject_United_Arab_Emirates"] = 8400,
["WikiProject_United_Kingdom"] = 98000,
["WikiProject_United_States"] = 981000,
["WikiProject_United_States_History"] = 5300,
["WikiProject_United_States_Territories"] = 8500,
["WikiProject_United_States_courts_and_judges"] = 13000,
["WikiProject_University_of_California"] = 3400,
["WikiProject_University_of_Cambridge"] = 2800,
["WikiProject_University_of_Florida"] = 2100,
["WikiProject_University_of_Oxford"] = 12000,
["WikiProject_University_of_Pennsylvania"] = 3100,
["WikiProject_Unreferenced_articles"] = 3100,
["WikiProject_Urban_studies_and_planning"] = 7200,
["WikiProject_Uruguay"] = 12000,
["WikiProject_Userboxes"] = 64000,
["WikiProject_Veganism_and_Vegetarianism"] = 3400,
["WikiProject_Venezuela"] = 14000,
["WikiProject_Veterinary_medicine"] = 2400,
["WikiProject_Video_Games"] = 2000,
["WikiProject_Video_games"] = 118000,
["WikiProject_Video_games/class"] = 118000,
["WikiProject_Video_games/importance"] = 118000,
["WikiProject_Vietnam"] = 20000,
["WikiProject_Villages"] = 13000,
["WikiProject_Virginia"] = 32000,
["WikiProject_Viruses"] = 7300,
["WikiProject_Visual_arts"] = 113000,
["WikiProject_Volcanoes"] = 7300,
["WikiProject_Volleyball"] = 20000,
["WikiProject_Wales"] = 36000,
["WikiProject_Warwickshire"] = 2700,
["WikiProject_Water"] = 2800,
["WikiProject_Water_sports"] = 16000,
["WikiProject_Weather"] = 17000,
["WikiProject_Websites"] = 5800,
["WikiProject_West_Midlands"] = 4800,
["WikiProject_Western_Asia"] = 11000,
["WikiProject_Westerns"] = 10000,
["WikiProject_Wiki_Loves_Women"] = 2100,
["WikiProject_Wikipedia_essays"] = 2700,
["WikiProject_Wikipedia_essays/importance"] = 2700,
["WikiProject_Wiltshire"] = 2800,
["WikiProject_Wisconsin"] = 32000,
["WikiProject_Women"] = 188000,
["WikiProject_Women's_Health"] = 3700,
["WikiProject_Women's_History"] = 94000,
["WikiProject_Women's_sport"] = 209000,
["WikiProject_Women_artists"] = 24000,
["WikiProject_Women_in_Business"] = 9600,
["WikiProject_Women_in_Music"] = 79000,
["WikiProject_Women_in_Red"] = 66000,
["WikiProject_Women_in_Religion"] = 9200,
["WikiProject_Women_scientists"] = 28000,
["WikiProject_Women_writers"] = 85000,
["WikiProject_World_Heritage_Sites"] = 2800,
["WikiProject_World_Rally"] = 2300,
["WikiProject_Writing_systems"] = 4800,
["WikiProject_Years"] = 743000,
["WikiProject_Yemen"] = 6600,
["WikiProject_Yorkshire"] = 29000,
["WikiProject_YouTube"] = 3500,
["WikiProject_Yugoslavia"] = 7700,
["WikiProject_Zimbabwe"] = 6100,
["WikiProject_Zoo"] = 3200,
["WikiProject_banner"] = 5800,
["WikiProject_banner_shell"] = 12000000,
["WikiProject_cleanup_list"] = 84000,
["WikiProject_cleanup_listing"] = 9700,
["WikiProject_cleanup_listing/styles.css"] = 9700,
["WikiProject_description_page"] = 2900,
["WikiProject_status"] = 2700,
["WikiProjectbasename"] = 2600,
["Wiki_Loves_Pride_talk"] = 4300,
["Wikibooks"] = 2600,
["Wikibreak"] = 2600,
["Wikicite"] = 2300,
["Wikidata"] = 465000,
["WikidataCheck"] = 36000,
["Wikidata_check"] = 551000,
["Wikidata_entity_link"] = 66000,
["Wikidata_image"] = 1120000,
["Wikidata_list"] = 4300,
["Wikidata_list_end"] = 4200,
["Wikidata_location"] = 3400,
["Wikidata_property_link"] = 2600,
["Wikidata_sitelink"] = 96000,
["Wikinews"] = 3300,
["Wikipedia's_sister_projects/styles.css"] = 6900,
["Wikipedia:Version_1.0_article_stats"] = 5100,
["Wikipedia_Embassy_link"] = 4400,
["Wikipedia_ads"] = 3800,
["Wikipedia_category"] = 18000,
["Wikipedia_help_pages"] = 2200,
["Wikipedia_languages/styles.css"] = 4600,
["Wikipedia_logs"] = 9500,
["Wikipedia_other"] = 13000,
["Wikipedia_policies_and_guidelines"] = 3800,
["Wikiquote"] = 44000,
["Wikiquote-inline"] = 2900,
["Wikiquote_inline"] = 3300,
["Wikisource"] = 20000,
["Wikisource-inline"] = 6300,
["Wikisource/Author"] = 5700,
["Wikisource/inner_core"] = 20000,
["Wikisource/outer_core"] = 20000,
["Wikisource_author-inline"] = 2000,
["Wikisource_inline"] = 6600,
["Wikispecies"] = 36000,
["Wikispecies-inline"] = 12000,
["Wikispecies_inline"] = 14000,
["Wikivoyage"] = 12000,
["Wikivoyage-inline"] = 2500,
["Wikivoyage_inline"] = 5700,
["Wikt"] = 11000,
["Wikt-lang"] = 4800,
["Wiktionary"] = 82000,
["Wiktionary-inline"] = 2600,
["Wiktionary_inline"] = 3400,
["Wiktionary_redirect"] = 2100,
["Wiktionary_redirect/styles.css"] = 2200,
["Win_draw_lose"] = 8200,
["Win_draw_lose_totals"] = 6600,
["Wink"] = 4500,
["Winners"] = 5300,
["Winning_percentage"] = 43000,
["Winpct"] = 8900,
["Women's_Tennis_Association_link"] = 3900,
["Won"] = 55000,
["Word_break"] = 2300,
["Workpage"] = 4700,
["Works_year_header"] = 4900,
["Works_year_header/helper"] = 4900,
["WorldFootball.net"] = 25000,
["World_Aquatics"] = 2000,
["World_Athletics"] = 14000,
["World_Rowing"] = 2700,
["World_Series_Year"] = 6800,
["World_Tennis_profile"] = 9300,
["World_topic"] = 2100,
["Worldfootball.net"] = 6300,
["Wounded_in_action"] = 2100,
["Wrap"] = 60000,
["Wraplink"] = 3800,
["Writer_icon"] = 6300,
["Writer_icon2"] = 6300,
["WritingCredits"] = 4000,
["Wsy"] = 5900,
["Module:WDL"] = 15000,
["Module:WLink"] = 9200,
["Module:WPMILHIST_Infobox_style"] = 246000,
["Module:WPSHIPS_utilities"] = 103000,
["Module:WPSHIPS_utilities/data"] = 103000,
["Module:Wd"] = 1940000,
["Module:Wd/i18n"] = 1940000,
["Module:Weather_box"] = 32000,
["Module:Weather_box/colors"] = 32000,
["Module:Weather_box/row"] = 32000,
["Module:Webarchive"] = 695000,
["Module:Webarchive/data"] = 695000,
["Module:Wide_image"] = 11000,
["Module:Wide_image/styles.css"] = 11000,
["Module:WikiProject_banner"] = 12000000,
["Module:WikiProject_banner/auxiliary"] = 4820000,
["Module:WikiProject_banner/config"] = 12000000,
["Module:WikiProject_banner/styles.css"] = 12000000,
["Module:Wikidata"] = 213000,
["Module:WikidataCheck"] = 563000,
["Module:WikidataIB"] = 1150000,
["Module:WikidataIB/nolinks"] = 1150000,
["Module:WikidataIB/titleformats"] = 1150000,
["Module:WikidataIdentifiers"] = 2800,
["Module:Wikipedia_ads"] = 3800,
["Module:Wikipedia_ads/data"] = 4100,
["Module:Wikipedia_ads/list"] = 4100,
["Module:WikitextParser"] = 20000,
["Module:Wikitext_Parsing"] = 19000000,
["Module:Wikt-lang"] = 4800,
["Module:Wikt-lang/data"] = 4900,
["Module:Women_in_Red_event"] = 67000,
["Module:World_topic"] = 2100,
["Module:WritingCredits"] = 4000,
}
fw6zq60089ig1g9ih59oyymbew108aw
74893
74892
2026-08-24T00:42:43Z
Robertsky
10424
1 versaun husi [[:en:Module:Transclusion_count/data/W]]
74892
Scribunto
text/plain
return {
["WAL"] = 2200,
["WDL"] = 8100,
["WDLtot"] = 6500,
["WIA"] = 2100,
["WP1"] = 5100,
["WPB"] = 2000,
["WPBS"] = 27000,
["WPB_Announcements"] = 20000,
["WPCC"] = 258000,
["WPEUR10k"] = 9500,
["WPEUR20k"] = 16000,
["WPLA10k"] = 3200,
["WPMILHIST"] = 2200,
["WPMILHIST_Infobox_style"] = 109000,
["WPOCEANIA10k"] = 3900,
["WPSS-cat"] = 22000,
["WPTC_track_map_key"] = 2200,
["WPUKIR10k"] = 11000,
["WPUKIR20k"] = 11000,
["WPUS"] = 3100,
["WPVG_announcements"] = 118000,
["WPVG_announcements/shell"] = 118000,
["WPVG_icon"] = 36000,
["WPVG_icon_direct"] = 158000,
["WPX_action_box"] = 2900,
["WPX_block"] = 2200,
["WPX_last_updated"] = 5100,
["WPX_list_end"] = 2200,
["WPX_list_start"] = 2200,
["WPX_subheader"] = 3000,
["WP_Architecture"] = 4400,
["WP_Athletics"] = 2400,
["WP_Canada"] = 2000,
["WP_Crime"] = 2400,
["WP_Women"] = 2500,
["WP_Years"] = 5100,
["WP_banner_shell"] = 5800,
["WRMS_source"] = 2700,
["WRMS_species"] = 15000,
["WTA"] = 3900,
["Warning"] = 56000,
["Watch"] = 29000,
["Wb"] = 2100,
["Wbr"] = 2300,
["Wd"] = 2400,
["Wdib"] = 15000,
["Weather_box"] = 32000,
["Webarchive"] = 695000,
["Wednesday"] = 2800,
["Welcome_ISP"] = 4100,
["Welcome_graphical/links"] = 61000,
["Welcomeg/links"] = 61000,
["Western_name_order"] = 7700,
["What_links_here"] = 13000,
["When"] = 27000,
["Where"] = 2400,
["Which"] = 6600,
["Whisperback"] = 2700,
["White"] = 94000,
["Who"] = 11000,
["Who's_Who"] = 3800,
["Whois"] = 9500,
["Whyte"] = 2100,
["Whyte_suffix"] = 2100,
["Wide_image"] = 9600,
["WikiProjectBannerShell"] = 84000,
["WikiProjectCard"] = 3200,
["WikiProject_2010s"] = 3600,
["WikiProject_Academic_Journals"] = 36000,
["WikiProject_Afghanistan"] = 12000,
["WikiProject_Africa"] = 238000,
["WikiProject_African_diaspora"] = 26000,
["WikiProject_AfroCreatives"] = 9700,
["WikiProject_Agriculture"] = 15000,
["WikiProject_Alabama"] = 20000,
["WikiProject_Alaska"] = 12000,
["WikiProject_Albania"] = 17000,
["WikiProject_Albums"] = 408000,
["WikiProject_Algae"] = 5900,
["WikiProject_Algeria"] = 8600,
["WikiProject_Alternative_medicine"] = 2400,
["WikiProject_Alternative_music"] = 16000,
["WikiProject_Alternative_views"] = 2300,
["WikiProject_American_Open_Wheel_Racing"] = 4100,
["WikiProject_American_football"] = 12000,
["WikiProject_Amphibians_and_Reptiles"] = 36000,
["WikiProject_Amusement_Parks"] = 7300,
["WikiProject_Amusement_Parks/importance"] = 7300,
["WikiProject_Anarchism"] = 4000,
["WikiProject_Anarchism_cleanup_issue_count"] = 4100,
["WikiProject_Anatomy"] = 22000,
["WikiProject_Ancient_Egypt"] = 6100,
["WikiProject_Ancient_Near_East"] = 7500,
["WikiProject_Anglicanism"] = 13000,
["WikiProject_Anglo-Saxon_Kingdoms"] = 2300,
["WikiProject_Animal_rights"] = 2900,
["WikiProject_Animals"] = 38000,
["WikiProject_Animation"] = 43000,
["WikiProject_Animation/importance"] = 43000,
["WikiProject_Anime_and_manga"] = 44000,
["WikiProject_Antarctica"] = 18000,
["WikiProject_Anthropology"] = 12000,
["WikiProject_Anthroponymy"] = 147000,
["WikiProject_Antigua_and_Barbuda"] = 2900,
["WikiProject_Apple_Inc."] = 3400,
["WikiProject_Apps"] = 2400,
["WikiProject_Arab_world"] = 6900,
["WikiProject_Archaeology"] = 24000,
["WikiProject_Architecture"] = 178000,
["WikiProject_Arctic"] = 3200,
["WikiProject_Arena_Football_League"] = 2800,
["WikiProject_Argentina"] = 36000,
["WikiProject_Arizona"] = 6200,
["WikiProject_Armenia"] = 14000,
["WikiProject_Arthropods"] = 32000,
["WikiProject_Articles_for_creation"] = 236000,
["WikiProject_Arts"] = 14000,
["WikiProject_Asia"] = 34000,
["WikiProject_Asian_Month"] = 2700,
["WikiProject_Assyria"] = 5400,
["WikiProject_Astronomy"] = 94000,
["WikiProject_Astronomy/importance"] = 94000,
["WikiProject_Athletics"] = 90000,
["WikiProject_Auckland"] = 3200,
["WikiProject_Australia"] = 288000,
["WikiProject_Australia/ACR"] = 288000,
["WikiProject_Austria"] = 38000,
["WikiProject_Autism"] = 2500,
["WikiProject_Automobiles"] = 23000,
["WikiProject_Aviation"] = 84000,
["WikiProject_Awards"] = 45000,
["WikiProject_Azerbaijan"] = 17000,
["WikiProject_BBC"] = 9400,
["WikiProject_Badminton"] = 9200,
["WikiProject_Bahrain"] = 3600,
["WikiProject_Bangladesh"] = 32000,
["WikiProject_BannerShell"] = 3800,
["WikiProject_Banner_Shell"] = 8300,
["WikiProject_Baseball"] = 95000,
["WikiProject_Basketball"] = 72000,
["WikiProject_Basque"] = 3500,
["WikiProject_Bavaria"] = 7300,
["WikiProject_Beauty_Pageants"] = 9400,
["WikiProject_Beer"] = 4700,
["WikiProject_Beetles"] = 83000,
["WikiProject_Belarus"] = 12000,
["WikiProject_Belgium"] = 40000,
["WikiProject_Belize"] = 2700,
["WikiProject_Berkshire"] = 2400,
["WikiProject_Bhutan"] = 2900,
["WikiProject_Biathlon"] = 3100,
["WikiProject_Bible"] = 8500,
["WikiProject_Biography"] = 2910000,
["WikiProject_Biology"] = 11000,
["WikiProject_Birds"] = 33000,
["WikiProject_Bivalves"] = 3700,
["WikiProject_Board_and_table_games"] = 9800,
["WikiProject_Bolivia"] = 8300,
["WikiProject_Books"] = 85000,
["WikiProject_Bosnia_and_Herzegovina"] = 16000,
["WikiProject_Boxing"] = 20000,
["WikiProject_Brands"] = 24000,
["WikiProject_Brazil"] = 70000,
["WikiProject_Bridges_and_Tunnels"] = 14000,
["WikiProject_Bristol"] = 2600,
["WikiProject_British_Empire"] = 14000,
["WikiProject_British_Motorsport"] = 2500,
["WikiProject_British_Overseas_Territories"] = 23000,
["WikiProject_Buckinghamshire"] = 2300,
["WikiProject_Buddhism"] = 9500,
["WikiProject_Bulgaria"] = 25000,
["WikiProject_Buses"] = 7400,
["WikiProject_Business"] = 57000,
["WikiProject_COVID-19"] = 4500,
["WikiProject_California"] = 93000,
["WikiProject_Cambodia"] = 6100,
["WikiProject_Cambodia/to_do"] = 6100,
["WikiProject_Canada"] = 258000,
["WikiProject_Canada/TFtext"] = 258000,
["WikiProject_Canada_Roads"] = 2900,
["WikiProject_Canada_Roads/class"] = 2900,
["WikiProject_Canadian_football"] = 11000,
["WikiProject_Cannabis"] = 2600,
["WikiProject_Canoeing_and_Kayaking"] = 7800,
["WikiProject_Caribbean"] = 54000,
["WikiProject_Cartoon_Network"] = 2900,
["WikiProject_Catalan-speaking_countries"] = 4500,
["WikiProject_Catalonia"] = 3600,
["WikiProject_Categories"] = 6400,
["WikiProject_Catholicism"] = 66000,
["WikiProject_Caves"] = 2300,
["WikiProject_Celts"] = 2300,
["WikiProject_Cemeteries"] = 11000,
["WikiProject_Central_America"] = 9600,
["WikiProject_Central_Asia"] = 23000,
["WikiProject_Central_Asia/importance"] = 23000,
["WikiProject_Cephalopods"] = 5000,
["WikiProject_Chemicals"] = 30000,
["WikiProject_Chemistry"] = 18000,
["WikiProject_Cheshire"] = 4500,
["WikiProject_Chess"] = 9500,
["WikiProject_Chess/importance"] = 9500,
["WikiProject_Chicago"] = 42000,
["WikiProject_Children's_literature"] = 26000,
["WikiProject_Chile"] = 24000,
["WikiProject_China"] = 125000,
["WikiProject_Christian_music"] = 8100,
["WikiProject_Christianity"] = 95000,
["WikiProject_Cities"] = 541000,
["WikiProject_Civil_Rights_Movement"] = 2100,
["WikiProject_Civil_Rights_Movement/article_todolist"] = 2100,
["WikiProject_Civil_engineering"] = 23000,
["WikiProject_Classical_Greece_and_Rome"] = 33000,
["WikiProject_Classical_music"] = 35000,
["WikiProject_Cleveland"] = 3000,
["WikiProject_Climate_change"] = 5000,
["WikiProject_Climbing"] = 3100,
["WikiProject_Cold_War"] = 3400,
["WikiProject_College_Basketball"] = 36000,
["WikiProject_College_basketball"] = 63000,
["WikiProject_College_football"] = 166000,
["WikiProject_College_football/importance"] = 166000,
["WikiProject_Colombia"] = 20000,
["WikiProject_Comedy"] = 44000,
["WikiProject_Comics"] = 60000,
["WikiProject_Comics/importance"] = 60000,
["WikiProject_Companies"] = 122000,
["WikiProject_Composers"] = 20000,
["WikiProject_Computer_Security"] = 2500,
["WikiProject_Computer_science"] = 9100,
["WikiProject_Computer_security"] = 2900,
["WikiProject_Computing"] = 49000,
["WikiProject_Concerts"] = 8300,
["WikiProject_Connecticut"] = 19000,
["WikiProject_Conservatism"] = 11000,
["WikiProject_Cooperatives"] = 2400,
["WikiProject_Cornwall"] = 6300,
["WikiProject_Cornwall/guide"] = 6300,
["WikiProject_Correction_and_Detention_Facilities"] = 4900,
["WikiProject_Costa_Rica"] = 6800,
["WikiProject_Countries"] = 29000,
["WikiProject_Country_Music"] = 12000,
["WikiProject_Country_music"] = 17000,
["WikiProject_Cricket"] = 66000,
["WikiProject_Cricket/importance"] = 66000,
["WikiProject_Crime"] = 11000,
["WikiProject_Crime_and_Criminal_Biography"] = 77000,
["WikiProject_Croatia"] = 29000,
["WikiProject_Crusades"] = 3300,
["WikiProject_Cuba"] = 10000,
["WikiProject_Cue_sports"] = 2600,
["WikiProject_Culture"] = 17000,
["WikiProject_Curling"] = 7700,
["WikiProject_Current_events"] = 8400,
["WikiProject_Cycling"] = 44000,
["WikiProject_Cyprus"] = 7500,
["WikiProject_Czech_Republic"] = 38000,
["WikiProject_Dams"] = 7300,
["WikiProject_Dance"] = 17000,
["WikiProject_Darts"] = 2200,
["WikiProject_Deaf"] = 2400,
["WikiProject_Death"] = 57000,
["WikiProject_Denmark"] = 43000,
["WikiProject_Derbyshire"] = 3600,
["WikiProject_Devon"] = 5800,
["WikiProject_Dinosaurs"] = 5900,
["WikiProject_Diptera"] = 23000,
["WikiProject_Disability"] = 28000,
["WikiProject_Disambiguation"] = 351000,
["WikiProject_Disaster_management"] = 28000,
["WikiProject_Discographies"] = 7700,
["WikiProject_Discrimination"] = 8400,
["WikiProject_Disney"] = 11000,
["WikiProject_Doctor_Who"] = 4200,
["WikiProject_Dogs"] = 4200,
["WikiProject_Dorset"] = 3100,
["WikiProject_Drag_Race"] = 2100,
["WikiProject_Dungeons_&_Dragons"] = 6600,
["WikiProject_Dungeons_&_Dragons/importance"] = 6600,
["WikiProject_Earthquakes"] = 3700,
["WikiProject_EastEnders"] = 2500,
["WikiProject_East_Anglia"] = 10000,
["WikiProject_East_Timor"] = 2100,
["WikiProject_Eastern_Orthodoxy"] = 3100,
["WikiProject_Ecology"] = 4300,
["WikiProject_Economics"] = 24000,
["WikiProject_Ecoregions"] = 2800,
["WikiProject_Ecuador"] = 11000,
["WikiProject_Edit_requests"] = 4400,
["WikiProject_Education"] = 42000,
["WikiProject_Egypt"] = 18000,
["WikiProject_El_Salvador"] = 4900,
["WikiProject_Elections_and_Referendums"] = 143000,
["WikiProject_Electrical_engineering"] = 5000,
["WikiProject_Electronic_music"] = 19000,
["WikiProject_Electronics"] = 6900,
["WikiProject_Elements"] = 10000,
["WikiProject_Energy"] = 28000,
["WikiProject_Engineering"] = 16000,
["WikiProject_England"] = 124000,
["WikiProject_English_Language"] = 3200,
["WikiProject_Environment"] = 23000,
["WikiProject_Equine"] = 9000,
["WikiProject_Espionage"] = 3200,
["WikiProject_Essays"] = 2600,
["WikiProject_Estonia"] = 24000,
["WikiProject_Ethiopia"] = 7000,
["WikiProject_Ethnic_groups"] = 15000,
["WikiProject_Ethnic_groups_tasks"] = 15000,
["WikiProject_Europe"] = 43000,
["WikiProject_European_Microstates"] = 14000,
["WikiProject_European_Union"] = 10000,
["WikiProject_European_history"] = 18000,
["WikiProject_Eurovision"] = 5200,
["WikiProject_Event_Venues"] = 14000,
["WikiProject_Explosives"] = 2200,
["WikiProject_Faroe_Islands"] = 2800,
["WikiProject_Fashion"] = 14000,
["WikiProject_Feminism"] = 11000,
["WikiProject_Fencing"] = 8500,
["WikiProject_Festivals"] = 11000,
["WikiProject_Fictional_characters"] = 96000,
["WikiProject_Fictional_characters/class"] = 96000,
["WikiProject_Figure_Skating"] = 8400,
["WikiProject_Fiji"] = 5800,
["WikiProject_Film"] = 435000,
["WikiProject_Finance_&_Investment"] = 25000,
["WikiProject_Finland"] = 40000,
["WikiProject_Firearms"] = 13000,
["WikiProject_Firefighting"] = 4200,
["WikiProject_Fisheries_and_Fishing"] = 3300,
["WikiProject_Fishes"] = 45000,
["WikiProject_Florida"] = 34000,
["WikiProject_Folklore"] = 3900,
["WikiProject_Food_and_drink"] = 69000,
["WikiProject_Football"] = 528000,
["WikiProject_Forestry"] = 3500,
["WikiProject_Former_countries"] = 38000,
["WikiProject_Formula_One"] = 8400,
["WikiProject_France"] = 205000,
["WikiProject_Fraternities_and_Sororities"] = 4300,
["WikiProject_Fungi"] = 33000,
["WikiProject_Futures_studies"] = 2100,
["WikiProject_Gaelic_games"] = 22000,
["WikiProject_Gambling"] = 5300,
["WikiProject_Gastropods"] = 50000,
["WikiProject_Gender_studies"] = 5700,
["WikiProject_Genealogy"] = 7700,
["WikiProject_Geography"] = 101000,
["WikiProject_Geology"] = 36000,
["WikiProject_Georgia_(U.S._state)"] = 27000,
["WikiProject_Georgia_(country)"] = 12000,
["WikiProject_Germany"] = 189000,
["WikiProject_Ghana"] = 9100,
["WikiProject_Ghost_towns"] = 3100,
["WikiProject_Gibraltar"] = 2600,
["WikiProject_Glaciers"] = 4000,
["WikiProject_Gloucestershire"] = 3200,
["WikiProject_Golf"] = 18000,
["WikiProject_Google"] = 2200,
["WikiProject_Greater_Manchester"] = 7700,
["WikiProject_Greece"] = 59000,
["WikiProject_Green_Bay_Packers"] = 3400,
["WikiProject_Greenland"] = 3200,
["WikiProject_Guatemala"] = 5400,
["WikiProject_Guild_of_Copy_Editors"] = 12000,
["WikiProject_Guitarists"] = 4500,
["WikiProject_Gymnastics"] = 13000,
["WikiProject_Haiti"] = 6000,
["WikiProject_Hampshire"] = 4700,
["WikiProject_Handball"] = 16000,
["WikiProject_Hawaii"] = 10000,
["WikiProject_Health_and_fitness"] = 7500,
["WikiProject_Heraldry"] = 3400,
["WikiProject_Heraldry_and_vexillology"] = 19000,
["WikiProject_Hertfordshire"] = 3600,
["WikiProject_Higher_education"] = 95000,
["WikiProject_Higher_education/config"] = 95000,
["WikiProject_Highways"] = 16000,
["WikiProject_Highways/class"] = 16000,
["WikiProject_Hinduism"] = 11000,
["WikiProject_Hip-hop"] = 31000,
["WikiProject_Hip_hop"] = 20000,
["WikiProject_Historic_sites"] = 30000,
["WikiProject_History"] = 78000,
["WikiProject_History_of_Science"] = 6700,
["WikiProject_Holidays"] = 5600,
["WikiProject_Home_Living"] = 3700,
["WikiProject_Honduras"] = 3900,
["WikiProject_Hong_Kong"] = 26000,
["WikiProject_Horror"] = 20000,
["WikiProject_Horse_racing"] = 17000,
["WikiProject_Horticulture_and_Gardening"] = 5200,
["WikiProject_Hospitals"] = 13000,
["WikiProject_Hotels"] = 6200,
["WikiProject_Human_rights"] = 18000,
["WikiProject_Hungary"] = 35000,
["WikiProject_Ice_Hockey"] = 67000,
["WikiProject_Iceland"] = 12000,
["WikiProject_Illinois"] = 43000,
["WikiProject_Indexes"] = 2700,
["WikiProject_India"] = 310000,
["WikiProject_Indigenous_peoples_of_North_America"] = 20000,
["WikiProject_Indigenous_peoples_of_the_Americas"] = 5600,
["WikiProject_Indonesia"] = 38000,
["WikiProject_Industrial"] = 4600,
["WikiProject_Industrial_design"] = 3900,
["WikiProject_Industrial_tasks"] = 4600,
["WikiProject_Insects"] = 133000,
["WikiProject_International_relations"] = 95000,
["WikiProject_Internet"] = 11000,
["WikiProject_Internet_culture"] = 10000,
["WikiProject_Intertranswiki/OKA"] = 5600,
["WikiProject_Iran"] = 96000,
["WikiProject_Iraq"] = 13000,
["WikiProject_Ireland"] = 106000,
["WikiProject_Islam"] = 25000,
["WikiProject_Islands"] = 17000,
["WikiProject_Isle_of_Man"] = 3100,
["WikiProject_Israel"] = 36000,
["WikiProject_Italy"] = 131000,
["WikiProject_Japan"] = 148000,
["WikiProject_Jazz"] = 46000,
["WikiProject_Jewish_Women"] = 3600,
["WikiProject_Jewish_culture"] = 2200,
["WikiProject_Jewish_history"] = 13000,
["WikiProject_Jordan"] = 5500,
["WikiProject_Journalism"] = 51000,
["WikiProject_Judaism"] = 26000,
["WikiProject_Kansas"] = 16000,
["WikiProject_Kent"] = 5400,
["WikiProject_Kingdom_of_Naples"] = 2400,
["WikiProject_Korea"] = 69000,
["WikiProject_Kosovo"] = 5800,
["WikiProject_Kurdistan"] = 6700,
["WikiProject_Kuwait"] = 2800,
["WikiProject_Kyrgyzstan"] = 3400,
["WikiProject_LGBTQ+_studies"] = 52000,
["WikiProject_LGBT_studies"] = 23000,
["WikiProject_Lacrosse"] = 3800,
["WikiProject_Lakes"] = 23000,
["WikiProject_Lancashire_and_Cumbria"] = 9000,
["WikiProject_Languages"] = 25000,
["WikiProject_Latin"] = 2100,
["WikiProject_Latin_America"] = 3100,
["WikiProject_Latin_music"] = 20000,
["WikiProject_Latino_and_Hispanic_heritage"] = 16000,
["WikiProject_Latter_Day_Saint_movement"] = 5300,
["WikiProject_Latvia"] = 14000,
["WikiProject_Law"] = 93000,
["WikiProject_Law_Enforcement"] = 17000,
["WikiProject_Leaders_by_year"] = 2600,
["WikiProject_Lebanon"] = 11000,
["WikiProject_Lepidoptera"] = 128000,
["WikiProject_Libraries"] = 13000,
["WikiProject_Library_of_Congress"] = 2300,
["WikiProject_Lighthouses"] = 4000,
["WikiProject_Limnology_and_Oceanography"] = 2100,
["WikiProject_Lincolnshire"] = 5100,
["WikiProject_Linguistics"] = 17000,
["WikiProject_Lists"] = 222000,
["WikiProject_Lists/class"] = 222000,
["WikiProject_Literature"] = 42000,
["WikiProject_Lithuania"] = 18000,
["WikiProject_London"] = 40000,
["WikiProject_London_Transport"] = 3300,
["WikiProject_Lower_Saxony"] = 2100,
["WikiProject_Lutheranism"] = 4100,
["WikiProject_Luxembourg"] = 7300,
["WikiProject_Macau"] = 2400,
["WikiProject_Magazines"] = 23000,
["WikiProject_Maine"] = 12000,
["WikiProject_Malaysia"] = 31000,
["WikiProject_Maldives"] = 3900,
["WikiProject_Malta"] = 6200,
["WikiProject_Mammals"] = 21000,
["WikiProject_Maps"] = 11000,
["WikiProject_Marine_life"] = 17000,
["WikiProject_Marketing_&_Advertising"] = 7000,
["WikiProject_Martial_arts"] = 40000,
["WikiProject_Maryland"] = 21000,
["WikiProject_Mathematics"] = 34000,
["WikiProject_Media"] = 27000,
["WikiProject_Media_franchises"] = 3300,
["WikiProject_Medicine"] = 80000,
["WikiProject_Melanesia"] = 9700,
["WikiProject_Merseyside"] = 4500,
["WikiProject_Mesoamerica"] = 3100,
["WikiProject_Metal"] = 28000,
["WikiProject_Metalworking"] = 2700,
["WikiProject_Mexico"] = 60000,
["WikiProject_Miami"] = 2900,
["WikiProject_Michigan"] = 33000,
["WikiProject_Microbiology"] = 23000,
["WikiProject_Micronesia"] = 9200,
["WikiProject_Microsoft"] = 2900,
["WikiProject_Microsoft_Windows"] = 2500,
["WikiProject_Middle_Ages"] = 33000,
["WikiProject_Military_history"] = 346000,
["WikiProject_Military_history/Checklist_categories"] = 163000,
["WikiProject_Military_history/Class"] = 346000,
["WikiProject_Military_history/Special_project_categories"] = 346000,
["WikiProject_Military_history/Special_project_phase"] = 346000,
["WikiProject_Military_history/Task_force_categories"] = 374000,
["WikiProject_Military_history/YesNo"] = 279000,
["WikiProject_Military_history/class"] = 346000,
["WikiProject_Mills"] = 2900,
["WikiProject_Mining"] = 9400,
["WikiProject_Minnesota"] = 26000,
["WikiProject_Missouri"] = 27000,
["WikiProject_Mixed_martial_arts"] = 7300,
["WikiProject_Moldova"] = 7400,
["WikiProject_Molecular_Biology"] = 40000,
["WikiProject_Mongols"] = 6700,
["WikiProject_Montana"] = 10000,
["WikiProject_Montenegro"] = 7200,
["WikiProject_Morocco"] = 11000,
["WikiProject_Motorcycle_racing"] = 7400,
["WikiProject_Motorcycling"] = 8500,
["WikiProject_Motorsport"] = 29000,
["WikiProject_Mountains"] = 40000,
["WikiProject_Multi-sport_events"] = 51000,
["WikiProject_Museums"] = 34000,
["WikiProject_Music/Music_genres_task_force"] = 6000,
["WikiProject_Music_theory"] = 2300,
["WikiProject_Musical_Instruments"] = 5900,
["WikiProject_Musical_Theatre"] = 8200,
["WikiProject_Myanmar"] = 13000,
["WikiProject_Mythology"] = 14000,
["WikiProject_NASCAR"] = 9200,
["WikiProject_National_Basketball_Association"] = 17000,
["WikiProject_National_Football_League"] = 54000,
["WikiProject_National_Register_of_Historic_Places"] = 96000,
["WikiProject_National_Register_of_Historic_Places/importance"] = 96000,
["WikiProject_Nepal"] = 21000,
["WikiProject_Netball"] = 2100,
["WikiProject_Netherlands"] = 63000,
["WikiProject_Neuroscience"] = 5600,
["WikiProject_Nevada"] = 9600,
["WikiProject_New_Jersey"] = 28000,
["WikiProject_New_York_(state)"] = 54000,
["WikiProject_New_York_City"] = 36000,
["WikiProject_New_Zealand"] = 84000,
["WikiProject_Newspapers"] = 19000,
["WikiProject_Nicaragua"] = 3400,
["WikiProject_Nigeria"] = 26000,
["WikiProject_Normandy"] = 4700,
["WikiProject_Norse_history_and_culture"] = 3800,
["WikiProject_North_America"] = 16000,
["WikiProject_North_America/importance"] = 16000,
["WikiProject_North_East_England"] = 6700,
["WikiProject_North_Macedonia"] = 8200,
["WikiProject_Northern_Ireland"] = 23000,
["WikiProject_Norway"] = 64000,
["WikiProject_Nottinghamshire"] = 3000,
["WikiProject_Novels"] = 96000,
["WikiProject_Numismatics"] = 8200,
["WikiProject_Nursing"] = 2400,
["WikiProject_Occult"] = 2900,
["WikiProject_Occupational_Safety_and_Health"] = 3400,
["WikiProject_Occupations"] = 5900,
["WikiProject_Oceania"] = 11000,
["WikiProject_Oceans"] = 3400,
["WikiProject_Ohio"] = 9700,
["WikiProject_Oklahoma"] = 16000,
["WikiProject_Olympics"] = 212000,
["WikiProject_Oman"] = 2400,
["WikiProject_Opera"] = 18000,
["WikiProject_Orders,_decorations,_and_medals"] = 7800,
["WikiProject_Oregon"] = 28000,
["WikiProject_Oregon/errors"] = 28000,
["WikiProject_Oregon_collab"] = 28000,
["WikiProject_Organizations"] = 74000,
["WikiProject_Organized_Labour"] = 14000,
["WikiProject_Overseas_France"] = 6400,
["WikiProject_Pakistan"] = 47000,
["WikiProject_Palaeontology"] = 37000,
["WikiProject_Palestine"] = 15000,
["WikiProject_Panama"] = 4800,
["WikiProject_Papua_New_Guinea"] = 6000,
["WikiProject_Paraguay"] = 4600,
["WikiProject_Paranormal"] = 2900,
["WikiProject_Pennsylvania"] = 55000,
["WikiProject_Peru"] = 19000,
["WikiProject_Pharmacology"] = 20000,
["WikiProject_Philadelphia"] = 12000,
["WikiProject_Philately"] = 5200,
["WikiProject_Philippines"] = 6400,
["WikiProject_Philosophy"] = 25000,
["WikiProject_Photography"] = 17000,
["WikiProject_Physics"] = 30000,
["WikiProject_Physiology"] = 4200,
["WikiProject_Pittsburgh"] = 6400,
["WikiProject_Plants"] = 159000,
["WikiProject_Podcasting"] = 2800,
["WikiProject_Poetry"] = 27000,
["WikiProject_Pokémon"] = 4000,
["WikiProject_Pokémon/class"] = 4000,
["WikiProject_Poland"] = 118000,
["WikiProject_Politics"] = 287000,
["WikiProject_Politics_of_the_United_Kingdom"] = 56000,
["WikiProject_Polynesia"] = 17000,
["WikiProject_Pop_music"] = 38000,
["WikiProject_Popular_culture"] = 4000,
["WikiProject_Pornography"] = 5200,
["WikiProject_Portals"] = 2200,
["WikiProject_Portals/class"] = 2200,
["WikiProject_Portals/importance"] = 2200,
["WikiProject_Portals/importancescale"] = 2200,
["WikiProject_Portugal"] = 34000,
["WikiProject_Post-hardcore"] = 4500,
["WikiProject_Primates"] = 2800,
["WikiProject_Pritzker-GLAM"] = 3000,
["WikiProject_Professional_sound_production"] = 2600,
["WikiProject_Professional_wrestling"] = 19000,
["WikiProject_Progressive_Rock"] = 4200,
["WikiProject_Protected_areas"] = 31000,
["WikiProject_Protista"] = 5300,
["WikiProject_Psychoactive_and_Recreational_Drugs"] = 2500,
["WikiProject_Psychology"] = 21000,
["WikiProject_Puerto_Rico"] = 16000,
["WikiProject_Punk_music"] = 8700,
["WikiProject_Qatar"] = 4900,
["WikiProject_R&B_and_Soul_Music"] = 20000,
["WikiProject_Radio"] = 15000,
["WikiProject_Radio_Stations"] = 45000,
["WikiProject_Record_Charts"] = 5500,
["WikiProject_Record_Labels"] = 15000,
["WikiProject_Record_Production"] = 7500,
["WikiProject_Redirect"] = 6600,
["WikiProject_Redirect/class"] = 6600,
["WikiProject_Referees"] = 4500,
["WikiProject_Reggae"] = 3300,
["WikiProject_Regional_and_national_music"] = 11000,
["WikiProject_Religion"] = 38000,
["WikiProject_Religious_Buildings,_Architecture_and_Monasticism"] = 2000,
["WikiProject_Religious_texts"] = 2600,
["WikiProject_Retailing"] = 6000,
["WikiProject_Retailing/importance"] = 6000,
["WikiProject_Rivers"] = 60000,
["WikiProject_Robotics"] = 3600,
["WikiProject_Rock_music"] = 34000,
["WikiProject_Rocketry"] = 2600,
["WikiProject_Rocketry/importance"] = 2600,
["WikiProject_Rocks_and_minerals"] = 3300,
["WikiProject_Rodents"] = 5500,
["WikiProject_Role-playing_games"] = 7600,
["WikiProject_Romance"] = 3400,
["WikiProject_Romania"] = 45000,
["WikiProject_Rome"] = 4300,
["WikiProject_Roots_music"] = 6000,
["WikiProject_Rowing"] = 14000,
["WikiProject_Royalty_and_Nobility"] = 7000,
["WikiProject_Rugby_league"] = 21000,
["WikiProject_Rugby_union"] = 42000,
["WikiProject_Running"] = 27000,
["WikiProject_Russia"] = 135000,
["WikiProject_Sailing"] = 14000,
["WikiProject_Saints"] = 6700,
["WikiProject_San_Diego"] = 3600,
["WikiProject_Saudi_Arabia"] = 10000,
["WikiProject_Schools"] = 89000,
["WikiProject_Science"] = 21000,
["WikiProject_Science_Fiction"] = 20000,
["WikiProject_Science_fiction"] = 2400,
["WikiProject_Scotland"] = 63000,
["WikiProject_Scottish_Islands"] = 3300,
["WikiProject_Scouting"] = 8000,
["WikiProject_Screenwriters"] = 2700,
["WikiProject_Sculpture"] = 17000,
["WikiProject_Serbia"] = 31000,
["WikiProject_Sexology_and_sexuality"] = 10000,
["WikiProject_Shakespeare"] = 2200,
["WikiProject_Ships"] = 91000,
["WikiProject_Shipwrecks"] = 8200,
["WikiProject_Shopping_Centers"] = 5900,
["WikiProject_Shropshire"] = 2000,
["WikiProject_Sicily"] = 3900,
["WikiProject_Singapore"] = 16000,
["WikiProject_Skepticism"] = 6300,
["WikiProject_Skiing_and_Snowboarding"] = 22000,
["WikiProject_Skyscrapers"] = 6300,
["WikiProject_Slovakia"] = 19000,
["WikiProject_Slovenia"] = 22000,
["WikiProject_Snooker"] = 3300,
["WikiProject_Soap_Operas"] = 22000,
["WikiProject_Socialism"] = 27000,
["WikiProject_Sociology"] = 51000,
["WikiProject_Softball"] = 5600,
["WikiProject_Software"] = 16000,
["WikiProject_Somalia"] = 3300,
["WikiProject_Somerset"] = 5000,
["WikiProject_Song_Contests"] = 9300,
["WikiProject_Songs"] = 238000,
["WikiProject_South_Africa"] = 51000,
["WikiProject_South_America"] = 37000,
["WikiProject_South_Dakota"] = 9300,
["WikiProject_Southeast_Asia"] = 16000,
["WikiProject_Soviet_Union"] = 28000,
["WikiProject_Spaceflight"] = 14000,
["WikiProject_Spain"] = 98000,
["WikiProject_Speed_Skating"] = 6100,
["WikiProject_Spiders"] = 17000,
["WikiProject_Sports"] = 181000,
["WikiProject_Sports_Car_Racing"] = 5500,
["WikiProject_Squash"] = 2800,
["WikiProject_Sri_Lanka"] = 31000,
["WikiProject_St._Louis"] = 3300,
["WikiProject_Star_Trek"] = 4200,
["WikiProject_Star_Wars"] = 6100,
["WikiProject_Statistics"] = 7400,
["WikiProject_Stub_sorting"] = 68000,
["WikiProject_Stub_sorting_category"] = 22000,
["WikiProject_Stub_sorting_category/styles.css"] = 22000,
["WikiProject_Surrey"] = 2800,
["WikiProject_Sussex"] = 4500,
["WikiProject_Sweden"] = 74000,
["WikiProject_Swimming"] = 40000,
["WikiProject_Switzerland"] = 50000,
["WikiProject_Syria"] = 14000,
["WikiProject_Systems"] = 4900,
["WikiProject_Table_tennis"] = 4700,
["WikiProject_Taiwan"] = 22000,
["WikiProject_Tajikistan"] = 2700,
["WikiProject_Tambayan_Philippines"] = 60000,
["WikiProject_Taxation"] = 2300,
["WikiProject_Technology"] = 19000,
["WikiProject_Telecommunications"] = 11000,
["WikiProject_Television"] = 334000,
["WikiProject_Television/config"] = 334000,
["WikiProject_Templates"] = 33000,
["WikiProject_Tennessee"] = 21000,
["WikiProject_Tennis"] = 64000,
["WikiProject_Textile_Arts"] = 2800,
["WikiProject_Textile_arts"] = 3700,
["WikiProject_Thailand"] = 29000,
["WikiProject_The_Beatles"] = 5100,
["WikiProject_The_Simpsons"] = 2400,
["WikiProject_Theatre"] = 41000,
["WikiProject_Theology"] = 2500,
["WikiProject_Tibet"] = 4100,
["WikiProject_Time"] = 19000,
["WikiProject_Timor-Leste"] = 2300,
["WikiProject_Toys"] = 4000,
["WikiProject_Trade"] = 3000,
["WikiProject_Trains"] = 153000,
["WikiProject_Trains/portalbox"] = 153000,
["WikiProject_Translation_studies"] = 2600,
["WikiProject_Transport"] = 34000,
["WikiProject_Travel_and_Tourism"] = 16000,
["WikiProject_Tree_of_Life"] = 10000,
["WikiProject_Trinidad_and_Tobago"] = 5200,
["WikiProject_Tunisia"] = 5800,
["WikiProject_Turkey"] = 68000,
["WikiProject_Turkmenistan"] = 2400,
["WikiProject_Turtles"] = 3700,
["WikiProject_Typography"] = 2900,
["WikiProject_U.S._Congress"] = 25000,
["WikiProject_U.S._Roads"] = 37000,
["WikiProject_U.S._Roads/StateName"] = 36000,
["WikiProject_U.S._Roads/articletest"] = 37000,
["WikiProject_U.S._Roads/cats"] = 37000,
["WikiProject_U.S._Roads/cats/core"] = 37000,
["WikiProject_U.S._Roads/cats/istemplate"] = 37000,
["WikiProject_U.S._Roads/class"] = 37000,
["WikiProject_U.S._Roads/overcat"] = 36000,
["WikiProject_U.S._Supreme_Court_cases"] = 6400,
["WikiProject_UK_Parliament_constituencies"] = 2300,
["WikiProject_UK_geography"] = 38000,
["WikiProject_Ukraine"] = 44000,
["WikiProject_Ukraine/class"] = 44000,
["WikiProject_Underwater_diving"] = 3900,
["WikiProject_United_Arab_Emirates"] = 8400,
["WikiProject_United_Kingdom"] = 98000,
["WikiProject_United_States"] = 981000,
["WikiProject_United_States_History"] = 5300,
["WikiProject_United_States_Territories"] = 8500,
["WikiProject_United_States_courts_and_judges"] = 13000,
["WikiProject_University_of_California"] = 3400,
["WikiProject_University_of_Cambridge"] = 2800,
["WikiProject_University_of_Florida"] = 2100,
["WikiProject_University_of_Oxford"] = 12000,
["WikiProject_University_of_Pennsylvania"] = 3100,
["WikiProject_Unreferenced_articles"] = 3100,
["WikiProject_Urban_studies_and_planning"] = 7200,
["WikiProject_Uruguay"] = 12000,
["WikiProject_Userboxes"] = 64000,
["WikiProject_Veganism_and_Vegetarianism"] = 3400,
["WikiProject_Venezuela"] = 14000,
["WikiProject_Veterinary_medicine"] = 2400,
["WikiProject_Video_Games"] = 2000,
["WikiProject_Video_games"] = 118000,
["WikiProject_Video_games/class"] = 118000,
["WikiProject_Video_games/importance"] = 118000,
["WikiProject_Vietnam"] = 20000,
["WikiProject_Villages"] = 13000,
["WikiProject_Virginia"] = 32000,
["WikiProject_Viruses"] = 7300,
["WikiProject_Visual_arts"] = 113000,
["WikiProject_Volcanoes"] = 7300,
["WikiProject_Volleyball"] = 20000,
["WikiProject_Wales"] = 36000,
["WikiProject_Warwickshire"] = 2700,
["WikiProject_Water"] = 2800,
["WikiProject_Water_sports"] = 16000,
["WikiProject_Weather"] = 17000,
["WikiProject_Websites"] = 5800,
["WikiProject_West_Midlands"] = 4800,
["WikiProject_Western_Asia"] = 11000,
["WikiProject_Westerns"] = 10000,
["WikiProject_Wiki_Loves_Women"] = 2100,
["WikiProject_Wikipedia_essays"] = 2700,
["WikiProject_Wikipedia_essays/importance"] = 2700,
["WikiProject_Wiltshire"] = 2800,
["WikiProject_Wisconsin"] = 32000,
["WikiProject_Women"] = 188000,
["WikiProject_Women's_Health"] = 3700,
["WikiProject_Women's_History"] = 94000,
["WikiProject_Women's_sport"] = 209000,
["WikiProject_Women_artists"] = 24000,
["WikiProject_Women_in_Business"] = 9600,
["WikiProject_Women_in_Music"] = 79000,
["WikiProject_Women_in_Red"] = 66000,
["WikiProject_Women_in_Religion"] = 9200,
["WikiProject_Women_scientists"] = 28000,
["WikiProject_Women_writers"] = 85000,
["WikiProject_World_Heritage_Sites"] = 2800,
["WikiProject_World_Rally"] = 2300,
["WikiProject_Writing_systems"] = 4800,
["WikiProject_Years"] = 743000,
["WikiProject_Yemen"] = 6600,
["WikiProject_Yorkshire"] = 29000,
["WikiProject_YouTube"] = 3500,
["WikiProject_Yugoslavia"] = 7700,
["WikiProject_Zimbabwe"] = 6100,
["WikiProject_Zoo"] = 3200,
["WikiProject_banner"] = 5800,
["WikiProject_banner_shell"] = 12000000,
["WikiProject_cleanup_list"] = 84000,
["WikiProject_cleanup_listing"] = 9700,
["WikiProject_cleanup_listing/styles.css"] = 9700,
["WikiProject_description_page"] = 2900,
["WikiProject_status"] = 2700,
["WikiProjectbasename"] = 2600,
["Wiki_Loves_Pride_talk"] = 4300,
["Wikibooks"] = 2600,
["Wikibreak"] = 2600,
["Wikicite"] = 2300,
["Wikidata"] = 465000,
["WikidataCheck"] = 36000,
["Wikidata_check"] = 551000,
["Wikidata_entity_link"] = 66000,
["Wikidata_image"] = 1120000,
["Wikidata_list"] = 4300,
["Wikidata_list_end"] = 4200,
["Wikidata_location"] = 3400,
["Wikidata_property_link"] = 2600,
["Wikidata_sitelink"] = 96000,
["Wikinews"] = 3300,
["Wikipedia's_sister_projects/styles.css"] = 6900,
["Wikipedia:Version_1.0_article_stats"] = 5100,
["Wikipedia_Embassy_link"] = 4400,
["Wikipedia_ads"] = 3800,
["Wikipedia_category"] = 18000,
["Wikipedia_help_pages"] = 2200,
["Wikipedia_languages/styles.css"] = 4600,
["Wikipedia_logs"] = 9500,
["Wikipedia_other"] = 13000,
["Wikipedia_policies_and_guidelines"] = 3800,
["Wikiquote"] = 44000,
["Wikiquote-inline"] = 2900,
["Wikiquote_inline"] = 3300,
["Wikisource"] = 20000,
["Wikisource-inline"] = 6300,
["Wikisource/Author"] = 5700,
["Wikisource/inner_core"] = 20000,
["Wikisource/outer_core"] = 20000,
["Wikisource_author-inline"] = 2000,
["Wikisource_inline"] = 6600,
["Wikispecies"] = 36000,
["Wikispecies-inline"] = 12000,
["Wikispecies_inline"] = 14000,
["Wikivoyage"] = 12000,
["Wikivoyage-inline"] = 2500,
["Wikivoyage_inline"] = 5700,
["Wikt"] = 11000,
["Wikt-lang"] = 4800,
["Wiktionary"] = 82000,
["Wiktionary-inline"] = 2600,
["Wiktionary_inline"] = 3400,
["Wiktionary_redirect"] = 2100,
["Wiktionary_redirect/styles.css"] = 2200,
["Win_draw_lose"] = 8200,
["Win_draw_lose_totals"] = 6600,
["Wink"] = 4500,
["Winners"] = 5300,
["Winning_percentage"] = 43000,
["Winpct"] = 8900,
["Women's_Tennis_Association_link"] = 3900,
["Won"] = 55000,
["Word_break"] = 2300,
["Workpage"] = 4700,
["Works_year_header"] = 4900,
["Works_year_header/helper"] = 4900,
["WorldFootball.net"] = 25000,
["World_Aquatics"] = 2000,
["World_Athletics"] = 14000,
["World_Rowing"] = 2700,
["World_Series_Year"] = 6800,
["World_Tennis_profile"] = 9300,
["World_topic"] = 2100,
["Worldfootball.net"] = 6300,
["Wounded_in_action"] = 2100,
["Wrap"] = 60000,
["Wraplink"] = 3800,
["Writer_icon"] = 6300,
["Writer_icon2"] = 6300,
["WritingCredits"] = 4000,
["Wsy"] = 5900,
["Module:WDL"] = 15000,
["Module:WLink"] = 9200,
["Module:WPMILHIST_Infobox_style"] = 246000,
["Module:WPSHIPS_utilities"] = 103000,
["Module:WPSHIPS_utilities/data"] = 103000,
["Module:Wd"] = 1940000,
["Module:Wd/i18n"] = 1940000,
["Module:Weather_box"] = 32000,
["Module:Weather_box/colors"] = 32000,
["Module:Weather_box/row"] = 32000,
["Module:Webarchive"] = 695000,
["Module:Webarchive/data"] = 695000,
["Module:Wide_image"] = 11000,
["Module:Wide_image/styles.css"] = 11000,
["Module:WikiProject_banner"] = 12000000,
["Module:WikiProject_banner/auxiliary"] = 4820000,
["Module:WikiProject_banner/config"] = 12000000,
["Module:WikiProject_banner/styles.css"] = 12000000,
["Module:Wikidata"] = 213000,
["Module:WikidataCheck"] = 563000,
["Module:WikidataIB"] = 1150000,
["Module:WikidataIB/nolinks"] = 1150000,
["Module:WikidataIB/titleformats"] = 1150000,
["Module:WikidataIdentifiers"] = 2800,
["Module:Wikipedia_ads"] = 3800,
["Module:Wikipedia_ads/data"] = 4100,
["Module:Wikipedia_ads/list"] = 4100,
["Module:WikitextParser"] = 20000,
["Module:Wikitext_Parsing"] = 19000000,
["Module:Wikt-lang"] = 4800,
["Module:Wikt-lang/data"] = 4900,
["Module:Women_in_Red_event"] = 67000,
["Module:World_topic"] = 2100,
["Module:WritingCredits"] = 4000,
}
fw6zq60089ig1g9ih59oyymbew108aw
Template:Infobox settlement
10
8160
74764
72869
2026-08-23T23:49:46Z
Robertsky
10424
Robertsky moveu [[Template:Infokaixa fatin-koabitasaun]] para o seu redirecionamento [[Template:Infobox settlement]]
72869
wikitext
text/x-wiki
<includeonly>{{Infobox settlement/core
| name = {{{naran|{{{name|}}}}}}
| official_name = {{{naran_ofisial|{{{official_name|}}}}}}
| native_name = {{{naran_lokal|{{{native_name|}}}}}}
| native_name_lang = {{{lian_naran_lokal|{{{native_name_lang|}}}}}}
| other_name = {{{naran_seluk|{{{other_name|}}}}}}
| settlement_type = {{{tipu_fatin|{{{settlement_type|}}}}}}
| short_description = {{{deskrisaun_badak|{{{short_description|}}}}}}
| translit_lang1 = {{{transliterasaun_lian1|{{{translit_lang1|}}}}}}
| translit_lang1_type = {{{transliterasaun_lian1_tipu|{{{translit_lang1_type|}}}}}}
| translit_lang1_info = {{{transliterasaun_lian1_info|{{{translit_lang1_info|}}}}}}
| translit_lang1_type1 = {{{transliterasaun_lian1_tipu1|{{{translit_lang1_type1|}}}}}}
| translit_lang1_info1 = {{{transliterasaun_lian1_info1|{{{translit_lang1_info1|}}}}}}
| translit_lang1_type2 = {{{transliterasaun_lian1_tipu2|{{{translit_lang1_type2|}}}}}}
| translit_lang1_info2 = {{{transliterasaun_lian1_info2|{{{translit_lang1_info2|}}}}}}
| translit_lang1_type3 = {{{transliterasaun_lian1_tipu3|{{{translit_lang1_type3|}}}}}}
| translit_lang1_info3 = {{{transliterasaun_lian1_info3|{{{translit_lang1_info3|}}}}}}
| translit_lang1_type4 = {{{transliterasaun_lian1_tipu4|{{{translit_lang1_type4|}}}}}}
| translit_lang1_info4 = {{{transliterasaun_lian1_info4|{{{translit_lang1_info4|}}}}}}
| translit_lang1_type5 = {{{transliterasaun_lian1_tipu5|{{{translit_lang1_type5|}}}}}}
| translit_lang1_info5 = {{{transliterasaun_lian1_info5|{{{translit_lang1_info5|}}}}}}
| translit_lang1_type6 = {{{transliterasaun_lian1_tipu6|{{{translit_lang1_type6|}}}}}}
| translit_lang1_info6 = {{{transliterasaun_lian1_info6|{{{translit_lang1_info6|}}}}}}
| translit_lang2 = {{{transliterasaun_lian2|{{{translit_lang2|}}}}}}
| translit_lang2_type = {{{transliterasaun_lian2_tipu|{{{translit_lang2_type|}}}}}}
| translit_lang2_info = {{{transliterasaun_lian2_info|{{{translit_lang2_info|}}}}}}
| translit_lang2_type1 = {{{transliterasaun_lian2_tipu1|{{{translit_lang2_type1|}}}}}}
| translit_lang2_info1 = {{{transliterasaun_lian2_info1|{{{translit_lang2_info1|}}}}}}
| translit_lang2_type2 = {{{transliterasaun_lian2_tipu2|{{{translit_lang2_type2|}}}}}}
| translit_lang2_info2 = {{{transliterasaun_lian2_info2|{{{translit_lang2_info2|}}}}}}
| translit_lang2_type3 = {{{transliterasaun_lian2_tipu3|{{{translit_lang2_type3|}}}}}}
| translit_lang2_info3 = {{{transliterasaun_lian2_info3|{{{translit_lang2_info3|}}}}}}
| translit_lang2_type4 = {{{transliterasaun_lian2_tipu4|{{{translit_lang2_type4|}}}}}}
| translit_lang2_info4 = {{{transliterasaun_lian2_info4|{{{translit_lang2_info4|}}}}}}
| translit_lang2_type5 = {{{transliterasaun_lian2_tipu5|{{{translit_lang2_type5|}}}}}}
| translit_lang2_info5 = {{{transliterasaun_lian2_info5|{{{translit_lang2_info5|}}}}}}
| translit_lang2_type6 = {{{transliterasaun_lian2_tipu6|{{{translit_lang2_type6|}}}}}}
| translit_lang2_info6 = {{{transliterasaun_lian2_info6|{{{translit_lang2_info6|}}}}}}
| image_skyline = {{{imajen_paisajen|{{{image_skyline|}}}}}}
| imagesize = {{{tamanu_imajen|{{{imagesize|}}}}}}
| image_alt = {{{alt_imajen|{{{image_alt|}}}}}}
| image_caption = {{{legenda_imajen|{{{image_caption|}}}}}}
| image_flag = {{{imajen_bandeira|{{{image_flag|}}}}}}
| flag_size = {{{tamanu_bandeira|{{{flag_size|}}}}}}
| flag_alt = {{{alt_bandeira|{{{flag_alt|}}}}}}
| flag_border = {{{borda_bandeira|{{{flag_border|}}}}}}
| flag_link = {{{ligasaun_bandeira|{{{flag_link|}}}}}}
| image_seal = {{{imajen_selu|{{{image_seal|}}}}}}
| seal_size = {{{tamanu_selu|{{{seal_size|}}}}}}
| seal_alt = {{{alt_selu|{{{seal_alt|}}}}}}
| seal_link = {{{ligasaun_selu|{{{seal_link|}}}}}}
| seal_type = {{{tipu_selu|{{{seal_type|}}}}}}
| seal_class = {{{klase_selu|{{{seal_class|}}}}}}
| image_shield = {{{imajen_brasau|{{{image_shield|}}}}}}
| shield_size = {{{tamanu_brasau|{{{shield_size|}}}}}}
| shield_alt = {{{alt_brasau|{{{shield_alt|}}}}}}
| shield_link = {{{ligasaun_brasau|{{{shield_link|}}}}}}
| image_blank_emblem = {{{imajen_emblema|{{{image_blank_emblem|}}}}}}
| blank_emblem_type = {{{tipu_emblema|{{{blank_emblem_type|}}}}}}
| blank_emblem_size = {{{tamanu_emblema|{{{blank_emblem_size|}}}}}}
| blank_emblem_alt = {{{alt_emblema|{{{blank_emblem_alt|}}}}}}
| blank_emblem_link = {{{ligasaun_emblema|{{{blank_emblem_link|}}}}}}
| etymology = {{{etimolojia|{{{etymology|}}}}}}
| nickname = {{{naran_popular|{{{nickname|}}}}}}
| nicknames = {{{naran_popular_sira|{{{nicknames|}}}}}}
| motto = {{{lema|{{{motto|}}}}}}
| mottoes = {{{lema_sira|{{{mottoes|}}}}}}
| anthem = {{{hino|{{{anthem|}}}}}}
| image_map = {{{imajen_mapa|{{{image_map|}}}}}}
| mapsize = {{{tamanu_mapa|{{{mapsize|}}}}}}
| map_alt = {{{alt_mapa|{{{map_alt|}}}}}}
| map_caption = {{{legenda_mapa|{{{map_caption|}}}}}}
| image_map1 = {{{imajen_mapa1|{{{image_map1|}}}}}}
| mapsize1 = {{{tamanu_mapa1|{{{mapsize1|}}}}}}
| map_alt1 = {{{alt_mapa1|{{{map_alt1|}}}}}}
| map_caption1 = {{{legenda_mapa1|{{{map_caption1|}}}}}}
| pushpin_map = {{{mapa_lokalizasaun|{{{pushpin_map|}}}}}}
| pushpin_mapsize = {{{tamanu_mapa_lokalizasaun|{{{pushpin_mapsize|}}}}}}
| pushpin_map_alt = {{{alt_mapa_lokalizasaun|{{{pushpin_map_alt|}}}}}}
| pushpin_map_caption = {{{legenda_mapa_lokalizasaun|{{{pushpin_map_caption|}}}}}}
| pushpin_map_caption_notsmall = {{{legenda_mapa_lokalizasaun_la_kiik|{{{pushpin_map_caption_notsmall|}}}}}}
| pushpin_label = {{{label_mapa_lokalizasaun|{{{pushpin_label|}}}}}}
| pushpin_label_position = {{{pozisaun_label_mapa_lokalizasaun|{{{pushpin_label_position|}}}}}}
| pushpin_outside = {{{liur_mapa_lokalizasaun|{{{pushpin_outside|}}}}}}
| pushpin_relief = {{{relefu_mapa_lokalizasaun|{{{pushpin_relief|}}}}}}
| pushpin_image = {{{imajen_mapa_lokalizasaun|{{{pushpin_image|}}}}}}
| pushpin_overlay = {{{kamada_mapa_lokalizasaun|{{{pushpin_overlay|}}}}}}
| mapframe = {{{mapa_interativu|{{{mapframe|}}}}}}
| coordinates = {{{koordenadas|{{{coordinates|}}}}}}
| coord = {{{koord|{{{coord|}}}}}}
| coor_pinpoint = {{{pontu_koordenadas|{{{coor_pinpoint|}}}}}}
| coordinates_footnotes = {{{nota_koordenadas|{{{coordinates_footnotes|}}}}}}
| grid_name = {{{naran_grid|{{{grid_name|}}}}}}
| grid_position = {{{pozisaun_grid|{{{grid_position|}}}}}}
| mapframe-coordinates = {{{mapframe_koordenadas|{{{mapframe-coordinates|}}}}}}
| mapframe-coord = {{{mapframe_koord|{{{mapframe-coord|}}}}}}
| mapframe-caption = {{{mapframe_legenda|{{{mapframe-caption|}}}}}}
| mapframe-custom = {{{mapframe_custom|{{{mapframe-custom|}}}}}}
| mapframe-id = {{{mapframe_id|{{{mapframe-id|}}}}}}
| id = {{{id|{{{id|}}}}}}
| qid = {{{qid|{{{qid|}}}}}}
| mapframe-wikidata = {{{mapframe_wikidata|{{{mapframe-wikidata|}}}}}}
| mapframe-point = {{{mapframe_pontu|{{{mapframe-point|}}}}}}
| mapframe-shape = {{{mapframe_forma|{{{mapframe-shape|}}}}}}
| mapframe-line = {{{mapframe_lina|{{{mapframe-line|}}}}}}
| mapframe-geomask = {{{mapframe_geomask|{{{mapframe-geomask|}}}}}}
| mapframe-switcher = {{{mapframe_switcher|{{{mapframe-switcher|}}}}}}
| mapframe-frame-width = {{{mapframe_luan_frame|{{{mapframe-frame-width|}}}}}}
| mapframe-width = {{{mapframe_luan|{{{mapframe-width|}}}}}}
| mapframe-frame-height = {{{mapframe_aas_frame|{{{mapframe-frame-height|}}}}}}
| mapframe-height = {{{mapframe_aas|{{{mapframe-height|}}}}}}
| mapframe-shape-fill = {{{mapframe_kor_forma|{{{mapframe-shape-fill|}}}}}}
| mapframe-shape-fill-opacity = {{{mapframe_opasidade_kor_forma|{{{mapframe-shape-fill-opacity|}}}}}}
| mapframe-stroke-color = {{{mapframe_kor_lina|{{{mapframe-stroke-color|}}}}}}
| mapframe-stroke-colour = {{{mapframe_kor_lina_uk|{{{mapframe-stroke-colour|}}}}}}
| mapframe-line-stroke-color = {{{mapframe_kor_lina_line|{{{mapframe-line-stroke-color|}}}}}}
| mapframe-line-stroke-colour = {{{mapframe_kor_lina_line_uk|{{{mapframe-line-stroke-colour|}}}}}}
| mapframe-shape-stroke-color = {{{mapframe_kor_borda_forma|{{{mapframe-shape-stroke-color|}}}}}}
| mapframe-shape-stroke-colour = {{{mapframe_kor_borda_forma_uk|{{{mapframe-shape-stroke-colour|}}}}}}
| mapframe-stroke-width = {{{mapframe_luan_lina|{{{mapframe-stroke-width|}}}}}}
| mapframe-shape-stroke-width = {{{mapframe_luan_borda_forma|{{{mapframe-shape-stroke-width|}}}}}}
| mapframe-line-stroke-width = {{{mapframe_luan_lina_line|{{{mapframe-line-stroke-width|}}}}}}
| mapframe-marker = {{{mapframe_marker|{{{mapframe-marker|}}}}}}
| mapframe-marker-color = {{{mapframe_kor_marker|{{{mapframe-marker-color|}}}}}}
| mapframe-marker-colour = {{{mapframe_kor_marker_uk|{{{mapframe-marker-colour|}}}}}}
| mapframe-geomask-stroke-color = {{{mapframe_kor_borda_geomask|{{{mapframe-geomask-stroke-color|}}}}}}
| mapframe-geomask-stroke-colour = {{{mapframe_kor_borda_geomask_uk|{{{mapframe-geomask-stroke-colour|}}}}}}
| mapframe-geomask-stroke-width = {{{mapframe_luan_borda_geomask|{{{mapframe-geomask-stroke-width|}}}}}}
| mapframe-geomask-fill = {{{mapframe_kor_geomask|{{{mapframe-geomask-fill|}}}}}}
| mapframe-geomask-fill-opacity = {{{mapframe_opasidade_kor_geomask|{{{mapframe-geomask-fill-opacity|}}}}}}
| mapframe-zoom = {{{mapframe_zoom|{{{mapframe-zoom|}}}}}}
| mapframe-length_km = {{{mapframe_naruk_km|{{{mapframe-length_km|}}}}}}
| mapframe-length_mi = {{{mapframe_naruk_mi|{{{mapframe-length_mi|}}}}}}
| mapframe-area_km2 = {{{mapframe_area_km2|{{{mapframe-area_km2|}}}}}}
| mapframe-area_mi2 = {{{mapframe_area_mi2|{{{mapframe-area_mi2|}}}}}}
| mapframe-frame-coordinates = {{{mapframe_frame_koordenadas|{{{mapframe-frame-coordinates|}}}}}}
| mapframe-frame-coord = {{{mapframe_frame_koord|{{{mapframe-frame-coord|}}}}}}
| mapframe-type = {{{mapframe_tipu|{{{mapframe-type|}}}}}}
| mapframe-population = {{{mapframe_populasaun|{{{mapframe-population|}}}}}}
| subdivision_type = {{{tipu_subdivizaun|{{{subdivision_type|}}}}}}
| subdivision_name = {{{naran_subdivizaun|{{{subdivision_name|}}}}}}
| subdivision_type1 = {{{tipu_subdivizaun1|{{{subdivision_type1|}}}}}}
| subdivision_name1 = {{{naran_subdivizaun1|{{{subdivision_name1|}}}}}}
| subdivision_type2 = {{{tipu_subdivizaun2|{{{subdivision_type2|}}}}}}
| subdivision_name2 = {{{naran_subdivizaun2|{{{subdivision_name2|}}}}}}
| subdivision_type3 = {{{tipu_subdivizaun3|{{{subdivision_type3|}}}}}}
| subdivision_name3 = {{{naran_subdivizaun3|{{{subdivision_name3|}}}}}}
| subdivision_type4 = {{{tipu_subdivizaun4|{{{subdivision_type4|}}}}}}
| subdivision_name4 = {{{naran_subdivizaun4|{{{subdivision_name4|}}}}}}
| subdivision_type5 = {{{tipu_subdivizaun5|{{{subdivision_type5|}}}}}}
| subdivision_name5 = {{{naran_subdivizaun5|{{{subdivision_name5|}}}}}}
| subdivision_type6 = {{{tipu_subdivizaun6|{{{subdivision_type6|}}}}}}
| subdivision_name6 = {{{naran_subdivizaun6|{{{subdivision_name6|}}}}}}
| established_title = {{{titulu_estabelesimentu|{{{established_title|}}}}}}
| established_date = {{{data_estabelesimentu|{{{established_date|}}}}}}
| established_title1 = {{{titulu_estabelesimentu1|{{{established_title1|}}}}}}
| established_date1 = {{{data_estabelesimentu1|{{{established_date1|}}}}}}
| established_title2 = {{{titulu_estabelesimentu2|{{{established_title2|}}}}}}
| established_date2 = {{{data_estabelesimentu2|{{{established_date2|}}}}}}
| established_title3 = {{{titulu_estabelesimentu3|{{{established_title3|}}}}}}
| established_date3 = {{{data_estabelesimentu3|{{{established_date3|}}}}}}
| established_title4 = {{{titulu_estabelesimentu4|{{{established_title4|}}}}}}
| established_date4 = {{{data_estabelesimentu4|{{{established_date4|}}}}}}
| established_title5 = {{{titulu_estabelesimentu5|{{{established_title5|}}}}}}
| established_date5 = {{{data_estabelesimentu5|{{{established_date5|}}}}}}
| established_title6 = {{{titulu_estabelesimentu6|{{{established_title6|}}}}}}
| established_date6 = {{{data_estabelesimentu6|{{{established_date6|}}}}}}
| established_title7 = {{{titulu_estabelesimentu7|{{{established_title7|}}}}}}
| established_date7 = {{{data_estabelesimentu7|{{{established_date7|}}}}}}
| extinct_title = {{{titulu_extinta|{{{extinct_title|}}}}}}
| extinct_date = {{{data_extinta|{{{extinct_date|}}}}}}
| founder = {{{fundador|{{{founder|}}}}}}
| named_for = {{{naran_husi|{{{named_for|}}}}}}
| seat_type = {{{tipu_sede|{{{seat_type|}}}}}}
| seat = {{{sede|{{{seat|}}}}}}
| seat1_type = {{{tipu_sede1|{{{seat1_type|}}}}}}
| seat1 = {{{sede1|{{{seat1|}}}}}}
| parts_type = {{{tipu_parte|{{{parts_type|}}}}}}
| parts_style = {{{estilu_parte|{{{parts_style|}}}}}}
| parts = {{{parte_sira|{{{parts|}}}}}}
| p1 = {{{parte1|{{{p1|}}}}}}
| p2 = {{{parte2|{{{p2|}}}}}}
| p3 = {{{parte3|{{{p3|}}}}}}
| p4 = {{{parte4|{{{p4|}}}}}}
| p5 = {{{parte5|{{{p5|}}}}}}
| p6 = {{{parte6|{{{p6|}}}}}}
| p7 = {{{parte7|{{{p7|}}}}}}
| p8 = {{{parte8|{{{p8|}}}}}}
| p9 = {{{parte9|{{{p9|}}}}}}
| p10 = {{{parte10|{{{p10|}}}}}}
| p11 = {{{parte11|{{{p11|}}}}}}
| p12 = {{{parte12|{{{p12|}}}}}}
| p13 = {{{parte13|{{{p13|}}}}}}
| p14 = {{{parte14|{{{p14|}}}}}}
| p15 = {{{parte15|{{{p15|}}}}}}
| p16 = {{{parte16|{{{p16|}}}}}}
| p17 = {{{parte17|{{{p17|}}}}}}
| p18 = {{{parte18|{{{p18|}}}}}}
| p19 = {{{parte19|{{{p19|}}}}}}
| p20 = {{{parte20|{{{p20|}}}}}}
| p21 = {{{parte21|{{{p21|}}}}}}
| p22 = {{{parte22|{{{p22|}}}}}}
| p23 = {{{parte23|{{{p23|}}}}}}
| p24 = {{{parte24|{{{p24|}}}}}}
| p25 = {{{parte25|{{{p25|}}}}}}
| p26 = {{{parte26|{{{p26|}}}}}}
| p27 = {{{parte27|{{{p27|}}}}}}
| p28 = {{{parte28|{{{p28|}}}}}}
| p29 = {{{parte29|{{{p29|}}}}}}
| p30 = {{{parte30|{{{p30|}}}}}}
| p31 = {{{parte31|{{{p31|}}}}}}
| p32 = {{{parte32|{{{p32|}}}}}}
| p33 = {{{parte33|{{{p33|}}}}}}
| p34 = {{{parte34|{{{p34|}}}}}}
| p35 = {{{parte35|{{{p35|}}}}}}
| p36 = {{{parte36|{{{p36|}}}}}}
| p37 = {{{parte37|{{{p37|}}}}}}
| p38 = {{{parte38|{{{p38|}}}}}}
| p39 = {{{parte39|{{{p39|}}}}}}
| p40 = {{{parte40|{{{p40|}}}}}}
| p41 = {{{parte41|{{{p41|}}}}}}
| p42 = {{{parte42|{{{p42|}}}}}}
| p43 = {{{parte43|{{{p43|}}}}}}
| p44 = {{{parte44|{{{p44|}}}}}}
| p45 = {{{parte45|{{{p45|}}}}}}
| p46 = {{{parte46|{{{p46|}}}}}}
| p47 = {{{parte47|{{{p47|}}}}}}
| p48 = {{{parte48|{{{p48|}}}}}}
| p49 = {{{parte49|{{{p49|}}}}}}
| p50 = {{{parte50|{{{p50|}}}}}}
| government_footnotes = {{{nota_governu|{{{government_footnotes|}}}}}}
| government_type = {{{tipu_governu|{{{government_type|}}}}}}
| governing_body = {{{orgaun_governu|{{{governing_body|}}}}}}
| leader_party = {{{partidu_lider|{{{leader_party|}}}}}}
| leader_title = {{{titulu_lider|{{{leader_title|}}}}}}
| leader_name = {{{naran_lider|{{{leader_name|}}}}}}
| leader_title1 = {{{titulu_lider1|{{{leader_title1|}}}}}}
| leader_name1 = {{{naran_lider1|{{{leader_name1|}}}}}}
| leader_party1 = {{{partidu_lider1|{{{leader_party1|}}}}}}
| leader_title2 = {{{titulu_lider2|{{{leader_title2|}}}}}}
| leader_name2 = {{{naran_lider2|{{{leader_name2|}}}}}}
| leader_party2 = {{{partidu_lider2|{{{leader_party2|}}}}}}
| leader_title3 = {{{titulu_lider3|{{{leader_title3|}}}}}}
| leader_name3 = {{{naran_lider3|{{{leader_name3|}}}}}}
| leader_party3 = {{{partidu_lider3|{{{leader_party3|}}}}}}
| leader_title4 = {{{titulu_lider4|{{{leader_title4|}}}}}}
| leader_name4 = {{{naran_lider4|{{{leader_name4|}}}}}}
| leader_party4 = {{{partidu_lider4|{{{leader_party4|}}}}}}
| total_type = {{{tipu_total|{{{total_type|}}}}}}
| unit_pref = {{{unidade_preferida|{{{unit_pref|}}}}}}
| area_footnotes = {{{nota_area|{{{area_footnotes|}}}}}}
| dunam_link = {{{ligasaun_dunam|{{{dunam_link|}}}}}}
| area_total_km2 = {{{area_total_km2|{{{area_total_km2|}}}}}}
| area_total_sq_mi = {{{area_total_sq_mi|{{{area_total_sq_mi|}}}}}}
| area_total_ha = {{{area_total_ha|{{{area_total_ha|}}}}}}
| area_total_acre = {{{area_total_acre|{{{area_total_acre|}}}}}}
| area_total_dunam = {{{area_total_dunam|{{{area_total_dunam|}}}}}}
| area_land_km2 = {{{area_rai_km2|{{{area_land_km2|}}}}}}
| area_land_sq_mi = {{{area_rai_sq_mi|{{{area_land_sq_mi|}}}}}}
| area_land_ha = {{{area_rai_ha|{{{area_land_ha|}}}}}}
| area_land_acre = {{{area_rai_acre|{{{area_land_acre|}}}}}}
| area_land_dunam = {{{area_rai_dunam|{{{area_land_dunam|}}}}}}
| area_water_km2 = {{{area_bee_km2|{{{area_water_km2|}}}}}}
| area_water_sq_mi = {{{area_bee_sq_mi|{{{area_water_sq_mi|}}}}}}
| area_water_ha = {{{area_bee_ha|{{{area_water_ha|}}}}}}
| area_water_acre = {{{area_bee_acre|{{{area_water_acre|}}}}}}
| area_water_dunam = {{{area_bee_dunam|{{{area_water_dunam|}}}}}}
| area_urban_km2 = {{{area_urbana_km2|{{{area_urban_km2|}}}}}}
| area_urban_sq_mi = {{{area_urbana_sq_mi|{{{area_urban_sq_mi|}}}}}}
| area_urban_ha = {{{area_urbana_ha|{{{area_urban_ha|}}}}}}
| area_urban_acre = {{{area_urbana_acre|{{{area_urban_acre|}}}}}}
| area_urban_dunam = {{{area_urbana_dunam|{{{area_urban_dunam|}}}}}}
| area_rural_km2 = {{{area_rural_km2|{{{area_rural_km2|}}}}}}
| area_rural_sq_mi = {{{area_rural_sq_mi|{{{area_rural_sq_mi|}}}}}}
| area_rural_ha = {{{area_rural_ha|{{{area_rural_ha|}}}}}}
| area_rural_acre = {{{area_rural_acre|{{{area_rural_acre|}}}}}}
| area_rural_dunam = {{{area_rural_dunam|{{{area_rural_dunam|}}}}}}
| area_metro_km2 = {{{area_metropolitana_km2|{{{area_metro_km2|}}}}}}
| area_metro_sq_mi = {{{area_metropolitana_sq_mi|{{{area_metro_sq_mi|}}}}}}
| area_metro_ha = {{{area_metropolitana_ha|{{{area_metro_ha|}}}}}}
| area_metro_acre = {{{area_metropolitana_acre|{{{area_metro_acre|}}}}}}
| area_metro_dunam = {{{area_metropolitana_dunam|{{{area_metro_dunam|}}}}}}
| area_water_percent = {{{persentajen_bee|{{{area_water_percent|}}}}}}
| area_urban_footnotes = {{{nota_area_urbana|{{{area_urban_footnotes|}}}}}}
| area_rural_footnotes = {{{nota_area_rural|{{{area_rural_footnotes|}}}}}}
| area_metro_footnotes = {{{nota_area_metropolitana|{{{area_metro_footnotes|}}}}}}
| area_rank = {{{rank_area|{{{area_rank|}}}}}}
| area_note = {{{nota_area|{{{area_note|}}}}}}
| area_blank1_title = {{{titulu_area_seluk1|{{{area_blank1_title|}}}}}}
| area_blank1_km2 = {{{area_seluk1_km2|{{{area_blank1_km2|}}}}}}
| area_blank1_sq_mi = {{{area_seluk1_sq_mi|{{{area_blank1_sq_mi|}}}}}}
| area_blank1_ha = {{{area_seluk1_ha|{{{area_blank1_ha|}}}}}}
| area_blank1_acre = {{{area_seluk1_acre|{{{area_blank1_acre|}}}}}}
| area_blank1_dunam = {{{area_seluk1_dunam|{{{area_blank1_dunam|}}}}}}
| area_blank2_title = {{{titulu_area_seluk2|{{{area_blank2_title|}}}}}}
| area_blank2_km2 = {{{area_seluk2_km2|{{{area_blank2_km2|}}}}}}
| area_blank2_sq_mi = {{{area_seluk2_sq_mi|{{{area_blank2_sq_mi|}}}}}}
| area_blank2_ha = {{{area_seluk2_ha|{{{area_blank2_ha|}}}}}}
| area_blank2_acre = {{{area_seluk2_acre|{{{area_blank2_acre|}}}}}}
| area_blank2_dunam = {{{area_seluk2_dunam|{{{area_blank2_dunam|}}}}}}
| dimensions_footnotes = {{{nota_dimensaun|{{{dimensions_footnotes|}}}}}}
| length_km = {{{naruk_km|{{{length_km|}}}}}}
| length_mi = {{{naruk_mi|{{{length_mi|}}}}}}
| width_km = {{{luan_km|{{{width_km|}}}}}}
| width_mi = {{{luan_mi|{{{width_mi|}}}}}}
| elevation_footnotes = {{{nota_altitude|{{{elevation_footnotes|}}}}}}
| elevation_m = {{{altitude_m|{{{elevation_m|}}}}}}
| elevation_ft = {{{altitude_ft|{{{elevation_ft|}}}}}}
| elevation_point = {{{pontu_altitude|{{{elevation_point|}}}}}}
| elevation_max_footnotes = {{{nota_altitude_max|{{{elevation_max_footnotes|}}}}}}
| elevation_max_m = {{{altitude_max_m|{{{elevation_max_m|}}}}}}
| elevation_max_ft = {{{altitude_max_ft|{{{elevation_max_ft|}}}}}}
| elevation_max_point = {{{pontu_altitude_max|{{{elevation_max_point|}}}}}}
| elevation_max_rank = {{{rank_altitude_max|{{{elevation_max_rank|}}}}}}
| elevation_min_footnotes = {{{nota_altitude_min|{{{elevation_min_footnotes|}}}}}}
| elevation_min_m = {{{altitude_min_m|{{{elevation_min_m|}}}}}}
| elevation_min_ft = {{{altitude_min_ft|{{{elevation_min_ft|}}}}}}
| elevation_min_point = {{{pontu_altitude_min|{{{elevation_min_point|}}}}}}
| elevation_min_rank = {{{rank_altitude_min|{{{elevation_min_rank|}}}}}}
| population_footnotes = {{{nota_populasaun|{{{population_footnotes|}}}}}}
| population_as_of = {{{data_populasaun|{{{population_as_of|}}}}}}
| population_total = {{{populasaun_total|{{{population_total|}}}}}}
| pop_est_footnotes = {{{nota_estimasaun_populasaun|{{{pop_est_footnotes|}}}}}}
| pop_est_as_of = {{{data_estimasaun_populasaun|{{{pop_est_as_of|}}}}}}
| population_est = {{{estimasaun_populasaun|{{{population_est|}}}}}}
| population_rank = {{{rank_populasaun|{{{population_rank|}}}}}}
| population_density_km2 = {{{densidade_populasaun_km2|{{{population_density_km2|}}}}}}
| population_density_sq_mi = {{{densidade_populasaun_sq_mi|{{{population_density_sq_mi|}}}}}}
| population_urban_footnotes = {{{nota_populasaun_urbana|{{{population_urban_footnotes|}}}}}}
| population_urban = {{{populasaun_urbana|{{{population_urban|}}}}}}
| population_density_urban_km2 = {{{densidade_populasaun_urbana_km2|{{{population_density_urban_km2|}}}}}}
| population_density_urban_sq_mi = {{{densidade_populasaun_urbana_sq_mi|{{{population_density_urban_sq_mi|}}}}}}
| population_rural_footnotes = {{{nota_populasaun_rural|{{{population_rural_footnotes|}}}}}}
| population_rural = {{{populasaun_rural|{{{population_rural|}}}}}}
| population_density_rural_km2 = {{{densidade_populasaun_rural_km2|{{{population_density_rural_km2|}}}}}}
| population_density_rural_sq_mi = {{{densidade_populasaun_rural_sq_mi|{{{population_density_rural_sq_mi|}}}}}}
| population_metro_footnotes = {{{nota_populasaun_metropolitana|{{{population_metro_footnotes|}}}}}}
| population_metro = {{{populasaun_metropolitana|{{{population_metro|}}}}}}
| population_density_metro_km2 = {{{densidade_populasaun_metropolitana_km2|{{{population_density_metro_km2|}}}}}}
| population_density_metro_sq_mi = {{{densidade_populasaun_metropolitana_sq_mi|{{{population_density_metro_sq_mi|}}}}}}
| population_density_rank = {{{rank_densidade_populasaun|{{{population_density_rank|}}}}}}
| population_blank1_title = {{{titulu_populasaun_seluk1|{{{population_blank1_title|}}}}}}
| population_blank1 = {{{populasaun_seluk1|{{{population_blank1|}}}}}}
| population_density_blank1_km2 = {{{densidade_populasaun_seluk1_km2|{{{population_density_blank1_km2|}}}}}}
| population_density_blank1_sq_mi = {{{densidade_populasaun_seluk1_sq_mi|{{{population_density_blank1_sq_mi|}}}}}}
| population_blank2_title = {{{titulu_populasaun_seluk2|{{{population_blank2_title|}}}}}}
| population_blank2 = {{{populasaun_seluk2|{{{population_blank2|}}}}}}
| population_density_blank2_km2 = {{{densidade_populasaun_seluk2_km2|{{{population_density_blank2_km2|}}}}}}
| population_density_blank2_sq_mi = {{{densidade_populasaun_seluk2_sq_mi|{{{population_density_blank2_sq_mi|}}}}}}
| population_demonym = {{{demonimu_populasaun|{{{population_demonym|}}}}}}
| population_demonyms = {{{demonimu_populasaun_sira|{{{population_demonyms|}}}}}}
| population_note = {{{nota_populasaun|{{{population_note|}}}}}}
| demographics_type1 = {{{tipu_demografia1|{{{demographics_type1|}}}}}}
| demographics1_footnotes = {{{nota_demografia1|{{{demographics1_footnotes|}}}}}}
| demographics1_title1 = {{{titulu_demografia1_1|{{{demographics1_title1|}}}}}}
| demographics1_info1 = {{{info_demografia1_1|{{{demographics1_info1|}}}}}}
| demographics1_title2 = {{{titulu_demografia1_2|{{{demographics1_title2|}}}}}}
| demographics1_info2 = {{{info_demografia1_2|{{{demographics1_info2|}}}}}}
| demographics1_title3 = {{{titulu_demografia1_3|{{{demographics1_title3|}}}}}}
| demographics1_info3 = {{{info_demografia1_3|{{{demographics1_info3|}}}}}}
| demographics1_title4 = {{{titulu_demografia1_4|{{{demographics1_title4|}}}}}}
| demographics1_info4 = {{{info_demografia1_4|{{{demographics1_info4|}}}}}}
| demographics1_title5 = {{{titulu_demografia1_5|{{{demographics1_title5|}}}}}}
| demographics1_info5 = {{{info_demografia1_5|{{{demographics1_info5|}}}}}}
| demographics1_title6 = {{{titulu_demografia1_6|{{{demographics1_title6|}}}}}}
| demographics1_info6 = {{{info_demografia1_6|{{{demographics1_info6|}}}}}}
| demographics1_title7 = {{{titulu_demografia1_7|{{{demographics1_title7|}}}}}}
| demographics1_info7 = {{{info_demografia1_7|{{{demographics1_info7|}}}}}}
| demographics_type2 = {{{tipu_demografia2|{{{demographics_type2|}}}}}}
| demographics2_footnotes = {{{nota_demografia2|{{{demographics2_footnotes|}}}}}}
| demographics2_title1 = {{{titulu_demografia2_1|{{{demographics2_title1|}}}}}}
| demographics2_info1 = {{{info_demografia2_1|{{{demographics2_info1|}}}}}}
| demographics2_title2 = {{{titulu_demografia2_2|{{{demographics2_title2|}}}}}}
| demographics2_info2 = {{{info_demografia2_2|{{{demographics2_info2|}}}}}}
| demographics2_title3 = {{{titulu_demografia2_3|{{{demographics2_title3|}}}}}}
| demographics2_info3 = {{{info_demografia2_3|{{{demographics2_info3|}}}}}}
| demographics2_title4 = {{{titulu_demografia2_4|{{{demographics2_title4|}}}}}}
| demographics2_info4 = {{{info_demografia2_4|{{{demographics2_info4|}}}}}}
| demographics2_title5 = {{{titulu_demografia2_5|{{{demographics2_title5|}}}}}}
| demographics2_info5 = {{{info_demografia2_5|{{{demographics2_info5|}}}}}}
| demographics2_title6 = {{{titulu_demografia2_6|{{{demographics2_title6|}}}}}}
| demographics2_info6 = {{{info_demografia2_6|{{{demographics2_info6|}}}}}}
| demographics2_title7 = {{{titulu_demografia2_7|{{{demographics2_title7|}}}}}}
| demographics2_info7 = {{{info_demografia2_7|{{{demographics2_info7|}}}}}}
| demographics2_title8 = {{{titulu_demografia2_8|{{{demographics2_title8|}}}}}}
| demographics2_info8 = {{{info_demografia2_8|{{{demographics2_info8|}}}}}}
| demographics2_title9 = {{{titulu_demografia2_9|{{{demographics2_title9|}}}}}}
| demographics2_info9 = {{{info_demografia2_9|{{{demographics2_info9|}}}}}}
| demographics2_title10 = {{{titulu_demografia2_10|{{{demographics2_title10|}}}}}}
| demographics2_info10 = {{{info_demografia2_10|{{{demographics2_info10|}}}}}}
| timezone_link = {{{ligasaun_zona_tempu|{{{timezone_link|}}}}}}
| timezone = {{{zona_tempu|{{{timezone|}}}}}}
| utc_offset = {{{diferensa_utc|{{{utc_offset|}}}}}}
| timezone_DST = {{{zona_tempu_DST|{{{timezone_DST|}}}}}}
| utc_offset_DST = {{{diferensa_utc_DST|{{{utc_offset_DST|}}}}}}
| timezone1_location = {{{fatin_zona_tempu1|{{{timezone1_location|}}}}}}
| timezone1 = {{{zona_tempu1|{{{timezone1|}}}}}}
| utc_offset1 = {{{diferensa_utc1|{{{utc_offset1|}}}}}}
| timezone1_DST = {{{zona_tempu1_DST|{{{timezone1_DST|}}}}}}
| utc_offset1_DST = {{{diferensa_utc1_DST|{{{utc_offset1_DST|}}}}}}
| timezone2_location = {{{fatin_zona_tempu2|{{{timezone2_location|}}}}}}
| timezone2 = {{{zona_tempu2|{{{timezone2|}}}}}}
| utc_offset2 = {{{diferensa_utc2|{{{utc_offset2|}}}}}}
| timezone2_DST = {{{zona_tempu2_DST|{{{timezone2_DST|}}}}}}
| utc_offset2_DST = {{{diferensa_utc2_DST|{{{utc_offset2_DST|}}}}}}
| timezone3_location = {{{fatin_zona_tempu3|{{{timezone3_location|}}}}}}
| timezone3 = {{{zona_tempu3|{{{timezone3|}}}}}}
| utc_offset3 = {{{diferensa_utc3|{{{utc_offset3|}}}}}}
| timezone3_DST = {{{zona_tempu3_DST|{{{timezone3_DST|}}}}}}
| utc_offset3_DST = {{{diferensa_utc3_DST|{{{utc_offset3_DST|}}}}}}
| timezone4_location = {{{fatin_zona_tempu4|{{{timezone4_location|}}}}}}
| timezone4 = {{{zona_tempu4|{{{timezone4|}}}}}}
| utc_offset4 = {{{diferensa_utc4|{{{utc_offset4|}}}}}}
| timezone4_DST = {{{zona_tempu4_DST|{{{timezone4_DST|}}}}}}
| utc_offset4_DST = {{{diferensa_utc4_DST|{{{utc_offset4_DST|}}}}}}
| timezone5_location = {{{fatin_zona_tempu5|{{{timezone5_location|}}}}}}
| timezone5 = {{{zona_tempu5|{{{timezone5|}}}}}}
| utc_offset5 = {{{diferensa_utc5|{{{utc_offset5|}}}}}}
| timezone5_DST = {{{zona_tempu5_DST|{{{timezone5_DST|}}}}}}
| utc_offset5_DST = {{{diferensa_utc5_DST|{{{utc_offset5_DST|}}}}}}
| postal_code_type = {{{tipu_kodigu_postal|{{{postal_code_type|}}}}}}
| postal_code = {{{kodigu_postal|{{{postal_code|}}}}}}
| postal2_code_type = {{{tipu_kodigu_postal2|{{{postal2_code_type|}}}}}}
| postal2_code = {{{kodigu_postal2|{{{postal2_code|}}}}}}
| area_code_type = {{{tipu_kodigu_area|{{{area_code_type|}}}}}}
| area_code = {{{kodigu_area|{{{area_code|}}}}}}
| area_codes = {{{kodigu_area_sira|{{{area_codes|}}}}}}
| geocode = {{{geokodigu|{{{geocode|}}}}}}
| iso_code = {{{kodigu_iso|{{{iso_code|}}}}}}
| registration_plate_type = {{{tipu_plaka_veiklu|{{{registration_plate_type|}}}}}}
| registration_plate = {{{plaka_veiklu|{{{registration_plate|}}}}}}
| code1_name = {{{naran_kodigu1|{{{code1_name|}}}}}}
| code1_info = {{{info_kodigu1|{{{code1_info|}}}}}}
| code2_name = {{{naran_kodigu2|{{{code2_name|}}}}}}
| code2_info = {{{info_kodigu2|{{{code2_info|}}}}}}
| blank_name = {{{naran_kampu|{{{blank_name|}}}}}}
| blank_info = {{{info_kampu|{{{blank_info|}}}}}}
| blank1_name = {{{naran_kampu1|{{{blank1_name|}}}}}}
| blank1_info = {{{info_kampu1|{{{blank1_info|}}}}}}
| blank2_name = {{{naran_kampu2|{{{blank2_name|}}}}}}
| blank2_info = {{{info_kampu2|{{{blank2_info|}}}}}}
| blank_name_sec1 = {{{naran_kampu_sec1|{{{blank_name_sec1|}}}}}}
| blank_info_sec1 = {{{info_kampu_sec1|{{{blank_info_sec1|}}}}}}
| blank1_name_sec1 = {{{naran_kampu1_sec1|{{{blank1_name_sec1|}}}}}}
| blank1_info_sec1 = {{{info_kampu1_sec1|{{{blank1_info_sec1|}}}}}}
| blank2_name_sec1 = {{{naran_kampu2_sec1|{{{blank2_name_sec1|}}}}}}
| blank2_info_sec1 = {{{info_kampu2_sec1|{{{blank2_info_sec1|}}}}}}
| blank3_name_sec1 = {{{naran_kampu3_sec1|{{{blank3_name_sec1|}}}}}}
| blank3_info_sec1 = {{{info_kampu3_sec1|{{{blank3_info_sec1|}}}}}}
| blank4_name_sec1 = {{{naran_kampu4_sec1|{{{blank4_name_sec1|}}}}}}
| blank4_info_sec1 = {{{info_kampu4_sec1|{{{blank4_info_sec1|}}}}}}
| blank5_name_sec1 = {{{naran_kampu5_sec1|{{{blank5_name_sec1|}}}}}}
| blank5_info_sec1 = {{{info_kampu5_sec1|{{{blank5_info_sec1|}}}}}}
| blank6_name_sec1 = {{{naran_kampu6_sec1|{{{blank6_name_sec1|}}}}}}
| blank6_info_sec1 = {{{info_kampu6_sec1|{{{blank6_info_sec1|}}}}}}
| blank7_name_sec1 = {{{naran_kampu7_sec1|{{{blank7_name_sec1|}}}}}}
| blank7_info_sec1 = {{{info_kampu7_sec1|{{{blank7_info_sec1|}}}}}}
| blank_name_sec2 = {{{naran_kampu_sec2|{{{blank_name_sec2|}}}}}}
| blank_info_sec2 = {{{info_kampu_sec2|{{{blank_info_sec2|}}}}}}
| blank1_name_sec2 = {{{naran_kampu1_sec2|{{{blank1_name_sec2|}}}}}}
| blank1_info_sec2 = {{{info_kampu1_sec2|{{{blank1_info_sec2|}}}}}}
| blank2_name_sec2 = {{{naran_kampu2_sec2|{{{blank2_name_sec2|}}}}}}
| blank2_info_sec2 = {{{info_kampu2_sec2|{{{blank2_info_sec2|}}}}}}
| blank3_name_sec2 = {{{naran_kampu3_sec2|{{{blank3_name_sec2|}}}}}}
| blank3_info_sec2 = {{{info_kampu3_sec2|{{{blank3_info_sec2|}}}}}}
| blank4_name_sec2 = {{{naran_kampu4_sec2|{{{blank4_name_sec2|}}}}}}
| blank4_info_sec2 = {{{info_kampu4_sec2|{{{blank4_info_sec2|}}}}}}
| blank5_name_sec2 = {{{naran_kampu5_sec2|{{{blank5_name_sec2|}}}}}}
| blank5_info_sec2 = {{{info_kampu5_sec2|{{{blank5_info_sec2|}}}}}}
| blank6_name_sec2 = {{{naran_kampu6_sec2|{{{blank6_name_sec2|}}}}}}
| blank6_info_sec2 = {{{info_kampu6_sec2|{{{blank6_info_sec2|}}}}}}
| blank7_name_sec2 = {{{naran_kampu7_sec2|{{{blank7_name_sec2|}}}}}}
| blank7_info_sec2 = {{{info_kampu7_sec2|{{{blank7_info_sec2|}}}}}}
| website = {{{sitiu_web|{{{website|}}}}}}
| module = {{{modulu|{{{module|}}}}}}
| footnotes = {{{nota_sira|{{{footnotes|}}}}}}
| child = {{{labarik|{{{child|}}}}}}
| embed = {{{hatama|{{{embed|}}}}}}
}}</includeonly><noinclude>{{Documentation}}</noinclude>
lqxhq8z2ypiy93fcxzxeq1h9tolu8g4
Módulo:Transclusion count/data/L
828
8166
75046
74072
2026-08-23T05:09:15Z
en>Ahechtbot
0
[[Wikipedia:BOT|Bot]]: Updated page.
75046
Scribunto
text/plain
return {
["LASTYEAR"] = 846000,
["LAT"] = 4100,
["LCAuth"] = 3300,
["LCCN"] = 2300,
["LKA"] = 2100,
["LTU"] = 4900,
["LUX"] = 2500,
["LVA"] = 4700,
["La"] = 518000,
["LaPreferente"] = 2300,
["Label"] = 42000,
["Lafc"] = 7000,
["Lang"] = 457000,
["Lang-ka"] = 5900,
["Lang-sr-Cyrl"] = 13000,
["Lang-sr-cyr"] = 3300,
["Lang-sr-cyrl"] = 2400,
["Lang-zh"] = 84000,
["Lang2iso"] = 4500,
["Lang_unset_italics"] = 2400,
["Langnf"] = 2700,
["Langr"] = 2300,
["Language_with_name"] = 7800,
["Language_with_name/for"] = 3300,
["Languages"] = 2700,
["Langx"] = 671000,
["Large"] = 506000,
["Large_category_TOC"] = 11000,
["Last_edited_by"] = 62000,
["Last_word"] = 41000,
["LaunchesByYear_footer"] = 3600,
["LaunchesByYear_header"] = 3600,
["Law_sidebar_style/styles.css"] = 2200,
["Lc"] = 9900,
["Lead_too_short"] = 11000,
["League_icon"] = 3600,
["Leagueicon"] = 3500,
["Leave_feedback/link"] = 86000,
["Left"] = 10000,
["Left-pointing_double_angles"] = 2900,
["Left_angles"] = 2900,
["Leftlegend"] = 2000,
["Legend"] = 35000,
["Legend/styles.css"] = 152000,
["Legend0"] = 13000,
["Legend2"] = 23000,
["Legend_inline"] = 28000,
["LepIndex"] = 12000,
["Letter-NumberCombDisambig"] = 3500,
["Letter–number_combination_disambiguation"] = 4900,
["Lgtext"] = 3900,
["Libera.Chat"] = 11000,
["Library_link_about"] = 4000,
["Library_of_Congress_Control_Number"] = 2400,
["Library_resources_box"] = 4200,
["Librivox_author"] = 7300,
["Librivox_book"] = 4000,
["LicenseTagFairUseQualifier"] = 12000,
["License_migration"] = 45000,
["License_migration_complete"] = 19000,
["License_migration_not_eligible"] = 6800,
["License_migration_redundant"] = 19000,
["Lichengloss"] = 3100,
["Like"] = 2600,
["Likely"] = 5400,
["Line_link"] = 15000,
["Linear-gradient_text"] = 9200,
["Linescore_Amfootball"] = 2400,
["LinkCatIfExists2"] = 16000,
["LinkStatusLocal"] = 45000,
["LinkSummary"] = 249000,
["LinkSummaryLive"] = 9800,
["Link_if_exists"] = 298000,
["Link_note"] = 75000,
["Link_summary"] = 263000,
["Link_target"] = 34000,
["Linkcolor"] = 2600,
["Linkless_exists"] = 26000,
["Linksearch"] = 2800,
["Linksummarylive"] = 5600,
["Linktext"] = 15000,
["List-Class"] = 17000,
["Listen"] = 17000,
["Listen_live"] = 4800,
["Listenlive"] = 3800,
["Lists_of_people_editnotice"] = 2600,
["Lit"] = 17000,
["Literal_translation"] = 26000,
["Lnl"] = 11000,
["LoMP"] = 4800,
["Location_map"] = 51000,
["Location_map+"] = 31000,
["Location_map_data_documentation"] = 6800,
["Location_map_many"] = 4800,
["Location_map~"] = 30000,
["Location_mark"] = 2700,
["Location_mark+"] = 2700,
["Location_mark~"] = 2700,
["Log"] = 3700,
["Logo_fur"] = 64000,
["Logo_requested"] = 6600,
["London_Gazette"] = 36000,
["Long_plot"] = 4000,
["Longitem"] = 2070000,
["Longlink"] = 5300,
["Look_from"] = 11000,
["Lookfrom"] = 5500,
["Loop"] = 102000,
["Loss"] = 4100,
["Low-Class"] = 15000,
["Low-importance"] = 16000,
["Lower"] = 8400,
["Lowercase"] = 4600,
["Lowercase_title"] = 18000,
["Lowercasetitle"] = 2500,
["Lpsn"] = 2200,
["Lt"] = 2500,
["Lua"] = 12000,
["Lua_escape"] = 5700,
["Module:LCCN"] = 2400,
["Module:Labelled_list_hatnote"] = 635000,
["Module:Lang"] = 1720000,
["Module:Lang-zh"] = 85000,
["Module:Lang/ISO_639_synonyms"] = 1720000,
["Module:Lang/configuration"] = 1720000,
["Module:Lang/data"] = 1720000,
["Module:Lang/data/iana_languages"] = 1720000,
["Module:Lang/data/iana_regions"] = 1720000,
["Module:Lang/data/iana_scripts"] = 1720000,
["Module:Lang/data/iana_suppressed_scripts"] = 1720000,
["Module:Lang/data/iana_variants"] = 1720000,
["Module:Lang/data/is_latn_data"] = 1720000,
["Module:Lang/documentor_tool"] = 4100,
["Module:Lang/langx"] = 691000,
["Module:Lang/tag_from_name"] = 7500,
["Module:Language_with_name/for"] = 3300,
["Module:Large_category_TOC"] = 12000,
["Module:Large_category_TOC/styles.css"] = 12000,
["Module:Latin"] = 9000,
["Module:Librivox_book"] = 4000,
["Module:Lighthouse_tracking"] = 2600,
["Module:Link_if_exists"] = 307000,
["Module:Link_summary"] = 263000,
["Module:List"] = 2630000,
["Module:Listen"] = 17000,
["Module:Listen/styles.css"] = 16000,
["Module:Location_map"] = 1160000,
["Module:Location_map/data/Antarctica"] = 2700,
["Module:Location_map/data/Arkansas"] = 3400,
["Module:Location_map/data/Australia"] = 3400,
["Module:Location_map/data/Australia_New_South_Wales"] = 3700,
["Module:Location_map/data/Australia_Queensland"] = 6000,
["Module:Location_map/data/Australia_South_Australia"] = 2200,
["Module:Location_map/data/Austria"] = 3500,
["Module:Location_map/data/Azerbaijan"] = 4900,
["Module:Location_map/data/Bangladesh"] = 2300,
["Module:Location_map/data/Belgium"] = 2000,
["Module:Location_map/data/Bosnia_and_Herzegovina"] = 5500,
["Module:Location_map/data/Brazil"] = 5300,
["Module:Location_map/data/Bulgaria"] = 3400,
["Module:Location_map/data/California"] = 6200,
["Module:Location_map/data/Canada"] = 5000,
["Module:Location_map/data/Canada_Alberta"] = 2200,
["Module:Location_map/data/Canada_British_Columbia"] = 3500,
["Module:Location_map/data/Canada_Ontario"] = 2000,
["Module:Location_map/data/China"] = 3900,
["Module:Location_map/data/Croatia"] = 4300,
["Module:Location_map/data/Czech_Republic"] = 6900,
["Module:Location_map/data/Estonia"] = 3100,
["Module:Location_map/data/Europe"] = 4400,
["Module:Location_map/data/Florida"] = 2700,
["Module:Location_map/data/France"] = 40000,
["Module:Location_map/data/France_Auvergne-Rhône-Alpes"] = 4400,
["Module:Location_map/data/France_Bourgogne-Franche-Comté"] = 4000,
["Module:Location_map/data/France_Grand_Est"] = 5300,
["Module:Location_map/data/France_Hauts-de-France"] = 3900,
["Module:Location_map/data/France_Normandy"] = 3400,
["Module:Location_map/data/France_Nouvelle-Aquitaine"] = 4800,
["Module:Location_map/data/France_Occitanie"] = 4800,
["Module:Location_map/data/Germany"] = 17000,
["Module:Location_map/data/Germany_Bavaria"] = 2900,
["Module:Location_map/data/Germany_Rhineland-Palatinate"] = 2600,
["Module:Location_map/data/Greece"] = 5000,
["Module:Location_map/data/Hungary"] = 2900,
["Module:Location_map/data/Illinois"] = 3500,
["Module:Location_map/data/India"] = 24000,
["Module:Location_map/data/India3"] = 2900,
["Module:Location_map/data/India_Andhra_Pradesh"] = 2900,
["Module:Location_map/data/India_Karnataka"] = 2200,
["Module:Location_map/data/India_Kerala"] = 2900,
["Module:Location_map/data/India_Maharashtra"] = 3100,
["Module:Location_map/data/India_Punjab"] = 2300,
["Module:Location_map/data/India_Tamil_Nadu"] = 3300,
["Module:Location_map/data/India_Uttar_Pradesh"] = 3600,
["Module:Location_map/data/India_West_Bengal"] = 3000,
["Module:Location_map/data/Indiana"] = 3200,
["Module:Location_map/data/Iowa"] = 3000,
["Module:Location_map/data/Iran"] = 51000,
["Module:Location_map/data/Ireland"] = 4000,
["Module:Location_map/data/Italy"] = 12000,
["Module:Location_map/data/Japan"] = 15000,
["Module:Location_map/data/Maine"] = 2100,
["Module:Location_map/data/Maryland"] = 2100,
["Module:Location_map/data/Massachusetts"] = 4700,
["Module:Location_map/data/Mexico"] = 3900,
["Module:Location_map/data/Michigan"] = 3900,
["Module:Location_map/data/Minnesota"] = 4600,
["Module:Location_map/data/Nepal"] = 4800,
["Module:Location_map/data/Netherlands"] = 3100,
["Module:Location_map/data/New_York"] = 8100,
["Module:Location_map/data/North_Carolina"] = 3700,
["Module:Location_map/data/Norway"] = 2100,
["Module:Location_map/data/Ohio"] = 2700,
["Module:Location_map/data/Pakistan"] = 3100,
["Module:Location_map/data/Pennsylvania"] = 6100,
["Module:Location_map/data/Peru"] = 2900,
["Module:Location_map/data/Philippines"] = 3800,
["Module:Location_map/data/Poland"] = 54000,
["Module:Location_map/data/Queensland"] = 2500,
["Module:Location_map/data/Romania"] = 6000,
["Module:Location_map/data/Russia"] = 29000,
["Module:Location_map/data/Russia_Bashkortostan"] = 4500,
["Module:Location_map/data/Russia_Vladimir_Oblast"] = 2200,
["Module:Location_map/data/Russia_Vologda_Oblast"] = 4800,
["Module:Location_map/data/Serbia"] = 4400,
["Module:Location_map/data/Slovakia"] = 3300,
["Module:Location_map/data/Slovenia"] = 6800,
["Module:Location_map/data/South_Africa"] = 3300,
["Module:Location_map/data/Spain"] = 8700,
["Module:Location_map/data/Sweden"] = 2900,
["Module:Location_map/data/Switzerland"] = 6100,
["Module:Location_map/data/Syria"] = 2800,
["Module:Location_map/data/Texas"] = 3900,
["Module:Location_map/data/Turkey"] = 22000,
["Module:Location_map/data/Turkey_Central_Anatolia"] = 2100,
["Module:Location_map/data/Turkey_Marmara"] = 2300,
["Module:Location_map/data/USA"] = 115000,
["Module:Location_map/data/USA_Alabama"] = 2200,
["Module:Location_map/data/USA_Alaska"] = 2400,
["Module:Location_map/data/USA_Arizona"] = 2200,
["Module:Location_map/data/USA_Arkansas"] = 3500,
["Module:Location_map/data/USA_California"] = 8100,
["Module:Location_map/data/USA_Colorado"] = 2400,
["Module:Location_map/data/USA_Florida"] = 3400,
["Module:Location_map/data/USA_Georgia"] = 2100,
["Module:Location_map/data/USA_Illinois"] = 3800,
["Module:Location_map/data/USA_Indiana"] = 3400,
["Module:Location_map/data/USA_Iowa"] = 3200,
["Module:Location_map/data/USA_Kentucky"] = 3300,
["Module:Location_map/data/USA_Maine"] = 2300,
["Module:Location_map/data/USA_Maryland"] = 2600,
["Module:Location_map/data/USA_Massachusetts"] = 5000,
["Module:Location_map/data/USA_Michigan"] = 4300,
["Module:Location_map/data/USA_Minnesota"] = 5000,
["Module:Location_map/data/USA_Missouri"] = 2200,
["Module:Location_map/data/USA_New_Jersey"] = 3000,
["Module:Location_map/data/USA_New_York"] = 9100,
["Module:Location_map/data/USA_North_Carolina"] = 4500,
["Module:Location_map/data/USA_Ohio"] = 3000,
["Module:Location_map/data/USA_Oregon"] = 2600,
["Module:Location_map/data/USA_Pennsylvania"] = 7300,
["Module:Location_map/data/USA_Tennessee"] = 2200,
["Module:Location_map/data/USA_Texas"] = 4400,
["Module:Location_map/data/USA_Virginia"] = 5100,
["Module:Location_map/data/USA_Washington"] = 3200,
["Module:Location_map/data/USA_West_Virginia"] = 4400,
["Module:Location_map/data/USA_Wisconsin"] = 3000,
["Module:Location_map/data/Ukraine"] = 4100,
["Module:Location_map/data/United_States"] = 2600,
["Module:Location_map/data/Virginia"] = 4000,
["Module:Location_map/data/Washington"] = 2400,
["Module:Location_map/data/West_Virginia"] = 4100,
["Module:Location_map/data/Wisconsin"] = 2600,
["Module:Location_map/data/doc"] = 6700,
["Module:Location_map/info"] = 6800,
["Module:Location_map/multi"] = 35000,
["Module:Location_map/styles.css"] = 786000,
["Module:London_Gazette_util"] = 36000,
["Module:Lua_banner"] = 12000,
}
py0cl07pbkafa3iuohgs0sqpajpe0nh
75047
75046
2026-08-24T01:09:15Z
Robertsky
10424
1 versaun husi [[:en:Module:Transclusion_count/data/L]]
75046
Scribunto
text/plain
return {
["LASTYEAR"] = 846000,
["LAT"] = 4100,
["LCAuth"] = 3300,
["LCCN"] = 2300,
["LKA"] = 2100,
["LTU"] = 4900,
["LUX"] = 2500,
["LVA"] = 4700,
["La"] = 518000,
["LaPreferente"] = 2300,
["Label"] = 42000,
["Lafc"] = 7000,
["Lang"] = 457000,
["Lang-ka"] = 5900,
["Lang-sr-Cyrl"] = 13000,
["Lang-sr-cyr"] = 3300,
["Lang-sr-cyrl"] = 2400,
["Lang-zh"] = 84000,
["Lang2iso"] = 4500,
["Lang_unset_italics"] = 2400,
["Langnf"] = 2700,
["Langr"] = 2300,
["Language_with_name"] = 7800,
["Language_with_name/for"] = 3300,
["Languages"] = 2700,
["Langx"] = 671000,
["Large"] = 506000,
["Large_category_TOC"] = 11000,
["Last_edited_by"] = 62000,
["Last_word"] = 41000,
["LaunchesByYear_footer"] = 3600,
["LaunchesByYear_header"] = 3600,
["Law_sidebar_style/styles.css"] = 2200,
["Lc"] = 9900,
["Lead_too_short"] = 11000,
["League_icon"] = 3600,
["Leagueicon"] = 3500,
["Leave_feedback/link"] = 86000,
["Left"] = 10000,
["Left-pointing_double_angles"] = 2900,
["Left_angles"] = 2900,
["Leftlegend"] = 2000,
["Legend"] = 35000,
["Legend/styles.css"] = 152000,
["Legend0"] = 13000,
["Legend2"] = 23000,
["Legend_inline"] = 28000,
["LepIndex"] = 12000,
["Letter-NumberCombDisambig"] = 3500,
["Letter–number_combination_disambiguation"] = 4900,
["Lgtext"] = 3900,
["Libera.Chat"] = 11000,
["Library_link_about"] = 4000,
["Library_of_Congress_Control_Number"] = 2400,
["Library_resources_box"] = 4200,
["Librivox_author"] = 7300,
["Librivox_book"] = 4000,
["LicenseTagFairUseQualifier"] = 12000,
["License_migration"] = 45000,
["License_migration_complete"] = 19000,
["License_migration_not_eligible"] = 6800,
["License_migration_redundant"] = 19000,
["Lichengloss"] = 3100,
["Like"] = 2600,
["Likely"] = 5400,
["Line_link"] = 15000,
["Linear-gradient_text"] = 9200,
["Linescore_Amfootball"] = 2400,
["LinkCatIfExists2"] = 16000,
["LinkStatusLocal"] = 45000,
["LinkSummary"] = 249000,
["LinkSummaryLive"] = 9800,
["Link_if_exists"] = 298000,
["Link_note"] = 75000,
["Link_summary"] = 263000,
["Link_target"] = 34000,
["Linkcolor"] = 2600,
["Linkless_exists"] = 26000,
["Linksearch"] = 2800,
["Linksummarylive"] = 5600,
["Linktext"] = 15000,
["List-Class"] = 17000,
["Listen"] = 17000,
["Listen_live"] = 4800,
["Listenlive"] = 3800,
["Lists_of_people_editnotice"] = 2600,
["Lit"] = 17000,
["Literal_translation"] = 26000,
["Lnl"] = 11000,
["LoMP"] = 4800,
["Location_map"] = 51000,
["Location_map+"] = 31000,
["Location_map_data_documentation"] = 6800,
["Location_map_many"] = 4800,
["Location_map~"] = 30000,
["Location_mark"] = 2700,
["Location_mark+"] = 2700,
["Location_mark~"] = 2700,
["Log"] = 3700,
["Logo_fur"] = 64000,
["Logo_requested"] = 6600,
["London_Gazette"] = 36000,
["Long_plot"] = 4000,
["Longitem"] = 2070000,
["Longlink"] = 5300,
["Look_from"] = 11000,
["Lookfrom"] = 5500,
["Loop"] = 102000,
["Loss"] = 4100,
["Low-Class"] = 15000,
["Low-importance"] = 16000,
["Lower"] = 8400,
["Lowercase"] = 4600,
["Lowercase_title"] = 18000,
["Lowercasetitle"] = 2500,
["Lpsn"] = 2200,
["Lt"] = 2500,
["Lua"] = 12000,
["Lua_escape"] = 5700,
["Module:LCCN"] = 2400,
["Module:Labelled_list_hatnote"] = 635000,
["Module:Lang"] = 1720000,
["Module:Lang-zh"] = 85000,
["Module:Lang/ISO_639_synonyms"] = 1720000,
["Module:Lang/configuration"] = 1720000,
["Module:Lang/data"] = 1720000,
["Module:Lang/data/iana_languages"] = 1720000,
["Module:Lang/data/iana_regions"] = 1720000,
["Module:Lang/data/iana_scripts"] = 1720000,
["Module:Lang/data/iana_suppressed_scripts"] = 1720000,
["Module:Lang/data/iana_variants"] = 1720000,
["Module:Lang/data/is_latn_data"] = 1720000,
["Module:Lang/documentor_tool"] = 4100,
["Module:Lang/langx"] = 691000,
["Module:Lang/tag_from_name"] = 7500,
["Module:Language_with_name/for"] = 3300,
["Module:Large_category_TOC"] = 12000,
["Module:Large_category_TOC/styles.css"] = 12000,
["Module:Latin"] = 9000,
["Module:Librivox_book"] = 4000,
["Module:Lighthouse_tracking"] = 2600,
["Module:Link_if_exists"] = 307000,
["Module:Link_summary"] = 263000,
["Module:List"] = 2630000,
["Module:Listen"] = 17000,
["Module:Listen/styles.css"] = 16000,
["Module:Location_map"] = 1160000,
["Module:Location_map/data/Antarctica"] = 2700,
["Module:Location_map/data/Arkansas"] = 3400,
["Module:Location_map/data/Australia"] = 3400,
["Module:Location_map/data/Australia_New_South_Wales"] = 3700,
["Module:Location_map/data/Australia_Queensland"] = 6000,
["Module:Location_map/data/Australia_South_Australia"] = 2200,
["Module:Location_map/data/Austria"] = 3500,
["Module:Location_map/data/Azerbaijan"] = 4900,
["Module:Location_map/data/Bangladesh"] = 2300,
["Module:Location_map/data/Belgium"] = 2000,
["Module:Location_map/data/Bosnia_and_Herzegovina"] = 5500,
["Module:Location_map/data/Brazil"] = 5300,
["Module:Location_map/data/Bulgaria"] = 3400,
["Module:Location_map/data/California"] = 6200,
["Module:Location_map/data/Canada"] = 5000,
["Module:Location_map/data/Canada_Alberta"] = 2200,
["Module:Location_map/data/Canada_British_Columbia"] = 3500,
["Module:Location_map/data/Canada_Ontario"] = 2000,
["Module:Location_map/data/China"] = 3900,
["Module:Location_map/data/Croatia"] = 4300,
["Module:Location_map/data/Czech_Republic"] = 6900,
["Module:Location_map/data/Estonia"] = 3100,
["Module:Location_map/data/Europe"] = 4400,
["Module:Location_map/data/Florida"] = 2700,
["Module:Location_map/data/France"] = 40000,
["Module:Location_map/data/France_Auvergne-Rhône-Alpes"] = 4400,
["Module:Location_map/data/France_Bourgogne-Franche-Comté"] = 4000,
["Module:Location_map/data/France_Grand_Est"] = 5300,
["Module:Location_map/data/France_Hauts-de-France"] = 3900,
["Module:Location_map/data/France_Normandy"] = 3400,
["Module:Location_map/data/France_Nouvelle-Aquitaine"] = 4800,
["Module:Location_map/data/France_Occitanie"] = 4800,
["Module:Location_map/data/Germany"] = 17000,
["Module:Location_map/data/Germany_Bavaria"] = 2900,
["Module:Location_map/data/Germany_Rhineland-Palatinate"] = 2600,
["Module:Location_map/data/Greece"] = 5000,
["Module:Location_map/data/Hungary"] = 2900,
["Module:Location_map/data/Illinois"] = 3500,
["Module:Location_map/data/India"] = 24000,
["Module:Location_map/data/India3"] = 2900,
["Module:Location_map/data/India_Andhra_Pradesh"] = 2900,
["Module:Location_map/data/India_Karnataka"] = 2200,
["Module:Location_map/data/India_Kerala"] = 2900,
["Module:Location_map/data/India_Maharashtra"] = 3100,
["Module:Location_map/data/India_Punjab"] = 2300,
["Module:Location_map/data/India_Tamil_Nadu"] = 3300,
["Module:Location_map/data/India_Uttar_Pradesh"] = 3600,
["Module:Location_map/data/India_West_Bengal"] = 3000,
["Module:Location_map/data/Indiana"] = 3200,
["Module:Location_map/data/Iowa"] = 3000,
["Module:Location_map/data/Iran"] = 51000,
["Module:Location_map/data/Ireland"] = 4000,
["Module:Location_map/data/Italy"] = 12000,
["Module:Location_map/data/Japan"] = 15000,
["Module:Location_map/data/Maine"] = 2100,
["Module:Location_map/data/Maryland"] = 2100,
["Module:Location_map/data/Massachusetts"] = 4700,
["Module:Location_map/data/Mexico"] = 3900,
["Module:Location_map/data/Michigan"] = 3900,
["Module:Location_map/data/Minnesota"] = 4600,
["Module:Location_map/data/Nepal"] = 4800,
["Module:Location_map/data/Netherlands"] = 3100,
["Module:Location_map/data/New_York"] = 8100,
["Module:Location_map/data/North_Carolina"] = 3700,
["Module:Location_map/data/Norway"] = 2100,
["Module:Location_map/data/Ohio"] = 2700,
["Module:Location_map/data/Pakistan"] = 3100,
["Module:Location_map/data/Pennsylvania"] = 6100,
["Module:Location_map/data/Peru"] = 2900,
["Module:Location_map/data/Philippines"] = 3800,
["Module:Location_map/data/Poland"] = 54000,
["Module:Location_map/data/Queensland"] = 2500,
["Module:Location_map/data/Romania"] = 6000,
["Module:Location_map/data/Russia"] = 29000,
["Module:Location_map/data/Russia_Bashkortostan"] = 4500,
["Module:Location_map/data/Russia_Vladimir_Oblast"] = 2200,
["Module:Location_map/data/Russia_Vologda_Oblast"] = 4800,
["Module:Location_map/data/Serbia"] = 4400,
["Module:Location_map/data/Slovakia"] = 3300,
["Module:Location_map/data/Slovenia"] = 6800,
["Module:Location_map/data/South_Africa"] = 3300,
["Module:Location_map/data/Spain"] = 8700,
["Module:Location_map/data/Sweden"] = 2900,
["Module:Location_map/data/Switzerland"] = 6100,
["Module:Location_map/data/Syria"] = 2800,
["Module:Location_map/data/Texas"] = 3900,
["Module:Location_map/data/Turkey"] = 22000,
["Module:Location_map/data/Turkey_Central_Anatolia"] = 2100,
["Module:Location_map/data/Turkey_Marmara"] = 2300,
["Module:Location_map/data/USA"] = 115000,
["Module:Location_map/data/USA_Alabama"] = 2200,
["Module:Location_map/data/USA_Alaska"] = 2400,
["Module:Location_map/data/USA_Arizona"] = 2200,
["Module:Location_map/data/USA_Arkansas"] = 3500,
["Module:Location_map/data/USA_California"] = 8100,
["Module:Location_map/data/USA_Colorado"] = 2400,
["Module:Location_map/data/USA_Florida"] = 3400,
["Module:Location_map/data/USA_Georgia"] = 2100,
["Module:Location_map/data/USA_Illinois"] = 3800,
["Module:Location_map/data/USA_Indiana"] = 3400,
["Module:Location_map/data/USA_Iowa"] = 3200,
["Module:Location_map/data/USA_Kentucky"] = 3300,
["Module:Location_map/data/USA_Maine"] = 2300,
["Module:Location_map/data/USA_Maryland"] = 2600,
["Module:Location_map/data/USA_Massachusetts"] = 5000,
["Module:Location_map/data/USA_Michigan"] = 4300,
["Module:Location_map/data/USA_Minnesota"] = 5000,
["Module:Location_map/data/USA_Missouri"] = 2200,
["Module:Location_map/data/USA_New_Jersey"] = 3000,
["Module:Location_map/data/USA_New_York"] = 9100,
["Module:Location_map/data/USA_North_Carolina"] = 4500,
["Module:Location_map/data/USA_Ohio"] = 3000,
["Module:Location_map/data/USA_Oregon"] = 2600,
["Module:Location_map/data/USA_Pennsylvania"] = 7300,
["Module:Location_map/data/USA_Tennessee"] = 2200,
["Module:Location_map/data/USA_Texas"] = 4400,
["Module:Location_map/data/USA_Virginia"] = 5100,
["Module:Location_map/data/USA_Washington"] = 3200,
["Module:Location_map/data/USA_West_Virginia"] = 4400,
["Module:Location_map/data/USA_Wisconsin"] = 3000,
["Module:Location_map/data/Ukraine"] = 4100,
["Module:Location_map/data/United_States"] = 2600,
["Module:Location_map/data/Virginia"] = 4000,
["Module:Location_map/data/Washington"] = 2400,
["Module:Location_map/data/West_Virginia"] = 4100,
["Module:Location_map/data/Wisconsin"] = 2600,
["Module:Location_map/data/doc"] = 6700,
["Module:Location_map/info"] = 6800,
["Module:Location_map/multi"] = 35000,
["Module:Location_map/styles.css"] = 786000,
["Module:London_Gazette_util"] = 36000,
["Module:Lua_banner"] = 12000,
}
py0cl07pbkafa3iuohgs0sqpajpe0nh
Template:Abbr
10
8232
75024
73020
2026-08-20T18:14:41Z
en>Wbm1058
0
notify protected page of requested move
75024
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Abbreviation|2=Template talk:Abbr#Requested move 20 August 2026}}
</noinclude><abbr {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} title="{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|"|"}}}}">{{{1|}}}</abbr><noinclude>{{Documentation}}
</noinclude>
ihl3vw67bee64tyrlx4jyqgpbp82rw2
75025
75024
2026-08-24T00:46:07Z
Robertsky
10424
1 versaun husi [[:en:Template:Abbr]]
75024
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Abbreviation|2=Template talk:Abbr#Requested move 20 August 2026}}
</noinclude><abbr {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} title="{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|"|"}}}}">{{{1|}}}</abbr><noinclude>{{Documentation}}
</noinclude>
ihl3vw67bee64tyrlx4jyqgpbp82rw2
Módulo:Transclusion count/data/R
828
8423
74974
74157
2026-08-23T05:10:15Z
en>Ahechtbot
0
[[Wikipedia:BOT|Bot]]: Updated page.
74974
Scribunto
text/plain
return {
["R"] = 36000,
["R/ref"] = 36000,
["R/superscript"] = 113000,
["R/where"] = 113000,
["RA"] = 11000,
["RCS"] = 5500,
["REVISIONUSER2"] = 64000,
["RMS"] = 6400,
["RMnac"] = 3200,
["ROM"] = 2700,
["ROU"] = 7500,
["RSA"] = 5200,
["RSS-Atom_feed_notice"] = 222000,
["RTGS"] = 2900,
["RT_data"] = 4100,
["RUS"] = 15000,
["R_Wikidata"] = 2200,
["R_alt"] = 2900,
["R_ambig"] = 16000,
["R_avoided_double_redirect"] = 204000,
["R_cat_shell"] = 12000,
["R_category_shell"] = 15000,
["R_from_ASCII-only"] = 240000,
["R_from_ATC_code"] = 4700,
["R_from_ATCvet_code"] = 5400,
["R_from_British_English"] = 2700,
["R_from_DOI_prefix"] = 7700,
["R_from_IMO_number"] = 4600,
["R_from_ISO_4"] = 42000,
["R_from_ISO_4_abbreviation"] = 47000,
["R_from_ISO_639"] = 8800,
["R_from_ISO_639_code"] = 9000,
["R_from_NLM"] = 4600,
["R_from_NLM_abbreviation"] = 4700,
["R_from_UK_road"] = 3000,
["R_from_UN/LOCODE"] = 7100,
["R_from_US_postal_abbreviation"] = 44000,
["R_from_Unicode"] = 28000,
["R_from_Unicode_character"] = 32000,
["R_from_abbreviation"] = 27000,
["R_from_acronym"] = 3000,
["R_from_adjective"] = 7900,
["R_from_airport_code"] = 7000,
["R_from_album"] = 18000,
["R_from_alt_name"] = 5300,
["R_from_alternate_name"] = 21000,
["R_from_alternate_spelling"] = 7200,
["R_from_alternative_capitalisation"] = 9100,
["R_from_alternative_capitalization"] = 4600,
["R_from_alternative_disambiguation"] = 6300,
["R_from_alternative_hyphenation"] = 323000,
["R_from_alternative_language"] = 91000,
["R_from_alternative_name"] = 300000,
["R_from_alternative_punctuation"] = 33000,
["R_from_alternative_scientific_name"] = 160000,
["R_from_alternative_spacing"] = 16000,
["R_from_alternative_spelling"] = 80000,
["R_from_alternative_title"] = 10000,
["R_from_alternative_transliteration"] = 7300,
["R_from_ambiguous"] = 3000,
["R_from_ambiguous_page"] = 7800,
["R_from_ambiguous_sort_name"] = 40000,
["R_from_ambiguous_term"] = 53000,
["R_from_avoided_double_redirect"] = 7500,
["R_from_birth_name"] = 14000,
["R_from_book"] = 5500,
["R_from_case_citation"] = 3300,
["R_from_category_navigation"] = 4400,
["R_from_chemical_formula"] = 9200,
["R_from_comment_subpage"] = 22000,
["R_from_diacritic"] = 11000,
["R_from_diacritics"] = 2100,
["R_from_domain_name"] = 15000,
["R_from_draft"] = 4000,
["R_from_draft_namespace"] = 5900,
["R_from_drug_trade_name"] = 23000,
["R_from_emoji"] = 3400,
["R_from_fictional_character"] = 57000,
["R_from_fictional_element"] = 5700,
["R_from_fictional_location"] = 2400,
["R_from_film"] = 2100,
["R_from_former_name"] = 33000,
["R_from_full_name"] = 13000,
["R_from_gene_symbol"] = 10000,
["R_from_given_name"] = 3200,
["R_from_incomplete_disambiguation"] = 61000,
["R_from_incomplete_name"] = 2600,
["R_from_incorrect_disambiguation"] = 5700,
["R_from_incorrect_name"] = 14000,
["R_from_initialism"] = 27000,
["R_from_initials"] = 4200,
["R_from_legislation"] = 3300,
["R_from_less_specific_name"] = 5100,
["R_from_list_topic"] = 21000,
["R_from_long"] = 6600,
["R_from_long_name"] = 108000,
["R_from_longer_name"] = 17000,
["R_from_member"] = 6700,
["R_from_merge"] = 77000,
["R_from_miscapitalisation"] = 42000,
["R_from_miscapitalization"] = 5900,
["R_from_misspelling"] = 68000,
["R_from_modification"] = 465000,
["R_from_molecular_formula"] = 6800,
["R_from_monotypic_taxon"] = 8100,
["R_from_more_specific_geographic_name"] = 2800,
["R_from_more_specific_name"] = 6300,
["R_from_move"] = 3050000,
["R_from_move/except"] = 3050000,
["R_from_name_with_title"] = 6600,
["R_from_nickname"] = 3200,
["R_from_old_AfC_draft"] = 29000,
["R_from_other_capitalisation"] = 418000,
["R_from_other_capitalization"] = 6500,
["R_from_other_disambiguation"] = 21000,
["R_from_other_language"] = 2900,
["R_from_other_name"] = 8100,
["R_from_other_punctuation"] = 2000,
["R_from_other_spelling"] = 2800,
["R_from_person"] = 14000,
["R_from_personal_name"] = 3100,
["R_from_plural"] = 39000,
["R_from_product_name"] = 2500,
["R_from_pseudonym"] = 2900,
["R_from_railroad_name_with_ampersand"] = 2300,
["R_from_related_term"] = 2200,
["R_from_related_topic"] = 7100,
["R_from_related_word"] = 17000,
["R_from_remote_page"] = 12000,
["R_from_remote_talk_page"] = 30000,
["R_from_school"] = 3500,
["R_from_scientific_name"] = 36000,
["R_from_short"] = 5500,
["R_from_short_name"] = 117000,
["R_from_shortcut"] = 48000,
["R_from_shorter_name"] = 2500,
["R_from_shorter_title"] = 5200,
["R_from_song"] = 60000,
["R_from_sort_name"] = 188000,
["R_from_species_to_genus"] = 4800,
["R_from_stylization"] = 2000,
["R_from_subpage"] = 41000,
["R_from_subtopic"] = 83000,
["R_from_surname"] = 33000,
["R_from_symbol"] = 3100,
["R_from_synonym"] = 6500,
["R_from_taxonomic_synonym"] = 2500,
["R_from_television_episode"] = 63000,
["R_from_template_shortcut"] = 4700,
["R_from_title_with_diacritics"] = 5800,
["R_from_title_without_diacritics"] = 392000,
["R_from_trade_name"] = 23000,
["R_from_typo"] = 4000,
["R_from_unnecessary_disambiguation"] = 48000,
["R_from_work"] = 2800,
["R_from_year"] = 4100,
["R_hatnote"] = 3000,
["R_list_topic"] = 11000,
["R_mentioned_in_hatnote"] = 12000,
["R_miscap"] = 3000,
["R_move"] = 2300,
["R_printworthy"] = 94000,
["R_protected"] = 11000,
["R_protected/excon"] = 2500,
["R_protected/semi"] = 6300,
["R_sect"] = 3500,
["R_section"] = 24000,
["R_shell"] = 22000,
["R_to_Swiss_municipality_(,_Switzerland)"] = 2300,
["R_to_Swiss_municipality_(canton)"] = 3500,
["R_to_Swiss_municipality_2L"] = 2600,
["R_to_TV_episode_list_entry"] = 9100,
["R_to_alternative_scientific_name"] = 3200,
["R_to_anchor"] = 113000,
["R_to_category_namespace"] = 6500,
["R_to_century"] = 2700,
["R_to_diacritic"] = 422000,
["R_to_diacritics"] = 3900,
["R_to_disambiguation"] = 4000,
["R_to_disambiguation_page"] = 289000,
["R_to_list"] = 39000,
["R_to_list_entry"] = 94000,
["R_to_monotypic_taxon"] = 17000,
["R_to_plural"] = 4900,
["R_to_project"] = 2600,
["R_to_project_namespace"] = 26000,
["R_to_redirect_template"] = 4800,
["R_to_related_topic"] = 95000,
["R_to_scientific_name"] = 105000,
["R_to_section"] = 427000,
["R_to_short_name"] = 4400,
["R_to_stub_template"] = 5000,
["R_to_subpage"] = 8000,
["R_to_subtopic"] = 4200,
["R_to_transliteration"] = 15000,
["R_unprintworthy"] = 98000,
["R_with_Wikidata_item"] = 50000,
["R_with_history"] = 21000,
["R_with_possibilities"] = 127000,
["Racing-Reference_driver"] = 2900,
["Radio_Relay"] = 3600,
["Radio_formats"] = 11000,
["Rail-interchange"] = 42000,
["RailGauge"] = 10000,
["Rail_color"] = 38000,
["Rail_color_box"] = 15000,
["Rail_icon"] = 22000,
["Rail_line"] = 9700,
["Rail_navbox_titlestyle"] = 14000,
["Rail_pass_box"] = 18000,
["Rail_start"] = 2100,
["Rail_template_doc"] = 2300,
["Railway-routemap"] = 4600,
["Railway_division_link"] = 5000,
["Railway_stations_in_countryname_opened_in_YYYY_category_header"] = 3100,
["Railway_stations_in_countryname_opened_or_closed_in_YYYY_category_header"] = 5300,
["Railway_stations_in_countryname_opened_or_closed_in_YYYY_category_header/core"] = 5300,
["Rand"] = 5300,
["Random_number"] = 5600,
["Random_page_in_category"] = 5600,
["Random_subpage"] = 7800,
["Ranking_movements"] = 4800,
["Rating"] = 101000,
["Rating-Christgau"] = 2700,
["Rayment"] = 2000,
["Rayment-hc"] = 6400,
["Razavi_Khorasan_Province"] = 2400,
["Rbox"] = 2200,
["Rcat_shell"] = 268000,
["Rcatsh"] = 9800,
["Rcatshell"] = 5800,
["Rcb"] = 10000,
["Rcr"] = 30000,
["Rcs"] = 4500,
["Re"] = 89000,
["Recent_AfDs"] = 5400,
["Recent_AfDs/core"] = 5400,
["Red"] = 54000,
["Redacted"] = 3200,
["Redirect"] = 62000,
["Redirect-Class"] = 13000,
["Redirect-distinguish"] = 5200,
["Redirect_category"] = 5000,
["Redirect_category_shell"] = 4140000,
["Redirect_from_modification"] = 3200,
["Redirect_from_move"] = 3700,
["Redirect_italic_title"] = 2100,
["Redirect_shell"] = 326000,
["Redirect_template"] = 7860000,
["Redirect_to_section"] = 3600,
["Redr"] = 9300,
["Ref"] = 24000,
["Ref."] = 2300,
["Ref_heading"] = 2500,
["Ref_improve"] = 2500,
["Ref_label"] = 13000,
["Refbegin"] = 225000,
["Refbegin/styles.css"] = 225000,
["Refend"] = 225000,
["Reference_column_heading"] = 11000,
["Reference_page"] = 80000,
["Refh"] = 4700,
["Refideas"] = 30000,
["Refimprove"] = 76000,
["Reflist"] = 6550000,
["Reflist-talk"] = 109000,
["Reflist-talk/styles.css"] = 110000,
["Reflist/styles.css"] = 6550000,
["Reflist_talk"] = 7900,
["Refn"] = 43000,
["Reftalk"] = 9500,
["Region_history_sidebar_title"] = 5900,
["Registration_required"] = 7800,
["Reign"] = 5800,
["Related_molecular_formulas"] = 2400,
["ReleaseVersionParameters"] = 2100,
["Release_version_parameters"] = 2100,
["Reliable_sources_for_medical_articles"] = 14000,
["Remove_accents"] = 9000,
["Remove_file_prefix"] = 2200,
["Remove_first_word"] = 190000,
["Remove_last_word"] = 21000,
["Repeat_vandal"] = 2700,
["Repeated_IP_abuse"] = 5200,
["Repeatvandal"] = 2200,
["Replace"] = 1150000,
["Reply"] = 24000,
["Reply_to"] = 372000,
["Replyto"] = 19000,
["Republican_Party_(US)/meta/shading"] = 19000,
["Reqmapin"] = 2500,
["Reqphoto"] = 72000,
["Request_and_endorse"] = 2500,
["Request_edit_button"] = 12000,
["Request_edit_button/styles.css"] = 12000,
["Requestandendorse"] = 2400,
["Resbox"] = 3400,
["Resize"] = 152000,
["Resizediv"] = 14000,
["Resolve_category_redirect"] = 1370000,
["Resolved"] = 18000,
["Respell"] = 24000,
["Respond"] = 76000,
["Resume-like"] = 4300,
["Retired"] = 11000,
["Retrieved"] = 3200,
["Reverse_date"] = 56000,
["Reviewer_topicon"] = 2700,
["RfA_watchlist_notice"] = 7300,
["RfA_watchlist_notice/text"] = 7300,
["Rfd_log_header"] = 7300,
["Ribbon_devices"] = 5200,
["Ribbon_devices/alt"] = 5200,
["Ribbon_devices/device"] = 4100,
["Ribbon_devices/device_layout"] = 4100,
["Ric"] = 17000,
["Right"] = 6600,
["Right-pointing_double_angles"] = 2900,
["Right_angles"] = 2900,
["Right_ascension"] = 11000,
["Rint"] = 31000,
["Rlp"] = 11000,
["Rlp/Positions"] = 11000,
["Rmri"] = 3900,
["Rnd"] = 8400,
["Rollback_topicon"] = 3300,
["Roman"] = 3600,
["Romania_metadata_Wikidata"] = 3200,
["RomanianSoccer"] = 2400,
["Rotten-tomatoes"] = 9100,
["Rotten_Tomatoes"] = 26000,
["Rotten_Tomatoes_data"] = 6500,
["Rotten_Tomatoes_prose"] = 6700,
["Round"] = 61000,
["Round4-with_third"] = 3500,
["Round_corners"] = 9700,
["Rounddown"] = 4100,
["RouteBox"] = 9700,
["Routemap"] = 30000,
["Routemap/embeded_text"] = 9400,
["Routemap/if_empty_codes"] = 5100,
["Routemap/styles.css"] = 31000,
["RoutemapRouteIcon"] = 4000,
["Row_hover_highlight"] = 2900,
["Row_hover_highlight/styles.css"] = 2900,
["Royal_Australian_Navy_ship"] = 6700,
["Royal_Canadian_Navy_ship"] = 5300,
["Royal_Mail_ship"] = 6400,
["Royal_Netherlands_Navy_ship"] = 3300,
["Rp"] = 76000,
["Rshell"] = 10000,
["Rtl-para"] = 2100,
["Rto"] = 3500,
["Ru"] = 3700,
["Ru-census"] = 7500,
["Ru-census2002"] = 5700,
["Ru-census2010"] = 7500,
["Ru-pop-ref"] = 9900,
["Rugby_box"] = 3600,
["Rugby_league_positions"] = 11000,
["Rugby_league_positions/Positions"] = 11000,
["Rugby_league_records"] = 2000,
["Rugby_league_squad2_coach"] = 2800,
["Rugby_union"] = 3700,
["Rugby_union_team"] = 5300,
["Rugby_union_team/link"] = 5300,
["Rugbybox"] = 3600,
["RussiaAdmMunRef"] = 5800,
["Russia_Time_Zone_Wikidata"] = 6700,
["Russia_Time_Zone_Wikidata/getQID"] = 6500,
["Russia_by_federal_subject_category_navigation"] = 3000,
["Rut"] = 5300,
["Rwd"] = 5000,
["Rws"] = 27000,
["Module:R_avoided_double_redirect"] = 204000,
["Module:Rail-interchange_multi"] = 15000,
["Module:Random"] = 13000,
["Module:Ranking_movements"] = 4800,
["Module:Ranking_movements/styles.css"] = 4800,
["Module:Redirect"] = 4990000,
["Module:Redirect-distinguish"] = 5200,
["Module:RedirectData"] = 48000,
["Module:Redirect_hatnote"] = 64000,
["Module:Redirect_template"] = 7860000,
["Module:Redirect_template_handler"] = 29000,
["Module:Reply_to"] = 372000,
["Module:ResolveEntityId"] = 503000,
["Module:Resolve_category_redirect"] = 1760000,
["Module:Respell"] = 24000,
["Module:RfD"] = 2400,
["Module:Rivals.com_recruit_url"] = 2500,
["Module:Road_data"] = 18000,
["Module:Road_data/RJL_types"] = 17000,
["Module:Road_data/banners/USA"] = 9500,
["Module:Road_data/browse"] = 18000,
["Module:Road_data/browsetable"] = 18000,
["Module:Road_data/browsetable/styles.css"] = 18000,
["Module:Road_data/countrymask"] = 35000,
["Module:Road_data/extra"] = 32000,
["Module:Road_data/locations"] = 12000,
["Module:Road_data/parser"] = 42000,
["Module:Road_data/parser/hooks"] = 20000,
["Module:Road_data/parser/namespace"] = 4300,
["Module:Road_data/size"] = 18000,
["Module:Road_data/strings/ASIA"] = 9100,
["Module:Road_data/strings/CAN"] = 5000,
["Module:Road_data/strings/EUR"] = 5800,
["Module:Road_data/strings/IND"] = 2300,
["Module:Road_data/strings/JPN"] = 3500,
["Module:Road_data/strings/USA"] = 21000,
["Module:Road_data/strings/USA/regional/GRR"] = 21000,
["Module:Road_data/strings/USA/regional/NER"] = 21000,
["Module:Road_data/strings/USA/regional/Tour"] = 21000,
["Module:Road_data/strings/USA/regional/Trails"] = 21000,
["Module:Road_data/util"] = 43000,
["Module:Roman"] = 6400,
["Module:Rotten_Tomatoes_data"] = 6500,
["Module:RoundN"] = 13000,
["Module:Routemap"] = 31000,
["Module:Rugby_box"] = 3600,
["Module:Russia_by_federal_subject_category_navigation"] = 3000,
}
fkxb6cisbbbjxb4h4c1atlau3ygvvdn
74975
74974
2026-08-24T00:44:28Z
Robertsky
10424
1 versaun husi [[:en:Module:Transclusion_count/data/R]]
74974
Scribunto
text/plain
return {
["R"] = 36000,
["R/ref"] = 36000,
["R/superscript"] = 113000,
["R/where"] = 113000,
["RA"] = 11000,
["RCS"] = 5500,
["REVISIONUSER2"] = 64000,
["RMS"] = 6400,
["RMnac"] = 3200,
["ROM"] = 2700,
["ROU"] = 7500,
["RSA"] = 5200,
["RSS-Atom_feed_notice"] = 222000,
["RTGS"] = 2900,
["RT_data"] = 4100,
["RUS"] = 15000,
["R_Wikidata"] = 2200,
["R_alt"] = 2900,
["R_ambig"] = 16000,
["R_avoided_double_redirect"] = 204000,
["R_cat_shell"] = 12000,
["R_category_shell"] = 15000,
["R_from_ASCII-only"] = 240000,
["R_from_ATC_code"] = 4700,
["R_from_ATCvet_code"] = 5400,
["R_from_British_English"] = 2700,
["R_from_DOI_prefix"] = 7700,
["R_from_IMO_number"] = 4600,
["R_from_ISO_4"] = 42000,
["R_from_ISO_4_abbreviation"] = 47000,
["R_from_ISO_639"] = 8800,
["R_from_ISO_639_code"] = 9000,
["R_from_NLM"] = 4600,
["R_from_NLM_abbreviation"] = 4700,
["R_from_UK_road"] = 3000,
["R_from_UN/LOCODE"] = 7100,
["R_from_US_postal_abbreviation"] = 44000,
["R_from_Unicode"] = 28000,
["R_from_Unicode_character"] = 32000,
["R_from_abbreviation"] = 27000,
["R_from_acronym"] = 3000,
["R_from_adjective"] = 7900,
["R_from_airport_code"] = 7000,
["R_from_album"] = 18000,
["R_from_alt_name"] = 5300,
["R_from_alternate_name"] = 21000,
["R_from_alternate_spelling"] = 7200,
["R_from_alternative_capitalisation"] = 9100,
["R_from_alternative_capitalization"] = 4600,
["R_from_alternative_disambiguation"] = 6300,
["R_from_alternative_hyphenation"] = 323000,
["R_from_alternative_language"] = 91000,
["R_from_alternative_name"] = 300000,
["R_from_alternative_punctuation"] = 33000,
["R_from_alternative_scientific_name"] = 160000,
["R_from_alternative_spacing"] = 16000,
["R_from_alternative_spelling"] = 80000,
["R_from_alternative_title"] = 10000,
["R_from_alternative_transliteration"] = 7300,
["R_from_ambiguous"] = 3000,
["R_from_ambiguous_page"] = 7800,
["R_from_ambiguous_sort_name"] = 40000,
["R_from_ambiguous_term"] = 53000,
["R_from_avoided_double_redirect"] = 7500,
["R_from_birth_name"] = 14000,
["R_from_book"] = 5500,
["R_from_case_citation"] = 3300,
["R_from_category_navigation"] = 4400,
["R_from_chemical_formula"] = 9200,
["R_from_comment_subpage"] = 22000,
["R_from_diacritic"] = 11000,
["R_from_diacritics"] = 2100,
["R_from_domain_name"] = 15000,
["R_from_draft"] = 4000,
["R_from_draft_namespace"] = 5900,
["R_from_drug_trade_name"] = 23000,
["R_from_emoji"] = 3400,
["R_from_fictional_character"] = 57000,
["R_from_fictional_element"] = 5700,
["R_from_fictional_location"] = 2400,
["R_from_film"] = 2100,
["R_from_former_name"] = 33000,
["R_from_full_name"] = 13000,
["R_from_gene_symbol"] = 10000,
["R_from_given_name"] = 3200,
["R_from_incomplete_disambiguation"] = 61000,
["R_from_incomplete_name"] = 2600,
["R_from_incorrect_disambiguation"] = 5700,
["R_from_incorrect_name"] = 14000,
["R_from_initialism"] = 27000,
["R_from_initials"] = 4200,
["R_from_legislation"] = 3300,
["R_from_less_specific_name"] = 5100,
["R_from_list_topic"] = 21000,
["R_from_long"] = 6600,
["R_from_long_name"] = 108000,
["R_from_longer_name"] = 17000,
["R_from_member"] = 6700,
["R_from_merge"] = 77000,
["R_from_miscapitalisation"] = 42000,
["R_from_miscapitalization"] = 5900,
["R_from_misspelling"] = 68000,
["R_from_modification"] = 465000,
["R_from_molecular_formula"] = 6800,
["R_from_monotypic_taxon"] = 8100,
["R_from_more_specific_geographic_name"] = 2800,
["R_from_more_specific_name"] = 6300,
["R_from_move"] = 3050000,
["R_from_move/except"] = 3050000,
["R_from_name_with_title"] = 6600,
["R_from_nickname"] = 3200,
["R_from_old_AfC_draft"] = 29000,
["R_from_other_capitalisation"] = 418000,
["R_from_other_capitalization"] = 6500,
["R_from_other_disambiguation"] = 21000,
["R_from_other_language"] = 2900,
["R_from_other_name"] = 8100,
["R_from_other_punctuation"] = 2000,
["R_from_other_spelling"] = 2800,
["R_from_person"] = 14000,
["R_from_personal_name"] = 3100,
["R_from_plural"] = 39000,
["R_from_product_name"] = 2500,
["R_from_pseudonym"] = 2900,
["R_from_railroad_name_with_ampersand"] = 2300,
["R_from_related_term"] = 2200,
["R_from_related_topic"] = 7100,
["R_from_related_word"] = 17000,
["R_from_remote_page"] = 12000,
["R_from_remote_talk_page"] = 30000,
["R_from_school"] = 3500,
["R_from_scientific_name"] = 36000,
["R_from_short"] = 5500,
["R_from_short_name"] = 117000,
["R_from_shortcut"] = 48000,
["R_from_shorter_name"] = 2500,
["R_from_shorter_title"] = 5200,
["R_from_song"] = 60000,
["R_from_sort_name"] = 188000,
["R_from_species_to_genus"] = 4800,
["R_from_stylization"] = 2000,
["R_from_subpage"] = 41000,
["R_from_subtopic"] = 83000,
["R_from_surname"] = 33000,
["R_from_symbol"] = 3100,
["R_from_synonym"] = 6500,
["R_from_taxonomic_synonym"] = 2500,
["R_from_television_episode"] = 63000,
["R_from_template_shortcut"] = 4700,
["R_from_title_with_diacritics"] = 5800,
["R_from_title_without_diacritics"] = 392000,
["R_from_trade_name"] = 23000,
["R_from_typo"] = 4000,
["R_from_unnecessary_disambiguation"] = 48000,
["R_from_work"] = 2800,
["R_from_year"] = 4100,
["R_hatnote"] = 3000,
["R_list_topic"] = 11000,
["R_mentioned_in_hatnote"] = 12000,
["R_miscap"] = 3000,
["R_move"] = 2300,
["R_printworthy"] = 94000,
["R_protected"] = 11000,
["R_protected/excon"] = 2500,
["R_protected/semi"] = 6300,
["R_sect"] = 3500,
["R_section"] = 24000,
["R_shell"] = 22000,
["R_to_Swiss_municipality_(,_Switzerland)"] = 2300,
["R_to_Swiss_municipality_(canton)"] = 3500,
["R_to_Swiss_municipality_2L"] = 2600,
["R_to_TV_episode_list_entry"] = 9100,
["R_to_alternative_scientific_name"] = 3200,
["R_to_anchor"] = 113000,
["R_to_category_namespace"] = 6500,
["R_to_century"] = 2700,
["R_to_diacritic"] = 422000,
["R_to_diacritics"] = 3900,
["R_to_disambiguation"] = 4000,
["R_to_disambiguation_page"] = 289000,
["R_to_list"] = 39000,
["R_to_list_entry"] = 94000,
["R_to_monotypic_taxon"] = 17000,
["R_to_plural"] = 4900,
["R_to_project"] = 2600,
["R_to_project_namespace"] = 26000,
["R_to_redirect_template"] = 4800,
["R_to_related_topic"] = 95000,
["R_to_scientific_name"] = 105000,
["R_to_section"] = 427000,
["R_to_short_name"] = 4400,
["R_to_stub_template"] = 5000,
["R_to_subpage"] = 8000,
["R_to_subtopic"] = 4200,
["R_to_transliteration"] = 15000,
["R_unprintworthy"] = 98000,
["R_with_Wikidata_item"] = 50000,
["R_with_history"] = 21000,
["R_with_possibilities"] = 127000,
["Racing-Reference_driver"] = 2900,
["Radio_Relay"] = 3600,
["Radio_formats"] = 11000,
["Rail-interchange"] = 42000,
["RailGauge"] = 10000,
["Rail_color"] = 38000,
["Rail_color_box"] = 15000,
["Rail_icon"] = 22000,
["Rail_line"] = 9700,
["Rail_navbox_titlestyle"] = 14000,
["Rail_pass_box"] = 18000,
["Rail_start"] = 2100,
["Rail_template_doc"] = 2300,
["Railway-routemap"] = 4600,
["Railway_division_link"] = 5000,
["Railway_stations_in_countryname_opened_in_YYYY_category_header"] = 3100,
["Railway_stations_in_countryname_opened_or_closed_in_YYYY_category_header"] = 5300,
["Railway_stations_in_countryname_opened_or_closed_in_YYYY_category_header/core"] = 5300,
["Rand"] = 5300,
["Random_number"] = 5600,
["Random_page_in_category"] = 5600,
["Random_subpage"] = 7800,
["Ranking_movements"] = 4800,
["Rating"] = 101000,
["Rating-Christgau"] = 2700,
["Rayment"] = 2000,
["Rayment-hc"] = 6400,
["Razavi_Khorasan_Province"] = 2400,
["Rbox"] = 2200,
["Rcat_shell"] = 268000,
["Rcatsh"] = 9800,
["Rcatshell"] = 5800,
["Rcb"] = 10000,
["Rcr"] = 30000,
["Rcs"] = 4500,
["Re"] = 89000,
["Recent_AfDs"] = 5400,
["Recent_AfDs/core"] = 5400,
["Red"] = 54000,
["Redacted"] = 3200,
["Redirect"] = 62000,
["Redirect-Class"] = 13000,
["Redirect-distinguish"] = 5200,
["Redirect_category"] = 5000,
["Redirect_category_shell"] = 4140000,
["Redirect_from_modification"] = 3200,
["Redirect_from_move"] = 3700,
["Redirect_italic_title"] = 2100,
["Redirect_shell"] = 326000,
["Redirect_template"] = 7860000,
["Redirect_to_section"] = 3600,
["Redr"] = 9300,
["Ref"] = 24000,
["Ref."] = 2300,
["Ref_heading"] = 2500,
["Ref_improve"] = 2500,
["Ref_label"] = 13000,
["Refbegin"] = 225000,
["Refbegin/styles.css"] = 225000,
["Refend"] = 225000,
["Reference_column_heading"] = 11000,
["Reference_page"] = 80000,
["Refh"] = 4700,
["Refideas"] = 30000,
["Refimprove"] = 76000,
["Reflist"] = 6550000,
["Reflist-talk"] = 109000,
["Reflist-talk/styles.css"] = 110000,
["Reflist/styles.css"] = 6550000,
["Reflist_talk"] = 7900,
["Refn"] = 43000,
["Reftalk"] = 9500,
["Region_history_sidebar_title"] = 5900,
["Registration_required"] = 7800,
["Reign"] = 5800,
["Related_molecular_formulas"] = 2400,
["ReleaseVersionParameters"] = 2100,
["Release_version_parameters"] = 2100,
["Reliable_sources_for_medical_articles"] = 14000,
["Remove_accents"] = 9000,
["Remove_file_prefix"] = 2200,
["Remove_first_word"] = 190000,
["Remove_last_word"] = 21000,
["Repeat_vandal"] = 2700,
["Repeated_IP_abuse"] = 5200,
["Repeatvandal"] = 2200,
["Replace"] = 1150000,
["Reply"] = 24000,
["Reply_to"] = 372000,
["Replyto"] = 19000,
["Republican_Party_(US)/meta/shading"] = 19000,
["Reqmapin"] = 2500,
["Reqphoto"] = 72000,
["Request_and_endorse"] = 2500,
["Request_edit_button"] = 12000,
["Request_edit_button/styles.css"] = 12000,
["Requestandendorse"] = 2400,
["Resbox"] = 3400,
["Resize"] = 152000,
["Resizediv"] = 14000,
["Resolve_category_redirect"] = 1370000,
["Resolved"] = 18000,
["Respell"] = 24000,
["Respond"] = 76000,
["Resume-like"] = 4300,
["Retired"] = 11000,
["Retrieved"] = 3200,
["Reverse_date"] = 56000,
["Reviewer_topicon"] = 2700,
["RfA_watchlist_notice"] = 7300,
["RfA_watchlist_notice/text"] = 7300,
["Rfd_log_header"] = 7300,
["Ribbon_devices"] = 5200,
["Ribbon_devices/alt"] = 5200,
["Ribbon_devices/device"] = 4100,
["Ribbon_devices/device_layout"] = 4100,
["Ric"] = 17000,
["Right"] = 6600,
["Right-pointing_double_angles"] = 2900,
["Right_angles"] = 2900,
["Right_ascension"] = 11000,
["Rint"] = 31000,
["Rlp"] = 11000,
["Rlp/Positions"] = 11000,
["Rmri"] = 3900,
["Rnd"] = 8400,
["Rollback_topicon"] = 3300,
["Roman"] = 3600,
["Romania_metadata_Wikidata"] = 3200,
["RomanianSoccer"] = 2400,
["Rotten-tomatoes"] = 9100,
["Rotten_Tomatoes"] = 26000,
["Rotten_Tomatoes_data"] = 6500,
["Rotten_Tomatoes_prose"] = 6700,
["Round"] = 61000,
["Round4-with_third"] = 3500,
["Round_corners"] = 9700,
["Rounddown"] = 4100,
["RouteBox"] = 9700,
["Routemap"] = 30000,
["Routemap/embeded_text"] = 9400,
["Routemap/if_empty_codes"] = 5100,
["Routemap/styles.css"] = 31000,
["RoutemapRouteIcon"] = 4000,
["Row_hover_highlight"] = 2900,
["Row_hover_highlight/styles.css"] = 2900,
["Royal_Australian_Navy_ship"] = 6700,
["Royal_Canadian_Navy_ship"] = 5300,
["Royal_Mail_ship"] = 6400,
["Royal_Netherlands_Navy_ship"] = 3300,
["Rp"] = 76000,
["Rshell"] = 10000,
["Rtl-para"] = 2100,
["Rto"] = 3500,
["Ru"] = 3700,
["Ru-census"] = 7500,
["Ru-census2002"] = 5700,
["Ru-census2010"] = 7500,
["Ru-pop-ref"] = 9900,
["Rugby_box"] = 3600,
["Rugby_league_positions"] = 11000,
["Rugby_league_positions/Positions"] = 11000,
["Rugby_league_records"] = 2000,
["Rugby_league_squad2_coach"] = 2800,
["Rugby_union"] = 3700,
["Rugby_union_team"] = 5300,
["Rugby_union_team/link"] = 5300,
["Rugbybox"] = 3600,
["RussiaAdmMunRef"] = 5800,
["Russia_Time_Zone_Wikidata"] = 6700,
["Russia_Time_Zone_Wikidata/getQID"] = 6500,
["Russia_by_federal_subject_category_navigation"] = 3000,
["Rut"] = 5300,
["Rwd"] = 5000,
["Rws"] = 27000,
["Module:R_avoided_double_redirect"] = 204000,
["Module:Rail-interchange_multi"] = 15000,
["Module:Random"] = 13000,
["Module:Ranking_movements"] = 4800,
["Module:Ranking_movements/styles.css"] = 4800,
["Module:Redirect"] = 4990000,
["Module:Redirect-distinguish"] = 5200,
["Module:RedirectData"] = 48000,
["Module:Redirect_hatnote"] = 64000,
["Module:Redirect_template"] = 7860000,
["Module:Redirect_template_handler"] = 29000,
["Module:Reply_to"] = 372000,
["Module:ResolveEntityId"] = 503000,
["Module:Resolve_category_redirect"] = 1760000,
["Module:Respell"] = 24000,
["Module:RfD"] = 2400,
["Module:Rivals.com_recruit_url"] = 2500,
["Module:Road_data"] = 18000,
["Module:Road_data/RJL_types"] = 17000,
["Module:Road_data/banners/USA"] = 9500,
["Module:Road_data/browse"] = 18000,
["Module:Road_data/browsetable"] = 18000,
["Module:Road_data/browsetable/styles.css"] = 18000,
["Module:Road_data/countrymask"] = 35000,
["Module:Road_data/extra"] = 32000,
["Module:Road_data/locations"] = 12000,
["Module:Road_data/parser"] = 42000,
["Module:Road_data/parser/hooks"] = 20000,
["Module:Road_data/parser/namespace"] = 4300,
["Module:Road_data/size"] = 18000,
["Module:Road_data/strings/ASIA"] = 9100,
["Module:Road_data/strings/CAN"] = 5000,
["Module:Road_data/strings/EUR"] = 5800,
["Module:Road_data/strings/IND"] = 2300,
["Module:Road_data/strings/JPN"] = 3500,
["Module:Road_data/strings/USA"] = 21000,
["Module:Road_data/strings/USA/regional/GRR"] = 21000,
["Module:Road_data/strings/USA/regional/NER"] = 21000,
["Module:Road_data/strings/USA/regional/Tour"] = 21000,
["Module:Road_data/strings/USA/regional/Trails"] = 21000,
["Module:Road_data/util"] = 43000,
["Module:Roman"] = 6400,
["Module:Rotten_Tomatoes_data"] = 6500,
["Module:RoundN"] = 13000,
["Module:Routemap"] = 31000,
["Module:Rugby_box"] = 3600,
["Module:Russia_by_federal_subject_category_navigation"] = 3000,
}
fkxb6cisbbbjxb4h4c1atlau3ygvvdn
Módulo:Format TemplateData
828
8434
75034
73464
2026-07-23T06:01:42Z
en>A876
0
DON'T check for Module:JSONutil. (to stop this template from making ghost transclusion entries on many pages)
75034
Scribunto
text/plain
local TemplateData = {
item = 46997995,
serial = "2025-02-07",
suite = "TemplateData"
}
local Failsafe = TemplateData
local Config = {
-- Multiple option names mapped into unique internal fields.
basicCnf = {
catProblem = "strange",
classMultiColumns = "selMultClm",
classNoNumTOC = "suppressTOCnum",
classTable = "classTable",
cssParWrap = "cssTabWrap",
cssParams = "cssTable",
docpageCreate = "suffix",
docpageDetect = "subpage",
helpAliases = "supportAliases",
helpBoolean = "support4boolean",
helpContent = "support4content",
helpDate = "support4date",
helpDefault = "support4default",
helpFile = "support4wiki-file-name",
helpFormat = "supportFormat",
helpLine = "support4line",
helpNumber = "support4number",
helpPage = "support4wiki-page-name",
helpString = "support4string",
helpTemplate = "support4wiki-template-name",
helpURL = "support4url",
helpUser = "support4wiki-user-name",
msgDescMiss = "solo",
tStylesMultiColumns = "stylesMultClm",
tStylesTOCnum = "stylesTOCnum"
},
classTable = { "wikitable" }, -- Classes for params table
cssTable = false, -- Styles for params table
cssTabWrap = false, -- Styles for params table wrapper
debug = false,
debugmultilang = "#c0c0c0",
jsonDebug = "json-code-lint", -- Class for jsonDebug tool
loudly = false, -- Show exported element, etc.
solo = false, -- Complaint on missing description
strange = false, -- Title of maintenance category
subpage = false, -- Pattern to identify subpage
suffix = false, -- Subpage creation scheme
suppressTOCnum = false -- Class for TOC number suppression
}
local Data = {
div = false, -- <div class="mw-templatedata-doc-wrap">
got = false, -- table, initial templatedata object
heirs = false, -- table, params that are inherited
jump = false, -- source position at end of "params"
less = false, -- main description missing
lasting = false, -- old syntax encountered
lazy = false, -- doc mode; do not generate effective <templatedata>
leading = false, -- show TOC
-- low = false, -- 1= mode
order = false, -- parameter sequence
params = false, -- table, exported parameters
scream = false, -- error messages
sibling = false, -- TOC juxtaposed
slang = nil, -- project/user language code
slim = false, -- JSON reduced to plain
source = false, -- JSON input
strip = false, -- <templatedata> evaluation
tag = false, -- table, exported root element
title = false, -- page
tree = false -- table, rewritten templatedata object
}
local Permit = {
builder = {
after = "block",
align = "block",
block = "block",
compressed = "block",
dense = "block",
grouped = "inline",
half = "inline",
indent = "block",
inline = "inline",
last = "block",
lead = "block",
newlines = "*",
spaced = "inline"
},
colors = {
bg = "var(--background-color-base, #fff)",
deprecated = "#ffcbcb",
fg = "var(--color-base, #000)",
optional = "#eaecf0",
required = "#eaf3ff",
suggested = "#fff",
tableheadbg = "var(--background-color-progressive-subtle, #b3b7ff)"
},
params = {
aliases = "table",
autovalue = "string",
default = "string table I18N nowiki",
deprecated = "boolean string I18N",
description = "string table I18N",
example = "string table I18N nowiki",
inherits = "string",
label = "string table I18N",
required = "boolean",
style = "string table",
suggested = "boolean",
suggestedvalues = "string table number boolean",
type = "string"
},
root = {
description = "string table I18N",
format = "string",
maps = "table",
paramOrder = "table",
params = "table",
sets = "table"
},
search = "[{,]%%s*(['\"])%s%%1%%s*:%%s*%%{",
types = {
boolean = true,
content = true,
date = true,
line = true,
number = true,
string = true,
unknown = true,
url = true,
["string/line"] = "line",
["string/wiki-page-name"] = "wiki-page-name",
["string/wiki-user-name"] = "wiki-user-name",
["unbalanced-wikitext"] = true,
["wiki-file-name"] = true,
["wiki-page-name"] = true,
["wiki-template-name"] = true,
["wiki-user-name"] = true
}
}
local function Fault(alert)
-- Memorize error message.
-- Parameter:
-- alert -- string, error message
if Data.scream then
Data.scream = string.format("%s *** %s", Data.scream, alert)
else
Data.scream = alert
end
end -- Fault()
local function Fetch(ask, allow)
-- Fetch module.
-- Parameter:
-- ask -- string, with name
-- "/global"
-- "JSONutil"
-- "Multilingual"
-- "Text"
-- "WLink"
-- allow -- true: no error if unavailable
-- Returns table of module
-- Error: Module not available
local sign = ask
local r, stem
if sign:sub(1, 1) == "/" then
sign = TemplateData.frame:getTitle() .. sign
else
stem = sign
sign = "Module:" .. stem
end
if TemplateData.extern then
r = TemplateData.extern[sign]
else
TemplateData.extern = {}
end
if not r then
local lucky, g = pcall(require, sign)
if type(g) == "table" then
if stem and type(g[stem]) == "function" then
r = g[stem]()
else
r = g
end
TemplateData.extern[sign] = r
elseif not allow then
error(string.format("Fetch(%s) %s", sign, g), 0)
end
end
return r
end -- Fetch()
local function Foreign()
-- Guess human language, returns slang or not.
if type(Data.slang) == "nil" then
local Multilingual = Fetch("Multilingual", true)
if Multilingual and type(Multilingual.userLangCode) == "function" then
Data.slang = Multilingual.userLangCode()
else
Data.slang = mw.language.getContentLanguage():getCode():lower()
end
end
if Data.slang and mw.ustring.codepoint(Data.slang, 1, 1) > 122 then
Data.slang = false
end
return Data.slang
end -- Foreign()
local function facet(ask, at)
-- Find physical position of parameter definition in JSON.
-- Parameter:
-- ask -- string, parameter name
-- at -- number, physical position within definition
-- Returns number or nil.
local seek = string.format(Permit.search, ask:gsub("%%", "%%%%"):gsub("([%-.()+*?^$%[%]])", "%%%1"))
local i, k, r, slice, source
if not Data.jump then
Data.jump = Data.source:find("params", 2)
if Data.jump then
Data.jump = Data.jump + 7
else
Data.jump = 1
end
end
i, k = Data.source:find(seek, at + Data.jump)
while i and not r do
source = Data.source:sub(k + 1)
slice = source:match('^%s*"([^"]+)"s*:')
if not slice then
slice = source:match("^%s*'([^']+)'%s*:")
end
if (slice and Permit.params[slice]) or source:match("^%s*%}") then
r = k
else
i, k = Data.source:find(seek, k)
end
end -- while i
return r
end -- facet()
local function facilities(apply)
-- Retrieve details of suggestedvalues.
-- Parameter:
-- apply -- table, with plain or enhanced values
-- .suggestedvalues -- table|string|number, or more
-- Returns
-- 1 -- table, with suggestedvalues
-- 2 -- table, with CSS map, or not
-- 3 -- string, with class, or not
-- 4 -- string, with templatestyles, or not
local elements = apply.suggestedvalues
local s = type(elements)
local r1, r2, r3, r4
if s == "table" then
local values = elements.values
if type(values) == "table" then
r1 = values
if type(elements.scroll) == "string" then
r2 = r2 or {}
r2.height = apply.scroll
r2.overflow = "auto"
end
if type(elements.minwidth) == "string" then
local s = type(elements.maxcolumns)
r2 = r2 or {}
r2["column-width"] = elements.minwidth
if s == "string" or s == "number" then
s = tostring(elements.maxcolumns)
r2["column-count"] = s
end
if type(Config.selMultClm) == "string" then
r3 = Config.selMultClm
end
if type(Config.stylesMultClm) == "string" then
local src = Config.stylesMultClm .. "/styles.css"
r4 = TemplateData.frame:extensionTag("templatestyles", nil, { src = src })
end
end
elseif elements and elements ~= "" then
r1 = elements
end
elseif s == "string" then
s = mw.text.trim(about)
if s ~= "" then
r1 = {}
table.insert(r1, { code = s })
end
elseif s == "number" then
r1 = {}
table.insert(r1, { code = tostring(elements) })
end
return r1, r2, r3, r4
end -- facilities()
local function factory(adapt)
-- Retrieve localized text from system message.
-- Parameter:
-- adapt -- string, message ID after "templatedata-"
-- Returns string, with localized text
local o = mw.message.new("templatedata-" .. adapt)
if Foreign() then
o:inLanguage(Data.slang)
end
return o:plain()
end -- factory()
local function faculty(adjust)
-- Test template argument for Boolean.
-- adjust -- string or nil
-- Returns boolean.
local s = type(adjust)
local r
if s == "string" then
r = mw.text.trim(adjust)
r = (r ~= "" and r ~= "0")
elseif s == "boolean" then
r = adjust
else
r = false
end
return r
end -- faculty()
local function failures()
-- Retrieve error collection and category, returns string.
local r
if Data.scream then
local e = mw.html.create("span"):addClass("error"):wikitext(Data.scream)
r = tostring(e)
mw.addWarning("'''TemplateData'''<br />" .. Data.scream)
if Config.strange then
r = string.format("%s[[category:%s]]", r, Config.strange)
end
else
r = ""
end
return r
end -- failures()
local function fair(adjust)
-- Reduce text to one line of plain text, or noexport wikitext blocks.
-- adjust -- string
-- Returns string with adjusted text.
local f = function(a)
return a:gsub("%s*\n%s*", " "):gsub("%s%s+", " ")
end
local tags = {
{
start = "<noexport>",
stop = "</noexport>",
},
{
start = "<exportonly>",
stop = "</exportonly>",
l = false,
},
}
local r = adjust
local i, j, k, s, tag
for m = 1, 2 do
tag = tags[m]
if r:find(tag.start, 1, true) then
s = r
r = ""
i = 1
tag.l = true
j, k = s:find(tag.start, i, true)
while j do
if j > 1 then
r = r .. f(s:sub(i, j - 1))
end
i = k + 1
j, k = s:find(tag.stop, i, true)
if j then
if m == 1 then
r = r .. s:sub(i, j - 1)
end
i = k + 1
j, k = s:find(tag.start, i, true)
else
Fault("missing " .. tag.stop)
end
end -- while j
r = r .. s:sub(i)
elseif m == 1 then
r = f(r)
end
end -- for m
if tags[2].l then
r = r:gsub("<exportonly>.*</exportonly>", "")
end
return r
end -- fair()
local function fancy(advance, alert)
-- Present JSON source.
-- Parameter:
-- advance -- true, for nice
-- alert -- true, for visible
-- Returns string.
local r
if Data.source then
local support = Config.jsonDebug
local css
if advance then
css = {
height = "6em",
resize = "vertical",
}
r = {
[1] = "syntaxhighlight",
[2] = Data.source,
lang = "json",
style = table.concat(css, ";"),
}
if alert then
r.class(support)
end
r = TemplateData.frame:callParserFunction("#tag", r)
else
css = {
["font-size"] = "0.77em",
["line-height"] = "1.35",
}
if alert then
css.resize = "vertical"
else
css.display = "none"
end
r = mw.html.create("pre"):addClass(support):css(css):wikitext(mw.text.encode(Data.source))
r = tostring(r)
end
r = "\n" .. r
else
r = ""
end
return r
end -- fancy()
local function faraway(alternatives)
-- Retrieve best language version from multilingual text.
-- Parameter:
-- alternatives -- table, to be evaluated
-- Returns
-- 1 -- string, with best match
-- 2 -- table of other versions, if any
local n = 0
local variants = {}
local r1, r2
for k, v in pairs(alternatives) do
if type(v) == "string" then
v = mw.text.trim(v)
if v ~= "" and type(k) == "string" then
k = k:lower()
variants[k] = v
n = n + 1
end
end
end -- for k, v
if n > 0 then
local Multilingual = Fetch("Multilingual", true)
if Multilingual and type(Multilingual.i18n) == "function" then
local show, slang = Multilingual.i18n(variants)
if show then
r1 = show
variants[slang] = nil
r2 = variants
end
end
if not r1 then
Foreign()
for k, v in pairs(variants) do
if n == 1 then
r1 = v
elseif Data.slang == k then
variants[k] = nil
r1 = v
r2 = variants
end
end -- for k, v
end
if r2 and Multilingual then
for k, v in pairs(r2) do
if v and not Multilingual.isLang(k, true) then
Fault(string.format("%s <code>lang=%s</code>", "Invalid", k))
end
end -- for k, v
end
end
return r1, r2
end -- faraway()
local function fashioned(about, asked, assign)
-- Create description head.
-- Parameter:
-- about -- table, supposed to contain description
-- asked -- true, if mandatory description
-- assign -- <block>, if to be equipped
-- Returns <block> with head, or nil.
local para = assign or mw.html.create("div")
local plus, r
if about and about.description then
if type(about.description) == "string" then
para:wikitext(about.description)
else
para:wikitext(about.description[1])
plus = mw.html.create("ul")
plus:css("text-align", "left")
for k, v in pairs(about.description[2]) do
plus:node(
mw.html
.create("li")
:node(mw.html.create("code"):wikitext(k))
:node(mw.html.create("br"))
:wikitext(fair(v))
)
end -- for k, v
if Config.loudly then
plus = mw.html
.create("div")
:css("background-color", Config.debugmultilang)
:css("color", "inherit")
:node(plus)
else
plus:addClass("templatedata-maintain"):css("display", "none")
end
end
elseif Config.solo and asked then
para:addClass("error"):wikitext(Config.solo)
Data.less = true
else
para = false
end
if para then
if plus then
r = mw.html.create("div"):node(para):node(plus)
else
r = para
end
end
return r
end -- fashioned()
local function fatten(access)
-- Create table row for subheadline.
-- Parameter:
-- access -- string, with name
-- Returns <tr>.
local param = Data.tree.params[access]
local sub, sort = access:match("(=+)%s*(%S.*)$")
local headline = mw.html.create(string.format("h%d", #sub))
local r = mw.html.create("tr")
local td = mw.html.create("td"):attr("colspan", "5"):attr("data-sort-value", "!" .. sort)
local s
if param.style then
s = type(param.style)
if s == "table" then
td:css(param.style)
elseif s == "string" then
td:cssText(param.style)
end
end
s = fashioned(param, false, headline)
if s then
headline = s
else
headline:wikitext(sort)
end
td:node(headline)
r:node(td)
return r
end -- fatten()
local function fathers()
-- Merge parameters with inherited values.
local n = 0
local p = Data.params
local t = Data.tree.params
local p2, t2
for k, v in pairs(Data.heirs) do
n = n + 1
end -- for k, v
for i = 1, n do
if Data.heirs then
for k, v in pairs(Data.heirs) do
if v and not Data.heirs[v] then
n = n - 1
t[k].inherits = nil
Data.heirs[k] = nil
p2 = {}
t2 = {}
if p[v] then
for k2, v2 in pairs(p[v]) do
p2[k2] = v2
end -- for k2, v2
if p[k] then
for k2, v2 in pairs(p[k]) do
if type(v2) ~= "nil" then
p2[k2] = v2
end
end -- for k2, v2
end
p[k] = p2
for k2, v2 in pairs(t[v]) do
t2[k2] = v2
end -- for k2, v2
for k2, v2 in pairs(t[k]) do
if type(v2) ~= "nil" then
t2[k2] = v2
end
end -- for k2, v2
t[k] = t2
else
Fault("No params[] inherits " .. v)
end
end
end -- for k, v
end
end -- i = 1, n
if n > 0 then
local s
for k, v in pairs(Data.heirs) do
if v then
if s then
s = string.format("%s | %s", s, k)
else
s = "Circular inherits: " .. k
end
end
end -- for k, v
Fault(s)
end
end -- fathers()
local function favorize()
-- Local customization issues.
local boole = { ["font-size"] = "1.25em" }
local l, cx = pcall(mw.loadData, TemplateData.frame:getTitle() .. "/config")
local scripting, style
TemplateData.ltr = not mw.language.getContentLanguage():isRTL()
if TemplateData.ltr then
scripting = "left"
else
scripting = "right"
end
boole["margin-" .. scripting] = "3em"
Permit.boole = {
[false] = {
css = boole,
lead = true,
show = "☐",
},
[true] = {
css = boole,
lead = true,
show = "☑",
},
}
Permit.css = {}
for k, v in pairs(Permit.colors) do
if k == "tableheadbg" then
k = "tablehead"
end
if k == "fg" then
style = "color"
else
style = "background-color"
end
Permit.css[k] = {}
Permit.css[k][style] = v
end -- for k, v
if type(cx) == "table" then
local c, s
if type(cx.permit) == "table" then
if type(cx.permit.boole) == "table" then
if type(cx.permit.boole[true]) == "table" then
Permit.boole[false] = cx.permit.boole[false]
end
if type(cx.permit.boole[true]) == "table" then
Permit.boole[true] = cx.permit.boole[true]
end
end
if type(cx.permit.css) == "table" then
for k, v in pairs(cx.permit.css) do
if type(v) == "table" then
Permit.css[k] = v
end
end -- for k, v
end
end
for k, v in pairs(Config.basicCnf) do
s = type(cx[k])
if s == "string" or s == "table" then
Config[v] = cx[k]
end
end -- for k, v
end
if type(Config.subpage) ~= "string" or type(Config.suffix) ~= "string" then
local got = mw.message.new("templatedata-doc-subpage")
local suffix
if got:isDisabled() then
suffix = "doc"
else
suffix = got:plain()
end
if type(Config.subpage) ~= "string" then
Config.subpage = string.format("/%s$", suffix)
end
if type(Config.suffix) ~= "string" then
Config.suffix = string.format("%%s/%s", suffix)
end
end
end -- favorize()
local function feasible(all, at, about)
-- Deal with suggestedvalues within parameter.
-- Parameter:
-- all -- parameter details
-- .default
-- .type
-- at -- string, with parameter name
-- about -- suggestedvalues -- table,
-- value and possibly description
-- table may have elements:
-- .code -- mandatory
-- .label -- table|string
-- .support -- table|string
-- .icon -- string
-- .class -- table|string
-- .css -- table
-- .style -- string
-- .less -- true: suppress code
-- Returns
-- 1: mw.html object <ul>
-- 2: sequence table with values, or nil
local h = {}
local e, r1, r2, s, v
if #about > 0 then
for i = 1, #about do
e = about[i]
s = type(e)
if s == "table" then
if type(e.code) == "string" then
s = mw.text.trim(e.code)
if s == "" then
e = nil
else
e.code = s
end
else
e = nil
s = string.format("params.%s.%s[%d] %s", at, "suggestedvalues", i, "MISSING 'code:'")
end
elseif s == "string" then
s = mw.text.trim(e)
if s == "" then
e = nil
s = string.format("params.%s.%s[%d] EMPTY", at, "suggestedvalues", i)
Fault(s)
else
e = { code = s }
end
elseif s == "number" then
e = { code = tostring(e) }
else
s = string.format("params.%s.%s[%d] INVALID", at, "suggestedvalues", i)
Fault(s)
e = false
end
if e then
v = v or {}
table.insert(v, e)
if h[e.code] then
s = string.format("params.%s.%s REPEATED %s", at, "suggestedvalues", e.code)
Fault(s)
else
h[e.code] = true
end
end
end -- for i
else
Fault(string.format("params.%s.suggestedvalues %s", at, "NOT AN ARRAY"))
end
if v then
local code, d, k, less, story, swift, t, u
r1 = mw.html.create("ul")
r2 = {}
for i = 1, #v do
u = mw.html.create("li")
e = v[i]
table.insert(r2, e.code)
story = false
less = (e.less == true)
if not less then
swift = e.code
if e.support then
local scream, support
s = type(e.support)
if s == "string" then
support = e.support
elseif s == "table" then
support = faraway(e.support)
else
scream = "INVALID"
end
if support then
s = mw.text.trim(support)
if s == "" then
scream = "EMPTY"
elseif s:find("[%[%]|%<%>]") then
scream = "BAD PAGE"
else
support = s
end
end
if scream then
s = string.format("params.%s.%s[%d].support %s", at, "suggestedvalues", i, scream)
Fault(s)
else
swift = string.format("[[:%s|%s]]", support, swift)
end
end
if all.type:sub(1, 5) == "wiki-" and swift == e.code then
local rooms = {
file = 6,
temp = 10,
user = 2,
}
local ns = rooms[all.type:sub(6, 9)] or 0
t = mw.title.makeTitle(ns, swift)
if t and t.exists then
swift = string.format("[[:%s|%s]]", t.prefixedText, swift)
end
end
if e.code == all.default then
k = 800
else
k = 300
end
code =
mw.html.create("code"):css("font-weight", tostring(k)):css("white-space", "nowrap"):wikitext(swift)
u:node(code)
end
if e.class then
s = type(e.class)
if s == "string" then
u:addClass(e.class)
elseif s == "table" then
for k, s in pairs(e.class) do
u:addClass(s)
end -- for k, s
else
s = string.format("params.%s.%s[%d].class INVALID", at, "suggestedvalues", i)
Fault(s)
end
end
if e.css then
if type(e.css) == "table" then
u:css(e.css)
else
s = string.format("params.%s.%s[%d].css INVALID", at, "suggestedvalues", i)
Fault(s)
end
end
if e.style then
if type(e.style) == "string" then
u:cssText(e.style)
else
s = string.format("params.%s.%s[%d].style INVALID", at, "suggestedvalues", i)
Fault(s)
end
end
if all.type == "wiki-file-name" and not e.icon then
e.icon = e.code
end
if e.label then
s = type(e.label)
if s == "string" then
s = mw.text.trim(e.label)
if s == "" then
s = string.format("params.%s.%s[%d].label %s", at, "suggestedvalues", i, "EMPTY")
Fault(s)
else
story = s
end
elseif s == "table" then
story = faraway(e.label)
else
s = string.format("params.%s.%s[%d].label INVALID", at, "suggestedvalues", i)
Fault(s)
end
end
s = false
if type(e.icon) == "string" then
t = mw.title.makeTitle(6, e.icon)
if t and t.file.exists then
local g = mw.html.create("span")
s = string.format("[[%s|16px]]", t.prefixedText)
g:attr("role", "presentation"):wikitext(s)
s = tostring(g)
end
end
if not s and not less and e.label then
s = mw.ustring.char(0x2013)
end
if s then
d = mw.html.create("span"):wikitext(s)
if TemplateData.ltr then
if not less then
d:css("margin-left", "0.5em")
end
if story then
d:css("margin-right", "0.5em")
end
else
if not less then
d:css("margin-right", "0.5em")
end
if story then
d:css("margin-left", "0.5em")
end
end
u:node(d)
end
if story then
u:wikitext(story)
end
r1:newline():node(u)
end -- for i
end
if not r1 and v ~= false then
Fault(string.format("params.%s.suggestedvalues INVALID", at))
r1 = mw.html.create("code"):addClass("error"):wikitext("INVALID")
end
return r1, r2
end -- feasible()
local function feat()
-- Check and store parameter sequence.
if Data.source then
local i = 0
local s
for k, v in pairs(Data.tree.params) do
if i == 0 then
Data.order = {}
i = 1
s = k
else
i = 2
break -- for k, v
end
end -- for k, v
if i > 1 then
local pointers = {}
local points = {}
local given = {}
for k, v in pairs(Data.tree.params) do
i = facet(k, 1)
if type(v) == "table" then
if type(v.label) == "string" then
s = mw.text.trim(v.label)
if s == "" then
s = k
end
else
s = k
end
if given[s] then
if given[s] == 1 then
local scream = "Parameter label '%s' detected multiple times"
Fault(string.format(scream, s))
given[s] = 2
end
else
given[s] = 1
end
end
if i then
table.insert(points, i)
pointers[i] = k
i = facet(k, i)
if i then
s = "Parameter '%s' detected twice"
Fault(string.format(s, k))
end
else
s = "Parameter '%s' not detected"
Fault(string.format(s, k))
end
end -- for k, v
table.sort(points)
for i = 1, #points do
table.insert(Data.order, pointers[points[i]])
end -- i = 1, #points
elseif s then
table.insert(Data.order, s)
end
end
end -- feat()
local function feature(access)
-- Create table row for parameter, check and display violations.
-- Parameter:
-- access -- string, with name
-- Returns <tr>.
local mode, s, status
local fine = function(a)
s = mw.text.trim(a)
return a == s and a ~= "" and not a:find("%|=\n") and not a:find("%s%s")
end
local begin = mw.html.create("td")
local code = mw.html.create("code")
local desc = mw.html.create("td")
local eager = mw.html.create("td")
local legal = true
local param = Data.tree.params[access]
local ranking = { "required", "suggested", "optional", "deprecated" }
local r = mw.html.create("tr")
local styles = "mw-templatedata-doc-param-"
local sort, typed
for k, v in pairs(param) do
if v == "" then
param[k] = false
end
end -- for k, v
-- label
sort = param.label or access
if sort:match("^%d+$") then
begin:attr("data-sort-value", string.format("%05d", tonumber(sort)))
end
begin:css("font-weight", "700"):wikitext(sort)
-- name and aliases
code:css("font-size", "0.92em"):css("white-space", "nowrap"):wikitext(access)
if not fine(access) then
code:addClass("error")
Fault(string.format("Bad ID params.<code>%s</code>", access))
legal = false
begin:attr("data-sort-value", " " .. sort)
end
code = mw.html.create("td"):addClass(styles .. "name"):node(code)
if access:match("^%d+$") then
code:attr("data-sort-value", string.format("%05d", tonumber(access)))
end
if type(param.aliases) == "table" then
local lapsus, syn
for k, v in pairs(param.aliases) do
code:tag("br")
if type(v) == "string" then
if not fine(v) then
lapsus = true
code:node(mw.html.create("span"):addClass("error"):css("font-style", "italic"):wikitext("string"))
:wikitext(s)
else
if Config.supportAliases then
s = string.format("[[%s|%s]]", Config.supportAliases, mw.text.nowiki(s))
end
syn = mw.html.create("span"):addClass(styles .. "alias"):css("white-space", "nowrap"):wikitext(s)
code:node(syn)
end
else
lapsus = true
code:node(mw.html.create("code"):addClass("error"):wikitext(type(v)))
end
end -- for k, v
if lapsus then
s = string.format("params.<code>%s</code>.aliases", access)
Fault(factory("invalid-value"):gsub("$1", s))
legal = false
end
end
-- description etc.
s = fashioned(param)
if s then
desc:node(s)
end
if param.style then
s = type(param.style)
if s == "table" then
desc:css(param.style)
elseif s == "string" then
desc:cssText(param.style)
end
end
if param.suggestedvalues or param.default or param.example or param.autovalue then
local details = {
"suggestedvalues",
"default",
"example",
"autovalue",
}
local dl = mw.html.create("dl")
local dd, section, show
for i = 1, #details do
s = details[i]
show = param[s]
if show then
dd = mw.html.create("dd")
section = factory("doc-param-" .. s)
if s == "default" and Config.support4default then
section = string.format("[[%s|%s]]", Config.support4default, mw.text.nowiki(section))
end
if param.type == "boolean" and (show == "0" or show == "1") then
local boole = Permit.boole[(show == "1")]
if boole.lead == true then
dd:node(mw.html.create("code"):wikitext(show)):wikitext(" ")
end
if type(boole.show) == "string" then
local v = mw.html.create("span"):attr("aria-hidden", "true"):wikitext(boole.show)
if boole.css then
v:css(boole.css)
end
dd:node(v)
end
if type(boole.suffix) == "string" then
dd:wikitext(boole.suffix)
end
if boole.lead == false then
dd:wikitext(" "):node(mw.html.create("code"):wikitext(show))
end
elseif s == "suggestedvalues" then
local v, css, class, ts = facilities(param)
if v then
local ul
ul, v = feasible(param, access, v)
if v then
dd:newline():node(ul)
if css then
dd:css(css)
if class then
dd:addClass(class)
end
if ts then
dd:newline()
dd:node(ts)
end
end
Data.params[access].suggestedvalues = v
end
end
else
dd:wikitext(show)
end
dl:node(mw.html.create("dt"):wikitext(section)):node(dd)
end
end -- i = 1, #details
desc:node(dl)
end
-- type
if type(param.type) == "string" then
param.type = mw.text.trim(param.type)
if param.type == "" then
param.type = false
end
end
if param.type then
s = Permit.types[param.type]
typed = mw.html.create("td"):addClass(styles .. "type")
if s then
if s == "string" then
Data.params[access].type = s
typed:wikitext(factory("doc-param-type-" .. s)):tag("br")
typed:node(mw.html.create("span"):addClass("error"):wikitext(param.type))
Data.lasting = true
else
local support = Config["support4" .. param.type]
s = factory("doc-param-type-" .. param.type)
if support then
s = string.format("[[%s|%s]]", support, s)
end
typed:wikitext(s)
end
else
Data.params[access].type = "unknown"
typed:addClass("error"):wikitext("INVALID")
s = string.format("params.<code>%s</code>.type", access)
Fault(factory("invalid-value"):gsub("$1", s))
legal = false
end
else
typed = mw.html.create("td"):wikitext(factory("doc-param-type-unknown"))
Data.params[access].type = "unknown"
if param.default then
Data.params[access].default = nil
Fault("Default value requires <code>type</code>")
legal = false
end
end
typed:addClass("navigation-not-searchable")
-- status
if param.required then
mode = 1
if param.autovalue then
Fault(string.format("autovalued <code>%s</code> required", access))
legal = false
end
if param.default then
Fault(string.format("Defaulted <code>%s</code> required", access))
legal = false
end
if param.deprecated then
Fault(string.format("Required deprecated <code>%s</code>", access))
legal = false
end
elseif param.deprecated then
mode = 4
elseif param.suggested then
mode = 2
else
mode = 3
end
status = ranking[mode]
ranking = factory("doc-param-status-" .. status)
if mode == 1 or mode == 4 then
ranking = mw.html.create("span"):css("font-weight", "700"):wikitext(ranking)
if type(param.deprecated) == "string" then
ranking:tag("br")
ranking:wikitext(param.deprecated)
end
if param.suggested and mode == 4 then
s = string.format("Suggesting deprecated <code>%s</code>", access)
Fault(s)
legal = false
end
end
eager
:attr("data-sort-value", tostring(mode))
:node(ranking)
:addClass(string.format("%sstatus-%s %s", styles, status, "navigation-not-searchable"))
-- <tr>
r:attr("id", "templatedata:" .. mw.uri.anchorEncode(access))
:css(Permit.css[status])
:addClass(styles .. status)
:node(begin)
:node(code)
:node(desc)
:node(typed)
:node(eager)
:newline()
if not legal then
r:css("border", "3px solid #f00")
end
return r
end -- feature()
local function features()
-- Create <table> for parameters.
-- Returns <table>, or nil.
local r
if Data.tree and Data.tree.params then
local tbl = mw.html.create("table")
local tr = mw.html.create("tr")
feat()
if Data.order and #Data.order > 1 then
tbl:addClass("sortable")
end
if type(Config.classTable) == "table" then
for k, v in pairs(Config.classTable) do
tbl:addClass(v)
end -- for k, v
end
if type(Config.cssTable) == "table" then
tbl:css(Config.cssTable)
end
tr:addClass("navigation-not-searchable")
:node(
mw.html.create("th"):attr("colspan", "2"):css(Permit.css.tablehead):wikitext(factory("doc-param-name"))
)
:node(mw.html.create("th"):css(Permit.css.tablehead):wikitext(factory("doc-param-desc")))
:node(mw.html.create("th"):css(Permit.css.tablehead):wikitext(factory("doc-param-type")))
:node(mw.html.create("th"):css(Permit.css.tablehead):wikitext(factory("doc-param-status")))
tbl
:newline()
-- :node( mw.html.create( "thead" )
:node(tr)
-- )
:newline()
if Data.order then
local leave, s
for i = 1, #Data.order do
s = Data.order[i]
if s:sub(1, 1) == "=" then
leave = true
tbl:node(fatten(s))
Data.order[i] = false
elseif s:match("[=|]") then
Fault(string.format("Bad param <code>%s</code>", s))
else
tbl:node(feature(s))
end
end -- for i = 1, #Data.order
if leave then
for i = #Data.order, 1, -1 do
if not Data.order[i] then
table.remove(Data.order, i)
end
end -- for i = #Data.order, 1, -1
end
Data.tag.paramOrder = Data.order
end
if Config.cssTabWrap or Data.scroll then
r = mw.html.create("div")
if type(Config.cssTabWrap) == "table" then
r:css(Config.cssTabWrap)
elseif type(Config.cssTabWrap) == "string" then
-- deprecated
r:cssText(Config.cssTabWrap)
end
if Data.scroll then
r:css("height", Data.scroll):css("overflow", "auto")
end
r:node(tbl)
else
r = tbl
end
end
return r
end -- features()
local function fellow(any, assigned, at)
-- Check sets[] parameter and issue error message, if necessary.
-- Parameter:
-- any -- should be number
-- assigned -- parameter name
-- at -- number, of set
local s
if type(any) ~= "number" then
s = "<code>sets[%d].params[%s]</code>??"
Fault(string.format(s, at, mw.text.nowiki(tostring(any))))
elseif type(assigned) == "string" then
if not Data.got.params[assigned] then
s = "<code>sets[%d].params %s</code> is undefined"
Fault(string.format(s, at, assigned))
end
else
s = "<code>sets[%d].params[%d] = %s</code>??"
Fault(string.format(s, k, type(assigned)))
end
end -- fellow()
local function fellows()
-- Check sets[] and issue error message, if necessary.
local s
if type(Data.got.sets) == "table" then
if type(Data.got.params) == "table" then
for k, v in pairs(Data.got.sets) do
if type(k) == "number" then
if type(v) == "table" then
for ek, ev in pairs(v) do
if ek == "label" then
s = type(ev)
if s ~= "string" and s ~= "table" then
s = "<code>sets[%d].label</code>??"
Fault(string.format(s, k))
end
elseif ek == "params" and type(ev) == "table" then
for pk, pv in pairs(ev) do
fellow(pk, pv, k)
end -- for pk, pv
else
ek = mw.text.nowiki(tostring(ek))
s = "<code>sets[%d][%s]</code>??"
Fault(string.format(s, k, ek))
end
end -- for ek, ev
else
k = mw.text.nowiki(tostring(k))
v = mw.text.nowiki(tostring(v))
s = string.format("<code>sets[%s][%s]</code>??", k, v)
Fault(s)
end
else
k = mw.text.nowiki(tostring(k))
s = string.format("<code>sets[%s]</code> ?????", k)
Fault(s)
end
end -- for k, v
else
s = "<code>params</code> required for <code>sets</code>"
Fault(s)
end
else
s = "<code>sets</code> needs to be of <code>object</code> type"
Fault(s)
end
end -- fellows()
local function finalize(advance)
-- Wrap presentation into frame.
-- Parameter:
-- advance -- true, for nice
-- Returns string.
local r, lapsus
if Data.div then
r = tostring(Data.div)
elseif Data.strip then
r = Data.strip
else
lapsus = true
r = ""
end
r = r .. failures()
if Data.source then
local live = (advance or lapsus)
if not live then
live = TemplateData.frame:preprocess("{{REVISIONID}}")
live = (live == "")
end
if live then
r = r .. fancy(advance, lapsus)
end
end
return r
end -- finalize()
local function find()
-- Find JSON data within page source (title).
-- Returns string, or nil.
local s = Data.title:getContent()
local i, j = s:find("<templatedata>", 1, true)
local r
if i then
local k = s:find("</templatedata>", j, true)
if k then
r = mw.text.trim(s:sub(j + 1, k - 1))
end
end
return r
end -- find()
local function flat(adjust)
-- Remove formatting from text string for VisualEditor.
-- Parameter:
-- arglist -- string, to be stripped, or nil
-- Returns string, or nil.
local r
if adjust then
r = adjust:gsub("\n", " ")
if r:find("<noexport>", 1, true) then
r = r:gsub("<noexport>.*</noexport>", "")
end
if r:find("<exportonly>", 1, true) then
r = r:gsub("</?exportonly>", "")
end
if r:find("''", 1, true) then
r = r:gsub("'''", ""):gsub("''", "")
end
if r:find("<", 1, true) then
local Text = Fetch("Text")
r = r:gsub("<br */?>", "\r\n"):gsub("<sup>2</sup>", "²"):gsub("<sup>3</sup>", "³")
r = Text.getPlain(r)
end
if r:find("[", 1, true) then
local WLink = Fetch("WLink")
if WLink.isBracketedURL(r) then
r = r:gsub("%[([hf]tt?ps?://%S+) [^%]]+%]", "%1")
end
r = WLink.getPlain(r)
end
if r:find("&", 1, true) then
r = mw.text.decode(r)
if r:find("­", 1, true) then
r = r:gsub("­", "")
end
end
end
return r
end -- flat()
local function flush()
-- JSON encode narrowed input; obey unnamed (numerical) parameters.
-- Returns <templatedata> JSON string.
local r
if Data.tag then
r = mw.text.jsonEncode(Data.tag):gsub("%}$", ",")
else
r = "{"
end
r = r .. '\n"params":{'
if Data.order then
local sep = ""
local s
for i = 1, #Data.order do
s = Data.order[i]
r = string.format("%s%s\n%s:%s", r, sep, mw.text.jsonEncode(s), mw.text.jsonEncode(Data.params[s]))
sep = ",\n"
end -- for i = 1, #Data.order
end
r = r .. "\n}\n}"
return r
end -- flush()
local function focus(access)
-- Check components; focus multilingual description, build trees.
-- Parameter:
-- access -- string, name of parameter, nil for root
local f = function(a, at)
local r
if at then
r = string.format("<code>params.%s</code>", at)
else
r = "''root''"
end
if a then
r = string.format("%s<code>.%s</code>", r, a)
end
return r
end
local parent
if access then
parent = Data.got.params[access]
else
parent = Data.got
end
if type(parent) == "table" then
local elem, permit, s, scope, slot, tag, target
if access then
permit = Permit.params
if type(access) == "number" then
slot = tostring(access)
else
slot = access
end
else
permit = Permit.root
end
for k, v in pairs(parent) do
scope = permit[k]
if scope then
s = type(v)
if s == "string" and k ~= "format" then
v = mw.text.trim(v)
end
if scope:find(s, 1, true) then
if scope:find("I18N", 1, true) then
if s == "string" then
elem = fair(v)
elseif s == "table" then
local translated
v, translated = faraway(v)
if v then
if translated and k == "description" then
elem = {
[1] = fair(v),
[2] = translated,
}
else
elem = fair(v)
end
else
elem = false
end
end
if type(v) == "string" then
if k == "deprecated" then
if v == "1" then
v = true
elseif v == "0" then
v = false
end
elem = v
elseif scope:find("nowiki", 1, true) then
elem = mw.text.nowiki(v)
elem = elem:gsub(" " .. string.char(10), "<br>")
v = v:gsub(string.char(13), "")
else
v = flat(v)
end
elseif s == "boolean" then
if scope:find("boolean", 1, true) then
elem = v
else
s = "Type <code>boolean</code> bad for " .. f(k, slot)
Fault(s)
end
end
else
if k == "params" and not access then
v = nil
elem = nil
elseif k == "format" and not access then
elem = mw.text.decode(v)
v = nil
elseif k == "inherits" then
elem = v
if not Data.heirs then
Data.heirs = {}
end
Data.heirs[slot] = v
v = nil
elseif k == "style" then
elem = v
v = nil
elseif s == "string" then
v = mw.text.nowiki(v)
elem = v
else
elem = v
end
end
if type(elem) ~= "nil" then
if not target then
if access then
if not Data.tree.params then
Data.tree.params = {}
end
Data.tree.params[slot] = {}
target = Data.tree.params[slot]
else
Data.tree = {}
target = Data.tree
end
end
target[k] = elem
elem = false
end
if type(v) ~= "nil" then
if not tag then
if access then
if type(v) == "string" and v.sub(1, 1) == "=" then
v = nil
else
if not Data.params then
Data.params = {}
end
Data.params[slot] = {}
tag = Data.params[slot]
end
else
Data.tag = {}
tag = Data.tag
end
end
if type(v) ~= "nil" and k ~= "suggestedvalues" then
tag[k] = v
end
end
else
s = string.format("Type <code>%s</code> bad for %s", scope, f(k, slot))
Fault(s)
end
else
Fault("Unknown component " .. f(k, slot))
end
end -- for k, v
if not access and Data.got.sets then
fellows()
end
else
Fault(f() .. " needs to be of <code>object</code> type")
end
end -- focus()
local function format()
-- Build formatted element.
-- Returns <inline>.
local source = Data.tree.format:lower()
local r, s
if source == "inline" or source == "block" then
r = mw.html.create("i"):wikitext(source)
else
local code
if source:find("|", 1, true) then
local scan = "^[\n ]*%{%{[\n _]*|[\n _]*=[\n _]*%}%}[\n ]*$"
if source:match(scan) then
code = source:gsub("\n", "N")
else
s = mw.text.nowiki(source):gsub("\n", "\n")
s = tostring(mw.html.create("code"):wikitext(s))
Fault("Invalid format " .. s)
source = false
end
else
local words = mw.text.split(source, "%s+")
local show, start, support, unknown
for i = 1, #words do
s = words[i]
if i == 1 then
start = s
end
support = Permit.builder[s]
if support == start or support == "*" then
Permit.builder[s] = true
elseif s:match("^[1-9]%d?") and Permit.builder.align then
Permit.builder.align = tonumber(s)
else
if unknown then
unknown = string.format("%s %s", unknown, s)
else
unknown = s
end
end
end -- i = 1, #words
if unknown then
s = tostring(mw.html.create("code"):css("white-space", "nowrap"):wikitext(s))
Fault("Unknown/misplaced format keyword " .. s)
source = false
start = false
end
if start == "inline" then
if Permit.builder.half == true then
show = "inline half"
code = "{{_ |_=_}}"
elseif Permit.builder.grouped == true then
show = "inline grouped"
code = "{{_ | _=_}}"
elseif Permit.builder.spaced == true then
show = "inline spaced"
code = "{{_ | _ = _ }}"
end
if Permit.builder.newlines == true then
show = show or "inline"
code = code or "{{_|_=_}}"
show = show .. " newlines"
code = string.format("N%sN", code)
end
elseif start == "block" then
local space = "" -- amid "|" and name
local spaced = " " -- preceding "="
local spacer = " " -- following "="
local suffix = "N" -- closing "}}" on new line
show = "block"
if Permit.builder.indent == true then
start = " "
show = "block indent"
else
start = ""
end
if Permit.builder.compressed == true then
spaced = ""
spacer = ""
show = show .. " compressed"
if Permit.builder.last == true then
show = show .. " last"
else
suffix = ""
end
else
if Permit.builder.lead == true then
show = show .. " lead"
space = " "
end
if type(Permit.builder.align) ~= "string" then
local n
s = " align"
if Permit.builder.align == true then
n = 0
if type(Data.got) == "table" and type(Data.got.params) == "table" then
for k, v in pairs(Data.got.params) do
if type(v) == "table" and not v.deprecated and type(k) == "string" then
k = mw.ustring.len(k)
if k > n then
n = k
end
end
end -- for k, v
end
else
n = Permit.builder.align
if type(n) == "number" and n > 1 then
s = string.format("%s %d", s, n)
else
n = 0 -- How come?
end
end
if n > 1 then
spaced = string.rep("_", n - 1) .. " "
end
show = show .. s
elseif Permit.builder.after == true then
spaced = ""
show = show .. " after"
elseif Permit.builder.dense == true then
spaced = ""
spacer = ""
show = show .. " dense"
end
if Permit.builder.last == true then
suffix = spacer
show = show .. " last"
end
end
code = string.format("N{{_N%s|%s_%s=%s_%s}}N", start, space, spaced, spacer, suffix)
if show == "block" then
show = "block newlines"
end
end
if show then
r = mw.html.create("span"):wikitext(show)
end
end
if code then
source = code:gsub("N", "\n")
code = mw.text.nowiki(code):gsub("N", "\n")
code = mw.html.create("code"):css("margin-left", "1em"):css("margin-right", "1em"):wikitext(code)
if r then
r = mw.html.create("span"):node(r):node(code)
else
r = code
end
end
end
if source and Data.tag then
Data.tag.format = source
end
return r
end -- format()
local function formatter()
-- Build presented documentation.
-- Returns <div>.
local r = mw.html.create("div")
local x = fashioned(Data.tree, true, r)
local s
if x then
r = x
end
if Data.leading then
local toc = mw.html.create("div")
local shift
if Config.suppressTOCnum then
toc:addClass(Config.suppressTOCnum)
if type(Config.stylesTOCnum) == "string" then
local src = Config.stylesTOCnum .. "/styles.css"
s = TemplateData.frame:extensionTag("templatestyles", nil, { src = src })
r:newline():node(s)
end
end
toc:addClass("navigation-not-searchable"):css("margin-top", "0.5em"):wikitext("__TOC__")
if Data.sibling then
local block = mw.html.create("div")
if TemplateData.ltr then
shift = "right"
else
shift = "left"
end
block:css("float", shift):wikitext(Data.sibling)
r:newline():node(block):newline()
end
r:newline():node(toc):newline()
if shift then
r:node(mw.html.create("div"):css("clear", shift)):newline()
end
end
s = features()
if s then
if Data.leading then
r:node(mw.html.create("h" .. Config.nested):wikitext(factory("doc-params"))):newline()
end
r:node(s)
end
if Data.shared then
local global = mw.html.create("div"):attr("id", "templatedata-global")
local shift
if TemplateData.ltr then
shift = "right"
else
shift = "left"
end
global:css("float", shift):wikitext(string.format("[[%s|%s]]", Data.shared, "Global"))
r:newline():node(global)
end
if Data.tree and Data.tree.format then
local e = format()
if e then
local show = "Format"
if Config.supportFormat then
show = string.format("[[%s|%s]]", Config.supportFormat, show)
end
r:node(mw.html.create("p"):addClass("navigation-not-searchable"):wikitext(show .. ": "):node(e))
end
end
return r
end -- formatter()
local function free()
-- Remove JSON comment lines.
if Data.source:find("//", 1, true) then
Data.source:gsub("([{,\"'])(%s*\n%s*//.*\n%s*)([{},\"'])", "%1%3")
end
end -- free()
local function full()
-- Build survey table from JSON data, append invisible <templatedata>.
Data.div = mw.html.create("div"):addClass("mw-templatedata-doc-wrap")
if Permit.css.bg then
Data.div:css(Permit.css.bg)
end
if Permit.css.fg then
Data.div:css(Permit.css.fg)
end
focus()
if Data.tag then
if type(Data.got.params) == "table" then
for k, v in pairs(Data.got.params) do
focus(k)
end -- for k, v
if Data.heirs then
fathers()
end
end
end
Data.div:node(formatter())
if not Data.lazy then
Data.slim = flush()
if TemplateData.frame then
local div = mw.html.create("div")
local tdata = {
[1] = "templatedata",
[2] = Data.slim,
}
Data.strip = TemplateData.frame:callParserFunction("#tag", tdata)
div:wikitext(Data.strip)
if Config.loudly then
Data.div:node(mw.html.create("hr"):css({ height = "7ex" }))
else
div:css("display", "none")
end
Data.div:node(div)
end
end
if Data.lasting then
Fault("deprecated type syntax")
end
if Data.less then
Fault(Config.solo)
end
end -- full()
local function furnish(adapt, arglist)
-- Analyze transclusion.
-- Parameter:
-- adapt -- table, #invoke parameters
-- arglist -- table, template parameters
-- Returns string.
local source
favorize()
-- deprecated:
for k, v in pairs(Config.basicCnf) do
if adapt[k] and adapt[k] ~= "" then
Config[v] = adapt[k]
end
end -- for k, v
if arglist.heading and arglist.heading:match("^[3-6]$") then
Config.nested = arglist.heading
else
Config.nested = "2"
end
Config.loudly = faculty(arglist.debug or adapt.debug)
Data.lazy = faculty(arglist.lazy) and not Config.loudly
Data.leading = faculty(arglist.TOC)
if Data.leading and arglist.TOCsibling then
Data.sibling = mw.text.trim(arglist.TOCsibling)
end
if arglist.lang then
Data.slang = arglist.lang:lower()
elseif adapt.lang then
Data.slang = adapt.lang:lower()
end
if arglist.JSON then
source = arglist.JSON
elseif arglist.Global then
source = TemplateData.getGlobalJSON(arglist.Global, arglist.Local)
elseif arglist[1] then
local s = mw.text.trim(arglist[1])
local start = s:sub(1, 1)
if start == "<" then
Data.strip = s
elseif start == "{" then
source = s
elseif mw.ustring.sub(s, 1, 8) == mw.ustring.char(127, 39, 34, 96, 85, 78, 73, 81) then
Data.strip = s
end
end
if type(arglist.vertical) == "string" and arglist.vertical:match("^%d*%.?%d+[emprx]+$") then
Data.scroll = arglist.vertical
end
if not source then
Data.title = mw.title.getCurrentTitle()
source = find()
if not source and not Data.title.text:match(Config.subpage) then
local s = string.format(Config.suffix, Data.title.prefixedText)
Data.title = mw.title.new(s)
if Data.title.exists then
source = find()
end
end
end
if not Data.lazy then
if not Data.title then
Data.title = mw.title.getCurrentTitle()
end
Data.lazy = Data.title.text:match(Config.subpage)
end
if type(source) == "string" then
TemplateData.getPlainJSON(source)
end
return finalize(faculty(arglist.source))
end -- furnish()
Failsafe.failsafe = function(atleast)
-- Retrieve versioning and check for compliance.
-- Precondition:
-- atleast -- string, with required version
-- or wikidata|item|~|@ or false
-- Postcondition:
-- Returns string -- with queried version/item, also if problem
-- false -- if appropriate
-- 2024-03-01
local since = atleast
local last = (since == "~")
local linked = (since == "@")
local link = (since == "item")
local r
if last or link or linked or since == "wikidata" then
local item = Failsafe.item
since = false
if type(item) == "number" and item > 0 then
local suited = string.format("Q%d", item)
if link then
r = suited
else
local entity = mw.wikibase.getEntity(suited)
if type(entity) == "table" then
local seek = Failsafe.serialProperty or "P348"
local vsn = entity:formatPropertyValues(seek)
if type(vsn) == "table" and type(vsn.value) == "string" and vsn.value ~= "" then
if last and vsn.value == Failsafe.serial then
r = false
elseif linked then
if mw.title.getCurrentTitle().prefixedText == mw.wikibase.getSitelink(suited) then
r = false
else
r = suited
end
else
r = vsn.value
end
end
end
end
elseif link then
r = false
end
end
if type(r) == "nil" then
if not since or since <= Failsafe.serial then
r = Failsafe.serial
else
r = false
end
end
return r
end -- Failsafe.failsafe()
TemplateData.getGlobalJSON = function(access, adapt)
-- Retrieve TemplateData from a global repository (JSON).
-- Parameter:
-- access -- string, with page specifier (on WikiMedia Commons)
-- adapt -- JSON string or table with local overrides
-- Returns true, if succeeded.
local plugin = Fetch("/global")
local r
if type(plugin) == "table" and type(plugin.fetch) == "function" then
local s, got = plugin.fetch(access, adapt)
if got then
Data.got = got
Data.order = got.paramOrder
Data.shared = s
r = true
full()
else
Fault(s)
end
end
return r
end -- TemplateData.getGlobalJSON()
TemplateData.getPlainJSON = function(adapt)
-- Reduce enhanced JSON data to plain text localized JSON.
-- Parameter:
-- adapt -- string, with enhanced JSON
-- Returns string, or not.
if type(adapt) == "string" then
-- local JSONutil = Fetch("JSONutil", true) -- DON'T check for Module:JSONutil. (doesn't exist in English WP, blocked from creation.)
local JSONutil = nil -- DO act as if Fetch() failed.
Data.source = adapt
free()
if JSONutil then
local Multilingual = Fetch("Multilingual", true)
local f
if Multilingual then
f = Multilingual.i18n
end
Data.got = JSONutil.fetch(Data.source, true, f)
else
local lucky
lucky, Data.got = pcall(mw.text.jsonDecode, Data.source)
end
if type(Data.got) == "table" then
full()
elseif not Data.strip then
local scream = type(Data.got)
if scream == "string" then
scream = Data.got
else
scream = "Data.got: " .. scream
end
Fault("fatal JSON error: " .. scream)
end
end
return Data.slim
end -- TemplateData.getPlainJSON()
TemplateData.test = function(adapt, arglist)
TemplateData.frame = mw.getCurrentFrame()
return furnish(adapt, arglist)
end -- TemplateData.test()
-- Export.
local p = {}
p.f = function(frame)
-- Template call.
local lucky, r
TemplateData.frame = frame
lucky, r = pcall(furnish, frame.args, frame:getParent().args)
if not lucky then
Fault("INTERNAL: " .. r)
r = failures()
end
return r
end -- p.f
p.failsafe = function(frame)
-- Versioning interface.
local s = type(frame)
local since
if s == "table" then
since = frame.args[1]
elseif s == "string" then
since = frame
end
if since then
since = mw.text.trim(since)
if since == "" then
since = false
end
end
return Failsafe.failsafe(since) or ""
end -- p.failsafe
p.TemplateData = function()
-- Module interface.
return TemplateData
end
setmetatable(p, {
__call = function(func, ...)
setmetatable(p, nil)
return Failsafe
end,
})
return p
2dd3b90kpdohdijcui9w39wr2ft47sq
75035
75034
2026-08-24T01:00:13Z
Robertsky
10424
1 versaun husi [[:en:Module:Format_TemplateData]]
75034
Scribunto
text/plain
local TemplateData = {
item = 46997995,
serial = "2025-02-07",
suite = "TemplateData"
}
local Failsafe = TemplateData
local Config = {
-- Multiple option names mapped into unique internal fields.
basicCnf = {
catProblem = "strange",
classMultiColumns = "selMultClm",
classNoNumTOC = "suppressTOCnum",
classTable = "classTable",
cssParWrap = "cssTabWrap",
cssParams = "cssTable",
docpageCreate = "suffix",
docpageDetect = "subpage",
helpAliases = "supportAliases",
helpBoolean = "support4boolean",
helpContent = "support4content",
helpDate = "support4date",
helpDefault = "support4default",
helpFile = "support4wiki-file-name",
helpFormat = "supportFormat",
helpLine = "support4line",
helpNumber = "support4number",
helpPage = "support4wiki-page-name",
helpString = "support4string",
helpTemplate = "support4wiki-template-name",
helpURL = "support4url",
helpUser = "support4wiki-user-name",
msgDescMiss = "solo",
tStylesMultiColumns = "stylesMultClm",
tStylesTOCnum = "stylesTOCnum"
},
classTable = { "wikitable" }, -- Classes for params table
cssTable = false, -- Styles for params table
cssTabWrap = false, -- Styles for params table wrapper
debug = false,
debugmultilang = "#c0c0c0",
jsonDebug = "json-code-lint", -- Class for jsonDebug tool
loudly = false, -- Show exported element, etc.
solo = false, -- Complaint on missing description
strange = false, -- Title of maintenance category
subpage = false, -- Pattern to identify subpage
suffix = false, -- Subpage creation scheme
suppressTOCnum = false -- Class for TOC number suppression
}
local Data = {
div = false, -- <div class="mw-templatedata-doc-wrap">
got = false, -- table, initial templatedata object
heirs = false, -- table, params that are inherited
jump = false, -- source position at end of "params"
less = false, -- main description missing
lasting = false, -- old syntax encountered
lazy = false, -- doc mode; do not generate effective <templatedata>
leading = false, -- show TOC
-- low = false, -- 1= mode
order = false, -- parameter sequence
params = false, -- table, exported parameters
scream = false, -- error messages
sibling = false, -- TOC juxtaposed
slang = nil, -- project/user language code
slim = false, -- JSON reduced to plain
source = false, -- JSON input
strip = false, -- <templatedata> evaluation
tag = false, -- table, exported root element
title = false, -- page
tree = false -- table, rewritten templatedata object
}
local Permit = {
builder = {
after = "block",
align = "block",
block = "block",
compressed = "block",
dense = "block",
grouped = "inline",
half = "inline",
indent = "block",
inline = "inline",
last = "block",
lead = "block",
newlines = "*",
spaced = "inline"
},
colors = {
bg = "var(--background-color-base, #fff)",
deprecated = "#ffcbcb",
fg = "var(--color-base, #000)",
optional = "#eaecf0",
required = "#eaf3ff",
suggested = "#fff",
tableheadbg = "var(--background-color-progressive-subtle, #b3b7ff)"
},
params = {
aliases = "table",
autovalue = "string",
default = "string table I18N nowiki",
deprecated = "boolean string I18N",
description = "string table I18N",
example = "string table I18N nowiki",
inherits = "string",
label = "string table I18N",
required = "boolean",
style = "string table",
suggested = "boolean",
suggestedvalues = "string table number boolean",
type = "string"
},
root = {
description = "string table I18N",
format = "string",
maps = "table",
paramOrder = "table",
params = "table",
sets = "table"
},
search = "[{,]%%s*(['\"])%s%%1%%s*:%%s*%%{",
types = {
boolean = true,
content = true,
date = true,
line = true,
number = true,
string = true,
unknown = true,
url = true,
["string/line"] = "line",
["string/wiki-page-name"] = "wiki-page-name",
["string/wiki-user-name"] = "wiki-user-name",
["unbalanced-wikitext"] = true,
["wiki-file-name"] = true,
["wiki-page-name"] = true,
["wiki-template-name"] = true,
["wiki-user-name"] = true
}
}
local function Fault(alert)
-- Memorize error message.
-- Parameter:
-- alert -- string, error message
if Data.scream then
Data.scream = string.format("%s *** %s", Data.scream, alert)
else
Data.scream = alert
end
end -- Fault()
local function Fetch(ask, allow)
-- Fetch module.
-- Parameter:
-- ask -- string, with name
-- "/global"
-- "JSONutil"
-- "Multilingual"
-- "Text"
-- "WLink"
-- allow -- true: no error if unavailable
-- Returns table of module
-- Error: Module not available
local sign = ask
local r, stem
if sign:sub(1, 1) == "/" then
sign = TemplateData.frame:getTitle() .. sign
else
stem = sign
sign = "Module:" .. stem
end
if TemplateData.extern then
r = TemplateData.extern[sign]
else
TemplateData.extern = {}
end
if not r then
local lucky, g = pcall(require, sign)
if type(g) == "table" then
if stem and type(g[stem]) == "function" then
r = g[stem]()
else
r = g
end
TemplateData.extern[sign] = r
elseif not allow then
error(string.format("Fetch(%s) %s", sign, g), 0)
end
end
return r
end -- Fetch()
local function Foreign()
-- Guess human language, returns slang or not.
if type(Data.slang) == "nil" then
local Multilingual = Fetch("Multilingual", true)
if Multilingual and type(Multilingual.userLangCode) == "function" then
Data.slang = Multilingual.userLangCode()
else
Data.slang = mw.language.getContentLanguage():getCode():lower()
end
end
if Data.slang and mw.ustring.codepoint(Data.slang, 1, 1) > 122 then
Data.slang = false
end
return Data.slang
end -- Foreign()
local function facet(ask, at)
-- Find physical position of parameter definition in JSON.
-- Parameter:
-- ask -- string, parameter name
-- at -- number, physical position within definition
-- Returns number or nil.
local seek = string.format(Permit.search, ask:gsub("%%", "%%%%"):gsub("([%-.()+*?^$%[%]])", "%%%1"))
local i, k, r, slice, source
if not Data.jump then
Data.jump = Data.source:find("params", 2)
if Data.jump then
Data.jump = Data.jump + 7
else
Data.jump = 1
end
end
i, k = Data.source:find(seek, at + Data.jump)
while i and not r do
source = Data.source:sub(k + 1)
slice = source:match('^%s*"([^"]+)"s*:')
if not slice then
slice = source:match("^%s*'([^']+)'%s*:")
end
if (slice and Permit.params[slice]) or source:match("^%s*%}") then
r = k
else
i, k = Data.source:find(seek, k)
end
end -- while i
return r
end -- facet()
local function facilities(apply)
-- Retrieve details of suggestedvalues.
-- Parameter:
-- apply -- table, with plain or enhanced values
-- .suggestedvalues -- table|string|number, or more
-- Returns
-- 1 -- table, with suggestedvalues
-- 2 -- table, with CSS map, or not
-- 3 -- string, with class, or not
-- 4 -- string, with templatestyles, or not
local elements = apply.suggestedvalues
local s = type(elements)
local r1, r2, r3, r4
if s == "table" then
local values = elements.values
if type(values) == "table" then
r1 = values
if type(elements.scroll) == "string" then
r2 = r2 or {}
r2.height = apply.scroll
r2.overflow = "auto"
end
if type(elements.minwidth) == "string" then
local s = type(elements.maxcolumns)
r2 = r2 or {}
r2["column-width"] = elements.minwidth
if s == "string" or s == "number" then
s = tostring(elements.maxcolumns)
r2["column-count"] = s
end
if type(Config.selMultClm) == "string" then
r3 = Config.selMultClm
end
if type(Config.stylesMultClm) == "string" then
local src = Config.stylesMultClm .. "/styles.css"
r4 = TemplateData.frame:extensionTag("templatestyles", nil, { src = src })
end
end
elseif elements and elements ~= "" then
r1 = elements
end
elseif s == "string" then
s = mw.text.trim(about)
if s ~= "" then
r1 = {}
table.insert(r1, { code = s })
end
elseif s == "number" then
r1 = {}
table.insert(r1, { code = tostring(elements) })
end
return r1, r2, r3, r4
end -- facilities()
local function factory(adapt)
-- Retrieve localized text from system message.
-- Parameter:
-- adapt -- string, message ID after "templatedata-"
-- Returns string, with localized text
local o = mw.message.new("templatedata-" .. adapt)
if Foreign() then
o:inLanguage(Data.slang)
end
return o:plain()
end -- factory()
local function faculty(adjust)
-- Test template argument for Boolean.
-- adjust -- string or nil
-- Returns boolean.
local s = type(adjust)
local r
if s == "string" then
r = mw.text.trim(adjust)
r = (r ~= "" and r ~= "0")
elseif s == "boolean" then
r = adjust
else
r = false
end
return r
end -- faculty()
local function failures()
-- Retrieve error collection and category, returns string.
local r
if Data.scream then
local e = mw.html.create("span"):addClass("error"):wikitext(Data.scream)
r = tostring(e)
mw.addWarning("'''TemplateData'''<br />" .. Data.scream)
if Config.strange then
r = string.format("%s[[category:%s]]", r, Config.strange)
end
else
r = ""
end
return r
end -- failures()
local function fair(adjust)
-- Reduce text to one line of plain text, or noexport wikitext blocks.
-- adjust -- string
-- Returns string with adjusted text.
local f = function(a)
return a:gsub("%s*\n%s*", " "):gsub("%s%s+", " ")
end
local tags = {
{
start = "<noexport>",
stop = "</noexport>",
},
{
start = "<exportonly>",
stop = "</exportonly>",
l = false,
},
}
local r = adjust
local i, j, k, s, tag
for m = 1, 2 do
tag = tags[m]
if r:find(tag.start, 1, true) then
s = r
r = ""
i = 1
tag.l = true
j, k = s:find(tag.start, i, true)
while j do
if j > 1 then
r = r .. f(s:sub(i, j - 1))
end
i = k + 1
j, k = s:find(tag.stop, i, true)
if j then
if m == 1 then
r = r .. s:sub(i, j - 1)
end
i = k + 1
j, k = s:find(tag.start, i, true)
else
Fault("missing " .. tag.stop)
end
end -- while j
r = r .. s:sub(i)
elseif m == 1 then
r = f(r)
end
end -- for m
if tags[2].l then
r = r:gsub("<exportonly>.*</exportonly>", "")
end
return r
end -- fair()
local function fancy(advance, alert)
-- Present JSON source.
-- Parameter:
-- advance -- true, for nice
-- alert -- true, for visible
-- Returns string.
local r
if Data.source then
local support = Config.jsonDebug
local css
if advance then
css = {
height = "6em",
resize = "vertical",
}
r = {
[1] = "syntaxhighlight",
[2] = Data.source,
lang = "json",
style = table.concat(css, ";"),
}
if alert then
r.class(support)
end
r = TemplateData.frame:callParserFunction("#tag", r)
else
css = {
["font-size"] = "0.77em",
["line-height"] = "1.35",
}
if alert then
css.resize = "vertical"
else
css.display = "none"
end
r = mw.html.create("pre"):addClass(support):css(css):wikitext(mw.text.encode(Data.source))
r = tostring(r)
end
r = "\n" .. r
else
r = ""
end
return r
end -- fancy()
local function faraway(alternatives)
-- Retrieve best language version from multilingual text.
-- Parameter:
-- alternatives -- table, to be evaluated
-- Returns
-- 1 -- string, with best match
-- 2 -- table of other versions, if any
local n = 0
local variants = {}
local r1, r2
for k, v in pairs(alternatives) do
if type(v) == "string" then
v = mw.text.trim(v)
if v ~= "" and type(k) == "string" then
k = k:lower()
variants[k] = v
n = n + 1
end
end
end -- for k, v
if n > 0 then
local Multilingual = Fetch("Multilingual", true)
if Multilingual and type(Multilingual.i18n) == "function" then
local show, slang = Multilingual.i18n(variants)
if show then
r1 = show
variants[slang] = nil
r2 = variants
end
end
if not r1 then
Foreign()
for k, v in pairs(variants) do
if n == 1 then
r1 = v
elseif Data.slang == k then
variants[k] = nil
r1 = v
r2 = variants
end
end -- for k, v
end
if r2 and Multilingual then
for k, v in pairs(r2) do
if v and not Multilingual.isLang(k, true) then
Fault(string.format("%s <code>lang=%s</code>", "Invalid", k))
end
end -- for k, v
end
end
return r1, r2
end -- faraway()
local function fashioned(about, asked, assign)
-- Create description head.
-- Parameter:
-- about -- table, supposed to contain description
-- asked -- true, if mandatory description
-- assign -- <block>, if to be equipped
-- Returns <block> with head, or nil.
local para = assign or mw.html.create("div")
local plus, r
if about and about.description then
if type(about.description) == "string" then
para:wikitext(about.description)
else
para:wikitext(about.description[1])
plus = mw.html.create("ul")
plus:css("text-align", "left")
for k, v in pairs(about.description[2]) do
plus:node(
mw.html
.create("li")
:node(mw.html.create("code"):wikitext(k))
:node(mw.html.create("br"))
:wikitext(fair(v))
)
end -- for k, v
if Config.loudly then
plus = mw.html
.create("div")
:css("background-color", Config.debugmultilang)
:css("color", "inherit")
:node(plus)
else
plus:addClass("templatedata-maintain"):css("display", "none")
end
end
elseif Config.solo and asked then
para:addClass("error"):wikitext(Config.solo)
Data.less = true
else
para = false
end
if para then
if plus then
r = mw.html.create("div"):node(para):node(plus)
else
r = para
end
end
return r
end -- fashioned()
local function fatten(access)
-- Create table row for subheadline.
-- Parameter:
-- access -- string, with name
-- Returns <tr>.
local param = Data.tree.params[access]
local sub, sort = access:match("(=+)%s*(%S.*)$")
local headline = mw.html.create(string.format("h%d", #sub))
local r = mw.html.create("tr")
local td = mw.html.create("td"):attr("colspan", "5"):attr("data-sort-value", "!" .. sort)
local s
if param.style then
s = type(param.style)
if s == "table" then
td:css(param.style)
elseif s == "string" then
td:cssText(param.style)
end
end
s = fashioned(param, false, headline)
if s then
headline = s
else
headline:wikitext(sort)
end
td:node(headline)
r:node(td)
return r
end -- fatten()
local function fathers()
-- Merge parameters with inherited values.
local n = 0
local p = Data.params
local t = Data.tree.params
local p2, t2
for k, v in pairs(Data.heirs) do
n = n + 1
end -- for k, v
for i = 1, n do
if Data.heirs then
for k, v in pairs(Data.heirs) do
if v and not Data.heirs[v] then
n = n - 1
t[k].inherits = nil
Data.heirs[k] = nil
p2 = {}
t2 = {}
if p[v] then
for k2, v2 in pairs(p[v]) do
p2[k2] = v2
end -- for k2, v2
if p[k] then
for k2, v2 in pairs(p[k]) do
if type(v2) ~= "nil" then
p2[k2] = v2
end
end -- for k2, v2
end
p[k] = p2
for k2, v2 in pairs(t[v]) do
t2[k2] = v2
end -- for k2, v2
for k2, v2 in pairs(t[k]) do
if type(v2) ~= "nil" then
t2[k2] = v2
end
end -- for k2, v2
t[k] = t2
else
Fault("No params[] inherits " .. v)
end
end
end -- for k, v
end
end -- i = 1, n
if n > 0 then
local s
for k, v in pairs(Data.heirs) do
if v then
if s then
s = string.format("%s | %s", s, k)
else
s = "Circular inherits: " .. k
end
end
end -- for k, v
Fault(s)
end
end -- fathers()
local function favorize()
-- Local customization issues.
local boole = { ["font-size"] = "1.25em" }
local l, cx = pcall(mw.loadData, TemplateData.frame:getTitle() .. "/config")
local scripting, style
TemplateData.ltr = not mw.language.getContentLanguage():isRTL()
if TemplateData.ltr then
scripting = "left"
else
scripting = "right"
end
boole["margin-" .. scripting] = "3em"
Permit.boole = {
[false] = {
css = boole,
lead = true,
show = "☐",
},
[true] = {
css = boole,
lead = true,
show = "☑",
},
}
Permit.css = {}
for k, v in pairs(Permit.colors) do
if k == "tableheadbg" then
k = "tablehead"
end
if k == "fg" then
style = "color"
else
style = "background-color"
end
Permit.css[k] = {}
Permit.css[k][style] = v
end -- for k, v
if type(cx) == "table" then
local c, s
if type(cx.permit) == "table" then
if type(cx.permit.boole) == "table" then
if type(cx.permit.boole[true]) == "table" then
Permit.boole[false] = cx.permit.boole[false]
end
if type(cx.permit.boole[true]) == "table" then
Permit.boole[true] = cx.permit.boole[true]
end
end
if type(cx.permit.css) == "table" then
for k, v in pairs(cx.permit.css) do
if type(v) == "table" then
Permit.css[k] = v
end
end -- for k, v
end
end
for k, v in pairs(Config.basicCnf) do
s = type(cx[k])
if s == "string" or s == "table" then
Config[v] = cx[k]
end
end -- for k, v
end
if type(Config.subpage) ~= "string" or type(Config.suffix) ~= "string" then
local got = mw.message.new("templatedata-doc-subpage")
local suffix
if got:isDisabled() then
suffix = "doc"
else
suffix = got:plain()
end
if type(Config.subpage) ~= "string" then
Config.subpage = string.format("/%s$", suffix)
end
if type(Config.suffix) ~= "string" then
Config.suffix = string.format("%%s/%s", suffix)
end
end
end -- favorize()
local function feasible(all, at, about)
-- Deal with suggestedvalues within parameter.
-- Parameter:
-- all -- parameter details
-- .default
-- .type
-- at -- string, with parameter name
-- about -- suggestedvalues -- table,
-- value and possibly description
-- table may have elements:
-- .code -- mandatory
-- .label -- table|string
-- .support -- table|string
-- .icon -- string
-- .class -- table|string
-- .css -- table
-- .style -- string
-- .less -- true: suppress code
-- Returns
-- 1: mw.html object <ul>
-- 2: sequence table with values, or nil
local h = {}
local e, r1, r2, s, v
if #about > 0 then
for i = 1, #about do
e = about[i]
s = type(e)
if s == "table" then
if type(e.code) == "string" then
s = mw.text.trim(e.code)
if s == "" then
e = nil
else
e.code = s
end
else
e = nil
s = string.format("params.%s.%s[%d] %s", at, "suggestedvalues", i, "MISSING 'code:'")
end
elseif s == "string" then
s = mw.text.trim(e)
if s == "" then
e = nil
s = string.format("params.%s.%s[%d] EMPTY", at, "suggestedvalues", i)
Fault(s)
else
e = { code = s }
end
elseif s == "number" then
e = { code = tostring(e) }
else
s = string.format("params.%s.%s[%d] INVALID", at, "suggestedvalues", i)
Fault(s)
e = false
end
if e then
v = v or {}
table.insert(v, e)
if h[e.code] then
s = string.format("params.%s.%s REPEATED %s", at, "suggestedvalues", e.code)
Fault(s)
else
h[e.code] = true
end
end
end -- for i
else
Fault(string.format("params.%s.suggestedvalues %s", at, "NOT AN ARRAY"))
end
if v then
local code, d, k, less, story, swift, t, u
r1 = mw.html.create("ul")
r2 = {}
for i = 1, #v do
u = mw.html.create("li")
e = v[i]
table.insert(r2, e.code)
story = false
less = (e.less == true)
if not less then
swift = e.code
if e.support then
local scream, support
s = type(e.support)
if s == "string" then
support = e.support
elseif s == "table" then
support = faraway(e.support)
else
scream = "INVALID"
end
if support then
s = mw.text.trim(support)
if s == "" then
scream = "EMPTY"
elseif s:find("[%[%]|%<%>]") then
scream = "BAD PAGE"
else
support = s
end
end
if scream then
s = string.format("params.%s.%s[%d].support %s", at, "suggestedvalues", i, scream)
Fault(s)
else
swift = string.format("[[:%s|%s]]", support, swift)
end
end
if all.type:sub(1, 5) == "wiki-" and swift == e.code then
local rooms = {
file = 6,
temp = 10,
user = 2,
}
local ns = rooms[all.type:sub(6, 9)] or 0
t = mw.title.makeTitle(ns, swift)
if t and t.exists then
swift = string.format("[[:%s|%s]]", t.prefixedText, swift)
end
end
if e.code == all.default then
k = 800
else
k = 300
end
code =
mw.html.create("code"):css("font-weight", tostring(k)):css("white-space", "nowrap"):wikitext(swift)
u:node(code)
end
if e.class then
s = type(e.class)
if s == "string" then
u:addClass(e.class)
elseif s == "table" then
for k, s in pairs(e.class) do
u:addClass(s)
end -- for k, s
else
s = string.format("params.%s.%s[%d].class INVALID", at, "suggestedvalues", i)
Fault(s)
end
end
if e.css then
if type(e.css) == "table" then
u:css(e.css)
else
s = string.format("params.%s.%s[%d].css INVALID", at, "suggestedvalues", i)
Fault(s)
end
end
if e.style then
if type(e.style) == "string" then
u:cssText(e.style)
else
s = string.format("params.%s.%s[%d].style INVALID", at, "suggestedvalues", i)
Fault(s)
end
end
if all.type == "wiki-file-name" and not e.icon then
e.icon = e.code
end
if e.label then
s = type(e.label)
if s == "string" then
s = mw.text.trim(e.label)
if s == "" then
s = string.format("params.%s.%s[%d].label %s", at, "suggestedvalues", i, "EMPTY")
Fault(s)
else
story = s
end
elseif s == "table" then
story = faraway(e.label)
else
s = string.format("params.%s.%s[%d].label INVALID", at, "suggestedvalues", i)
Fault(s)
end
end
s = false
if type(e.icon) == "string" then
t = mw.title.makeTitle(6, e.icon)
if t and t.file.exists then
local g = mw.html.create("span")
s = string.format("[[%s|16px]]", t.prefixedText)
g:attr("role", "presentation"):wikitext(s)
s = tostring(g)
end
end
if not s and not less and e.label then
s = mw.ustring.char(0x2013)
end
if s then
d = mw.html.create("span"):wikitext(s)
if TemplateData.ltr then
if not less then
d:css("margin-left", "0.5em")
end
if story then
d:css("margin-right", "0.5em")
end
else
if not less then
d:css("margin-right", "0.5em")
end
if story then
d:css("margin-left", "0.5em")
end
end
u:node(d)
end
if story then
u:wikitext(story)
end
r1:newline():node(u)
end -- for i
end
if not r1 and v ~= false then
Fault(string.format("params.%s.suggestedvalues INVALID", at))
r1 = mw.html.create("code"):addClass("error"):wikitext("INVALID")
end
return r1, r2
end -- feasible()
local function feat()
-- Check and store parameter sequence.
if Data.source then
local i = 0
local s
for k, v in pairs(Data.tree.params) do
if i == 0 then
Data.order = {}
i = 1
s = k
else
i = 2
break -- for k, v
end
end -- for k, v
if i > 1 then
local pointers = {}
local points = {}
local given = {}
for k, v in pairs(Data.tree.params) do
i = facet(k, 1)
if type(v) == "table" then
if type(v.label) == "string" then
s = mw.text.trim(v.label)
if s == "" then
s = k
end
else
s = k
end
if given[s] then
if given[s] == 1 then
local scream = "Parameter label '%s' detected multiple times"
Fault(string.format(scream, s))
given[s] = 2
end
else
given[s] = 1
end
end
if i then
table.insert(points, i)
pointers[i] = k
i = facet(k, i)
if i then
s = "Parameter '%s' detected twice"
Fault(string.format(s, k))
end
else
s = "Parameter '%s' not detected"
Fault(string.format(s, k))
end
end -- for k, v
table.sort(points)
for i = 1, #points do
table.insert(Data.order, pointers[points[i]])
end -- i = 1, #points
elseif s then
table.insert(Data.order, s)
end
end
end -- feat()
local function feature(access)
-- Create table row for parameter, check and display violations.
-- Parameter:
-- access -- string, with name
-- Returns <tr>.
local mode, s, status
local fine = function(a)
s = mw.text.trim(a)
return a == s and a ~= "" and not a:find("%|=\n") and not a:find("%s%s")
end
local begin = mw.html.create("td")
local code = mw.html.create("code")
local desc = mw.html.create("td")
local eager = mw.html.create("td")
local legal = true
local param = Data.tree.params[access]
local ranking = { "required", "suggested", "optional", "deprecated" }
local r = mw.html.create("tr")
local styles = "mw-templatedata-doc-param-"
local sort, typed
for k, v in pairs(param) do
if v == "" then
param[k] = false
end
end -- for k, v
-- label
sort = param.label or access
if sort:match("^%d+$") then
begin:attr("data-sort-value", string.format("%05d", tonumber(sort)))
end
begin:css("font-weight", "700"):wikitext(sort)
-- name and aliases
code:css("font-size", "0.92em"):css("white-space", "nowrap"):wikitext(access)
if not fine(access) then
code:addClass("error")
Fault(string.format("Bad ID params.<code>%s</code>", access))
legal = false
begin:attr("data-sort-value", " " .. sort)
end
code = mw.html.create("td"):addClass(styles .. "name"):node(code)
if access:match("^%d+$") then
code:attr("data-sort-value", string.format("%05d", tonumber(access)))
end
if type(param.aliases) == "table" then
local lapsus, syn
for k, v in pairs(param.aliases) do
code:tag("br")
if type(v) == "string" then
if not fine(v) then
lapsus = true
code:node(mw.html.create("span"):addClass("error"):css("font-style", "italic"):wikitext("string"))
:wikitext(s)
else
if Config.supportAliases then
s = string.format("[[%s|%s]]", Config.supportAliases, mw.text.nowiki(s))
end
syn = mw.html.create("span"):addClass(styles .. "alias"):css("white-space", "nowrap"):wikitext(s)
code:node(syn)
end
else
lapsus = true
code:node(mw.html.create("code"):addClass("error"):wikitext(type(v)))
end
end -- for k, v
if lapsus then
s = string.format("params.<code>%s</code>.aliases", access)
Fault(factory("invalid-value"):gsub("$1", s))
legal = false
end
end
-- description etc.
s = fashioned(param)
if s then
desc:node(s)
end
if param.style then
s = type(param.style)
if s == "table" then
desc:css(param.style)
elseif s == "string" then
desc:cssText(param.style)
end
end
if param.suggestedvalues or param.default or param.example or param.autovalue then
local details = {
"suggestedvalues",
"default",
"example",
"autovalue",
}
local dl = mw.html.create("dl")
local dd, section, show
for i = 1, #details do
s = details[i]
show = param[s]
if show then
dd = mw.html.create("dd")
section = factory("doc-param-" .. s)
if s == "default" and Config.support4default then
section = string.format("[[%s|%s]]", Config.support4default, mw.text.nowiki(section))
end
if param.type == "boolean" and (show == "0" or show == "1") then
local boole = Permit.boole[(show == "1")]
if boole.lead == true then
dd:node(mw.html.create("code"):wikitext(show)):wikitext(" ")
end
if type(boole.show) == "string" then
local v = mw.html.create("span"):attr("aria-hidden", "true"):wikitext(boole.show)
if boole.css then
v:css(boole.css)
end
dd:node(v)
end
if type(boole.suffix) == "string" then
dd:wikitext(boole.suffix)
end
if boole.lead == false then
dd:wikitext(" "):node(mw.html.create("code"):wikitext(show))
end
elseif s == "suggestedvalues" then
local v, css, class, ts = facilities(param)
if v then
local ul
ul, v = feasible(param, access, v)
if v then
dd:newline():node(ul)
if css then
dd:css(css)
if class then
dd:addClass(class)
end
if ts then
dd:newline()
dd:node(ts)
end
end
Data.params[access].suggestedvalues = v
end
end
else
dd:wikitext(show)
end
dl:node(mw.html.create("dt"):wikitext(section)):node(dd)
end
end -- i = 1, #details
desc:node(dl)
end
-- type
if type(param.type) == "string" then
param.type = mw.text.trim(param.type)
if param.type == "" then
param.type = false
end
end
if param.type then
s = Permit.types[param.type]
typed = mw.html.create("td"):addClass(styles .. "type")
if s then
if s == "string" then
Data.params[access].type = s
typed:wikitext(factory("doc-param-type-" .. s)):tag("br")
typed:node(mw.html.create("span"):addClass("error"):wikitext(param.type))
Data.lasting = true
else
local support = Config["support4" .. param.type]
s = factory("doc-param-type-" .. param.type)
if support then
s = string.format("[[%s|%s]]", support, s)
end
typed:wikitext(s)
end
else
Data.params[access].type = "unknown"
typed:addClass("error"):wikitext("INVALID")
s = string.format("params.<code>%s</code>.type", access)
Fault(factory("invalid-value"):gsub("$1", s))
legal = false
end
else
typed = mw.html.create("td"):wikitext(factory("doc-param-type-unknown"))
Data.params[access].type = "unknown"
if param.default then
Data.params[access].default = nil
Fault("Default value requires <code>type</code>")
legal = false
end
end
typed:addClass("navigation-not-searchable")
-- status
if param.required then
mode = 1
if param.autovalue then
Fault(string.format("autovalued <code>%s</code> required", access))
legal = false
end
if param.default then
Fault(string.format("Defaulted <code>%s</code> required", access))
legal = false
end
if param.deprecated then
Fault(string.format("Required deprecated <code>%s</code>", access))
legal = false
end
elseif param.deprecated then
mode = 4
elseif param.suggested then
mode = 2
else
mode = 3
end
status = ranking[mode]
ranking = factory("doc-param-status-" .. status)
if mode == 1 or mode == 4 then
ranking = mw.html.create("span"):css("font-weight", "700"):wikitext(ranking)
if type(param.deprecated) == "string" then
ranking:tag("br")
ranking:wikitext(param.deprecated)
end
if param.suggested and mode == 4 then
s = string.format("Suggesting deprecated <code>%s</code>", access)
Fault(s)
legal = false
end
end
eager
:attr("data-sort-value", tostring(mode))
:node(ranking)
:addClass(string.format("%sstatus-%s %s", styles, status, "navigation-not-searchable"))
-- <tr>
r:attr("id", "templatedata:" .. mw.uri.anchorEncode(access))
:css(Permit.css[status])
:addClass(styles .. status)
:node(begin)
:node(code)
:node(desc)
:node(typed)
:node(eager)
:newline()
if not legal then
r:css("border", "3px solid #f00")
end
return r
end -- feature()
local function features()
-- Create <table> for parameters.
-- Returns <table>, or nil.
local r
if Data.tree and Data.tree.params then
local tbl = mw.html.create("table")
local tr = mw.html.create("tr")
feat()
if Data.order and #Data.order > 1 then
tbl:addClass("sortable")
end
if type(Config.classTable) == "table" then
for k, v in pairs(Config.classTable) do
tbl:addClass(v)
end -- for k, v
end
if type(Config.cssTable) == "table" then
tbl:css(Config.cssTable)
end
tr:addClass("navigation-not-searchable")
:node(
mw.html.create("th"):attr("colspan", "2"):css(Permit.css.tablehead):wikitext(factory("doc-param-name"))
)
:node(mw.html.create("th"):css(Permit.css.tablehead):wikitext(factory("doc-param-desc")))
:node(mw.html.create("th"):css(Permit.css.tablehead):wikitext(factory("doc-param-type")))
:node(mw.html.create("th"):css(Permit.css.tablehead):wikitext(factory("doc-param-status")))
tbl
:newline()
-- :node( mw.html.create( "thead" )
:node(tr)
-- )
:newline()
if Data.order then
local leave, s
for i = 1, #Data.order do
s = Data.order[i]
if s:sub(1, 1) == "=" then
leave = true
tbl:node(fatten(s))
Data.order[i] = false
elseif s:match("[=|]") then
Fault(string.format("Bad param <code>%s</code>", s))
else
tbl:node(feature(s))
end
end -- for i = 1, #Data.order
if leave then
for i = #Data.order, 1, -1 do
if not Data.order[i] then
table.remove(Data.order, i)
end
end -- for i = #Data.order, 1, -1
end
Data.tag.paramOrder = Data.order
end
if Config.cssTabWrap or Data.scroll then
r = mw.html.create("div")
if type(Config.cssTabWrap) == "table" then
r:css(Config.cssTabWrap)
elseif type(Config.cssTabWrap) == "string" then
-- deprecated
r:cssText(Config.cssTabWrap)
end
if Data.scroll then
r:css("height", Data.scroll):css("overflow", "auto")
end
r:node(tbl)
else
r = tbl
end
end
return r
end -- features()
local function fellow(any, assigned, at)
-- Check sets[] parameter and issue error message, if necessary.
-- Parameter:
-- any -- should be number
-- assigned -- parameter name
-- at -- number, of set
local s
if type(any) ~= "number" then
s = "<code>sets[%d].params[%s]</code>??"
Fault(string.format(s, at, mw.text.nowiki(tostring(any))))
elseif type(assigned) == "string" then
if not Data.got.params[assigned] then
s = "<code>sets[%d].params %s</code> is undefined"
Fault(string.format(s, at, assigned))
end
else
s = "<code>sets[%d].params[%d] = %s</code>??"
Fault(string.format(s, k, type(assigned)))
end
end -- fellow()
local function fellows()
-- Check sets[] and issue error message, if necessary.
local s
if type(Data.got.sets) == "table" then
if type(Data.got.params) == "table" then
for k, v in pairs(Data.got.sets) do
if type(k) == "number" then
if type(v) == "table" then
for ek, ev in pairs(v) do
if ek == "label" then
s = type(ev)
if s ~= "string" and s ~= "table" then
s = "<code>sets[%d].label</code>??"
Fault(string.format(s, k))
end
elseif ek == "params" and type(ev) == "table" then
for pk, pv in pairs(ev) do
fellow(pk, pv, k)
end -- for pk, pv
else
ek = mw.text.nowiki(tostring(ek))
s = "<code>sets[%d][%s]</code>??"
Fault(string.format(s, k, ek))
end
end -- for ek, ev
else
k = mw.text.nowiki(tostring(k))
v = mw.text.nowiki(tostring(v))
s = string.format("<code>sets[%s][%s]</code>??", k, v)
Fault(s)
end
else
k = mw.text.nowiki(tostring(k))
s = string.format("<code>sets[%s]</code> ?????", k)
Fault(s)
end
end -- for k, v
else
s = "<code>params</code> required for <code>sets</code>"
Fault(s)
end
else
s = "<code>sets</code> needs to be of <code>object</code> type"
Fault(s)
end
end -- fellows()
local function finalize(advance)
-- Wrap presentation into frame.
-- Parameter:
-- advance -- true, for nice
-- Returns string.
local r, lapsus
if Data.div then
r = tostring(Data.div)
elseif Data.strip then
r = Data.strip
else
lapsus = true
r = ""
end
r = r .. failures()
if Data.source then
local live = (advance or lapsus)
if not live then
live = TemplateData.frame:preprocess("{{REVISIONID}}")
live = (live == "")
end
if live then
r = r .. fancy(advance, lapsus)
end
end
return r
end -- finalize()
local function find()
-- Find JSON data within page source (title).
-- Returns string, or nil.
local s = Data.title:getContent()
local i, j = s:find("<templatedata>", 1, true)
local r
if i then
local k = s:find("</templatedata>", j, true)
if k then
r = mw.text.trim(s:sub(j + 1, k - 1))
end
end
return r
end -- find()
local function flat(adjust)
-- Remove formatting from text string for VisualEditor.
-- Parameter:
-- arglist -- string, to be stripped, or nil
-- Returns string, or nil.
local r
if adjust then
r = adjust:gsub("\n", " ")
if r:find("<noexport>", 1, true) then
r = r:gsub("<noexport>.*</noexport>", "")
end
if r:find("<exportonly>", 1, true) then
r = r:gsub("</?exportonly>", "")
end
if r:find("''", 1, true) then
r = r:gsub("'''", ""):gsub("''", "")
end
if r:find("<", 1, true) then
local Text = Fetch("Text")
r = r:gsub("<br */?>", "\r\n"):gsub("<sup>2</sup>", "²"):gsub("<sup>3</sup>", "³")
r = Text.getPlain(r)
end
if r:find("[", 1, true) then
local WLink = Fetch("WLink")
if WLink.isBracketedURL(r) then
r = r:gsub("%[([hf]tt?ps?://%S+) [^%]]+%]", "%1")
end
r = WLink.getPlain(r)
end
if r:find("&", 1, true) then
r = mw.text.decode(r)
if r:find("­", 1, true) then
r = r:gsub("­", "")
end
end
end
return r
end -- flat()
local function flush()
-- JSON encode narrowed input; obey unnamed (numerical) parameters.
-- Returns <templatedata> JSON string.
local r
if Data.tag then
r = mw.text.jsonEncode(Data.tag):gsub("%}$", ",")
else
r = "{"
end
r = r .. '\n"params":{'
if Data.order then
local sep = ""
local s
for i = 1, #Data.order do
s = Data.order[i]
r = string.format("%s%s\n%s:%s", r, sep, mw.text.jsonEncode(s), mw.text.jsonEncode(Data.params[s]))
sep = ",\n"
end -- for i = 1, #Data.order
end
r = r .. "\n}\n}"
return r
end -- flush()
local function focus(access)
-- Check components; focus multilingual description, build trees.
-- Parameter:
-- access -- string, name of parameter, nil for root
local f = function(a, at)
local r
if at then
r = string.format("<code>params.%s</code>", at)
else
r = "''root''"
end
if a then
r = string.format("%s<code>.%s</code>", r, a)
end
return r
end
local parent
if access then
parent = Data.got.params[access]
else
parent = Data.got
end
if type(parent) == "table" then
local elem, permit, s, scope, slot, tag, target
if access then
permit = Permit.params
if type(access) == "number" then
slot = tostring(access)
else
slot = access
end
else
permit = Permit.root
end
for k, v in pairs(parent) do
scope = permit[k]
if scope then
s = type(v)
if s == "string" and k ~= "format" then
v = mw.text.trim(v)
end
if scope:find(s, 1, true) then
if scope:find("I18N", 1, true) then
if s == "string" then
elem = fair(v)
elseif s == "table" then
local translated
v, translated = faraway(v)
if v then
if translated and k == "description" then
elem = {
[1] = fair(v),
[2] = translated,
}
else
elem = fair(v)
end
else
elem = false
end
end
if type(v) == "string" then
if k == "deprecated" then
if v == "1" then
v = true
elseif v == "0" then
v = false
end
elem = v
elseif scope:find("nowiki", 1, true) then
elem = mw.text.nowiki(v)
elem = elem:gsub(" " .. string.char(10), "<br>")
v = v:gsub(string.char(13), "")
else
v = flat(v)
end
elseif s == "boolean" then
if scope:find("boolean", 1, true) then
elem = v
else
s = "Type <code>boolean</code> bad for " .. f(k, slot)
Fault(s)
end
end
else
if k == "params" and not access then
v = nil
elem = nil
elseif k == "format" and not access then
elem = mw.text.decode(v)
v = nil
elseif k == "inherits" then
elem = v
if not Data.heirs then
Data.heirs = {}
end
Data.heirs[slot] = v
v = nil
elseif k == "style" then
elem = v
v = nil
elseif s == "string" then
v = mw.text.nowiki(v)
elem = v
else
elem = v
end
end
if type(elem) ~= "nil" then
if not target then
if access then
if not Data.tree.params then
Data.tree.params = {}
end
Data.tree.params[slot] = {}
target = Data.tree.params[slot]
else
Data.tree = {}
target = Data.tree
end
end
target[k] = elem
elem = false
end
if type(v) ~= "nil" then
if not tag then
if access then
if type(v) == "string" and v.sub(1, 1) == "=" then
v = nil
else
if not Data.params then
Data.params = {}
end
Data.params[slot] = {}
tag = Data.params[slot]
end
else
Data.tag = {}
tag = Data.tag
end
end
if type(v) ~= "nil" and k ~= "suggestedvalues" then
tag[k] = v
end
end
else
s = string.format("Type <code>%s</code> bad for %s", scope, f(k, slot))
Fault(s)
end
else
Fault("Unknown component " .. f(k, slot))
end
end -- for k, v
if not access and Data.got.sets then
fellows()
end
else
Fault(f() .. " needs to be of <code>object</code> type")
end
end -- focus()
local function format()
-- Build formatted element.
-- Returns <inline>.
local source = Data.tree.format:lower()
local r, s
if source == "inline" or source == "block" then
r = mw.html.create("i"):wikitext(source)
else
local code
if source:find("|", 1, true) then
local scan = "^[\n ]*%{%{[\n _]*|[\n _]*=[\n _]*%}%}[\n ]*$"
if source:match(scan) then
code = source:gsub("\n", "N")
else
s = mw.text.nowiki(source):gsub("\n", "\n")
s = tostring(mw.html.create("code"):wikitext(s))
Fault("Invalid format " .. s)
source = false
end
else
local words = mw.text.split(source, "%s+")
local show, start, support, unknown
for i = 1, #words do
s = words[i]
if i == 1 then
start = s
end
support = Permit.builder[s]
if support == start or support == "*" then
Permit.builder[s] = true
elseif s:match("^[1-9]%d?") and Permit.builder.align then
Permit.builder.align = tonumber(s)
else
if unknown then
unknown = string.format("%s %s", unknown, s)
else
unknown = s
end
end
end -- i = 1, #words
if unknown then
s = tostring(mw.html.create("code"):css("white-space", "nowrap"):wikitext(s))
Fault("Unknown/misplaced format keyword " .. s)
source = false
start = false
end
if start == "inline" then
if Permit.builder.half == true then
show = "inline half"
code = "{{_ |_=_}}"
elseif Permit.builder.grouped == true then
show = "inline grouped"
code = "{{_ | _=_}}"
elseif Permit.builder.spaced == true then
show = "inline spaced"
code = "{{_ | _ = _ }}"
end
if Permit.builder.newlines == true then
show = show or "inline"
code = code or "{{_|_=_}}"
show = show .. " newlines"
code = string.format("N%sN", code)
end
elseif start == "block" then
local space = "" -- amid "|" and name
local spaced = " " -- preceding "="
local spacer = " " -- following "="
local suffix = "N" -- closing "}}" on new line
show = "block"
if Permit.builder.indent == true then
start = " "
show = "block indent"
else
start = ""
end
if Permit.builder.compressed == true then
spaced = ""
spacer = ""
show = show .. " compressed"
if Permit.builder.last == true then
show = show .. " last"
else
suffix = ""
end
else
if Permit.builder.lead == true then
show = show .. " lead"
space = " "
end
if type(Permit.builder.align) ~= "string" then
local n
s = " align"
if Permit.builder.align == true then
n = 0
if type(Data.got) == "table" and type(Data.got.params) == "table" then
for k, v in pairs(Data.got.params) do
if type(v) == "table" and not v.deprecated and type(k) == "string" then
k = mw.ustring.len(k)
if k > n then
n = k
end
end
end -- for k, v
end
else
n = Permit.builder.align
if type(n) == "number" and n > 1 then
s = string.format("%s %d", s, n)
else
n = 0 -- How come?
end
end
if n > 1 then
spaced = string.rep("_", n - 1) .. " "
end
show = show .. s
elseif Permit.builder.after == true then
spaced = ""
show = show .. " after"
elseif Permit.builder.dense == true then
spaced = ""
spacer = ""
show = show .. " dense"
end
if Permit.builder.last == true then
suffix = spacer
show = show .. " last"
end
end
code = string.format("N{{_N%s|%s_%s=%s_%s}}N", start, space, spaced, spacer, suffix)
if show == "block" then
show = "block newlines"
end
end
if show then
r = mw.html.create("span"):wikitext(show)
end
end
if code then
source = code:gsub("N", "\n")
code = mw.text.nowiki(code):gsub("N", "\n")
code = mw.html.create("code"):css("margin-left", "1em"):css("margin-right", "1em"):wikitext(code)
if r then
r = mw.html.create("span"):node(r):node(code)
else
r = code
end
end
end
if source and Data.tag then
Data.tag.format = source
end
return r
end -- format()
local function formatter()
-- Build presented documentation.
-- Returns <div>.
local r = mw.html.create("div")
local x = fashioned(Data.tree, true, r)
local s
if x then
r = x
end
if Data.leading then
local toc = mw.html.create("div")
local shift
if Config.suppressTOCnum then
toc:addClass(Config.suppressTOCnum)
if type(Config.stylesTOCnum) == "string" then
local src = Config.stylesTOCnum .. "/styles.css"
s = TemplateData.frame:extensionTag("templatestyles", nil, { src = src })
r:newline():node(s)
end
end
toc:addClass("navigation-not-searchable"):css("margin-top", "0.5em"):wikitext("__TOC__")
if Data.sibling then
local block = mw.html.create("div")
if TemplateData.ltr then
shift = "right"
else
shift = "left"
end
block:css("float", shift):wikitext(Data.sibling)
r:newline():node(block):newline()
end
r:newline():node(toc):newline()
if shift then
r:node(mw.html.create("div"):css("clear", shift)):newline()
end
end
s = features()
if s then
if Data.leading then
r:node(mw.html.create("h" .. Config.nested):wikitext(factory("doc-params"))):newline()
end
r:node(s)
end
if Data.shared then
local global = mw.html.create("div"):attr("id", "templatedata-global")
local shift
if TemplateData.ltr then
shift = "right"
else
shift = "left"
end
global:css("float", shift):wikitext(string.format("[[%s|%s]]", Data.shared, "Global"))
r:newline():node(global)
end
if Data.tree and Data.tree.format then
local e = format()
if e then
local show = "Format"
if Config.supportFormat then
show = string.format("[[%s|%s]]", Config.supportFormat, show)
end
r:node(mw.html.create("p"):addClass("navigation-not-searchable"):wikitext(show .. ": "):node(e))
end
end
return r
end -- formatter()
local function free()
-- Remove JSON comment lines.
if Data.source:find("//", 1, true) then
Data.source:gsub("([{,\"'])(%s*\n%s*//.*\n%s*)([{},\"'])", "%1%3")
end
end -- free()
local function full()
-- Build survey table from JSON data, append invisible <templatedata>.
Data.div = mw.html.create("div"):addClass("mw-templatedata-doc-wrap")
if Permit.css.bg then
Data.div:css(Permit.css.bg)
end
if Permit.css.fg then
Data.div:css(Permit.css.fg)
end
focus()
if Data.tag then
if type(Data.got.params) == "table" then
for k, v in pairs(Data.got.params) do
focus(k)
end -- for k, v
if Data.heirs then
fathers()
end
end
end
Data.div:node(formatter())
if not Data.lazy then
Data.slim = flush()
if TemplateData.frame then
local div = mw.html.create("div")
local tdata = {
[1] = "templatedata",
[2] = Data.slim,
}
Data.strip = TemplateData.frame:callParserFunction("#tag", tdata)
div:wikitext(Data.strip)
if Config.loudly then
Data.div:node(mw.html.create("hr"):css({ height = "7ex" }))
else
div:css("display", "none")
end
Data.div:node(div)
end
end
if Data.lasting then
Fault("deprecated type syntax")
end
if Data.less then
Fault(Config.solo)
end
end -- full()
local function furnish(adapt, arglist)
-- Analyze transclusion.
-- Parameter:
-- adapt -- table, #invoke parameters
-- arglist -- table, template parameters
-- Returns string.
local source
favorize()
-- deprecated:
for k, v in pairs(Config.basicCnf) do
if adapt[k] and adapt[k] ~= "" then
Config[v] = adapt[k]
end
end -- for k, v
if arglist.heading and arglist.heading:match("^[3-6]$") then
Config.nested = arglist.heading
else
Config.nested = "2"
end
Config.loudly = faculty(arglist.debug or adapt.debug)
Data.lazy = faculty(arglist.lazy) and not Config.loudly
Data.leading = faculty(arglist.TOC)
if Data.leading and arglist.TOCsibling then
Data.sibling = mw.text.trim(arglist.TOCsibling)
end
if arglist.lang then
Data.slang = arglist.lang:lower()
elseif adapt.lang then
Data.slang = adapt.lang:lower()
end
if arglist.JSON then
source = arglist.JSON
elseif arglist.Global then
source = TemplateData.getGlobalJSON(arglist.Global, arglist.Local)
elseif arglist[1] then
local s = mw.text.trim(arglist[1])
local start = s:sub(1, 1)
if start == "<" then
Data.strip = s
elseif start == "{" then
source = s
elseif mw.ustring.sub(s, 1, 8) == mw.ustring.char(127, 39, 34, 96, 85, 78, 73, 81) then
Data.strip = s
end
end
if type(arglist.vertical) == "string" and arglist.vertical:match("^%d*%.?%d+[emprx]+$") then
Data.scroll = arglist.vertical
end
if not source then
Data.title = mw.title.getCurrentTitle()
source = find()
if not source and not Data.title.text:match(Config.subpage) then
local s = string.format(Config.suffix, Data.title.prefixedText)
Data.title = mw.title.new(s)
if Data.title.exists then
source = find()
end
end
end
if not Data.lazy then
if not Data.title then
Data.title = mw.title.getCurrentTitle()
end
Data.lazy = Data.title.text:match(Config.subpage)
end
if type(source) == "string" then
TemplateData.getPlainJSON(source)
end
return finalize(faculty(arglist.source))
end -- furnish()
Failsafe.failsafe = function(atleast)
-- Retrieve versioning and check for compliance.
-- Precondition:
-- atleast -- string, with required version
-- or wikidata|item|~|@ or false
-- Postcondition:
-- Returns string -- with queried version/item, also if problem
-- false -- if appropriate
-- 2024-03-01
local since = atleast
local last = (since == "~")
local linked = (since == "@")
local link = (since == "item")
local r
if last or link or linked or since == "wikidata" then
local item = Failsafe.item
since = false
if type(item) == "number" and item > 0 then
local suited = string.format("Q%d", item)
if link then
r = suited
else
local entity = mw.wikibase.getEntity(suited)
if type(entity) == "table" then
local seek = Failsafe.serialProperty or "P348"
local vsn = entity:formatPropertyValues(seek)
if type(vsn) == "table" and type(vsn.value) == "string" and vsn.value ~= "" then
if last and vsn.value == Failsafe.serial then
r = false
elseif linked then
if mw.title.getCurrentTitle().prefixedText == mw.wikibase.getSitelink(suited) then
r = false
else
r = suited
end
else
r = vsn.value
end
end
end
end
elseif link then
r = false
end
end
if type(r) == "nil" then
if not since or since <= Failsafe.serial then
r = Failsafe.serial
else
r = false
end
end
return r
end -- Failsafe.failsafe()
TemplateData.getGlobalJSON = function(access, adapt)
-- Retrieve TemplateData from a global repository (JSON).
-- Parameter:
-- access -- string, with page specifier (on WikiMedia Commons)
-- adapt -- JSON string or table with local overrides
-- Returns true, if succeeded.
local plugin = Fetch("/global")
local r
if type(plugin) == "table" and type(plugin.fetch) == "function" then
local s, got = plugin.fetch(access, adapt)
if got then
Data.got = got
Data.order = got.paramOrder
Data.shared = s
r = true
full()
else
Fault(s)
end
end
return r
end -- TemplateData.getGlobalJSON()
TemplateData.getPlainJSON = function(adapt)
-- Reduce enhanced JSON data to plain text localized JSON.
-- Parameter:
-- adapt -- string, with enhanced JSON
-- Returns string, or not.
if type(adapt) == "string" then
-- local JSONutil = Fetch("JSONutil", true) -- DON'T check for Module:JSONutil. (doesn't exist in English WP, blocked from creation.)
local JSONutil = nil -- DO act as if Fetch() failed.
Data.source = adapt
free()
if JSONutil then
local Multilingual = Fetch("Multilingual", true)
local f
if Multilingual then
f = Multilingual.i18n
end
Data.got = JSONutil.fetch(Data.source, true, f)
else
local lucky
lucky, Data.got = pcall(mw.text.jsonDecode, Data.source)
end
if type(Data.got) == "table" then
full()
elseif not Data.strip then
local scream = type(Data.got)
if scream == "string" then
scream = Data.got
else
scream = "Data.got: " .. scream
end
Fault("fatal JSON error: " .. scream)
end
end
return Data.slim
end -- TemplateData.getPlainJSON()
TemplateData.test = function(adapt, arglist)
TemplateData.frame = mw.getCurrentFrame()
return furnish(adapt, arglist)
end -- TemplateData.test()
-- Export.
local p = {}
p.f = function(frame)
-- Template call.
local lucky, r
TemplateData.frame = frame
lucky, r = pcall(furnish, frame.args, frame:getParent().args)
if not lucky then
Fault("INTERNAL: " .. r)
r = failures()
end
return r
end -- p.f
p.failsafe = function(frame)
-- Versioning interface.
local s = type(frame)
local since
if s == "table" then
since = frame.args[1]
elseif s == "string" then
since = frame
end
if since then
since = mw.text.trim(since)
if since == "" then
since = false
end
end
return Failsafe.failsafe(since) or ""
end -- p.failsafe
p.TemplateData = function()
-- Module interface.
return TemplateData
end
setmetatable(p, {
__call = function(func, ...)
setmetatable(p, nil)
return Failsafe
end,
})
return p
2dd3b90kpdohdijcui9w39wr2ft47sq
Módulo:Format TemplateData/config
828
8437
75038
73470
2026-07-30T13:47:38Z
en>RogueScholar
0
Remove 'cssParWrap' table containing negative inline margin values to match default TemplateData table presentation
75038
Scribunto
text/plain
--[=[
Configuration for [[Module:Format TemplateData]] on enwiki
mw.loadData()
]=]
local Serial = "2026-01-25"
return {
catProblem = "Templates with TemplateData errors",
classMultiColumns = "column-multiple",
classNoNumTOC = "nonumtoc",
classTable = {
"wikitable",
"templatedata-params"
},
cssParams = {
["border"] = "thin solid var(--background-color-progressive-subtle, #b3b7ff)",
["margin-left"] = "auto",
["margin-right"] = "auto"
},
docpageCreate = "%s/doc",
docpageDetect = "/doc$",
failsafe = Serial,
helpAliases = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#aliases",
helpBoolean = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#boolean",
helpContent = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#Content",
helpDate = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#date",
helpDefault = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#default",
helpFile = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#wiki-file-name",
helpFormat = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#format",
helpLine = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#line",
helpNumber = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#number",
helpPage = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#wiki-page-name",
helpString = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#string",
helpTemplate = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#wiki-template-name",
helpURL = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#url",
helpUser = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#wiki-user-name",
msgDescMiss = "missing <code>description</code>",
permit = {
boole = {
[true] = {
css = {
["color"] = "var(--color-content-added, #050)",
["font-weight"] = "700"
},
lead = false,
show = "True"
},
[false] = {
css = {
["color"] = "var(--color-content-removed, #610)",
["font-weight"] = "700"
},
lead = false,
show = "False"
}
},
css = {
bg = {},
deprecated = {
["background-color"] = "var(--background-color-destructive-subtle, #fdd)",
["border-left"] = "3px dotted var(--color-error, red)",
["color"] = "var(--color-base, #000)"
},
fg = {},
optional = {
["border-left"] = "3px solid #ccc",
["color"] = "var(--color-base, #000)"
},
required = {
["border-left"] = "3px solid #000",
["color"] = "var(--color-base, #000)"
},
suggested = {
["border-left"] = "3px solid var(--border-color-subtle, #888)",
["color"] = "var(--color-base, #000)"
},
tableheadbg = {
["background-color"] = "var(--background-color-progressive-subtle, #b3b7ff)",
["color"] = "var(--color-base, #000)"
}
}
},
serial = Serial,
tStylesMultiColumns = "column-multiple",
tStylesTOCnum = "TOC nonum"
}
n89gwq7t3gsq9p5a5i3eevisuxrxfab
75039
75038
2026-08-24T01:00:13Z
Robertsky
10424
1 versaun husi [[:en:Module:Format_TemplateData/config]]
75038
Scribunto
text/plain
--[=[
Configuration for [[Module:Format TemplateData]] on enwiki
mw.loadData()
]=]
local Serial = "2026-01-25"
return {
catProblem = "Templates with TemplateData errors",
classMultiColumns = "column-multiple",
classNoNumTOC = "nonumtoc",
classTable = {
"wikitable",
"templatedata-params"
},
cssParams = {
["border"] = "thin solid var(--background-color-progressive-subtle, #b3b7ff)",
["margin-left"] = "auto",
["margin-right"] = "auto"
},
docpageCreate = "%s/doc",
docpageDetect = "/doc$",
failsafe = Serial,
helpAliases = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#aliases",
helpBoolean = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#boolean",
helpContent = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#Content",
helpDate = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#date",
helpDefault = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#default",
helpFile = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#wiki-file-name",
helpFormat = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#format",
helpLine = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#line",
helpNumber = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#number",
helpPage = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#wiki-page-name",
helpString = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#string",
helpTemplate = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#wiki-template-name",
helpURL = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#url",
helpUser = "mediawikiwiki:Special:MyLanguage/Help:TemplateData#wiki-user-name",
msgDescMiss = "missing <code>description</code>",
permit = {
boole = {
[true] = {
css = {
["color"] = "var(--color-content-added, #050)",
["font-weight"] = "700"
},
lead = false,
show = "True"
},
[false] = {
css = {
["color"] = "var(--color-content-removed, #610)",
["font-weight"] = "700"
},
lead = false,
show = "False"
}
},
css = {
bg = {},
deprecated = {
["background-color"] = "var(--background-color-destructive-subtle, #fdd)",
["border-left"] = "3px dotted var(--color-error, red)",
["color"] = "var(--color-base, #000)"
},
fg = {},
optional = {
["border-left"] = "3px solid #ccc",
["color"] = "var(--color-base, #000)"
},
required = {
["border-left"] = "3px solid #000",
["color"] = "var(--color-base, #000)"
},
suggested = {
["border-left"] = "3px solid var(--border-color-subtle, #888)",
["color"] = "var(--color-base, #000)"
},
tableheadbg = {
["background-color"] = "var(--background-color-progressive-subtle, #b3b7ff)",
["color"] = "var(--color-base, #000)"
}
}
},
serial = Serial,
tStylesMultiColumns = "column-multiple",
tStylesTOCnum = "TOC nonum"
}
n89gwq7t3gsq9p5a5i3eevisuxrxfab
Template:Redirect category shell
10
8530
74926
73664
2026-08-20T17:28:15Z
en>Jonesey95
0
magic word has been implemented as of today
74926
wikitext
text/x-wiki
__NONEWSECTIONLINK__{{Mbox
| name = Redirect category shell
| type = move
| image = none
| style = margin-top: 1.1em; border: solid 1px darkblue; border-left-width: 0.5em;
| textstyle = padding-top: 0.9em; padding-bottom: 0.9em;
| text = '''This {{Talk other|talk page|page}} is a [[Wikipedia:Redirect|redirect]]. <small>The following [[Wikipedia:Categorizing redirects|categories]] are used to track and monitor this redirect:</small>'''{{#if:{{{h|}}}
|{{block indent|1= ''{{{h}}}''}}
}}
<!--
Automatically detect protected redirects:
--><includeonly>{{#switch: {{PROTECTIONLEVEL:move}}
|sysop|templateeditor|extendedconfirmed={{pp-move|small=yes|catonly=no}}
}}{{#switch: {{PROTECTIONLEVEL:edit}}
|sysop
|templateeditor
|extendedconfirmed
|autoconfirmed={{pp-protected|small=yes}}{{R protected}}
| <!--Not protected, or only semi-move-protected-->
}}</includeonly>{{#if: {{{1|}}}||<includeonly>
* {{red|'''Important – Please Read! {{maroon|This template should {{em|not}} be applied without parameters by bot nor by any automated or semi-automated process. It should {{em|not}} be used without parameters {{em|unless you want to learn how to categorize redirects}}. For editors who want to learn how to categorize redirects, this template is a {{em|learning tool}}. {{em|Only}} those editors who intend to return to the redirect to learn which rcats to use should apply this template without parameters, or with an empty first parameter!}}'''}}</includeonly>
* '''Manifold sort''': If help is needed to determine appropriate categories, then this redirect populates '''{{Cat|Miscellaneous redirects}}'''. Monitors of that category will check this redirect and add or remove [[Wikipedia:Categorizing redirects|rcats]] as needed.{{#ifeq: {{lc:{{{nocat|false}}}}} | false |{{{category|<includeonly>[[Category:Miscellaneous redirects]]</includeonly>}}}}}
}}
{{#if: {{{2|}}}|{{{2}}}|{{{1|}}}}}{{#if: {{{1|}}}{{{2|}}}||{{#ifeq: {{ROOTPAGENAME}}|Redirect category shell||[[Category:Redirect category shell without parameters]]}}}}
''<small>When appropriate, [[Wikipedia:Protection policy|protection levels]] are automatically sensed, described and categorized.</small>''
}}<includeonly>__EXPECTSHORTPAGE__<!--To prevent pages from appearing on Special:ShortPages. See Tech News 2026-34. --></includeonly><noinclude>
{{Documentation}}
</noinclude>
dt89h4apbs7l1rhl2q3letiqcxmyceg
74927
74926
2026-08-24T00:43:41Z
Robertsky
10424
1 versaun husi [[:en:Template:Redirect_category_shell]]
74926
wikitext
text/x-wiki
__NONEWSECTIONLINK__{{Mbox
| name = Redirect category shell
| type = move
| image = none
| style = margin-top: 1.1em; border: solid 1px darkblue; border-left-width: 0.5em;
| textstyle = padding-top: 0.9em; padding-bottom: 0.9em;
| text = '''This {{Talk other|talk page|page}} is a [[Wikipedia:Redirect|redirect]]. <small>The following [[Wikipedia:Categorizing redirects|categories]] are used to track and monitor this redirect:</small>'''{{#if:{{{h|}}}
|{{block indent|1= ''{{{h}}}''}}
}}
<!--
Automatically detect protected redirects:
--><includeonly>{{#switch: {{PROTECTIONLEVEL:move}}
|sysop|templateeditor|extendedconfirmed={{pp-move|small=yes|catonly=no}}
}}{{#switch: {{PROTECTIONLEVEL:edit}}
|sysop
|templateeditor
|extendedconfirmed
|autoconfirmed={{pp-protected|small=yes}}{{R protected}}
| <!--Not protected, or only semi-move-protected-->
}}</includeonly>{{#if: {{{1|}}}||<includeonly>
* {{red|'''Important – Please Read! {{maroon|This template should {{em|not}} be applied without parameters by bot nor by any automated or semi-automated process. It should {{em|not}} be used without parameters {{em|unless you want to learn how to categorize redirects}}. For editors who want to learn how to categorize redirects, this template is a {{em|learning tool}}. {{em|Only}} those editors who intend to return to the redirect to learn which rcats to use should apply this template without parameters, or with an empty first parameter!}}'''}}</includeonly>
* '''Manifold sort''': If help is needed to determine appropriate categories, then this redirect populates '''{{Cat|Miscellaneous redirects}}'''. Monitors of that category will check this redirect and add or remove [[Wikipedia:Categorizing redirects|rcats]] as needed.{{#ifeq: {{lc:{{{nocat|false}}}}} | false |{{{category|<includeonly>[[Category:Miscellaneous redirects]]</includeonly>}}}}}
}}
{{#if: {{{2|}}}|{{{2}}}|{{{1|}}}}}{{#if: {{{1|}}}{{{2|}}}||{{#ifeq: {{ROOTPAGENAME}}|Redirect category shell||[[Category:Redirect category shell without parameters]]}}}}
''<small>When appropriate, [[Wikipedia:Protection policy|protection levels]] are automatically sensed, described and categorized.</small>''
}}<includeonly>__EXPECTSHORTPAGE__<!--To prevent pages from appearing on Special:ShortPages. See Tech News 2026-34. --></includeonly><noinclude>
{{Documentation}}
</noinclude>
dt89h4apbs7l1rhl2q3letiqcxmyceg
Módulo:Transclusion count/data/P
828
8586
75036
73787
2026-08-23T05:09:55Z
en>Ahechtbot
0
[[Wikipedia:BOT|Bot]]: Updated page.
75036
Scribunto
text/plain
return {
["P"] = 6400,
["P-1"] = 4800,
["P-phrases"] = 4200,
["P."] = 4000,
["P1"] = 233000,
["P2"] = 513000,
["PAGENAMEBASE"] = 1900000,
["PAGENAMEU"] = 56000,
["PAK"] = 3500,
["PD-US"] = 8600,
["PD-US-1923-abroad"] = 5400,
["PD-US-expired"] = 5000,
["PD-US-expired-abroad"] = 8700,
["PD-US-no_notice"] = 2300,
["PD-art"] = 3200,
["PD-ineligible-USonly"] = 7700,
["PD-notice"] = 26000,
["PD-old-100"] = 3200,
["PD-self"] = 31000,
["PD-textlogo"] = 6200,
["PDB_Gallery"] = 2900,
["PDanube"] = 3300,
["PER"] = 3500,
["PHI"] = 2700,
["PHL"] = 3700,
["PH_census"] = 2000,
["PLANTS"] = 4300,
["PM20"] = 3300,
["PMID"] = 6500,
["PNsign"] = 2100,
["POL"] = 68000,
["POR"] = 5600,
["POTD/Day"] = 2900,
["POTD_archive"] = 2500,
["POTD_archive/footer"] = 2500,
["POTD_default"] = 12000,
["POTD_image"] = 3900,
["POTD_image1"] = 2500,
["POTD_image2"] = 2500,
["POTD_navigation"] = 7800,
["POTD_texttitle"] = 2600,
["POTDlink"] = 8200,
["POV"] = 3100,
["POW"] = 2500,
["PR/header"] = 3100,
["PR/heading"] = 7200,
["PRI"] = 2200,
["PRT"] = 6400,
["PR_link"] = 118000,
["PS"] = 3100,
["Pad"] = 51000,
["Paddle_Steamer"] = 3100,
["Page"] = 4400,
["Page_name_sub"] = 52000,
["Page_needed"] = 23000,
["Page_tabs"] = 4100,
["Page_tabs/styles.css"] = 4100,
["Pagelinks"] = 75000,
["Pagelist"] = 15000,
["Pagetype"] = 11300000,
["Paid"] = 17000,
["Pakistani_English"] = 4000,
["Para"] = 2880000,
["Parabr"] = 3800,
["Paragraph_break"] = 2150000,
["Param_value"] = 152000,
["Param_value/styles.css"] = 152000,
["Parameter"] = 3040000,
["Parameter_names_example"] = 2700,
["ParmPart"] = 15000,
["Partial"] = 5800,
["Partial_minor_planet_designation"] = 5700,
["Partly_done"] = 4300,
["Party_color"] = 82000,
["Party_color_cell"] = 6600,
["Party_index_link"] = 3300,
["Party_name_with_color"] = 7200,
["Party_name_with_colour"] = 4200,
["Party_shading/Democratic"] = 19000,
["Party_shading/Independent"] = 3400,
["Party_shading/Republican"] = 18000,
["Party_stripe"] = 17000,
["Pass"] = 3300,
["Pb"] = 2120000,
["Pd-notice"] = 2200,
["Pedigree"] = 4400,
["Peer_review/heading"] = 10000,
["Peer_review_links"] = 3200,
["Peer_review_tools"] = 9600,
["Penalty_shoot-out"] = 6000,
["Pending"] = 6400,
["Pending_DYK_American_hooks"] = 5100,
["Pending_DYK_biographies"] = 11000,
["Pending_film"] = 2700,
["Pending_films_key"] = 2600,
["Pengoal"] = 12000,
["Penmiss"] = 15000,
["Percentage"] = 18000,
["Performance_key"] = 2800,
["Performance_key/styles.css"] = 2800,
["Period_color"] = 28000,
["Period_end"] = 26000,
["Period_id"] = 29000,
["Period_start"] = 29000,
["Personal_attack_removed"] = 2100,
["PeruTasks"] = 19000,
["Phab"] = 8100,
["Phabricator"] = 8300,
["Phanerozoic_250px"] = 25000,
["PharmNavFootnote"] = 5600,
["Philippine_census_reference"] = 2000,
["Philippine_name"] = 4300,
["Photo"] = 2200,
["Photo_montage"] = 4900,
["Photo_requested"] = 108000,
["Photograph_requested"] = 4600,
["Photomontage"] = 4400,
["Photoreq"] = 2900,
["Picture_of_the_day"] = 8200,
["Pie_chart"] = 8300,
["Pie_chart/styles.css"] = 8300,
["Ping"] = 284000,
["Pipe"] = 97000,
["Place_name_disambiguation"] = 40000,
["Plain_link"] = 119000,
["Plain_list"] = 16000,
["Plain_text"] = 109000,
["Plainlink"] = 30000,
["Plainlist"] = 390000,
["Plainlist/styles.css"] = 3110000,
["Player"] = 3900,
["Player2"] = 2900,
["Please_check_ISSN"] = 16000,
["Plural"] = 107000,
["Pluralize_from_text"] = 2830000,
["Pn"] = 2800,
["Poem_quote"] = 3900,
["Poemquote"] = 2700,
["Politician_icon"] = 34000,
["Politician_icon2"] = 34000,
["Politics_sidebar_below"] = 19000,
["Politics_sidebar_title"] = 19000,
["Polluted_category"] = 2500,
["Polparty"] = 31000,
["Pop_density"] = 10000,
["Population_Germany"] = 14000,
["Portal"] = 10800000,
["Portal-Class"] = 8100,
["Portal-inline"] = 245000,
["Portal_and_project"] = 261000,
["Portal_bar"] = 185000,
["Portal_box"] = 2100,
["Portalbar"] = 9900,
["Portuguese_name"] = 10000,
["Possible"] = 4000,
["Possibly_empty_category"] = 70000,
["Post-nominals"] = 63000,
["Post-nominals/AUS"] = 8500,
["Post-nominals/CAN"] = 10000,
["Post-nominals/GBR"] = 33000,
["Post-nominals/NZL"] = 4500,
["Postnominals"] = 11000,
["Pp"] = 8800,
["Pp-book-cover"] = 52000,
["Pp-extended"] = 11000,
["Pp-move"] = 11000,
["Pp-pc"] = 4400,
["Pp-protected"] = 13000,
["Pp-semi"] = 6800,
["Pp-semi-indef"] = 4800,
["Pp-template"] = 4400,
["Pp-vandalism"] = 2800,
["Precision"] = 6000,
["Preferences"] = 18000,
["Preferences/section"] = 3100,
["PresFoot"] = 3300,
["PresHead"] = 3900,
["PresRow"] = 3900,
["Press"] = 5800,
["Preview_warning"] = 608000,
["Primary_source_inline"] = 8200,
["Primary_sources"] = 33000,
["Principal_rank"] = 653000,
["Prisoner_of_war"] = 2600,
["Prl"] = 118000,
["ProCyclingStats"] = 2400,
["ProQuest"] = 35000,
["Professional_wrestling_profiles"] = 3200,
["Professional_wrestling_results_table"] = 3200,
["Profit"] = 3600,
["Progress_box"] = 19000,
["Project-Class"] = 13000,
["Project_other"] = 18000,
["Promotional"] = 18000,
["Proper_name"] = 2800,
["Prose"] = 3300,
["Protected_page_maintenance_message"] = 42000,
["Protection_padlock"] = 25000,
["Proxy_block"] = 2200,
["Pso"] = 5000,
["Purge"] = 568000,
["Purge_button"] = 19000,
["Purge_button/styles.css"] = 19000,
["Module:POTD_titletext"] = 2500,
["Module:Page"] = 123000,
["Module:PageLinks"] = 75000,
["Module:Page_tabs"] = 4100,
["Module:Pagelist"] = 15000,
["Module:Pagetype"] = 19100000,
["Module:Pagetype/config"] = 19100000,
["Module:Pagetype/disambiguation"] = 13300000,
["Module:Pagetype/rfd"] = 17200000,
["Module:Pagetype/setindex"] = 13500000,
["Module:Pagetype/softredirect"] = 17800000,
["Module:ParameterCount"] = 1700000,
["Module:Parameter_names_example"] = 2700,
["Module:Parameter_validation"] = 165000,
["Module:Parameter_validation/default_config"] = 165000,
["Module:Party_name_with_color"] = 13000,
["Module:Percentage"] = 18000,
["Module:Person_date"] = 1780000,
["Module:Person_height"] = 283000,
["Module:Person_length"] = 7700,
["Module:Person_weight"] = 85000,
["Module:Phone_size"] = 2100,
["Module:Photo_montage"] = 4900,
["Module:Piechart"] = 8300,
["Module:Piechart/cuts.json"] = 8300,
["Module:Plain_text"] = 1880000,
["Module:Pn"] = 4800,
["Module:Political_party"] = 150000,
["Module:Political_party/A"] = 27000,
["Module:Political_party/B"] = 20000,
["Module:Political_party/C"] = 49000,
["Module:Political_party/D"] = 58000,
["Module:Political_party/E"] = 6900,
["Module:Political_party/F"] = 15000,
["Module:Political_party/G"] = 22000,
["Module:Political_party/H"] = 7500,
["Module:Political_party/I"] = 62000,
["Module:Political_party/J"] = 10000,
["Module:Political_party/K"] = 6200,
["Module:Political_party/L"] = 47000,
["Module:Political_party/M"] = 15000,
["Module:Political_party/N"] = 38000,
["Module:Political_party/O"] = 7100,
["Module:Political_party/P"] = 34000,
["Module:Political_party/R"] = 58000,
["Module:Political_party/S"] = 37000,
["Module:Political_party/T"] = 15000,
["Module:Political_party/U"] = 22000,
["Module:Political_party/V"] = 7900,
["Module:Political_party/W"] = 15000,
["Module:Political_party/Y"] = 2400,
["Module:Pop_density"] = 10000,
["Module:PopulationFromWikidata"] = 15000,
["Module:Portal"] = 11300000,
["Module:Portal-inline"] = 250000,
["Module:Portal/images/a"] = 2050000,
["Module:Portal/images/aliases"] = 356000,
["Module:Portal/images/b"] = 3560000,
["Module:Portal/images/c"] = 2260000,
["Module:Portal/images/d"] = 120000,
["Module:Portal/images/e"] = 594000,
["Module:Portal/images/f"] = 1020000,
["Module:Portal/images/g"] = 700000,
["Module:Portal/images/h"] = 546000,
["Module:Portal/images/i"] = 1300000,
["Module:Portal/images/j"] = 346000,
["Module:Portal/images/k"] = 88000,
["Module:Portal/images/l"] = 530000,
["Module:Portal/images/m"] = 771000,
["Module:Portal/images/n"] = 840000,
["Module:Portal/images/o"] = 460000,
["Module:Portal/images/other"] = 271000,
["Module:Portal/images/p"] = 979000,
["Module:Portal/images/q"] = 3300,
["Module:Portal/images/r"] = 441000,
["Module:Portal/images/s"] = 2000000,
["Module:Portal/images/t"] = 860000,
["Module:Portal/images/u"] = 1390000,
["Module:Portal/images/v"] = 346000,
["Module:Portal/images/w"] = 213000,
["Module:Portal/images/y"] = 39000,
["Module:Portal/images/z"] = 6500,
["Module:Portal/styles.css"] = 10800000,
["Module:Portal_bar"] = 206000,
["Module:Portal_bar/styles.css"] = 206000,
["Module:PrevalenceData"] = 8300,
["Module:Professional_wrestling_profiles"] = 3200,
["Module:Professional_wrestling_results_table"] = 3200,
["Module:Progress_box"] = 19000,
["Module:Progress_box/config"] = 19000,
["Module:Progress_box/styles.css"] = 19000,
["Module:Protect"] = 126000,
["Module:Protected_edit_request"] = 60000,
["Module:Protection_banner"] = 74000,
["Module:Protection_banner/config"] = 74000,
["Module:Purge"] = 591000,
}
7esc1ag0vtespwi4dle2ds32xzhjm7c
75037
75036
2026-08-24T01:00:13Z
Robertsky
10424
1 versaun husi [[:en:Module:Transclusion_count/data/P]]
75036
Scribunto
text/plain
return {
["P"] = 6400,
["P-1"] = 4800,
["P-phrases"] = 4200,
["P."] = 4000,
["P1"] = 233000,
["P2"] = 513000,
["PAGENAMEBASE"] = 1900000,
["PAGENAMEU"] = 56000,
["PAK"] = 3500,
["PD-US"] = 8600,
["PD-US-1923-abroad"] = 5400,
["PD-US-expired"] = 5000,
["PD-US-expired-abroad"] = 8700,
["PD-US-no_notice"] = 2300,
["PD-art"] = 3200,
["PD-ineligible-USonly"] = 7700,
["PD-notice"] = 26000,
["PD-old-100"] = 3200,
["PD-self"] = 31000,
["PD-textlogo"] = 6200,
["PDB_Gallery"] = 2900,
["PDanube"] = 3300,
["PER"] = 3500,
["PHI"] = 2700,
["PHL"] = 3700,
["PH_census"] = 2000,
["PLANTS"] = 4300,
["PM20"] = 3300,
["PMID"] = 6500,
["PNsign"] = 2100,
["POL"] = 68000,
["POR"] = 5600,
["POTD/Day"] = 2900,
["POTD_archive"] = 2500,
["POTD_archive/footer"] = 2500,
["POTD_default"] = 12000,
["POTD_image"] = 3900,
["POTD_image1"] = 2500,
["POTD_image2"] = 2500,
["POTD_navigation"] = 7800,
["POTD_texttitle"] = 2600,
["POTDlink"] = 8200,
["POV"] = 3100,
["POW"] = 2500,
["PR/header"] = 3100,
["PR/heading"] = 7200,
["PRI"] = 2200,
["PRT"] = 6400,
["PR_link"] = 118000,
["PS"] = 3100,
["Pad"] = 51000,
["Paddle_Steamer"] = 3100,
["Page"] = 4400,
["Page_name_sub"] = 52000,
["Page_needed"] = 23000,
["Page_tabs"] = 4100,
["Page_tabs/styles.css"] = 4100,
["Pagelinks"] = 75000,
["Pagelist"] = 15000,
["Pagetype"] = 11300000,
["Paid"] = 17000,
["Pakistani_English"] = 4000,
["Para"] = 2880000,
["Parabr"] = 3800,
["Paragraph_break"] = 2150000,
["Param_value"] = 152000,
["Param_value/styles.css"] = 152000,
["Parameter"] = 3040000,
["Parameter_names_example"] = 2700,
["ParmPart"] = 15000,
["Partial"] = 5800,
["Partial_minor_planet_designation"] = 5700,
["Partly_done"] = 4300,
["Party_color"] = 82000,
["Party_color_cell"] = 6600,
["Party_index_link"] = 3300,
["Party_name_with_color"] = 7200,
["Party_name_with_colour"] = 4200,
["Party_shading/Democratic"] = 19000,
["Party_shading/Independent"] = 3400,
["Party_shading/Republican"] = 18000,
["Party_stripe"] = 17000,
["Pass"] = 3300,
["Pb"] = 2120000,
["Pd-notice"] = 2200,
["Pedigree"] = 4400,
["Peer_review/heading"] = 10000,
["Peer_review_links"] = 3200,
["Peer_review_tools"] = 9600,
["Penalty_shoot-out"] = 6000,
["Pending"] = 6400,
["Pending_DYK_American_hooks"] = 5100,
["Pending_DYK_biographies"] = 11000,
["Pending_film"] = 2700,
["Pending_films_key"] = 2600,
["Pengoal"] = 12000,
["Penmiss"] = 15000,
["Percentage"] = 18000,
["Performance_key"] = 2800,
["Performance_key/styles.css"] = 2800,
["Period_color"] = 28000,
["Period_end"] = 26000,
["Period_id"] = 29000,
["Period_start"] = 29000,
["Personal_attack_removed"] = 2100,
["PeruTasks"] = 19000,
["Phab"] = 8100,
["Phabricator"] = 8300,
["Phanerozoic_250px"] = 25000,
["PharmNavFootnote"] = 5600,
["Philippine_census_reference"] = 2000,
["Philippine_name"] = 4300,
["Photo"] = 2200,
["Photo_montage"] = 4900,
["Photo_requested"] = 108000,
["Photograph_requested"] = 4600,
["Photomontage"] = 4400,
["Photoreq"] = 2900,
["Picture_of_the_day"] = 8200,
["Pie_chart"] = 8300,
["Pie_chart/styles.css"] = 8300,
["Ping"] = 284000,
["Pipe"] = 97000,
["Place_name_disambiguation"] = 40000,
["Plain_link"] = 119000,
["Plain_list"] = 16000,
["Plain_text"] = 109000,
["Plainlink"] = 30000,
["Plainlist"] = 390000,
["Plainlist/styles.css"] = 3110000,
["Player"] = 3900,
["Player2"] = 2900,
["Please_check_ISSN"] = 16000,
["Plural"] = 107000,
["Pluralize_from_text"] = 2830000,
["Pn"] = 2800,
["Poem_quote"] = 3900,
["Poemquote"] = 2700,
["Politician_icon"] = 34000,
["Politician_icon2"] = 34000,
["Politics_sidebar_below"] = 19000,
["Politics_sidebar_title"] = 19000,
["Polluted_category"] = 2500,
["Polparty"] = 31000,
["Pop_density"] = 10000,
["Population_Germany"] = 14000,
["Portal"] = 10800000,
["Portal-Class"] = 8100,
["Portal-inline"] = 245000,
["Portal_and_project"] = 261000,
["Portal_bar"] = 185000,
["Portal_box"] = 2100,
["Portalbar"] = 9900,
["Portuguese_name"] = 10000,
["Possible"] = 4000,
["Possibly_empty_category"] = 70000,
["Post-nominals"] = 63000,
["Post-nominals/AUS"] = 8500,
["Post-nominals/CAN"] = 10000,
["Post-nominals/GBR"] = 33000,
["Post-nominals/NZL"] = 4500,
["Postnominals"] = 11000,
["Pp"] = 8800,
["Pp-book-cover"] = 52000,
["Pp-extended"] = 11000,
["Pp-move"] = 11000,
["Pp-pc"] = 4400,
["Pp-protected"] = 13000,
["Pp-semi"] = 6800,
["Pp-semi-indef"] = 4800,
["Pp-template"] = 4400,
["Pp-vandalism"] = 2800,
["Precision"] = 6000,
["Preferences"] = 18000,
["Preferences/section"] = 3100,
["PresFoot"] = 3300,
["PresHead"] = 3900,
["PresRow"] = 3900,
["Press"] = 5800,
["Preview_warning"] = 608000,
["Primary_source_inline"] = 8200,
["Primary_sources"] = 33000,
["Principal_rank"] = 653000,
["Prisoner_of_war"] = 2600,
["Prl"] = 118000,
["ProCyclingStats"] = 2400,
["ProQuest"] = 35000,
["Professional_wrestling_profiles"] = 3200,
["Professional_wrestling_results_table"] = 3200,
["Profit"] = 3600,
["Progress_box"] = 19000,
["Project-Class"] = 13000,
["Project_other"] = 18000,
["Promotional"] = 18000,
["Proper_name"] = 2800,
["Prose"] = 3300,
["Protected_page_maintenance_message"] = 42000,
["Protection_padlock"] = 25000,
["Proxy_block"] = 2200,
["Pso"] = 5000,
["Purge"] = 568000,
["Purge_button"] = 19000,
["Purge_button/styles.css"] = 19000,
["Module:POTD_titletext"] = 2500,
["Module:Page"] = 123000,
["Module:PageLinks"] = 75000,
["Module:Page_tabs"] = 4100,
["Module:Pagelist"] = 15000,
["Module:Pagetype"] = 19100000,
["Module:Pagetype/config"] = 19100000,
["Module:Pagetype/disambiguation"] = 13300000,
["Module:Pagetype/rfd"] = 17200000,
["Module:Pagetype/setindex"] = 13500000,
["Module:Pagetype/softredirect"] = 17800000,
["Module:ParameterCount"] = 1700000,
["Module:Parameter_names_example"] = 2700,
["Module:Parameter_validation"] = 165000,
["Module:Parameter_validation/default_config"] = 165000,
["Module:Party_name_with_color"] = 13000,
["Module:Percentage"] = 18000,
["Module:Person_date"] = 1780000,
["Module:Person_height"] = 283000,
["Module:Person_length"] = 7700,
["Module:Person_weight"] = 85000,
["Module:Phone_size"] = 2100,
["Module:Photo_montage"] = 4900,
["Module:Piechart"] = 8300,
["Module:Piechart/cuts.json"] = 8300,
["Module:Plain_text"] = 1880000,
["Module:Pn"] = 4800,
["Module:Political_party"] = 150000,
["Module:Political_party/A"] = 27000,
["Module:Political_party/B"] = 20000,
["Module:Political_party/C"] = 49000,
["Module:Political_party/D"] = 58000,
["Module:Political_party/E"] = 6900,
["Module:Political_party/F"] = 15000,
["Module:Political_party/G"] = 22000,
["Module:Political_party/H"] = 7500,
["Module:Political_party/I"] = 62000,
["Module:Political_party/J"] = 10000,
["Module:Political_party/K"] = 6200,
["Module:Political_party/L"] = 47000,
["Module:Political_party/M"] = 15000,
["Module:Political_party/N"] = 38000,
["Module:Political_party/O"] = 7100,
["Module:Political_party/P"] = 34000,
["Module:Political_party/R"] = 58000,
["Module:Political_party/S"] = 37000,
["Module:Political_party/T"] = 15000,
["Module:Political_party/U"] = 22000,
["Module:Political_party/V"] = 7900,
["Module:Political_party/W"] = 15000,
["Module:Political_party/Y"] = 2400,
["Module:Pop_density"] = 10000,
["Module:PopulationFromWikidata"] = 15000,
["Module:Portal"] = 11300000,
["Module:Portal-inline"] = 250000,
["Module:Portal/images/a"] = 2050000,
["Module:Portal/images/aliases"] = 356000,
["Module:Portal/images/b"] = 3560000,
["Module:Portal/images/c"] = 2260000,
["Module:Portal/images/d"] = 120000,
["Module:Portal/images/e"] = 594000,
["Module:Portal/images/f"] = 1020000,
["Module:Portal/images/g"] = 700000,
["Module:Portal/images/h"] = 546000,
["Module:Portal/images/i"] = 1300000,
["Module:Portal/images/j"] = 346000,
["Module:Portal/images/k"] = 88000,
["Module:Portal/images/l"] = 530000,
["Module:Portal/images/m"] = 771000,
["Module:Portal/images/n"] = 840000,
["Module:Portal/images/o"] = 460000,
["Module:Portal/images/other"] = 271000,
["Module:Portal/images/p"] = 979000,
["Module:Portal/images/q"] = 3300,
["Module:Portal/images/r"] = 441000,
["Module:Portal/images/s"] = 2000000,
["Module:Portal/images/t"] = 860000,
["Module:Portal/images/u"] = 1390000,
["Module:Portal/images/v"] = 346000,
["Module:Portal/images/w"] = 213000,
["Module:Portal/images/y"] = 39000,
["Module:Portal/images/z"] = 6500,
["Module:Portal/styles.css"] = 10800000,
["Module:Portal_bar"] = 206000,
["Module:Portal_bar/styles.css"] = 206000,
["Module:PrevalenceData"] = 8300,
["Module:Professional_wrestling_profiles"] = 3200,
["Module:Professional_wrestling_results_table"] = 3200,
["Module:Progress_box"] = 19000,
["Module:Progress_box/config"] = 19000,
["Module:Progress_box/styles.css"] = 19000,
["Module:Protect"] = 126000,
["Module:Protected_edit_request"] = 60000,
["Module:Protection_banner"] = 74000,
["Module:Protection_banner/config"] = 74000,
["Module:Purge"] = 591000,
}
7esc1ag0vtespwi4dle2ds32xzhjm7c
Template:Infobox person
10
8609
75026
73980
2026-08-24T00:36:48Z
en>Zackmann08
0
only display when needed
75026
wikitext
text/x-wiki
<includeonly>{{#invoke:infobox|infoboxTemplate|child={{if empty|{{{child|}}}|{{{embed|}}}}}
| bodyclass = biography vcard
| above = {{#if:{{{honorific_prefix|}}}|<div class="honorific-prefix" style="font-size: 80%; font-weight: normal;">{{{honorific_prefix|}}}</div>}}<div class="fn">{{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}</div>{{#if:{{{honorific_suffix|}}}|<div class="honorific-suffix" style="font-size: 80%; font-weight: normal;">{{{honorific_suffix|}}}</div>}}
| subheader = {{#ifeq:{{lc: {{if empty|{{{child|}}}|{{{embed|}}}}}}}|yes|{{#if:{{{embed_title|}}}|'''{{{embed_title|}}}'''}}}}
| subheader2 = {{#switch:{{if empty|{{{child|}}}|{{{embed|}}}}}|yes=<!--empty when this infobox is embedded-->|#default={{#if:{{{native_name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{{native_name}}}{{#if:{{{native_name_lang|}}}|</div>}} }} }}
| subheaderstyle2 = font-size: 125%
| image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{#ifeq:{{lc:{{{landscape|}}}}}|yes|{{min|300|{{#if:{{#ifexpr:{{{image_size|}}}}}|300|{{{image_size|}}}}}}}x200px|{{{image_size|}}}}}|sizedefault=frameless|upright={{if empty|{{{image_upright|}}}|1}}|alt={{if empty|{{{alt|}}}|{{{image_alt|}}}}}|class={{{image_class|}}}|suppressplaceholder=yes}}
| caption = {{if empty|{{{caption|}}}|{{{image_caption|}}}}}
| label2 = Pronunciation
| data2 = {{{pronunciation|}}}
| label10 = Born
| data10 = {{br separated entries
|1={{#if:{{{birth_name|}}}|<div style="display:inline" class="nickname">{{{birth_name|}}}</div>}}
|2={{#invoke:person date|birth}}
|3={{#if:{{{birth_place|}}}|<div style="display:inline" class="birthplace">{{{birth_place|}}}</div>}}
}}
| label11 = Bapti{{#if:{{{baptized|}}}|z|s}}ed
| data11 = {{#if:{{{birth_date|}}}||{{if empty|{{{baptized|}}}|{{{baptised|}}}}}}}
| label12 = Disappeared
| data12 = {{Br separated entries|1={{{disappeared_date|}}}|2={{{disappeared_place|}}}}}
| label13 = Status
| data13 = {{{disappeared_status|}}}
| label14 = Died
| data14 = {{br separated entries
|1={{#invoke:person date|death}}
|2={{#if:{{{death_place|}}}|<div style="display:inline" class="deathplace">{{{death_place|}}}</div>}}
}}
| label15 = {{longitem|Cause of death}}
| data15 = {{{death_cause|}}}
| label16 = {{longitem|Body discovered}}
| data16 = {{{body_discovered|}}}
| label17 = {{longitem|{{#if:{{{burial_place|}}}|Burial place|Resting place}}}}
| data17 = {{#if:{{{burial_place|}}}|{{Br separated entries|1={{{burial_place|}}}|2={{{burial_coordinates|}}}}}|{{Br separated entries|1={{{resting_place|}}}|2={{{resting_place_coordinates|}}}}}}}
| class17 = label
| label18 = Monuments
| data18 = {{{monuments|}}}
| label21 = Other name{{pluralize from text|{{{other_names|}}}|plural=s}}
| data21 = {{{other_names|}}}
| class21 = nickname
| label22 = Siglum
| data22 = {{{siglum|}}}
| label23 = Citizenship
| data23 = {{{citizenship|}}}
| class23 = category
| label24 = Education
| data24 = {{{education|}}}
| label25 = Alma mater
| data25 = {{{alma_mater|}}}
| label26 = Occupation{{Pluralize from text|{{{occupation|}}}|plural=s}}
| data26 = {{{occupation|}}}
| class26 = role
| label27 = Years active
| data27 = {{{years_active|}}}
| label28 = Era
| data28 = {{{era|}}}
| class28 = category
| label29 = Employer{{Pluralize from text|{{{employer|}}}|likely=(s)|plural=s}}
| data29 = {{{employer|}}}{{main other|{{Pluralize from text| {{{employer|}}}|likely=[[Category:Pages using infobox person with multiple employers]]}}}}
| class29 = org
| label30 = {{#if:{{{organisation|}}}|Organisation|Organization}}{{#if:{{{organizations|}}}|s|{{pluralize from text|{{if empty|{{{organization|}}}|{{{organisation|}}}}}|likely=(s)|plural=s}}}}
| data30 = {{if empty|{{{organisation|}}}|{{{organization|}}}|{{{organizations|}}}}}{{main other|{{Pluralize from text|{{if empty|{{{organization|}}}|{{{organisation|}}}}}|likely=[[Category:Pages using infobox person with multiple organizations]]}}}}
| class30 = org
| label31 = Agent{{Pluralize from text|{{{agent|}}}|likely=(s)|plural=s}}
| data31 = {{{agent|}}}{{main other|{{Pluralize from text|{{{agent|}}}|likely=[[Category:Pages using infobox person with multiple agents]]}}}}
| class31 = agent
| label32 = Known for
| data32 = {{{known_for|}}}
| label33 = Works
| data33 = {{{works|}}}
| label34 = Notable credit{{Pluralize from text|{{{credits|}}}|likely=(s)|plural=s}}
| data34 = {{#if:{{{works|}}}|{{#if:{{{credits|}}}|{{preview warning|Note that if {{para|works}} is supplied, {{para|credits}} will not display.}}}}|<!--
-->{{{credits|}}}{{main other|{{Pluralize from text|{{{credits|}}}|likely=[[Category:Pages using infobox person with multiple credits]]}}}}}}
| label35 = Label{{Pluralize from text|{{{label_name|}}}|likely=(s)|plural=s}}
| data35 = {{#if:{{{works|}}}{{{credits|}}}|{{#if:{{{label_name|}}}|{{preview warning|Note that if {{para|works}} or {{para|credits}} is supplied, {{para|label_name}} will not display.}}}}|<!--
-->{{{label_name|}}}{{main other|{{Pluralize from text|{{{label_name|}}}|likely=[[Category:Pages using infobox person with multiple labels]]}}}}}}
| label36 = Notable work
| data36 = {{#if:{{{works|}}}{{{credits|}}}{{{label_name|}}}|{{#if:{{{notable_works|}}}|{{preview warning|Note that if {{para|works}}, {{para|credits}} or {{para|label_name}} is supplied, {{para|notable_works}} will not display.}}}}|{{{notable_works|}}}}}
| label37 = Style
| data37 = {{{style|}}}
| class37 = category
| label40 = Television
| data40 = {{{television|}}}
| label41 = Height
| data41 = {{#if:{{{height_m|}}}{{{height_cm|}}}{{{height_ft|}}}{{{height_in|}}} | {{convinfobox|{{if empty|{{{height_m|}}}|{{{height_cm|}}}}}|{{#if:{{{height_m|}}}|m|cm}}|{{{height_ft|}}}|ft|{{{height_in|}}}|in}}}}{{#if:{{{height|}}} | {{infobox person/height|{{{height|}}}}}}}
| label42 = {{#if:{{{office|}}}|Office|Title}}
| data42 = {{if empty|{{{office|}}}|{{{title|}}}}}
| class42 = title
| label43 = Term
| data43 = {{{term|}}}
| label44 = Predecessor
| data44 = {{{predecessor|}}}
| label45 = Successor
| data45 = {{{successor|}}}
| label46 = {{longitem|Political party}}
| data46 = {{{political_party|}}}
| class46 = org
| label47 = {{longitem|Other political<br />affiliations}}
| data47 = {{{other_party|}}}
| class47 = org
| label48 = Movement
| data48 = {{{movement|}}}
| class48 = category
| label49 = Opponent{{Pluralize from text|{{{opponents|}}}|likely=(s)|plural=s}}
| data49 = {{{opponents|}}}{{main other|{{Pluralize from text|{{{opponents|}}}|likely=[[Category:Pages using infobox person with multiple opponents]]}}}}
| label50 = {{longitem|Board member of}}
| data50 = {{{boards|}}}
| label51 = {{longitem|{{#if:{{{criminal_charges|}}}|Criminal charges|Criminal charge{{pluralize from text|{{{criminal_charge|}}}|likely=(s)|plural=s}}}}}}
| data51 = {{if empty|{{{criminal_charges|}}}|{{{criminal_charge|}}}}}{{main other|{{Pluralize from text|{{{criminal_charge|}}}|likely=[[Category:Pages using infobox person with multiple criminal charges]]}}}}
| label52 = {{longitem|Criminal penalty}}
| data52 = {{{criminal_penalty|}}}
| label53 = {{longitem|{{#if:{{{judicial_status|}}}|Judicial status|Criminal status}}}}
| data53 = {{if empty|{{{judicial_status|}}} | {{{criminal_status|}}}}}
| class53 = category
| label54 = Spouse{{#if:{{{spouses|}}}|s|{{Pluralize from text|{{{spouse|}}}|likely=(s)|plural=s}}}}
| data54 = {{if empty|{{{spouse|}}}|{{{spouses|}}}}}{{main other|{{Pluralize from text| {{{spouse|}}} |likely=[[Category:Pages using infobox person with multiple spouses]]}}}}
| label55 = Partner{{#if:{{{partners|}}}|s|{{Pluralize from text|{{if empty|{{{partner|}}}|{{{domesticpartner|}}}|{{{domestic_partner|}}}|{{{partner(s)|}}}}} |likely=(s)|plural=s}}}}
| data55 = {{if empty|{{{partner|}}}|{{{partners|}}}}}{{main other|{{Pluralize from text| {{{partner|}}} |likely=[[Category:Pages using infobox person with multiple partners]]}}}}
| label56 = Children
| data56 = {{{children|}}}
| label57 = {{#if:{{{parents|}}}|Parent{{Pluralize from text|{{{parents|}}}|likely=(s)|plural=s}}|<!--
-->{{#ifexpr:{{count|{{{father|}}}|{{{mother|}}}}} > 1|Parents|{{#if:{{{father|}}}|Father|{{#if:{{{mother|}}}|Mother}}}}}}}}
| data57 = {{#if:{{{parents|}}}|{{{parents}}}|{{#ifexpr:{{count|{{{father|}}}|{{{mother|}}}}} > 1|{{Unbulleted list|{{{father}}} (father)|{{{mother}}} (mother)}}|{{{mother|}}}{{{father|}}}}}}}<!--
-->{{main other|{{Pluralize from text|{{{parents|}}}|likely=[[Category:Pages using infobox person with multiple parents]]}}}}
| label58 = Relatives
| data58 = {{{relatives|}}}
| label59 = Family
| data59 = {{{family|}}}
| label60 = Call sign
| data60 = {{{callsign|}}}
| label61 = Awards
| data61 = {{{awards|}}}
| label62 = {{#if:{{{honours|}}}|Honours|Honors}}
| data62 = {{if empty|{{{honours|}}}|{{{honors|}}}}}
| data64 = {{{module|}}}
| data65 = {{{module2|}}}
| data66 = {{{module3|}}}
| data67 = {{{module4|}}}
| data68 = {{{module5|}}}
| data69 = {{{module6|}}}
| label70 = Website
| data70 = {{{website|}}}
| header71 = {{#if:{{{signature|}}}|{{if empty|{{{signature_type|}}}|Signature}}}}
| data72 = {{#invoke:InfoboxImage|InfoboxImage|image={{{signature|}}}|size={{{signature_size|}}}|class=infobox-signature skin-invert|sizedefault=150px|alt={{{signature_alt|}}}}}
| header73 = {{#if:{{{footnotes|}}}|Notes}}
| data74 = {{#if:{{{footnotes|}}}|<div style="text-align: left;">{{{footnotes}}}</div>}}
}}<!--
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using {{if empty|{{lcfirst:{{{template_name|}}}}}|infobox person}} with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview = Page using [[Template:{{#if:{{{template_name|}}}|{{ucfirst:{{{template_name|}}}}}|Infobox person}}]] with unknown parameter "_VALUE_"|ignoreblank=y| agent | alma_mater | alt | awards | baptised | baptized | birth_date | birth_name | birth_place | boards | body_discovered | burial_coordinates | burial_place | callsign | caption | child | children | citizenship | credits | criminal_charge | criminal_charges | criminal_penalty | criminal_status | death_cause | death_date | death_place | disappeared_date | disappeared_place | disappeared_status | domestic_partner | domesticpartner | education | embed | embed_title | employer | era | family | father | footnotes | height | height_cm | height_ft | height_in | height_m | honorific_prefix | honorific_suffix | honors | honours | image | image_alt | image_caption | image_class | image_size | image_upright | judicial_status | known_for | label_name | landscape | module | module2 | module3 | module4 | module5 | module6 | monuments | mother | movement | name | native_name | native_name_lang | nocat_wdimage | notable_works | occupation | office | opponents | organisation | organization | organizations | other_names | other_party | parents | partner | partner(s) | partners | political_party | predecessor | pronunciation | relatives | resting_place | resting_place_coordinates | siglum | signature | signature_alt | signature_size | signature_type | spouse | spouses | style | successor | television | template_name | term | title | website | works | years_active }}<!--
-->{{Main other|{{#if:{{{pronunciation|}}}|[[Category:Biography template using pronunciation]]}}<!--
-->{{#if:{{{signature|}}}|[[Category:Biography with signature]]}}<!--
-->[[Category:Articles with hCards]]
}}{{#if:{{{alma_mater|}}}|{{preview warning|Page using [[Template:Infobox person]] with deprecated parameter {{code|alma_mater}} which should be merged with/replaced by {{code|education}}.}}{{main other|[[Category:Pages using infobox person with deprecated parameters]]}}}}<!--
-->{{#invoke:Check for conflicting parameters|check
| nested = 1
| template = [[Template:{{#if:{{{template_name|}}}|{{ucfirst:{{{template_name|}}}}}|Infobox person}}]]
| cat = {{main other|Category:Pages using {{if empty|{{{template_name|}}}|infobox person}} with conflicting parameters}}
| alma_mater; education
| child; embed
| image_alt; alt
| height_m; height_cm; height_ft; height
| caption; image_caption
| baptized; baptised
| organisation; organization; organizations
| {{#if:{{{works|}}}|works;}} {{#if:{{{credits|}}}|credits;}} {{#if:{{{label_name|}}}|label_name;}} notable_works
| height_m; height_cm
| office; title
| criminal_charges; criminal_charge
| spouse; spouses
| partner; partners
| {{#if:{{{parents|}}}||NULL_}}parents; {{#if:{{{father|}}}||NULL_}}father
| {{#if:{{{parents|}}}||NULL_}}parents; {{#if:{{{mother|}}}||NULL_}}mother
| honours; honors
}}{{#ifeq:{{if empty|{{{child|}}}|{{{embed|}}}}}|yes||{{Wikidata image|1={{{image|}}}|2={{{nocat_wdimage|}}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
li4v0y8zscvr1rkx0vbg5jfzhjf0850
75027
75026
2026-08-24T00:46:08Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_person]]
75026
wikitext
text/x-wiki
<includeonly>{{#invoke:infobox|infoboxTemplate|child={{if empty|{{{child|}}}|{{{embed|}}}}}
| bodyclass = biography vcard
| above = {{#if:{{{honorific_prefix|}}}|<div class="honorific-prefix" style="font-size: 80%; font-weight: normal;">{{{honorific_prefix|}}}</div>}}<div class="fn">{{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}</div>{{#if:{{{honorific_suffix|}}}|<div class="honorific-suffix" style="font-size: 80%; font-weight: normal;">{{{honorific_suffix|}}}</div>}}
| subheader = {{#ifeq:{{lc: {{if empty|{{{child|}}}|{{{embed|}}}}}}}|yes|{{#if:{{{embed_title|}}}|'''{{{embed_title|}}}'''}}}}
| subheader2 = {{#switch:{{if empty|{{{child|}}}|{{{embed|}}}}}|yes=<!--empty when this infobox is embedded-->|#default={{#if:{{{native_name|}}}|{{#if:{{{native_name_lang|}}}|<div class="nickname" lang="{{{native_name_lang}}}">}}{{{native_name}}}{{#if:{{{native_name_lang|}}}|</div>}} }} }}
| subheaderstyle2 = font-size: 125%
| image = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{#ifeq:{{lc:{{{landscape|}}}}}|yes|{{min|300|{{#if:{{#ifexpr:{{{image_size|}}}}}|300|{{{image_size|}}}}}}}x200px|{{{image_size|}}}}}|sizedefault=frameless|upright={{if empty|{{{image_upright|}}}|1}}|alt={{if empty|{{{alt|}}}|{{{image_alt|}}}}}|class={{{image_class|}}}|suppressplaceholder=yes}}
| caption = {{if empty|{{{caption|}}}|{{{image_caption|}}}}}
| label2 = Pronunciation
| data2 = {{{pronunciation|}}}
| label10 = Born
| data10 = {{br separated entries
|1={{#if:{{{birth_name|}}}|<div style="display:inline" class="nickname">{{{birth_name|}}}</div>}}
|2={{#invoke:person date|birth}}
|3={{#if:{{{birth_place|}}}|<div style="display:inline" class="birthplace">{{{birth_place|}}}</div>}}
}}
| label11 = Bapti{{#if:{{{baptized|}}}|z|s}}ed
| data11 = {{#if:{{{birth_date|}}}||{{if empty|{{{baptized|}}}|{{{baptised|}}}}}}}
| label12 = Disappeared
| data12 = {{Br separated entries|1={{{disappeared_date|}}}|2={{{disappeared_place|}}}}}
| label13 = Status
| data13 = {{{disappeared_status|}}}
| label14 = Died
| data14 = {{br separated entries
|1={{#invoke:person date|death}}
|2={{#if:{{{death_place|}}}|<div style="display:inline" class="deathplace">{{{death_place|}}}</div>}}
}}
| label15 = {{longitem|Cause of death}}
| data15 = {{{death_cause|}}}
| label16 = {{longitem|Body discovered}}
| data16 = {{{body_discovered|}}}
| label17 = {{longitem|{{#if:{{{burial_place|}}}|Burial place|Resting place}}}}
| data17 = {{#if:{{{burial_place|}}}|{{Br separated entries|1={{{burial_place|}}}|2={{{burial_coordinates|}}}}}|{{Br separated entries|1={{{resting_place|}}}|2={{{resting_place_coordinates|}}}}}}}
| class17 = label
| label18 = Monuments
| data18 = {{{monuments|}}}
| label21 = Other name{{pluralize from text|{{{other_names|}}}|plural=s}}
| data21 = {{{other_names|}}}
| class21 = nickname
| label22 = Siglum
| data22 = {{{siglum|}}}
| label23 = Citizenship
| data23 = {{{citizenship|}}}
| class23 = category
| label24 = Education
| data24 = {{{education|}}}
| label25 = Alma mater
| data25 = {{{alma_mater|}}}
| label26 = Occupation{{Pluralize from text|{{{occupation|}}}|plural=s}}
| data26 = {{{occupation|}}}
| class26 = role
| label27 = Years active
| data27 = {{{years_active|}}}
| label28 = Era
| data28 = {{{era|}}}
| class28 = category
| label29 = Employer{{Pluralize from text|{{{employer|}}}|likely=(s)|plural=s}}
| data29 = {{{employer|}}}{{main other|{{Pluralize from text| {{{employer|}}}|likely=[[Category:Pages using infobox person with multiple employers]]}}}}
| class29 = org
| label30 = {{#if:{{{organisation|}}}|Organisation|Organization}}{{#if:{{{organizations|}}}|s|{{pluralize from text|{{if empty|{{{organization|}}}|{{{organisation|}}}}}|likely=(s)|plural=s}}}}
| data30 = {{if empty|{{{organisation|}}}|{{{organization|}}}|{{{organizations|}}}}}{{main other|{{Pluralize from text|{{if empty|{{{organization|}}}|{{{organisation|}}}}}|likely=[[Category:Pages using infobox person with multiple organizations]]}}}}
| class30 = org
| label31 = Agent{{Pluralize from text|{{{agent|}}}|likely=(s)|plural=s}}
| data31 = {{{agent|}}}{{main other|{{Pluralize from text|{{{agent|}}}|likely=[[Category:Pages using infobox person with multiple agents]]}}}}
| class31 = agent
| label32 = Known for
| data32 = {{{known_for|}}}
| label33 = Works
| data33 = {{{works|}}}
| label34 = Notable credit{{Pluralize from text|{{{credits|}}}|likely=(s)|plural=s}}
| data34 = {{#if:{{{works|}}}|{{#if:{{{credits|}}}|{{preview warning|Note that if {{para|works}} is supplied, {{para|credits}} will not display.}}}}|<!--
-->{{{credits|}}}{{main other|{{Pluralize from text|{{{credits|}}}|likely=[[Category:Pages using infobox person with multiple credits]]}}}}}}
| label35 = Label{{Pluralize from text|{{{label_name|}}}|likely=(s)|plural=s}}
| data35 = {{#if:{{{works|}}}{{{credits|}}}|{{#if:{{{label_name|}}}|{{preview warning|Note that if {{para|works}} or {{para|credits}} is supplied, {{para|label_name}} will not display.}}}}|<!--
-->{{{label_name|}}}{{main other|{{Pluralize from text|{{{label_name|}}}|likely=[[Category:Pages using infobox person with multiple labels]]}}}}}}
| label36 = Notable work
| data36 = {{#if:{{{works|}}}{{{credits|}}}{{{label_name|}}}|{{#if:{{{notable_works|}}}|{{preview warning|Note that if {{para|works}}, {{para|credits}} or {{para|label_name}} is supplied, {{para|notable_works}} will not display.}}}}|{{{notable_works|}}}}}
| label37 = Style
| data37 = {{{style|}}}
| class37 = category
| label40 = Television
| data40 = {{{television|}}}
| label41 = Height
| data41 = {{#if:{{{height_m|}}}{{{height_cm|}}}{{{height_ft|}}}{{{height_in|}}} | {{convinfobox|{{if empty|{{{height_m|}}}|{{{height_cm|}}}}}|{{#if:{{{height_m|}}}|m|cm}}|{{{height_ft|}}}|ft|{{{height_in|}}}|in}}}}{{#if:{{{height|}}} | {{infobox person/height|{{{height|}}}}}}}
| label42 = {{#if:{{{office|}}}|Office|Title}}
| data42 = {{if empty|{{{office|}}}|{{{title|}}}}}
| class42 = title
| label43 = Term
| data43 = {{{term|}}}
| label44 = Predecessor
| data44 = {{{predecessor|}}}
| label45 = Successor
| data45 = {{{successor|}}}
| label46 = {{longitem|Political party}}
| data46 = {{{political_party|}}}
| class46 = org
| label47 = {{longitem|Other political<br />affiliations}}
| data47 = {{{other_party|}}}
| class47 = org
| label48 = Movement
| data48 = {{{movement|}}}
| class48 = category
| label49 = Opponent{{Pluralize from text|{{{opponents|}}}|likely=(s)|plural=s}}
| data49 = {{{opponents|}}}{{main other|{{Pluralize from text|{{{opponents|}}}|likely=[[Category:Pages using infobox person with multiple opponents]]}}}}
| label50 = {{longitem|Board member of}}
| data50 = {{{boards|}}}
| label51 = {{longitem|{{#if:{{{criminal_charges|}}}|Criminal charges|Criminal charge{{pluralize from text|{{{criminal_charge|}}}|likely=(s)|plural=s}}}}}}
| data51 = {{if empty|{{{criminal_charges|}}}|{{{criminal_charge|}}}}}{{main other|{{Pluralize from text|{{{criminal_charge|}}}|likely=[[Category:Pages using infobox person with multiple criminal charges]]}}}}
| label52 = {{longitem|Criminal penalty}}
| data52 = {{{criminal_penalty|}}}
| label53 = {{longitem|{{#if:{{{judicial_status|}}}|Judicial status|Criminal status}}}}
| data53 = {{if empty|{{{judicial_status|}}} | {{{criminal_status|}}}}}
| class53 = category
| label54 = Spouse{{#if:{{{spouses|}}}|s|{{Pluralize from text|{{{spouse|}}}|likely=(s)|plural=s}}}}
| data54 = {{if empty|{{{spouse|}}}|{{{spouses|}}}}}{{main other|{{Pluralize from text| {{{spouse|}}} |likely=[[Category:Pages using infobox person with multiple spouses]]}}}}
| label55 = Partner{{#if:{{{partners|}}}|s|{{Pluralize from text|{{if empty|{{{partner|}}}|{{{domesticpartner|}}}|{{{domestic_partner|}}}|{{{partner(s)|}}}}} |likely=(s)|plural=s}}}}
| data55 = {{if empty|{{{partner|}}}|{{{partners|}}}}}{{main other|{{Pluralize from text| {{{partner|}}} |likely=[[Category:Pages using infobox person with multiple partners]]}}}}
| label56 = Children
| data56 = {{{children|}}}
| label57 = {{#if:{{{parents|}}}|Parent{{Pluralize from text|{{{parents|}}}|likely=(s)|plural=s}}|<!--
-->{{#ifexpr:{{count|{{{father|}}}|{{{mother|}}}}} > 1|Parents|{{#if:{{{father|}}}|Father|{{#if:{{{mother|}}}|Mother}}}}}}}}
| data57 = {{#if:{{{parents|}}}|{{{parents}}}|{{#ifexpr:{{count|{{{father|}}}|{{{mother|}}}}} > 1|{{Unbulleted list|{{{father}}} (father)|{{{mother}}} (mother)}}|{{{mother|}}}{{{father|}}}}}}}<!--
-->{{main other|{{Pluralize from text|{{{parents|}}}|likely=[[Category:Pages using infobox person with multiple parents]]}}}}
| label58 = Relatives
| data58 = {{{relatives|}}}
| label59 = Family
| data59 = {{{family|}}}
| label60 = Call sign
| data60 = {{{callsign|}}}
| label61 = Awards
| data61 = {{{awards|}}}
| label62 = {{#if:{{{honours|}}}|Honours|Honors}}
| data62 = {{if empty|{{{honours|}}}|{{{honors|}}}}}
| data64 = {{{module|}}}
| data65 = {{{module2|}}}
| data66 = {{{module3|}}}
| data67 = {{{module4|}}}
| data68 = {{{module5|}}}
| data69 = {{{module6|}}}
| label70 = Website
| data70 = {{{website|}}}
| header71 = {{#if:{{{signature|}}}|{{if empty|{{{signature_type|}}}|Signature}}}}
| data72 = {{#invoke:InfoboxImage|InfoboxImage|image={{{signature|}}}|size={{{signature_size|}}}|class=infobox-signature skin-invert|sizedefault=150px|alt={{{signature_alt|}}}}}
| header73 = {{#if:{{{footnotes|}}}|Notes}}
| data74 = {{#if:{{{footnotes|}}}|<div style="text-align: left;">{{{footnotes}}}</div>}}
}}<!--
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using {{if empty|{{lcfirst:{{{template_name|}}}}}|infobox person}} with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview = Page using [[Template:{{#if:{{{template_name|}}}|{{ucfirst:{{{template_name|}}}}}|Infobox person}}]] with unknown parameter "_VALUE_"|ignoreblank=y| agent | alma_mater | alt | awards | baptised | baptized | birth_date | birth_name | birth_place | boards | body_discovered | burial_coordinates | burial_place | callsign | caption | child | children | citizenship | credits | criminal_charge | criminal_charges | criminal_penalty | criminal_status | death_cause | death_date | death_place | disappeared_date | disappeared_place | disappeared_status | domestic_partner | domesticpartner | education | embed | embed_title | employer | era | family | father | footnotes | height | height_cm | height_ft | height_in | height_m | honorific_prefix | honorific_suffix | honors | honours | image | image_alt | image_caption | image_class | image_size | image_upright | judicial_status | known_for | label_name | landscape | module | module2 | module3 | module4 | module5 | module6 | monuments | mother | movement | name | native_name | native_name_lang | nocat_wdimage | notable_works | occupation | office | opponents | organisation | organization | organizations | other_names | other_party | parents | partner | partner(s) | partners | political_party | predecessor | pronunciation | relatives | resting_place | resting_place_coordinates | siglum | signature | signature_alt | signature_size | signature_type | spouse | spouses | style | successor | television | template_name | term | title | website | works | years_active }}<!--
-->{{Main other|{{#if:{{{pronunciation|}}}|[[Category:Biography template using pronunciation]]}}<!--
-->{{#if:{{{signature|}}}|[[Category:Biography with signature]]}}<!--
-->[[Category:Articles with hCards]]
}}{{#if:{{{alma_mater|}}}|{{preview warning|Page using [[Template:Infobox person]] with deprecated parameter {{code|alma_mater}} which should be merged with/replaced by {{code|education}}.}}{{main other|[[Category:Pages using infobox person with deprecated parameters]]}}}}<!--
-->{{#invoke:Check for conflicting parameters|check
| nested = 1
| template = [[Template:{{#if:{{{template_name|}}}|{{ucfirst:{{{template_name|}}}}}|Infobox person}}]]
| cat = {{main other|Category:Pages using {{if empty|{{{template_name|}}}|infobox person}} with conflicting parameters}}
| alma_mater; education
| child; embed
| image_alt; alt
| height_m; height_cm; height_ft; height
| caption; image_caption
| baptized; baptised
| organisation; organization; organizations
| {{#if:{{{works|}}}|works;}} {{#if:{{{credits|}}}|credits;}} {{#if:{{{label_name|}}}|label_name;}} notable_works
| height_m; height_cm
| office; title
| criminal_charges; criminal_charge
| spouse; spouses
| partner; partners
| {{#if:{{{parents|}}}||NULL_}}parents; {{#if:{{{father|}}}||NULL_}}father
| {{#if:{{{parents|}}}||NULL_}}parents; {{#if:{{{mother|}}}||NULL_}}mother
| honours; honors
}}{{#ifeq:{{if empty|{{{child|}}}|{{{embed|}}}}}|yes||{{Wikidata image|1={{{image|}}}|2={{{nocat_wdimage|}}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
li4v0y8zscvr1rkx0vbg5jfzhjf0850
Template:Br separated entries
10
8611
74812
73869
2026-08-10T12:21:08Z
en>RMCD bot
0
Sync modified notice of move discussion on [[Template talk:Hlist#Requested move 3 August 2026|Template talk:Hlist]]
74812
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Br-separated list|2=Template talk:Hlist#Requested move 3 August 2026}}
</noinclude>{{<includeonly>safesubst:</includeonly>#invoke:Separated entries|br|dataPlural=1}}<noinclude>
{{documentation}}
</noinclude>
fs78y3yfiqdpdhog9wjflihm81mn526
74813
74812
2026-08-24T00:16:59Z
Robertsky
10424
1 versaun husi [[:en:Template:Br_separated_entries]]
74812
wikitext
text/x-wiki
<noinclude>{{Requested move notice|1=Template:Br-separated list|2=Template talk:Hlist#Requested move 3 August 2026}}
</noinclude>{{<includeonly>safesubst:</includeonly>#invoke:Separated entries|br|dataPlural=1}}<noinclude>
{{documentation}}
</noinclude>
fs78y3yfiqdpdhog9wjflihm81mn526
Template:Infobox football biography/doc
10
8656
75030
73969
2026-08-17T08:28:30Z
en>Bruce1ee
0
Reverted edit by [[Special:Contribs/Mbalentle Sinalo|Mbalentle Sinalo]] ([[User talk:Mbalentle Sinalo|talk]]) to last version by GiantSnowman
73968
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
{{Short description|Wikipedia association football template}}
{{For|American football biographies|Template:Infobox gridiron football biography}}
{{High-use}}
{{Tracks Wikidata|P18|cat=No local image but image on Wikidata}}
{{Lua|Module:Infobox3cols|Module:InfoboxImage|Module:Check for unknown parameters|Module:String|Module:Footballer positions|Module:Check height}}
{{tl|Infobox football biography}} is intended to provide a quick overview of an [[association football]] (or [[Variants of association football|football variant]]) player's or manager's details to enable a reader to extract the most oft-needed information without trawling through the article proper.
{{Parameter names example
| name | image | upright | upright | alt | caption | full_name | birth_name | birth_date | birth_place | death_date | death_place | height | position | currentclub | clubnumber
| youthyears1 | youthclubs1 | youthyears2 | youthclubs2 | youthyears3 | youthclubs3 | youthyears4 | youthclubs4 | youthyears5 | youthclubs5 | youthyears6 | youthclubs6 | youthyears7 | youthclubs7 | youthyears8 | youthclubs8 | youthyears9 | youthclubs9 | youthyears10 | youthclubs10 | youthyears11 | youthclubs11 | youthyears12 | youthclubs12
| collegeyears1 | college1 | collegecaps1 | collegegoals1
| collegeyears2 | college2 | collegecaps2 | collegegoals2
| collegeyears3 | college3 | collegecaps3 | collegegoals3
| collegeyears4 | college4 | collegecaps4 | collegegoals4
| years1 | clubs1 | caps1 | goals1 | years2 | clubs2 | caps2 | goals2 | years3 | clubs3 | caps3 | goals3 | years4 | clubs4 | caps4 | goals4 | years5 | clubs5 | caps5 | goals5 | years6 | clubs6 | caps6 | goals6 | years7 | clubs7 | caps7 | goals7 | years8 | clubs8 | caps8 | goals8 | years9 | clubs9 | caps9 | goals9 | years10 | clubs10 | caps10 | goals10 | years11 | clubs11 | caps11 | goals11 | years12 | clubs12 | caps12 | goals12 | years13 | clubs13 | caps13 | goals13 | years14 | clubs14 | caps14 | goals14 | years15 | clubs15 | caps15 | goals15 | years16 | clubs16 | caps16 | goals16 | years17 | clubs17 | caps17 | goals17 | years18 | clubs18 | caps18 | goals18 | years19 | clubs19 | caps19 | goals19 | years20 | clubs20 | caps20 | goals20 | years21 | clubs21 | caps21 | goals21 | years22 | clubs22 | caps22 | goals22 | years23 | clubs23 | caps23 | goals23 | years24 | clubs24 | caps24 | goals24 | years25 | clubs25 | caps25 | goals25 | years26 | clubs26 | caps26 | goals26 | years27 | clubs27 | caps27 | goals27 | years28 | clubs28 | caps28 | goals28 | years29 | clubs29 | caps29 | goals29 | years30 | clubs30 | caps30 | goals30 | years31 | clubs31 | caps31 | goals31 | years32 | clubs32 | caps32 | goals32 | years33 | clubs33 | caps33 | goals33 | years34 | clubs34 | caps34 | goals34 | years35 | clubs35 | caps35 | goals35 | years36 | clubs36 | caps36 | goals36 | years37 | clubs37 | caps37 | goals37 | years38 | clubs38 | caps38 | goals38 | years39 | clubs39 | caps39 | goals39 | years40 | clubs40 | caps40 | goals40 | years41 | clubs41 | caps41 | goals41 | years42 | clubs42 | caps42 | goals42 | years43 | clubs43 | caps43 | goals43 | years44 | clubs44 | caps44 | goals44 | years45 | clubs45 | caps45 | goals45 | years46 | clubs46 | caps46 | goals46 | years47 | clubs47 | caps47 | goals47 | years48 | clubs48 | caps48 | goals48 | years49 | clubs49 | caps49 | goals49 | years50 | clubs50 | caps50 | goals50 | years51 | clubs51 | caps51 | goals51 | years52 | clubs52 | caps52 | goals52
| totalcaps | totalgoals
| nationalyears1 | nationalteam1 | nationalcaps1 | nationalgoals1 | nationalyears2 | nationalteam2 | nationalcaps2 | nationalgoals2 | nationalyears3 | nationalteam3 | nationalcaps3 | nationalgoals3 | nationalyears4 | nationalteam4 | nationalcaps4 | nationalgoals4 | nationalyears5 | nationalteam5 | nationalcaps5 | nationalgoals5 | nationalyears6 | nationalteam6 | nationalcaps6 | nationalgoals6 | nationalyears7 | nationalteam7 | nationalcaps7 | nationalgoals7 | nationalyears8 | nationalteam8 | nationalcaps8 | nationalgoals8 | nationalyears9 | nationalteam9 | nationalcaps9 | nationalgoals9 | nationalyears10 | nationalteam10 | nationalcaps10 | nationalgoals10
| manageryears1 | managerclubs1 | manageryears2 | managerclubs2 | manageryears3 | managerclubs3 | manageryears4 | managerclubs4 | manageryears5 | managerclubs5 | manageryears6 | managerclubs6 | manageryears7 | managerclubs7 | manageryears8 | managerclubs8 | manageryears9 | managerclubs9 | manageryears10 | managerclubs10 | manageryears11 | managerclubs11 | manageryears12 | managerclubs12 | manageryears13 | managerclubs13 | manageryears14 | managerclubs14 | manageryears15 | managerclubs15 | manageryears16 | managerclubs16 | manageryears17 | managerclubs17 | manageryears18 | managerclubs18 | manageryears19 | managerclubs19 | manageryears20 | managerclubs20 | manageryears21 | managerclubs21 | manageryears22 | managerclubs22 | manageryears23 | managerclubs23 | manageryears24 | managerclubs24 | manageryears25 | managerclubs25 | manageryears26 | managerclubs26 | manageryears27 | managerclubs27 | manageryears28 | managerclubs28 | manageryears29 | managerclubs29 | manageryears30 | managerclubs30 | manageryears31 | managerclubs31 | manageryears32 | managerclubs32 | manageryears33 | managerclubs33 | manageryears34 | managerclubs34 | manageryears35 | managerclubs35 | manageryears36 | managerclubs36 | manageryears37 | managerclubs37 | manageryears38 | managerclubs38 | manageryears39 | managerclubs39 | manageryears40 | managerclubs40 | manageryears41 | managerclubs41 | manageryears42 | managerclubs42 | manageryears43 | managerclubs43 | manageryears44 | managerclubs44 | manageryears45 | managerclubs45 | manageryears46 | managerclubs46 | manageryears47 | managerclubs47 | manageryears48 | managerclubs48 | manageryears49 | managerclubs49 | manageryears50 | managerclubs50 | manageryears51 | managerclubs51 | manageryears52 | managerclubs52 | manageryears53 | managerclubs53 | manageryears54 | managerclubs54 | manageryears55 | managerclubs55 | manageryears56 | managerclubs56 | manageryears57 | managerclubs57 | manageryears58 | managerclubs58 | manageryears59 | managerclubs59 | manageryears60 | managerclubs60 | manageryears60 | managerclubs60 | manageryears61 | managerclubs61 | manageryears62 | managerclubs62 | manageryears63 | managerclubs63 | manageryears64 | managerclubs64 | manageryears65 | managerclubs65 | manageryears66 | managerclubs66 | manageryears67 | managerclubs67 | manageryears68 | managerclubs68 | manageryears69 | managerclubs69 | manageryears70 | managerclubs70 | manageryears71 | managerclubs71 | manageryears72 | managerclubs72 | manageryears73 | managerclubs73 | manageryears74 | managerclubs74 | manageryears75 | managerclubs75 | manageryears76 | managerclubs76 | manageryears77 | managerclubs77 | manageryears78 | managerclubs78 | manageryears79 | managerclubs79 | manageryears80 | managerclubs80
| medaltemplates | medaltemplates-expand
| module | club-update | nationalteam-update
}}
== Usage ==
Note: all the field names ending in '''1''' should be repeated for each team, e.g. '''youthyears1''' and '''youthclubs1''' should be followed by '''youthyears2''' and '''youthclubs2''' and so on, as needed.
===Current players===
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
|embed =
|name =
|image =
|upright =
|alt =
|caption =
|full_name =
|birth_date =
|birth_place =
|height =
|position =
|currentclub =
|clubnumber =
|youthyears1 =
|youthclubs1 =
|collegeyears1 =
|college1 =
|collegecaps1 =
|collegegoals1 =
|years1 =
|clubs1 =
|caps1 =
|goals1 =
|nationalyears1 =
|nationalteam1 =
|nationalcaps1 =
|nationalgoals1 =
|medaltemplates =
|club-update =
|nationalteam-update =
}}
</syntaxhighlight>
===Former players===
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
|embed =
|name =
|image =
|upright =
|alt =
|caption =
|full_name =
|birth_date =
|birth_place =
|death_date =
|death_place =
|height =
|position =
|youthyears1 =
|youthclubs1 =
|collegeyears1 =
|college1 =
|collegecaps1 =
|collegegoals1 =
|years1 =
|clubs1 =
|caps1 =
|goals1 =
|totalcaps =
|totalgoals =
|nationalyears1 =
|nationalteam1 =
|nationalcaps1 =
|nationalgoals1 =
|medaltemplates =
}}
</syntaxhighlight>
===Managers who were players===
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
|embed =
|name =
|image =
|upright =
|alt =
|caption =
|full_name =
|birth_date =
|birth_place =
|death_date =
|death_place =
|height =
|position =
|currentclub =
|youthyears1 =
|youthclubs1 =
|collegeyears1 =
|college1 =
|collegecaps1 =
|collegegoals1 =
|years1 =
|clubs1 =
|caps1 =
|goals1 =
|totalcaps =
|totalgoals =
|nationalyears1 =
|nationalteam1 =
|nationalcaps1 =
|nationalgoals1 =
|medaltemplates =
|manageryears1 =
|managerclubs1 =
}}
</syntaxhighlight>
===Managers who were not players===
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
|embed =
|name =
|image =
|upright =
|caption =
|full_name =
|birth_date =
|birth_place =
|death_date =
|death_place =
|currentclub =
|manageryears1 =
|managerclubs1 =
}}
</syntaxhighlight>
=== Full blank template ===
{{Hidden begin |showhide=left |title=Blank template with all parameters |bodystyle=font-size:105%;}}
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
| embed =
| embed-header =
| header-color =
| name =
| image =
| upright =
| alt =
| caption =
| full_name =
| birth_name =
| birth_date =
| birth_place =
| death_date =
| death_place =
| height =
| position =
| currentclub =
| clubnumber =
| youthyears1 =
| youthclubs1 =
| youthyears2 =
| youthclubs2 =
| youthyears3 =
| youthclubs3 =
| youthyears4 =
| youthclubs4 =
| youthyears5 =
| youthclubs5 =
| youthyears6 =
| youthclubs6 =
| youthyears7 =
| youthclubs7 =
| youthyears8 =
| youthclubs8 =
| youthyears9 =
| youthclubs9 =
| youthyears10 =
| youthclubs10 =
| youthyears11 =
| youthclubs11 =
| youthyears12 =
| youthclubs12 =
| collegeyears1 =
| college1 =
| collegecaps1 =
| collegegoals1 =
| collegeyears2 =
| college2 =
| collegecaps2 =
| collegegoals2 =
| collegeyears3 =
| college3 =
| collegecaps3 =
| collegegoals3 =
| collegeyears4 =
| college4 =
| collegecaps4 =
| collegegoals4 =
| years1 =
| clubs1 =
| caps1 =
| goals1 =
| years2 =
| clubs2 =
| caps2 =
| goals2 =
| years3 =
| clubs3 =
| caps3 =
| goals3 =
| years4 =
| clubs4 =
| caps4 =
| goals4 =
| years5 =
| clubs5 =
| caps5 =
| goals5 =
| years6 =
| clubs6 =
| caps6 =
| goals6 =
| years7 =
| clubs7 =
| caps7 =
| goals7 =
| years8 =
| clubs8 =
| caps8 =
| goals8 =
| years9 =
| clubs9 =
| caps9 =
| goals9 =
| years10 =
| clubs10 =
| caps10 =
| goals10 =
| years11 =
| clubs11 =
| caps11 =
| goals11 =
| years12 =
| clubs12 =
| caps12 =
| goals12 =
| years13 =
| clubs13 =
| caps13 =
| goals13 =
| years14 =
| clubs14 =
| caps14 =
| goals14 =
| years15 =
| clubs15 =
| caps15 =
| goals15 =
| years16 =
| clubs16 =
| caps16 =
| goals16 =
| years17 =
| clubs17 =
| caps17 =
| goals17 =
| years18 =
| clubs18 =
| caps18 =
| goals18 =
| years19 =
| clubs19 =
| caps19 =
| goals19 =
| years20 =
| clubs20 =
| caps20 =
| goals20 =
| years21 =
| clubs21 =
| caps21 =
| goals21 =
| years22 =
| clubs22 =
| caps22 =
| goals22 =
| years23 =
| clubs23 =
| caps23 =
| goals23 =
| years24 =
| clubs24 =
| caps24 =
| goals24 =
| years25 =
| clubs25 =
| caps25 =
| goals25 =
| years26 =
| clubs26 =
| caps26 =
| goals26 =
| years27 =
| clubs27 =
| caps27 =
| goals27 =
| years28 =
| clubs28 =
| caps28 =
| goals28 =
| years29 =
| clubs29 =
| caps29 =
| goals29 =
| years30 =
| clubs30 =
| caps30 =
| goals30 =
| years31 =
| clubs31 =
| caps31 =
| goals31 =
| years32 =
| clubs32 =
| caps32 =
| goals32 =
| years33 =
| clubs33 =
| caps33 =
| goals33 =
| years34 =
| clubs34 =
| caps34 =
| goals34 =
| years35 =
| clubs35 =
| caps35 =
| goals35 =
| years36 =
| clubs36 =
| caps36 =
| goals36 =
| years37 =
| clubs37 =
| caps37 =
| goals37 =
| years38 =
| clubs38 =
| caps38 =
| goals38 =
| years39 =
| clubs39 =
| caps39 =
| goals39 =
| years40 =
| clubs40 =
| caps40 =
| goals40 =
| years41 =
| clubs41 =
| caps41 =
| goals41 =
| years42 =
| clubs42 =
| caps42 =
| goals42 =
| years43 =
| clubs43 =
| caps43 =
| goals43 =
| years44 =
| clubs44 =
| caps44 =
| goals44 =
| years45 =
| clubs45 =
| caps45 =
| goals45 =
| years46 =
| clubs46 =
| caps46 =
| goals46 =
| years47 =
| clubs47 =
| caps47 =
| goals47 =
| years48 =
| clubs48 =
| caps48 =
| goals48 =
| years49 =
| clubs49 =
| caps49 =
| goals49 =
| years50 =
| clubs50 =
| caps50 =
| goals50 =
| years51 =
| clubs51 =
| caps51 =
| goals51 =
| years52 =
| clubs52 =
| caps52 =
| goals52 =
| totalcaps =
| totalgoals =
| nationalyears1 =
| nationalteam1 =
| nationalcaps1 =
| nationalgoals1 =
| nationalyears2 =
| nationalteam2 =
| nationalcaps2 =
| nationalgoals2 =
| nationalyears3 =
| nationalteam3 =
| nationalcaps3 =
| nationalgoals3 =
| nationalyears4 =
| nationalteam4 =
| nationalcaps4 =
| nationalgoals4 =
| nationalyears5 =
| nationalteam5 =
| nationalcaps5 =
| nationalgoals5 =
| nationalyears6 =
| nationalteam6 =
| nationalcaps6 =
| nationalgoals6 =
| nationalyears7 =
| nationalteam7 =
| nationalcaps7 =
| nationalgoals7 =
| nationalyears8 =
| nationalteam8 =
| nationalcaps8 =
| nationalgoals8 =
| nationalyears9 =
| nationalteam9 =
| nationalcaps9 =
| nationalgoals9 =
| nationalyears10 =
| nationalteam10 =
| nationalcaps10 =
| nationalgoals10 =
| manageryears1 =
| managerclubs1 =
| manageryears2 =
| managerclubs2 =
| manageryears3 =
| managerclubs3 =
| manageryears4 =
| managerclubs4 =
| manageryears5 =
| managerclubs5 =
| manageryears6 =
| managerclubs6 =
| manageryears7 =
| managerclubs7 =
| manageryears8 =
| managerclubs8 =
| manageryears9 =
| managerclubs9 =
| manageryears10 =
| managerclubs10 =
| manageryears11 =
| managerclubs11 =
| manageryears12 =
| managerclubs12 =
| manageryears13 =
| managerclubs13 =
| manageryears14 =
| managerclubs14 =
| manageryears15 =
| managerclubs15 =
| manageryears16 =
| managerclubs16 =
| manageryears17 =
| managerclubs17 =
| manageryears18 =
| managerclubs18 =
| manageryears19 =
| managerclubs19 =
| manageryears20 =
| managerclubs20 =
| manageryears21 =
| managerclubs21 =
| manageryears22 =
| managerclubs22 =
| manageryears23 =
| managerclubs23 =
| manageryears24 =
| managerclubs24 =
| manageryears25 =
| managerclubs25 =
| manageryears26 =
| managerclubs26 =
| manageryears27 =
| managerclubs27 =
| manageryears28 =
| managerclubs28 =
| manageryears29 =
| managerclubs29 =
| manageryears30 =
| managerclubs30 =
| manageryears31 =
| managerclubs31 =
| manageryears32 =
| managerclubs32 =
| manageryears33 =
| managerclubs33 =
| manageryears34 =
| managerclubs34 =
| manageryears35 =
| managerclubs35 =
| manageryears36 =
| managerclubs36 =
| manageryears37 =
| managerclubs37 =
| manageryears38 =
| managerclubs38 =
| manageryears39 =
| managerclubs39 =
| manageryears40 =
| managerclubs40 =
| manageryears41 =
| managerclubs41 =
| manageryears42 =
| managerclubs42 =
| manageryears43 =
| managerclubs43 =
| manageryears44 =
| managerclubs44 =
| manageryears45 =
| managerclubs45 =
| manageryears46 =
| managerclubs46 =
| manageryears47 =
| managerclubs47 =
| manageryears48 =
| managerclubs48 =
| manageryears49 =
| managerclubs49 =
| manageryears50 =
| managerclubs50 =
| manageryears51 =
| managerclubs51 =
| manageryears52 =
| managerclubs52 =
| manageryears53 =
| managerclubs53 =
| manageryears54 =
| managerclubs54 =
| manageryears55 =
| managerclubs55 =
| manageryears56 =
| managerclubs56 =
| manageryears57 =
| managerclubs57 =
| manageryears58 =
| managerclubs58 =
| manageryears59 =
| managerclubs59 =
| manageryears60 =
| managerclubs60 =
| manageryears60 =
| managerclubs60 =
| manageryears61 =
| managerclubs61 =
| manageryears62 =
| managerclubs62 =
| manageryears63 =
| managerclubs63 =
| manageryears64 =
| managerclubs64 =
| manageryears65 =
| managerclubs65 =
| manageryears66 =
| managerclubs66 =
| manageryears67 =
| managerclubs67 =
| manageryears68 =
| managerclubs68 =
| manageryears69 =
| managerclubs69 =
| manageryears70 =
| managerclubs70 =
| manageryears71 =
| managerclubs71 =
| manageryears72 =
| managerclubs72 =
| manageryears73 =
| managerclubs73 =
| manageryears74 =
| managerclubs74 =
| manageryears75 =
| managerclubs75 =
| manageryears76 =
| managerclubs76 =
| manageryears77 =
| managerclubs77 =
| manageryears78 =
| managerclubs78 =
| manageryears79 =
| managerclubs79 =
| manageryears80 =
| managerclubs80 =
| medaltemplates =
| medaltemplates-expand =
| module =
| club-update =
| nationalteam-update =
}}
</syntaxhighlight>
{{Hidden end}}
{{Clear}}
== Parameters ==
All parameters are optional.
;{{{embed}}}: Enables the template to be embedded into another template, such as {{tl|Infobox person}}. See [[#Use as a child template|explanation below]].
;{{{embed-header}}}: Allows for a custom heading to the infobox instead of "Association football career" when embedded into another template.
;{{{header-color}}}: Allows a custom [[web color]] to be set for the template's section headings and a divider when embedded into another template.
;{{{name}}}: The commonly used name of the player. If this is omitted, it will be inferred from the title of the article.
;{{{full_name}}}: The player's complete name. Long names will wrap automatically to the width of the infobox, so there's no need to include explicit linebreaks. Alias: '''fullname'''
;{{{image}}}: A picture of the player, ideally on the pitch in the strip of their most recent team (or the team the player is most well known for, in the case of retirees). Images should be given in the format {{mono|<nowiki>Example.jpg</nowiki>}}, rather than {{mono|<nowiki>[[File:Example.jpg]]</nowiki>}}.
;{{{upright}}}: Scales the image thumbnail from its default size by the given factor. Values less than 1 scale the image down (0.9 = 90%) and values greater than 1 scale the image up (1.15 = 115%). The use of {{{image_size}}} has been deprecated and should be avoided per [[WP:IMGSIZE]].
;{{{alt}}}: [[WP:ALT|Alternative text]] for the image.
;{{{caption}}}: A caption for the image.
;{{{birth_name}}}: If different from name and full_name.
;{{{birth_date}}}: The player's date of birth. A template ({{Tl|Birth date and age}} for living people; {{tl|Birth year}} or {{Tl|Birth date}} for all others) should be used to add the date, but be sure to use the appropriate parameters to present the date in the same format as used in the text. The date should not be wikilinked.
;{{{birth_place}}}: The location of the player's birth.
;{{{death_date}}}: The player's date of death. The template {{Tl|Death date and age}} should be used to add the date, but be sure to use the appropriate parameters to present the date in the same format as used in the text. The date should not be wikilinked.
;{{{death_place}}}: The location of the player's death.
;{{{height}}}: The player's height in the units most common within the country in which they play, using the format "X m", "X cm", or "X ft Y in". When given in this format, the height will be [[Template:Infobox person/height/doc|automatically converted]]. Note that fractions of an inch can also be added, e.g. "5 ft 8+1/2 in" will output "5 ft {{fraction|8|1|2}} in (1.74 m)".
;{{{position}}}: The player's '''most common''' position or positions. If a player is known for playing in multiple roles then explain the point more fully within the article.
;{{{currentclub}}}: The club for which the player currently plays, or is employed by. If the player now works in a non-playing role at the club, add this after the club in brackets. For retired players and free agents not currently employed by any club or federation, leave blank.
;{{{clubnumber}}}: The shirt number of the player at their current club.
;{{{youthyears1}}}, {{{youthyears2}}}... {{{youthyears12}}}: A list of years that the player has been at each club as a youth, one per attribute, earliest to latest.
;{{{youthclubs1}}}, {{{youthclubs2}}}... {{{youthclubs12}}}: A list of clubs that the player was a member of as a youth, one per attribute, earliest to latest.
;{{{collegeyears1}}}... {{{collegeyears4}}}: A list of years that the player has been at each college team, one per attribute, earliest to latest.
;{{{college1}}}... {{{college4}}}: A list of college teams that the player was a member of, one per attribute, earliest to latest.
;{{{collegecaps1}}}... {{{collegecaps4}}}: A list of appearances that the player has been awarded in '''all competitive matches''' for each college team, one per attribute, earliest to latest.
;{{{collegegoals1}}}... {{{collegegoals4}}}: A list of goals that the player has been awarded in '''all competitive matches''' for each college team, one per attribute, earliest to latest.
;{{{years1}}}, {{{years2}}}... {{{years52}}}: A list of years that the player has been contracted at each club, one per attribute, earliest to latest.
;{{{clubs1}}}, {{{clubs2}}}... {{{clubs52}}}: A list of clubs that the player has been contracted at, one per attribute, earliest to latest.
;{{{caps1}}}, {{{caps2}}}... {{{caps52}}}: A list of appearances that the player has been awarded in '''league competition''' only for each club (note: Playoff matches are '''not''' counted as league matches by most statistical sources (e.g. [http://www.soccerbase.com Soccerbase] and the Sky Sports (Rothmans) Football Yearbook), so they should not be included in this infobox), one per attribute, earliest to latest.
;{{{goals1}}}, {{{goals2}}}... {{{goals52}}}: A list of goals that the player has been awarded in '''league competition''' only for each club (note: Playoff matches are '''not''' counted as league matches by most statistical sources (e.g. [http://www.soccerbase.com Soccerbase] and the Sky Sports (Rothmans) Football Yearbook), so they should not be included in this infobox), one per attribute, earliest to latest.
;{{{totalcaps}}}: The total number of appearances the player has been awarded in '''league competition''' for all clubs.
;{{{totalgoals}}}: The total number of goals the player has scored in '''league competition''' for all clubs.
;{{{nationalyears1}}}, {{{nationalyears2}}}... {{{nationalyears10}}}: A list of years that the player has played for each national team, one per attribute, youngest to oldest level (e.g. U17, U21, Olympic team, B team, senior team).
;{{{nationalteam1}}}, {{{nationalteam2}}}... {{{nationalteam10}}}: A list of international teams that the player has played for, including non-senior teams such as U21, one per attribute, youngest to oldest level (e.g. U17, U21, Olympic team, B team, senior team).
;{{{nationalcaps1}}}, {{{nationalcaps2}}}... {{{nationalcaps10}}}: A list of appearances that the player has been awarded in '''all competitions and friendlies''' for each national team, one per attribute, youngest to oldest level (e.g. U17, U21, Olympic team, B team, senior team).
;{{{nationalgoals1}}}, {{{nationalgoals2}}}... {{{nationalgoals10}}}: A list of goals that the player has been awarded in '''all competitions and friendlies''' for each national team, one per attribute, youngest to oldest level (e.g. U17, U21, Olympic team, B team, senior team).
;{{{manageryears1}}}, {{{manageryears2}}}... {{{manageryears80}}}: A list of years that the person has served within the capacity of manager at each team, one per attribute, earliest to latest.
;{{{managerclubs1}}}, {{{managerclubs2}}}... {{{managerclubs80}}}: A list of clubs that the person has served within the capacity of team manager. Please '''do not''' list positions other than team manager (such as assistant or coach positions, or director of football roles where this role is not considered managerial) unless that position is a significant part of the person's career; this will apply primarily to those with significant or perhaps primary experience in management. Clubs listed can be both local and national and should be restricted to those ordinarily considered notable in themselves.
;{{{medaltemplates}}}: Medals earned in international competition can be added here using the templates {{tl|Medal}}.
;{{{medaltemplates-expand}}}: Expands the medals section to be displayed by default instead of being collapsed.
;{{{club-update}}}: A timestamp at which the player's infobox club statistics are unambiguously correct. The bare date of the last match played should not be used because this is not unambiguous. Dates should use the same format as the rest of the article; use five tildes (<nowiki>~~~~~</nowiki>) to generate the current date/time in dmy format, or {{subst|mdytime}} for mdy format. The parameter is not needed if the player has retired. Alias: '''pcupdate'''
;{{{nationalteam-update}}}: A timestamp at which the player's infobox national team statistics are unambiguously correct. The bare date of the last match played should not be used because this is not unambiguous. Dates should use the same format as the rest of the article; use five tildes (<nowiki>~~~~~</nowiki>) to generate the current date/time in dmy format, or {{subst|mdytime}} for mdy format. The parameter is not needed if the player has retired. Alias: '''ntupdate'''
;{{{module}}}: Enables another template to be embedded into this template, such as {{tl|Infobox military person}}. See [[#Embedding other templates|explanation below]].
=== Use as a child template ===
The '''embed''' parameter is used when embedding this infobox into another.
{{Infobox person module documentation|Infobox football biography|parameter=embed}}
=== Embedding other templates ===
The '''module''' parameter is used for embedding other templates into this infobox (see [[Wikipedia:Infobox modules]] and [[:Category:Biographical templates usable as a module]]).
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
| name =
| <!-- etc. -->
| module =
{{Infobox ABC
| embed = yes <!-- or child=yes / subbox=yes-->
| <!-- etc. -->
}}
}}
</syntaxhighlight>
== Examples ==
=== Independent ===
{{Infobox football biography
|name = Tim Template
|image = Nizar-Khalfan.jpg
|alt = Photo of a player in blue football kit, hair braided.
|caption = Tim Template with the Template Rangers
|full_name = Tim Tenerife Template
|birth_date = {{birth date and age|1975|1|1|df=y}}
|birth_place = Template City, Templatia
|height = 1.75 m
|position = [[Forward (association football)|Striker]]
|currentclub = Template City F.C.
|clubnumber = 9
|youthyears1 = 1985–1987
|youthclubs1 = Template Juniors
|youthyears2 = 1987–1992
|youthclubs2 = Template Youth
|collegeyears1 = 1983–1985
|college1 = Template College
|collegecaps1 = 2
|collegegoals1 = 1
|years1 = 1992–1999
|clubs1 = Template United F.C.
|caps1 = 75
|goals1 = 26
|years2 = 1999–2002
|clubs2 = Template Rangers
|caps2 = 32
|goals2 = 11
|years3 = 2001
|clubs3 = → Example F.C. (loan)
|caps3 = 15
|goals3 = 7
|years4 = 2002–
|clubs4 = Template City F.C.
|caps4 = 113
|goals4 = 46
|nationalyears1 = 1991
|nationalteam1 = Examplia U16
|nationalcaps1 = 1
|nationalgoals1 = 0
|nationalyears2 = 1996–1998
|nationalteam2 = Templatia U21
|nationalcaps2 = 8
|nationalgoals2 = 2
|nationalyears3 = 1999–
|nationalteam3 = Templatia
|nationalcaps3 = 46
|nationalgoals3 = 13
|medaltemplates =
{{Medal|Country|Brazil}}
{{Medal|Competition|FIFA Template Cup}}
{{medal|Winner|2013 FIFA Template Cup|}}
{{medal|3rd|2001 FIFA Template Cup|}}
{{Medal|Competition|[[Football at the Summer Olympics|Summer Olympics]]}}
{{medal|Gold|[[2016 Summer Olympics|2016 Rio de Janeiro]]|[[Football at the 2016 Summer Olympics – Men's tournament|Team]]}}
|club-update = 14:56, 6 October 2014 (UTC)
|nationalteam-update = 14:56, 6 October 2014 (UTC)
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox football biography
|name = Tim Template
|image = Nizar-Khalfan.jpg
|alt = Photo of a player in blue football kit, hair braided.
|caption = Tim Template with the Template Rangers
|full_name = Tim Tenerife Template
|birth_date = {{birth date and age|1975|1|1|df=y}}
|birth_place = Template City, Templatia
|height = 1.75 m
|position = [[Forward (association football)|Striker]]
|currentclub = Template City F.C.
|clubnumber = 9
|youthyears1 = 1985–1987
|youthclubs1 = Template Juniors
|youthyears2 = 1987–1992
|youthclubs2 = Template Youth
|collegeyears1 = 1983–1985
|college1 = Template College
|collegecaps1 = 2
|collegegoals1 = 1
|years1 = 1992–1999
|clubs1 = Template United F.C.
|caps1 = 75
|goals1 = 26
|years2 = 1999–2002
|clubs2 = Template Rangers
|caps2 = 32
|goals2 = 11
|years3 = 2001
|clubs3 = → Example F.C. (loan)
|caps3 = 15
|goals3 = 7
|years4 = 2002–
|clubs4 = Template City F.C.
|caps4 = 113
|goals4 = 46
|nationalyears1 = 1991
|nationalteam1 = Examplia U16
|nationalcaps1 = 1
|nationalgoals1 = 0
|nationalyears2 = 1996–1998
|nationalteam2 = Templatia U21
|nationalcaps2 = 8
|nationalgoals2 = 2
|nationalyears3 = 1999–
|nationalteam3 = Templatia
|nationalcaps3 = 46
|nationalgoals3 = 13
|medaltemplates =
{{Medal|Country|Brazil}}
{{Medal|Competition|FIFA Template Cup}}
{{medal|Winner|2013 FIFA Template Cup|}}
{{medal|3rd|2001 FIFA Template Cup|}}
{{Medal|Competition|[[Football at the Summer Olympics|Summer Olympics]]}}
{{medal|Gold|[[2016 Summer Olympics|2016 Rio de Janeiro]]|[[Football at the 2016 Summer Olympics – Men's tournament|Team]]}}
|club-update = ~~~~~
|nationalteam-update = ~~~~~
}}
</syntaxhighlight> {{clear}}
=== Embedded in a different infobox (embed parameter) ===
{{Infobox person
|name = Tim Template
|image = Nizar-Khalfan.jpg
|alt = Photo of a player in blue football kit, hair braided.
|caption = Tim Template with the Template Rangers
|birth_name = Tim Tenerife Template
|birth_date = {{birth date and age|1975|1|1|df=y}}
|birth_place = Template City, Templatia
|height = 1.75 m
|module =
{{Infobox football biography
|embed = yes
|position = [[Forward (association football)|Striker]]
|currentclub = Template City F.C.
|clubnumber = 9
|youthyears1 = 1985–1987
|youthclubs1 = Template Juniors
|youthyears2 = 1987–1992
|youthclubs2 = Template Youth
|collegeyears1 = 1983-1985
|college1 = Template College
|collegecaps1 = 2
|collegegoals1 = 1
|years1 = 1992–1999
|clubs1 = Template United F.C.
|caps1 = 75
|goals1 = 26
|years2 = 1999–2002
|clubs2 = Template Rangers
|caps2 = 32
|goals2 = 11
|years3 = 2001
|clubs3 = → Example F.C. (loan)
|caps3 = 15
|goals3 = 7
|years4 = 2002–
|clubs4 = Template City F.C.
|caps4 = 113
|goals4 = 46
|nationalyears1 = 1991
|nationalteam1 = Examplia U16
|nationalcaps1 = 1
|nationalgoals1 = 0
|nationalyears2 = 1996–1998
|nationalteam2 = Templatia U21
|nationalcaps2 = 8
|nationalgoals2 = 2
|nationalyears3 = 1999–
|nationalteam3 = Templatia
|nationalcaps3 = 46
|nationalgoals3 = 13
|medaltemplates =
{{Medal|Country|Brazil}}
{{Medal|Competition|FIFA Template Cup}}
{{medal|Winner|2013 FIFA Template Cup|}}
{{medal|3rd|2001 FIFA Template Cup|}}
{{Medal|Competition|[[Football at the Summer Olympics|Summer Olympics]]}}
{{medal|Gold|[[2016 Summer Olympics|2016 Rio de Janeiro]]|[[Football at the 2016 Summer Olympics – Men's tournament|Team]]}}
|club-update = 14:56, 6 October 2014 (UTC)
|nationalteam-update = 14:56, 6 October 2014 (UTC)
}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox person
|name = Tim Template
|image = Nizar-Khalfan.jpg
|alt = Photo of a player in blue football kit, hair braided.
|caption = Tim Template with the Template Rangers
|birth_name = Tim Tenerife Template
|birth_date = {{birth date and age|1975|1|1|df=y}}
|birth_place = Template City, Templatia
|height = 1.75 m
|module =
{{Infobox football biography
|embed = yes
|position = [[Forward (association football)|Striker]]
|currentclub = Template City F.C.
|clubnumber = 9
|youthyears1 = 1985–1987
|youthclubs1 = Template Juniors
|youthyears2 = 1987–1992
|youthclubs2 = Template Youth
|years1 = 1992–1999
|clubs1 = Template United F.C.
|caps1 = 75
|goals1 = 26
|years2 = 1999–2002
|clubs2 = Template Rangers
|caps2 = 32
|goals2 = 11
|years3 = 2001
|clubs3 = → Example F.C. (loan)
|caps3 = 15
|goals3 = 7
|years4 = 2002–
|clubs4 = Template City F.C.
|caps4 = 113
|goals4 = 46
|nationalyears1 = 1991
|nationalteam1 = Examplia U16
|nationalcaps1 = 1
|nationalgoals1 = 0
|nationalyears2 = 1996–1998
|nationalteam2 = Templatia U21
|nationalcaps2 = 8
|nationalgoals2 = 2
|nationalyears3 = 1999–
|nationalteam3 = Templatia
|nationalcaps3 = 46
|nationalgoals3 = 13
|medaltemplates =
{{Medal|Country|{{fb|BRA}}}}
{{Medal|Competition|FIFA Template Cup}}
{{medal|Winner|2013 FIFA Template Cup|}}
{{medal|3rd|2001 FIFA Template Cup|}}
{{Medal|Competition|[[Football at the Summer Olympics|Summer Olympics]]}}
{{medal|Gold|[[2016 Summer Olympics|2016 Rio de Janeiro]]|[[Football at the 2016 Summer Olympics – Men's tournament|Team]]}}
|club-update = ~~~~~
|nationalteam-update = ~~~~~
}}
}}
</syntaxhighlight> {{clear}}
{{Infobox rugby biography
| name = Alev Kelter
| birth_name = Leyla Alev Kelter
| birth_date = {{Birth-date and age|March 21, 1991}}
| birth_place = [[Tampa, Florida]], U.S.
| height = 5 ft 6 in
| ru_position = Centre
| repyears1 = 2016–present
| repteam1 = [[United States women's national rugby union team|United States]]
| repcaps1 = 9
| reppoints1 = 32
| ru_sevensnationalyears1 = 2014
| ru_sevensnationalteam1 = [[United States women's national rugby sevens team|United States]]
| ru_sevensnationalcomp1 = -
| module =
{{Infobox football biography | embed = yes
| position = [[Midfielder]]
| collegeyears1 = 2009–2013
| college1 = [[Wisconsin Badgers women's soccer|Wisconsin Badgers]]
| nationalyears1 = 2009
| nationalteam1 = [[United States women's national under-20 soccer team|United States U20]]
}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox rugby biography
| name = Alev Kelter
| birth_name = Leyla Alev Kelter
| birth_date = {{Birth-date and age|March 21, 1991}}
| birth_place = [[Tampa, Florida]], U.S.
| height = 5 ft 6 in
| ru_position = Centre
| repyears1 = 2016–present
| repteam1 = [[United States women's national rugby union team|United States]]
| repcaps1 = 9
| reppoints1 = 32
| ru_sevensnationalyears1 = 2014
| ru_sevensnationalteam1 = [[United States women's national rugby sevens team|United States]]
| ru_sevensnationalcomp1 = -
| module =
{{Infobox football biography | embed = yes
| position = [[Midfielder]]
| collegeyears1 = 2009–2013
| college1 = [[Wisconsin Badgers women's soccer|Wisconsin Badgers]]
| nationalyears1 = 2009
| nationalteam1 = [[United States women's national under-20 soccer team|United States U20]]
}}
}}
</syntaxhighlight> {{clear}}
=== Embedding other infoboxes (module parameter) ===
{{Infobox football biography
| name = Alev Kelter
| birth_name = Leyla Alev Kelter
| birth_date = {{Birth-date and age|March 21, 1991}}
| birth_place = [[Tampa, Florida]], U.S.
| height = 5 ft 6 in
| position = [[Midfielder]]
| collegeyears1 = 2009–2013
| college1 = [[Wisconsin Badgers women's soccer|Wisconsin Badgers]]
| nationalyears1 = 2009
| nationalteam1 = [[United States women's national under-20 soccer team|United States U20]]
| module =
{{Infobox rugby biography | embed = yes
| ru_position = Centre
| repyears1 = 2016–present
| repteam1 = [[United States women's national rugby union team|United States]]
| repcaps1 = 9
| reppoints1 = 32
| ru_sevensnationalyears1 = 2014
| ru_sevensnationalteam1 = [[United States women's national rugby sevens team|United States]]
| ru_sevensnationalcomp1 = -
}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox football biography
| name = Alev Kelter
| birth_name = Leyla Alev Kelter
| birth_date = {{Birth-date and age|March 21, 1991}}
| birth_place = [[Tampa, Florida]], U.S.
| height = 5 ft 6 in
| position = [[Midfielder]]
| collegeyears1 = 2009–2013
| college1 = [[Wisconsin Badgers women's soccer|Wisconsin Badgers]]
| nationalyears1 = 2009
| nationalteam1 = [[United States women's national under-20 soccer team|United States U20]]
| module =
{{Infobox rugby biography | embed = yes
| ru_position = Centre
| repyears1 = 2016–present
| repteam1 = [[United States women's national rugby union team|United States]]
| repcaps1 = 9
| reppoints1 = 32
| ru_sevensnationalyears1 = 2014
| ru_sevensnationalteam1 = [[United States women's national rugby sevens team|United States]]
| ru_sevensnationalcomp1 = -
}}
}}
</syntaxhighlight> {{clear}}
== Style guide ==
Try to always consider that an infobox exists to support an article and provide a quick synopsis of important facts. This becomes vital when considering that the amount of space available within an infobox is significantly less than that available outside of it.
As per the [[Wikipedia:Manual of Style (links)|manual of style]] entry on linking, years and dates should not be linked as they do not provide much benefit to the user.
Do not add flag icons to the birth_place, death_place, club, national team or other fields. See: [[Wikipedia:Manual of Style (flags)]].
As per the [[Wikipedia:Manual of Style (dates and numbers)|manual of style]] the player's height should be in the units most common in the country in which they play. Units should be abbreviated in the infobox and spelt out in the article text. Measurements should be inputted into the {{para|height}} parameter using the format "X m", "X cm", or "X ft Y in". This will [[Template:Infobox person/height/doc|automatically convert]] units between formats and correctly handle the presentation of units in their short forms. Per [[Wikipedia talk:WikiProject Football/Archive 87#Height|consensus at WikiProject Football]], metric height will then be displayed in metres.
For example:
*{{para|height|1.78 m}} produces 1.78 m (5 ft 10 in)
*{{para|height|178 cm}} produces 1.78 m (5 ft 10 in)
*{{para|height|5 ft 8 in}} produces 5 ft 8 in (1.73 m)
*{{para|height|5 ft 8+1/2 in}} produces 5 ft {{fraction|8|1|2}} in (1.74 m)
Alternatively, the templates {{tl|convert}} and {{tl|height}} may be used for height conversion. This is particularly useful if the more accurate metric height is known but the output should be in feet and inches, or if a fraction is desired for the converted inches.
For example:
*If you have the height in metres, but want to display feet and inches first:
**<code><nowiki>{{convert|1.73|m|order=flip}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.73|m|order=flip}}}}
*If you have the height in metres, but want to display feet and inches first (with precision to the nearest half inch):
**<code><nowiki>{{convert|1.79|m|order=flip|frac=2}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.79|m|order=flip|frac=2}}}}
**<code><nowiki>{{convert|1.79|m|order=flip|round=0.5}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.79|m|order=flip|round=0.5}}}}
*If you have the height in feet and inches (with precision to the nearest half inch), but want to display metres first:
**<code><nowiki>{{convert|5|ft|8+1/2|in|2|order=flip}}</nowiki></code> produces {{#invoke:person height|main|{{convert|5|ft|8+1/2|in|2|order=flip}}}}
**<code><nowiki>{{convert|5|ft|8.5|in|2|order=flip}}</nowiki></code> produces {{#invoke:person height|main|{{convert|5|ft|8.5|in|2|order=flip}}}}
*If you have the height in metres, but want to display the converted feet and inches with precision to the nearest half inch:
**<code><nowiki>{{height|m=1.79}}</nowiki></code> produces {{#invoke:person height|main|{{height|m=1.79}}}}
**<code><nowiki>{{convert|1.79|m|frac=2}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.79|m|frac=2}}}}
**<code><nowiki>{{convert|1.79|m|round=0.5}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.79|m|round=0.5}}}}
== Microformats ==
{{UF-hcard-person}}
==TemplateData==
{{Collapse top|[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"description": "This infobox template provides a quick overview of an association football player's or manager's details to enable a reader to extract the most oft-needed information without trawling through the article proper.",
"params": {
"name": {
"type": "string",
"label": "Name",
"description": "The commonly used name of the player. If this is omitted, it will be inferred from the title of the article."
},
"image": {
"type": "wiki-file-name",
"label": "Picture",
"description": "A picture of the player, ideally on the pitch in the strip of their most recent team (or the team the player is most well-known for, in the case of retirees). Use the format Example.jpg, rather than [[File:Example.jpg]]."
},
"upright": {
"type": "number",
"label": "Picture size",
"description": "Scales the image thumbnail from its default size by the given factor. Values less than 1 scale the image down (0.9 = 90%) and values greater than 1 scale the image up (1.15 = 115%).",
"example": "0.8"
},
"alt": {
"type": "string",
"label": "Picture alt text",
"description": "Alt text for the picture."
},
"caption": {
"type": "string",
"label": "Picture caption",
"description": "A caption for the picture."
},
"full_name": {
"type": "string",
"label": "Full name",
"description": "The player's complete name.",
"aliases": [ "fullname" ]
},
"birth_date": {
"type": "number",
"label": "Birth date",
"description": "The player's date of birth. A template ({{Birth date}}, {{Birth date and age}}) should be used to add the date, but be sure to use the appropriate parameters to present the date in the same format as used in the text. The date should not be wikilinked."
},
"birth_place": {
"type": "string",
"label": "Birth place",
"description": "The location of the player's birth."
},
"death_date": {
"label": "Date of death",
"description": "Use exact date if known, but otherwise as close an approximation as possible. Example: April 27, 1992",
"type": "string",
"required": false
},
"death_place": {
"label": "Place of death",
"description": "Example: Washington, DC, USA",
"type": "string",
"required": false
},
"height": {
"type": "number",
"label": "Height",
"description": "The player's height in the units most common within the country in which they play. The {{height}} template should be used for automatic formatting. The infobox also supports automatic conversion if the height is specified as \"X m\", \"X cm\", or \"X ft Y in\"."
},
"position": {
"type": "string",
"label": "Position",
"description": "The player's most common position or positions. If a player is known for playing in multiple roles then explain the point more fully within the article."
},
"currentclub": {
"type": "string",
"label": "Current club",
"description": "The club for which the player currently plays, or is employed by. If the player now works in a non-playing role at the club, add this after the club in brackets. For retired players and free agents not currently employed by any club or federation, leave blank."
},
"clubnumber": {
"type": "number",
"label": "Number",
"description": "The shirt number of the player at their current club."
},
"youthyears1": {
"type": "number",
"label": "Youth club 1 years",
"description": "The years that the player was at their first youth club. Up to 8 clubs can be added using the parameter names \"youthyears2\", \"youthyears3\", etc."
},
"youthclubs1": {
"type": "string",
"label": "Youth club 1",
"description": "The first club that the player was a member of as a youth. Up to 8 clubs can be added using the parameter names \"youthclubs2\", \"youthclubs3\", etc."
},
"youthyears2": {
"type": "number",
"label": "Youth club 2 years",
"description": "The years that the player was at their second youth club."
},
"youthclubs2": {
"type": "string",
"label": "Youth club 2",
"description": "The second club that the player was a member of as a youth."
},
"youthyears3": {
"type": "number",
"label": "Youth club 3 years",
"description": "The years that the player was at their third youth club."
},
"youthclubs3": {
"type": "string",
"label": "Youth club 3",
"description": "The third club that the player was a member of as a youth."
},
"youthyears4": {
"type": "number",
"label": "Youth club 4 years",
"description": "The years that the player was at their fourth youth club."
},
"youthclubs4": {
"type": "string",
"label": "Youth club 4",
"description": "The fourth club that the player was a member of as a youth."
},
"youthyears5": {
"type": "number",
"label": "Youth club 5 years",
"description": "The years that the player was at their fifth youth club."
},
"youthclubs5": {
"type": "string",
"label": "Youth club 5",
"description": "The fifth club that the player was a member of as a youth."
},
"years1": {
"type": "number",
"label": "Club 1 years",
"description": "The years that the player was at their first club. Up to 39 years can be added using the parameter names \"years2\", \"years3\", etc."
},
"clubs1": {
"type": "string",
"label": "Club 1",
"description": "The first (senior) club that the player has been contracted at. Up to 39 clubs can be added using the parameter names \"clubs2\", \"clubs3\", etc."
},
"caps1": {
"type": "number",
"label": "Club 1 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the first club. Playoff matches should not be included. Up to 39 caps can be added using the parameter names \"caps2\", \"caps3\", etc."
},
"goals1": {
"type": "number",
"label": "Club 1 goals",
"description": "The number of goals that the player has been awarded in league competition for the first club. Playoff matches should not be included. Up to 39 can be added using the parameter names \"goals2\", \"goals3\", etc."
},
"years2": {
"type": "number",
"label": "Club 2 years",
"description": "The years that the player was at their second club."
},
"clubs2": {
"type": "string",
"label": "Club 2",
"description": "The second club that the player has been contracted at."
},
"caps2": {
"type": "number",
"label": "Club 2 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the second club."
},
"goals2": {
"type": "number",
"label": "Club 2 goals",
"description": "The number of goals that the player has been awarded in league competition for the second club."
},
"years3": {
"type": "number",
"label": "Club 3 years",
"description": "The years that the player was at their third club."
},
"clubs3": {
"type": "string",
"label": "Club 3",
"description": "The third club that the player has been contracted at."
},
"caps3": {
"type": "number",
"label": "Club 3 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the third club."
},
"goals3": {
"type": "number",
"label": "Club 3 goals",
"description": "The number of goals that the player has been awarded in league competition for the third club."
},
"years4": {
"type": "number",
"label": "Club 4 years",
"description": "The years that the player was at their fourth club."
},
"clubs4": {
"type": "string",
"label": "Club 4",
"description": "The fourth club that the player has been contracted at."
},
"caps4": {
"type": "number",
"label": "Club 4 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the fourth club."
},
"goals4": {
"type": "number",
"label": "Club 4 goals",
"description": "The number of goals that the player has been awarded in league competition for the fourth club."
},
"years5": {
"type": "number",
"label": "Club 5 years",
"description": "The years that the player was at their fifth club."
},
"clubs5": {
"type": "string",
"label": "Club 5",
"description": "The fifth club that the player has been contracted at."
},
"caps5": {
"type": "number",
"label": "Club 5 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the fifth club."
},
"goals5": {
"type": "number",
"label": "Club 5 goals",
"description": "The number of goals that the player has been awarded in league competition for the fifth club."
},
"years6": {
"type": "number",
"label": "Club 6 years",
"description": "The years that the player was at their sixth club."
},
"clubs6": {
"type": "string",
"label": "Club 6",
"description": "The sixth club that the player has been contracted at."
},
"caps6": {
"type": "number",
"label": "Club 6 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the sixth club."
},
"goals6": {
"type": "number",
"label": "Club 6 goals",
"description": "The number of goals that the player has been awarded in league competition for the sixth club."
},
"years7": {
"type": "number",
"label": "Club 7 years",
"description": "The years that the player was at their seventh club."
},
"clubs7": {
"type": "string",
"label": "Club 7",
"description": "The seventh club that the player has been contracted at."
},
"caps7": {
"type": "number",
"label": "Club 7 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the seventh club."
},
"goals7": {
"type": "number",
"label": "Club 7 goals",
"description": "The number of goals that the player has been awarded in league competition for the seventh club."
},
"years8": {
"type": "number",
"label": "Club 8 years",
"description": "The years that the player was at their eighth club."
},
"clubs8": {
"type": "string",
"label": "Club 8",
"description": "The eighth club that the player has been contracted at."
},
"caps8": {
"type": "number",
"label": "Club 8 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the eighth club."
},
"goals8": {
"type": "number",
"label": "Club 8 goals",
"description": "The number of goals that the player has been awarded in league competition for the eighth club."
},
"years9": {
"type": "number",
"label": "Club 9 years",
"description": "The years that the player was at their ninth club."
},
"clubs9": {
"type": "string",
"label": "Club 9",
"description": "The ninth club that the player has been contracted at."
},
"caps9": {
"type": "number",
"label": "Club 9 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the ninth club."
},
"goals9": {
"type": "number",
"label": "Club 9 goals",
"description": "The number of goals that the player has been awarded in league competition for the ninth club."
},
"years10": {
"type": "number",
"label": "Club 10 years",
"description": "The years that the player was at their tenth club."
},
"clubs10": {
"type": "string",
"label": "Club 10",
"description": "The tenth club that the player has been contracted at."
},
"caps10": {
"type": "number",
"label": "Club 10 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the tenth club."
},
"goals10": {
"type": "number",
"label": "Club 10 goals",
"description": "The number of goals that the player has been awarded in league competition for the tenth club."
},
"totalcaps": {
"type": "number",
"label": "Club appearances total",
"description": "The total number of appearances the player has been awarded in league competition for all non-youth clubs."
},
"totalgoals": {
"label": "Club goals total",
"description": "The total number of goals the player has scored in league competition for all non-youth clubs.",
"type": "number"
},
"nationalyears1": {
"type": "number",
"label": "National team 1 years",
"description": "The years that the player has played for the first national team. Up to 9 years can be added using the parameter names \"nationalyears2\", \"nationalyears3\", etc."
},
"nationalteam1": {
"type": "string",
"label": "National team 1",
"description": "The first national team that the player has played for (including non-senior teams such as U21). Up to 9 teams can be added using the parameter names \"nationalteam2\", \"nationalteam3\", etc."
},
"nationalcaps1": {
"type": "number",
"label": "National team 1 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the first national team. Up to 9 numbers can be added using the parameter names \"nationalcaps2\", \"nationalcaps3\", etc."
},
"nationalgoals1": {
"type": "number",
"label": "National team 1 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the first national team. Up to 9 numbers can be added using the parameter names \"nationalgoals2\", \"nationalgoals3\", etc."
},
"nationalyears2": {
"type": "number",
"label": "National team 2 years",
"description": "The years that the player has played for the second national team."
},
"nationalteam2": {
"type": "string",
"label": "National team 2",
"description": "The second national team that the player has played for."
},
"nationalcaps2": {
"type": "number",
"label": "National team 2 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the second national team."
},
"nationalgoals2": {
"type": "number",
"label": "National team 2 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the second national team."
},
"nationalyears3": {
"type": "number",
"label": "National team 3 years",
"description": "The years that the player has played for the third national team."
},
"nationalteam3": {
"type": "string",
"label": "National team 3",
"description": "The third national team that the player has played for."
},
"nationalcaps3": {
"type": "number",
"label": "National team 3 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the third national team."
},
"nationalgoals3": {
"type": "number",
"label": "National team 3 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the third national team."
},
"nationalyears4": {
"type": "number",
"label": "National team 4 years",
"description": "The years that the player has played for the fourth national team."
},
"nationalteam4": {
"type": "string",
"label": "National team 4",
"description": "The fourth national team that the player has played for."
},
"nationalcaps4": {
"type": "number",
"label": "National team 4 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the fourth national team."
},
"nationalgoals4": {
"type": "number",
"label": "National team 4 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the fourth national team."
},
"nationalyears5": {
"type": "number",
"label": "National team 5 years",
"description": "The years that the player has played for the fifth national team."
},
"nationalteam5": {
"type": "string",
"label": "National team 5",
"description": "The fifth national team that the player has played for."
},
"nationalcaps5": {
"type": "number",
"label": "National team 5 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the fifth national team."
},
"nationalgoals5": {
"type": "number",
"label": "National team 5 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the fifth national team."
},
"manageryears1": {
"type": "number",
"label": "Manager club 1 years",
"description": "The years that the person has served with the first club in the capacity of team manager."
},
"managerclubs1": {
"type": "string",
"label": "Manager club 1",
"description": "The first club that the person has served within the capacity of team manager. Please do not list positions other than team manager (such as assistant or coach positions, or director of football roles where this role is not considered managerial) unless that position is a significant part of the person's career; this will apply primarily to those with significant or perhaps primary experience in management. Clubs listed can be both local and national and should be restricted to those ordinarily considered notable in themselves."
},
"manageryears2": {
"type": "number",
"label": "Manager club 2 years",
"description": "The years that the person has served with the second club in the capacity of team manager. Up to 30 can be added using the parameter names \"manageryears3\", \"manageryears4\", etc."
},
"managerclubs2": {
"type": "string",
"label": "Manager club 2",
"description": "The second club that the person has served within the capacity of team manager. Up to 30 can be added using the parameter names \"managerclubs3\", \"managerclubs4\", etc."
},
"manageryears3": {
"type": "number",
"label": "Manager club 3 years",
"description": "The years that the person has served with the third club in the capacity of team manager."
},
"managerclubs3": {
"type": "string",
"label": "Manager club 3",
"description": "The third club that the person has served within the capacity of team manager."
},
"manageryears4": {
"type": "number",
"label": "Manager club 4 years",
"description": "The years that the person has served with the fourth club in the capacity of team manager."
},
"managerclubs4": {
"type": "string",
"label": "Manager club 4",
"description": "The fourth club that the person has served within the capacity of team manager."
},
"manageryears5": {
"type": "number",
"label": "Manager club 5 years",
"description": "The years that the person has served with the fifth club in the capacity of team manager."
},
"managerclubs5": {
"type": "string",
"label": "Manager club 5",
"description": "The fifth club that the person has served within the capacity of team manager."
},
"manageryears6": {
"type": "number",
"label": "Manager club 6 years",
"description": "The years that the person has served with the sixth club in the capacity of team manager."
},
"managerclubs6": {
"type": "string",
"label": "Manager club 6",
"description": "The sixth club that the person has served within the capacity of team manager."
},
"manageryears7": {
"type": "number",
"label": "Manager club 7 years",
"description": "The years that the person has served with the seventh club in the capacity of team manager."
},
"managerclubs7": {
"type": "string",
"label": "Manager club 7",
"description": "The seventh club that the person has served within the capacity of team manager."
},
"manageryears8": {
"type": "number",
"label": "Manager club 8 years",
"description": "The years that the person has served with the eighth club in the capacity of team manager."
},
"managerclubs8": {
"type": "string",
"label": "Manager club 8",
"description": "The eighth club that the person has served within the capacity of team manager."
},
"manageryears9": {
"type": "number",
"label": "Manager club 9 years",
"description": "The years that the person has served with the ninth club in the capacity of team manager."
},
"managerclubs9": {
"type": "string",
"label": "Manager club 9",
"description": "The ninth club that the person has served within the capacity of team manager."
},
"manageryears10": {
"type": "number",
"label": "Manager club 10 years",
"description": "The years that the person has served with the tenth club in the capacity of team manager."
},
"managerclubs10": {
"type": "string",
"label": "Manager club 10",
"description": "The tenth club that the person has served within the capacity of team manager."
},
"medaltemplates": {
"type": "string",
"label": "Medal templates",
"description": "Honors can be added here using {{Medal}} templates."
},
"club-update": {
"type": "string",
"label": "Club update timestamp",
"description": "A timestamp at which the player's infobox club statistics are unambiguously correct. The bare date of the last match played should not be used because this is not unambiguous. Dates should use the same format as the rest of the article; use five tildes (<nowiki>~~~~~</nowiki>) to generate the current date/time in dmy format, or {{subst:mdytime}} for mdy format. The parameter is not needed if the player has retired.",
"aliases": [ "pcupdate" ]
},
"nationalteam-update": {
"label": "National team update timestamp",
"description": "A timestamp at which the player's infobox national team statistics are unambiguously correct. The bare date of the last match played should not be used because this is not unambiguous. Dates should use the same format as the rest of the article; use five tildes (<nowiki>~~~~~</nowiki>) to generate the current date/time in dmy format, or {{subst:mdytime}} for mdy format. The parameter is not needed if the player has retired.",
"type": "string",
"aliases": [ "ntupdate" ]
}
},
"format": "block"
}
</templatedata>
{{Collapse bottom}}
== Tracking categories ==
{{Infobox tracking cats}}
* {{clc|Pages using infobox football biography with height issues}}
* {{clc|Pages using infobox football biography with invalid clubnumber}}
* {{clc|Pages using infobox football biography with a module}}
* {{clc|Pages using infobox football biography with invalid position}}
* {{clc|Pages using infobox football biography with irregular position}}
* {{clc|Pages using infobox football biography with tags in position parameter}}
* {{clc|No local image but image on Wikidata}} – Used by [[Template:Wikidata image]] to track articles where an infobox has no image but [[Wikidata]] has an image name. To exclude articles from this category, add an image or {{para|nocat_wdimage|yes}} to the infobox.
== Supporting templates ==
The following templates are used directly from this template:
{{Columns-list|colwidth=20em|
* {{ml|Infobox3cols|}}
* {{tl|Abbr}}
* {{tl|Br separated entries}}
* {{tl|Infobox medal templates}}
* {{tl|Infobox person/height}}
* {{tl|Longitem}}
* {{tl|Main other}}
* {{tl|PAGENAMEBASE}}
* {{tl|Wikidata image}}
* {{tl|Yesno}}
}}
<includeonly>{{Basepage subpage|
<!-- Categories go here and interwikis go in Wikidata. -->
[[Category:Association football infobox templates|Football biography]]
[[Category:Sportsperson infobox templates|Football biography]]
[[Category:Biographical templates usable as a module|Football biography]]
[[Category:Infobox templates with module parameter|Football biography]]
[[Category:Infobox templates with updated parameter]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
ljt4pt7100pfw7jver9jivxcn26i366
75031
75030
2026-08-24T00:46:11Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_football_biography/doc]]
73968
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
{{Short description|Wikipedia association football template}}
{{For|American football biographies|Template:Infobox gridiron football biography}}
{{High-use}}
{{Tracks Wikidata|P18|cat=No local image but image on Wikidata}}
{{Lua|Module:Infobox3cols|Module:InfoboxImage|Module:Check for unknown parameters|Module:String|Module:Footballer positions|Module:Check height}}
{{tl|Infobox football biography}} is intended to provide a quick overview of an [[association football]] (or [[Variants of association football|football variant]]) player's or manager's details to enable a reader to extract the most oft-needed information without trawling through the article proper.
{{Parameter names example
| name | image | upright | upright | alt | caption | full_name | birth_name | birth_date | birth_place | death_date | death_place | height | position | currentclub | clubnumber
| youthyears1 | youthclubs1 | youthyears2 | youthclubs2 | youthyears3 | youthclubs3 | youthyears4 | youthclubs4 | youthyears5 | youthclubs5 | youthyears6 | youthclubs6 | youthyears7 | youthclubs7 | youthyears8 | youthclubs8 | youthyears9 | youthclubs9 | youthyears10 | youthclubs10 | youthyears11 | youthclubs11 | youthyears12 | youthclubs12
| collegeyears1 | college1 | collegecaps1 | collegegoals1
| collegeyears2 | college2 | collegecaps2 | collegegoals2
| collegeyears3 | college3 | collegecaps3 | collegegoals3
| collegeyears4 | college4 | collegecaps4 | collegegoals4
| years1 | clubs1 | caps1 | goals1 | years2 | clubs2 | caps2 | goals2 | years3 | clubs3 | caps3 | goals3 | years4 | clubs4 | caps4 | goals4 | years5 | clubs5 | caps5 | goals5 | years6 | clubs6 | caps6 | goals6 | years7 | clubs7 | caps7 | goals7 | years8 | clubs8 | caps8 | goals8 | years9 | clubs9 | caps9 | goals9 | years10 | clubs10 | caps10 | goals10 | years11 | clubs11 | caps11 | goals11 | years12 | clubs12 | caps12 | goals12 | years13 | clubs13 | caps13 | goals13 | years14 | clubs14 | caps14 | goals14 | years15 | clubs15 | caps15 | goals15 | years16 | clubs16 | caps16 | goals16 | years17 | clubs17 | caps17 | goals17 | years18 | clubs18 | caps18 | goals18 | years19 | clubs19 | caps19 | goals19 | years20 | clubs20 | caps20 | goals20 | years21 | clubs21 | caps21 | goals21 | years22 | clubs22 | caps22 | goals22 | years23 | clubs23 | caps23 | goals23 | years24 | clubs24 | caps24 | goals24 | years25 | clubs25 | caps25 | goals25 | years26 | clubs26 | caps26 | goals26 | years27 | clubs27 | caps27 | goals27 | years28 | clubs28 | caps28 | goals28 | years29 | clubs29 | caps29 | goals29 | years30 | clubs30 | caps30 | goals30 | years31 | clubs31 | caps31 | goals31 | years32 | clubs32 | caps32 | goals32 | years33 | clubs33 | caps33 | goals33 | years34 | clubs34 | caps34 | goals34 | years35 | clubs35 | caps35 | goals35 | years36 | clubs36 | caps36 | goals36 | years37 | clubs37 | caps37 | goals37 | years38 | clubs38 | caps38 | goals38 | years39 | clubs39 | caps39 | goals39 | years40 | clubs40 | caps40 | goals40 | years41 | clubs41 | caps41 | goals41 | years42 | clubs42 | caps42 | goals42 | years43 | clubs43 | caps43 | goals43 | years44 | clubs44 | caps44 | goals44 | years45 | clubs45 | caps45 | goals45 | years46 | clubs46 | caps46 | goals46 | years47 | clubs47 | caps47 | goals47 | years48 | clubs48 | caps48 | goals48 | years49 | clubs49 | caps49 | goals49 | years50 | clubs50 | caps50 | goals50 | years51 | clubs51 | caps51 | goals51 | years52 | clubs52 | caps52 | goals52
| totalcaps | totalgoals
| nationalyears1 | nationalteam1 | nationalcaps1 | nationalgoals1 | nationalyears2 | nationalteam2 | nationalcaps2 | nationalgoals2 | nationalyears3 | nationalteam3 | nationalcaps3 | nationalgoals3 | nationalyears4 | nationalteam4 | nationalcaps4 | nationalgoals4 | nationalyears5 | nationalteam5 | nationalcaps5 | nationalgoals5 | nationalyears6 | nationalteam6 | nationalcaps6 | nationalgoals6 | nationalyears7 | nationalteam7 | nationalcaps7 | nationalgoals7 | nationalyears8 | nationalteam8 | nationalcaps8 | nationalgoals8 | nationalyears9 | nationalteam9 | nationalcaps9 | nationalgoals9 | nationalyears10 | nationalteam10 | nationalcaps10 | nationalgoals10
| manageryears1 | managerclubs1 | manageryears2 | managerclubs2 | manageryears3 | managerclubs3 | manageryears4 | managerclubs4 | manageryears5 | managerclubs5 | manageryears6 | managerclubs6 | manageryears7 | managerclubs7 | manageryears8 | managerclubs8 | manageryears9 | managerclubs9 | manageryears10 | managerclubs10 | manageryears11 | managerclubs11 | manageryears12 | managerclubs12 | manageryears13 | managerclubs13 | manageryears14 | managerclubs14 | manageryears15 | managerclubs15 | manageryears16 | managerclubs16 | manageryears17 | managerclubs17 | manageryears18 | managerclubs18 | manageryears19 | managerclubs19 | manageryears20 | managerclubs20 | manageryears21 | managerclubs21 | manageryears22 | managerclubs22 | manageryears23 | managerclubs23 | manageryears24 | managerclubs24 | manageryears25 | managerclubs25 | manageryears26 | managerclubs26 | manageryears27 | managerclubs27 | manageryears28 | managerclubs28 | manageryears29 | managerclubs29 | manageryears30 | managerclubs30 | manageryears31 | managerclubs31 | manageryears32 | managerclubs32 | manageryears33 | managerclubs33 | manageryears34 | managerclubs34 | manageryears35 | managerclubs35 | manageryears36 | managerclubs36 | manageryears37 | managerclubs37 | manageryears38 | managerclubs38 | manageryears39 | managerclubs39 | manageryears40 | managerclubs40 | manageryears41 | managerclubs41 | manageryears42 | managerclubs42 | manageryears43 | managerclubs43 | manageryears44 | managerclubs44 | manageryears45 | managerclubs45 | manageryears46 | managerclubs46 | manageryears47 | managerclubs47 | manageryears48 | managerclubs48 | manageryears49 | managerclubs49 | manageryears50 | managerclubs50 | manageryears51 | managerclubs51 | manageryears52 | managerclubs52 | manageryears53 | managerclubs53 | manageryears54 | managerclubs54 | manageryears55 | managerclubs55 | manageryears56 | managerclubs56 | manageryears57 | managerclubs57 | manageryears58 | managerclubs58 | manageryears59 | managerclubs59 | manageryears60 | managerclubs60 | manageryears60 | managerclubs60 | manageryears61 | managerclubs61 | manageryears62 | managerclubs62 | manageryears63 | managerclubs63 | manageryears64 | managerclubs64 | manageryears65 | managerclubs65 | manageryears66 | managerclubs66 | manageryears67 | managerclubs67 | manageryears68 | managerclubs68 | manageryears69 | managerclubs69 | manageryears70 | managerclubs70 | manageryears71 | managerclubs71 | manageryears72 | managerclubs72 | manageryears73 | managerclubs73 | manageryears74 | managerclubs74 | manageryears75 | managerclubs75 | manageryears76 | managerclubs76 | manageryears77 | managerclubs77 | manageryears78 | managerclubs78 | manageryears79 | managerclubs79 | manageryears80 | managerclubs80
| medaltemplates | medaltemplates-expand
| module | club-update | nationalteam-update
}}
== Usage ==
Note: all the field names ending in '''1''' should be repeated for each team, e.g. '''youthyears1''' and '''youthclubs1''' should be followed by '''youthyears2''' and '''youthclubs2''' and so on, as needed.
===Current players===
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
|embed =
|name =
|image =
|upright =
|alt =
|caption =
|full_name =
|birth_date =
|birth_place =
|height =
|position =
|currentclub =
|clubnumber =
|youthyears1 =
|youthclubs1 =
|collegeyears1 =
|college1 =
|collegecaps1 =
|collegegoals1 =
|years1 =
|clubs1 =
|caps1 =
|goals1 =
|nationalyears1 =
|nationalteam1 =
|nationalcaps1 =
|nationalgoals1 =
|medaltemplates =
|club-update =
|nationalteam-update =
}}
</syntaxhighlight>
===Former players===
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
|embed =
|name =
|image =
|upright =
|alt =
|caption =
|full_name =
|birth_date =
|birth_place =
|death_date =
|death_place =
|height =
|position =
|youthyears1 =
|youthclubs1 =
|collegeyears1 =
|college1 =
|collegecaps1 =
|collegegoals1 =
|years1 =
|clubs1 =
|caps1 =
|goals1 =
|totalcaps =
|totalgoals =
|nationalyears1 =
|nationalteam1 =
|nationalcaps1 =
|nationalgoals1 =
|medaltemplates =
}}
</syntaxhighlight>
===Managers who were players===
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
|embed =
|name =
|image =
|upright =
|alt =
|caption =
|full_name =
|birth_date =
|birth_place =
|death_date =
|death_place =
|height =
|position =
|currentclub =
|youthyears1 =
|youthclubs1 =
|collegeyears1 =
|college1 =
|collegecaps1 =
|collegegoals1 =
|years1 =
|clubs1 =
|caps1 =
|goals1 =
|totalcaps =
|totalgoals =
|nationalyears1 =
|nationalteam1 =
|nationalcaps1 =
|nationalgoals1 =
|medaltemplates =
|manageryears1 =
|managerclubs1 =
}}
</syntaxhighlight>
===Managers who were not players===
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
|embed =
|name =
|image =
|upright =
|caption =
|full_name =
|birth_date =
|birth_place =
|death_date =
|death_place =
|currentclub =
|manageryears1 =
|managerclubs1 =
}}
</syntaxhighlight>
=== Full blank template ===
{{Hidden begin |showhide=left |title=Blank template with all parameters |bodystyle=font-size:105%;}}
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
| embed =
| embed-header =
| header-color =
| name =
| image =
| upright =
| alt =
| caption =
| full_name =
| birth_name =
| birth_date =
| birth_place =
| death_date =
| death_place =
| height =
| position =
| currentclub =
| clubnumber =
| youthyears1 =
| youthclubs1 =
| youthyears2 =
| youthclubs2 =
| youthyears3 =
| youthclubs3 =
| youthyears4 =
| youthclubs4 =
| youthyears5 =
| youthclubs5 =
| youthyears6 =
| youthclubs6 =
| youthyears7 =
| youthclubs7 =
| youthyears8 =
| youthclubs8 =
| youthyears9 =
| youthclubs9 =
| youthyears10 =
| youthclubs10 =
| youthyears11 =
| youthclubs11 =
| youthyears12 =
| youthclubs12 =
| collegeyears1 =
| college1 =
| collegecaps1 =
| collegegoals1 =
| collegeyears2 =
| college2 =
| collegecaps2 =
| collegegoals2 =
| collegeyears3 =
| college3 =
| collegecaps3 =
| collegegoals3 =
| collegeyears4 =
| college4 =
| collegecaps4 =
| collegegoals4 =
| years1 =
| clubs1 =
| caps1 =
| goals1 =
| years2 =
| clubs2 =
| caps2 =
| goals2 =
| years3 =
| clubs3 =
| caps3 =
| goals3 =
| years4 =
| clubs4 =
| caps4 =
| goals4 =
| years5 =
| clubs5 =
| caps5 =
| goals5 =
| years6 =
| clubs6 =
| caps6 =
| goals6 =
| years7 =
| clubs7 =
| caps7 =
| goals7 =
| years8 =
| clubs8 =
| caps8 =
| goals8 =
| years9 =
| clubs9 =
| caps9 =
| goals9 =
| years10 =
| clubs10 =
| caps10 =
| goals10 =
| years11 =
| clubs11 =
| caps11 =
| goals11 =
| years12 =
| clubs12 =
| caps12 =
| goals12 =
| years13 =
| clubs13 =
| caps13 =
| goals13 =
| years14 =
| clubs14 =
| caps14 =
| goals14 =
| years15 =
| clubs15 =
| caps15 =
| goals15 =
| years16 =
| clubs16 =
| caps16 =
| goals16 =
| years17 =
| clubs17 =
| caps17 =
| goals17 =
| years18 =
| clubs18 =
| caps18 =
| goals18 =
| years19 =
| clubs19 =
| caps19 =
| goals19 =
| years20 =
| clubs20 =
| caps20 =
| goals20 =
| years21 =
| clubs21 =
| caps21 =
| goals21 =
| years22 =
| clubs22 =
| caps22 =
| goals22 =
| years23 =
| clubs23 =
| caps23 =
| goals23 =
| years24 =
| clubs24 =
| caps24 =
| goals24 =
| years25 =
| clubs25 =
| caps25 =
| goals25 =
| years26 =
| clubs26 =
| caps26 =
| goals26 =
| years27 =
| clubs27 =
| caps27 =
| goals27 =
| years28 =
| clubs28 =
| caps28 =
| goals28 =
| years29 =
| clubs29 =
| caps29 =
| goals29 =
| years30 =
| clubs30 =
| caps30 =
| goals30 =
| years31 =
| clubs31 =
| caps31 =
| goals31 =
| years32 =
| clubs32 =
| caps32 =
| goals32 =
| years33 =
| clubs33 =
| caps33 =
| goals33 =
| years34 =
| clubs34 =
| caps34 =
| goals34 =
| years35 =
| clubs35 =
| caps35 =
| goals35 =
| years36 =
| clubs36 =
| caps36 =
| goals36 =
| years37 =
| clubs37 =
| caps37 =
| goals37 =
| years38 =
| clubs38 =
| caps38 =
| goals38 =
| years39 =
| clubs39 =
| caps39 =
| goals39 =
| years40 =
| clubs40 =
| caps40 =
| goals40 =
| years41 =
| clubs41 =
| caps41 =
| goals41 =
| years42 =
| clubs42 =
| caps42 =
| goals42 =
| years43 =
| clubs43 =
| caps43 =
| goals43 =
| years44 =
| clubs44 =
| caps44 =
| goals44 =
| years45 =
| clubs45 =
| caps45 =
| goals45 =
| years46 =
| clubs46 =
| caps46 =
| goals46 =
| years47 =
| clubs47 =
| caps47 =
| goals47 =
| years48 =
| clubs48 =
| caps48 =
| goals48 =
| years49 =
| clubs49 =
| caps49 =
| goals49 =
| years50 =
| clubs50 =
| caps50 =
| goals50 =
| years51 =
| clubs51 =
| caps51 =
| goals51 =
| years52 =
| clubs52 =
| caps52 =
| goals52 =
| totalcaps =
| totalgoals =
| nationalyears1 =
| nationalteam1 =
| nationalcaps1 =
| nationalgoals1 =
| nationalyears2 =
| nationalteam2 =
| nationalcaps2 =
| nationalgoals2 =
| nationalyears3 =
| nationalteam3 =
| nationalcaps3 =
| nationalgoals3 =
| nationalyears4 =
| nationalteam4 =
| nationalcaps4 =
| nationalgoals4 =
| nationalyears5 =
| nationalteam5 =
| nationalcaps5 =
| nationalgoals5 =
| nationalyears6 =
| nationalteam6 =
| nationalcaps6 =
| nationalgoals6 =
| nationalyears7 =
| nationalteam7 =
| nationalcaps7 =
| nationalgoals7 =
| nationalyears8 =
| nationalteam8 =
| nationalcaps8 =
| nationalgoals8 =
| nationalyears9 =
| nationalteam9 =
| nationalcaps9 =
| nationalgoals9 =
| nationalyears10 =
| nationalteam10 =
| nationalcaps10 =
| nationalgoals10 =
| manageryears1 =
| managerclubs1 =
| manageryears2 =
| managerclubs2 =
| manageryears3 =
| managerclubs3 =
| manageryears4 =
| managerclubs4 =
| manageryears5 =
| managerclubs5 =
| manageryears6 =
| managerclubs6 =
| manageryears7 =
| managerclubs7 =
| manageryears8 =
| managerclubs8 =
| manageryears9 =
| managerclubs9 =
| manageryears10 =
| managerclubs10 =
| manageryears11 =
| managerclubs11 =
| manageryears12 =
| managerclubs12 =
| manageryears13 =
| managerclubs13 =
| manageryears14 =
| managerclubs14 =
| manageryears15 =
| managerclubs15 =
| manageryears16 =
| managerclubs16 =
| manageryears17 =
| managerclubs17 =
| manageryears18 =
| managerclubs18 =
| manageryears19 =
| managerclubs19 =
| manageryears20 =
| managerclubs20 =
| manageryears21 =
| managerclubs21 =
| manageryears22 =
| managerclubs22 =
| manageryears23 =
| managerclubs23 =
| manageryears24 =
| managerclubs24 =
| manageryears25 =
| managerclubs25 =
| manageryears26 =
| managerclubs26 =
| manageryears27 =
| managerclubs27 =
| manageryears28 =
| managerclubs28 =
| manageryears29 =
| managerclubs29 =
| manageryears30 =
| managerclubs30 =
| manageryears31 =
| managerclubs31 =
| manageryears32 =
| managerclubs32 =
| manageryears33 =
| managerclubs33 =
| manageryears34 =
| managerclubs34 =
| manageryears35 =
| managerclubs35 =
| manageryears36 =
| managerclubs36 =
| manageryears37 =
| managerclubs37 =
| manageryears38 =
| managerclubs38 =
| manageryears39 =
| managerclubs39 =
| manageryears40 =
| managerclubs40 =
| manageryears41 =
| managerclubs41 =
| manageryears42 =
| managerclubs42 =
| manageryears43 =
| managerclubs43 =
| manageryears44 =
| managerclubs44 =
| manageryears45 =
| managerclubs45 =
| manageryears46 =
| managerclubs46 =
| manageryears47 =
| managerclubs47 =
| manageryears48 =
| managerclubs48 =
| manageryears49 =
| managerclubs49 =
| manageryears50 =
| managerclubs50 =
| manageryears51 =
| managerclubs51 =
| manageryears52 =
| managerclubs52 =
| manageryears53 =
| managerclubs53 =
| manageryears54 =
| managerclubs54 =
| manageryears55 =
| managerclubs55 =
| manageryears56 =
| managerclubs56 =
| manageryears57 =
| managerclubs57 =
| manageryears58 =
| managerclubs58 =
| manageryears59 =
| managerclubs59 =
| manageryears60 =
| managerclubs60 =
| manageryears60 =
| managerclubs60 =
| manageryears61 =
| managerclubs61 =
| manageryears62 =
| managerclubs62 =
| manageryears63 =
| managerclubs63 =
| manageryears64 =
| managerclubs64 =
| manageryears65 =
| managerclubs65 =
| manageryears66 =
| managerclubs66 =
| manageryears67 =
| managerclubs67 =
| manageryears68 =
| managerclubs68 =
| manageryears69 =
| managerclubs69 =
| manageryears70 =
| managerclubs70 =
| manageryears71 =
| managerclubs71 =
| manageryears72 =
| managerclubs72 =
| manageryears73 =
| managerclubs73 =
| manageryears74 =
| managerclubs74 =
| manageryears75 =
| managerclubs75 =
| manageryears76 =
| managerclubs76 =
| manageryears77 =
| managerclubs77 =
| manageryears78 =
| managerclubs78 =
| manageryears79 =
| managerclubs79 =
| manageryears80 =
| managerclubs80 =
| medaltemplates =
| medaltemplates-expand =
| module =
| club-update =
| nationalteam-update =
}}
</syntaxhighlight>
{{Hidden end}}
{{Clear}}
== Parameters ==
All parameters are optional.
;{{{embed}}}: Enables the template to be embedded into another template, such as {{tl|Infobox person}}. See [[#Use as a child template|explanation below]].
;{{{embed-header}}}: Allows for a custom heading to the infobox instead of "Association football career" when embedded into another template.
;{{{header-color}}}: Allows a custom [[web color]] to be set for the template's section headings and a divider when embedded into another template.
;{{{name}}}: The commonly used name of the player. If this is omitted, it will be inferred from the title of the article.
;{{{full_name}}}: The player's complete name. Long names will wrap automatically to the width of the infobox, so there's no need to include explicit linebreaks. Alias: '''fullname'''
;{{{image}}}: A picture of the player, ideally on the pitch in the strip of their most recent team (or the team the player is most well known for, in the case of retirees). Images should be given in the format {{mono|<nowiki>Example.jpg</nowiki>}}, rather than {{mono|<nowiki>[[File:Example.jpg]]</nowiki>}}.
;{{{upright}}}: Scales the image thumbnail from its default size by the given factor. Values less than 1 scale the image down (0.9 = 90%) and values greater than 1 scale the image up (1.15 = 115%). The use of {{{image_size}}} has been deprecated and should be avoided per [[WP:IMGSIZE]].
;{{{alt}}}: [[WP:ALT|Alternative text]] for the image.
;{{{caption}}}: A caption for the image.
;{{{birth_name}}}: If different from name and full_name.
;{{{birth_date}}}: The player's date of birth. A template ({{Tl|Birth date and age}} for living people; {{tl|Birth year}} or {{Tl|Birth date}} for all others) should be used to add the date, but be sure to use the appropriate parameters to present the date in the same format as used in the text. The date should not be wikilinked.
;{{{birth_place}}}: The location of the player's birth.
;{{{death_date}}}: The player's date of death. The template {{Tl|Death date and age}} should be used to add the date, but be sure to use the appropriate parameters to present the date in the same format as used in the text. The date should not be wikilinked.
;{{{death_place}}}: The location of the player's death.
;{{{height}}}: The player's height in the units most common within the country in which they play, using the format "X m", "X cm", or "X ft Y in". When given in this format, the height will be [[Template:Infobox person/height/doc|automatically converted]]. Note that fractions of an inch can also be added, e.g. "5 ft 8+1/2 in" will output "5 ft {{fraction|8|1|2}} in (1.74 m)".
;{{{position}}}: The player's '''most common''' position or positions. If a player is known for playing in multiple roles then explain the point more fully within the article.
;{{{currentclub}}}: The club for which the player currently plays, or is employed by. If the player now works in a non-playing role at the club, add this after the club in brackets. For retired players and free agents not currently employed by any club or federation, leave blank.
;{{{clubnumber}}}: The shirt number of the player at their current club.
;{{{youthyears1}}}, {{{youthyears2}}}... {{{youthyears12}}}: A list of years that the player has been at each club as a youth, one per attribute, earliest to latest.
;{{{youthclubs1}}}, {{{youthclubs2}}}... {{{youthclubs12}}}: A list of clubs that the player was a member of as a youth, one per attribute, earliest to latest.
;{{{collegeyears1}}}... {{{collegeyears4}}}: A list of years that the player has been at each college team, one per attribute, earliest to latest.
;{{{college1}}}... {{{college4}}}: A list of college teams that the player was a member of, one per attribute, earliest to latest.
;{{{collegecaps1}}}... {{{collegecaps4}}}: A list of appearances that the player has been awarded in '''all competitive matches''' for each college team, one per attribute, earliest to latest.
;{{{collegegoals1}}}... {{{collegegoals4}}}: A list of goals that the player has been awarded in '''all competitive matches''' for each college team, one per attribute, earliest to latest.
;{{{years1}}}, {{{years2}}}... {{{years52}}}: A list of years that the player has been contracted at each club, one per attribute, earliest to latest.
;{{{clubs1}}}, {{{clubs2}}}... {{{clubs52}}}: A list of clubs that the player has been contracted at, one per attribute, earliest to latest.
;{{{caps1}}}, {{{caps2}}}... {{{caps52}}}: A list of appearances that the player has been awarded in '''league competition''' only for each club (note: Playoff matches are '''not''' counted as league matches by most statistical sources (e.g. [http://www.soccerbase.com Soccerbase] and the Sky Sports (Rothmans) Football Yearbook), so they should not be included in this infobox), one per attribute, earliest to latest.
;{{{goals1}}}, {{{goals2}}}... {{{goals52}}}: A list of goals that the player has been awarded in '''league competition''' only for each club (note: Playoff matches are '''not''' counted as league matches by most statistical sources (e.g. [http://www.soccerbase.com Soccerbase] and the Sky Sports (Rothmans) Football Yearbook), so they should not be included in this infobox), one per attribute, earliest to latest.
;{{{totalcaps}}}: The total number of appearances the player has been awarded in '''league competition''' for all clubs.
;{{{totalgoals}}}: The total number of goals the player has scored in '''league competition''' for all clubs.
;{{{nationalyears1}}}, {{{nationalyears2}}}... {{{nationalyears10}}}: A list of years that the player has played for each national team, one per attribute, youngest to oldest level (e.g. U17, U21, Olympic team, B team, senior team).
;{{{nationalteam1}}}, {{{nationalteam2}}}... {{{nationalteam10}}}: A list of international teams that the player has played for, including non-senior teams such as U21, one per attribute, youngest to oldest level (e.g. U17, U21, Olympic team, B team, senior team).
;{{{nationalcaps1}}}, {{{nationalcaps2}}}... {{{nationalcaps10}}}: A list of appearances that the player has been awarded in '''all competitions and friendlies''' for each national team, one per attribute, youngest to oldest level (e.g. U17, U21, Olympic team, B team, senior team).
;{{{nationalgoals1}}}, {{{nationalgoals2}}}... {{{nationalgoals10}}}: A list of goals that the player has been awarded in '''all competitions and friendlies''' for each national team, one per attribute, youngest to oldest level (e.g. U17, U21, Olympic team, B team, senior team).
;{{{manageryears1}}}, {{{manageryears2}}}... {{{manageryears80}}}: A list of years that the person has served within the capacity of manager at each team, one per attribute, earliest to latest.
;{{{managerclubs1}}}, {{{managerclubs2}}}... {{{managerclubs80}}}: A list of clubs that the person has served within the capacity of team manager. Please '''do not''' list positions other than team manager (such as assistant or coach positions, or director of football roles where this role is not considered managerial) unless that position is a significant part of the person's career; this will apply primarily to those with significant or perhaps primary experience in management. Clubs listed can be both local and national and should be restricted to those ordinarily considered notable in themselves.
;{{{medaltemplates}}}: Medals earned in international competition can be added here using the templates {{tl|Medal}}.
;{{{medaltemplates-expand}}}: Expands the medals section to be displayed by default instead of being collapsed.
;{{{club-update}}}: A timestamp at which the player's infobox club statistics are unambiguously correct. The bare date of the last match played should not be used because this is not unambiguous. Dates should use the same format as the rest of the article; use five tildes (<nowiki>~~~~~</nowiki>) to generate the current date/time in dmy format, or {{subst|mdytime}} for mdy format. The parameter is not needed if the player has retired. Alias: '''pcupdate'''
;{{{nationalteam-update}}}: A timestamp at which the player's infobox national team statistics are unambiguously correct. The bare date of the last match played should not be used because this is not unambiguous. Dates should use the same format as the rest of the article; use five tildes (<nowiki>~~~~~</nowiki>) to generate the current date/time in dmy format, or {{subst|mdytime}} for mdy format. The parameter is not needed if the player has retired. Alias: '''ntupdate'''
;{{{module}}}: Enables another template to be embedded into this template, such as {{tl|Infobox military person}}. See [[#Embedding other templates|explanation below]].
=== Use as a child template ===
The '''embed''' parameter is used when embedding this infobox into another.
{{Infobox person module documentation|Infobox football biography|parameter=embed}}
=== Embedding other templates ===
The '''module''' parameter is used for embedding other templates into this infobox (see [[Wikipedia:Infobox modules]] and [[:Category:Biographical templates usable as a module]]).
<syntaxhighlight lang="wikitext" style="overflow: auto;">
{{Infobox football biography
| name =
| <!-- etc. -->
| module =
{{Infobox ABC
| embed = yes <!-- or child=yes / subbox=yes-->
| <!-- etc. -->
}}
}}
</syntaxhighlight>
== Examples ==
=== Independent ===
{{Infobox football biography
|name = Tim Template
|image = Nizar-Khalfan.jpg
|alt = Photo of a player in blue football kit, hair braided.
|caption = Tim Template with the Template Rangers
|full_name = Tim Tenerife Template
|birth_date = {{birth date and age|1975|1|1|df=y}}
|birth_place = Template City, Templatia
|height = 1.75 m
|position = [[Forward (association football)|Striker]]
|currentclub = Template City F.C.
|clubnumber = 9
|youthyears1 = 1985–1987
|youthclubs1 = Template Juniors
|youthyears2 = 1987–1992
|youthclubs2 = Template Youth
|collegeyears1 = 1983–1985
|college1 = Template College
|collegecaps1 = 2
|collegegoals1 = 1
|years1 = 1992–1999
|clubs1 = Template United F.C.
|caps1 = 75
|goals1 = 26
|years2 = 1999–2002
|clubs2 = Template Rangers
|caps2 = 32
|goals2 = 11
|years3 = 2001
|clubs3 = → Example F.C. (loan)
|caps3 = 15
|goals3 = 7
|years4 = 2002–
|clubs4 = Template City F.C.
|caps4 = 113
|goals4 = 46
|nationalyears1 = 1991
|nationalteam1 = Examplia U16
|nationalcaps1 = 1
|nationalgoals1 = 0
|nationalyears2 = 1996–1998
|nationalteam2 = Templatia U21
|nationalcaps2 = 8
|nationalgoals2 = 2
|nationalyears3 = 1999–
|nationalteam3 = Templatia
|nationalcaps3 = 46
|nationalgoals3 = 13
|medaltemplates =
{{Medal|Country|Brazil}}
{{Medal|Competition|FIFA Template Cup}}
{{medal|Winner|2013 FIFA Template Cup|}}
{{medal|3rd|2001 FIFA Template Cup|}}
{{Medal|Competition|[[Football at the Summer Olympics|Summer Olympics]]}}
{{medal|Gold|[[2016 Summer Olympics|2016 Rio de Janeiro]]|[[Football at the 2016 Summer Olympics – Men's tournament|Team]]}}
|club-update = 14:56, 6 October 2014 (UTC)
|nationalteam-update = 14:56, 6 October 2014 (UTC)
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox football biography
|name = Tim Template
|image = Nizar-Khalfan.jpg
|alt = Photo of a player in blue football kit, hair braided.
|caption = Tim Template with the Template Rangers
|full_name = Tim Tenerife Template
|birth_date = {{birth date and age|1975|1|1|df=y}}
|birth_place = Template City, Templatia
|height = 1.75 m
|position = [[Forward (association football)|Striker]]
|currentclub = Template City F.C.
|clubnumber = 9
|youthyears1 = 1985–1987
|youthclubs1 = Template Juniors
|youthyears2 = 1987–1992
|youthclubs2 = Template Youth
|collegeyears1 = 1983–1985
|college1 = Template College
|collegecaps1 = 2
|collegegoals1 = 1
|years1 = 1992–1999
|clubs1 = Template United F.C.
|caps1 = 75
|goals1 = 26
|years2 = 1999–2002
|clubs2 = Template Rangers
|caps2 = 32
|goals2 = 11
|years3 = 2001
|clubs3 = → Example F.C. (loan)
|caps3 = 15
|goals3 = 7
|years4 = 2002–
|clubs4 = Template City F.C.
|caps4 = 113
|goals4 = 46
|nationalyears1 = 1991
|nationalteam1 = Examplia U16
|nationalcaps1 = 1
|nationalgoals1 = 0
|nationalyears2 = 1996–1998
|nationalteam2 = Templatia U21
|nationalcaps2 = 8
|nationalgoals2 = 2
|nationalyears3 = 1999–
|nationalteam3 = Templatia
|nationalcaps3 = 46
|nationalgoals3 = 13
|medaltemplates =
{{Medal|Country|Brazil}}
{{Medal|Competition|FIFA Template Cup}}
{{medal|Winner|2013 FIFA Template Cup|}}
{{medal|3rd|2001 FIFA Template Cup|}}
{{Medal|Competition|[[Football at the Summer Olympics|Summer Olympics]]}}
{{medal|Gold|[[2016 Summer Olympics|2016 Rio de Janeiro]]|[[Football at the 2016 Summer Olympics – Men's tournament|Team]]}}
|club-update = ~~~~~
|nationalteam-update = ~~~~~
}}
</syntaxhighlight> {{clear}}
=== Embedded in a different infobox (embed parameter) ===
{{Infobox person
|name = Tim Template
|image = Nizar-Khalfan.jpg
|alt = Photo of a player in blue football kit, hair braided.
|caption = Tim Template with the Template Rangers
|birth_name = Tim Tenerife Template
|birth_date = {{birth date and age|1975|1|1|df=y}}
|birth_place = Template City, Templatia
|height = 1.75 m
|module =
{{Infobox football biography
|embed = yes
|position = [[Forward (association football)|Striker]]
|currentclub = Template City F.C.
|clubnumber = 9
|youthyears1 = 1985–1987
|youthclubs1 = Template Juniors
|youthyears2 = 1987–1992
|youthclubs2 = Template Youth
|collegeyears1 = 1983-1985
|college1 = Template College
|collegecaps1 = 2
|collegegoals1 = 1
|years1 = 1992–1999
|clubs1 = Template United F.C.
|caps1 = 75
|goals1 = 26
|years2 = 1999–2002
|clubs2 = Template Rangers
|caps2 = 32
|goals2 = 11
|years3 = 2001
|clubs3 = → Example F.C. (loan)
|caps3 = 15
|goals3 = 7
|years4 = 2002–
|clubs4 = Template City F.C.
|caps4 = 113
|goals4 = 46
|nationalyears1 = 1991
|nationalteam1 = Examplia U16
|nationalcaps1 = 1
|nationalgoals1 = 0
|nationalyears2 = 1996–1998
|nationalteam2 = Templatia U21
|nationalcaps2 = 8
|nationalgoals2 = 2
|nationalyears3 = 1999–
|nationalteam3 = Templatia
|nationalcaps3 = 46
|nationalgoals3 = 13
|medaltemplates =
{{Medal|Country|Brazil}}
{{Medal|Competition|FIFA Template Cup}}
{{medal|Winner|2013 FIFA Template Cup|}}
{{medal|3rd|2001 FIFA Template Cup|}}
{{Medal|Competition|[[Football at the Summer Olympics|Summer Olympics]]}}
{{medal|Gold|[[2016 Summer Olympics|2016 Rio de Janeiro]]|[[Football at the 2016 Summer Olympics – Men's tournament|Team]]}}
|club-update = 14:56, 6 October 2014 (UTC)
|nationalteam-update = 14:56, 6 October 2014 (UTC)
}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox person
|name = Tim Template
|image = Nizar-Khalfan.jpg
|alt = Photo of a player in blue football kit, hair braided.
|caption = Tim Template with the Template Rangers
|birth_name = Tim Tenerife Template
|birth_date = {{birth date and age|1975|1|1|df=y}}
|birth_place = Template City, Templatia
|height = 1.75 m
|module =
{{Infobox football biography
|embed = yes
|position = [[Forward (association football)|Striker]]
|currentclub = Template City F.C.
|clubnumber = 9
|youthyears1 = 1985–1987
|youthclubs1 = Template Juniors
|youthyears2 = 1987–1992
|youthclubs2 = Template Youth
|years1 = 1992–1999
|clubs1 = Template United F.C.
|caps1 = 75
|goals1 = 26
|years2 = 1999–2002
|clubs2 = Template Rangers
|caps2 = 32
|goals2 = 11
|years3 = 2001
|clubs3 = → Example F.C. (loan)
|caps3 = 15
|goals3 = 7
|years4 = 2002–
|clubs4 = Template City F.C.
|caps4 = 113
|goals4 = 46
|nationalyears1 = 1991
|nationalteam1 = Examplia U16
|nationalcaps1 = 1
|nationalgoals1 = 0
|nationalyears2 = 1996–1998
|nationalteam2 = Templatia U21
|nationalcaps2 = 8
|nationalgoals2 = 2
|nationalyears3 = 1999–
|nationalteam3 = Templatia
|nationalcaps3 = 46
|nationalgoals3 = 13
|medaltemplates =
{{Medal|Country|{{fb|BRA}}}}
{{Medal|Competition|FIFA Template Cup}}
{{medal|Winner|2013 FIFA Template Cup|}}
{{medal|3rd|2001 FIFA Template Cup|}}
{{Medal|Competition|[[Football at the Summer Olympics|Summer Olympics]]}}
{{medal|Gold|[[2016 Summer Olympics|2016 Rio de Janeiro]]|[[Football at the 2016 Summer Olympics – Men's tournament|Team]]}}
|club-update = ~~~~~
|nationalteam-update = ~~~~~
}}
}}
</syntaxhighlight> {{clear}}
{{Infobox rugby biography
| name = Alev Kelter
| birth_name = Leyla Alev Kelter
| birth_date = {{Birth-date and age|March 21, 1991}}
| birth_place = [[Tampa, Florida]], U.S.
| height = 5 ft 6 in
| ru_position = Centre
| repyears1 = 2016–present
| repteam1 = [[United States women's national rugby union team|United States]]
| repcaps1 = 9
| reppoints1 = 32
| ru_sevensnationalyears1 = 2014
| ru_sevensnationalteam1 = [[United States women's national rugby sevens team|United States]]
| ru_sevensnationalcomp1 = -
| module =
{{Infobox football biography | embed = yes
| position = [[Midfielder]]
| collegeyears1 = 2009–2013
| college1 = [[Wisconsin Badgers women's soccer|Wisconsin Badgers]]
| nationalyears1 = 2009
| nationalteam1 = [[United States women's national under-20 soccer team|United States U20]]
}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox rugby biography
| name = Alev Kelter
| birth_name = Leyla Alev Kelter
| birth_date = {{Birth-date and age|March 21, 1991}}
| birth_place = [[Tampa, Florida]], U.S.
| height = 5 ft 6 in
| ru_position = Centre
| repyears1 = 2016–present
| repteam1 = [[United States women's national rugby union team|United States]]
| repcaps1 = 9
| reppoints1 = 32
| ru_sevensnationalyears1 = 2014
| ru_sevensnationalteam1 = [[United States women's national rugby sevens team|United States]]
| ru_sevensnationalcomp1 = -
| module =
{{Infobox football biography | embed = yes
| position = [[Midfielder]]
| collegeyears1 = 2009–2013
| college1 = [[Wisconsin Badgers women's soccer|Wisconsin Badgers]]
| nationalyears1 = 2009
| nationalteam1 = [[United States women's national under-20 soccer team|United States U20]]
}}
}}
</syntaxhighlight> {{clear}}
=== Embedding other infoboxes (module parameter) ===
{{Infobox football biography
| name = Alev Kelter
| birth_name = Leyla Alev Kelter
| birth_date = {{Birth-date and age|March 21, 1991}}
| birth_place = [[Tampa, Florida]], U.S.
| height = 5 ft 6 in
| position = [[Midfielder]]
| collegeyears1 = 2009–2013
| college1 = [[Wisconsin Badgers women's soccer|Wisconsin Badgers]]
| nationalyears1 = 2009
| nationalteam1 = [[United States women's national under-20 soccer team|United States U20]]
| module =
{{Infobox rugby biography | embed = yes
| ru_position = Centre
| repyears1 = 2016–present
| repteam1 = [[United States women's national rugby union team|United States]]
| repcaps1 = 9
| reppoints1 = 32
| ru_sevensnationalyears1 = 2014
| ru_sevensnationalteam1 = [[United States women's national rugby sevens team|United States]]
| ru_sevensnationalcomp1 = -
}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox football biography
| name = Alev Kelter
| birth_name = Leyla Alev Kelter
| birth_date = {{Birth-date and age|March 21, 1991}}
| birth_place = [[Tampa, Florida]], U.S.
| height = 5 ft 6 in
| position = [[Midfielder]]
| collegeyears1 = 2009–2013
| college1 = [[Wisconsin Badgers women's soccer|Wisconsin Badgers]]
| nationalyears1 = 2009
| nationalteam1 = [[United States women's national under-20 soccer team|United States U20]]
| module =
{{Infobox rugby biography | embed = yes
| ru_position = Centre
| repyears1 = 2016–present
| repteam1 = [[United States women's national rugby union team|United States]]
| repcaps1 = 9
| reppoints1 = 32
| ru_sevensnationalyears1 = 2014
| ru_sevensnationalteam1 = [[United States women's national rugby sevens team|United States]]
| ru_sevensnationalcomp1 = -
}}
}}
</syntaxhighlight> {{clear}}
== Style guide ==
Try to always consider that an infobox exists to support an article and provide a quick synopsis of important facts. This becomes vital when considering that the amount of space available within an infobox is significantly less than that available outside of it.
As per the [[Wikipedia:Manual of Style (links)|manual of style]] entry on linking, years and dates should not be linked as they do not provide much benefit to the user.
Do not add flag icons to the birth_place, death_place, club, national team or other fields. See: [[Wikipedia:Manual of Style (flags)]].
As per the [[Wikipedia:Manual of Style (dates and numbers)|manual of style]] the player's height should be in the units most common in the country in which they play. Units should be abbreviated in the infobox and spelt out in the article text. Measurements should be inputted into the {{para|height}} parameter using the format "X m", "X cm", or "X ft Y in". This will [[Template:Infobox person/height/doc|automatically convert]] units between formats and correctly handle the presentation of units in their short forms. Per [[Wikipedia talk:WikiProject Football/Archive 87#Height|consensus at WikiProject Football]], metric height will then be displayed in metres.
For example:
*{{para|height|1.78 m}} produces 1.78 m (5 ft 10 in)
*{{para|height|178 cm}} produces 1.78 m (5 ft 10 in)
*{{para|height|5 ft 8 in}} produces 5 ft 8 in (1.73 m)
*{{para|height|5 ft 8+1/2 in}} produces 5 ft {{fraction|8|1|2}} in (1.74 m)
Alternatively, the templates {{tl|convert}} and {{tl|height}} may be used for height conversion. This is particularly useful if the more accurate metric height is known but the output should be in feet and inches, or if a fraction is desired for the converted inches.
For example:
*If you have the height in metres, but want to display feet and inches first:
**<code><nowiki>{{convert|1.73|m|order=flip}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.73|m|order=flip}}}}
*If you have the height in metres, but want to display feet and inches first (with precision to the nearest half inch):
**<code><nowiki>{{convert|1.79|m|order=flip|frac=2}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.79|m|order=flip|frac=2}}}}
**<code><nowiki>{{convert|1.79|m|order=flip|round=0.5}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.79|m|order=flip|round=0.5}}}}
*If you have the height in feet and inches (with precision to the nearest half inch), but want to display metres first:
**<code><nowiki>{{convert|5|ft|8+1/2|in|2|order=flip}}</nowiki></code> produces {{#invoke:person height|main|{{convert|5|ft|8+1/2|in|2|order=flip}}}}
**<code><nowiki>{{convert|5|ft|8.5|in|2|order=flip}}</nowiki></code> produces {{#invoke:person height|main|{{convert|5|ft|8.5|in|2|order=flip}}}}
*If you have the height in metres, but want to display the converted feet and inches with precision to the nearest half inch:
**<code><nowiki>{{height|m=1.79}}</nowiki></code> produces {{#invoke:person height|main|{{height|m=1.79}}}}
**<code><nowiki>{{convert|1.79|m|frac=2}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.79|m|frac=2}}}}
**<code><nowiki>{{convert|1.79|m|round=0.5}}</nowiki></code> produces {{#invoke:person height|main|{{convert|1.79|m|round=0.5}}}}
== Microformats ==
{{UF-hcard-person}}
==TemplateData==
{{Collapse top|[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"description": "This infobox template provides a quick overview of an association football player's or manager's details to enable a reader to extract the most oft-needed information without trawling through the article proper.",
"params": {
"name": {
"type": "string",
"label": "Name",
"description": "The commonly used name of the player. If this is omitted, it will be inferred from the title of the article."
},
"image": {
"type": "wiki-file-name",
"label": "Picture",
"description": "A picture of the player, ideally on the pitch in the strip of their most recent team (or the team the player is most well-known for, in the case of retirees). Use the format Example.jpg, rather than [[File:Example.jpg]]."
},
"upright": {
"type": "number",
"label": "Picture size",
"description": "Scales the image thumbnail from its default size by the given factor. Values less than 1 scale the image down (0.9 = 90%) and values greater than 1 scale the image up (1.15 = 115%).",
"example": "0.8"
},
"alt": {
"type": "string",
"label": "Picture alt text",
"description": "Alt text for the picture."
},
"caption": {
"type": "string",
"label": "Picture caption",
"description": "A caption for the picture."
},
"full_name": {
"type": "string",
"label": "Full name",
"description": "The player's complete name.",
"aliases": [ "fullname" ]
},
"birth_date": {
"type": "number",
"label": "Birth date",
"description": "The player's date of birth. A template ({{Birth date}}, {{Birth date and age}}) should be used to add the date, but be sure to use the appropriate parameters to present the date in the same format as used in the text. The date should not be wikilinked."
},
"birth_place": {
"type": "string",
"label": "Birth place",
"description": "The location of the player's birth."
},
"death_date": {
"label": "Date of death",
"description": "Use exact date if known, but otherwise as close an approximation as possible. Example: April 27, 1992",
"type": "string",
"required": false
},
"death_place": {
"label": "Place of death",
"description": "Example: Washington, DC, USA",
"type": "string",
"required": false
},
"height": {
"type": "number",
"label": "Height",
"description": "The player's height in the units most common within the country in which they play. The {{height}} template should be used for automatic formatting. The infobox also supports automatic conversion if the height is specified as \"X m\", \"X cm\", or \"X ft Y in\"."
},
"position": {
"type": "string",
"label": "Position",
"description": "The player's most common position or positions. If a player is known for playing in multiple roles then explain the point more fully within the article."
},
"currentclub": {
"type": "string",
"label": "Current club",
"description": "The club for which the player currently plays, or is employed by. If the player now works in a non-playing role at the club, add this after the club in brackets. For retired players and free agents not currently employed by any club or federation, leave blank."
},
"clubnumber": {
"type": "number",
"label": "Number",
"description": "The shirt number of the player at their current club."
},
"youthyears1": {
"type": "number",
"label": "Youth club 1 years",
"description": "The years that the player was at their first youth club. Up to 8 clubs can be added using the parameter names \"youthyears2\", \"youthyears3\", etc."
},
"youthclubs1": {
"type": "string",
"label": "Youth club 1",
"description": "The first club that the player was a member of as a youth. Up to 8 clubs can be added using the parameter names \"youthclubs2\", \"youthclubs3\", etc."
},
"youthyears2": {
"type": "number",
"label": "Youth club 2 years",
"description": "The years that the player was at their second youth club."
},
"youthclubs2": {
"type": "string",
"label": "Youth club 2",
"description": "The second club that the player was a member of as a youth."
},
"youthyears3": {
"type": "number",
"label": "Youth club 3 years",
"description": "The years that the player was at their third youth club."
},
"youthclubs3": {
"type": "string",
"label": "Youth club 3",
"description": "The third club that the player was a member of as a youth."
},
"youthyears4": {
"type": "number",
"label": "Youth club 4 years",
"description": "The years that the player was at their fourth youth club."
},
"youthclubs4": {
"type": "string",
"label": "Youth club 4",
"description": "The fourth club that the player was a member of as a youth."
},
"youthyears5": {
"type": "number",
"label": "Youth club 5 years",
"description": "The years that the player was at their fifth youth club."
},
"youthclubs5": {
"type": "string",
"label": "Youth club 5",
"description": "The fifth club that the player was a member of as a youth."
},
"years1": {
"type": "number",
"label": "Club 1 years",
"description": "The years that the player was at their first club. Up to 39 years can be added using the parameter names \"years2\", \"years3\", etc."
},
"clubs1": {
"type": "string",
"label": "Club 1",
"description": "The first (senior) club that the player has been contracted at. Up to 39 clubs can be added using the parameter names \"clubs2\", \"clubs3\", etc."
},
"caps1": {
"type": "number",
"label": "Club 1 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the first club. Playoff matches should not be included. Up to 39 caps can be added using the parameter names \"caps2\", \"caps3\", etc."
},
"goals1": {
"type": "number",
"label": "Club 1 goals",
"description": "The number of goals that the player has been awarded in league competition for the first club. Playoff matches should not be included. Up to 39 can be added using the parameter names \"goals2\", \"goals3\", etc."
},
"years2": {
"type": "number",
"label": "Club 2 years",
"description": "The years that the player was at their second club."
},
"clubs2": {
"type": "string",
"label": "Club 2",
"description": "The second club that the player has been contracted at."
},
"caps2": {
"type": "number",
"label": "Club 2 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the second club."
},
"goals2": {
"type": "number",
"label": "Club 2 goals",
"description": "The number of goals that the player has been awarded in league competition for the second club."
},
"years3": {
"type": "number",
"label": "Club 3 years",
"description": "The years that the player was at their third club."
},
"clubs3": {
"type": "string",
"label": "Club 3",
"description": "The third club that the player has been contracted at."
},
"caps3": {
"type": "number",
"label": "Club 3 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the third club."
},
"goals3": {
"type": "number",
"label": "Club 3 goals",
"description": "The number of goals that the player has been awarded in league competition for the third club."
},
"years4": {
"type": "number",
"label": "Club 4 years",
"description": "The years that the player was at their fourth club."
},
"clubs4": {
"type": "string",
"label": "Club 4",
"description": "The fourth club that the player has been contracted at."
},
"caps4": {
"type": "number",
"label": "Club 4 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the fourth club."
},
"goals4": {
"type": "number",
"label": "Club 4 goals",
"description": "The number of goals that the player has been awarded in league competition for the fourth club."
},
"years5": {
"type": "number",
"label": "Club 5 years",
"description": "The years that the player was at their fifth club."
},
"clubs5": {
"type": "string",
"label": "Club 5",
"description": "The fifth club that the player has been contracted at."
},
"caps5": {
"type": "number",
"label": "Club 5 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the fifth club."
},
"goals5": {
"type": "number",
"label": "Club 5 goals",
"description": "The number of goals that the player has been awarded in league competition for the fifth club."
},
"years6": {
"type": "number",
"label": "Club 6 years",
"description": "The years that the player was at their sixth club."
},
"clubs6": {
"type": "string",
"label": "Club 6",
"description": "The sixth club that the player has been contracted at."
},
"caps6": {
"type": "number",
"label": "Club 6 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the sixth club."
},
"goals6": {
"type": "number",
"label": "Club 6 goals",
"description": "The number of goals that the player has been awarded in league competition for the sixth club."
},
"years7": {
"type": "number",
"label": "Club 7 years",
"description": "The years that the player was at their seventh club."
},
"clubs7": {
"type": "string",
"label": "Club 7",
"description": "The seventh club that the player has been contracted at."
},
"caps7": {
"type": "number",
"label": "Club 7 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the seventh club."
},
"goals7": {
"type": "number",
"label": "Club 7 goals",
"description": "The number of goals that the player has been awarded in league competition for the seventh club."
},
"years8": {
"type": "number",
"label": "Club 8 years",
"description": "The years that the player was at their eighth club."
},
"clubs8": {
"type": "string",
"label": "Club 8",
"description": "The eighth club that the player has been contracted at."
},
"caps8": {
"type": "number",
"label": "Club 8 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the eighth club."
},
"goals8": {
"type": "number",
"label": "Club 8 goals",
"description": "The number of goals that the player has been awarded in league competition for the eighth club."
},
"years9": {
"type": "number",
"label": "Club 9 years",
"description": "The years that the player was at their ninth club."
},
"clubs9": {
"type": "string",
"label": "Club 9",
"description": "The ninth club that the player has been contracted at."
},
"caps9": {
"type": "number",
"label": "Club 9 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the ninth club."
},
"goals9": {
"type": "number",
"label": "Club 9 goals",
"description": "The number of goals that the player has been awarded in league competition for the ninth club."
},
"years10": {
"type": "number",
"label": "Club 10 years",
"description": "The years that the player was at their tenth club."
},
"clubs10": {
"type": "string",
"label": "Club 10",
"description": "The tenth club that the player has been contracted at."
},
"caps10": {
"type": "number",
"label": "Club 10 appearances",
"description": "The number of appearances that the player has been awarded in league competition for the tenth club."
},
"goals10": {
"type": "number",
"label": "Club 10 goals",
"description": "The number of goals that the player has been awarded in league competition for the tenth club."
},
"totalcaps": {
"type": "number",
"label": "Club appearances total",
"description": "The total number of appearances the player has been awarded in league competition for all non-youth clubs."
},
"totalgoals": {
"label": "Club goals total",
"description": "The total number of goals the player has scored in league competition for all non-youth clubs.",
"type": "number"
},
"nationalyears1": {
"type": "number",
"label": "National team 1 years",
"description": "The years that the player has played for the first national team. Up to 9 years can be added using the parameter names \"nationalyears2\", \"nationalyears3\", etc."
},
"nationalteam1": {
"type": "string",
"label": "National team 1",
"description": "The first national team that the player has played for (including non-senior teams such as U21). Up to 9 teams can be added using the parameter names \"nationalteam2\", \"nationalteam3\", etc."
},
"nationalcaps1": {
"type": "number",
"label": "National team 1 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the first national team. Up to 9 numbers can be added using the parameter names \"nationalcaps2\", \"nationalcaps3\", etc."
},
"nationalgoals1": {
"type": "number",
"label": "National team 1 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the first national team. Up to 9 numbers can be added using the parameter names \"nationalgoals2\", \"nationalgoals3\", etc."
},
"nationalyears2": {
"type": "number",
"label": "National team 2 years",
"description": "The years that the player has played for the second national team."
},
"nationalteam2": {
"type": "string",
"label": "National team 2",
"description": "The second national team that the player has played for."
},
"nationalcaps2": {
"type": "number",
"label": "National team 2 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the second national team."
},
"nationalgoals2": {
"type": "number",
"label": "National team 2 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the second national team."
},
"nationalyears3": {
"type": "number",
"label": "National team 3 years",
"description": "The years that the player has played for the third national team."
},
"nationalteam3": {
"type": "string",
"label": "National team 3",
"description": "The third national team that the player has played for."
},
"nationalcaps3": {
"type": "number",
"label": "National team 3 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the third national team."
},
"nationalgoals3": {
"type": "number",
"label": "National team 3 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the third national team."
},
"nationalyears4": {
"type": "number",
"label": "National team 4 years",
"description": "The years that the player has played for the fourth national team."
},
"nationalteam4": {
"type": "string",
"label": "National team 4",
"description": "The fourth national team that the player has played for."
},
"nationalcaps4": {
"type": "number",
"label": "National team 4 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the fourth national team."
},
"nationalgoals4": {
"type": "number",
"label": "National team 4 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the fourth national team."
},
"nationalyears5": {
"type": "number",
"label": "National team 5 years",
"description": "The years that the player has played for the fifth national team."
},
"nationalteam5": {
"type": "string",
"label": "National team 5",
"description": "The fifth national team that the player has played for."
},
"nationalcaps5": {
"type": "number",
"label": "National team 5 appearances",
"description": "The number of appearances that the player has been awarded in all competitions and friendlies for the fifth national team."
},
"nationalgoals5": {
"type": "number",
"label": "National team 5 goals",
"description": "The number of goals that the player has been awarded in all competitions and friendlies for the fifth national team."
},
"manageryears1": {
"type": "number",
"label": "Manager club 1 years",
"description": "The years that the person has served with the first club in the capacity of team manager."
},
"managerclubs1": {
"type": "string",
"label": "Manager club 1",
"description": "The first club that the person has served within the capacity of team manager. Please do not list positions other than team manager (such as assistant or coach positions, or director of football roles where this role is not considered managerial) unless that position is a significant part of the person's career; this will apply primarily to those with significant or perhaps primary experience in management. Clubs listed can be both local and national and should be restricted to those ordinarily considered notable in themselves."
},
"manageryears2": {
"type": "number",
"label": "Manager club 2 years",
"description": "The years that the person has served with the second club in the capacity of team manager. Up to 30 can be added using the parameter names \"manageryears3\", \"manageryears4\", etc."
},
"managerclubs2": {
"type": "string",
"label": "Manager club 2",
"description": "The second club that the person has served within the capacity of team manager. Up to 30 can be added using the parameter names \"managerclubs3\", \"managerclubs4\", etc."
},
"manageryears3": {
"type": "number",
"label": "Manager club 3 years",
"description": "The years that the person has served with the third club in the capacity of team manager."
},
"managerclubs3": {
"type": "string",
"label": "Manager club 3",
"description": "The third club that the person has served within the capacity of team manager."
},
"manageryears4": {
"type": "number",
"label": "Manager club 4 years",
"description": "The years that the person has served with the fourth club in the capacity of team manager."
},
"managerclubs4": {
"type": "string",
"label": "Manager club 4",
"description": "The fourth club that the person has served within the capacity of team manager."
},
"manageryears5": {
"type": "number",
"label": "Manager club 5 years",
"description": "The years that the person has served with the fifth club in the capacity of team manager."
},
"managerclubs5": {
"type": "string",
"label": "Manager club 5",
"description": "The fifth club that the person has served within the capacity of team manager."
},
"manageryears6": {
"type": "number",
"label": "Manager club 6 years",
"description": "The years that the person has served with the sixth club in the capacity of team manager."
},
"managerclubs6": {
"type": "string",
"label": "Manager club 6",
"description": "The sixth club that the person has served within the capacity of team manager."
},
"manageryears7": {
"type": "number",
"label": "Manager club 7 years",
"description": "The years that the person has served with the seventh club in the capacity of team manager."
},
"managerclubs7": {
"type": "string",
"label": "Manager club 7",
"description": "The seventh club that the person has served within the capacity of team manager."
},
"manageryears8": {
"type": "number",
"label": "Manager club 8 years",
"description": "The years that the person has served with the eighth club in the capacity of team manager."
},
"managerclubs8": {
"type": "string",
"label": "Manager club 8",
"description": "The eighth club that the person has served within the capacity of team manager."
},
"manageryears9": {
"type": "number",
"label": "Manager club 9 years",
"description": "The years that the person has served with the ninth club in the capacity of team manager."
},
"managerclubs9": {
"type": "string",
"label": "Manager club 9",
"description": "The ninth club that the person has served within the capacity of team manager."
},
"manageryears10": {
"type": "number",
"label": "Manager club 10 years",
"description": "The years that the person has served with the tenth club in the capacity of team manager."
},
"managerclubs10": {
"type": "string",
"label": "Manager club 10",
"description": "The tenth club that the person has served within the capacity of team manager."
},
"medaltemplates": {
"type": "string",
"label": "Medal templates",
"description": "Honors can be added here using {{Medal}} templates."
},
"club-update": {
"type": "string",
"label": "Club update timestamp",
"description": "A timestamp at which the player's infobox club statistics are unambiguously correct. The bare date of the last match played should not be used because this is not unambiguous. Dates should use the same format as the rest of the article; use five tildes (<nowiki>~~~~~</nowiki>) to generate the current date/time in dmy format, or {{subst:mdytime}} for mdy format. The parameter is not needed if the player has retired.",
"aliases": [ "pcupdate" ]
},
"nationalteam-update": {
"label": "National team update timestamp",
"description": "A timestamp at which the player's infobox national team statistics are unambiguously correct. The bare date of the last match played should not be used because this is not unambiguous. Dates should use the same format as the rest of the article; use five tildes (<nowiki>~~~~~</nowiki>) to generate the current date/time in dmy format, or {{subst:mdytime}} for mdy format. The parameter is not needed if the player has retired.",
"type": "string",
"aliases": [ "ntupdate" ]
}
},
"format": "block"
}
</templatedata>
{{Collapse bottom}}
== Tracking categories ==
{{Infobox tracking cats}}
* {{clc|Pages using infobox football biography with height issues}}
* {{clc|Pages using infobox football biography with invalid clubnumber}}
* {{clc|Pages using infobox football biography with a module}}
* {{clc|Pages using infobox football biography with invalid position}}
* {{clc|Pages using infobox football biography with irregular position}}
* {{clc|Pages using infobox football biography with tags in position parameter}}
* {{clc|No local image but image on Wikidata}} – Used by [[Template:Wikidata image]] to track articles where an infobox has no image but [[Wikidata]] has an image name. To exclude articles from this category, add an image or {{para|nocat_wdimage|yes}} to the infobox.
== Supporting templates ==
The following templates are used directly from this template:
{{Columns-list|colwidth=20em|
* {{ml|Infobox3cols|}}
* {{tl|Abbr}}
* {{tl|Br separated entries}}
* {{tl|Infobox medal templates}}
* {{tl|Infobox person/height}}
* {{tl|Longitem}}
* {{tl|Main other}}
* {{tl|PAGENAMEBASE}}
* {{tl|Wikidata image}}
* {{tl|Yesno}}
}}
<includeonly>{{Basepage subpage|
<!-- Categories go here and interwikis go in Wikidata. -->
[[Category:Association football infobox templates|Football biography]]
[[Category:Sportsperson infobox templates|Football biography]]
[[Category:Biographical templates usable as a module|Football biography]]
[[Category:Infobox templates with module parameter|Football biography]]
[[Category:Infobox templates with updated parameter]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
ljt4pt7100pfw7jver9jivxcn26i366
Módulo:Transclusion count/data/N
828
8679
75042
74016
2026-08-23T05:09:35Z
en>Ahechtbot
0
[[Wikipedia:BOT|Bot]]: Updated page.
75042
Scribunto
text/plain
return {
["N"] = 3100,
["N.b."] = 3000,
["N/A"] = 23000,
["N/a"] = 66000,
["NA"] = 2400,
["NA-Class"] = 15000,
["NASCAR_next_race"] = 2400,
["NASTRO_comment"] = 33000,
["NBA_Draft_template_list"] = 3600,
["NBA_Year"] = 6100,
["NBA_color"] = 3800,
["NBA_color_cell"] = 4600,
["NBA_color_cell2"] = 3600,
["NBA_player_statistics_legend"] = 5900,
["NBA_player_statistics_start"] = 5000,
["NBA_roster_footer"] = 2400,
["NBA_roster_header"] = 2200,
["NCAA_color_cell"] = 13000,
["NCAA_secondary_color_cell"] = 5100,
["NCES_District_ID"] = 3600,
["NED"] = 11000,
["NEXTYEAR"] = 10000,
["NFLAltPrimaryStyle"] = 2600,
["NFLPrimaryStyle"] = 28000,
["NFLSecondaryColor"] = 17000,
["NFL_Year"] = 30000,
["NFL_predraft"] = 10000,
["NFL_predraft/check"] = 10000,
["NFL_predraft/ftin"] = 10000,
["NFL_roster_navbox"] = 2800,
["NFLplayer"] = 2300,
["NFPA_704_diamond"] = 2000,
["NFPA_704_diamond/styles.css"] = 2000,
["NFPA_704_diamond/text"] = 2000,
["NFT"] = 7900,
["NFT_player"] = 33000,
["NGA"] = 3600,
["NGR"] = 2700,
["NHLE"] = 23000,
["NHLS_url"] = 2100,
["NLD"] = 13000,
["NLM_content"] = 2800,
["NOINDEX"] = 508000,
["NOMIS2011"] = 2200,
["NOR"] = 10000,
["NPG_name"] = 2200,
["NRDB_species"] = 7200,
["NRHPGoogleMapFootnote"] = 2500,
["NRHP_Focus"] = 74000,
["NRHP_color"] = 3700,
["NRHP_date_for_lists"] = 3100,
["NRHP_date_for_lists/dates"] = 3100,
["NRHP_header"] = 3400,
["NRHP_navigation_box"] = 17000,
["NRHP_row"] = 3400,
["NRHP_style"] = 72000,
["NRHP_url"] = 30000,
["NRHP_url/core"] = 32000,
["NRISref"] = 74000,
["NRT"] = 2300,
["NSWcity"] = 2000,
["NSWcity/core"] = 2000,
["NYCS_br"] = 2800,
["NYCS_time_2"] = 3200,
["NZL"] = 7400,
["NZ_census_2018"] = 2000,
["NZ_electorate_link"] = 2500,
["Na"] = 4500,
["Nac"] = 4000,
["Namespace_detect"] = 475000,
["Namespace_detect_showall"] = 13000,
["Nastaliq"] = 11000,
["Nat_fs_end"] = 2900,
["NationalArchivesNote"] = 8100,
["National_Film_Awards/style"] = 2200,
["National_Heritage_List_for_England"] = 28000,
["National_Register_of_Historic_Places"] = 22000,
["National_Register_of_Historic_Places_in_New_York"] = 4800,
["National_Register_of_Historic_Places_in_Pennsylvania"] = 3300,
["National_Register_of_Historic_Places_in_Virginia"] = 3100,
["National_basketball_squad"] = 3200,
["National_field_hockey_squad"] = 4400,
["National_football_squad_start/styles.css"] = 2600,
["National_men's_basketball_team"] = 4200,
["National_men's_cricket_team"] = 5000,
["National_men's_cricket_team_right"] = 2400,
["National_men's_ice_hockey_team"] = 8100,
["National_men's_volleyball_team"] = 2500,
["National_rugby_union_team"] = 6600,
["National_squad"] = 45000,
["National_squad_no_numbers"] = 17000,
["National_women's_volleyball_team"] = 2100,
["Native_name"] = 38000,
["Native_name_checker"] = 86000,
["Native_name_list"] = 5500,
["Nav_year_links"] = 3000,
["Naval"] = 5500,
["Naval/core"] = 5500,
["Navbar"] = 41000,
["Navbar-collapsible"] = 3700,
["Navbar-header"] = 17000,
["Navbar-header/styles.css"] = 17000,
["Navbox"] = 3070000,
["Navbox_GR_munic"] = 3700,
["Navbox_Musical_artist"] = 9700,
["Navbox_Ukraine_district"] = 2500,
["Navbox_bottom"] = 17000,
["Navbox_decade_list"] = 12000,
["Navbox_documentation"] = 56000,
["Navbox_ice_hockey"] = 3400,
["Navbox_musical_artist"] = 247000,
["Navbox_musical_artist/styles.css"] = 247000,
["Navbox_rugby_league_squad"] = 5100,
["Navbox_season_by_team"] = 3200,
["Navbox_top"] = 17000,
["Navbox_visibility"] = 56000,
["Navbox_with_collapsible_groups"] = 152000,
["Navbox_with_collapsible_sections"] = 3000,
["Navbox_with_columns"] = 26000,
["Navboxes"] = 68000,
["Navseasoncats"] = 125000,
["Navseasoncats_with_centuries_below_decade"] = 6600,
["Navseasoncats_with_decades_below_year"] = 16000,
["Navsource"] = 5400,
["Navy"] = 20000,
["Navy/core"] = 20000,
["Nay"] = 6900,
["Nbay"] = 6100,
["Nbh"] = 2100,
["Nbnd"] = 2700,
["Nbs"] = 19000,
["Nbsp"] = 547000,
["Nbsp_to_space"] = 25000,
["Ndash"] = 31000,
["Nee"] = 18000,
["NeilBrownPlayers"] = 3100,
["Net_register_tonnage"] = 2300,
["Netflix_title"] = 2300,
["New_user_bar"] = 57000,
["Newbot"] = 4500,
["Next_period"] = 26000,
["Nfly"] = 2500,
["Nigerian_English"] = 2400,
["Nihongo"] = 109000,
["Nihongo2"] = 13000,
["Nihongo_foot"] = 4100,
["No"] = 12000,
["No."] = 15000,
["No2"] = 13000,
["NoSpam"] = 4000,
["NoSpamEmail"] = 17000,
["No_bold"] = 3000,
["No_col_break"] = 2300,
["No_col_break/styles.css"] = 2300,
["No_documentation"] = 3800,
["No_footnotes"] = 56000,
["No_ping"] = 419000,
["No_ping2"] = 2300,
["No_plot"] = 12000,
["No_redirect"] = 732000,
["No_significant_coverage_(sports)"] = 5200,
["No_spam"] = 331000,
["No_wrap"] = 3400,
["Nobold"] = 479000,
["Nobold/styles.css"] = 480000,
["Nobr"] = 7400,
["Nobreak"] = 994000,
["Nochange"] = 3000,
["Noindex"] = 4900,
["Noitalic"] = 5700,
["Noitalic/styles.css"] = 5700,
["Nom"] = 48000,
["Nominated"] = 54000,
["Non-English-language_text_category"] = 3800,
["Non-admin_closure"] = 4200,
["Non-admin_closure_(requested_moves)"] = 4600,
["Non-admin_comment"] = 3700,
["Non-album_single"] = 4300,
["Non-album_singles"] = 3100,
["Non-diffusing"] = 4700,
["Non-diffusing_parent_category"] = 4500,
["Non-diffusing_subcategory"] = 37000,
["Non-free_2D_art"] = 7800,
["Non-free_3D_art"] = 2700,
["Non-free_album_cover"] = 222000,
["Non-free_audio_sample"] = 9000,
["Non-free_biog-pic"] = 38000,
["Non-free_book_cover"] = 64000,
["Non-free_character"] = 3300,
["Non-free_comic"] = 11000,
["Non-free_fair_use"] = 15000,
["Non-free_fair_use_in"] = 12000,
["Non-free_file_with_no_commercial_use_license"] = 2500,
["Non-free_film_poster"] = 105000,
["Non-free_film_screenshot"] = 4900,
["Non-free_game_cover"] = 8600,
["Non-free_game_screenshot"] = 5500,
["Non-free_historic_image"] = 18000,
["Non-free_image_data"] = 8100,
["Non-free_image_rationale"] = 9000,
["Non-free_logo"] = 157000,
["Non-free_magazine_cover"] = 9900,
["Non-free_media"] = 822000,
["Non-free_media_data"] = 9500,
["Non-free_media_rationale"] = 11000,
["Non-free_music_video_screenshot"] = 2100,
["Non-free_newspaper_image"] = 2200,
["Non-free_poster"] = 23000,
["Non-free_promotional"] = 6000,
["Non-free_school_logo"] = 15000,
["Non-free_seal"] = 9400,
["Non-free_symbol"] = 5800,
["Non-free_television_screenshot"] = 12000,
["Non-free_title-card"] = 13000,
["Non-free_use_rationale"] = 768000,
["Non-free_use_rationale/styles.css"] = 778000,
["Non-free_use_rationale_2"] = 244000,
["Non-free_use_rationale_album_cover"] = 152000,
["Non-free_use_rationale_biog"] = 2700,
["Non-free_use_rationale_book_cover"] = 20000,
["Non-free_use_rationale_logo"] = 127000,
["Non-free_use_rationale_poster"] = 63000,
["Non-free_use_rationale_title-card"] = 4500,
["Non-free_use_rationale_video_cover"] = 6500,
["Non-free_use_rationale_video_game_cover"] = 11000,
["Non-free_video_cover"] = 17000,
["Non-free_video_game_cover"] = 23000,
["Non-free_video_game_cover/platform"] = 23000,
["Non-free_video_game_screenshot"] = 12000,
["Non-free_video_game_screenshot/platform"] = 11000,
["Non-free_with_NC"] = 2300,
["Non_breaking_en_dash"] = 2800,
["Non_breaking_hyphen"] = 3100,
["Nonumtoc"] = 3300,
["Nonumtoc/styles.css"] = 3300,
["Noping"] = 390000,
["Noprint"] = 2400,
["Noredirect"] = 8900,
["Normal"] = 9700,
["Normalwraplink"] = 7100,
["North_America_topic"] = 3800,
["Nospam"] = 5500,
["Not-PD-US-expired-min-year"] = 65000,
["Not_a_ballot"] = 8500,
["Not_a_typo"] = 14000,
["Not_around"] = 12000,
["Not_done"] = 29000,
["Notability"] = 59000,
["Notavote"] = 2300,
["Notdone"] = 6200,
["Note"] = 27000,
["NoteFoot"] = 5600,
["NoteTag"] = 6100,
["Note_label"] = 9500,
["Notelist"] = 335000,
["Notelist-lr"] = 5100,
["Notelist-talk"] = 2100,
["Notelist-ua"] = 9400,
["Notes"] = 4200,
["Noteslist"] = 4800,
["Notice"] = 121000,
["Nowiki_="] = 2300,
["Nowrap"] = 1930000,
["Np"] = 5800,
["Npby"] = 2900,
["Nq"] = 4700,
["Nrut"] = 6600,
["Ns"] = 3200,
["Ns0"] = 86000,
["Ns_has_subpages"] = 3860000,
["Nts"] = 22000,
["Ntsh"] = 3700,
["Number_table_sorting"] = 41000,
["Number_table_sorting_hidden"] = 3700,
["Number_to_word"] = 8900,
["Numero"] = 4600,
["Nutshell"] = 5000,
["Nw="] = 2300,
["Née"] = 4100,
["Module:Namespace_detect"] = 540000,
["Module:Namespace_detect/config"] = 5210000,
["Module:Namespace_detect/data"] = 5210000,
["Module:National_squad"] = 59000,
["Module:Native_name"] = 121000,
["Module:Navbar"] = 5190000,
["Module:Navbar/configuration"] = 5190000,
["Module:Navbar/styles.css"] = 5190000,
["Module:Navbox"] = 4860000,
["Module:Navbox/configuration"] = 4860000,
["Module:Navbox/styles.css"] = 4860000,
["Module:Navbox_ice_hockey"] = 3400,
["Module:Navbox_or_wikitable"] = 2000,
["Module:Navbox_top_and_bottom"] = 17000,
["Module:Navbox_with_collapsible_groups"] = 15000,
["Module:Navboxes"] = 70000,
["Module:Nihongo"] = 112000,
["Module:No_ping"] = 503000,
["Module:Noinclude"] = 37000,
["Module:Normalize_volume_and_edition"] = 3600,
["Module:Ns_has_subpages"] = 3860000,
["Module:Number_table_sorting"] = 44000,
}
le8wpictf5wptyqhtulnwu542hpvr50
75043
75042
2026-08-24T01:08:54Z
Robertsky
10424
1 versaun husi [[:en:Module:Transclusion_count/data/N]]
75042
Scribunto
text/plain
return {
["N"] = 3100,
["N.b."] = 3000,
["N/A"] = 23000,
["N/a"] = 66000,
["NA"] = 2400,
["NA-Class"] = 15000,
["NASCAR_next_race"] = 2400,
["NASTRO_comment"] = 33000,
["NBA_Draft_template_list"] = 3600,
["NBA_Year"] = 6100,
["NBA_color"] = 3800,
["NBA_color_cell"] = 4600,
["NBA_color_cell2"] = 3600,
["NBA_player_statistics_legend"] = 5900,
["NBA_player_statistics_start"] = 5000,
["NBA_roster_footer"] = 2400,
["NBA_roster_header"] = 2200,
["NCAA_color_cell"] = 13000,
["NCAA_secondary_color_cell"] = 5100,
["NCES_District_ID"] = 3600,
["NED"] = 11000,
["NEXTYEAR"] = 10000,
["NFLAltPrimaryStyle"] = 2600,
["NFLPrimaryStyle"] = 28000,
["NFLSecondaryColor"] = 17000,
["NFL_Year"] = 30000,
["NFL_predraft"] = 10000,
["NFL_predraft/check"] = 10000,
["NFL_predraft/ftin"] = 10000,
["NFL_roster_navbox"] = 2800,
["NFLplayer"] = 2300,
["NFPA_704_diamond"] = 2000,
["NFPA_704_diamond/styles.css"] = 2000,
["NFPA_704_diamond/text"] = 2000,
["NFT"] = 7900,
["NFT_player"] = 33000,
["NGA"] = 3600,
["NGR"] = 2700,
["NHLE"] = 23000,
["NHLS_url"] = 2100,
["NLD"] = 13000,
["NLM_content"] = 2800,
["NOINDEX"] = 508000,
["NOMIS2011"] = 2200,
["NOR"] = 10000,
["NPG_name"] = 2200,
["NRDB_species"] = 7200,
["NRHPGoogleMapFootnote"] = 2500,
["NRHP_Focus"] = 74000,
["NRHP_color"] = 3700,
["NRHP_date_for_lists"] = 3100,
["NRHP_date_for_lists/dates"] = 3100,
["NRHP_header"] = 3400,
["NRHP_navigation_box"] = 17000,
["NRHP_row"] = 3400,
["NRHP_style"] = 72000,
["NRHP_url"] = 30000,
["NRHP_url/core"] = 32000,
["NRISref"] = 74000,
["NRT"] = 2300,
["NSWcity"] = 2000,
["NSWcity/core"] = 2000,
["NYCS_br"] = 2800,
["NYCS_time_2"] = 3200,
["NZL"] = 7400,
["NZ_census_2018"] = 2000,
["NZ_electorate_link"] = 2500,
["Na"] = 4500,
["Nac"] = 4000,
["Namespace_detect"] = 475000,
["Namespace_detect_showall"] = 13000,
["Nastaliq"] = 11000,
["Nat_fs_end"] = 2900,
["NationalArchivesNote"] = 8100,
["National_Film_Awards/style"] = 2200,
["National_Heritage_List_for_England"] = 28000,
["National_Register_of_Historic_Places"] = 22000,
["National_Register_of_Historic_Places_in_New_York"] = 4800,
["National_Register_of_Historic_Places_in_Pennsylvania"] = 3300,
["National_Register_of_Historic_Places_in_Virginia"] = 3100,
["National_basketball_squad"] = 3200,
["National_field_hockey_squad"] = 4400,
["National_football_squad_start/styles.css"] = 2600,
["National_men's_basketball_team"] = 4200,
["National_men's_cricket_team"] = 5000,
["National_men's_cricket_team_right"] = 2400,
["National_men's_ice_hockey_team"] = 8100,
["National_men's_volleyball_team"] = 2500,
["National_rugby_union_team"] = 6600,
["National_squad"] = 45000,
["National_squad_no_numbers"] = 17000,
["National_women's_volleyball_team"] = 2100,
["Native_name"] = 38000,
["Native_name_checker"] = 86000,
["Native_name_list"] = 5500,
["Nav_year_links"] = 3000,
["Naval"] = 5500,
["Naval/core"] = 5500,
["Navbar"] = 41000,
["Navbar-collapsible"] = 3700,
["Navbar-header"] = 17000,
["Navbar-header/styles.css"] = 17000,
["Navbox"] = 3070000,
["Navbox_GR_munic"] = 3700,
["Navbox_Musical_artist"] = 9700,
["Navbox_Ukraine_district"] = 2500,
["Navbox_bottom"] = 17000,
["Navbox_decade_list"] = 12000,
["Navbox_documentation"] = 56000,
["Navbox_ice_hockey"] = 3400,
["Navbox_musical_artist"] = 247000,
["Navbox_musical_artist/styles.css"] = 247000,
["Navbox_rugby_league_squad"] = 5100,
["Navbox_season_by_team"] = 3200,
["Navbox_top"] = 17000,
["Navbox_visibility"] = 56000,
["Navbox_with_collapsible_groups"] = 152000,
["Navbox_with_collapsible_sections"] = 3000,
["Navbox_with_columns"] = 26000,
["Navboxes"] = 68000,
["Navseasoncats"] = 125000,
["Navseasoncats_with_centuries_below_decade"] = 6600,
["Navseasoncats_with_decades_below_year"] = 16000,
["Navsource"] = 5400,
["Navy"] = 20000,
["Navy/core"] = 20000,
["Nay"] = 6900,
["Nbay"] = 6100,
["Nbh"] = 2100,
["Nbnd"] = 2700,
["Nbs"] = 19000,
["Nbsp"] = 547000,
["Nbsp_to_space"] = 25000,
["Ndash"] = 31000,
["Nee"] = 18000,
["NeilBrownPlayers"] = 3100,
["Net_register_tonnage"] = 2300,
["Netflix_title"] = 2300,
["New_user_bar"] = 57000,
["Newbot"] = 4500,
["Next_period"] = 26000,
["Nfly"] = 2500,
["Nigerian_English"] = 2400,
["Nihongo"] = 109000,
["Nihongo2"] = 13000,
["Nihongo_foot"] = 4100,
["No"] = 12000,
["No."] = 15000,
["No2"] = 13000,
["NoSpam"] = 4000,
["NoSpamEmail"] = 17000,
["No_bold"] = 3000,
["No_col_break"] = 2300,
["No_col_break/styles.css"] = 2300,
["No_documentation"] = 3800,
["No_footnotes"] = 56000,
["No_ping"] = 419000,
["No_ping2"] = 2300,
["No_plot"] = 12000,
["No_redirect"] = 732000,
["No_significant_coverage_(sports)"] = 5200,
["No_spam"] = 331000,
["No_wrap"] = 3400,
["Nobold"] = 479000,
["Nobold/styles.css"] = 480000,
["Nobr"] = 7400,
["Nobreak"] = 994000,
["Nochange"] = 3000,
["Noindex"] = 4900,
["Noitalic"] = 5700,
["Noitalic/styles.css"] = 5700,
["Nom"] = 48000,
["Nominated"] = 54000,
["Non-English-language_text_category"] = 3800,
["Non-admin_closure"] = 4200,
["Non-admin_closure_(requested_moves)"] = 4600,
["Non-admin_comment"] = 3700,
["Non-album_single"] = 4300,
["Non-album_singles"] = 3100,
["Non-diffusing"] = 4700,
["Non-diffusing_parent_category"] = 4500,
["Non-diffusing_subcategory"] = 37000,
["Non-free_2D_art"] = 7800,
["Non-free_3D_art"] = 2700,
["Non-free_album_cover"] = 222000,
["Non-free_audio_sample"] = 9000,
["Non-free_biog-pic"] = 38000,
["Non-free_book_cover"] = 64000,
["Non-free_character"] = 3300,
["Non-free_comic"] = 11000,
["Non-free_fair_use"] = 15000,
["Non-free_fair_use_in"] = 12000,
["Non-free_file_with_no_commercial_use_license"] = 2500,
["Non-free_film_poster"] = 105000,
["Non-free_film_screenshot"] = 4900,
["Non-free_game_cover"] = 8600,
["Non-free_game_screenshot"] = 5500,
["Non-free_historic_image"] = 18000,
["Non-free_image_data"] = 8100,
["Non-free_image_rationale"] = 9000,
["Non-free_logo"] = 157000,
["Non-free_magazine_cover"] = 9900,
["Non-free_media"] = 822000,
["Non-free_media_data"] = 9500,
["Non-free_media_rationale"] = 11000,
["Non-free_music_video_screenshot"] = 2100,
["Non-free_newspaper_image"] = 2200,
["Non-free_poster"] = 23000,
["Non-free_promotional"] = 6000,
["Non-free_school_logo"] = 15000,
["Non-free_seal"] = 9400,
["Non-free_symbol"] = 5800,
["Non-free_television_screenshot"] = 12000,
["Non-free_title-card"] = 13000,
["Non-free_use_rationale"] = 768000,
["Non-free_use_rationale/styles.css"] = 778000,
["Non-free_use_rationale_2"] = 244000,
["Non-free_use_rationale_album_cover"] = 152000,
["Non-free_use_rationale_biog"] = 2700,
["Non-free_use_rationale_book_cover"] = 20000,
["Non-free_use_rationale_logo"] = 127000,
["Non-free_use_rationale_poster"] = 63000,
["Non-free_use_rationale_title-card"] = 4500,
["Non-free_use_rationale_video_cover"] = 6500,
["Non-free_use_rationale_video_game_cover"] = 11000,
["Non-free_video_cover"] = 17000,
["Non-free_video_game_cover"] = 23000,
["Non-free_video_game_cover/platform"] = 23000,
["Non-free_video_game_screenshot"] = 12000,
["Non-free_video_game_screenshot/platform"] = 11000,
["Non-free_with_NC"] = 2300,
["Non_breaking_en_dash"] = 2800,
["Non_breaking_hyphen"] = 3100,
["Nonumtoc"] = 3300,
["Nonumtoc/styles.css"] = 3300,
["Noping"] = 390000,
["Noprint"] = 2400,
["Noredirect"] = 8900,
["Normal"] = 9700,
["Normalwraplink"] = 7100,
["North_America_topic"] = 3800,
["Nospam"] = 5500,
["Not-PD-US-expired-min-year"] = 65000,
["Not_a_ballot"] = 8500,
["Not_a_typo"] = 14000,
["Not_around"] = 12000,
["Not_done"] = 29000,
["Notability"] = 59000,
["Notavote"] = 2300,
["Notdone"] = 6200,
["Note"] = 27000,
["NoteFoot"] = 5600,
["NoteTag"] = 6100,
["Note_label"] = 9500,
["Notelist"] = 335000,
["Notelist-lr"] = 5100,
["Notelist-talk"] = 2100,
["Notelist-ua"] = 9400,
["Notes"] = 4200,
["Noteslist"] = 4800,
["Notice"] = 121000,
["Nowiki_="] = 2300,
["Nowrap"] = 1930000,
["Np"] = 5800,
["Npby"] = 2900,
["Nq"] = 4700,
["Nrut"] = 6600,
["Ns"] = 3200,
["Ns0"] = 86000,
["Ns_has_subpages"] = 3860000,
["Nts"] = 22000,
["Ntsh"] = 3700,
["Number_table_sorting"] = 41000,
["Number_table_sorting_hidden"] = 3700,
["Number_to_word"] = 8900,
["Numero"] = 4600,
["Nutshell"] = 5000,
["Nw="] = 2300,
["Née"] = 4100,
["Module:Namespace_detect"] = 540000,
["Module:Namespace_detect/config"] = 5210000,
["Module:Namespace_detect/data"] = 5210000,
["Module:National_squad"] = 59000,
["Module:Native_name"] = 121000,
["Module:Navbar"] = 5190000,
["Module:Navbar/configuration"] = 5190000,
["Module:Navbar/styles.css"] = 5190000,
["Module:Navbox"] = 4860000,
["Module:Navbox/configuration"] = 4860000,
["Module:Navbox/styles.css"] = 4860000,
["Module:Navbox_ice_hockey"] = 3400,
["Module:Navbox_or_wikitable"] = 2000,
["Module:Navbox_top_and_bottom"] = 17000,
["Module:Navbox_with_collapsible_groups"] = 15000,
["Module:Navboxes"] = 70000,
["Module:Nihongo"] = 112000,
["Module:No_ping"] = 503000,
["Module:Noinclude"] = 37000,
["Module:Normalize_volume_and_edition"] = 3600,
["Module:Ns_has_subpages"] = 3860000,
["Module:Number_table_sorting"] = 44000,
}
le8wpictf5wptyqhtulnwu542hpvr50
Lesululi
0
8924
74830
74707
2026-08-24T00:25:09Z
Robertsky
10424
add infobox
74830
wikitext
text/x-wiki
{{Infobox mountain
| name = Lesululi
| image = 2022-08-29 Poerema, Cailaco.jpg
| image_size = 282px
| image_alt =
| image_caption = Lesululi hanesan haree hosi Poerema (husi parte súl)
[[File:Meligo suco.png|282px|center]]<br />Mapa Meligo hatudu lokalizasaun Lesululi iha Aldeia Liabote.<span style="display:none" data-plural="1"></span>
| elevation = {{Höhe|1242|TL|link=true }} ({{convert|1242|m|ft|disp=output only|abbr=on}})
| elevation_ref = [[Category:One-thousanders]]
| isolation =
| isolation_ref =
| prominence =
| prominence_ref =
| listing =
| range =
| parent_peak =
| location = [[Meligo]], [[Cailaco]], [[Bobonaro (Gemeinde)|Gemeinde Bobonaro]], [[Osttimor]]
| map = East Timor
| map_image =
| map_alt =
| map_caption =
| map_relief =
| map_size =
| label =
| label_position =
| coordinates = {{coord|-8.917500|125.265306|type:mountain_region:TL-BO|format=dms|display=inline,title}}
| topo =
| type =
| geology =
| volcanic_arc/belt =
| age =
| last_eruption =
| first_ascent =
| access =
| easiest_route =
| normal_route =
}}
[[Imajen:2021-03-31 Meligo.jpg|miniaturadaimagem|Vizaun husi norte. Iha Lesululi nia kotuk mosu Leolaco]]
[[Imajen:Ichthyosaurier am Lesululi 1.png|miniaturadaimagem|Fósil sira Ichthyosaur nian iha Lesululi]]
'''Foho Lesululi''' maka foho ida iha [[Bobonaru (munisípiu)|munisípiu Bobonaru]], [[Timór Lorosa'e]] nian.<ref name="PV">Peakvisor: [https://peakvisor.com/peak/foho-lesoluli.html ''Foho Lesoluli''].</ref> Nia hela iha parte leste husi suku [[Meligo]] (distritu administrativu [[Kailaku (postu administrativu)|Kailaku]] nian), iha fronteira entre aldeias [[Mude (Meligo)|Mude]] no [[Liabote]].<ref name="Atlas Bobonaro">Direcção-Geral de Estatística: [https://www.statistics.gov.tl/wp-content/uploads/2020/10/Bobonaro_Aldeia_AtlasCont-x-7.pdf ''Atlas munisípiu Bobonaro nian''].</ref> Kilómetru ida ba lorosa'e maka [[Foho Leolaco]] (Lesoluli) ho aas 1913 m, ho [[Foho Mude]] (1088 m) iha entre.<ref name="PV" /> Povoasaun [[Poerema]] (suku [[Goulolo (Kailaku)|Goulolo]]) hela entre foho sira. Liu tan ba parte oeste mak povoasaun [[Lesuaben]] no [[Baleo]] (suku Meligo).<ref name="Atlas Bobonaro" /> Kilómetru tolu ba parte leste suli [[Rio Marobo|Marobo]] (lokálmente hanaran Aitasio), ne'ebé forma bacia norte-súl to'o Lesululi.<ref name="Fatus">Aaron Benincasa: [https://api.research-repository.uwa.edu.au/ws/portalfiles/portal/5338890/Benincasa_Aaron_2015.pdf ''The 'fatus' of East Timor: stratigraphy and structure''].</ref>
Foho ne'e iha forma kuaze triangular no oin norte ne'ebé nakloke uitoan, maibé fatuk-kuak aas iha nia ninin súl no oeste. Ninia simeira lokaliza iha parte leste foho nian, ne'ebé naruk maizumenus kilómetru 2,5 hosi oeste ba leste, iha aldeia Liabote, no iha elevasaun metru 1242.<ref name="Fatus" />
Iha tinan 2021, fósil sira husi [[iktiosauru]] ida hetan iha foho Lesululi.<ref>IGTL - Instituto de Geociências de Timor-Leste: [https://www.facebook.com/photo/?fbid=122217410630066492&set=a.122117862176066492 ''𝐒𝐨𝐜𝐢𝐚𝐥𝐢𝐳𝐚çã𝐨 𝐛𝐚 𝐜𝐨𝐦𝐮𝐧𝐢𝐝𝐚𝐝𝐞 𝐥𝐨𝐜𝐚𝐥 𝐢𝐡𝐚 𝐂𝐚𝐢𝐥𝐚𝐜𝐨, 𝐦𝐮𝐧𝐢𝐜í𝐩𝐢𝐨 𝐁𝐨𝐛𝐨𝐧𝐚𝐫𝐨, 𝐬𝐨𝐛𝐫𝐞 𝐟ó𝐬𝐬𝐞𝐢𝐬 𝐫é𝐩𝐭𝐞𝐢𝐬 𝐦𝐚𝐫𝐢𝐧𝐡𝐨𝐬 (𝐢𝐜𝐡𝐭𝐡𝐲𝐨𝐬𝐚𝐮𝐫 𝐛𝐨𝐧𝐞𝐬)'', Loron 19 fulan-Outubru tinan 2024].</ref> Sira kalkula katak iha tinan millaun 208<ref>Filomeno Martins: [https://en.tatoli.tl/2026/04/09/president-ramos-horta-visits-208-million-year-old-ichthyosaurus-fossil-in-cailaco/10/ ''President Ramos-Horta visits 208-million-year-old Ichthyosaurus fossil in Cailaco''], TATOLI Agência Noticiosa de Timor-Leste, Loron 9 fulan-Abril tinan 2024.</ref> no maka fósil iktiosauru dahuluk ne'ebé hetan iha súl [[liña ekuadór]].<ref>Arminda Fonseca Pinto: [https://tatoli.tl/2026/08/08/xanana-halao-vizita-haree-direta-fosil-iktosauru-iha-foho-lesululi-kailaku/ ''Xanana hala’o vizita-haree direta Fósil Iktosauru iha Foho Lesululi Kailaku''], Tatoli.</ref> Ho naruk metru 25, animál ne'e fiar katak hanesan entre iktiosauru sira ne'ebé boot liu ne'ebé koñesidu. Iha fatin hanesan, ruin liras [[pterosauru]] nian mós deskobre iha fulan-Jullu 2026. Tanba fósil sira-ne'e, iha esforsu sira ne'ebé hala'o hela atu dezigna área ne'e hanesan [[Jeoparke Globál UNESCO]] nian.<ref>Afonso do Rosário, Isaura Lemos de Deus: [https://pt.tatoli.tl/2026/08/11/descoberta-de-fosseis-raros-reforca-potencial-geologico-de-timor-leste/ ''Descoberta de fósseis raros reforça potencial geológico de Timor-Leste |hrsg=TATOLI Agência Noticiosa de Timor-Leste''], Loron 11 fulan Agostu tinan 2026.</ref>
== Ligasaun ba li'ur ==
{{Commons|Category:Lesululi|Lesululi}}
== Referensia ==
<references />
[[Kategoria:Foho Timór Lorosa'e]]
2ntf98sws0mm4ndbl549omt5jw1i2mx
74831
74830
2026-08-24T00:25:53Z
Robertsky
10424
74831
wikitext
text/x-wiki
{{Infobox mountain
| name = Lesululi
| image = 2022-08-29 Poerema, Cailaco.jpg
| image_size = 282px
| image_alt =
| image_caption = Lesululi hanesan haree hosi Poerema (husi parte súl)
[[File:Meligo suco.png|282px|center]]<br />Mapa Meligo hatudu lokalizasaun Lesululi iha Aldeia Liabote.<span style="display:none" data-plural="1"></span>
| elevation = {{Höhe|1242|TL|link=true }} ({{convert|1242|m|ft|disp=output only|abbr=on}})
| elevation_ref = [[Category:One-thousanders]]
| isolation =
| isolation_ref =
| prominence =
| prominence_ref =
| listing =
| range =
| parent_peak =
| location = [[Meligo]], [[Cailaco]], [[Bobonaro (Gemeinde)|Gemeinde Bobonaro]], [[Osttimor]]
| map = Timor-Leste
| map_image =
| map_alt =
| map_caption =
| map_relief =
| map_size =
| label =
| label_position =
| coordinates = {{coord|-8.917500|125.265306|type:mountain_region:TL-BO|format=dms|display=inline,title}}
| topo =
| type =
| geology =
| volcanic_arc/belt =
| age =
| last_eruption =
| first_ascent =
| access =
| easiest_route =
| normal_route =
}}
[[Imajen:2021-03-31 Meligo.jpg|miniaturadaimagem|Vizaun husi norte. Iha Lesululi nia kotuk mosu Leolaco]]
[[Imajen:Ichthyosaurier am Lesululi 1.png|miniaturadaimagem|Fósil sira Ichthyosaur nian iha Lesululi]]
'''Foho Lesululi''' maka foho ida iha [[Bobonaru (munisípiu)|munisípiu Bobonaru]], [[Timór Lorosa'e]] nian.<ref name="PV">Peakvisor: [https://peakvisor.com/peak/foho-lesoluli.html ''Foho Lesoluli''].</ref> Nia hela iha parte leste husi suku [[Meligo]] (distritu administrativu [[Kailaku (postu administrativu)|Kailaku]] nian), iha fronteira entre aldeias [[Mude (Meligo)|Mude]] no [[Liabote]].<ref name="Atlas Bobonaro">Direcção-Geral de Estatística: [https://www.statistics.gov.tl/wp-content/uploads/2020/10/Bobonaro_Aldeia_AtlasCont-x-7.pdf ''Atlas munisípiu Bobonaro nian''].</ref> Kilómetru ida ba lorosa'e maka [[Foho Leolaco]] (Lesoluli) ho aas 1913 m, ho [[Foho Mude]] (1088 m) iha entre.<ref name="PV" /> Povoasaun [[Poerema]] (suku [[Goulolo (Kailaku)|Goulolo]]) hela entre foho sira. Liu tan ba parte oeste mak povoasaun [[Lesuaben]] no [[Baleo]] (suku Meligo).<ref name="Atlas Bobonaro" /> Kilómetru tolu ba parte leste suli [[Rio Marobo|Marobo]] (lokálmente hanaran Aitasio), ne'ebé forma bacia norte-súl to'o Lesululi.<ref name="Fatus">Aaron Benincasa: [https://api.research-repository.uwa.edu.au/ws/portalfiles/portal/5338890/Benincasa_Aaron_2015.pdf ''The 'fatus' of East Timor: stratigraphy and structure''].</ref>
Foho ne'e iha forma kuaze triangular no oin norte ne'ebé nakloke uitoan, maibé fatuk-kuak aas iha nia ninin súl no oeste. Ninia simeira lokaliza iha parte leste foho nian, ne'ebé naruk maizumenus kilómetru 2,5 hosi oeste ba leste, iha aldeia Liabote, no iha elevasaun metru 1242.<ref name="Fatus" />
Iha tinan 2021, fósil sira husi [[iktiosauru]] ida hetan iha foho Lesululi.<ref>IGTL - Instituto de Geociências de Timor-Leste: [https://www.facebook.com/photo/?fbid=122217410630066492&set=a.122117862176066492 ''𝐒𝐨𝐜𝐢𝐚𝐥𝐢𝐳𝐚çã𝐨 𝐛𝐚 𝐜𝐨𝐦𝐮𝐧𝐢𝐝𝐚𝐝𝐞 𝐥𝐨𝐜𝐚𝐥 𝐢𝐡𝐚 𝐂𝐚𝐢𝐥𝐚𝐜𝐨, 𝐦𝐮𝐧𝐢𝐜í𝐩𝐢𝐨 𝐁𝐨𝐛𝐨𝐧𝐚𝐫𝐨, 𝐬𝐨𝐛𝐫𝐞 𝐟ó𝐬𝐬𝐞𝐢𝐬 𝐫é𝐩𝐭𝐞𝐢𝐬 𝐦𝐚𝐫𝐢𝐧𝐡𝐨𝐬 (𝐢𝐜𝐡𝐭𝐡𝐲𝐨𝐬𝐚𝐮𝐫 𝐛𝐨𝐧𝐞𝐬)'', Loron 19 fulan-Outubru tinan 2024].</ref> Sira kalkula katak iha tinan millaun 208<ref>Filomeno Martins: [https://en.tatoli.tl/2026/04/09/president-ramos-horta-visits-208-million-year-old-ichthyosaurus-fossil-in-cailaco/10/ ''President Ramos-Horta visits 208-million-year-old Ichthyosaurus fossil in Cailaco''], TATOLI Agência Noticiosa de Timor-Leste, Loron 9 fulan-Abril tinan 2024.</ref> no maka fósil iktiosauru dahuluk ne'ebé hetan iha súl [[liña ekuadór]].<ref>Arminda Fonseca Pinto: [https://tatoli.tl/2026/08/08/xanana-halao-vizita-haree-direta-fosil-iktosauru-iha-foho-lesululi-kailaku/ ''Xanana hala’o vizita-haree direta Fósil Iktosauru iha Foho Lesululi Kailaku''], Tatoli.</ref> Ho naruk metru 25, animál ne'e fiar katak hanesan entre iktiosauru sira ne'ebé boot liu ne'ebé koñesidu. Iha fatin hanesan, ruin liras [[pterosauru]] nian mós deskobre iha fulan-Jullu 2026. Tanba fósil sira-ne'e, iha esforsu sira ne'ebé hala'o hela atu dezigna área ne'e hanesan [[Jeoparke Globál UNESCO]] nian.<ref>Afonso do Rosário, Isaura Lemos de Deus: [https://pt.tatoli.tl/2026/08/11/descoberta-de-fosseis-raros-reforca-potencial-geologico-de-timor-leste/ ''Descoberta de fósseis raros reforça potencial geológico de Timor-Leste |hrsg=TATOLI Agência Noticiosa de Timor-Leste''], Loron 11 fulan Agostu tinan 2026.</ref>
== Ligasaun ba li'ur ==
{{Commons|Category:Lesululi|Lesululi}}
== Referensia ==
<references />
[[Kategoria:Foho Timór Lorosa'e]]
tj49y5m8qaxgbp9of8p4lo2a96h7f74
Template:Infokaixa fatin-koabitasaun
10
8935
74765
2026-08-23T23:49:47Z
Robertsky
10424
Robertsky moveu [[Template:Infokaixa fatin-koabitasaun]] para o seu redirecionamento [[Template:Infobox settlement]]
74765
wikitext
text/x-wiki
#REDIRECIONAMENTO [[Template:Infobox settlement]]
0aur0whoqit8cw7z2d3c76h8xum2hu6
Template:Infobox mountain
10
8936
74766
2026-08-16T22:52:22Z
en>Zackmann08
0
removing support for deprecated parameters that have been cleaned.
74766
wikitext
text/x-wiki
<includeonly>{{Infobox
| bodyclass = vcard
| child = {{{child|}}}
| subbox = {{{subbox|}}}
| above = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}
| aboveclass = fn org
| autoheaders = y
| abovestyle = background-color: #E7DCC3;color:#000;
| headerstyle = background-color: #E7DCC3;color:#000;
| imagestyle = padding: 0.3em 0.2em 0.2em 0.2em;
| captionstyle = padding: 0.2em 0em;
| bodystyle = width:24.5em; line-height:1.5em;
| subheaderclass= nickname
| subheader = {{{other_name|}}}
| image = {{#invoke:InfoboxImage|InfoboxImage|image=<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->||size={{{image_size|}}}|upright={{{image_upright|}}}|sizedefault=272px|maxsize=288px|alt={{{image_alt|}}}}}
| caption = {{#if:{{{image|}}}|{{{image_caption|}}}|{{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2=|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}|<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2=|name=caption|qid={{{qid|}}}|qual=P2096|qualsonly=true|rank=best|maxvals=1|ps=2}}<!--
-->}}}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data36|data1}} = {{#if:{{{pushpin_map|}}}
| <div style="padding:0.2em 0.2em 0.5em 0.2em;">{{#invoke:Location map|infobox_pushpin_map
| default_width = 272
| max_width = 288
| pushpin_mark = Red triangle with thick white border.svg
| pushpin_mark_size = 16
| pushpin_relief = 1
| pushpin_label = {{{name|}}}
| coordinates = {{if empty|{{{range_coordinates|}}}|{{{coordinates|}}}}}
}}
</div>
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data37|data2}} = {{#if:{{{image_map|}}}
|<div style="padding:0.2em 0.2em {{#if:{{{image_map_caption|}}}{{{map_caption|}}}{{{location|}}}|0.5em|0.2em}} 0.2em;">{{#invoke:InfoboxImage
|InfoboxImage
|image={{{image_map|}}}
|size={{if empty|{{{map_width|}}}|{{{map_size|}}}}}
|upright={{{map_upright|}}}
|sizedefault=272px
|maxsize=288px
|alt={{{map_alt|}}}}}{{#switch:{{if empty|{{{image_map_caption|}}}|{{{map_caption|}}}}}|none|=|#default=<div>{{if empty|{{{image_map_caption|}}}|{{{map_caption|}}}}}</div>
}}</div>
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data38|data3}} = <!--
-->{{#invoke:Infobox mapframe
| auto
| onByDefault = {{#if:{{{image_map|}}}{{{pushpin_map|}}}|no|yes}}
| mapframe-coord = {{if empty|{{{mapframe-coordinates|}}}|{{{range_coordinates|}}}||{{{coordinates|}}}}}
| mapframe-frame-width = 250
| mapframe-wikidata = {{#if:{{{mapframe-coordinates|}}}{{{mapframe-coord|}}}{{{range_coordinates|}}}{{{coordinates|}}}|no|yes}}
| mapframe-marker = mountain
| mapframe-type = mountain
| mapframe-length_km = {{{length_km|}}}
| mapframe-length_mi = {{{length_mi|}}}
| mapframe-width_km = {{{width_km|}}}
| mapframe-width_mi = {{{width_mi|}}}
| mapframe-area_mi2 = {{{area_mi2|}}}
| mapframe-area_km2 = {{{area_km2|}}}
| mapframe-id = {{{qid|}}}
| mapframe-shape = yes
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data39|data4}} = {{#invoke:Infobox mapframe
|autocaption
|onByDefault={{#if:{{{image_map|}}}{{{pushpin_map|}}}|no|yes}}
}}
| header5 = Highest point
| label6 = Peak
| data6 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{highest|}}}|name=highest|qid={{{qid|}}}|qual=P2561|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|noicon=false}}<!--
-->|{{If last display both|, |<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{highest_location|}}}|name=highest_location|qid={{{qid|}}}|qual=P276|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|noicon=false}}<!--
-->}}}}
| label7 = [[Summit|Elevation]]
| data7 = {{If empty|{{{elevation|}}}|{{#if:{{{elevation_m|}}}{{{elevation_ft|}}}|{{Convinfobox|{{{elevation_m|}}}|m|{{{elevation_ft|}}}|ft}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2=|name=elevation|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2044}}}}}}}}{{{elevation_ref|}}}{{If last display both|<br/>|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{elevation_system|}}}|name=elevation_system|qid={{{qid|}}}|qual=P459|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|maxvals=1|noicon=true}}<!--
-->}}
| label8 = [[Topographic prominence|Prominence]]
| data8 = {{If empty|{{{prominence|}}}|{{#if:{{{prominence_m|}}}{{{prominence_ft|}}}|{{Convinfobox|{{{prominence_m|}}}|m|{{{prominence_ft|}}}|ft}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2660|2=|name=prominence|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2660}}}}}}}}{{#if:{{{prominence_ref|}}}|{{{prominence_ref|}}}}}
| label9 = [[Topographic prominence#Prominence parentage|Parent peak]]
| data9 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P3137|2={{{parent_peak|}}}|name=parent_peak|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|shortname=true|maxvals=1|noicon=false|replacetext={{#ifeq:{{{fetchwikidata|}}}|ALL||[[Category:Wikidata value to be checked for Infobox mountain]]}}<!--
-->}}|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P3137}}}}}}
| label10 = [[Topographic isolation|Isolation]]
| data10 = {{If empty|{{{isolation|}}}|{{#if:{{{isolation_km|}}}{{{isolation_mi|}}}|{{Convinfobox|{{{isolation_km|}}}|km|{{{isolation_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2659|2=|name=isolation|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2659}}}}}}}}{{If last display both|<br/>to |<!--
-->{{#invoke:WikidataIB|getValue|1=P2659|2={{{isolation_parent|}}}|name=isolation_parent|qid={{{qid|}}}|qual=P2210|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|maxvals=1|noicon=true}}<!--
-->}}{{#if:{{{isolation_ref|}}}|{{{isolation_ref|}}}}}
| class11 = category
| label11 = [[Lists of mountains|Listing]]
| data11 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P361|2={{{listing|}}}|name=listing|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|sorted=true|noicon=false|list=ubl|replacetext={{#ifeq:{{{fetchwikidata|}}}|ALL||[[Category:Wikidata value to be checked for Infobox mountain]]}}<!--
-->}}|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P3137}}}}}}
| label12 = Coordinates
| data12 = {{#if:{{{coordinates|}}}|{{#invoke:Coordinates|coordinsert|{{{coordinates|}}}|type:mountain|{{#if:{{{range_coordinates|}}}||scale:{{Map scale|type=mountain|<!--
-->length_km={{{length_km|}}}|length_mi={{{length_mi|}}}|width_km={{{width_km|}}}|width_mi={{{width_mi|}}}|<!--
-->area_mi2={{{area_mi2|}}}|area_km2={{{area_km2|}}}}}}}}}<!--
-->{{{coordinates_ref|}}} }}
| header20 = Dimensions
| label21 = Length
| data21 = {{If first display both|{{If empty|{{{length|}}}|{{#if:{{{length_km|}}}{{{length_mi|}}}|{{Convinfobox|{{{length_km|}}}|km|{{{length_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2043|2=|name=length|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2043}}}}}}}}|{{If last display both| |{{If empty|{{{length_orientation|}}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2043|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q36477|nomatch=}}<!--
-->|Q36477|(NS)|}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2043|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q34027|nomatch=}}<!--
-->|Q34027|(EW)|}}}}}}{{{length_ref|}}}}}
| label22 = Width
| data22 = {{If first display both|{{If empty|{{{width|}}}|{{#if:{{{width_km|}}}{{{width_mi|}}}|{{Convinfobox|{{{width_km|}}}|km|{{{width_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2049|2=|name=width|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2049}}}}}}}}|{{If last display both| |{{If empty|{{{width_orientation|}}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2049|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q36477|nomatch=}}<!--
-->|Q36477|(NS)|}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2049|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q34027|nomatch=}}<!--
-->|Q34027|(EW)|}}}}}}{{{width_ref|}}}}}
| label23 = Area
| data23 = {{If first display both|{{If empty|{{{area|}}}|{{#if:{{{area_km2|}}}{{{area_mi2|}}}|{{Convinfobox|{{{area_km2|}}}|km2|{{{area_mi2|}}}|mi2}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2046|2=|name=area|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2046}}}}}}}}|{{{area_ref|}}}}}
| label24 = Volume
| data24 = {{If first display both|{{If empty|{{{volume|}}}|{{#if:{{{volume_km3|}}}{{{volume_mi3|}}}|{{Convinfobox|{{{volume_km3|}}}|km3|{{{volume_mi3|}}}|mi3}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2234|2=|name=volume|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2234}}}}}}}}|{{{volume_ref|}}}}}
| header25 = Naming
| label26 = [[Etymology]]
| data26 = {{{etymology|}}}
| class27 = nickname
| label27 = [[Nickname|Nickname{{pluralize from text|{{{nickname|}}}|likely=(s)|plural=s}}]]
| data27 = {{{nickname|}}}
| class28 = nickname
| label28 = Native name
| data28 = {{native name checker|{{{native_name|}}}}}
| label29 = {{longitem|English translation}}
| data29 = {{{translation|}}}
| label30 = {{longitem|Language of name}}
| data30 = {{#if:{{{native_name|}}}||<!--
-->{{#if:{{{language|}}}|{{{language}}}|<!--
-->{{#if:{{{native_name_lang|}}}|{{ISO 639 name|{{{native_name_lang|}}}|link=yes}}}}}}}}
| label31 = Pronunciation
| data31 = {{{pronunciation|}}}
| label32 = {{longitem|Defining authority}}
| data32 = {{{authority|}}}
| header35 = Geography
<!-- data36 <=> data1 reserved for map when image is present -->
<!-- data37 <=> data2 reserved for map image when image is present -->
<!-- data38+data39 <=> data3+data4 mapframe slots -->
| class40 = label
| label40 = Location
| data40 = {{{location|}}}
| class41 = label
| label41 = {{longitem|{{If empty|{{{country_type|}}}|{{pluralize from text|{{{country|}}}|singular=Country|plural=Countries}}}}}}
| data41 = {{{country|}}}
| class42 = label
| label42 = {{longitem|{{If empty|{{{subdivision1_type|}}}|{{{state_type|}}}|State{{pluralize from text|{{if empty|{{{subdivision1|}}}|{{{state|}}}}}|likely=(s)|plural=s}}}}}}
| data42 = {{if empty|{{{subdivision1|}}}|{{{state|}}}}}
| class43 = label
| label43 = {{longitem|{{If empty|{{{subdivision2_type|}}}|{{{region_type|}}}|Region{{pluralize from text|{{if empty|{{{subdivision2|}}}|{{{region|}}}}}|likely=(s)|plural=s}}}}}}
| data43 = {{if empty|{{{subdivision2|}}}|{{{region|}}}}}
| class44 = label
| label44 = {{longitem|{{If empty|{{{subdivision3_type|}}}|{{{district_type|}}}|District{{pluralize from text|{{if empty|{{{subdivision3|}}}|{{{district|}}}}}|likely=(s)|plural=s}}}}}}
| data44 = {{if empty|{{{subdivision3|}}}|{{{district|}}}}}
| label45 = {{longitem|{{If empty|{{{subdivision4_type|}}}|{{{part_type|}}}|Subdivision{{pluralize from text|{{if empty|{{{subdivision4|}}}|{{{part|}}}}}|likely=(s)|plural=s}}}}}}
| data45 = {{if empty|{{{subdivision4|}}}|{{{part|}}}}}
| label46 = {{longitem|{{If empty|{{{settlement_type|}}}|Settlement{{pluralize from text|{{{settlement|}}}|likely=(s)|plural=s}}}}}}
| data46 = {{{settlement|}}}
| label47 = {{longitem|Range coordinates}}
| data47 = {{#if:{{{range_coordinates|}}}|{{#invoke:Coordinates|coordinsert|{{{range_coordinates|}}}||type:mountain|scale:{{Map scale|type=mountain|<!--
-->length_km={{{length_km|}}}|length_mi={{{length_mi|}}}|width_km={{{width_km|}}}|width_mi={{{width_mi|}}}|<!--
-->area_mi2={{{area_mi2|}}}|area_km2={{{area_km2|}}}}}}}<!--
-->{{{range_coordinates_ref|}}}}}
| class48 = category
| label48 = [[Mountain range|{{nowrap|Parent range}}]]
| data48 = {{if empty|{{{parent|}}}|{{{range|}}}}}
| label49 = Borders on
| data49 = {{{borders_on|}}}
| label50 = [[Ordnance Survey National Grid|OS grid]]
| data50 = {{#if:{{{grid_ref_UK|}}}|{{Gbmappingsmall|{{{grid_ref_UK|}}}|name={{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} }}{{{grid_ref_UK_ref|}}}}}
| label51 = [[Irish grid reference system|OSI/OSNI grid]]
| data51 = {{#if:{{{grid_ref_Ireland|}}}|{{iem4ibx|{{{grid_ref_Ireland|}}}|name={{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} }}{{{grid_ref_Ireland_ref|}}}}}
| label52 = [[Topographic map|Topo map{{pluralize from text|{{if empty|{{{topo|}}}|{{{topo_map|}}} }}|likely=(s)|plural=s}}]]
| data52 = {{#if:{{{topo_maker|}}}|{{{topo_maker}}} }}{{if empty|{{{topo|}}}|{{{topo_map|}}} }}
| label53 = [[Biome]]
| data53 = {{{biome|}}}
| header62 = Geology
| label63 = [[Mountain formation|Formed by]]
| data63 = {{{formed_by|}}}
| label64 = [[Orogeny|{{pluralize from text|{{{orogeny|}}}|singular=Orogeny|plural=Orogenies}}]]
| data64 = {{{orogeny|}}}
| label65 = [[Geologic time scale|Rock age{{pluralize from text|{{{age|}}}|likely=(s)|plural=s}}]]
| data65 = {{{age|}}}
| label66 = {{longitem|[[List of mountain types|Mountain type{{pluralize from text|{{if empty|{{{mountain_type|}}}|{{{type|}}}}}|<!--
-->likely=(s)|plural=s}}]]}}
| data66 = {{if empty|{{{mountain_type|}}}|{{{type|}}}}}
| label67 = [[List of rock types|Rock type{{pluralize from text|{{if empty|{{{geology|}}}|{{{rock|}}}}}|likely=(s)|plural=s}}]]
| data67 = {{if empty|{{{geology|}}}|{{{rock|}}}}}
| label68 = Volcanic zone
| data68 = {{{volcanic_zone|}}}
| label69 = {{nowrap|[[Volcanic arc]]}}
| data69 = {{{volcanic_arc|}}}
| label70 = {{nowrap|[[Volcanic belt]]}}
| data70 = {{{volcanic_belt|}}}
| label71 = {{nowrap|[[Volcanic field]]}}
| data71 = {{{volcanic_field|}}}
| label73 = {{nowrap|[[volcanic eruption|Last eruption]]}}
| data73 = {{{last_eruption|}}}
| header80 = Climbing
| label81 = [[First ascent]]
| data81 = {{{first_ascent|}}}
| label82 = [[Normal route|{{nowrap|Easiest route}}]]
| data82 = {{{easiest_route|}}}
| label83 = [[Normal route]]
| data83 = {{{normal_route|}}}
| label84 = Access
| data84 = {{{access|}}}
| header85 = _BLANK_
| data86 = {{{embedded|}}}
| data87 = {{{module|}}}
}}{{main other|{{#if:{{{region|}}}|{{#ifeq:{{#invoke:string|replace|{{{region}}}|^[A-Z0-9/\-]*$|MATCH|plain=false}}|MATCH|[[Category:Pages using infobox mountain with unknown parameters|ρ]]
}}}}
}}{{#ifeq:{{if empty|{{{child|}}}|{{{embed|}}}}}|yes||{{Wikidata image |1={{{image|}}}{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}} |2={{{nocat_wdimage|}}}}}
}}{{main other|
{{#if:{{{language|}}}|[[Category:Pages using infobox mountain with language parameter|{{#invoke:string|replace|{{{language}}}|[^A-Za-z0-9]||plain=false}} ]]}}
}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox mountain with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox mountain]] with unknown parameter "_VALUE_"|ignoreblank=y|mapframe_args=y| pushpin_map_args = y | access | age | area | area_km2 | area_mi2 | area_ref | authority | biome | borders_on | child | coordinates | coordinates_ref | country | country_type | district | district_type | easiest_route | elevation | elevation_ft | elevation_m | elevation_ref | elevation_system | embed | embedded | etymology | fetchwikidata | first_ascent | formed_by | geology | grid_ref_Ireland | grid_ref_Ireland_ref | grid_ref_UK | grid_ref_UK_ref | highest | highest_location | image | image_alt | image_caption | image_map | image_map_caption | image_size | image_upright | isolation | isolation_km | isolation_mi | isolation_parent | isolation_ref | language | last_eruption | length | length_km | length_mi | length_orientation | length_ref | listing | location | map_alt | map_caption | map_size | map_upright | map_width | module | mountain_type | name | native_name | native_name_lang | nickname | nocat_wdimage | normal_route | onlysourced | orogeny | other_name | parent | parent_peak | part | part_type | prominence | prominence_ft | prominence_m | prominence_ref | pronunciation | qid | range | range_coordinates | range_coordinates_ref | refs | region | region_type | rock | settlement | settlement_type | state | state_type | subbox | subdivision1 | subdivision1_type | subdivision2 | subdivision2_type | subdivision3 | subdivision3_type | subdivision4 | subdivision4_type | suppressfields | topo | topo_maker | topo_map | translation | type | volcanic_arc | volcanic_belt | volcanic_field | volcanic_zone | volume | volume_km3 | volume_mi3 | volume_ref | width | width_km | width_mi | width_orientation | width_ref }}{{#invoke:Check for conflicting parameters|check
| template = [[Template:Infobox mountain]]
| cat = {{main other|Category:Pages using infobox mountain with conflicting parameters}}
| map_width; map_size
| subdivision1; state
| subdivision2; region
| subdivision3; district
| subdivision4; part
| parent; range
| topo; topo_map
| mountain_type; type
| geology; rock
| child; embed
}}<noinclude>
{{documentation}}
</noinclude>
nkd0rlmwjp4ivuzcr60fzzpqgeh8egc
74767
74766
2026-08-24T00:15:08Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mountain]]
74766
wikitext
text/x-wiki
<includeonly>{{Infobox
| bodyclass = vcard
| child = {{{child|}}}
| subbox = {{{subbox|}}}
| above = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}
| aboveclass = fn org
| autoheaders = y
| abovestyle = background-color: #E7DCC3;color:#000;
| headerstyle = background-color: #E7DCC3;color:#000;
| imagestyle = padding: 0.3em 0.2em 0.2em 0.2em;
| captionstyle = padding: 0.2em 0em;
| bodystyle = width:24.5em; line-height:1.5em;
| subheaderclass= nickname
| subheader = {{{other_name|}}}
| image = {{#invoke:InfoboxImage|InfoboxImage|image=<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->||size={{{image_size|}}}|upright={{{image_upright|}}}|sizedefault=272px|maxsize=288px|alt={{{image_alt|}}}}}
| caption = {{#if:{{{image|}}}|{{{image_caption|}}}|{{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2=|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}|<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2=|name=caption|qid={{{qid|}}}|qual=P2096|qualsonly=true|rank=best|maxvals=1|ps=2}}<!--
-->}}}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data36|data1}} = {{#if:{{{pushpin_map|}}}
| <div style="padding:0.2em 0.2em 0.5em 0.2em;">{{#invoke:Location map|infobox_pushpin_map
| default_width = 272
| max_width = 288
| pushpin_mark = Red triangle with thick white border.svg
| pushpin_mark_size = 16
| pushpin_relief = 1
| pushpin_label = {{{name|}}}
| coordinates = {{if empty|{{{range_coordinates|}}}|{{{coordinates|}}}}}
}}
</div>
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data37|data2}} = {{#if:{{{image_map|}}}
|<div style="padding:0.2em 0.2em {{#if:{{{image_map_caption|}}}{{{map_caption|}}}{{{location|}}}|0.5em|0.2em}} 0.2em;">{{#invoke:InfoboxImage
|InfoboxImage
|image={{{image_map|}}}
|size={{if empty|{{{map_width|}}}|{{{map_size|}}}}}
|upright={{{map_upright|}}}
|sizedefault=272px
|maxsize=288px
|alt={{{map_alt|}}}}}{{#switch:{{if empty|{{{image_map_caption|}}}|{{{map_caption|}}}}}|none|=|#default=<div>{{if empty|{{{image_map_caption|}}}|{{{map_caption|}}}}}</div>
}}</div>
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data38|data3}} = <!--
-->{{#invoke:Infobox mapframe
| auto
| onByDefault = {{#if:{{{image_map|}}}{{{pushpin_map|}}}|no|yes}}
| mapframe-coord = {{if empty|{{{mapframe-coordinates|}}}|{{{range_coordinates|}}}||{{{coordinates|}}}}}
| mapframe-frame-width = 250
| mapframe-wikidata = {{#if:{{{mapframe-coordinates|}}}{{{mapframe-coord|}}}{{{range_coordinates|}}}{{{coordinates|}}}|no|yes}}
| mapframe-marker = mountain
| mapframe-type = mountain
| mapframe-length_km = {{{length_km|}}}
| mapframe-length_mi = {{{length_mi|}}}
| mapframe-width_km = {{{width_km|}}}
| mapframe-width_mi = {{{width_mi|}}}
| mapframe-area_mi2 = {{{area_mi2|}}}
| mapframe-area_km2 = {{{area_km2|}}}
| mapframe-id = {{{qid|}}}
| mapframe-shape = yes
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data39|data4}} = {{#invoke:Infobox mapframe
|autocaption
|onByDefault={{#if:{{{image_map|}}}{{{pushpin_map|}}}|no|yes}}
}}
| header5 = Highest point
| label6 = Peak
| data6 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{highest|}}}|name=highest|qid={{{qid|}}}|qual=P2561|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|noicon=false}}<!--
-->|{{If last display both|, |<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{highest_location|}}}|name=highest_location|qid={{{qid|}}}|qual=P276|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|noicon=false}}<!--
-->}}}}
| label7 = [[Summit|Elevation]]
| data7 = {{If empty|{{{elevation|}}}|{{#if:{{{elevation_m|}}}{{{elevation_ft|}}}|{{Convinfobox|{{{elevation_m|}}}|m|{{{elevation_ft|}}}|ft}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2=|name=elevation|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2044}}}}}}}}{{{elevation_ref|}}}{{If last display both|<br/>|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{elevation_system|}}}|name=elevation_system|qid={{{qid|}}}|qual=P459|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|maxvals=1|noicon=true}}<!--
-->}}
| label8 = [[Topographic prominence|Prominence]]
| data8 = {{If empty|{{{prominence|}}}|{{#if:{{{prominence_m|}}}{{{prominence_ft|}}}|{{Convinfobox|{{{prominence_m|}}}|m|{{{prominence_ft|}}}|ft}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2660|2=|name=prominence|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2660}}}}}}}}{{#if:{{{prominence_ref|}}}|{{{prominence_ref|}}}}}
| label9 = [[Topographic prominence#Prominence parentage|Parent peak]]
| data9 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P3137|2={{{parent_peak|}}}|name=parent_peak|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|shortname=true|maxvals=1|noicon=false|replacetext={{#ifeq:{{{fetchwikidata|}}}|ALL||[[Category:Wikidata value to be checked for Infobox mountain]]}}<!--
-->}}|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P3137}}}}}}
| label10 = [[Topographic isolation|Isolation]]
| data10 = {{If empty|{{{isolation|}}}|{{#if:{{{isolation_km|}}}{{{isolation_mi|}}}|{{Convinfobox|{{{isolation_km|}}}|km|{{{isolation_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2659|2=|name=isolation|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2659}}}}}}}}{{If last display both|<br/>to |<!--
-->{{#invoke:WikidataIB|getValue|1=P2659|2={{{isolation_parent|}}}|name=isolation_parent|qid={{{qid|}}}|qual=P2210|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|maxvals=1|noicon=true}}<!--
-->}}{{#if:{{{isolation_ref|}}}|{{{isolation_ref|}}}}}
| class11 = category
| label11 = [[Lists of mountains|Listing]]
| data11 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P361|2={{{listing|}}}|name=listing|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|sorted=true|noicon=false|list=ubl|replacetext={{#ifeq:{{{fetchwikidata|}}}|ALL||[[Category:Wikidata value to be checked for Infobox mountain]]}}<!--
-->}}|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P3137}}}}}}
| label12 = Coordinates
| data12 = {{#if:{{{coordinates|}}}|{{#invoke:Coordinates|coordinsert|{{{coordinates|}}}|type:mountain|{{#if:{{{range_coordinates|}}}||scale:{{Map scale|type=mountain|<!--
-->length_km={{{length_km|}}}|length_mi={{{length_mi|}}}|width_km={{{width_km|}}}|width_mi={{{width_mi|}}}|<!--
-->area_mi2={{{area_mi2|}}}|area_km2={{{area_km2|}}}}}}}}}<!--
-->{{{coordinates_ref|}}} }}
| header20 = Dimensions
| label21 = Length
| data21 = {{If first display both|{{If empty|{{{length|}}}|{{#if:{{{length_km|}}}{{{length_mi|}}}|{{Convinfobox|{{{length_km|}}}|km|{{{length_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2043|2=|name=length|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2043}}}}}}}}|{{If last display both| |{{If empty|{{{length_orientation|}}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2043|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q36477|nomatch=}}<!--
-->|Q36477|(NS)|}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2043|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q34027|nomatch=}}<!--
-->|Q34027|(EW)|}}}}}}{{{length_ref|}}}}}
| label22 = Width
| data22 = {{If first display both|{{If empty|{{{width|}}}|{{#if:{{{width_km|}}}{{{width_mi|}}}|{{Convinfobox|{{{width_km|}}}|km|{{{width_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2049|2=|name=width|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2049}}}}}}}}|{{If last display both| |{{If empty|{{{width_orientation|}}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2049|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q36477|nomatch=}}<!--
-->|Q36477|(NS)|}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2049|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q34027|nomatch=}}<!--
-->|Q34027|(EW)|}}}}}}{{{width_ref|}}}}}
| label23 = Area
| data23 = {{If first display both|{{If empty|{{{area|}}}|{{#if:{{{area_km2|}}}{{{area_mi2|}}}|{{Convinfobox|{{{area_km2|}}}|km2|{{{area_mi2|}}}|mi2}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2046|2=|name=area|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2046}}}}}}}}|{{{area_ref|}}}}}
| label24 = Volume
| data24 = {{If first display both|{{If empty|{{{volume|}}}|{{#if:{{{volume_km3|}}}{{{volume_mi3|}}}|{{Convinfobox|{{{volume_km3|}}}|km3|{{{volume_mi3|}}}|mi3}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2234|2=|name=volume|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2234}}}}}}}}|{{{volume_ref|}}}}}
| header25 = Naming
| label26 = [[Etymology]]
| data26 = {{{etymology|}}}
| class27 = nickname
| label27 = [[Nickname|Nickname{{pluralize from text|{{{nickname|}}}|likely=(s)|plural=s}}]]
| data27 = {{{nickname|}}}
| class28 = nickname
| label28 = Native name
| data28 = {{native name checker|{{{native_name|}}}}}
| label29 = {{longitem|English translation}}
| data29 = {{{translation|}}}
| label30 = {{longitem|Language of name}}
| data30 = {{#if:{{{native_name|}}}||<!--
-->{{#if:{{{language|}}}|{{{language}}}|<!--
-->{{#if:{{{native_name_lang|}}}|{{ISO 639 name|{{{native_name_lang|}}}|link=yes}}}}}}}}
| label31 = Pronunciation
| data31 = {{{pronunciation|}}}
| label32 = {{longitem|Defining authority}}
| data32 = {{{authority|}}}
| header35 = Geography
<!-- data36 <=> data1 reserved for map when image is present -->
<!-- data37 <=> data2 reserved for map image when image is present -->
<!-- data38+data39 <=> data3+data4 mapframe slots -->
| class40 = label
| label40 = Location
| data40 = {{{location|}}}
| class41 = label
| label41 = {{longitem|{{If empty|{{{country_type|}}}|{{pluralize from text|{{{country|}}}|singular=Country|plural=Countries}}}}}}
| data41 = {{{country|}}}
| class42 = label
| label42 = {{longitem|{{If empty|{{{subdivision1_type|}}}|{{{state_type|}}}|State{{pluralize from text|{{if empty|{{{subdivision1|}}}|{{{state|}}}}}|likely=(s)|plural=s}}}}}}
| data42 = {{if empty|{{{subdivision1|}}}|{{{state|}}}}}
| class43 = label
| label43 = {{longitem|{{If empty|{{{subdivision2_type|}}}|{{{region_type|}}}|Region{{pluralize from text|{{if empty|{{{subdivision2|}}}|{{{region|}}}}}|likely=(s)|plural=s}}}}}}
| data43 = {{if empty|{{{subdivision2|}}}|{{{region|}}}}}
| class44 = label
| label44 = {{longitem|{{If empty|{{{subdivision3_type|}}}|{{{district_type|}}}|District{{pluralize from text|{{if empty|{{{subdivision3|}}}|{{{district|}}}}}|likely=(s)|plural=s}}}}}}
| data44 = {{if empty|{{{subdivision3|}}}|{{{district|}}}}}
| label45 = {{longitem|{{If empty|{{{subdivision4_type|}}}|{{{part_type|}}}|Subdivision{{pluralize from text|{{if empty|{{{subdivision4|}}}|{{{part|}}}}}|likely=(s)|plural=s}}}}}}
| data45 = {{if empty|{{{subdivision4|}}}|{{{part|}}}}}
| label46 = {{longitem|{{If empty|{{{settlement_type|}}}|Settlement{{pluralize from text|{{{settlement|}}}|likely=(s)|plural=s}}}}}}
| data46 = {{{settlement|}}}
| label47 = {{longitem|Range coordinates}}
| data47 = {{#if:{{{range_coordinates|}}}|{{#invoke:Coordinates|coordinsert|{{{range_coordinates|}}}||type:mountain|scale:{{Map scale|type=mountain|<!--
-->length_km={{{length_km|}}}|length_mi={{{length_mi|}}}|width_km={{{width_km|}}}|width_mi={{{width_mi|}}}|<!--
-->area_mi2={{{area_mi2|}}}|area_km2={{{area_km2|}}}}}}}<!--
-->{{{range_coordinates_ref|}}}}}
| class48 = category
| label48 = [[Mountain range|{{nowrap|Parent range}}]]
| data48 = {{if empty|{{{parent|}}}|{{{range|}}}}}
| label49 = Borders on
| data49 = {{{borders_on|}}}
| label50 = [[Ordnance Survey National Grid|OS grid]]
| data50 = {{#if:{{{grid_ref_UK|}}}|{{Gbmappingsmall|{{{grid_ref_UK|}}}|name={{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} }}{{{grid_ref_UK_ref|}}}}}
| label51 = [[Irish grid reference system|OSI/OSNI grid]]
| data51 = {{#if:{{{grid_ref_Ireland|}}}|{{iem4ibx|{{{grid_ref_Ireland|}}}|name={{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} }}{{{grid_ref_Ireland_ref|}}}}}
| label52 = [[Topographic map|Topo map{{pluralize from text|{{if empty|{{{topo|}}}|{{{topo_map|}}} }}|likely=(s)|plural=s}}]]
| data52 = {{#if:{{{topo_maker|}}}|{{{topo_maker}}} }}{{if empty|{{{topo|}}}|{{{topo_map|}}} }}
| label53 = [[Biome]]
| data53 = {{{biome|}}}
| header62 = Geology
| label63 = [[Mountain formation|Formed by]]
| data63 = {{{formed_by|}}}
| label64 = [[Orogeny|{{pluralize from text|{{{orogeny|}}}|singular=Orogeny|plural=Orogenies}}]]
| data64 = {{{orogeny|}}}
| label65 = [[Geologic time scale|Rock age{{pluralize from text|{{{age|}}}|likely=(s)|plural=s}}]]
| data65 = {{{age|}}}
| label66 = {{longitem|[[List of mountain types|Mountain type{{pluralize from text|{{if empty|{{{mountain_type|}}}|{{{type|}}}}}|<!--
-->likely=(s)|plural=s}}]]}}
| data66 = {{if empty|{{{mountain_type|}}}|{{{type|}}}}}
| label67 = [[List of rock types|Rock type{{pluralize from text|{{if empty|{{{geology|}}}|{{{rock|}}}}}|likely=(s)|plural=s}}]]
| data67 = {{if empty|{{{geology|}}}|{{{rock|}}}}}
| label68 = Volcanic zone
| data68 = {{{volcanic_zone|}}}
| label69 = {{nowrap|[[Volcanic arc]]}}
| data69 = {{{volcanic_arc|}}}
| label70 = {{nowrap|[[Volcanic belt]]}}
| data70 = {{{volcanic_belt|}}}
| label71 = {{nowrap|[[Volcanic field]]}}
| data71 = {{{volcanic_field|}}}
| label73 = {{nowrap|[[volcanic eruption|Last eruption]]}}
| data73 = {{{last_eruption|}}}
| header80 = Climbing
| label81 = [[First ascent]]
| data81 = {{{first_ascent|}}}
| label82 = [[Normal route|{{nowrap|Easiest route}}]]
| data82 = {{{easiest_route|}}}
| label83 = [[Normal route]]
| data83 = {{{normal_route|}}}
| label84 = Access
| data84 = {{{access|}}}
| header85 = _BLANK_
| data86 = {{{embedded|}}}
| data87 = {{{module|}}}
}}{{main other|{{#if:{{{region|}}}|{{#ifeq:{{#invoke:string|replace|{{{region}}}|^[A-Z0-9/\-]*$|MATCH|plain=false}}|MATCH|[[Category:Pages using infobox mountain with unknown parameters|ρ]]
}}}}
}}{{#ifeq:{{if empty|{{{child|}}}|{{{embed|}}}}}|yes||{{Wikidata image |1={{{image|}}}{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}} |2={{{nocat_wdimage|}}}}}
}}{{main other|
{{#if:{{{language|}}}|[[Category:Pages using infobox mountain with language parameter|{{#invoke:string|replace|{{{language}}}|[^A-Za-z0-9]||plain=false}} ]]}}
}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox mountain with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox mountain]] with unknown parameter "_VALUE_"|ignoreblank=y|mapframe_args=y| pushpin_map_args = y | access | age | area | area_km2 | area_mi2 | area_ref | authority | biome | borders_on | child | coordinates | coordinates_ref | country | country_type | district | district_type | easiest_route | elevation | elevation_ft | elevation_m | elevation_ref | elevation_system | embed | embedded | etymology | fetchwikidata | first_ascent | formed_by | geology | grid_ref_Ireland | grid_ref_Ireland_ref | grid_ref_UK | grid_ref_UK_ref | highest | highest_location | image | image_alt | image_caption | image_map | image_map_caption | image_size | image_upright | isolation | isolation_km | isolation_mi | isolation_parent | isolation_ref | language | last_eruption | length | length_km | length_mi | length_orientation | length_ref | listing | location | map_alt | map_caption | map_size | map_upright | map_width | module | mountain_type | name | native_name | native_name_lang | nickname | nocat_wdimage | normal_route | onlysourced | orogeny | other_name | parent | parent_peak | part | part_type | prominence | prominence_ft | prominence_m | prominence_ref | pronunciation | qid | range | range_coordinates | range_coordinates_ref | refs | region | region_type | rock | settlement | settlement_type | state | state_type | subbox | subdivision1 | subdivision1_type | subdivision2 | subdivision2_type | subdivision3 | subdivision3_type | subdivision4 | subdivision4_type | suppressfields | topo | topo_maker | topo_map | translation | type | volcanic_arc | volcanic_belt | volcanic_field | volcanic_zone | volume | volume_km3 | volume_mi3 | volume_ref | width | width_km | width_mi | width_orientation | width_ref }}{{#invoke:Check for conflicting parameters|check
| template = [[Template:Infobox mountain]]
| cat = {{main other|Category:Pages using infobox mountain with conflicting parameters}}
| map_width; map_size
| subdivision1; state
| subdivision2; region
| subdivision3; district
| subdivision4; part
| parent; range
| topo; topo_map
| mountain_type; type
| geology; rock
| child; embed
}}<noinclude>
{{documentation}}
</noinclude>
nkd0rlmwjp4ivuzcr60fzzpqgeh8egc
75051
74767
2026-08-24T01:26:07Z
Robertsky
10424
translating labels
75051
wikitext
text/x-wiki
<includeonly>{{Infobox
| bodyclass = vcard
| child = {{{child|}}}
| subbox = {{{subbox|}}}
| above = {{if empty|{{{name|}}}|{{PAGENAMEBASE}}}}
| aboveclass = fn org
| autoheaders = y
| abovestyle = background-color: #E7DCC3;color:#000;
| headerstyle = background-color: #E7DCC3;color:#000;
| imagestyle = padding: 0.3em 0.2em 0.2em 0.2em;
| captionstyle = padding: 0.2em 0em;
| bodystyle = width:24.5em; line-height:1.5em;
| subheaderclass= nickname
| subheader = {{{other_name|}}}
| image = {{#invoke:InfoboxImage|InfoboxImage|image=<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->||size={{{image_size|}}}|upright={{{image_upright|}}}|sizedefault=272px|maxsize=288px|alt={{{image_alt|}}}}}
| caption = {{#if:{{{image|}}}|{{{image_caption|}}}|{{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2=|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}|<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2=|name=caption|qid={{{qid|}}}|qual=P2096|qualsonly=true|rank=best|maxvals=1|ps=2}}<!--
-->}}}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data36|data1}} = {{#if:{{{pushpin_map|}}}
| <div style="padding:0.2em 0.2em 0.5em 0.2em;">{{#invoke:Location map|infobox_pushpin_map
| default_width = 272
| max_width = 288
| pushpin_mark = Red triangle with thick white border.svg
| pushpin_mark_size = 16
| pushpin_relief = 1
| pushpin_label = {{{name|}}}
| coordinates = {{if empty|{{{range_coordinates|}}}|{{{coordinates|}}}}}
}}
</div>
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data37|data2}} = {{#if:{{{image_map|}}}
|<div style="padding:0.2em 0.2em {{#if:{{{image_map_caption|}}}{{{map_caption|}}}{{{location|}}}|0.5em|0.2em}} 0.2em;">{{#invoke:InfoboxImage
|InfoboxImage
|image={{{image_map|}}}
|size={{if empty|{{{map_width|}}}|{{{map_size|}}}}}
|upright={{{map_upright|}}}
|sizedefault=272px
|maxsize=288px
|alt={{{map_alt|}}}}}{{#switch:{{if empty|{{{image_map_caption|}}}|{{{map_caption|}}}}}|none|=|#default=<div>{{if empty|{{{image_map_caption|}}}|{{{map_caption|}}}}}</div>
}}</div>
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data38|data3}} = <!--
-->{{#invoke:Infobox mapframe
| auto
| onByDefault = {{#if:{{{image_map|}}}{{{pushpin_map|}}}|no|yes}}
| mapframe-coord = {{if empty|{{{mapframe-coordinates|}}}|{{{range_coordinates|}}}||{{{coordinates|}}}}}
| mapframe-frame-width = 250
| mapframe-wikidata = {{#if:{{{mapframe-coordinates|}}}{{{mapframe-coord|}}}{{{range_coordinates|}}}{{{coordinates|}}}|no|yes}}
| mapframe-marker = mountain
| mapframe-type = mountain
| mapframe-length_km = {{{length_km|}}}
| mapframe-length_mi = {{{length_mi|}}}
| mapframe-width_km = {{{width_km|}}}
| mapframe-width_mi = {{{width_mi|}}}
| mapframe-area_mi2 = {{{area_mi2|}}}
| mapframe-area_km2 = {{{area_km2|}}}
| mapframe-id = {{{qid|}}}
| mapframe-shape = yes
}}
| {{#if:<!--
-->{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}}<!--
-->|data39|data4}} = {{#invoke:Infobox mapframe
|autocaption
|onByDefault={{#if:{{{image_map|}}}{{{pushpin_map|}}}|no|yes}}
}}
| header5 = Pontu aas liu
| label6 = Tutun
| data6 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{highest|}}}|name=highest|qid={{{qid|}}}|qual=P2561|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|noicon=false}}<!--
-->|{{If last display both|, |<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{highest_location|}}}|name=highest_location|qid={{{qid|}}}|qual=P276|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|noicon=false}}<!--
-->}}}}
| label7 = [[:en:Summit|Elevasaun]]
| data7 = {{If empty|{{{elevation|}}}|{{#if:{{{elevation_m|}}}{{{elevation_ft|}}}|{{Convinfobox|{{{elevation_m|}}}|m|{{{elevation_ft|}}}|ft}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2=|name=elevation|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2044}}}}}}}}{{{elevation_ref|}}}{{If last display both|<br/>|<!--
-->{{#invoke:WikidataIB|getValue|1=P2044|2={{{elevation_system|}}}|name=elevation_system|qid={{{qid|}}}|qual=P459|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|maxvals=1|noicon=true}}<!--
-->}}
| label8 = [[:en:Topographic prominence|Prominénsia]]
| data8 = {{If empty|{{{prominence|}}}|{{#if:{{{prominence_m|}}}{{{prominence_ft|}}}|{{Convinfobox|{{{prominence_m|}}}|m|{{{prominence_ft|}}}|ft}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2660|2=|name=prominence|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2660}}}}}}}}{{#if:{{{prominence_ref|}}}|{{{prominence_ref|}}}}}
| label9 = [[:en:Topographic prominence#Prominence parentage|Piku inan-aman nian]]
| data9 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P3137|2={{{parent_peak|}}}|name=parent_peak|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|shortname=true|maxvals=1|noicon=false|replacetext={{#ifeq:{{{fetchwikidata|}}}|ALL||[[Category:Wikidata value to be checked for Infobox mountain]]}}<!--
-->}}|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P3137}}}}}}
| label10 = [[:en:Topographic isolation|Izolamentu]]
| data10 = {{If empty|{{{isolation|}}}|{{#if:{{{isolation_km|}}}{{{isolation_mi|}}}|{{Convinfobox|{{{isolation_km|}}}|km|{{{isolation_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2659|2=|name=isolation|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|maxvals=1|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2659}}}}}}}}{{If last display both|<br/>to |<!--
-->{{#invoke:WikidataIB|getValue|1=P2659|2={{{isolation_parent|}}}|name=isolation_parent|qid={{{qid|}}}|qual=P2210|qualsonly=Y|fetchwikidata={{if empty|{{{fetchwikidata|}}}|ALL}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|maxvals=1|noicon=true}}<!--
-->}}{{#if:{{{isolation_ref|}}}|{{{isolation_ref|}}}}}
| class11 = category
| label11 = [[:en:Lists of mountains|Lista]]
| data11 = {{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P361|2={{{listing|}}}|name=listing|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|qshortname=true|sorted=true|noicon=false|list=ubl|replacetext={{#ifeq:{{{fetchwikidata|}}}|ALL||[[Category:Wikidata value to be checked for Infobox mountain]]}}<!--
-->}}|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P3137}}}}}}
| label12 = Koordenasaun sira
| data12 = {{#if:{{{coordinates|}}}|{{#invoke:Coordinates|coordinsert|{{{coordinates|}}}|type:mountain|{{#if:{{{range_coordinates|}}}||scale:{{Map scale|type=mountain|<!--
-->length_km={{{length_km|}}}|length_mi={{{length_mi|}}}|width_km={{{width_km|}}}|width_mi={{{width_mi|}}}|<!--
-->area_mi2={{{area_mi2|}}}|area_km2={{{area_km2|}}}}}}}}}<!--
-->{{{coordinates_ref|}}} }}
| header20 = Dimensaun sira
| label21 = Naruk
| data21 = {{If first display both|{{If empty|{{{length|}}}|{{#if:{{{length_km|}}}{{{length_mi|}}}|{{Convinfobox|{{{length_km|}}}|km|{{{length_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2043|2=|name=length|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2043}}}}}}}}|{{If last display both| |{{If empty|{{{length_orientation|}}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2043|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q36477|nomatch=}}<!--
-->|Q36477|(NS)|}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2043|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q34027|nomatch=}}<!--
-->|Q34027|(EW)|}}}}}}{{{length_ref|}}}}}
| label22 = Belar
| data22 = {{If first display both|{{If empty|{{{width|}}}|{{#if:{{{width_km|}}}{{{width_mi|}}}|{{Convinfobox|{{{width_km|}}}|km|{{{width_mi|}}}|mi}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2049|2=|name=width|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2049}}}}}}}}|{{If last display both| |{{If empty|{{{width_orientation|}}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2049|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q36477|nomatch=}}<!--
-->|Q36477|(NS)|}}|{{#ifeq:{{#invoke:String|match|s=<!--
-->{{#invoke:WikidataIB|getQualifierIDs|1=P2049|2=|qid={{{qid|}}}|fwd=ALL|osd=n|qlist=P7469}}|pattern=Q34027|nomatch=}}<!--
-->|Q34027|(EW)|}}}}}}{{{width_ref|}}}}}
| label23 = Área
| data23 = {{If first display both|{{If empty|{{{area|}}}|{{#if:{{{area_km2|}}}{{{area_mi2|}}}|{{Convinfobox|{{{area_km2|}}}|km2|{{{area_mi2|}}}|mi2}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2046|2=|name=area|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2046}}}}}}}}|{{{area_ref|}}}}}
| label24 = Volume
| data24 = {{If first display both|{{If empty|{{{volume|}}}|{{#if:{{{volume_km3|}}}{{{volume_mi3|}}}|{{Convinfobox|{{{volume_km3|}}}|km3|{{{volume_mi3|}}}|mi3}}|}}|{{If first display both|<!--
-->{{#invoke:WikidataIB|getValue|1=P2234|2=|name=volume|qid={{{qid|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|suppressfields={{{suppressfields|}}}|onlysourced=true|unitabbr=true|convert=true|noicon=true}}<!--
-->|{{#ifeq:{{if empty|{{{refs|}}}|no}}|yes|{{Wikidata|references|normal+|{{{qid|}}}|P2234}}}}}}}}|{{{volume_ref|}}}}}
| header25 = Fó naran
| label26 = [[:en:Etymology]]
| data26 = {{{etymology|}}}
| class27 = nickname
| label27 = [[Naran bolu|Naran bolu{{pluralize from text|{{{nickname|}}}|likely=(s)|plural= sira}}]]
| data27 = {{{nickname|}}}
| class28 = nickname
| label28 = Naran rai-na'in
| data28 = {{native name checker|{{{native_name|}}}}}
| label29 = {{longitem|Tradusaun Tetun}}
| data29 = {{{translation|}}}
| label30 = {{longitem|Lian naran nian}}
| data30 = {{#if:{{{native_name|}}}||<!--
-->{{#if:{{{language|}}}|{{{language}}}|<!--
-->{{#if:{{{native_name_lang|}}}|{{ISO 639 name|{{{native_name_lang|}}}|link=yes}}}}}}}}
| label31 = Pronunsia
| data31 = {{{pronunciation|}}}
| label32 = {{longitem|Definisaun ba autoridade}}
| data32 = {{{authority|}}}
| header35 = Jeografia
<!-- data36 <=> data1 reserved for map when image is present -->
<!-- data37 <=> data2 reserved for map image when image is present -->
<!-- data38+data39 <=> data3+data4 mapframe slots -->
| class40 = label
| label40 = Lokál
| data40 = {{{location|}}}
| class41 = label
| label41 = {{longitem|{{If empty|{{{country_type|}}}|{{pluralize from text|{{{country|}}}|singular=Nasaun|plural=Nasaun sira}}}}}}
| data41 = {{{country|}}}
| class42 = label
| label42 = {{longitem|{{If empty|{{{subdivision1_type|}}}|{{{state_type|}}}|Estadu{{pluralize from text|{{if empty|{{{subdivision1|}}}|{{{state|}}}}}|likely= (sira)|plural= sira}}}}}}
| data42 = {{if empty|{{{subdivision1|}}}|{{{state|}}}}}
| class43 = label
| label43 = {{longitem|{{If empty|{{{subdivision2_type|}}}|{{{region_type|}}}|Rejiaun{{pluralize from text|{{if empty|{{{subdivision2|}}}|{{{region|}}}}}|likely= (sira)|plural= sira}}}}}}
| data43 = {{if empty|{{{subdivision2|}}}|{{{region|}}}}}
| class44 = label
| label44 = {{longitem|{{If empty|{{{subdivision3_type|}}}|{{{district_type|}}}|Distritu{{pluralize from text|{{if empty|{{{subdivision3|}}}|{{{district|}}}}}|likely= (sira)|plural=sira}}}}}}
| data44 = {{if empty|{{{subdivision3|}}}|{{{district|}}}}}
| label45 = {{longitem|{{If empty|{{{subdivision4_type|}}}|{{{part_type|}}}|Subdivizaun{{pluralize from text|{{if empty|{{{subdivision4|}}}|{{{part|}}}}}|likely= (sira)|plural= sira}}}}}}
| data45 = {{if empty|{{{subdivision4|}}}|{{{part|}}}}}
| label46 = {{longitem|{{If empty|{{{settlement_type|}}}|Asentamentu{{pluralize from text|{{{settlement|}}}|likely= (sira)|plural= sira}}}}}}
| data46 = {{{settlement|}}}
| label47 = {{longitem|Koordenasaun sira hosi foho-lolon}}
| data47 = {{#if:{{{range_coordinates|}}}|{{#invoke:Coordinates|coordinsert|{{{range_coordinates|}}}||type:mountain|scale:{{Map scale|type=mountain|<!--
-->length_km={{{length_km|}}}|length_mi={{{length_mi|}}}|width_km={{{width_km|}}}|width_mi={{{width_mi|}}}|<!--
-->area_mi2={{{area_mi2|}}}|area_km2={{{area_km2|}}}}}}}<!--
-->{{{range_coordinates_ref|}}}}}
| class48 = category
| label48 = [[:en:Mountain range|{{nowrap|Foho-lolon}}]]
| data48 = {{if empty|{{{parent|}}}|{{{range|}}}}}
| label49 = Fronteira sira iha
| data49 = {{{borders_on|}}}
| label50 = [[Ordnance Survey National Grid|OS grid]]
| data50 = {{#if:{{{grid_ref_UK|}}}|{{Gbmappingsmall|{{{grid_ref_UK|}}}|name={{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} }}{{{grid_ref_UK_ref|}}}}}
| label51 = [[Irish grid reference system|OSI/OSNI grid]]
| data51 = {{#if:{{{grid_ref_Ireland|}}}|{{iem4ibx|{{{grid_ref_Ireland|}}}|name={{if empty|{{{name|}}}|{{PAGENAMEBASE}}}} }}{{{grid_ref_Ireland_ref|}}}}}
| label52 = [[Topographic map|Topo map{{pluralize from text|{{if empty|{{{topo|}}}|{{{topo_map|}}} }}|likely=(s)|plural=s}}]]
| data52 = {{#if:{{{topo_maker|}}}|{{{topo_maker}}} }}{{if empty|{{{topo|}}}|{{{topo_map|}}} }}
| label53 = [[:en|Bioma]]
| data53 = {{{biome|}}}
| header62 = Geology
| label63 = [[:en:Mountain formation|Formasaun foho nian]]
| data63 = {{{formed_by|}}}
| label64 = [[:en:Orogeny|{{pluralize from text|{{{orogeny|}}}|singular=Orojéniu|plural=Orojéniu sira}}]]
| data64 = {{{orogeny|}}}
| label65 = [[:en:Geologic time scale|Fatuk nia idade]]
| data65 = {{{age|}}}
| label66 = {{longitem|[[:en:List of mountain types|Tipu foho{{pluralize from text|{{if empty|{{{mountain_type|}}}|{{{type|}}}}}|<!--
-->likely= (sira)|plural= sira}}]]}}
| data66 = {{if empty|{{{mountain_type|}}}|{{{type|}}}}}
| label67 = [[:en:List of rock types|Tipu fatuk{{pluralize from text|{{if empty|{{{geology|}}}|{{{rock|}}}}}|likely= (sira)|plural= sira}}]]
| data67 = {{if empty|{{{geology|}}}|{{{rock|}}}}}
| label68 = Zona vulkánika
| data68 = {{{volcanic_zone|}}}
| label69 = {{nowrap|[[:en:Volcanic arc|Arku vulkániku]]}}
| data69 = {{{volcanic_arc|}}}
| label70 = {{nowrap|[[:en:Volcanic belt|Sintu vulkániku]]}}
| data70 = {{{volcanic_belt|}}}
| label71 = {{nowrap|[[:en:Volcanic field|Kampu vulkániku]]}}
| data71 = {{{volcanic_field|}}}
| label73 = {{nowrap|[[:en:volcanic eruption|Erupsaun ikus]]}}
| data73 = {{{last_eruption|}}}
| header80 = Sa'e foho
| label81 = [[:en:First ascent|Sa'e dahuluk]]
| data81 = {{{first_ascent|}}}
| label82 = [[:en:Normal route|{{nowrap|Dalan ne'ebé fasil liu}}]]
| data82 = {{{easiest_route|}}}
| label83 = [[:en:Normal route|Rota normál]]
| data83 = {{{normal_route|}}}
| label84 = Asesu
| data84 = {{{access|}}}
| header85 = _BLANK_
| data86 = {{{embedded|}}}
| data87 = {{{module|}}}
}}{{main other|{{#if:{{{region|}}}|{{#ifeq:{{#invoke:string|replace|{{{region}}}|^[A-Z0-9/\-]*$|MATCH|plain=false}}|MATCH|[[Category:Pages using infobox mountain with unknown parameters|ρ]]
}}}}
}}{{#ifeq:{{if empty|{{{child|}}}|{{{embed|}}}}}|yes||{{Wikidata image |1={{{image|}}}{{#invoke:WikidataIB|getValue|1=P18|2={{{image|}}}|name=image|qid={{{qid|}}}|rank=best|suppressfields={{{suppressfields|}}}|fetchwikidata={{if empty|{{{fetchwikidata|}}}|NONE}}|onlysourced={{if empty|{{{onlysourced|}}}|false}}|maxvals=1|noicon=true}} |2={{{nocat_wdimage|}}}}}
}}{{main other|
{{#if:{{{language|}}}|[[Category:Pages using infobox mountain with language parameter|{{#invoke:string|replace|{{{language}}}|[^A-Za-z0-9]||plain=false}} ]]}}
}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using infobox mountain with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Infobox mountain]] with unknown parameter "_VALUE_"|ignoreblank=y|mapframe_args=y| pushpin_map_args = y | access | age | area | area_km2 | area_mi2 | area_ref | authority | biome | borders_on | child | coordinates | coordinates_ref | country | country_type | district | district_type | easiest_route | elevation | elevation_ft | elevation_m | elevation_ref | elevation_system | embed | embedded | etymology | fetchwikidata | first_ascent | formed_by | geology | grid_ref_Ireland | grid_ref_Ireland_ref | grid_ref_UK | grid_ref_UK_ref | highest | highest_location | image | image_alt | image_caption | image_map | image_map_caption | image_size | image_upright | isolation | isolation_km | isolation_mi | isolation_parent | isolation_ref | language | last_eruption | length | length_km | length_mi | length_orientation | length_ref | listing | location | map_alt | map_caption | map_size | map_upright | map_width | module | mountain_type | name | native_name | native_name_lang | nickname | nocat_wdimage | normal_route | onlysourced | orogeny | other_name | parent | parent_peak | part | part_type | prominence | prominence_ft | prominence_m | prominence_ref | pronunciation | qid | range | range_coordinates | range_coordinates_ref | refs | region | region_type | rock | settlement | settlement_type | state | state_type | subbox | subdivision1 | subdivision1_type | subdivision2 | subdivision2_type | subdivision3 | subdivision3_type | subdivision4 | subdivision4_type | suppressfields | topo | topo_maker | topo_map | translation | type | volcanic_arc | volcanic_belt | volcanic_field | volcanic_zone | volume | volume_km3 | volume_mi3 | volume_ref | width | width_km | width_mi | width_orientation | width_ref }}{{#invoke:Check for conflicting parameters|check
| template = [[Template:Infobox mountain]]
| cat = {{main other|Category:Pages using infobox mountain with conflicting parameters}}
| map_width; map_size
| subdivision1; state
| subdivision2; region
| subdivision3; district
| subdivision4; part
| parent; range
| topo; topo_map
| mountain_type; type
| geology; rock
| child; embed
}}<noinclude>
{{documentation}}
</noinclude>
fvhvariqlkcjmxv1y9ku3lo6tpp91um
Template:Native name checker
10
8937
74772
2022-01-15T17:59:39Z
en>MusikBot II
0
Changed protection settings for "[[Template:Native name checker]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 56735 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74772
wikitext
text/x-wiki
<includeonly>{{#invoke:native name|native_name_checker}}</includeonly><noinclude>{{documentation}}</noinclude>
ngh8pjh6mh5hws7dm7zaxylonxycbv5
74773
74772
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Template:Native_name_checker]]
74772
wikitext
text/x-wiki
<includeonly>{{#invoke:native name|native_name_checker}}</includeonly><noinclude>{{documentation}}</noinclude>
ngh8pjh6mh5hws7dm7zaxylonxycbv5
Template:If first display both
10
8938
74774
2025-08-05T05:10:51Z
en>Theknightwho
0
Make substable.
74774
wikitext
text/x-wiki
{{safesubst:<noinclude/>#if:{{{1|}}}|{{{1|}}}{{{2|}}}}}<noinclude>
{{documentation}}
</noinclude>
g0vqsy7hot1s82tjgi9hcxawzirr5ds
74775
74774
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Template:If_first_display_both]]
74774
wikitext
text/x-wiki
{{safesubst:<noinclude/>#if:{{{1|}}}|{{{1|}}}{{{2|}}}}}<noinclude>
{{documentation}}
</noinclude>
g0vqsy7hot1s82tjgi9hcxawzirr5ds
Template:If last display both
10
8939
74776
2025-08-05T05:12:16Z
en>Theknightwho
0
Make substable.
74776
wikitext
text/x-wiki
{{safesubst:<noinclude/>#if:{{{2|}}}|{{{1|}}}{{{2|}}}}}<noinclude>
{{Documentation}}
</noinclude>
iixsn6gmy5v6zp1aqm79vhpce8m4a1b
74777
74776
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Template:If_last_display_both]]
74776
wikitext
text/x-wiki
{{safesubst:<noinclude/>#if:{{{2|}}}|{{{1|}}}{{{2|}}}}}<noinclude>
{{Documentation}}
</noinclude>
iixsn6gmy5v6zp1aqm79vhpce8m4a1b
Template:Gbmappingsmall
10
8940
74778
2020-09-01T00:17:20Z
en>Ahecht
0
Reduce [[WP:PEIS]]
74778
wikitext
text/x-wiki
{{#if:{{{1|}}}|{{#invoke:Ordnance Survey coordinates|oscoord|{{{1}}}_region:GB_scale:25000|{{{1}}}|name={{{name|}}}}}}}<noinclude>
{{documentation|Template:Gbmapping/doc}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
bik3k9eqsrek54u144chkeqshqfg88l
74779
74778
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Template:Gbmappingsmall]]
74778
wikitext
text/x-wiki
{{#if:{{{1|}}}|{{#invoke:Ordnance Survey coordinates|oscoord|{{{1}}}_region:GB_scale:25000|{{{1}}}|name={{{name|}}}}}}}<noinclude>
{{documentation|Template:Gbmapping/doc}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
bik3k9eqsrek54u144chkeqshqfg88l
Módulo:Ordnance Survey coordinates
828
8941
74780
2026-06-13T03:13:40Z
en>Hike395
0
restore tracking cat
74780
Scribunto
text/plain
--[[ Ordnance Survey / Lat Long functions in Lua
****** ORDNANCE SURVEY TO LAT LONG FUNCTIONS ******
Ported to Lua from PHP by Wikipedia User Hike395, 18 Aug 2019
found by RWH at http://www.megalithia.com/search/llfuncshighlight.php
With thanks to Andy, G4JNT for inspiration in GEOG, and to the OSGB for their white paper on coordinate transformation
describing the iterative method used
thanks to the Ordnance survey of Ireland for details of the true and false origins of the Irish grid
You may use and redistribute this code under the terms of the GPL see http://www.gnu.org/copyleft/gpl.html
Written by Richard
www.megalithia.com
v0.something 27/2/2000
v 1.01 28 June 2004
v 1.02 6 Aug 2004 line 89 add "0" to chars in ngr=stripcharsnotinbag Thx Andy
v 1.03 9 Mar 2005 Jan (Klingon) added conversion to WGS84 map datum and removed limitation of digits of the grid ref
v 1.04 10 Aug 2005 Richard correct error trapping (only manifest on malformed ngrs
This code is predicated on the assumption that your are ONLY feeding it Irish or UK Grid references.
It uses the single char prefix of Irish grid refs to tell the difference, UK grid refs have a two letter prefix.
We would like an even number of digits for the rest of the grid ref.
Anything in the NGR other than 0-9, A-Z, a-z is eliminated.
WARNING this assumes there are no decimal points in your NGR components.
The transformation from OSGB36/Ireland 1965 to WGS84 is more precise than 5 m.
The function is case insensitive
Lat/Long to Ordnance Survey conversion is at bottom of file, see further authorship there
]]
local oscoord = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local namespace = mw.title.getCurrentTitle().namespace
local pow = math.pow
local sqrt = math.sqrt
local abs = math.abs
local floor = math.floor
local ceil = math.ceil
local sin = math.sin
local cos = math.cos
local tan = math.tan
local atan = math.atan2
local deg2rad = math.rad
local rad2deg = math.deg
--[[ DATUM SHIFT USING HELMERT TRANSFORMATION
*
* height above the ellipsoid is ignored
* latitude and longitude must be given in decimal degrees
*
* no transformation if abs(latitude)>89 or abs(longitude)>89
* (lifting this restriction requires some more lines of code)
*
* Written in 2009 by user Telford at de.wikipedia
* Based on math described in "A Guide to Coordinate Systems in Great Britain"
* by the UK Ordnance Survey
* URL: https://www.ordnancesurvey.co.uk/documents/resources/guide-coordinate-systems-great-britain.pdf
]]
-- Datum parameters
local data = mw.loadData('Module:Ordnance Survey coordinates/data')
local OSGBglobe = data.OSGBglobe
local IEglobe = data.IEglobe
local WGSglobe = data.WGSglobe
local WGS2OSGBparam = data.WGS2OSGBparam
local OSGB2WGSparam = data.OSGB2WGSparam
local IE2WGSparam = data.IE2WGSparam
local function HelmertDatumShift ( latitude , longitude, param )
-- latitude and longitude are in degrees
param = param or WGS2OSGBparam
-- parameters for ellipsoids
-- Annex A.1, Ordnance Survey document --
local a1 = param.semimajor_src
local b1 = param.semiminor_src
local e1 = param.ecc_src
local a2 = param.semimajor_dst
local b2 = param.semiminor_dst
local e2 = param.ecc_dst
-- convert latitude and longitude to cartesian coordinates
-- math in Annex B.1, Ordnance Survey document
local phi = deg2rad ( latitude )
local lambda = deg2rad ( longitude )
local cosphi = cos ( phi )
local sinphi = sin ( phi )
local coslambda = cos ( lambda )
local sinlambda = sin ( lambda )
local ny = a1 / sqrt ( 1. - e1*sinphi*sinphi )
local x1 = ny * cosphi * coslambda
local y1 = ny * cosphi * sinlambda
local z1 = ny * ( 1. - e1 ) * sinphi
-- the helmert transformation proper
-- Equation 3, Section 6.2, Ordnance Survey document
local x2 = x1 + param.tx + ( param.s0 * x1 - param.rz * y1 + param.ry * z1 )
local y2 = y1 + param.ty + ( param.rz * x1 + param.s0 * y1 - param.rx * z1 )
local z2 = z1 + param.tz + ( -param.ry *x1 + param.rx * y1 + param.s0 * z1 )
-- convert cartesian coordinates to latitude and longitude
-- math in Annex B.2, of Ordnance Survey document
lambda = atan ( y2, x2 )
local p2 = sqrt ( x2*x2 + y2*y2 )
phi = atan ( z2, p2*(1.-e2) )
local n0 = 101
local phi_alt
repeat
phi_alt = phi
ny = a2 / sqrt ( 1. - e2 * sin(phi) * sin(phi) )
phi = atan ( z2 + e2 * ny * sin(phi), p2)
n0 = n0 - 1
until abs ( phi - phi_alt ) <= 0.000000000001 or n0 <= 0
return {lat=rad2deg(phi),lon=rad2deg(lambda)}
end
-- LAT LONG TO OS GRID LIBRARY RESUMES HERE
local function northeast(lett,num,shift)
-- split into northings and eastings
local le=mw.ustring.len(num)
if le%2 == 1 then
return {err="Malformed numerical part of NGR"}
end
local pr=le/2
local n = mw.ustring.sub(num,pr+1)
local e = mw.ustring.sub(num,1,pr)
-- Hack to move to center of square: append a 5 to northings and eastings
shift = yesno(shift)
if shift then
n = n.."5"
e = e.."5"
pr = pr+1
end
-- end hack
n = n == '' and 0 or n
e = e == '' and 0 or e
pr = pow(10.0,(5.0-pr))
local T1 = mw.ustring.byte(mw.ustring.sub(lett,1,1))-65
if T1>8 then
T1 = T1-1
end
local T2 = nil
if mw.ustring.len(lett)>1 then
T2 = mw.ustring.byte(mw.ustring.sub(lett,2))-65
if T2>8 then
T2 = T2-1
end
end
return {n=n,e=e,pr=pr,T1=T1,T2=T2}
end
local function EN2LL(e,n,datum)
local a = datum.semimajor*datum.scale
local b = datum.semiminor*datum.scale
local lat0rad = deg2rad(datum.lat0)
local n1 = datum.n1
local n12 = n1*n1
local n13 = n12*n1
local k=(n-datum.n0)/a+lat0rad
local nextcounter=0
local j3, j4, j5, j6, m
repeat
nextcounter=nextcounter+1
local k3=k-lat0rad
local k4=k+lat0rad
j3=(1.0+n1+1.25*n12+1.25*n13)*k3
j4=(3.0*n1+3.0*n12+2.625*n13)*sin(k3)*cos(k4)
j5=(1.875*n12+1.875*n13)*sin(2.0*k3)*cos(2.0*k4)
j6=35.0/24.0*n13*sin(3.0*k3)*cos(3.0*k4)
m=b*(j3-j4+j5-j6)
k=k+(n-datum.n0-m)/a
until abs(n-datum.n0-m)<=0.000000001 or nextcounter>=100
local x = 1.0-datum.ecc*pow(sin(k),2.0)
local v=a/sqrt(x)
local r=v*(1.0-datum.ecc)/x
local h2=v/r-1.0
local y1=e-datum.e0
local tank = tan(k)
local tank2 = tank*tank
local tank4 = tank2*tank2
local tank6 = tank2*tank4
local cosk = cos(k)
local yv = y1/v -- dimensionless quantity in series expansion
local yv2 = yv*yv
local yv3 = yv*yv2
local yv5 = yv3*yv2
local yv7 = yv5*yv2
j3=tank/(2.0*r)
j4=tank/(24.0*r)*(5.0+3.0*tank2+h2-9.0*tank2*h2)
j5=tank/(720.0*r)*(61.0+90.0*tank2+45.0*tank4)
local k9=k-y1*(yv*j3+yv3*j4-yv5*j5)
j6=1.0/(cosk)
local j7=1.0/(cosk*6.0)*(v/r+2.0*tank2)
local j8=1.0/(cosk*120.0)*(5.0+28.0*tank2+24.0*tank4)
local j9=1.0/(cosk*5040.0)
j9=j9*(61.0+662.0*tank2+1320.0*tank4+720.0*tank6)
local long=datum.lon0+rad2deg(yv*j6-yv3*j7+yv5*j8-yv7*j9)
local lat=rad2deg(k9)
return {lat=lat,lon=long}
end
local function GBEN2LL(e,n,direct)
-- no need to compute lat/long if GB has direct link
if direct then
return {region="GB",e=e,n=n}
end
local latlong = EN2LL(e,n,OSGBglobe)
local helmert = HelmertDatumShift ( latlong.lat, latlong.lon, OSGB2WGSparam)
return {region="GB",lat=helmert.lat,long=helmert.lon}
end
local function GB2LL(lett,num,direct)
-- British OS to Lat+Long
-- first caclulate e,n
-- computing e and n exactly, to get SW corner of box
local ne = northeast(lett,num)
if ne.err then
return {region="GB",err=ne.err}
end
-- use British definition of e and n
local e=500000.0*(ne.T1%5)+100000.0*(ne.T2%5)-1000000.0+ne.e*ne.pr
local n=1900000.0-500000.0*floor(ne.T1/5)-100000.0*floor(ne.T2/5)+ne.n*ne.pr
local result = GBEN2LL(e,n,direct)
result.prec = 0.8165*ne.pr
return result
end
local function IrishEN2LL(e,n)
local latlong = EN2LL(e,n,IEglobe)
local helmert = HelmertDatumShift ( latlong.lat, latlong.lon, IE2WGSparam)
return {region="IE",lat=helmert.lat,long=helmert.lon}
end
local function Irish2LL(lett,num)
-- Irish OS to Lat+Long
-- first caclulate e,n
-- computing e and n exactly, to get SW corner of box
local ne = northeast(lett,num)
if ne.err then
return {region="IE", err=ne.err}
end
-- use Irish definition of northing and easting
local e=100000.0*(ne.T1%5.0)+ne.e*ne.pr
local n=ne.n*ne.pr+100000.0*(4.0-floor(ne.T1/5.0))
local result = IrishEN2LL(e,n)
result.prec = 0.8165*ne.pr -- useful @ Commons
return result
end
local function empty(s)
return not s or s == ''
end
local function NGR2LL(ngr,direct)
local _ = 0
ngr, _ = mw.ustring.gsub(mw.ustring.upper(ngr),"[%s%p]","")
local first, last, lett, num = mw.ustring.find(ngr,"^([A-Z]+)(%d+)$")
if not first or empty(lett) or empty(num) or mw.ustring.len(lett) > 2 then
return {err="Malformed NGR"}
end
if mw.ustring.len(lett) == 1 then
return Irish2LL(lett,num)
end
return GB2LL(lett, num, direct)
end
local function split(s,sep)
-- split a string s into chunks, separated by sep
sep = sep or "%s"
local t = {}
for chunk in mw.ustring.gmatch(s,"([^"..sep.."]+)") do
table.insert(t,chunk)
end
return t
end
local function trim(s)
local _ = 0
s, _ = mw.ustring.gsub(s,"^%s+","")
s, _ = mw.ustring.gsub(s,"%s+$","")
return s
end
local function alldigits(s)
return not mw.ustring.find(s,"%D")
end
local function warning(errmsg)
local preview = require('Module:If preview')
local msg = errmsg or 'Empty OS grid ref'
local html = preview._warning({ msg })
if namespace == 0 and errmsg then
html = html..'[[Category:Pages with malformed OS coordinates]]'
end
return html
end
-- generate URL of geohack map
local function geohack(main_args, other_args, LL)
-- create geohack link. Example:
-- https://geohack.toolforge.org/geohack.php?pagename=Mount_Whitney¶ms=36.578580925_N_118.29199495_W_type:mountain_region:US-CA_scale:100000_source:NGS
local url = 'https://geohack.toolforge.org/geohack.php?'
local input = main_args[1]
local namearg = main_args["name"]
local current_page = mw.title.getCurrentTitle()
local pagename = mw.uri.encode( current_page.prefixedText, 'WIKI' )
if not empty(pagename) then
url = url..'pagename='..pagename..'&'
end
url = url..'params='..mw.ustring.format('%.6f',LL.lat)..'_N_'
if LL.long < 0 then
url = url..mw.ustring.format('%.6f',-LL.long)..'_W'
else
url = url..mw.ustring.format('%.6f',LL.long)..'_E'
end
for _, a in ipairs(other_args) do
url = url..'_'..a
end
if not mw.ustring.find(input,"region") and LL.region then
url = url..'_region:'..LL.region
end
if not mw.ustring.find(input,"scale") and
not mw.ustring.find(input,"type") and
not mw.ustring.find(input,"dim") and LL.prec then
url = url..'_dim:'..floor(50*LL.prec+0.5)..'m'
end
if not empty(namearg) then
url = url .. "&title=" .. mw.uri.encode(namearg)
end
return url
end
local function dimArgs(other_args, LL)
local args = {}
for _, a in ipairs(other_args) do
local splitOut = mw.text.split(a, ':', true)
args[splitOut[1]] = splitOut[2]
end
if not args.scale and not args.type and not args.dim then
args.dim = LL.prec and tostring(floor(50*LL.prec+0.5))..'m'
end
args.viewport_cm = 10
return args
end
-- function to generate direct link to OS map for both GB and IE
local function generalDirectLink(other_args, LL)
-- create direct link to OS maps. The template is
-- https://explore.osmaps.com/pin?lat={latdegdec}&lon={londegdec}&zoom={osmzoom}&overlays=&style=Standard&type=2d
local args = dimArgs(other_args, LL)
local zoom = require('Module:Infobox dim')._zoom
local lvl = zoom(args) or 12
local url = mw.ustring.format('https://explore.osmaps.com/pin?lat=%.6f&lon=%.6f&zoom=%d&overlays=&style=Standard&type=2d',
LL.lat,LL.long,lvl)
return url
end
-- function to generate direct link to OS map for GB only
local function GBDirectLink(other_args, LL)
-- create direct link to OS maps. The template is
-- http://streetmap.co.uk/grid/{osgb36easting}_{osgb36northing}_120
local args = dimArgs(other_args, LL)
local scaleFcn = require('Module:Infobox dim')._scale
local scale = scaleFcn(args) or 50000
scale = scale*scale
local level
if scale < 2500*5000 then
level = 106
elseif scale < 5000*25000 then
level = 110
elseif scale < 25000*50000 then
level = 115
elseif scale < 50000*100000 then
level = 120
elseif scale < 100000*200000 then
level = 126
elseif scale < 200000*500000 then
level = 130
elseif scale < 500000*1000000 then
level = 140
else
level = 150
end
return mw.ustring.format('http://streetmap.co.uk/grid/%d_%d_%d', LL.e, LL.n, level)
end
function oscoord._main(main_args)
local input = main_args[1]
if empty(input) then
return warning(nil)
end
local linktitle = main_args[2]
local rawurl = yesno(main_args["rawurl"])
local direct = yesno(main_args["direct"])
local args = split(input,'_')
local LL
local restargs = 1
if #args >= 2 and alldigits(args[2]) then
if mw.ustring.sub(args[1],1,1) == 'i' then
local firstArg = mw.ustring.sub(args[1],2)
if alldigits(firstArg) then
LL = IrishEN2LL(firstArg,args[2])
restargs = 3
if empty(linktitle) then
linktitle=args[1]..'_'..args[2]
end
end
elseif alldigits(args[1]) then
LL = GBEN2LL(args[1],args[2],direct)
restargs = 3
if empty(linktitle) then
linktitle=args[1]..'_'..args[2]
end
end
else
LL = NGR2LL(args[1],direct)
restargs = 2
if empty(linktitle) then
linktitle=args[1]
end
end
linktitle = trim(linktitle)
if not empty(LL.err) then
return linktitle ..warning(LL.err)
end
LL.lat = LL.lat or 0
LL.long = LL.long or 0
LL.lat = ceil(LL.lat*1000000)/1000000
LL.long = ceil(LL.long*1000000)/1000000
local other_args = {}
for i = restargs, #args do
table.insert(other_args, args[i])
end
local url
if not direct then
url = geohack(main_args, other_args, LL)
elseif LL.region ~= 'GB' then
url = generalDirectLink(other_args, LL)
else
url = GBDirectLink(other_args, LL)
end
if not rawurl then
url = mw.ustring.format('<span class="nourlexpansion%s" style="white-space:nowrap">[%s %s]</span>%s',
direct and '' or ' plainlinks',
url,linktitle,
namespace == 0 and '[[Category:Articles with OS grid coordinates]]' or '')
end
return url
end
function oscoord.main(frame)
local args = getArgs(frame)
return oscoord._main(args)
end
function oscoord.oscoord(frame)
local args = getArgs(frame)
return oscoord._main(args)
end
--[[
****** LAT/LONG CONVERSION TO OS GRID REF FUNCTIONS *****
* Uses the WGS-84 ellipsoid and only works for GB grid ref
*
* See also:
* http://www.posc.org/Epicentre.2_2/DataModel/ExamplesofUsage/eu_cs34h.html
* http://kanadier.gps-info.de/d-utm-gitter.htm
* http://www.gpsy.com/gpsinfo/geotoutm/
* http://www.colorado.edu/geography/gcraft/notes/gps/gps_f.html
* http://search.cpan.org/src/GRAHAMC/Geo-Coordinates-UTM-0.05/
* UK Ordnance Survey grid (OSBG36): http://www.gps.gov.uk/guidecontents.asp
* Swiss CH1903: http://www.gps.gov.uk/guidecontents.asp
*
* ----------------------------------------------------------------------
*
* Copyright 2005, Egil Kvaleberg <egil@kvaleberg.no>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Converted to Lua by User:Hike395 on 2023-12-15
]]
local function find_M ( lat_rad )
local e = OSGBglobe.ecc
local e2 = e*e
local e3 = e*e*e
return OSGBglobe.semimajor * ( ( 1 - e/4 - 3 * e2/64
- 5 * e3/256
) * lat_rad
- ( 3 * e/8 + 3 * e2/32
+ 45 * e3/1024
) * sin(2 * lat_rad)
+ ( 15 * e2/256 +
45 * e3/1024
) * sin(4 * lat_rad)
- ( 35 * e3/3072
) * sin(6 * lat_rad) )
end
--[[
* Convert latitude, longitude in decimal degrees to
* Transverse Mercator Easting and Northing based on a GB origin
*
* return nil if problems
]]
local function LatLonOrigin2TM( latitude, longitude )
if longitude < -180 or longitude > 180 or latitude < -80 or latitude > 84 then
return nil
end
local longitude2 = longitude - floor((longitude + 180)/360) * 360
local lat_rad = deg2rad( latitude )
local e = OSGBglobe.ecc
local e_prime_sq = e / (1-e)
local v = OSGBglobe.semimajor / sqrt(1 - e * sin(lat_rad)*sin(lat_rad))
local tank = tan(lat_rad)
local T = tank*tank
local T2 = T*T
local C = e_prime_sq * pow( cos(lat_rad), 2)
local A = deg2rad( longitude2 -OSGBglobe.lon0 ) * cos(lat_rad)
local A2 = A*A
local A3 = A2*A
local A4 = A2*A2
local A5 = A3*A2
local A6 = A3*A3
local M = find_M( lat_rad )
local M0 = 0.0
if latitude_origin ~= 0 then
M0 = find_M(deg2rad( OSGBglobe.lat0 ))
end
local northing = OSGBglobe.n0 + OSGBglobe.scale *
( (M - M0) + v*tan(lat_rad) *
( A2/2
+ (5 - T + 9*C + 4*C*C) * A4/24
+ (61 - 58*T + T2
+ 600*C - 330*e_prime_sq) * A6/720 ))
local easting = OSGBglobe.e0 + OSGBglobe.scale * v *
( A
+ (1-T+C)*A3/6
+ (5 - 18*T + T2 + 72*C
- 58 * e_prime_sq)*A5/120 )
return {northing=northing,easting=easting}
end
--[[
* Convert latitude, longitude in decimal degrees to
* OSBG36 Easting and Northing
]]
local function LatLon2OSGB36( latlon, prec )
local tm = LatLonOrigin2TM(latlon.lat, latlon.lon)
if not tm then return '' end
if not tonumber(prec) then prec = 5 end
prec = floor(prec+0.5)
if prec > 5 then prec = 5 end
if prec < 1 then prec = 1 end
-- fix by Roger W Haworth
local grid_x = floor( tm.easting / 100000 )
local grid_y = floor( tm.northing / 100000 )
if grid_x < 0 or grid_x > 6 or grid_y < 0 or grid_y > 12 then return '' end
-- 0000000001111111111222222
-- 1234567890123456789012345
local letters = "ABCDEFGHJKLMNOPQRSTUVWXYZ"
local indx1 = 18-floor(grid_y/5)*5+floor(grid_x/5)
local indx2 = 21-(grid_y%5)*5+grid_x%5
local c1 = mw.ustring.sub(letters,indx1,indx1)
local c2 = mw.ustring.sub(letters,indx2,indx2)
local easting = tm.easting%100000
local northing = tm.northing%100000
local grid = pow(10.0,5.0-prec)
easting = floor(easting/grid)
northing = floor(northing/grid)
local fmt = '%0'..prec..'d'
local e = mw.ustring.format(fmt, easting)
local n = mw.ustring.format(fmt, northing)
return c1..c2..e..n
end
function oscoord._WGS2OSGB(lat,lon,prec)
return LatLon2OSGB36(HelmertDatumShift(lat,lon,WGS2OSGBparam),prec)
end
function oscoord.WGS2OSGB(frame)
local args = getArgs(frame)
return args[1] and args[2] and oscoord._WGS2OSGB(args[1],args[2],args[3]) or ''
end
function oscoord.LL2OS(frame)
local args = getArgs(frame)
if not args[1] or not args[2] then return '' end
local gridRef = oscoord._WGS2OSGB(args[1],args[2],args.prec)
if not gridRef or #gridRef == 0 then return '' end
if args[3] then
gridRef = gridRef..'_'..args[3]
end
return oscoord._main({gridRef,args.linktitle,name=args.name})
end
return oscoord
nrwn7ipk24a5v2mu5ixnzr0tc8jtiix
74781
74780
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Module:Ordnance_Survey_coordinates]]
74780
Scribunto
text/plain
--[[ Ordnance Survey / Lat Long functions in Lua
****** ORDNANCE SURVEY TO LAT LONG FUNCTIONS ******
Ported to Lua from PHP by Wikipedia User Hike395, 18 Aug 2019
found by RWH at http://www.megalithia.com/search/llfuncshighlight.php
With thanks to Andy, G4JNT for inspiration in GEOG, and to the OSGB for their white paper on coordinate transformation
describing the iterative method used
thanks to the Ordnance survey of Ireland for details of the true and false origins of the Irish grid
You may use and redistribute this code under the terms of the GPL see http://www.gnu.org/copyleft/gpl.html
Written by Richard
www.megalithia.com
v0.something 27/2/2000
v 1.01 28 June 2004
v 1.02 6 Aug 2004 line 89 add "0" to chars in ngr=stripcharsnotinbag Thx Andy
v 1.03 9 Mar 2005 Jan (Klingon) added conversion to WGS84 map datum and removed limitation of digits of the grid ref
v 1.04 10 Aug 2005 Richard correct error trapping (only manifest on malformed ngrs
This code is predicated on the assumption that your are ONLY feeding it Irish or UK Grid references.
It uses the single char prefix of Irish grid refs to tell the difference, UK grid refs have a two letter prefix.
We would like an even number of digits for the rest of the grid ref.
Anything in the NGR other than 0-9, A-Z, a-z is eliminated.
WARNING this assumes there are no decimal points in your NGR components.
The transformation from OSGB36/Ireland 1965 to WGS84 is more precise than 5 m.
The function is case insensitive
Lat/Long to Ordnance Survey conversion is at bottom of file, see further authorship there
]]
local oscoord = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local namespace = mw.title.getCurrentTitle().namespace
local pow = math.pow
local sqrt = math.sqrt
local abs = math.abs
local floor = math.floor
local ceil = math.ceil
local sin = math.sin
local cos = math.cos
local tan = math.tan
local atan = math.atan2
local deg2rad = math.rad
local rad2deg = math.deg
--[[ DATUM SHIFT USING HELMERT TRANSFORMATION
*
* height above the ellipsoid is ignored
* latitude and longitude must be given in decimal degrees
*
* no transformation if abs(latitude)>89 or abs(longitude)>89
* (lifting this restriction requires some more lines of code)
*
* Written in 2009 by user Telford at de.wikipedia
* Based on math described in "A Guide to Coordinate Systems in Great Britain"
* by the UK Ordnance Survey
* URL: https://www.ordnancesurvey.co.uk/documents/resources/guide-coordinate-systems-great-britain.pdf
]]
-- Datum parameters
local data = mw.loadData('Module:Ordnance Survey coordinates/data')
local OSGBglobe = data.OSGBglobe
local IEglobe = data.IEglobe
local WGSglobe = data.WGSglobe
local WGS2OSGBparam = data.WGS2OSGBparam
local OSGB2WGSparam = data.OSGB2WGSparam
local IE2WGSparam = data.IE2WGSparam
local function HelmertDatumShift ( latitude , longitude, param )
-- latitude and longitude are in degrees
param = param or WGS2OSGBparam
-- parameters for ellipsoids
-- Annex A.1, Ordnance Survey document --
local a1 = param.semimajor_src
local b1 = param.semiminor_src
local e1 = param.ecc_src
local a2 = param.semimajor_dst
local b2 = param.semiminor_dst
local e2 = param.ecc_dst
-- convert latitude and longitude to cartesian coordinates
-- math in Annex B.1, Ordnance Survey document
local phi = deg2rad ( latitude )
local lambda = deg2rad ( longitude )
local cosphi = cos ( phi )
local sinphi = sin ( phi )
local coslambda = cos ( lambda )
local sinlambda = sin ( lambda )
local ny = a1 / sqrt ( 1. - e1*sinphi*sinphi )
local x1 = ny * cosphi * coslambda
local y1 = ny * cosphi * sinlambda
local z1 = ny * ( 1. - e1 ) * sinphi
-- the helmert transformation proper
-- Equation 3, Section 6.2, Ordnance Survey document
local x2 = x1 + param.tx + ( param.s0 * x1 - param.rz * y1 + param.ry * z1 )
local y2 = y1 + param.ty + ( param.rz * x1 + param.s0 * y1 - param.rx * z1 )
local z2 = z1 + param.tz + ( -param.ry *x1 + param.rx * y1 + param.s0 * z1 )
-- convert cartesian coordinates to latitude and longitude
-- math in Annex B.2, of Ordnance Survey document
lambda = atan ( y2, x2 )
local p2 = sqrt ( x2*x2 + y2*y2 )
phi = atan ( z2, p2*(1.-e2) )
local n0 = 101
local phi_alt
repeat
phi_alt = phi
ny = a2 / sqrt ( 1. - e2 * sin(phi) * sin(phi) )
phi = atan ( z2 + e2 * ny * sin(phi), p2)
n0 = n0 - 1
until abs ( phi - phi_alt ) <= 0.000000000001 or n0 <= 0
return {lat=rad2deg(phi),lon=rad2deg(lambda)}
end
-- LAT LONG TO OS GRID LIBRARY RESUMES HERE
local function northeast(lett,num,shift)
-- split into northings and eastings
local le=mw.ustring.len(num)
if le%2 == 1 then
return {err="Malformed numerical part of NGR"}
end
local pr=le/2
local n = mw.ustring.sub(num,pr+1)
local e = mw.ustring.sub(num,1,pr)
-- Hack to move to center of square: append a 5 to northings and eastings
shift = yesno(shift)
if shift then
n = n.."5"
e = e.."5"
pr = pr+1
end
-- end hack
n = n == '' and 0 or n
e = e == '' and 0 or e
pr = pow(10.0,(5.0-pr))
local T1 = mw.ustring.byte(mw.ustring.sub(lett,1,1))-65
if T1>8 then
T1 = T1-1
end
local T2 = nil
if mw.ustring.len(lett)>1 then
T2 = mw.ustring.byte(mw.ustring.sub(lett,2))-65
if T2>8 then
T2 = T2-1
end
end
return {n=n,e=e,pr=pr,T1=T1,T2=T2}
end
local function EN2LL(e,n,datum)
local a = datum.semimajor*datum.scale
local b = datum.semiminor*datum.scale
local lat0rad = deg2rad(datum.lat0)
local n1 = datum.n1
local n12 = n1*n1
local n13 = n12*n1
local k=(n-datum.n0)/a+lat0rad
local nextcounter=0
local j3, j4, j5, j6, m
repeat
nextcounter=nextcounter+1
local k3=k-lat0rad
local k4=k+lat0rad
j3=(1.0+n1+1.25*n12+1.25*n13)*k3
j4=(3.0*n1+3.0*n12+2.625*n13)*sin(k3)*cos(k4)
j5=(1.875*n12+1.875*n13)*sin(2.0*k3)*cos(2.0*k4)
j6=35.0/24.0*n13*sin(3.0*k3)*cos(3.0*k4)
m=b*(j3-j4+j5-j6)
k=k+(n-datum.n0-m)/a
until abs(n-datum.n0-m)<=0.000000001 or nextcounter>=100
local x = 1.0-datum.ecc*pow(sin(k),2.0)
local v=a/sqrt(x)
local r=v*(1.0-datum.ecc)/x
local h2=v/r-1.0
local y1=e-datum.e0
local tank = tan(k)
local tank2 = tank*tank
local tank4 = tank2*tank2
local tank6 = tank2*tank4
local cosk = cos(k)
local yv = y1/v -- dimensionless quantity in series expansion
local yv2 = yv*yv
local yv3 = yv*yv2
local yv5 = yv3*yv2
local yv7 = yv5*yv2
j3=tank/(2.0*r)
j4=tank/(24.0*r)*(5.0+3.0*tank2+h2-9.0*tank2*h2)
j5=tank/(720.0*r)*(61.0+90.0*tank2+45.0*tank4)
local k9=k-y1*(yv*j3+yv3*j4-yv5*j5)
j6=1.0/(cosk)
local j7=1.0/(cosk*6.0)*(v/r+2.0*tank2)
local j8=1.0/(cosk*120.0)*(5.0+28.0*tank2+24.0*tank4)
local j9=1.0/(cosk*5040.0)
j9=j9*(61.0+662.0*tank2+1320.0*tank4+720.0*tank6)
local long=datum.lon0+rad2deg(yv*j6-yv3*j7+yv5*j8-yv7*j9)
local lat=rad2deg(k9)
return {lat=lat,lon=long}
end
local function GBEN2LL(e,n,direct)
-- no need to compute lat/long if GB has direct link
if direct then
return {region="GB",e=e,n=n}
end
local latlong = EN2LL(e,n,OSGBglobe)
local helmert = HelmertDatumShift ( latlong.lat, latlong.lon, OSGB2WGSparam)
return {region="GB",lat=helmert.lat,long=helmert.lon}
end
local function GB2LL(lett,num,direct)
-- British OS to Lat+Long
-- first caclulate e,n
-- computing e and n exactly, to get SW corner of box
local ne = northeast(lett,num)
if ne.err then
return {region="GB",err=ne.err}
end
-- use British definition of e and n
local e=500000.0*(ne.T1%5)+100000.0*(ne.T2%5)-1000000.0+ne.e*ne.pr
local n=1900000.0-500000.0*floor(ne.T1/5)-100000.0*floor(ne.T2/5)+ne.n*ne.pr
local result = GBEN2LL(e,n,direct)
result.prec = 0.8165*ne.pr
return result
end
local function IrishEN2LL(e,n)
local latlong = EN2LL(e,n,IEglobe)
local helmert = HelmertDatumShift ( latlong.lat, latlong.lon, IE2WGSparam)
return {region="IE",lat=helmert.lat,long=helmert.lon}
end
local function Irish2LL(lett,num)
-- Irish OS to Lat+Long
-- first caclulate e,n
-- computing e and n exactly, to get SW corner of box
local ne = northeast(lett,num)
if ne.err then
return {region="IE", err=ne.err}
end
-- use Irish definition of northing and easting
local e=100000.0*(ne.T1%5.0)+ne.e*ne.pr
local n=ne.n*ne.pr+100000.0*(4.0-floor(ne.T1/5.0))
local result = IrishEN2LL(e,n)
result.prec = 0.8165*ne.pr -- useful @ Commons
return result
end
local function empty(s)
return not s or s == ''
end
local function NGR2LL(ngr,direct)
local _ = 0
ngr, _ = mw.ustring.gsub(mw.ustring.upper(ngr),"[%s%p]","")
local first, last, lett, num = mw.ustring.find(ngr,"^([A-Z]+)(%d+)$")
if not first or empty(lett) or empty(num) or mw.ustring.len(lett) > 2 then
return {err="Malformed NGR"}
end
if mw.ustring.len(lett) == 1 then
return Irish2LL(lett,num)
end
return GB2LL(lett, num, direct)
end
local function split(s,sep)
-- split a string s into chunks, separated by sep
sep = sep or "%s"
local t = {}
for chunk in mw.ustring.gmatch(s,"([^"..sep.."]+)") do
table.insert(t,chunk)
end
return t
end
local function trim(s)
local _ = 0
s, _ = mw.ustring.gsub(s,"^%s+","")
s, _ = mw.ustring.gsub(s,"%s+$","")
return s
end
local function alldigits(s)
return not mw.ustring.find(s,"%D")
end
local function warning(errmsg)
local preview = require('Module:If preview')
local msg = errmsg or 'Empty OS grid ref'
local html = preview._warning({ msg })
if namespace == 0 and errmsg then
html = html..'[[Category:Pages with malformed OS coordinates]]'
end
return html
end
-- generate URL of geohack map
local function geohack(main_args, other_args, LL)
-- create geohack link. Example:
-- https://geohack.toolforge.org/geohack.php?pagename=Mount_Whitney¶ms=36.578580925_N_118.29199495_W_type:mountain_region:US-CA_scale:100000_source:NGS
local url = 'https://geohack.toolforge.org/geohack.php?'
local input = main_args[1]
local namearg = main_args["name"]
local current_page = mw.title.getCurrentTitle()
local pagename = mw.uri.encode( current_page.prefixedText, 'WIKI' )
if not empty(pagename) then
url = url..'pagename='..pagename..'&'
end
url = url..'params='..mw.ustring.format('%.6f',LL.lat)..'_N_'
if LL.long < 0 then
url = url..mw.ustring.format('%.6f',-LL.long)..'_W'
else
url = url..mw.ustring.format('%.6f',LL.long)..'_E'
end
for _, a in ipairs(other_args) do
url = url..'_'..a
end
if not mw.ustring.find(input,"region") and LL.region then
url = url..'_region:'..LL.region
end
if not mw.ustring.find(input,"scale") and
not mw.ustring.find(input,"type") and
not mw.ustring.find(input,"dim") and LL.prec then
url = url..'_dim:'..floor(50*LL.prec+0.5)..'m'
end
if not empty(namearg) then
url = url .. "&title=" .. mw.uri.encode(namearg)
end
return url
end
local function dimArgs(other_args, LL)
local args = {}
for _, a in ipairs(other_args) do
local splitOut = mw.text.split(a, ':', true)
args[splitOut[1]] = splitOut[2]
end
if not args.scale and not args.type and not args.dim then
args.dim = LL.prec and tostring(floor(50*LL.prec+0.5))..'m'
end
args.viewport_cm = 10
return args
end
-- function to generate direct link to OS map for both GB and IE
local function generalDirectLink(other_args, LL)
-- create direct link to OS maps. The template is
-- https://explore.osmaps.com/pin?lat={latdegdec}&lon={londegdec}&zoom={osmzoom}&overlays=&style=Standard&type=2d
local args = dimArgs(other_args, LL)
local zoom = require('Module:Infobox dim')._zoom
local lvl = zoom(args) or 12
local url = mw.ustring.format('https://explore.osmaps.com/pin?lat=%.6f&lon=%.6f&zoom=%d&overlays=&style=Standard&type=2d',
LL.lat,LL.long,lvl)
return url
end
-- function to generate direct link to OS map for GB only
local function GBDirectLink(other_args, LL)
-- create direct link to OS maps. The template is
-- http://streetmap.co.uk/grid/{osgb36easting}_{osgb36northing}_120
local args = dimArgs(other_args, LL)
local scaleFcn = require('Module:Infobox dim')._scale
local scale = scaleFcn(args) or 50000
scale = scale*scale
local level
if scale < 2500*5000 then
level = 106
elseif scale < 5000*25000 then
level = 110
elseif scale < 25000*50000 then
level = 115
elseif scale < 50000*100000 then
level = 120
elseif scale < 100000*200000 then
level = 126
elseif scale < 200000*500000 then
level = 130
elseif scale < 500000*1000000 then
level = 140
else
level = 150
end
return mw.ustring.format('http://streetmap.co.uk/grid/%d_%d_%d', LL.e, LL.n, level)
end
function oscoord._main(main_args)
local input = main_args[1]
if empty(input) then
return warning(nil)
end
local linktitle = main_args[2]
local rawurl = yesno(main_args["rawurl"])
local direct = yesno(main_args["direct"])
local args = split(input,'_')
local LL
local restargs = 1
if #args >= 2 and alldigits(args[2]) then
if mw.ustring.sub(args[1],1,1) == 'i' then
local firstArg = mw.ustring.sub(args[1],2)
if alldigits(firstArg) then
LL = IrishEN2LL(firstArg,args[2])
restargs = 3
if empty(linktitle) then
linktitle=args[1]..'_'..args[2]
end
end
elseif alldigits(args[1]) then
LL = GBEN2LL(args[1],args[2],direct)
restargs = 3
if empty(linktitle) then
linktitle=args[1]..'_'..args[2]
end
end
else
LL = NGR2LL(args[1],direct)
restargs = 2
if empty(linktitle) then
linktitle=args[1]
end
end
linktitle = trim(linktitle)
if not empty(LL.err) then
return linktitle ..warning(LL.err)
end
LL.lat = LL.lat or 0
LL.long = LL.long or 0
LL.lat = ceil(LL.lat*1000000)/1000000
LL.long = ceil(LL.long*1000000)/1000000
local other_args = {}
for i = restargs, #args do
table.insert(other_args, args[i])
end
local url
if not direct then
url = geohack(main_args, other_args, LL)
elseif LL.region ~= 'GB' then
url = generalDirectLink(other_args, LL)
else
url = GBDirectLink(other_args, LL)
end
if not rawurl then
url = mw.ustring.format('<span class="nourlexpansion%s" style="white-space:nowrap">[%s %s]</span>%s',
direct and '' or ' plainlinks',
url,linktitle,
namespace == 0 and '[[Category:Articles with OS grid coordinates]]' or '')
end
return url
end
function oscoord.main(frame)
local args = getArgs(frame)
return oscoord._main(args)
end
function oscoord.oscoord(frame)
local args = getArgs(frame)
return oscoord._main(args)
end
--[[
****** LAT/LONG CONVERSION TO OS GRID REF FUNCTIONS *****
* Uses the WGS-84 ellipsoid and only works for GB grid ref
*
* See also:
* http://www.posc.org/Epicentre.2_2/DataModel/ExamplesofUsage/eu_cs34h.html
* http://kanadier.gps-info.de/d-utm-gitter.htm
* http://www.gpsy.com/gpsinfo/geotoutm/
* http://www.colorado.edu/geography/gcraft/notes/gps/gps_f.html
* http://search.cpan.org/src/GRAHAMC/Geo-Coordinates-UTM-0.05/
* UK Ordnance Survey grid (OSBG36): http://www.gps.gov.uk/guidecontents.asp
* Swiss CH1903: http://www.gps.gov.uk/guidecontents.asp
*
* ----------------------------------------------------------------------
*
* Copyright 2005, Egil Kvaleberg <egil@kvaleberg.no>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Converted to Lua by User:Hike395 on 2023-12-15
]]
local function find_M ( lat_rad )
local e = OSGBglobe.ecc
local e2 = e*e
local e3 = e*e*e
return OSGBglobe.semimajor * ( ( 1 - e/4 - 3 * e2/64
- 5 * e3/256
) * lat_rad
- ( 3 * e/8 + 3 * e2/32
+ 45 * e3/1024
) * sin(2 * lat_rad)
+ ( 15 * e2/256 +
45 * e3/1024
) * sin(4 * lat_rad)
- ( 35 * e3/3072
) * sin(6 * lat_rad) )
end
--[[
* Convert latitude, longitude in decimal degrees to
* Transverse Mercator Easting and Northing based on a GB origin
*
* return nil if problems
]]
local function LatLonOrigin2TM( latitude, longitude )
if longitude < -180 or longitude > 180 or latitude < -80 or latitude > 84 then
return nil
end
local longitude2 = longitude - floor((longitude + 180)/360) * 360
local lat_rad = deg2rad( latitude )
local e = OSGBglobe.ecc
local e_prime_sq = e / (1-e)
local v = OSGBglobe.semimajor / sqrt(1 - e * sin(lat_rad)*sin(lat_rad))
local tank = tan(lat_rad)
local T = tank*tank
local T2 = T*T
local C = e_prime_sq * pow( cos(lat_rad), 2)
local A = deg2rad( longitude2 -OSGBglobe.lon0 ) * cos(lat_rad)
local A2 = A*A
local A3 = A2*A
local A4 = A2*A2
local A5 = A3*A2
local A6 = A3*A3
local M = find_M( lat_rad )
local M0 = 0.0
if latitude_origin ~= 0 then
M0 = find_M(deg2rad( OSGBglobe.lat0 ))
end
local northing = OSGBglobe.n0 + OSGBglobe.scale *
( (M - M0) + v*tan(lat_rad) *
( A2/2
+ (5 - T + 9*C + 4*C*C) * A4/24
+ (61 - 58*T + T2
+ 600*C - 330*e_prime_sq) * A6/720 ))
local easting = OSGBglobe.e0 + OSGBglobe.scale * v *
( A
+ (1-T+C)*A3/6
+ (5 - 18*T + T2 + 72*C
- 58 * e_prime_sq)*A5/120 )
return {northing=northing,easting=easting}
end
--[[
* Convert latitude, longitude in decimal degrees to
* OSBG36 Easting and Northing
]]
local function LatLon2OSGB36( latlon, prec )
local tm = LatLonOrigin2TM(latlon.lat, latlon.lon)
if not tm then return '' end
if not tonumber(prec) then prec = 5 end
prec = floor(prec+0.5)
if prec > 5 then prec = 5 end
if prec < 1 then prec = 1 end
-- fix by Roger W Haworth
local grid_x = floor( tm.easting / 100000 )
local grid_y = floor( tm.northing / 100000 )
if grid_x < 0 or grid_x > 6 or grid_y < 0 or grid_y > 12 then return '' end
-- 0000000001111111111222222
-- 1234567890123456789012345
local letters = "ABCDEFGHJKLMNOPQRSTUVWXYZ"
local indx1 = 18-floor(grid_y/5)*5+floor(grid_x/5)
local indx2 = 21-(grid_y%5)*5+grid_x%5
local c1 = mw.ustring.sub(letters,indx1,indx1)
local c2 = mw.ustring.sub(letters,indx2,indx2)
local easting = tm.easting%100000
local northing = tm.northing%100000
local grid = pow(10.0,5.0-prec)
easting = floor(easting/grid)
northing = floor(northing/grid)
local fmt = '%0'..prec..'d'
local e = mw.ustring.format(fmt, easting)
local n = mw.ustring.format(fmt, northing)
return c1..c2..e..n
end
function oscoord._WGS2OSGB(lat,lon,prec)
return LatLon2OSGB36(HelmertDatumShift(lat,lon,WGS2OSGBparam),prec)
end
function oscoord.WGS2OSGB(frame)
local args = getArgs(frame)
return args[1] and args[2] and oscoord._WGS2OSGB(args[1],args[2],args[3]) or ''
end
function oscoord.LL2OS(frame)
local args = getArgs(frame)
if not args[1] or not args[2] then return '' end
local gridRef = oscoord._WGS2OSGB(args[1],args[2],args.prec)
if not gridRef or #gridRef == 0 then return '' end
if args[3] then
gridRef = gridRef..'_'..args[3]
end
return oscoord._main({gridRef,args.linktitle,name=args.name})
end
return oscoord
nrwn7ipk24a5v2mu5ixnzr0tc8jtiix
Template:Iem4ibx
10
8942
74784
2023-03-26T19:09:46Z
en>Hike395
0
invoke module directly
74784
wikitext
text/x-wiki
{{#if:{{{1|}}}|{{#invoke:Ordnance Survey coordinates|oscoord|{{{1}}}_region:IE_scale:25000|{{{1}}}|name={{{name|}}}}}}}<noinclude>
<!--add categories and interwiki links to the /doc page-->
{{documentation}}
</noinclude>
7ef909qwkrmrqcrgkk2v5ndu1dgric9
74785
74784
2026-08-24T00:15:10Z
Robertsky
10424
1 versaun husi [[:en:Template:Iem4ibx]]
74784
wikitext
text/x-wiki
{{#if:{{{1|}}}|{{#invoke:Ordnance Survey coordinates|oscoord|{{{1}}}_region:IE_scale:25000|{{{1}}}|name={{{name|}}}}}}}<noinclude>
<!--add categories and interwiki links to the /doc page-->
{{documentation}}
</noinclude>
7ef909qwkrmrqcrgkk2v5ndu1dgric9
Template:No documentation
10
8943
74794
2024-03-06T18:00:20Z
en>MusikBot II
0
Changed protection settings for "[[Template:No documentation]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 2500 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
74794
wikitext
text/x-wiki
#REDIRECT [[Template:Improve documentation]]
qbaa6gk7i6dtamsr2a90x3scdkj3rwe
74795
74794
2026-08-24T00:15:11Z
Robertsky
10424
1 versaun husi [[:en:Template:No_documentation]]
74794
wikitext
text/x-wiki
#REDIRECT [[Template:Improve documentation]]
qbaa6gk7i6dtamsr2a90x3scdkj3rwe
Template:Infobox mountain/doc
10
8944
74798
2026-08-15T17:55:04Z
en>Hike395
0
/* Parameters */ note about Wikidata defaults (as best as I can tell)
74798
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{Lua|Module:Infobox|Module:WikidataIB|Module:InfoboxImage|Module:Check for unknown parameters|Module:Coordinates}}
{{Uses Wikidata|P18|P2044|P2660|P3137|P2659|P361|P2043|P2049|P2046|P2234}}
<!--
== Wikidata-enabled ==
Simply add <code><nowiki>{{Infobox mountain}}</nowiki></code> to the top of an article, and the data will be automatically included from [[Wikidata]]. If necessary, these values can be overridden by passing local values to the relevant parameters in the article:
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox mountain
| name = [local value]
}}
</syntaxhighlight>
To add data to Wikidata, please see the Parameters section below.
{{Clear}}
-->
== Standard usage ==
{{Parameter names example
| name
| other_name
| image
| image_size
| image_upright
| image_alt
| image_caption
| mapframe = no
| highest
| highest_location
| elevation
| elevation_ref
| elevation_system
| prominence
| prominence_ref
| parent_peak
| isolation
| isolation_parent
| isolation_ref
| listing
| coordinates
| coordinates_ref
| length
| length_orientation
| length_ref
| width
| width_orientation
| width_ref
| area
| area_ref
| volume
| volume_ref
| etymology
| nickname
| native_name
| native_name_lang
| translation
| pronunciation
| authority
| location
| country
| country_type
| state
| state_type
| region
| region_type
| district
| district_type
| part
| part_type
| settlement
| settlement_type
| range_coordinates
| range_coordinates_ref
| range
| borders_on
| grid_ref_UK
| grid_ref_UK_ref
| grid_ref_Ireland
| grid_ref_Ireland_ref
| topo_maker
| topo_map
| biome
| formed_by
| orogeny
| age
| type
| geology
| volcanic_zone
| volcanic_arc
| volcanic_belt
| volcanic_field
| last_eruption
| first_ascent
| easiest_route
| normal_route
| access
| embedded
| module
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox mountain
| name =
| other_name =
| image =
| image_size =
| image_upright =
| image_alt =
| image_caption =
| map =
<!----------------------- HIGHEST POINT -->
| highest =
| highest_location =
| elevation_m =
| elevation_ft =
| elevation_ref =
| elevation_system =
| prominence_m =
| prominence_ft =
| prominence_ref =
| parent_peak =
| isolation_km =
| isolation_mi =
| isolation_parent =
| isolation_ref =
| listing =
| coordinates =
| coordinates_ref =
<!----------------------- DIMENSIONS -->
| length_km =
| length_mi =
| length_orientation =
| length_ref =
| width_km =
| width_mi =
| width_orientation =
| width_ref =
| area_km2 =
| area_mi2 =
| area_ref =
| volume_km3 =
| volume_mi3 =
| volume_ref =
<!----------------------- NAMING -->
| etymology =
| nickname =
| native_name = <!-- {{native name}} or {{native name list}} -->
| native_name_lang = <!-- not used by |native_name= -->
| translation =
| pronunciation =
| authority =
<!----------------------- GEOGRAPHY -->
| location = <!-- While location is not deprecated, use of country,state,region,district is preferred -->
| country_type = <!-- For Antarctica, set to Continent -->
| country = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| state_type =
| state = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| region_type =
| region = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| district_type =
| district = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| part_type =
| part = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| settlement_type =
| settlement = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| range_coordinates =
| range_coordinates_ref =
| range =
| borders_on =
| grid_ref_UK =
| grid_ref_UK_ref =
| grid_ref_Ireland =
| grid_ref_Ireland_ref =
| topo_maker =
| topo_map =
| biome =
<!----------------------- GEOLOGY -->
| formed_by =
| orogeny =
| age =
| type =
| geology =
| volcanic_arc =
| volcanic_belt =
| volcanic_field =
| volcanic_zone =
| last_eruption =
<!----------------------- CLIMBING -->
| first_ascent =
| easiest_route =
| normal_route =
| access =
<!----------------------- ATTACHED -->
| module =
}}
</syntaxhighlight>
== Parameters ==
'''Note''': defaults from Wikidata are only used when {{para|fetchwikidata|ALL}}.
=== Lead section ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''name''' || Wikidata label in the local language || Name of the mountain, peak or hill.
|-
| '''other_name''' || || Other name for the mountain. See <code>native_name</code> if the name is in a different language.
|-
| '''image''' || Image on Wikidata || Imagegraph of the mountain. Preferably a distance shot to show most/all of the mountain rather than a view from the summit.
|-
| '''image_size''' || 280px || The default image width in pixels.
|-
| '''image_upright''' || ||
|-
| '''image_alt''' || <code>image_caption</code> || [[Wikipedia:Alternative text for images|Alt text]] for the image.
|-
| '''image_caption''' || {{Wikidata property link|P2096}} stated on image || Description of the imagegraph.
|}
=== Maps ===
The maps appear in the lead section, at the top, if there is no image present. However, if there is a image, they all move to the Geography section automatically.
==== Pushpin map ====
{{Location map/doc/infobox parameters
| pushpin_mark = Red triangle with thick white border.svg
| pushpin_mark_size = 16
}}
==== Mapframe maps ====
{{Infobox mapframe/doc/parameters
| onByDefault = yes, unless one of these parameters has a value: {{parameter|pushpin_map}}, {{parameter|image_map}}
| mapframe-coord = the first of the following: {{parameter|mapframe-coordinates}}, {{parameter|mapframe-coord}}, {{parameter|range_coordinates}}, {{parameter|range_coords}}, {{parameter|coordinates}}, {{parameter|coords}}
| mapframe-frame-width = 250
| mapframe-wikidata = yes, unless one of these parameters has a value: {{parameter|mapframe-coordinates}}, {{parameter|mapframe-coord}}, {{parameter|range_coordinates}}, {{parameter|range_coords}}, {{parameter|coordinates}}, {{parameter|coords}}
| mapframe-marker = mountain
| mapframe-type = mountain
| mapframe-length_km = {{parameter|length_km}}
| mapframe-length_mi = {{parameter|length_mi}}
| mapframe-width_km = {{parameter|width_km}}
| mapframe-width_mi = {{parameter|width_mi}}
| mapframe-area_mi2 = {{parameter|area_mi2}}
| mapframe-area_km2 = {{parameter|area_km2}}
| mapframe-id = {{parameter|qid}}
}}
=== Highest point ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''highest''' || {{Wikidata property link|P2044}} with qualifier {{Wikidata property link|P2561}} || Name of the highest summit of a single mountain or peak.
|-
| '''highest_location''' || {{Wikidata property link|P2044}} with qualifier {{Wikidata property link|P276}} || Location of highest summit.
|-
| '''elevation''' || rowspan=3 | {{Wikidata property link|P2044}} || Summit [[elevation]], without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|m|ft|abbr=on}}</nowiki></code>
|-
| '''elevation_m''' || Summit elevation in metres, with auto-conversion.
|-
| '''elevation_ft''' || Summit elevation in feet, with auto-conversion.
|-
| '''elevation_ref''' || N/A || Optional parameter to add a suffix to the <code>elevation</code> parameters (such as a reference).
|-
| '''elevation_system''' || {{Wikidata property link|P2044}} with qualifier {{Wikidata property link|P459}} || The elevation reference system that defines the elevation, e.g., NAVD88 or DE-NHN
|-
| '''prominence''' || rowspan=3 | {{Wikidata property link|P2660}} || [[Topographic prominence]], without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|m|ft|abbr=on}}</nowiki></code>
|-
| '''prominence_m''' || Topographic prominence in metres, with auto-conversion.
|-
| '''prominence_ft''' || Topographic prominence in metres, with auto-conversion.
|-
| '''prominence_ref''' || N/A || Optional parameter to add a suffix to the <code>prominence</code> parameters (such as a reference).
|-
| '''parent_peak''' || {{Wikidata property link|P3137}} ||
|-
| '''isolation''' || rowspan=3 | {{Wikidata property link|P2659}} || [[Topographic isolation]], without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km|mi|abbr=on}}</nowiki></code>
|-
| '''isolation_km''' || Topographic isolation in kilometres, with auto-conversion.
|-
| '''isolation_mi''' || Topographic isolation in miles, with auto-conversion.
|-
| '''isolation_parent''' || {{Wikidata property link|P2659}} with qualifier {{Wikidata property link|P2210}} || Name of the landform the summit is isolated from.
|-
| '''isolation_ref''' || N/A || Optional parameter to add a suffix to the <code>isolation</code> parameters (such as a reference).
|-
| '''listing''' || {{Wikidata property link|P361}} || Name of a relevant list of mountains that the peak belongs to. See [[List of mountain lists]] for examples.
|-
| '''coordinates''' || {{Wikidata property link|P625}} || [[Geographic coordinate system|Coordinates]] of the highest point or peak.
|-
| '''coordinates_ref''' || N/A || Optional parameter to add a suffix to the <code>coordinates</code> parameter (such as a reference).
|}
=== Dimensions ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''length''' || rowspan=3 | {{Wikidata property link|P2043}} || Length of the mountain or peak, without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km|mi|abbr=on}}</nowiki></code>
|-
| '''length_km''' || Length in kilometres, with auto-conversion.
|-
| '''length_mi''' || Length in miles, with auto-conversion.
|-
| '''length_orientation''' || {{Wikidata property link|P2043}} with qualifier {{Wikidata property link|P7469}} as:<br/>{{Wikidata entity link|Q34027}} (for EW) or {{Wikidata entity link|Q36477}} (for NS) || Length orientation.
|-
| '''length_ref''' || N/A || Optional parameter to add a suffix to the <code>length</code> parameters (such as a reference).
|-
| '''width''' || rowspan=3 | {{Wikidata property link|P2049}} || Width of the mountain or peak, without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km|mi|abbr=on}}</nowiki></code>
|-
| '''width_km''' || Length in kilometres, with auto-conversion.
|-
| '''width_mi''' || Length in miles, with auto-conversion.
|-
| '''width_orientation''' || {{Wikidata property link|P2049}} with qualifier {{Wikidata property link|P7469}} as:<br/>{{Wikidata entity link|Q34027}} (for EW) or {{Wikidata entity link|Q36477}} (for NS) || Width orientation.
|-
| '''width_ref''' || N/A || Optional parameter to add a suffix to the <code>width</code> parameters (such as a reference).
|-
| '''area''' || rowspan=3 | {{Wikidata property link|P2046}} || Footprint of the mountain or peak, without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km2|mi2|abbr=on}}</nowiki></code>
|-
| '''area_km2''' || Footprint of the mountain or peak in square kilometres, with auto-conversion.
|-
| '''area_mi2''' || Footprint of the mountain or peak in square miles, with auto-conversion.
|-
| '''area_ref''' || N/A || Optional parameter to add a suffix to the <code>area</code> parameters (such as a reference).
|-
| '''volume''' || rowspan=3 | {{Wikidata property link|P2234}} || Volume of the mountain or peak, without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km3|mi3|abbr=on}}</nowiki></code>
|-
| '''volume_km3''' || Volume of the mountain or peak in cubic kilometres, with auto-conversion.
|-
| '''volume_mi3''' || Volume of the mountain or peak in cubic miles, with auto-conversion.
|-
| '''volume_ref''' || N/A || Optional parameter to add a suffix to the <code>volume</code> parameters (such as a reference).
|}
=== Naming ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''etymology''' || {{Wikidata property link|P138}} || Origin of name
|-
| '''nickname''' || {{Wikidata property link|P1449}} ||
|-
| '''native_name''' || {{Wikidata property link|P1559}} || Name in local language – use {{tl|native name}} or, for multiple names, use {{tl|native name list}}
|-
| '''native_name_lang''' || {{Wikidata property link|P1559}} || [[ISO 639-2]] code of <code>native_name</code>; not used by '''native_name'''.
|-
| '''translation''' || {{Wikidata property link|P1559}} with qualifier {{Wikidata property link|P2441}} || Translation of name to English (if name is not an English name)
|-
| '''pronunciation''' || {{Wikidata property link|P898}} || Use an appropriate IPA-xx template, replacing 'xx' with the ISO code for the language. (See {{tl|IPAc-en}} for English.)
|-
| '''authority''' || || The government agency responsible for making names official.
|}
=== Geography ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''location''' || {{Wikidata property link|P276}} || Free-form field to describe the location.
|-
| '''country''' || {{Wikidata property link|P17}} || Country(ies) of the peak or mountain.
|-
| '''country_type''' || || Optional parameter to override the default "Country" label.
|-
| '''subdivision1'''/'''state''' || {{Wikidata property link|P131}} || 1st level subdivision (i.e. states) of the peak or mountain.
|-
| '''subdivision1_type'''/'''state_type''' || || Optional parameter to override the default "State" label.
|-
| '''subdivision2'''/'''region''' || || 2nd level subdivision (i.e. regions) of the peak or mountain.
|-
| '''subdivision2_type'''/'''region_type''' || || Optional parameter to override the default "Region" label.
|-
| '''subdivision3'''/'''district''' || || 3rd level subdivision (i.e. districts) of the peak or mountain.
|-
| '''subdivision3_type'''/'''district_type''' || || Optional parameter to override the default "District" label.
|-
| '''subdivision4'''/'''part''' || || 4th level subdivision (i.e. subdivisions) of the peak or mountain.
|-
| '''subdivision4_type'''/'''part_type''' || || Optional parameter to override the default "Subdivisions" label.
|-
| '''settlement''' || || Settlement(s) on/around the peak or mountain.
|-
| '''settlement_type''' || || Optional parameter to override the default "Settlement" label.
|-
| '''range_coordinates''' || || Typically marks the centre of the mountain range. Do not use for an individual mountain.
|-
| '''range_coordinates_ref''' || N/A || Optional parameter to add a suffix to the <code>range_coordinates</code> parameter (such as a reference).
|-
| '''range''' || {{Wikidata property link|P4552}} || The [[mountain range]] (specific subgroup) that the mountain/massif/range. I.e. [[Bernese Alps]], not [[Alps]]. Alias is "parent".
|-
| '''borders_on'''/'''border''' || {{Wikidata property link|P4777}} || Geographical entities that form the border of the mountain or range
|-
| '''grid_ref_UK''' || {{Wikidata property link|P613}} || If the mountain is in Great Britain, the [[British national grid reference system|British grid reference]]. Use <code>grid_ref_UK_ref</code> to add a suffix reference.
|-
| '''grid_ref_Ireland''' || {{Wikidata property link|P4091}} || If the mountain is in Ireland (whether [[Northern Ireland]] or the [[Republic of Ireland|Republic]]), the [[Irish national grid reference system|Irish grid reference]]. Use <code>grid_ref_Ireland_ref</code> to add a suffix reference.
|-
| '''topo''' || || The publisher/maker and name of the topographic map.
|-
| '''topo_maker''' || || The publisher or maker of the topographic map. e.g. NTS (Canada) or USGS (United States).
|-
| '''topo_map''' || || The name of the topographic map.
|-
| '''biome''' || || [[Biome]](s) for range
|}
===Geology===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''formed_by''' || ||
|-
| '''orogeny''' || ||
|-
| '''age''' || || Age of the rock. [[Geologic time scale]]s may be useful here.
|-
| '''type''' || ||
|-
| '''rock''' || || Type of the rock mountain is made from. <code>geology</code> is an alias.
|-
| '''volcanic arc''' || || If the mountain is a volcano, the [[volcanic arc|arc]] where it is located
|-
| '''volcanic belt''' || || If the mountain is a volcano, the [[volcanic belt|belt]] where it is located
|-
| '''volcanic field''' || || If the mountain is a volcano, the [[volcanic field|field]] where it is located
|-
| '''volcanic zone''' || || If the mountain is a volcano, the general zone or region where it is located, if none of the other volcanic parameters are applicable
|-
| '''last_eruption''' || || The date of the last eruption if the mountain is of volcanic origin.
|}
=== Climbing ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''first_ascent''' || || Date of the first recorded ascent.
|-
| '''easiest_route''' || || The easiest route to the summit. Some possibilities include [[Hiking|Hike]], [[Scrambling|Scramble]] or any of the [[Yosemite Decimal System|YDS]] grades.
|-
| '''normal_route''' || ||
|-
| '''access''' || ||
|-
|}
=== Advanced uses ===
{{no documentation}}
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''qid''' || ||
|-
| '''suppressfields''' || ||
|-
| '''fetchwikidata''' || ||
|-
| '''onlysourced''' || ||
|-
| '''child''' || ||
|-
| '''embedded''' || ||
|-
| '''module''' || ||
|-
|}
== Tracking categories ==
{{Infobox tracking categories}}
* {{Category link with count|Wikidata value to be checked for Infobox mountain}}
* {{Category link with count|Pages using infobox mountain with language parameter}}
== Template data ==
{{collapse top|title=[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"format": "block",
"description": "This template is used to create an infobox for an article about a mountain.",
"params": {
"name": {
"required": true,
"label": "Name",
"type": "string",
"description": "Name of the mountain, peak or hill. If more than one mountain by the name exists, the article is likely disambiguated but this name in the infobox should be the undisambiguated name. For example, Mount Columbia (for Mount Columbia (Canada) or Mount Columbia (Colorado)."
},
"other_name": {
"required": false,
"label": "Other name",
"type": "string",
"description": "An alternate English name for the mountain, e.g., \"Mount McKinley\" for Denali. Quotes can be used as normal to italicize or bold the text if desired."
},
"etymology": {
"required": false,
"label": "Etymology",
"type": "string",
"description": "The etymology of the name"
},
"native_name": {
"required": false,
"label": "Native name",
"type": "string",
"description": "The name of the mountain in the local language, if not English."
},
"native_name_lang": {
"required": false,
"label": "ISO 639 language code",
"type": "string",
"description": "The ISO 639 code for the language of the mountain name (if not English). e.g., \"fr\" for French"
},
"language": {
"required": false,
"label": "Language",
"type": "string",
"description": "Language of mountain name."
},
"translation": {
"required": false,
"label": "Translation",
"type": "string",
"description": "Translation of the mountain's name into English"
},
"pronunciation": {
"required": false,
"label": "Pronunciation",
"type": "string",
"description": "Use an appropriate IPA-xx template, replacing 'xx' with the ISO code for the language. (See {{IPAc-en}} for English.)"
},
"image": {
"required": false,
"label": "Image",
"type": "string",
"description": "Imagegraph of the mountain. Preferably a distance shot to show most/all of the mountain rather than a view from the summit. Do not include the \"File:\" prefix. If uploading a new image, please put them on Commons so they can be easily used by the other language Wikipedias. If the only image available is less than 280px wide, you can use the image_size parameter to indicate its size."
},
"image_alt": {
"required": false,
"label": "Image alt",
"type": "string",
"description": "Alt text for the image, primarily for visually impaired readers. See Wikipedia:Alternative text for images."
},
"image_caption": {
"required": false,
"label": "Image caption",
"type": "string",
"description": "Description of the imagegraph which is displayed below. Include the month and year if known."
},
"map_image": {
"required": false,
"label": "Map image",
"type": "string",
"description": "The file name of a static map image to be displayed. For a [[Template:location map|location map]], use map"
},
"map_alt": {
"required": false,
"label": "Map alt",
"type": "string",
"description": "Alt text for the map, primarily for visually impaired readers. See [[Wikipedia:Alternative text for images#Maps]]."
},
"map_caption": {
"required": false,
"label": "Map caption",
"type": "string",
"description": "Fill out if a map caption is desired. If not specified, location will be used."
},
"location": {
"required": false,
"label": "Location",
"type": "string",
"description": "Province or state first, followed by country. For the US, the county is optional but if given, be provided before the state. If a pushpin map is being used, the location will be used for the map's caption unless the map_caption parameter is set."
},
"elevation": {
"required": false,
"label": "Elevation",
"type": "string",
"description": "Maximum height of the mountain. If the mountain has multiple high points, use the highest. Metres should be used first for all mountains outside of the United States and feet for those within the U.S. For conversions, use elevation_m for metres to feet or elevation_ft for feet to metres. This field is required."
},
"elevation_m": {
"required": false,
"label": "Elevation (meters)",
"type": "string",
"description": "Maximum height of the mountain, metres."
},
"elevation_ft": {
"required": false,
"label": "Elevation (feet)",
"type": "string",
"description": "Maximum height of the mountain, feet."
},
"elevation_ref": {
"required": false,
"label": "Elevation ref",
"type": "string",
"description": "Reference for the elevation using the standard <ref> </ref> tags. If elevation_m/elevation_ft was used, the reference must be supplied using this parameter."
},
"prominence": {
"required": false,
"label": "Prominence",
"type": "string",
"description": "The clean topographic prominence of the summit. For conversions, use prominence_m for metres to feet or prominence_ft for feet to metres."
},
"prominence_m": {
"required": false,
"label": "Prominence (meters)",
"type": "string",
"description": "The clean topographic prominence of the summit, metres."
},
"prominence_ft": {
"required": false,
"label": "Prominence (feet)",
"type": "string",
"description": "The clean topographic prominence of the summit, feet."
},
"prominence_ref": {
"required": false,
"label": "Prominence ref",
"type": "string",
"description": "Reference for the prominence using the standard <ref> </ref> tags."
},
"parent_peak": {
"required": false,
"label": "Parent peak",
"type": "string",
"description": "In computation of prominence, peaks form a hierarchy: this is the parent of the peak in the hierarchy. For more information, see Line parent."
},
"listing": {
"required": false,
"label": "Listing",
"type": "string",
"description": "Name of a relevant list of mountains that the peak belongs to. See List of mountain lists for examples."
},
"range": {
"required": false,
"label": "Range",
"type": "string",
"description": "Mountain range if applicable. The specific range subgroup should be provided instead of any major mountain system unless there is no applicable subgroup. For example, use Teton Range and not Rocky Mountains or Bernese Alps not Alps."
},
"coordinates": {
"required": false,
"label": "Coordinates",
"type": "string",
"description": "The latitude and longitude of the summit using the {{coord}} template with display=inline,title. If the article uses a geolinks template in the external links section, do not use the display parameter."
},
"topo": {
"required": false,
"label": "Topo",
"type": "string",
"description": "Topographic map"
},
"grid_ref_UK": {
"required": false,
"label": "Grid ref (UK)",
"type": "string",
"description": "Ordnance Survey (UK) grid reference for the mountain, passed to {{Gbmappingsmall}}."
},
"grid_ref_UK_ref": {
"required": false,
"label": "Notes for grid_ref_UK",
"description": "Notes for grid_ref_UK, e.g., a citation."
},
"grid_ref_Ireland": {
"required": false,
"label": "Grid ref (Ireland)",
"type": "string",
"description": "Ordnance Survey(Ireland) grid reference for the mountain, passed to {{iem4ibx}}."
},
"grid_ref_Ireland_ref": {
"required": false,
"label": "Notes for grid_ref_Ireland",
"description": "Notes for grid_ref_Ireland, e.g., a citation."
},
"coord_type": {
"required": false,
"label": "Coordinate type",
"default": "mountain",
"type": "string",
"description": "Type, from [[Wikipedia:WikiProject Geographical coordinates/type:]]."
},
"region_code": {
"required": false,
"label": "Region",
"type": "line",
"description": "Either a two character ISO 3166-1 alpha-2 country code or an ISO 3166-2 region code. See [[Wikipedia:COORD REGION]]."
},
"source": {
"required": false,
"label": "Source",
"type": "string",
"description": "The source of the coordinate data. See [[Wikipedia:COORD SOURCE]]."
},
"format": {
"required": false,
"label": "Format",
"default": "dms",
"type": "line",
"description": "Format to display degrees in the coordinate listing. dms for degree, minutes, second output (the default), or dec for decimal degree output."
},
"coordinates_ref": {
"required": false,
"label": "Coordinates ref",
"type": "string",
"description": "For any references regarding the coordinates reported. <ref> </ref> tags must be used."
},
"type": {
"required": false,
"label": "Type",
"type": "line",
"description": "The type of mountain — see List of mountain types."
},
"age": {
"required": false,
"label": "Age",
"type": "line",
"description": "Age of the rock. Geologic time scales may be useful here."
},
"volcanic_arc": {
"required": false,
"label": "Volcanic arc",
"type": "string",
"description": "If the mountain is a volcano, arc in which it is situated."
},
"volcanic_belt": {
"required": false,
"label": "Volcanic belt",
"type": "string",
"description": "If the mountain is a volcano, belt in which it is situated."
},
"volcanic_field": {
"required": false,
"label": "Volcanic field",
"type": "string",
"description": "If the mountain is a volcano, field in which it is situated."
},
"volcanic_zone": {
"required": false,
"label": "Volcanic zone",
"type": "string",
"description": "If the mountain is a volcano, the general zone or region in which it is situated."
},
"last_eruption": {
"required": false,
"label": "Last eruption",
"type": "string",
"description": "The date of the last eruption if the mountain is of volcanic origin. Only use Unknown if a verifiable source such as the Global Volcanism Program states it as such."
},
"first_ascent": {
"required": false,
"label": "First ascent",
"type": "string",
"description": "Date of the first ascent, if known. Typically, this is the first recorded ascent but not necessarily the first true ascent. If it is quite probable the peak/mountain was ascended by local people before then, a footnote should be added."
},
"easiest_route": {
"required": false,
"label": "Easiest route",
"type": "string",
"description": "The easiest route to the summit. Some possibilities include Hike, Scramble or any of the YDS grades."
},
"embedded": {
"required": false,
"label": "Embedded",
"type": "string",
"description": "Another Infobox to place within the mountain infobox. The other infobox will show up at the end of the mountain infobox. The other infobox needs to have its \"embedded\" or \"child\" parameter set to 1 or yes, as appropriate."
},
"child": {
"required": false,
"type": "line",
"label": "Child",
"description": "\"yes\" if the mountain infobox is embedded inside another Infobox"
},
"map_size": {
"required": false,
"default": "250",
"type": "number",
"label": "Map size",
"description": "Size of the map, in pixels. Must be entered as a number. The default value is 250."
},
"image_size": {
"required": false,
"type": "number",
"label": "Image size",
"description": "Width of the image, if less than 280px."
},
"subbox": {
"label": "Subbox",
"description": "Use this infobox as a subbox of another",
"type": "boolean"
},
"suppressfields": {
"label": "Suppress fields",
"description": "list of fields to never fetch from Wikidata",
"type": "string"
},
"fetchwikidata": {
"label": "Fetch from Wikidata",
"description": "List of fields to fetch from Wikidata"
},
"onlysourced": {
"label": "Get only sourced Wikidata",
"description": "Fetch only sourced data from Wikidata",
"type": "boolean",
"autovalue": "true"
},
"image_upright": {
"label": "Upright",
"description": "Size of imagegraph, fed to upright= parameter of image Wikimarkup",
"example": "1.0",
"type": "number"
},
"range_coordinates": {
"label": "Range coordinates",
"description": "If article is about a mountain range, coordinates of the center of the range. Please use the {{coord}} template to specify.",
"type": "content"
},
"range_coordinates_ref": {},
"map_upright": {
"label": "Map upright",
"description": "Size of map, expressed as \"upright\" parameter to image Wikimarkup",
"example": "1.0",
"type": "number"
},
"highest": {
"label": "Highest point",
"description": "Name of highest peak or summit",
"type": "string"
},
"highest_location": {
"label": "Highest location",
"description": "Location of highest point/summit. Use hierarchical administrative boundaries, e.g., county/state/country",
"type": "string"
},
"refs": {
"label": "Wikidata refs",
"description": "When set to \"yes\", use references from Wikidata",
"type": "boolean",
"default": "no"
},
"elevation_system": {
"label": "Elevation system",
"description": "Elevation system (i.e., vertical datum) for elevation from Wikidata"
},
"isolation": {
"label": "Isolation",
"description": "Distance to nearest highest peak, in freeform text. Typically this is filled with a {{convert}} template",
"type": "content"
},
"isolation_km": {
"label": "Isolation (kilometers)",
"description": "Kilometers to nearest peak higher than subject of article. Use number without commas",
"type": "number"
},
"isolation_mi": {
"label": "Isolation (miles)",
"description": "Distance to nearest higher peak, in miles. Expressed as number with no commas",
"type": "number"
},
"isolation_parent": {
"label": "Isolation parent",
"description": "Name of nearest mountain that is higher than the subject of the article",
"type": "string"
},
"isolation_ref": {
"label": "Isolation note",
"description": "Reference for isolation data, or notes for isolation data",
"type": "string"
},
"length_km": {
"label": "Length (kilometers)",
"description": "Length of mountain range in kilometers: numeric value, no comma",
"type": "number"
},
"length_mi": {
"label": "Length (miles)",
"description": "Length of mountain range in miles, numeric value, no commas",
"type": "number"
},
"width_km": {
"label": "Width (kilometers)",
"description": "Width of mountain range along minor axis, in kilometers.",
"type": "number"
},
"width_mi": {
"label": "Width (miles)",
"description": "Width of mountain range in miles, numeric value",
"type": "number"
},
"area_mi2": {},
"area_km2": {},
"length": {
"label": "Length",
"description": "Freeform field for length of mountain range. Use {{convert}} template for correct unit conversion.",
"type": "content"
},
"length_orientation": {
"label": "Orientation",
"description": "The major axis of the mountain range",
"example": "N-S",
"type": "string"
},
"length_ref": {
"label": "Length note",
"description": "Reference for length data, or note about it",
"type": "content"
},
"width": {
"label": "Width",
"description": "Freeform field describing width of mountain range, typically using a {{convert}} template",
"type": "content"
},
"width_orientation": {
"label": "Width orientation",
"description": "Orientation of minor (shorter) axis of mountain range",
"example": "E-W",
"type": "string"
},
"width_ref": {
"label": "Width note",
"description": "Reference for width data, or supplementary note",
"type": "string"
},
"area": {},
"area_ref": {},
"volume": {},
"volume_km3": {},
"volume_mi3": {},
"volume_ref": {},
"nickname": {},
"authority": {},
"country": {},
"country_type": {},
"state": {
"aliases": [
"subdivision1"
]
},
"state_type": {
"aliases": [
"subdivision1_type"
]
},
"region": {
"aliases": [
"subdivision2"
]
},
"region_type": {
"aliases": [
"subdivision2_type"
]
},
"district": {
"aliases": [
"subdivision3"
]
},
"district_type": {
"aliases": [
"subdivision3_type"
]
},
"part": {
"aliases": [
"subdivision4"
]
},
"part_type": {
"aliases": [
"subdivision4_type"
]
},
"settlement_type": {},
"settlement": {},
"parent": {},
"borders_on": {},
"border": {},
"topo_maker": {},
"topo_map": {},
"biome": {},
"formed_by": {},
"orogeny": {},
"period": {},
"mountain_type": {},
"geology": {
"aliases": [
"rock"
]
},
"volcanic_region": {},
"normal_route": {},
"access": {},
"module": {},
"nocat_wdimage": {},
"mapframe": {
"label": "Show mapframe map",
"description": "Specify yes or no to show or hide the map, overriding the default",
"example": "yes",
"type": "string",
"default": "no",
"suggested": true
},
"mapframe-caption": {
"label": "Mapframe caption",
"description": "Caption for the map. If mapframe-geomask is set, then the default is \"Location in <<geomask's label>>\"",
"type": "string"
},
"mapframe-custom": {
"label": "Custom mapframe",
"description": "Use a custom map instead of the automatic mapframe. Specify either a {{maplink}} template, or another template that generates a mapframe map, or an image name. If used, other mapframe parameters will be ignored.",
"type": "wiki-template-name"
},
"mapframe-id": {
"aliases": [
"id",
"qid"
],
"label": "Mapframe Wikidata item",
"description": "Id (Q-number) of Wikidata item to use.",
"type": "string",
"default": "(item for current page)"
},
"mapframe-coordinates": {
"aliases": [
"mapframe-coord",
"coordinates",
"coord"
],
"label": "Mapframe coordinates ",
"description": "Coordinates to use, instead of any on Wikidata. Use the {{Coord}} template.",
"example": "{{Coord|12.34|N|56.78|E}}",
"type": "wiki-template-name",
"default": "(coordinates from Wikidata)"
},
"mapframe-wikidata": {
"label": "Mapframe shapes from Wikidata",
"description": "et to yes to show shape/line features from the wikidata item, if any, when coordinates are specified by parameter",
"example": "yes",
"type": "string"
},
"mapframe-shape": {
"label": "Mapframe shape feature",
"description": "Override display of mapframe shape feature. Turn off by setting to \"none\". Use an inverse shape (geomask) instead of a regular shape by setting to \"inverse\"",
"type": "string"
},
"mapframe-point": {
"label": "Mapframe point feature",
"description": "Override display of mapframe point feature. Turn off display of point feature by setting to \"none\". Force point marker to be displayed by setting to \"on\"",
"type": "string"
},
"mapframe-geomask": {
"label": "Mapframe geomask",
"description": "Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. P17 for country, or P131 for located in the administrative territorial entity)",
"example": "Q100",
"type": "wiki-page-name"
},
"mapframe-switcher": {
"label": "Mapframe switcher",
"description": "Set to \"auto\" or \"geomasks\" or \"zooms\" to enable Template:Switcher-style switching between multiple mapframes. IF SET TO auto – switch geomasks found in location (P276) and located in the administrative territorial entity (P131) statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country. IF SET TO geomasks – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the mapframe-geomask parameter. IF SET TO zooms – switch between \"zoomed in\"/\"zoomed midway\"/\"zoomed out\", where \"zoomed in\" is the default zoom (with a minimum of 3), \"zoomed out\" is 1, and \"zoomed midway\" is the average.",
"type": "string"
},
"mapframe-frame-width": {
"aliases": [
"mapframe-width"
],
"label": "Mapframe width",
"description": "Frame width in pixels",
"type": "number",
"default": "270"
},
"mapframe-frame-height": {
"aliases": [
"mapframe-height"
],
"label": "Mapframe height",
"description": "Frame height in pixels",
"type": "number",
"default": "200"
},
"mapframe-shape-fill": {
"label": "Mapframe shape fill",
"description": "Color used to fill shape features",
"type": "string",
"default": "#606060"
},
"mapframe-shape-fill-opacity": {
"label": "Mapframe shape fill opacity",
"description": "Opacity level of shape fill, a number between 0 and 1",
"type": "number",
"default": "0.5"
},
"mapframe-stroke-color": {
"aliases": [
"mapframe-stroke-colour"
],
"label": "Mapframe stroke color",
"description": "Color of line features, and outlines of shape features",
"type": "string",
"default": "#ff0000"
},
"mapframe-stroke-width": {
"label": "Mapframe stroke width",
"description": "Width of line features, and outlines of shape features",
"type": "number",
"default": "5"
},
"mapframe-marker": {
"label": "Mapframe marker",
"description": "Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options",
"example": "museum",
"type": "string"
},
"mapframe-marker-color": {
"aliases": [
"mapframe-marker-colour"
],
"label": "Mapframe marker color",
"description": "Background color for the marker",
"type": "string",
"default": "#5E74F3"
},
"mapframe-geomask-stroke-color": {
"aliases": [
"mapframe-geomask-stroke-colour"
],
"label": "Mapframe geomask stroke color",
"description": "Color of outline of geomask shape",
"type": "string",
"default": "#555555"
},
"mapframe-geomask-stroke-width": {
"label": "Mapframe geomask stroke width",
"description": "Width of outline of geomask shape",
"type": "number",
"default": "2"
},
"mapframe-geomask-fill": {
"label": "Mapframe geomask fill",
"description": "Color used to fill outside geomask features",
"type": "string",
"default": "#606060"
},
"mapframe-geomask-fill-opacity": {
"label": "Mapframe geomask fill opacity",
"description": "Opacity level of fill outside geomask features, a number between 0 and 1",
"type": "number",
"default": "0.5"
},
"mapframe-zoom": {
"label": "Mapframe zoom",
"description": "Set the zoom level, from \"1\" to \"18\", to used if the zoom level cannot be determined automatically from object length or area",
"example": "12",
"type": "number",
"default": "10"
},
"mapframe-length_km": {
"label": "Mapframe length (km)",
"description": "Object length in kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area",
"type": "number"
},
"mapframe-length_mi": {
"label": "Mapframe length (mi)",
"description": "Object length in miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area",
"type": "number"
},
"mapframe-area_km2": {
"label": "Mapframe area (km^2)",
"description": "Object arean square kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area",
"type": "number"
},
"mapframe-area_mi2": {
"label": "Mapframe area (mi^2)",
"description": "Object area in square miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area",
"type": "number"
},
"mapframe-frame-coordinates": {
"aliases": [
"mapframe-frame-coord"
],
"label": "Mapframe frame coordinates",
"description": "Alternate latitude and longitude coordinates for initial placement of map, using {{coord}}",
"example": "{{Coord|12.35|N|56.71|E}}",
"type": "wiki-template-name"
},
"mapframe-line": {},
"image_width": {},
"coords_ref": {},
"pushpin_map": {
"label": "Pushpin map",
"description": "The name of a location map as per Template:Location map (e.g. Indonesia or Russia). The coordinate fields position a pushpin coordinate marker and label on the map automatically. Example see: Mount Everest. For a static image, use map_image",
"type": "string"
},
"pushpin_relief": {
"label": "Pushpin relief",
"description": "If a location map template is specified, this template will attempt to display a relief map if one is available. To force the default map image to display set to 0.",
"type": "string"
},
"pushpin_label": {
"label": "Pushpin label",
"description": "Label to be used for the mountain's location on the map. If not specified, the value of the name parameter is used.",
"type": "string"
},
"pushpin_label_position": {
"label": "Pushpin label position",
"description": "The position of the label on the pushpin map relative to the pushpin coordinate marker. Valid options are {left, right, top, bottom, none}.",
"type": "line",
"default": "right"
}
},
"paramOrder": [
"name",
"other_name",
"etymology",
"native_name",
"native_name_lang",
"language",
"translation",
"pronunciation",
"image",
"image_alt",
"image_size",
"image_upright",
"image_caption",
"map_size",
"map_upright",
"map_image",
"map_alt",
"map_caption",
"location",
"pushpin_map",
"pushpin_relief",
"pushpin_label",
"pushpin_label_position",
"highest",
"highest_location",
"elevation",
"elevation_m",
"elevation_ft",
"elevation_ref",
"prominence",
"prominence_m",
"prominence_ft",
"prominence_ref",
"parent_peak",
"isolation",
"isolation_km",
"isolation_mi",
"isolation_parent",
"isolation_ref",
"listing",
"range",
"coordinates",
"coordinates_ref",
"range_coordinates",
"range_coordinates_ref",
"coord_type",
"region_code",
"format",
"source",
"topo",
"grid_ref_UK",
"grid_ref_UK_ref",
"grid_ref_Ireland",
"grid_ref_Ireland_ref",
"length",
"length_km",
"length_mi",
"length_orientation",
"length_ref",
"width",
"width_km",
"width_mi",
"width_orientation",
"width_ref",
"type",
"age",
"volcanic_arc",
"volcanic_belt",
"volcanic_field",
"volcanic_zone",
"last_eruption",
"first_ascent",
"easiest_route",
"embedded",
"child",
"subbox",
"suppressfields",
"fetchwikidata",
"onlysourced",
"refs",
"elevation_system",
"area_mi2",
"area_km2",
"area",
"area_ref",
"volume",
"volume_km3",
"volume_mi3",
"volume_ref",
"nickname",
"authority",
"country",
"country_type",
"state",
"state_type",
"region",
"region_type",
"district",
"district_type",
"part",
"part_type",
"settlement",
"settlement_type",
"parent",
"borders_on",
"border",
"topo_maker",
"topo_map",
"biome",
"formed_by",
"orogeny",
"period",
"mountain_type",
"geology",
"volcanic_region",
"normal_route",
"access",
"module",
"nocat_wdimage",
"mapframe",
"mapframe-caption",
"mapframe-custom",
"mapframe-id",
"mapframe-coordinates",
"mapframe-wikidata",
"mapframe-shape",
"mapframe-point",
"mapframe-geomask",
"mapframe-switcher",
"mapframe-frame-width",
"mapframe-frame-height",
"mapframe-shape-fill",
"mapframe-shape-fill-opacity",
"mapframe-stroke-color",
"mapframe-stroke-width",
"mapframe-marker",
"mapframe-marker-color",
"mapframe-geomask-stroke-color",
"mapframe-geomask-stroke-width",
"mapframe-geomask-fill",
"mapframe-geomask-fill-opacity",
"mapframe-zoom",
"mapframe-length_km",
"mapframe-length_mi",
"mapframe-area_km2",
"mapframe-area_mi2",
"mapframe-frame-coordinates",
"mapframe-line",
"image_width",
"coords_ref"
]
}
</templatedata>
{{collapse bottom}}
== Microformat ==
{{UF-hcard-geo}}
<includeonly>{{sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Embeddable templates]]
[[Category:Geology infobox templates]]
[[Category:Infobox templates with module parameter|Mountain]]
[[Category:Templates with coordinates fields]]
[[Category:Mountain templates]]
[[Category:Place infobox templates|Mountain]]
[[Category:Templates that add a tracking category]]
[[Category:WikiProject Mountains templates]]
}}</includeonly>
4h68b311j52mcwxpryaak2zyqym14qx
74799
74798
2026-08-24T00:15:11Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mountain/doc]]
74798
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{Lua|Module:Infobox|Module:WikidataIB|Module:InfoboxImage|Module:Check for unknown parameters|Module:Coordinates}}
{{Uses Wikidata|P18|P2044|P2660|P3137|P2659|P361|P2043|P2049|P2046|P2234}}
<!--
== Wikidata-enabled ==
Simply add <code><nowiki>{{Infobox mountain}}</nowiki></code> to the top of an article, and the data will be automatically included from [[Wikidata]]. If necessary, these values can be overridden by passing local values to the relevant parameters in the article:
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox mountain
| name = [local value]
}}
</syntaxhighlight>
To add data to Wikidata, please see the Parameters section below.
{{Clear}}
-->
== Standard usage ==
{{Parameter names example
| name
| other_name
| image
| image_size
| image_upright
| image_alt
| image_caption
| mapframe = no
| highest
| highest_location
| elevation
| elevation_ref
| elevation_system
| prominence
| prominence_ref
| parent_peak
| isolation
| isolation_parent
| isolation_ref
| listing
| coordinates
| coordinates_ref
| length
| length_orientation
| length_ref
| width
| width_orientation
| width_ref
| area
| area_ref
| volume
| volume_ref
| etymology
| nickname
| native_name
| native_name_lang
| translation
| pronunciation
| authority
| location
| country
| country_type
| state
| state_type
| region
| region_type
| district
| district_type
| part
| part_type
| settlement
| settlement_type
| range_coordinates
| range_coordinates_ref
| range
| borders_on
| grid_ref_UK
| grid_ref_UK_ref
| grid_ref_Ireland
| grid_ref_Ireland_ref
| topo_maker
| topo_map
| biome
| formed_by
| orogeny
| age
| type
| geology
| volcanic_zone
| volcanic_arc
| volcanic_belt
| volcanic_field
| last_eruption
| first_ascent
| easiest_route
| normal_route
| access
| embedded
| module
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox mountain
| name =
| other_name =
| image =
| image_size =
| image_upright =
| image_alt =
| image_caption =
| map =
<!----------------------- HIGHEST POINT -->
| highest =
| highest_location =
| elevation_m =
| elevation_ft =
| elevation_ref =
| elevation_system =
| prominence_m =
| prominence_ft =
| prominence_ref =
| parent_peak =
| isolation_km =
| isolation_mi =
| isolation_parent =
| isolation_ref =
| listing =
| coordinates =
| coordinates_ref =
<!----------------------- DIMENSIONS -->
| length_km =
| length_mi =
| length_orientation =
| length_ref =
| width_km =
| width_mi =
| width_orientation =
| width_ref =
| area_km2 =
| area_mi2 =
| area_ref =
| volume_km3 =
| volume_mi3 =
| volume_ref =
<!----------------------- NAMING -->
| etymology =
| nickname =
| native_name = <!-- {{native name}} or {{native name list}} -->
| native_name_lang = <!-- not used by |native_name= -->
| translation =
| pronunciation =
| authority =
<!----------------------- GEOGRAPHY -->
| location = <!-- While location is not deprecated, use of country,state,region,district is preferred -->
| country_type = <!-- For Antarctica, set to Continent -->
| country = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| state_type =
| state = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| region_type =
| region = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| district_type =
| district = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| part_type =
| part = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| settlement_type =
| settlement = <!-- If multiple, use {{enum}} or {{hlist}}. -->
| range_coordinates =
| range_coordinates_ref =
| range =
| borders_on =
| grid_ref_UK =
| grid_ref_UK_ref =
| grid_ref_Ireland =
| grid_ref_Ireland_ref =
| topo_maker =
| topo_map =
| biome =
<!----------------------- GEOLOGY -->
| formed_by =
| orogeny =
| age =
| type =
| geology =
| volcanic_arc =
| volcanic_belt =
| volcanic_field =
| volcanic_zone =
| last_eruption =
<!----------------------- CLIMBING -->
| first_ascent =
| easiest_route =
| normal_route =
| access =
<!----------------------- ATTACHED -->
| module =
}}
</syntaxhighlight>
== Parameters ==
'''Note''': defaults from Wikidata are only used when {{para|fetchwikidata|ALL}}.
=== Lead section ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''name''' || Wikidata label in the local language || Name of the mountain, peak or hill.
|-
| '''other_name''' || || Other name for the mountain. See <code>native_name</code> if the name is in a different language.
|-
| '''image''' || Image on Wikidata || Imagegraph of the mountain. Preferably a distance shot to show most/all of the mountain rather than a view from the summit.
|-
| '''image_size''' || 280px || The default image width in pixels.
|-
| '''image_upright''' || ||
|-
| '''image_alt''' || <code>image_caption</code> || [[Wikipedia:Alternative text for images|Alt text]] for the image.
|-
| '''image_caption''' || {{Wikidata property link|P2096}} stated on image || Description of the imagegraph.
|}
=== Maps ===
The maps appear in the lead section, at the top, if there is no image present. However, if there is a image, they all move to the Geography section automatically.
==== Pushpin map ====
{{Location map/doc/infobox parameters
| pushpin_mark = Red triangle with thick white border.svg
| pushpin_mark_size = 16
}}
==== Mapframe maps ====
{{Infobox mapframe/doc/parameters
| onByDefault = yes, unless one of these parameters has a value: {{parameter|pushpin_map}}, {{parameter|image_map}}
| mapframe-coord = the first of the following: {{parameter|mapframe-coordinates}}, {{parameter|mapframe-coord}}, {{parameter|range_coordinates}}, {{parameter|range_coords}}, {{parameter|coordinates}}, {{parameter|coords}}
| mapframe-frame-width = 250
| mapframe-wikidata = yes, unless one of these parameters has a value: {{parameter|mapframe-coordinates}}, {{parameter|mapframe-coord}}, {{parameter|range_coordinates}}, {{parameter|range_coords}}, {{parameter|coordinates}}, {{parameter|coords}}
| mapframe-marker = mountain
| mapframe-type = mountain
| mapframe-length_km = {{parameter|length_km}}
| mapframe-length_mi = {{parameter|length_mi}}
| mapframe-width_km = {{parameter|width_km}}
| mapframe-width_mi = {{parameter|width_mi}}
| mapframe-area_mi2 = {{parameter|area_mi2}}
| mapframe-area_km2 = {{parameter|area_km2}}
| mapframe-id = {{parameter|qid}}
}}
=== Highest point ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''highest''' || {{Wikidata property link|P2044}} with qualifier {{Wikidata property link|P2561}} || Name of the highest summit of a single mountain or peak.
|-
| '''highest_location''' || {{Wikidata property link|P2044}} with qualifier {{Wikidata property link|P276}} || Location of highest summit.
|-
| '''elevation''' || rowspan=3 | {{Wikidata property link|P2044}} || Summit [[elevation]], without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|m|ft|abbr=on}}</nowiki></code>
|-
| '''elevation_m''' || Summit elevation in metres, with auto-conversion.
|-
| '''elevation_ft''' || Summit elevation in feet, with auto-conversion.
|-
| '''elevation_ref''' || N/A || Optional parameter to add a suffix to the <code>elevation</code> parameters (such as a reference).
|-
| '''elevation_system''' || {{Wikidata property link|P2044}} with qualifier {{Wikidata property link|P459}} || The elevation reference system that defines the elevation, e.g., NAVD88 or DE-NHN
|-
| '''prominence''' || rowspan=3 | {{Wikidata property link|P2660}} || [[Topographic prominence]], without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|m|ft|abbr=on}}</nowiki></code>
|-
| '''prominence_m''' || Topographic prominence in metres, with auto-conversion.
|-
| '''prominence_ft''' || Topographic prominence in metres, with auto-conversion.
|-
| '''prominence_ref''' || N/A || Optional parameter to add a suffix to the <code>prominence</code> parameters (such as a reference).
|-
| '''parent_peak''' || {{Wikidata property link|P3137}} ||
|-
| '''isolation''' || rowspan=3 | {{Wikidata property link|P2659}} || [[Topographic isolation]], without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km|mi|abbr=on}}</nowiki></code>
|-
| '''isolation_km''' || Topographic isolation in kilometres, with auto-conversion.
|-
| '''isolation_mi''' || Topographic isolation in miles, with auto-conversion.
|-
| '''isolation_parent''' || {{Wikidata property link|P2659}} with qualifier {{Wikidata property link|P2210}} || Name of the landform the summit is isolated from.
|-
| '''isolation_ref''' || N/A || Optional parameter to add a suffix to the <code>isolation</code> parameters (such as a reference).
|-
| '''listing''' || {{Wikidata property link|P361}} || Name of a relevant list of mountains that the peak belongs to. See [[List of mountain lists]] for examples.
|-
| '''coordinates''' || {{Wikidata property link|P625}} || [[Geographic coordinate system|Coordinates]] of the highest point or peak.
|-
| '''coordinates_ref''' || N/A || Optional parameter to add a suffix to the <code>coordinates</code> parameter (such as a reference).
|}
=== Dimensions ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''length''' || rowspan=3 | {{Wikidata property link|P2043}} || Length of the mountain or peak, without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km|mi|abbr=on}}</nowiki></code>
|-
| '''length_km''' || Length in kilometres, with auto-conversion.
|-
| '''length_mi''' || Length in miles, with auto-conversion.
|-
| '''length_orientation''' || {{Wikidata property link|P2043}} with qualifier {{Wikidata property link|P7469}} as:<br/>{{Wikidata entity link|Q34027}} (for EW) or {{Wikidata entity link|Q36477}} (for NS) || Length orientation.
|-
| '''length_ref''' || N/A || Optional parameter to add a suffix to the <code>length</code> parameters (such as a reference).
|-
| '''width''' || rowspan=3 | {{Wikidata property link|P2049}} || Width of the mountain or peak, without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km|mi|abbr=on}}</nowiki></code>
|-
| '''width_km''' || Length in kilometres, with auto-conversion.
|-
| '''width_mi''' || Length in miles, with auto-conversion.
|-
| '''width_orientation''' || {{Wikidata property link|P2049}} with qualifier {{Wikidata property link|P7469}} as:<br/>{{Wikidata entity link|Q34027}} (for EW) or {{Wikidata entity link|Q36477}} (for NS) || Width orientation.
|-
| '''width_ref''' || N/A || Optional parameter to add a suffix to the <code>width</code> parameters (such as a reference).
|-
| '''area''' || rowspan=3 | {{Wikidata property link|P2046}} || Footprint of the mountain or peak, without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km2|mi2|abbr=on}}</nowiki></code>
|-
| '''area_km2''' || Footprint of the mountain or peak in square kilometres, with auto-conversion.
|-
| '''area_mi2''' || Footprint of the mountain or peak in square miles, with auto-conversion.
|-
| '''area_ref''' || N/A || Optional parameter to add a suffix to the <code>area</code> parameters (such as a reference).
|-
| '''volume''' || rowspan=3 | {{Wikidata property link|P2234}} || Volume of the mountain or peak, without auto-conversion. You may wish to use <code><nowiki>{{</nowiki>[[Template:Convert|Convert]]<nowiki>|xxx|km3|mi3|abbr=on}}</nowiki></code>
|-
| '''volume_km3''' || Volume of the mountain or peak in cubic kilometres, with auto-conversion.
|-
| '''volume_mi3''' || Volume of the mountain or peak in cubic miles, with auto-conversion.
|-
| '''volume_ref''' || N/A || Optional parameter to add a suffix to the <code>volume</code> parameters (such as a reference).
|}
=== Naming ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''etymology''' || {{Wikidata property link|P138}} || Origin of name
|-
| '''nickname''' || {{Wikidata property link|P1449}} ||
|-
| '''native_name''' || {{Wikidata property link|P1559}} || Name in local language – use {{tl|native name}} or, for multiple names, use {{tl|native name list}}
|-
| '''native_name_lang''' || {{Wikidata property link|P1559}} || [[ISO 639-2]] code of <code>native_name</code>; not used by '''native_name'''.
|-
| '''translation''' || {{Wikidata property link|P1559}} with qualifier {{Wikidata property link|P2441}} || Translation of name to English (if name is not an English name)
|-
| '''pronunciation''' || {{Wikidata property link|P898}} || Use an appropriate IPA-xx template, replacing 'xx' with the ISO code for the language. (See {{tl|IPAc-en}} for English.)
|-
| '''authority''' || || The government agency responsible for making names official.
|}
=== Geography ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''location''' || {{Wikidata property link|P276}} || Free-form field to describe the location.
|-
| '''country''' || {{Wikidata property link|P17}} || Country(ies) of the peak or mountain.
|-
| '''country_type''' || || Optional parameter to override the default "Country" label.
|-
| '''subdivision1'''/'''state''' || {{Wikidata property link|P131}} || 1st level subdivision (i.e. states) of the peak or mountain.
|-
| '''subdivision1_type'''/'''state_type''' || || Optional parameter to override the default "State" label.
|-
| '''subdivision2'''/'''region''' || || 2nd level subdivision (i.e. regions) of the peak or mountain.
|-
| '''subdivision2_type'''/'''region_type''' || || Optional parameter to override the default "Region" label.
|-
| '''subdivision3'''/'''district''' || || 3rd level subdivision (i.e. districts) of the peak or mountain.
|-
| '''subdivision3_type'''/'''district_type''' || || Optional parameter to override the default "District" label.
|-
| '''subdivision4'''/'''part''' || || 4th level subdivision (i.e. subdivisions) of the peak or mountain.
|-
| '''subdivision4_type'''/'''part_type''' || || Optional parameter to override the default "Subdivisions" label.
|-
| '''settlement''' || || Settlement(s) on/around the peak or mountain.
|-
| '''settlement_type''' || || Optional parameter to override the default "Settlement" label.
|-
| '''range_coordinates''' || || Typically marks the centre of the mountain range. Do not use for an individual mountain.
|-
| '''range_coordinates_ref''' || N/A || Optional parameter to add a suffix to the <code>range_coordinates</code> parameter (such as a reference).
|-
| '''range''' || {{Wikidata property link|P4552}} || The [[mountain range]] (specific subgroup) that the mountain/massif/range. I.e. [[Bernese Alps]], not [[Alps]]. Alias is "parent".
|-
| '''borders_on'''/'''border''' || {{Wikidata property link|P4777}} || Geographical entities that form the border of the mountain or range
|-
| '''grid_ref_UK''' || {{Wikidata property link|P613}} || If the mountain is in Great Britain, the [[British national grid reference system|British grid reference]]. Use <code>grid_ref_UK_ref</code> to add a suffix reference.
|-
| '''grid_ref_Ireland''' || {{Wikidata property link|P4091}} || If the mountain is in Ireland (whether [[Northern Ireland]] or the [[Republic of Ireland|Republic]]), the [[Irish national grid reference system|Irish grid reference]]. Use <code>grid_ref_Ireland_ref</code> to add a suffix reference.
|-
| '''topo''' || || The publisher/maker and name of the topographic map.
|-
| '''topo_maker''' || || The publisher or maker of the topographic map. e.g. NTS (Canada) or USGS (United States).
|-
| '''topo_map''' || || The name of the topographic map.
|-
| '''biome''' || || [[Biome]](s) for range
|}
===Geology===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''formed_by''' || ||
|-
| '''orogeny''' || ||
|-
| '''age''' || || Age of the rock. [[Geologic time scale]]s may be useful here.
|-
| '''type''' || ||
|-
| '''rock''' || || Type of the rock mountain is made from. <code>geology</code> is an alias.
|-
| '''volcanic arc''' || || If the mountain is a volcano, the [[volcanic arc|arc]] where it is located
|-
| '''volcanic belt''' || || If the mountain is a volcano, the [[volcanic belt|belt]] where it is located
|-
| '''volcanic field''' || || If the mountain is a volcano, the [[volcanic field|field]] where it is located
|-
| '''volcanic zone''' || || If the mountain is a volcano, the general zone or region where it is located, if none of the other volcanic parameters are applicable
|-
| '''last_eruption''' || || The date of the last eruption if the mountain is of volcanic origin.
|}
=== Climbing ===
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''first_ascent''' || || Date of the first recorded ascent.
|-
| '''easiest_route''' || || The easiest route to the summit. Some possibilities include [[Hiking|Hike]], [[Scrambling|Scramble]] or any of the [[Yosemite Decimal System|YDS]] grades.
|-
| '''normal_route''' || ||
|-
| '''access''' || ||
|-
|}
=== Advanced uses ===
{{no documentation}}
{| class="wikitable"
|-
! align="center" | Parameter !! align="center" | Default value !! align="center" | Description
|-
| '''qid''' || ||
|-
| '''suppressfields''' || ||
|-
| '''fetchwikidata''' || ||
|-
| '''onlysourced''' || ||
|-
| '''child''' || ||
|-
| '''embedded''' || ||
|-
| '''module''' || ||
|-
|}
== Tracking categories ==
{{Infobox tracking categories}}
* {{Category link with count|Wikidata value to be checked for Infobox mountain}}
* {{Category link with count|Pages using infobox mountain with language parameter}}
== Template data ==
{{collapse top|title=[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"format": "block",
"description": "This template is used to create an infobox for an article about a mountain.",
"params": {
"name": {
"required": true,
"label": "Name",
"type": "string",
"description": "Name of the mountain, peak or hill. If more than one mountain by the name exists, the article is likely disambiguated but this name in the infobox should be the undisambiguated name. For example, Mount Columbia (for Mount Columbia (Canada) or Mount Columbia (Colorado)."
},
"other_name": {
"required": false,
"label": "Other name",
"type": "string",
"description": "An alternate English name for the mountain, e.g., \"Mount McKinley\" for Denali. Quotes can be used as normal to italicize or bold the text if desired."
},
"etymology": {
"required": false,
"label": "Etymology",
"type": "string",
"description": "The etymology of the name"
},
"native_name": {
"required": false,
"label": "Native name",
"type": "string",
"description": "The name of the mountain in the local language, if not English."
},
"native_name_lang": {
"required": false,
"label": "ISO 639 language code",
"type": "string",
"description": "The ISO 639 code for the language of the mountain name (if not English). e.g., \"fr\" for French"
},
"language": {
"required": false,
"label": "Language",
"type": "string",
"description": "Language of mountain name."
},
"translation": {
"required": false,
"label": "Translation",
"type": "string",
"description": "Translation of the mountain's name into English"
},
"pronunciation": {
"required": false,
"label": "Pronunciation",
"type": "string",
"description": "Use an appropriate IPA-xx template, replacing 'xx' with the ISO code for the language. (See {{IPAc-en}} for English.)"
},
"image": {
"required": false,
"label": "Image",
"type": "string",
"description": "Imagegraph of the mountain. Preferably a distance shot to show most/all of the mountain rather than a view from the summit. Do not include the \"File:\" prefix. If uploading a new image, please put them on Commons so they can be easily used by the other language Wikipedias. If the only image available is less than 280px wide, you can use the image_size parameter to indicate its size."
},
"image_alt": {
"required": false,
"label": "Image alt",
"type": "string",
"description": "Alt text for the image, primarily for visually impaired readers. See Wikipedia:Alternative text for images."
},
"image_caption": {
"required": false,
"label": "Image caption",
"type": "string",
"description": "Description of the imagegraph which is displayed below. Include the month and year if known."
},
"map_image": {
"required": false,
"label": "Map image",
"type": "string",
"description": "The file name of a static map image to be displayed. For a [[Template:location map|location map]], use map"
},
"map_alt": {
"required": false,
"label": "Map alt",
"type": "string",
"description": "Alt text for the map, primarily for visually impaired readers. See [[Wikipedia:Alternative text for images#Maps]]."
},
"map_caption": {
"required": false,
"label": "Map caption",
"type": "string",
"description": "Fill out if a map caption is desired. If not specified, location will be used."
},
"location": {
"required": false,
"label": "Location",
"type": "string",
"description": "Province or state first, followed by country. For the US, the county is optional but if given, be provided before the state. If a pushpin map is being used, the location will be used for the map's caption unless the map_caption parameter is set."
},
"elevation": {
"required": false,
"label": "Elevation",
"type": "string",
"description": "Maximum height of the mountain. If the mountain has multiple high points, use the highest. Metres should be used first for all mountains outside of the United States and feet for those within the U.S. For conversions, use elevation_m for metres to feet or elevation_ft for feet to metres. This field is required."
},
"elevation_m": {
"required": false,
"label": "Elevation (meters)",
"type": "string",
"description": "Maximum height of the mountain, metres."
},
"elevation_ft": {
"required": false,
"label": "Elevation (feet)",
"type": "string",
"description": "Maximum height of the mountain, feet."
},
"elevation_ref": {
"required": false,
"label": "Elevation ref",
"type": "string",
"description": "Reference for the elevation using the standard <ref> </ref> tags. If elevation_m/elevation_ft was used, the reference must be supplied using this parameter."
},
"prominence": {
"required": false,
"label": "Prominence",
"type": "string",
"description": "The clean topographic prominence of the summit. For conversions, use prominence_m for metres to feet or prominence_ft for feet to metres."
},
"prominence_m": {
"required": false,
"label": "Prominence (meters)",
"type": "string",
"description": "The clean topographic prominence of the summit, metres."
},
"prominence_ft": {
"required": false,
"label": "Prominence (feet)",
"type": "string",
"description": "The clean topographic prominence of the summit, feet."
},
"prominence_ref": {
"required": false,
"label": "Prominence ref",
"type": "string",
"description": "Reference for the prominence using the standard <ref> </ref> tags."
},
"parent_peak": {
"required": false,
"label": "Parent peak",
"type": "string",
"description": "In computation of prominence, peaks form a hierarchy: this is the parent of the peak in the hierarchy. For more information, see Line parent."
},
"listing": {
"required": false,
"label": "Listing",
"type": "string",
"description": "Name of a relevant list of mountains that the peak belongs to. See List of mountain lists for examples."
},
"range": {
"required": false,
"label": "Range",
"type": "string",
"description": "Mountain range if applicable. The specific range subgroup should be provided instead of any major mountain system unless there is no applicable subgroup. For example, use Teton Range and not Rocky Mountains or Bernese Alps not Alps."
},
"coordinates": {
"required": false,
"label": "Coordinates",
"type": "string",
"description": "The latitude and longitude of the summit using the {{coord}} template with display=inline,title. If the article uses a geolinks template in the external links section, do not use the display parameter."
},
"topo": {
"required": false,
"label": "Topo",
"type": "string",
"description": "Topographic map"
},
"grid_ref_UK": {
"required": false,
"label": "Grid ref (UK)",
"type": "string",
"description": "Ordnance Survey (UK) grid reference for the mountain, passed to {{Gbmappingsmall}}."
},
"grid_ref_UK_ref": {
"required": false,
"label": "Notes for grid_ref_UK",
"description": "Notes for grid_ref_UK, e.g., a citation."
},
"grid_ref_Ireland": {
"required": false,
"label": "Grid ref (Ireland)",
"type": "string",
"description": "Ordnance Survey(Ireland) grid reference for the mountain, passed to {{iem4ibx}}."
},
"grid_ref_Ireland_ref": {
"required": false,
"label": "Notes for grid_ref_Ireland",
"description": "Notes for grid_ref_Ireland, e.g., a citation."
},
"coord_type": {
"required": false,
"label": "Coordinate type",
"default": "mountain",
"type": "string",
"description": "Type, from [[Wikipedia:WikiProject Geographical coordinates/type:]]."
},
"region_code": {
"required": false,
"label": "Region",
"type": "line",
"description": "Either a two character ISO 3166-1 alpha-2 country code or an ISO 3166-2 region code. See [[Wikipedia:COORD REGION]]."
},
"source": {
"required": false,
"label": "Source",
"type": "string",
"description": "The source of the coordinate data. See [[Wikipedia:COORD SOURCE]]."
},
"format": {
"required": false,
"label": "Format",
"default": "dms",
"type": "line",
"description": "Format to display degrees in the coordinate listing. dms for degree, minutes, second output (the default), or dec for decimal degree output."
},
"coordinates_ref": {
"required": false,
"label": "Coordinates ref",
"type": "string",
"description": "For any references regarding the coordinates reported. <ref> </ref> tags must be used."
},
"type": {
"required": false,
"label": "Type",
"type": "line",
"description": "The type of mountain — see List of mountain types."
},
"age": {
"required": false,
"label": "Age",
"type": "line",
"description": "Age of the rock. Geologic time scales may be useful here."
},
"volcanic_arc": {
"required": false,
"label": "Volcanic arc",
"type": "string",
"description": "If the mountain is a volcano, arc in which it is situated."
},
"volcanic_belt": {
"required": false,
"label": "Volcanic belt",
"type": "string",
"description": "If the mountain is a volcano, belt in which it is situated."
},
"volcanic_field": {
"required": false,
"label": "Volcanic field",
"type": "string",
"description": "If the mountain is a volcano, field in which it is situated."
},
"volcanic_zone": {
"required": false,
"label": "Volcanic zone",
"type": "string",
"description": "If the mountain is a volcano, the general zone or region in which it is situated."
},
"last_eruption": {
"required": false,
"label": "Last eruption",
"type": "string",
"description": "The date of the last eruption if the mountain is of volcanic origin. Only use Unknown if a verifiable source such as the Global Volcanism Program states it as such."
},
"first_ascent": {
"required": false,
"label": "First ascent",
"type": "string",
"description": "Date of the first ascent, if known. Typically, this is the first recorded ascent but not necessarily the first true ascent. If it is quite probable the peak/mountain was ascended by local people before then, a footnote should be added."
},
"easiest_route": {
"required": false,
"label": "Easiest route",
"type": "string",
"description": "The easiest route to the summit. Some possibilities include Hike, Scramble or any of the YDS grades."
},
"embedded": {
"required": false,
"label": "Embedded",
"type": "string",
"description": "Another Infobox to place within the mountain infobox. The other infobox will show up at the end of the mountain infobox. The other infobox needs to have its \"embedded\" or \"child\" parameter set to 1 or yes, as appropriate."
},
"child": {
"required": false,
"type": "line",
"label": "Child",
"description": "\"yes\" if the mountain infobox is embedded inside another Infobox"
},
"map_size": {
"required": false,
"default": "250",
"type": "number",
"label": "Map size",
"description": "Size of the map, in pixels. Must be entered as a number. The default value is 250."
},
"image_size": {
"required": false,
"type": "number",
"label": "Image size",
"description": "Width of the image, if less than 280px."
},
"subbox": {
"label": "Subbox",
"description": "Use this infobox as a subbox of another",
"type": "boolean"
},
"suppressfields": {
"label": "Suppress fields",
"description": "list of fields to never fetch from Wikidata",
"type": "string"
},
"fetchwikidata": {
"label": "Fetch from Wikidata",
"description": "List of fields to fetch from Wikidata"
},
"onlysourced": {
"label": "Get only sourced Wikidata",
"description": "Fetch only sourced data from Wikidata",
"type": "boolean",
"autovalue": "true"
},
"image_upright": {
"label": "Upright",
"description": "Size of imagegraph, fed to upright= parameter of image Wikimarkup",
"example": "1.0",
"type": "number"
},
"range_coordinates": {
"label": "Range coordinates",
"description": "If article is about a mountain range, coordinates of the center of the range. Please use the {{coord}} template to specify.",
"type": "content"
},
"range_coordinates_ref": {},
"map_upright": {
"label": "Map upright",
"description": "Size of map, expressed as \"upright\" parameter to image Wikimarkup",
"example": "1.0",
"type": "number"
},
"highest": {
"label": "Highest point",
"description": "Name of highest peak or summit",
"type": "string"
},
"highest_location": {
"label": "Highest location",
"description": "Location of highest point/summit. Use hierarchical administrative boundaries, e.g., county/state/country",
"type": "string"
},
"refs": {
"label": "Wikidata refs",
"description": "When set to \"yes\", use references from Wikidata",
"type": "boolean",
"default": "no"
},
"elevation_system": {
"label": "Elevation system",
"description": "Elevation system (i.e., vertical datum) for elevation from Wikidata"
},
"isolation": {
"label": "Isolation",
"description": "Distance to nearest highest peak, in freeform text. Typically this is filled with a {{convert}} template",
"type": "content"
},
"isolation_km": {
"label": "Isolation (kilometers)",
"description": "Kilometers to nearest peak higher than subject of article. Use number without commas",
"type": "number"
},
"isolation_mi": {
"label": "Isolation (miles)",
"description": "Distance to nearest higher peak, in miles. Expressed as number with no commas",
"type": "number"
},
"isolation_parent": {
"label": "Isolation parent",
"description": "Name of nearest mountain that is higher than the subject of the article",
"type": "string"
},
"isolation_ref": {
"label": "Isolation note",
"description": "Reference for isolation data, or notes for isolation data",
"type": "string"
},
"length_km": {
"label": "Length (kilometers)",
"description": "Length of mountain range in kilometers: numeric value, no comma",
"type": "number"
},
"length_mi": {
"label": "Length (miles)",
"description": "Length of mountain range in miles, numeric value, no commas",
"type": "number"
},
"width_km": {
"label": "Width (kilometers)",
"description": "Width of mountain range along minor axis, in kilometers.",
"type": "number"
},
"width_mi": {
"label": "Width (miles)",
"description": "Width of mountain range in miles, numeric value",
"type": "number"
},
"area_mi2": {},
"area_km2": {},
"length": {
"label": "Length",
"description": "Freeform field for length of mountain range. Use {{convert}} template for correct unit conversion.",
"type": "content"
},
"length_orientation": {
"label": "Orientation",
"description": "The major axis of the mountain range",
"example": "N-S",
"type": "string"
},
"length_ref": {
"label": "Length note",
"description": "Reference for length data, or note about it",
"type": "content"
},
"width": {
"label": "Width",
"description": "Freeform field describing width of mountain range, typically using a {{convert}} template",
"type": "content"
},
"width_orientation": {
"label": "Width orientation",
"description": "Orientation of minor (shorter) axis of mountain range",
"example": "E-W",
"type": "string"
},
"width_ref": {
"label": "Width note",
"description": "Reference for width data, or supplementary note",
"type": "string"
},
"area": {},
"area_ref": {},
"volume": {},
"volume_km3": {},
"volume_mi3": {},
"volume_ref": {},
"nickname": {},
"authority": {},
"country": {},
"country_type": {},
"state": {
"aliases": [
"subdivision1"
]
},
"state_type": {
"aliases": [
"subdivision1_type"
]
},
"region": {
"aliases": [
"subdivision2"
]
},
"region_type": {
"aliases": [
"subdivision2_type"
]
},
"district": {
"aliases": [
"subdivision3"
]
},
"district_type": {
"aliases": [
"subdivision3_type"
]
},
"part": {
"aliases": [
"subdivision4"
]
},
"part_type": {
"aliases": [
"subdivision4_type"
]
},
"settlement_type": {},
"settlement": {},
"parent": {},
"borders_on": {},
"border": {},
"topo_maker": {},
"topo_map": {},
"biome": {},
"formed_by": {},
"orogeny": {},
"period": {},
"mountain_type": {},
"geology": {
"aliases": [
"rock"
]
},
"volcanic_region": {},
"normal_route": {},
"access": {},
"module": {},
"nocat_wdimage": {},
"mapframe": {
"label": "Show mapframe map",
"description": "Specify yes or no to show or hide the map, overriding the default",
"example": "yes",
"type": "string",
"default": "no",
"suggested": true
},
"mapframe-caption": {
"label": "Mapframe caption",
"description": "Caption for the map. If mapframe-geomask is set, then the default is \"Location in <<geomask's label>>\"",
"type": "string"
},
"mapframe-custom": {
"label": "Custom mapframe",
"description": "Use a custom map instead of the automatic mapframe. Specify either a {{maplink}} template, or another template that generates a mapframe map, or an image name. If used, other mapframe parameters will be ignored.",
"type": "wiki-template-name"
},
"mapframe-id": {
"aliases": [
"id",
"qid"
],
"label": "Mapframe Wikidata item",
"description": "Id (Q-number) of Wikidata item to use.",
"type": "string",
"default": "(item for current page)"
},
"mapframe-coordinates": {
"aliases": [
"mapframe-coord",
"coordinates",
"coord"
],
"label": "Mapframe coordinates ",
"description": "Coordinates to use, instead of any on Wikidata. Use the {{Coord}} template.",
"example": "{{Coord|12.34|N|56.78|E}}",
"type": "wiki-template-name",
"default": "(coordinates from Wikidata)"
},
"mapframe-wikidata": {
"label": "Mapframe shapes from Wikidata",
"description": "et to yes to show shape/line features from the wikidata item, if any, when coordinates are specified by parameter",
"example": "yes",
"type": "string"
},
"mapframe-shape": {
"label": "Mapframe shape feature",
"description": "Override display of mapframe shape feature. Turn off by setting to \"none\". Use an inverse shape (geomask) instead of a regular shape by setting to \"inverse\"",
"type": "string"
},
"mapframe-point": {
"label": "Mapframe point feature",
"description": "Override display of mapframe point feature. Turn off display of point feature by setting to \"none\". Force point marker to be displayed by setting to \"on\"",
"type": "string"
},
"mapframe-geomask": {
"label": "Mapframe geomask",
"description": "Wikidata item to use as a geomask (everything outside the boundary is shaded darker). Can either be a specific Wikidata item (Q-number), or a property that specifies the item to use (e.g. P17 for country, or P131 for located in the administrative territorial entity)",
"example": "Q100",
"type": "wiki-page-name"
},
"mapframe-switcher": {
"label": "Mapframe switcher",
"description": "Set to \"auto\" or \"geomasks\" or \"zooms\" to enable Template:Switcher-style switching between multiple mapframes. IF SET TO auto – switch geomasks found in location (P276) and located in the administrative territorial entity (P131) statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country. IF SET TO geomasks – switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the mapframe-geomask parameter. IF SET TO zooms – switch between \"zoomed in\"/\"zoomed midway\"/\"zoomed out\", where \"zoomed in\" is the default zoom (with a minimum of 3), \"zoomed out\" is 1, and \"zoomed midway\" is the average.",
"type": "string"
},
"mapframe-frame-width": {
"aliases": [
"mapframe-width"
],
"label": "Mapframe width",
"description": "Frame width in pixels",
"type": "number",
"default": "270"
},
"mapframe-frame-height": {
"aliases": [
"mapframe-height"
],
"label": "Mapframe height",
"description": "Frame height in pixels",
"type": "number",
"default": "200"
},
"mapframe-shape-fill": {
"label": "Mapframe shape fill",
"description": "Color used to fill shape features",
"type": "string",
"default": "#606060"
},
"mapframe-shape-fill-opacity": {
"label": "Mapframe shape fill opacity",
"description": "Opacity level of shape fill, a number between 0 and 1",
"type": "number",
"default": "0.5"
},
"mapframe-stroke-color": {
"aliases": [
"mapframe-stroke-colour"
],
"label": "Mapframe stroke color",
"description": "Color of line features, and outlines of shape features",
"type": "string",
"default": "#ff0000"
},
"mapframe-stroke-width": {
"label": "Mapframe stroke width",
"description": "Width of line features, and outlines of shape features",
"type": "number",
"default": "5"
},
"mapframe-marker": {
"label": "Mapframe marker",
"description": "Marker symbol to use for coordinates; see [[mw:Help:Extension:Kartographer/Icons]] for options",
"example": "museum",
"type": "string"
},
"mapframe-marker-color": {
"aliases": [
"mapframe-marker-colour"
],
"label": "Mapframe marker color",
"description": "Background color for the marker",
"type": "string",
"default": "#5E74F3"
},
"mapframe-geomask-stroke-color": {
"aliases": [
"mapframe-geomask-stroke-colour"
],
"label": "Mapframe geomask stroke color",
"description": "Color of outline of geomask shape",
"type": "string",
"default": "#555555"
},
"mapframe-geomask-stroke-width": {
"label": "Mapframe geomask stroke width",
"description": "Width of outline of geomask shape",
"type": "number",
"default": "2"
},
"mapframe-geomask-fill": {
"label": "Mapframe geomask fill",
"description": "Color used to fill outside geomask features",
"type": "string",
"default": "#606060"
},
"mapframe-geomask-fill-opacity": {
"label": "Mapframe geomask fill opacity",
"description": "Opacity level of fill outside geomask features, a number between 0 and 1",
"type": "number",
"default": "0.5"
},
"mapframe-zoom": {
"label": "Mapframe zoom",
"description": "Set the zoom level, from \"1\" to \"18\", to used if the zoom level cannot be determined automatically from object length or area",
"example": "12",
"type": "number",
"default": "10"
},
"mapframe-length_km": {
"label": "Mapframe length (km)",
"description": "Object length in kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area",
"type": "number"
},
"mapframe-length_mi": {
"label": "Mapframe length (mi)",
"description": "Object length in miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area",
"type": "number"
},
"mapframe-area_km2": {
"label": "Mapframe area (km^2)",
"description": "Object arean square kilometres, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area",
"type": "number"
},
"mapframe-area_mi2": {
"label": "Mapframe area (mi^2)",
"description": "Object area in square miles, for automatically determining zoom level. ONLY use ONE of the available parameters for length or area",
"type": "number"
},
"mapframe-frame-coordinates": {
"aliases": [
"mapframe-frame-coord"
],
"label": "Mapframe frame coordinates",
"description": "Alternate latitude and longitude coordinates for initial placement of map, using {{coord}}",
"example": "{{Coord|12.35|N|56.71|E}}",
"type": "wiki-template-name"
},
"mapframe-line": {},
"image_width": {},
"coords_ref": {},
"pushpin_map": {
"label": "Pushpin map",
"description": "The name of a location map as per Template:Location map (e.g. Indonesia or Russia). The coordinate fields position a pushpin coordinate marker and label on the map automatically. Example see: Mount Everest. For a static image, use map_image",
"type": "string"
},
"pushpin_relief": {
"label": "Pushpin relief",
"description": "If a location map template is specified, this template will attempt to display a relief map if one is available. To force the default map image to display set to 0.",
"type": "string"
},
"pushpin_label": {
"label": "Pushpin label",
"description": "Label to be used for the mountain's location on the map. If not specified, the value of the name parameter is used.",
"type": "string"
},
"pushpin_label_position": {
"label": "Pushpin label position",
"description": "The position of the label on the pushpin map relative to the pushpin coordinate marker. Valid options are {left, right, top, bottom, none}.",
"type": "line",
"default": "right"
}
},
"paramOrder": [
"name",
"other_name",
"etymology",
"native_name",
"native_name_lang",
"language",
"translation",
"pronunciation",
"image",
"image_alt",
"image_size",
"image_upright",
"image_caption",
"map_size",
"map_upright",
"map_image",
"map_alt",
"map_caption",
"location",
"pushpin_map",
"pushpin_relief",
"pushpin_label",
"pushpin_label_position",
"highest",
"highest_location",
"elevation",
"elevation_m",
"elevation_ft",
"elevation_ref",
"prominence",
"prominence_m",
"prominence_ft",
"prominence_ref",
"parent_peak",
"isolation",
"isolation_km",
"isolation_mi",
"isolation_parent",
"isolation_ref",
"listing",
"range",
"coordinates",
"coordinates_ref",
"range_coordinates",
"range_coordinates_ref",
"coord_type",
"region_code",
"format",
"source",
"topo",
"grid_ref_UK",
"grid_ref_UK_ref",
"grid_ref_Ireland",
"grid_ref_Ireland_ref",
"length",
"length_km",
"length_mi",
"length_orientation",
"length_ref",
"width",
"width_km",
"width_mi",
"width_orientation",
"width_ref",
"type",
"age",
"volcanic_arc",
"volcanic_belt",
"volcanic_field",
"volcanic_zone",
"last_eruption",
"first_ascent",
"easiest_route",
"embedded",
"child",
"subbox",
"suppressfields",
"fetchwikidata",
"onlysourced",
"refs",
"elevation_system",
"area_mi2",
"area_km2",
"area",
"area_ref",
"volume",
"volume_km3",
"volume_mi3",
"volume_ref",
"nickname",
"authority",
"country",
"country_type",
"state",
"state_type",
"region",
"region_type",
"district",
"district_type",
"part",
"part_type",
"settlement",
"settlement_type",
"parent",
"borders_on",
"border",
"topo_maker",
"topo_map",
"biome",
"formed_by",
"orogeny",
"period",
"mountain_type",
"geology",
"volcanic_region",
"normal_route",
"access",
"module",
"nocat_wdimage",
"mapframe",
"mapframe-caption",
"mapframe-custom",
"mapframe-id",
"mapframe-coordinates",
"mapframe-wikidata",
"mapframe-shape",
"mapframe-point",
"mapframe-geomask",
"mapframe-switcher",
"mapframe-frame-width",
"mapframe-frame-height",
"mapframe-shape-fill",
"mapframe-shape-fill-opacity",
"mapframe-stroke-color",
"mapframe-stroke-width",
"mapframe-marker",
"mapframe-marker-color",
"mapframe-geomask-stroke-color",
"mapframe-geomask-stroke-width",
"mapframe-geomask-fill",
"mapframe-geomask-fill-opacity",
"mapframe-zoom",
"mapframe-length_km",
"mapframe-length_mi",
"mapframe-area_km2",
"mapframe-area_mi2",
"mapframe-frame-coordinates",
"mapframe-line",
"image_width",
"coords_ref"
]
}
</templatedata>
{{collapse bottom}}
== Microformat ==
{{UF-hcard-geo}}
<includeonly>{{sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Embeddable templates]]
[[Category:Geology infobox templates]]
[[Category:Infobox templates with module parameter|Mountain]]
[[Category:Templates with coordinates fields]]
[[Category:Mountain templates]]
[[Category:Place infobox templates|Mountain]]
[[Category:Templates that add a tracking category]]
[[Category:WikiProject Mountains templates]]
}}</includeonly>
4h68b311j52mcwxpryaak2zyqym14qx
Módulo:Infobox dim
828
8945
74800
2025-11-15T18:59:08Z
en>Hike395
0
allow zoom computation to accept latitude
74800
Scribunto
text/plain
require('strict')
local getArgs = require('Module:Arguments').getArgs
local p = {}
local log2 = 0.693147181
local ppm = 1000/0.3 -- pixels per meter, from 0.3 mm / pixel from https://wiki.openstreetmap.org/wiki/Zoom_levels
-- To convert to OSM zoom level, we need to know meters per pixel at zoom level 9
-- On the equator, it's 305.748 meters/pixel according to https://wiki.openstreetmap.org/wiki/Zoom_levels
-- This quantity depends on the latitude (which we usually don't have easy access to)
-- Instead, we'll be correct at 38 degrees N, given en-WP bias towards NA and Europe
-- 38N was chosen because:
-- * It's the furthest north where scale=100000 maps to zoom=12
-- * One hemisphere (20000km) maps to zoom=1
local mppl9Equator = 305.748
-- Convert from Geohack's scale to OSM style zoom levels as used by <maplink>
local function geohackScaleToMapZoom(scale,latitude)
scale = tonumber(scale)
if not scale or scale <= 0 then return end
latitude = latitude or 38
local mppl9 = mppl9Equator*math.cos(math.rad(latitude))
return math.log(mppl9*ppm/scale)/log2 + 9
end
-- compute the viewport size (on screen) in meters, assuming ppm pixels per meter on screen
local function computeViewport(args)
local viewport_cm = tonumber(args.viewport_cm)
local viewport_px = tonumber(args.viewport_px)
return viewport_cm and viewport_cm / 100 or viewport_px and viewport_px / ppm
or tonumber(args.default_viewport) or 0.1
end
-- convert from geohack dim (knowing the viewpoint size on screen) to geohack scale
local function geohackDimToScale(dim, args)
dim = tonumber(dim)
args = args or {}
if not dim or dim <= 0 then return end
local units = args.units
if units and string.lower(units) == 'km' then
dim = dim*1000
end
return dim / computeViewport(args)
end
-- inverse of above function, returning dim in km
local function geohackScaleToDim(scale, args)
scale = tonumber(scale)
args = args or {}
if not scale or scale <= 0 then return end
return scale * computeViewport(args) * 1e-3
end
local oddShape = 2.09 --- length/sqrt(area) of Boston (to choose an example)
-- Convert from Geohack's types to Geohack dim
local function geohackTypeToDim(args)
local t = args.type
if not t then return end
local typeDim = mw.loadData('Module:Infobox_dim/data')
local dim = typeDim[t]
local population = tonumber(args.population)
if t == 'city' and population and population > 0 then
-- assume city is a circle with density of 1000/square kilometer
-- compute diameter, in meters. Then multiply by oddShape to account for weird shapes
dim = 35.68e-3*math.sqrt(population)*oddShape
-- don't zoom in too far
if dim < 5 then
dim = 5
end
end
return dim
end
-- Convert from dimension of object to Geohack dim
local function computeDim(length,width,area)
if length and width then
return math.max(length,width)
end
if length then return length end
if width then return width end
if area then return oddShape*math.sqrt(area) end
end
-- compute geohack dim from unit arguments (e.g., length_mi)
local function convertDim(args)
local length = args.length_mi and 1.60934*args.length_mi or args.length_km
local width = args.width_mi and 1.60934*args.width_mi or args.width_km
local area = args.area_acre and 0.00404686*args.area_acre or
args.area_ha and 0.01*args.area_ha or
args.area_mi2 and 2.58999*args.area_mi2 or args.area_km2
local dim = computeDim(length, width, area)
return dim
end
local function computeScale(args)
if args.scale then return args.scale end
local dim, units, scale
if args.dim then
dim, units = mw.ustring.match(args.dim,"^([-%d%.]+)%s*(%D*)")
args.units = units
args.default_viewport = 0.1 -- default geohack viewpoirt
scale = geohackDimToScale(dim, args)
end
if not scale then
dim = convertDim(args) or geohackTypeToDim(args)
args.units = 'km'
args.default_viewport = 0.2 --- when object dimensions or type is specified, assume 20cm viewport
scale = dim and geohackDimToScale(dim, args)
end
if not scale then return end
scale = math.floor(scale+0.5)
-- keep scale within sane bounds (OSM zoom levels 1-17)
if scale < 1600 then
scale = 1600
end
if scale > 200e6 then
scale = 200e6
end
return scale
end
-- Argument checking
local positiveNumericArgs = {viewport_cm=true,viewport_px=true,length_mi=true,length_km=true,
width_mi=true,width_km=true,area_mi2=true,area_km2=true,
area_acre=true,area_ha=true,scale=true,population=true}
local function cleanArgs(args)
local clean = {}
if type(args) == 'table' then
for k, v in pairs(args) do
if positiveNumericArgs[k] then
v = v and mw.ustring.gsub(v,",","") -- clean out any commas
v = tonumber(v) -- ensure argument is numeric
if v and v <= 0 then -- if non-positive, ignore value
v = nil
end
end
clean[k] = v
end
end
return clean
end
-- Module entry points
function p._dim(args)
args = cleanArgs(args)
if args.dim then return args.dim end
-- compute scale for geohack
local scale = args.scale
local dim
if not scale then
args.default_viewport = 0.2 -- when specifying a object dimension or type, assume output spans 20cm
dim = convertDim(args) or geohackTypeToDim(args)
args.units = 'km'
scale = dim and geohackDimToScale(dim, args)
end
-- reset back to 10cm viewport for correct geohack dim output
args.viewport_cm = 10
dim = scale and geohackScaleToDim(scale, args)
return dim and tostring(math.floor(dim+0.5))..'km'
end
function p._scale(args)
args = cleanArgs(args)
return computeScale(args)
end
function p._zoom(args)
args = cleanArgs(args)
args.viewport_px = args.viewport_px or 200 --- viewport for Kartographer is 200px high
local scale = computeScale(args)
if scale then
local latitude = tonumber(args.latitude)
latitude = latitude and (latitude > 70 and 70 or latitude < -70 and -70 or latitude)
local zoom = geohackScaleToMapZoom(scale,latitude)
return zoom and math.floor(zoom)
end
end
-- Template entry points
function p.dim(frame)
return p._dim(getArgs(frame)) or ''
end
function p.scale(frame)
return p._scale(getArgs(frame)) or ''
end
function p.zoom(frame)
return p._zoom(getArgs(frame)) or ''
end
return p
jy5fyn8gcmhd8ajqw0ljt5qgmzyo4hz
74801
74800
2026-08-24T00:15:12Z
Robertsky
10424
1 versaun husi [[:en:Module:Infobox_dim]]
74800
Scribunto
text/plain
require('strict')
local getArgs = require('Module:Arguments').getArgs
local p = {}
local log2 = 0.693147181
local ppm = 1000/0.3 -- pixels per meter, from 0.3 mm / pixel from https://wiki.openstreetmap.org/wiki/Zoom_levels
-- To convert to OSM zoom level, we need to know meters per pixel at zoom level 9
-- On the equator, it's 305.748 meters/pixel according to https://wiki.openstreetmap.org/wiki/Zoom_levels
-- This quantity depends on the latitude (which we usually don't have easy access to)
-- Instead, we'll be correct at 38 degrees N, given en-WP bias towards NA and Europe
-- 38N was chosen because:
-- * It's the furthest north where scale=100000 maps to zoom=12
-- * One hemisphere (20000km) maps to zoom=1
local mppl9Equator = 305.748
-- Convert from Geohack's scale to OSM style zoom levels as used by <maplink>
local function geohackScaleToMapZoom(scale,latitude)
scale = tonumber(scale)
if not scale or scale <= 0 then return end
latitude = latitude or 38
local mppl9 = mppl9Equator*math.cos(math.rad(latitude))
return math.log(mppl9*ppm/scale)/log2 + 9
end
-- compute the viewport size (on screen) in meters, assuming ppm pixels per meter on screen
local function computeViewport(args)
local viewport_cm = tonumber(args.viewport_cm)
local viewport_px = tonumber(args.viewport_px)
return viewport_cm and viewport_cm / 100 or viewport_px and viewport_px / ppm
or tonumber(args.default_viewport) or 0.1
end
-- convert from geohack dim (knowing the viewpoint size on screen) to geohack scale
local function geohackDimToScale(dim, args)
dim = tonumber(dim)
args = args or {}
if not dim or dim <= 0 then return end
local units = args.units
if units and string.lower(units) == 'km' then
dim = dim*1000
end
return dim / computeViewport(args)
end
-- inverse of above function, returning dim in km
local function geohackScaleToDim(scale, args)
scale = tonumber(scale)
args = args or {}
if not scale or scale <= 0 then return end
return scale * computeViewport(args) * 1e-3
end
local oddShape = 2.09 --- length/sqrt(area) of Boston (to choose an example)
-- Convert from Geohack's types to Geohack dim
local function geohackTypeToDim(args)
local t = args.type
if not t then return end
local typeDim = mw.loadData('Module:Infobox_dim/data')
local dim = typeDim[t]
local population = tonumber(args.population)
if t == 'city' and population and population > 0 then
-- assume city is a circle with density of 1000/square kilometer
-- compute diameter, in meters. Then multiply by oddShape to account for weird shapes
dim = 35.68e-3*math.sqrt(population)*oddShape
-- don't zoom in too far
if dim < 5 then
dim = 5
end
end
return dim
end
-- Convert from dimension of object to Geohack dim
local function computeDim(length,width,area)
if length and width then
return math.max(length,width)
end
if length then return length end
if width then return width end
if area then return oddShape*math.sqrt(area) end
end
-- compute geohack dim from unit arguments (e.g., length_mi)
local function convertDim(args)
local length = args.length_mi and 1.60934*args.length_mi or args.length_km
local width = args.width_mi and 1.60934*args.width_mi or args.width_km
local area = args.area_acre and 0.00404686*args.area_acre or
args.area_ha and 0.01*args.area_ha or
args.area_mi2 and 2.58999*args.area_mi2 or args.area_km2
local dim = computeDim(length, width, area)
return dim
end
local function computeScale(args)
if args.scale then return args.scale end
local dim, units, scale
if args.dim then
dim, units = mw.ustring.match(args.dim,"^([-%d%.]+)%s*(%D*)")
args.units = units
args.default_viewport = 0.1 -- default geohack viewpoirt
scale = geohackDimToScale(dim, args)
end
if not scale then
dim = convertDim(args) or geohackTypeToDim(args)
args.units = 'km'
args.default_viewport = 0.2 --- when object dimensions or type is specified, assume 20cm viewport
scale = dim and geohackDimToScale(dim, args)
end
if not scale then return end
scale = math.floor(scale+0.5)
-- keep scale within sane bounds (OSM zoom levels 1-17)
if scale < 1600 then
scale = 1600
end
if scale > 200e6 then
scale = 200e6
end
return scale
end
-- Argument checking
local positiveNumericArgs = {viewport_cm=true,viewport_px=true,length_mi=true,length_km=true,
width_mi=true,width_km=true,area_mi2=true,area_km2=true,
area_acre=true,area_ha=true,scale=true,population=true}
local function cleanArgs(args)
local clean = {}
if type(args) == 'table' then
for k, v in pairs(args) do
if positiveNumericArgs[k] then
v = v and mw.ustring.gsub(v,",","") -- clean out any commas
v = tonumber(v) -- ensure argument is numeric
if v and v <= 0 then -- if non-positive, ignore value
v = nil
end
end
clean[k] = v
end
end
return clean
end
-- Module entry points
function p._dim(args)
args = cleanArgs(args)
if args.dim then return args.dim end
-- compute scale for geohack
local scale = args.scale
local dim
if not scale then
args.default_viewport = 0.2 -- when specifying a object dimension or type, assume output spans 20cm
dim = convertDim(args) or geohackTypeToDim(args)
args.units = 'km'
scale = dim and geohackDimToScale(dim, args)
end
-- reset back to 10cm viewport for correct geohack dim output
args.viewport_cm = 10
dim = scale and geohackScaleToDim(scale, args)
return dim and tostring(math.floor(dim+0.5))..'km'
end
function p._scale(args)
args = cleanArgs(args)
return computeScale(args)
end
function p._zoom(args)
args = cleanArgs(args)
args.viewport_px = args.viewport_px or 200 --- viewport for Kartographer is 200px high
local scale = computeScale(args)
if scale then
local latitude = tonumber(args.latitude)
latitude = latitude and (latitude > 70 and 70 or latitude < -70 and -70 or latitude)
local zoom = geohackScaleToMapZoom(scale,latitude)
return zoom and math.floor(zoom)
end
end
-- Template entry points
function p.dim(frame)
return p._dim(getArgs(frame)) or ''
end
function p.scale(frame)
return p._scale(getArgs(frame)) or ''
end
function p.zoom(frame)
return p._zoom(getArgs(frame)) or ''
end
return p
jy5fyn8gcmhd8ajqw0ljt5qgmzyo4hz
Template:Map scale
10
8946
74802
2024-10-07T17:59:46Z
en>MusikBot II
0
Protected "[[Template:Map scale]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 26119 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74802
wikitext
text/x-wiki
<includeonly>{{#invoke:Infobox dim|scale}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using map scale with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Map scale]] with unknown parameter "_VALUE_"|ignoreblank=y| area_acre | area_ha | area_km2 | area_mi2 | dim | length_km | length_mi | population | scale | type | width_km | width_mi }}<noinclude>
{{Documentation}}</noinclude>
efdlxcmedhtkjl5i3ahbmlo7g4k3gp6
74803
74802
2026-08-24T00:15:12Z
Robertsky
10424
1 versaun husi [[:en:Template:Map_scale]]
74802
wikitext
text/x-wiki
<includeonly>{{#invoke:Infobox dim|scale}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using map scale with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Map scale]] with unknown parameter "_VALUE_"|ignoreblank=y| area_acre | area_ha | area_km2 | area_mi2 | dim | length_km | length_mi | population | scale | type | width_km | width_mi }}<noinclude>
{{Documentation}}</noinclude>
efdlxcmedhtkjl5i3ahbmlo7g4k3gp6
Módulo:Infobox dim/data
828
8947
74804
2024-10-07T18:00:28Z
en>MusikBot II
0
Protected "[[Module:Infobox dim/data]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 27202 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74804
Scribunto
text/plain
local typeToDim = { -- typical size of object (in km)
country = 2000,
satellite = 2000,
state = 600,
adm1st = 200,
adm2nd = 60,
adm3rd = 20,
city = 20,
isle = 20,
mountain = 20,
river = 20,
waterbody = 20,
event = 10,
forest = 10,
glacier = 10,
airport = 6,
landmark = 2,
railwaystation = 2,
edu = 2,
pass = 2,
camera = 2
}
return typeToDim
q8gk4m0g59kpt1szm28fnnl9cyh4rhi
74805
74804
2026-08-24T00:15:12Z
Robertsky
10424
1 versaun husi [[:en:Module:Infobox_dim/data]]
74804
Scribunto
text/plain
local typeToDim = { -- typical size of object (in km)
country = 2000,
satellite = 2000,
state = 600,
adm1st = 200,
adm2nd = 60,
adm3rd = 20,
city = 20,
isle = 20,
mountain = 20,
river = 20,
waterbody = 20,
event = 10,
forest = 10,
glacier = 10,
airport = 6,
landmark = 2,
railwaystation = 2,
edu = 2,
pass = 2,
camera = 2
}
return typeToDim
q8gk4m0g59kpt1szm28fnnl9cyh4rhi
Módulo:Ordnance Survey coordinates/data
828
8948
74806
2024-11-06T11:07:21Z
en>Hike395
0
fix typo, add url to comments
74806
Scribunto
text/plain
-- Data for [[Module:Ordnance Survey coordinates]]
-- You may use and redistribute this data under the terms of the GPL see http://www.gnu.org/copyleft/gpl.html
local deg2rad = math.rad
local OSGBglobe = {
semimajor = 6377563.396,
semiminor = 6356256.910,
ecc = 0.006670539761597529073698869358812557054558,
n1 = 0.00167322025032508731869331280635710896296,
scale = 0.9996012717,
e0 = 400000.0,
n0 = -100000.0,
lat0 = 49.0,
lon0 = -2.0
}
local IEglobe = {
semimajor = 6377340.189,
semiminor = 6356034.447,
ecc = 0.006670540293336110419293763349975612794125,
n1 = 0.001673220384152058651484728058385228837777,
scale = 1.000035,
e0 = 200000.0,
n0 = 250000.0,
lat0 = 53.5,
lon0 = -8.0
}
local WGSglobe = {
semimajor = 6378137.0,
semiminor = 6356752.3141,
ecc = 0.00669438003551279089034150031998869922791
}
local WGS2OSGBparam = {
-- Table 4, Section 6.6, Ordnance Survey document https://www.ordnancesurvey.co.uk/documents/resources/guide-coordinate-systems-great-britain.pdf
semimajor_src = WGSglobe.semimajor,
semiminor_src = WGSglobe.semiminor,
ecc_src = WGSglobe.ecc,
semimajor_dst = OSGBglobe.semimajor,
semiminor_dst = OSGBglobe.semiminor,
ecc_dst = OSGBglobe.ecc,
tx = -446.448,
ty = 125.157,
tz = -542.060,
s0 = 0.0000204894,
rx = deg2rad ( -.1502/3600. ),
ry = deg2rad ( -.2470/3600. ),
rz = deg2rad ( -.8421/3600. )
}
local OSGB2WGSparam = {
semimajor_src = OSGBglobe.semimajor,
semiminor_src = OSGBglobe.semiminor,
ecc_src = OSGBglobe.ecc,
semimajor_dst = WGSglobe.semimajor,
semiminor_dst = WGSglobe.semiminor,
ecc_dst = WGSglobe.ecc,
tx = -WGS2OSGBparam.tx,
ty = -WGS2OSGBparam.ty,
tz = -WGS2OSGBparam.tz,
s0 = -WGS2OSGBparam.s0,
rx = -WGS2OSGBparam.rx,
ry = -WGS2OSGBparam.ry,
rz = -WGS2OSGBparam.rz,
}
local IE2WGSparam = {
semimajor_src = IEglobe.semimajor,
semiminor_src = IEglobe.semiminor,
ecc_src = IEglobe.ecc,
semimajor_dst = WGSglobe.semimajor,
semiminor_dst = WGSglobe.semiminor,
ecc_dst = WGSglobe.ecc,
tx = 482.53,
ty = -130.596,
tz = 564.557,
s0 = 8.15/1000000.0,
rx = deg2rad( -1.042/3600.0 ),
ry = deg2rad( -0.214/3600.0 ),
rz = deg2rad( -0.631/3600.0 )
}
return {OSGBglobe=OSGBglobe, IEglobe=IEglobe, WGSglobe=WGSglobe,
WGS2OSGBparam=WGS2OSGBparam, OSGB2WGSparam=OSGB2WGSparam, IE2WGSparam=IE2WGSparam}
rmtx7j2h2k0b6yobekjf1yh1h2d5gsy
74807
74806
2026-08-24T00:15:12Z
Robertsky
10424
1 versaun husi [[:en:Module:Ordnance_Survey_coordinates/data]]
74806
Scribunto
text/plain
-- Data for [[Module:Ordnance Survey coordinates]]
-- You may use and redistribute this data under the terms of the GPL see http://www.gnu.org/copyleft/gpl.html
local deg2rad = math.rad
local OSGBglobe = {
semimajor = 6377563.396,
semiminor = 6356256.910,
ecc = 0.006670539761597529073698869358812557054558,
n1 = 0.00167322025032508731869331280635710896296,
scale = 0.9996012717,
e0 = 400000.0,
n0 = -100000.0,
lat0 = 49.0,
lon0 = -2.0
}
local IEglobe = {
semimajor = 6377340.189,
semiminor = 6356034.447,
ecc = 0.006670540293336110419293763349975612794125,
n1 = 0.001673220384152058651484728058385228837777,
scale = 1.000035,
e0 = 200000.0,
n0 = 250000.0,
lat0 = 53.5,
lon0 = -8.0
}
local WGSglobe = {
semimajor = 6378137.0,
semiminor = 6356752.3141,
ecc = 0.00669438003551279089034150031998869922791
}
local WGS2OSGBparam = {
-- Table 4, Section 6.6, Ordnance Survey document https://www.ordnancesurvey.co.uk/documents/resources/guide-coordinate-systems-great-britain.pdf
semimajor_src = WGSglobe.semimajor,
semiminor_src = WGSglobe.semiminor,
ecc_src = WGSglobe.ecc,
semimajor_dst = OSGBglobe.semimajor,
semiminor_dst = OSGBglobe.semiminor,
ecc_dst = OSGBglobe.ecc,
tx = -446.448,
ty = 125.157,
tz = -542.060,
s0 = 0.0000204894,
rx = deg2rad ( -.1502/3600. ),
ry = deg2rad ( -.2470/3600. ),
rz = deg2rad ( -.8421/3600. )
}
local OSGB2WGSparam = {
semimajor_src = OSGBglobe.semimajor,
semiminor_src = OSGBglobe.semiminor,
ecc_src = OSGBglobe.ecc,
semimajor_dst = WGSglobe.semimajor,
semiminor_dst = WGSglobe.semiminor,
ecc_dst = WGSglobe.ecc,
tx = -WGS2OSGBparam.tx,
ty = -WGS2OSGBparam.ty,
tz = -WGS2OSGBparam.tz,
s0 = -WGS2OSGBparam.s0,
rx = -WGS2OSGBparam.rx,
ry = -WGS2OSGBparam.ry,
rz = -WGS2OSGBparam.rz,
}
local IE2WGSparam = {
semimajor_src = IEglobe.semimajor,
semiminor_src = IEglobe.semiminor,
ecc_src = IEglobe.ecc,
semimajor_dst = WGSglobe.semimajor,
semiminor_dst = WGSglobe.semiminor,
ecc_dst = WGSglobe.ecc,
tx = 482.53,
ty = -130.596,
tz = 564.557,
s0 = 8.15/1000000.0,
rx = deg2rad( -1.042/3600.0 ),
ry = deg2rad( -0.214/3600.0 ),
rz = deg2rad( -0.631/3600.0 )
}
return {OSGBglobe=OSGBglobe, IEglobe=IEglobe, WGSglobe=WGSglobe,
WGS2OSGBparam=WGS2OSGBparam, OSGB2WGSparam=OSGB2WGSparam, IE2WGSparam=IE2WGSparam}
rmtx7j2h2k0b6yobekjf1yh1h2d5gsy
Template:Location map/doc/infobox parameters
10
8949
74808
2026-08-08T18:00:03Z
en>MusikBot II
0
Protected "[[Template:Location map/doc/infobox parameters]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 256 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
74808
wikitext
text/x-wiki
{{navbar|Template:Location map/doc/infobox parameters|plain=y|style=float: right;}}
Below are the parameters used by [[Module:Location map]] to produce the pushpin map in this Infobox. These parameters are available for editors to set in articles that use this infobox.
{| class="wikitable"
! Parameter
! Description
! Default
|-
|{{para|pushpin_map}}
| The map(s) to display. For example, specifying England will use the values for England in Module:Location map/data/England.Multiple maps can be shown by providing a list of map names separated by {{code|#}}. For multiple maps, the first is shown by default. A reader can select the others with radio buttons.
| ''{{if empty|{{{pushpin_map|}}}|N/A}}''
|-
|{{para|pushpin_caption}}
| The text of a caption to be displayed below the map. If not provided a default caption will be generated. Multiple captions can be shown when separated by {{code|##}} (that's two).
| ''{{if empty|{{{pushpin_caption|}}}|Location within MAPNAME}}''
|-
|{{para|pushpin_relief}}
| 0/false/off will cause the template to display the map defined as {{code|image}} (generally not a [[Cartographic relief depiction|relief map]]). 1/true/on will cause the template to display the map defined as {{code|image1}} (generally a relief map). Any non-zero numeric value such as {{code|2}} or {{code|3}} will display {{code|image2}} or {{code|image3}}, if those images are defined. Any other non-empty value will cause display of {{code|image1}}. See the example at [[Template:Location map+/relief|Location map+/relief]].
| ''{{if empty|{{{pushpin_relief|}}}|0}}''
|-
|{{para|pushpin_label}}
| The text of the label to display next to the identifying mark; a [[H:WIKILINK|wikilink]] can be used. You can enclose the label inside of {{tl|nowrap}} if you want to make sure that it stays on a single line.
| ''{{if empty|{{{pushpin_label|}}}|N/A}}''
|-
|{{para|pushpin_label_size}}
| The font size to use for the label, given as a percentage of the normal font size (<100=smaller, >100=larger); the default size is 90. Do not include {{kbd|%}}. For example, use {{para|pushpin_label_size|80}}, not {{para|pushpin_label_size|80%}}. If set to {{code|0}}, the label is only displayed when the user hovers over the mark.
| ''{{if empty|{{{pushpin_label_size|}}}|90}}''
|-
|style="white-space:nowrap;"<!--Only need to nowrap the longest one-->|{{para|pushpin_label_position}}
| The position of the label relative to the identifying mark; valid values are {{code|left}}, {{code|right}}, {{code|top}}, {{code|bottom}} and {{code|none}}. This defaults to either {{code|left}} or {{code|right}}, depending on the coordinates of the marker and its position relative to the right border of the map image. When {{para|pushpin_label_position|none}}, any defined label will not be displayed with the mark, but it will be used to create the default caption.
| ''{{if empty|{{{pushpin_label_position|}}}|N/A}}''
|-
|{{para|pushpin_mark}}
| The name of an image file to display as the identifying mark; the default is {{#if:{{{pushpin_mark|}}}|[[:File:{{{pushpin_mark|}}}]] [[File:{{{pushpin_mark|}}}|{{if empty|{{{pushpin_mark_size|}}}|8}}px]]|[[:File:Red pog.svg|Red pog.svg]] [[File:Red pog.svg|8px]]}}. See examples at [[Commons:Location markers]] and [[Commons:Category:Map icons]].
| ''{{#if:{{{pushpin_mark|}}}|[[:File:{{{pushpin_mark|}}}]] [[File:{{{pushpin_mark|}}}|{{if empty|{{{pushpin_mark_size|}}}|8}}px]]|[[:File:Red pog.svg|Red pog.svg]] [[File:Red pog.svg|8px]]}}''
|-
|{{para|pushpin_mark_size}}
| The size of the identifying mark in pixels. Do not include {{kbd|px}}
| ''{{if empty|{{{pushpin_mark_size|}}}|8}}''
|-
|{{para|pushpin_alt}}
| Alt text for map; used by [[screen reader]]s. See [[WP:ALT]].
| ''{{if empty|{{{pushpin_alt|}}}|N/A}}''
|-
|{{para|pushpin_background}}
| The background color to use for the label; see [[Web colors]]. The default is no background color, which shows the map image behind the label.
| ''{{if empty|{{{pushpin_background|}}}|N/A}}''
|-
|{{para|pushpin_map_size}}
| Determines the width of the map in [[pixel]]s, overriding any default values; do not include {{kbd|px}}.
| ''{{if empty|{{{pushpin_map_size|}}}|N/A}}''
|}
1aios1omci6ogipjx541dsm1dtxj66f
74809
74808
2026-08-24T00:15:12Z
Robertsky
10424
1 versaun husi [[:en:Template:Location_map/doc/infobox_parameters]]
74808
wikitext
text/x-wiki
{{navbar|Template:Location map/doc/infobox parameters|plain=y|style=float: right;}}
Below are the parameters used by [[Module:Location map]] to produce the pushpin map in this Infobox. These parameters are available for editors to set in articles that use this infobox.
{| class="wikitable"
! Parameter
! Description
! Default
|-
|{{para|pushpin_map}}
| The map(s) to display. For example, specifying England will use the values for England in Module:Location map/data/England.Multiple maps can be shown by providing a list of map names separated by {{code|#}}. For multiple maps, the first is shown by default. A reader can select the others with radio buttons.
| ''{{if empty|{{{pushpin_map|}}}|N/A}}''
|-
|{{para|pushpin_caption}}
| The text of a caption to be displayed below the map. If not provided a default caption will be generated. Multiple captions can be shown when separated by {{code|##}} (that's two).
| ''{{if empty|{{{pushpin_caption|}}}|Location within MAPNAME}}''
|-
|{{para|pushpin_relief}}
| 0/false/off will cause the template to display the map defined as {{code|image}} (generally not a [[Cartographic relief depiction|relief map]]). 1/true/on will cause the template to display the map defined as {{code|image1}} (generally a relief map). Any non-zero numeric value such as {{code|2}} or {{code|3}} will display {{code|image2}} or {{code|image3}}, if those images are defined. Any other non-empty value will cause display of {{code|image1}}. See the example at [[Template:Location map+/relief|Location map+/relief]].
| ''{{if empty|{{{pushpin_relief|}}}|0}}''
|-
|{{para|pushpin_label}}
| The text of the label to display next to the identifying mark; a [[H:WIKILINK|wikilink]] can be used. You can enclose the label inside of {{tl|nowrap}} if you want to make sure that it stays on a single line.
| ''{{if empty|{{{pushpin_label|}}}|N/A}}''
|-
|{{para|pushpin_label_size}}
| The font size to use for the label, given as a percentage of the normal font size (<100=smaller, >100=larger); the default size is 90. Do not include {{kbd|%}}. For example, use {{para|pushpin_label_size|80}}, not {{para|pushpin_label_size|80%}}. If set to {{code|0}}, the label is only displayed when the user hovers over the mark.
| ''{{if empty|{{{pushpin_label_size|}}}|90}}''
|-
|style="white-space:nowrap;"<!--Only need to nowrap the longest one-->|{{para|pushpin_label_position}}
| The position of the label relative to the identifying mark; valid values are {{code|left}}, {{code|right}}, {{code|top}}, {{code|bottom}} and {{code|none}}. This defaults to either {{code|left}} or {{code|right}}, depending on the coordinates of the marker and its position relative to the right border of the map image. When {{para|pushpin_label_position|none}}, any defined label will not be displayed with the mark, but it will be used to create the default caption.
| ''{{if empty|{{{pushpin_label_position|}}}|N/A}}''
|-
|{{para|pushpin_mark}}
| The name of an image file to display as the identifying mark; the default is {{#if:{{{pushpin_mark|}}}|[[:File:{{{pushpin_mark|}}}]] [[File:{{{pushpin_mark|}}}|{{if empty|{{{pushpin_mark_size|}}}|8}}px]]|[[:File:Red pog.svg|Red pog.svg]] [[File:Red pog.svg|8px]]}}. See examples at [[Commons:Location markers]] and [[Commons:Category:Map icons]].
| ''{{#if:{{{pushpin_mark|}}}|[[:File:{{{pushpin_mark|}}}]] [[File:{{{pushpin_mark|}}}|{{if empty|{{{pushpin_mark_size|}}}|8}}px]]|[[:File:Red pog.svg|Red pog.svg]] [[File:Red pog.svg|8px]]}}''
|-
|{{para|pushpin_mark_size}}
| The size of the identifying mark in pixels. Do not include {{kbd|px}}
| ''{{if empty|{{{pushpin_mark_size|}}}|8}}''
|-
|{{para|pushpin_alt}}
| Alt text for map; used by [[screen reader]]s. See [[WP:ALT]].
| ''{{if empty|{{{pushpin_alt|}}}|N/A}}''
|-
|{{para|pushpin_background}}
| The background color to use for the label; see [[Web colors]]. The default is no background color, which shows the map image behind the label.
| ''{{if empty|{{{pushpin_background|}}}|N/A}}''
|-
|{{para|pushpin_map_size}}
| Determines the width of the map in [[pixel]]s, overriding any default values; do not include {{kbd|px}}.
| ''{{if empty|{{{pushpin_map_size|}}}|N/A}}''
|}
1aios1omci6ogipjx541dsm1dtxj66f
Template:Infobox mountain/Berg
10
8950
74810
2025-10-10T07:24:11Z
en>Zackmann08
0
Undid revision [[Special:Diff/1315128507|1315128507]] by [[Special:Contributions/Jonesey95|Jonesey95]]. Pretty sure this was accidental. [[User:Jonesey95]] you broke the subst aspect of the template...
74810
wikitext
text/x-wiki
{{Infobox mountain
| name = {{<includeonly>safesubst:</includeonly>#if: {{{NAME|}}}|{{{NAME}}}|{{<includeonly>safesubst:</includeonly>PAGENAME}}}}
| photo = {{{BILD|}}}
| photo_size = {{<includeonly>safesubst:</includeonly>#if:{{{BILD-BREITE|}}}|{{{BILD-BREITE|}}}|282px}}
| photo_alt =
| photo_caption = {{{BILDBESCHREIBUNG|}}}
{{<includeonly>safesubst:</includeonly>br separated entries
| 1 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD1|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD1}}}|size={{{BILD1-BREITE|}}}|{{{BILD1-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 2 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD1|}}}|{{{BILD1-BESCHREIBUNG|}}}}}
| 3 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD2|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD2}}}|size={{{BILD2-BREITE|}}}|{{{BILD2-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 4 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD2|}}}|{{{BILD2-BESCHREIBUNG|}}}}}
| 5 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD3|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD3}}}|size={{{BILD3-BREITE|}}}|{{{BILD3-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 6 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD3|}}}|{{{BILD3-BESCHREIBUNG|}}}}}
| 7 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD4|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD4}}}|size={{{BILD4-BREITE|}}}|{{{BILD4-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 8 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD4|}}}|{{{BILD4-BESCHREIBUNG|}}}}}
| 9 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD5|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD5}}}|size={{{BILD5-BREITE|}}}|{{{BILD5-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 10= {{<includeonly>safesubst:</includeonly>#if:{{{BILD5|}}}|{{{BILD5-BESCHREIBUNG|}}}}}
}}
| elevation = {{<includeonly>safesubst:</includeonly>#if: {{{HÖHE|}}}|{{Höhe|{{{HÖHE|}}}|{{{HÖHE-BEZUG|}}}|link={{<includeonly>safesubst:</includeonly>#if:{{{HÖHE-BEZUG|}}}|true|false}} }} ({{convert|{{{HÖHE|}}}|m|ft|disp=output only|abbr=on}}) {{{HÖHE-ANMERKUNG|}}} }}
| elevation_ref = {{<includeonly>safesubst:</includeonly>#ifeq:{{<includeonly>safesubst:</includeonly>NAMESPACE}}|{{<includeonly>safesubst:</includeonly>ns:0}}
|{{<includeonly>safesubst:</includeonly>#if: {{{HÖHE|}}}
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 8000 | [[Category:Eight-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 7000 | [[Category:Seven-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 6000 | [[Category:Six-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 5000 | [[Category:Five-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 4000 | [[Category:Four-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 3000 | [[Category:Three-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 2000 | [[Category:Two-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 1000 | [[Category:One-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 611 | [[Category:Mountains under 1000 metres]]
}}
}}
}}
}}
}}
}}
}}
}}
}}
}}}}
| isolation = {{<includeonly>safesubst:</includeonly>#if:{{{DOMINANZ|}}}|{{<includeonly>safesubst:</includeonly>formatnum: {{{DOMINANZ|}}}}} km{{<includeonly>safesubst:</includeonly>#if:{{{DOMINANZ-BEZUG|}}}|<span title="to"> → </span>{{{DOMINANZ-BEZUG}}}}} }}
| isolation_ref =
| prominence = {{<includeonly>safesubst:</includeonly>#if:{{{SCHARTENHÖHE|}}}|{{<includeonly>safesubst:</includeonly>formatnum:{{{SCHARTENHÖHE|}}}}} m{{<includeonly>safesubst:</includeonly>#if:{{{SCHARTE|}}}|<span title="above the wind-gap"> ↓ </span>{{{SCHARTE}}}}}{{<includeonly>safesubst:</includeonly>#if:{{{SCHARTE-BEZUG|}}}|<span title="to"> → </span>{{{SCHARTE-BEZUG}}}}} }}
| prominence_ref =
| listing = {{<includeonly>safesubst:</includeonly>#if:{{{BESONDERHEITEN|}}}|{{{BESONDERHEITEN}}}}}
| range = {{<includeonly>safesubst:</includeonly>#switch: {{{GEBIRGE|}}}
| [[Ammergauer Alpen]] = [[Ammergau Alps]]
| [[Bayerische Voralpen]] = [[Bavarian Prealps]]
| [[Bayerischer Wald]] = [[Bavarian Forest]]
| [[Berchtesgadener Alpen]] = [[Berchtesgaden Alps]]
| [[Böhmerwald]] = [[Bohemian Forest]]
| [[Böhmische Schweiz]] = [[Bohemian Switzerland]]
| [[Brandenberger Alpen]] = [[Brandenberg Alps]]
| [[Chiemgauer Alpen]] = [[Chiemgau Alps]]
| [[Elbsandsteingebirge]] = [[Elbe Sandstone Mountains]]
| [[Erzgebirge]] = [[Ore Mountains]]
| [[Estergebirge]] = [[Ester Mountains]]
| [[Gutensteiner Alpen]] = [[Gutenstein Alps]]
| [[Haardt (Pfälzerwald)|Haardt]] = [[Haardt]]
| [[Harz (Mittelgebirge)|Harz]] = [[Harz Mountains]]
| [[Hornbachkette]], [[Allgäuer Alpen]] = [[Hornbach chain]], [[Allgäu Alps]]
| [[Kaufunger Wald]] = [[Kaufungen Forest]]
| [[Kitzbüheler Alpen]] = [[Kitzbühel Alps]]
| [[Kitzbühler Alpen]] = [[Kitzbühel Alps]]
| [[Lechquellengebirge]] = [[Lechquellen Mountains]]
| [[Lipper Bergland]] = [[Lippe Uplands]]
| [[Mangfallgebirge]] = [[Mangfall Mountains]]
| [[Mangfallgebirge]] ([[Schlierseer Berge]]) = [[Mangfall Mountains]] ([[Schliersee Mountains]])
| [[Oberlausitzer Bergland]] = [[Upper Lusatian Highlands]]
| [[Oberpfälzer Wald]] = [[Upper Palatine Forest]]
| [[Nordpfälzer Bergland]] = [[North Palatine Uplands]]
| [[Pfälzerwald]] = [[Palatine Forest]]
| [[Sächsische Schweiz]] = [[Saxon Switzerland]]
| [[Schlierseer Berge]] = [[Schliersee Mountains]]
| [[Schwäbische Alb]] = [[Swabian Jura]]
| [[Schwarzwald]] = [[Black Forest]]
| [[Sonnjochgruppe]], [[Karwendel]] = [[Sonnjoch Group]], [[Karwendel]]
| [[Tannheimer Berge]], [[Allgäuer Alpen]] = [[Tannheim Mountains]], [[Allgäu Alps]]
| [[Teutoburger Wald]] = [[Teutoburg Forest]]
| [[Thüringer Wald]] = [[Thuringian Forest]]
| [[Tuxer Alpen]] = [[Tux Alps]]
| [[Voralpen]] ([[Bayerische Voralpen]]) = [[Prealps]] ([[Bavarian Prealps]])
| [[Walliser Alpen]] = [[Pennine Alps]]
| [[Weserbergland]] = [[Weser Uplands]]
| [[Wettersteingebirge]] = [[Wetterstein Mountains]]
| [[Wettersteingebirge]], [[Ostalpen]] = [[Wetterstein Mountains]], [[Eastern Alps]]
| [[Zittauer Gebirge]] = [[Zittau Mountains]]
| #default = {{{GEBIRGE|}}}
}}
| parent_peak =
| location = {{<includeonly>safesubst:</includeonly>#switch: {{{LAGE|}}}
| [[Baden-Württemberg]], [[Deutschland]] = [[Baden-Württemberg]], {{GER}}
| [[Bayern]] = [[Bavaria]], {{GER}}
| [[Bayern]], [[Deutschland]] = [[Bavaria]], {{GER}}
| [[Bayern]]/[[Hessen]], [[Deutschland]] = [[Bavaria]]/[[Hesse]], {{GER}}
| Grenze [[Bayern]], [[Deutschland]]/ [[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Bavaria]], {{GER}} / [[Tyrol (state)|Tyrol]], {{AUT}}
| [[Hochsauerland]], [[Nordrhein-Westfalen]] = [[Hochsauerland]], [[North Rhine-Westphalia]], {{GER}}
| [[Italien]] = {{ITA}}
| [[Niederösterreich]] = [[Lower Austria]], {{AUT}}
| [[Niederösterreich]], [[Österreich]] = [[Lower Austria]], {{AUT}}
| [[Niederösterreich]] ([[Österreich]]) = [[Lower Austria]], {{AUT}}
| [[Niedersachsen]], [[Deutschland]] = [[Lower Saxony]], {{GER}}
| [[Nordpfalz]] ([[Rheinland-Pfalz]], [[Deutschland]]) = [[North Palatine]], [[Rhineland-Palatinate]], {{GER}}
| [[Nordrhein-Westfalen]], [[Deutschland]] = [[North Rhine-Westphalia]], {{GER}}
| [[Pfälzerwald]] ([[Rheinland-Pfalz]], [[Deutschland]]) = [[Palatine Forest]], [[Rhineland-Palatinate]], {{GER}}
| [[Rheinland-Pfalz]], [[Deutschland]] = [[Rhineland-Palatinate]], {{GER}}
| [[Rheinland-Pfalz]], ([[Deutschland]]) = [[Rhineland-Palatinate]], {{GER}}
| [[Sauerland]], [[Nordrhein-Westfalen]], [[Deutschland]]= [[Sauerland]], [[North Rhine-Westphalia]], {{GER}}
| [[Sachsen|Freistaat Sachsen]], [[Deutschland]] = [[Saxony]], {{GER}}
| [[Sachsen]], [[Deutschland]] = [[Saxony]], {{GER}}
| [[Sachsen]] ([[Deutschland]]) = [[Saxony]], {{GER}}
| [[Deutschland]], [[Sachsen]] = [[Saxony]], {{GER}}
| [[Sachsen-Anhalt]], [[Deutschland]] = [[Saxony-Anhalt]], {{GER}}
| [[Salzburg (Bundesland)|Salzburg]], [[Österreich]] = [[Salzburg (state)|Salzburg]], {{AUT}}
| [[Steiermark]], [[Österreich]] = [[Styria]], {{AUT}}
| [[Thüringen]], [[Deutschland]] = [[Thuringia]], {{GER}}
| [[Thüringen]] ([[Deutschland]]) = [[Thuringia]], {{GER}}
| [[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Tyrol (state)|Tyrol]], {{AUT}}
| [[Tschechien]] = {{CZE}}
| [[Vorarlberg]], [[Österreich]] = [[Vorarlberg]], [[Austria]]
| #default = {{{LAGE|}}}
}}
| map = {{<includeonly>safesubst:</includeonly>#if:{{{KARTE|}}}
|
|{{<includeonly>safesubst:</includeonly>#if:{{{POSKARTE|}}}
|
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}
|{{<includeonly>safesubst:</includeonly>Infobox Berg/map|{{<includeonly>safesubst:</includeonly>#titleparts:{{{REGION-ISO|}}}|1|1}}}}
}}
}}
}}
}}
| map_image = {{<includeonly>safesubst:</includeonly>#if:{{{KARTE|}}}
|{{{KARTE|}}}
|{{<includeonly>safesubst:</includeonly>#if:{{{POSKARTE|}}}
|{{{POSKARTE|}}}
|{{{ALTERNATIVKARTE|}}}
}}
}}
| map_alt =
| map_caption =
| map_relief =
| map_size =
| label =
| label_position =
| coordinates = {{<includeonly>safesubst:</includeonly>#if: {{{COORD|}}}
|{{{COORD}}}
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>German coord convert|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}|type:mountain{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}|_region:{{{REGION-ISO|}}}}}|format=dms|display=inline,title}}
|{{<includeonly>safesubst:</includeonly>#if:{{{GEO-LAGE|}}}|{{{GEO-LAGE}}}<span style="display:none">[[Template:Coordinate/Wartung/Berg|dep1]]</span>}}
}}
}}
| topo = {{{TOPO-KARTE|}}}
| type = {{<includeonly>safesubst:</includeonly>#switch: {{{TYP|}}}
| Bergrücken = [[ridge]]
| [[Bergrücken]] = [[ridge]]
| Doppelgipfel = double summit
| erloschener [[Vulkan]] = extinct [[volcano]]
| Felsmassiv = rock [[massif]]
| Felsberg = rock summit
| [[Kegelberg]] = cone mountain
| [[Quellkuppe]] = [[cryptodome]]
| [[Schlackenkegel]] = [[cinder cone]]
| [[Tafelberg]] = [[table mountain]]
| [[Vulkan]] = [[volcano]]
| #default = {{{TYP|}}}
}}
| geology = {{<includeonly>safesubst:</includeonly>#switch: {{{GESTEIN|}}}
| [[Basalt]] und [[Tuff]] = [[Basalt]] and [[tuff]]
| [[Buntsandstein]] = [[Bunter Sandstone]]
| [[Dachsteinkalk]] = [[Dachstein limestone]]
| [[Gneis]] = [[Gneiss]]
| [[Granit]] = [[Granite]]
| Granit = [[Granite]]
| [[Hauptdolomit]] = [[main dolomite]]
| Hauptdolomit = [[main dolomite]]
| [[Rhyolith]] = [[Rhyolite]]
| [[Sandstein]] = [[Sandstone]]
| [[Weißer Jura]] = [[White Jurassic]]
| Weißer Jura = [[White Jurassic]]
| [[Wettersteinkalk]] = [[Wetterstein limestone]]
| [[Vorberge (Geomorphologie)|Vorgebirge]] = [[foothills]]
| [[Vulkan]] = [[volcano]]
| #default = {{{GESTEIN|}}}
}}
| volcanic_arc/belt =
| age = {{<includeonly>safesubst:</includeonly>#switch: {{{ALTER|}}}
| variskisch = [[Hercynian]]
| [[Kreide (Geologie)|Kreide]] = [[Cretaceous]]
| [[Trias (Geologie)|Trias]] = [[Triassic]]
| #default = {{{ALTER|}}}
}}
| last_eruption = {{{LETZTE ERUPTION|}}}
| first_ascent = {{{ERSTBESTEIGUNG|}}}
| access = {{{ERSCHLIESSUNG|}}}
| easiest_route = {{{LEICHTESTE ROUTE|}}}
| normal_route = {{{NORMALWEG|}}}
}}<noinclude>
{{Documentation}}
</noinclude>
a0vwsg4dxsb4pmg558dg29jtlfjii39
74811
74810
2026-08-24T00:16:59Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mountain/Berg]]
74810
wikitext
text/x-wiki
{{Infobox mountain
| name = {{<includeonly>safesubst:</includeonly>#if: {{{NAME|}}}|{{{NAME}}}|{{<includeonly>safesubst:</includeonly>PAGENAME}}}}
| photo = {{{BILD|}}}
| photo_size = {{<includeonly>safesubst:</includeonly>#if:{{{BILD-BREITE|}}}|{{{BILD-BREITE|}}}|282px}}
| photo_alt =
| photo_caption = {{{BILDBESCHREIBUNG|}}}
{{<includeonly>safesubst:</includeonly>br separated entries
| 1 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD1|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD1}}}|size={{{BILD1-BREITE|}}}|{{{BILD1-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 2 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD1|}}}|{{{BILD1-BESCHREIBUNG|}}}}}
| 3 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD2|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD2}}}|size={{{BILD2-BREITE|}}}|{{{BILD2-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 4 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD2|}}}|{{{BILD2-BESCHREIBUNG|}}}}}
| 5 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD3|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD3}}}|size={{{BILD3-BREITE|}}}|{{{BILD3-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 6 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD3|}}}|{{{BILD3-BESCHREIBUNG|}}}}}
| 7 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD4|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD4}}}|size={{{BILD4-BREITE|}}}|{{{BILD4-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 8 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD4|}}}|{{{BILD4-BESCHREIBUNG|}}}}}
| 9 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD5|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD5}}}|size={{{BILD5-BREITE|}}}|{{{BILD5-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 10= {{<includeonly>safesubst:</includeonly>#if:{{{BILD5|}}}|{{{BILD5-BESCHREIBUNG|}}}}}
}}
| elevation = {{<includeonly>safesubst:</includeonly>#if: {{{HÖHE|}}}|{{Höhe|{{{HÖHE|}}}|{{{HÖHE-BEZUG|}}}|link={{<includeonly>safesubst:</includeonly>#if:{{{HÖHE-BEZUG|}}}|true|false}} }} ({{convert|{{{HÖHE|}}}|m|ft|disp=output only|abbr=on}}) {{{HÖHE-ANMERKUNG|}}} }}
| elevation_ref = {{<includeonly>safesubst:</includeonly>#ifeq:{{<includeonly>safesubst:</includeonly>NAMESPACE}}|{{<includeonly>safesubst:</includeonly>ns:0}}
|{{<includeonly>safesubst:</includeonly>#if: {{{HÖHE|}}}
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 8000 | [[Category:Eight-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 7000 | [[Category:Seven-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 6000 | [[Category:Six-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 5000 | [[Category:Five-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 4000 | [[Category:Four-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 3000 | [[Category:Three-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 2000 | [[Category:Two-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 1000 | [[Category:One-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 611 | [[Category:Mountains under 1000 metres]]
}}
}}
}}
}}
}}
}}
}}
}}
}}
}}}}
| isolation = {{<includeonly>safesubst:</includeonly>#if:{{{DOMINANZ|}}}|{{<includeonly>safesubst:</includeonly>formatnum: {{{DOMINANZ|}}}}} km{{<includeonly>safesubst:</includeonly>#if:{{{DOMINANZ-BEZUG|}}}|<span title="to"> → </span>{{{DOMINANZ-BEZUG}}}}} }}
| isolation_ref =
| prominence = {{<includeonly>safesubst:</includeonly>#if:{{{SCHARTENHÖHE|}}}|{{<includeonly>safesubst:</includeonly>formatnum:{{{SCHARTENHÖHE|}}}}} m{{<includeonly>safesubst:</includeonly>#if:{{{SCHARTE|}}}|<span title="above the wind-gap"> ↓ </span>{{{SCHARTE}}}}}{{<includeonly>safesubst:</includeonly>#if:{{{SCHARTE-BEZUG|}}}|<span title="to"> → </span>{{{SCHARTE-BEZUG}}}}} }}
| prominence_ref =
| listing = {{<includeonly>safesubst:</includeonly>#if:{{{BESONDERHEITEN|}}}|{{{BESONDERHEITEN}}}}}
| range = {{<includeonly>safesubst:</includeonly>#switch: {{{GEBIRGE|}}}
| [[Ammergauer Alpen]] = [[Ammergau Alps]]
| [[Bayerische Voralpen]] = [[Bavarian Prealps]]
| [[Bayerischer Wald]] = [[Bavarian Forest]]
| [[Berchtesgadener Alpen]] = [[Berchtesgaden Alps]]
| [[Böhmerwald]] = [[Bohemian Forest]]
| [[Böhmische Schweiz]] = [[Bohemian Switzerland]]
| [[Brandenberger Alpen]] = [[Brandenberg Alps]]
| [[Chiemgauer Alpen]] = [[Chiemgau Alps]]
| [[Elbsandsteingebirge]] = [[Elbe Sandstone Mountains]]
| [[Erzgebirge]] = [[Ore Mountains]]
| [[Estergebirge]] = [[Ester Mountains]]
| [[Gutensteiner Alpen]] = [[Gutenstein Alps]]
| [[Haardt (Pfälzerwald)|Haardt]] = [[Haardt]]
| [[Harz (Mittelgebirge)|Harz]] = [[Harz Mountains]]
| [[Hornbachkette]], [[Allgäuer Alpen]] = [[Hornbach chain]], [[Allgäu Alps]]
| [[Kaufunger Wald]] = [[Kaufungen Forest]]
| [[Kitzbüheler Alpen]] = [[Kitzbühel Alps]]
| [[Kitzbühler Alpen]] = [[Kitzbühel Alps]]
| [[Lechquellengebirge]] = [[Lechquellen Mountains]]
| [[Lipper Bergland]] = [[Lippe Uplands]]
| [[Mangfallgebirge]] = [[Mangfall Mountains]]
| [[Mangfallgebirge]] ([[Schlierseer Berge]]) = [[Mangfall Mountains]] ([[Schliersee Mountains]])
| [[Oberlausitzer Bergland]] = [[Upper Lusatian Highlands]]
| [[Oberpfälzer Wald]] = [[Upper Palatine Forest]]
| [[Nordpfälzer Bergland]] = [[North Palatine Uplands]]
| [[Pfälzerwald]] = [[Palatine Forest]]
| [[Sächsische Schweiz]] = [[Saxon Switzerland]]
| [[Schlierseer Berge]] = [[Schliersee Mountains]]
| [[Schwäbische Alb]] = [[Swabian Jura]]
| [[Schwarzwald]] = [[Black Forest]]
| [[Sonnjochgruppe]], [[Karwendel]] = [[Sonnjoch Group]], [[Karwendel]]
| [[Tannheimer Berge]], [[Allgäuer Alpen]] = [[Tannheim Mountains]], [[Allgäu Alps]]
| [[Teutoburger Wald]] = [[Teutoburg Forest]]
| [[Thüringer Wald]] = [[Thuringian Forest]]
| [[Tuxer Alpen]] = [[Tux Alps]]
| [[Voralpen]] ([[Bayerische Voralpen]]) = [[Prealps]] ([[Bavarian Prealps]])
| [[Walliser Alpen]] = [[Pennine Alps]]
| [[Weserbergland]] = [[Weser Uplands]]
| [[Wettersteingebirge]] = [[Wetterstein Mountains]]
| [[Wettersteingebirge]], [[Ostalpen]] = [[Wetterstein Mountains]], [[Eastern Alps]]
| [[Zittauer Gebirge]] = [[Zittau Mountains]]
| #default = {{{GEBIRGE|}}}
}}
| parent_peak =
| location = {{<includeonly>safesubst:</includeonly>#switch: {{{LAGE|}}}
| [[Baden-Württemberg]], [[Deutschland]] = [[Baden-Württemberg]], {{GER}}
| [[Bayern]] = [[Bavaria]], {{GER}}
| [[Bayern]], [[Deutschland]] = [[Bavaria]], {{GER}}
| [[Bayern]]/[[Hessen]], [[Deutschland]] = [[Bavaria]]/[[Hesse]], {{GER}}
| Grenze [[Bayern]], [[Deutschland]]/ [[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Bavaria]], {{GER}} / [[Tyrol (state)|Tyrol]], {{AUT}}
| [[Hochsauerland]], [[Nordrhein-Westfalen]] = [[Hochsauerland]], [[North Rhine-Westphalia]], {{GER}}
| [[Italien]] = {{ITA}}
| [[Niederösterreich]] = [[Lower Austria]], {{AUT}}
| [[Niederösterreich]], [[Österreich]] = [[Lower Austria]], {{AUT}}
| [[Niederösterreich]] ([[Österreich]]) = [[Lower Austria]], {{AUT}}
| [[Niedersachsen]], [[Deutschland]] = [[Lower Saxony]], {{GER}}
| [[Nordpfalz]] ([[Rheinland-Pfalz]], [[Deutschland]]) = [[North Palatine]], [[Rhineland-Palatinate]], {{GER}}
| [[Nordrhein-Westfalen]], [[Deutschland]] = [[North Rhine-Westphalia]], {{GER}}
| [[Pfälzerwald]] ([[Rheinland-Pfalz]], [[Deutschland]]) = [[Palatine Forest]], [[Rhineland-Palatinate]], {{GER}}
| [[Rheinland-Pfalz]], [[Deutschland]] = [[Rhineland-Palatinate]], {{GER}}
| [[Rheinland-Pfalz]], ([[Deutschland]]) = [[Rhineland-Palatinate]], {{GER}}
| [[Sauerland]], [[Nordrhein-Westfalen]], [[Deutschland]]= [[Sauerland]], [[North Rhine-Westphalia]], {{GER}}
| [[Sachsen|Freistaat Sachsen]], [[Deutschland]] = [[Saxony]], {{GER}}
| [[Sachsen]], [[Deutschland]] = [[Saxony]], {{GER}}
| [[Sachsen]] ([[Deutschland]]) = [[Saxony]], {{GER}}
| [[Deutschland]], [[Sachsen]] = [[Saxony]], {{GER}}
| [[Sachsen-Anhalt]], [[Deutschland]] = [[Saxony-Anhalt]], {{GER}}
| [[Salzburg (Bundesland)|Salzburg]], [[Österreich]] = [[Salzburg (state)|Salzburg]], {{AUT}}
| [[Steiermark]], [[Österreich]] = [[Styria]], {{AUT}}
| [[Thüringen]], [[Deutschland]] = [[Thuringia]], {{GER}}
| [[Thüringen]] ([[Deutschland]]) = [[Thuringia]], {{GER}}
| [[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Tyrol (state)|Tyrol]], {{AUT}}
| [[Tschechien]] = {{CZE}}
| [[Vorarlberg]], [[Österreich]] = [[Vorarlberg]], [[Austria]]
| #default = {{{LAGE|}}}
}}
| map = {{<includeonly>safesubst:</includeonly>#if:{{{KARTE|}}}
|
|{{<includeonly>safesubst:</includeonly>#if:{{{POSKARTE|}}}
|
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}
|{{<includeonly>safesubst:</includeonly>Infobox Berg/map|{{<includeonly>safesubst:</includeonly>#titleparts:{{{REGION-ISO|}}}|1|1}}}}
}}
}}
}}
}}
| map_image = {{<includeonly>safesubst:</includeonly>#if:{{{KARTE|}}}
|{{{KARTE|}}}
|{{<includeonly>safesubst:</includeonly>#if:{{{POSKARTE|}}}
|{{{POSKARTE|}}}
|{{{ALTERNATIVKARTE|}}}
}}
}}
| map_alt =
| map_caption =
| map_relief =
| map_size =
| label =
| label_position =
| coordinates = {{<includeonly>safesubst:</includeonly>#if: {{{COORD|}}}
|{{{COORD}}}
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>German coord convert|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}|type:mountain{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}|_region:{{{REGION-ISO|}}}}}|format=dms|display=inline,title}}
|{{<includeonly>safesubst:</includeonly>#if:{{{GEO-LAGE|}}}|{{{GEO-LAGE}}}<span style="display:none">[[Template:Coordinate/Wartung/Berg|dep1]]</span>}}
}}
}}
| topo = {{{TOPO-KARTE|}}}
| type = {{<includeonly>safesubst:</includeonly>#switch: {{{TYP|}}}
| Bergrücken = [[ridge]]
| [[Bergrücken]] = [[ridge]]
| Doppelgipfel = double summit
| erloschener [[Vulkan]] = extinct [[volcano]]
| Felsmassiv = rock [[massif]]
| Felsberg = rock summit
| [[Kegelberg]] = cone mountain
| [[Quellkuppe]] = [[cryptodome]]
| [[Schlackenkegel]] = [[cinder cone]]
| [[Tafelberg]] = [[table mountain]]
| [[Vulkan]] = [[volcano]]
| #default = {{{TYP|}}}
}}
| geology = {{<includeonly>safesubst:</includeonly>#switch: {{{GESTEIN|}}}
| [[Basalt]] und [[Tuff]] = [[Basalt]] and [[tuff]]
| [[Buntsandstein]] = [[Bunter Sandstone]]
| [[Dachsteinkalk]] = [[Dachstein limestone]]
| [[Gneis]] = [[Gneiss]]
| [[Granit]] = [[Granite]]
| Granit = [[Granite]]
| [[Hauptdolomit]] = [[main dolomite]]
| Hauptdolomit = [[main dolomite]]
| [[Rhyolith]] = [[Rhyolite]]
| [[Sandstein]] = [[Sandstone]]
| [[Weißer Jura]] = [[White Jurassic]]
| Weißer Jura = [[White Jurassic]]
| [[Wettersteinkalk]] = [[Wetterstein limestone]]
| [[Vorberge (Geomorphologie)|Vorgebirge]] = [[foothills]]
| [[Vulkan]] = [[volcano]]
| #default = {{{GESTEIN|}}}
}}
| volcanic_arc/belt =
| age = {{<includeonly>safesubst:</includeonly>#switch: {{{ALTER|}}}
| variskisch = [[Hercynian]]
| [[Kreide (Geologie)|Kreide]] = [[Cretaceous]]
| [[Trias (Geologie)|Trias]] = [[Triassic]]
| #default = {{{ALTER|}}}
}}
| last_eruption = {{{LETZTE ERUPTION|}}}
| first_ascent = {{{ERSTBESTEIGUNG|}}}
| access = {{{ERSCHLIESSUNG|}}}
| easiest_route = {{{LEICHTESTE ROUTE|}}}
| normal_route = {{{NORMALWEG|}}}
}}<noinclude>
{{Documentation}}
</noinclude>
a0vwsg4dxsb4pmg558dg29jtlfjii39
74826
74811
2026-08-24T00:20:25Z
en>Robertsky
0
replace deprecated parameters
74826
wikitext
text/x-wiki
{{Infobox mountain
| name = {{<includeonly>safesubst:</includeonly>#if: {{{NAME|}}}|{{{NAME}}}|{{<includeonly>safesubst:</includeonly>PAGENAME}}}}
| image = {{{BILD|}}}
| image_size = {{<includeonly>safesubst:</includeonly>#if:{{{BILD-BREITE|}}}|{{{BILD-BREITE|}}}|282px}}
| image_alt =
| image_caption = {{{BILDBESCHREIBUNG|}}}
{{<includeonly>safesubst:</includeonly>br separated entries
| 1 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD1|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD1}}}|size={{{BILD1-BREITE|}}}|{{{BILD1-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 2 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD1|}}}|{{{BILD1-BESCHREIBUNG|}}}}}
| 3 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD2|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD2}}}|size={{{BILD2-BREITE|}}}|{{{BILD2-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 4 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD2|}}}|{{{BILD2-BESCHREIBUNG|}}}}}
| 5 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD3|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD3}}}|size={{{BILD3-BREITE|}}}|{{{BILD3-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 6 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD3|}}}|{{{BILD3-BESCHREIBUNG|}}}}}
| 7 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD4|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD4}}}|size={{{BILD4-BREITE|}}}|{{{BILD4-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 8 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD4|}}}|{{{BILD4-BESCHREIBUNG|}}}}}
| 9 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD5|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD5}}}|size={{{BILD5-BREITE|}}}|{{{BILD5-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 10= {{<includeonly>safesubst:</includeonly>#if:{{{BILD5|}}}|{{{BILD5-BESCHREIBUNG|}}}}}
}}
| elevation = {{<includeonly>safesubst:</includeonly>#if: {{{HÖHE|}}}|{{Höhe|{{{HÖHE|}}}|{{{HÖHE-BEZUG|}}}|link={{<includeonly>safesubst:</includeonly>#if:{{{HÖHE-BEZUG|}}}|true|false}} }} ({{convert|{{{HÖHE|}}}|m|ft|disp=output only|abbr=on}}) {{{HÖHE-ANMERKUNG|}}} }}
| elevation_ref = {{<includeonly>safesubst:</includeonly>#ifeq:{{<includeonly>safesubst:</includeonly>NAMESPACE}}|{{<includeonly>safesubst:</includeonly>ns:0}}
|{{<includeonly>safesubst:</includeonly>#if: {{{HÖHE|}}}
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 8000 | [[Category:Eight-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 7000 | [[Category:Seven-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 6000 | [[Category:Six-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 5000 | [[Category:Five-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 4000 | [[Category:Four-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 3000 | [[Category:Three-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 2000 | [[Category:Two-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 1000 | [[Category:One-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 611 | [[Category:Mountains under 1000 metres]]
}}
}}
}}
}}
}}
}}
}}
}}
}}
}}}}
| isolation = {{<includeonly>safesubst:</includeonly>#if:{{{DOMINANZ|}}}|{{<includeonly>safesubst:</includeonly>formatnum: {{{DOMINANZ|}}}}} km{{<includeonly>safesubst:</includeonly>#if:{{{DOMINANZ-BEZUG|}}}|<span title="to"> → </span>{{{DOMINANZ-BEZUG}}}}} }}
| isolation_ref =
| prominence = {{<includeonly>safesubst:</includeonly>#if:{{{SCHARTENHÖHE|}}}|{{<includeonly>safesubst:</includeonly>formatnum:{{{SCHARTENHÖHE|}}}}} m{{<includeonly>safesubst:</includeonly>#if:{{{SCHARTE|}}}|<span title="above the wind-gap"> ↓ </span>{{{SCHARTE}}}}}{{<includeonly>safesubst:</includeonly>#if:{{{SCHARTE-BEZUG|}}}|<span title="to"> → </span>{{{SCHARTE-BEZUG}}}}} }}
| prominence_ref =
| listing = {{<includeonly>safesubst:</includeonly>#if:{{{BESONDERHEITEN|}}}|{{{BESONDERHEITEN}}}}}
| range = {{<includeonly>safesubst:</includeonly>#switch: {{{GEBIRGE|}}}
| [[Ammergauer Alpen]] = [[Ammergau Alps]]
| [[Bayerische Voralpen]] = [[Bavarian Prealps]]
| [[Bayerischer Wald]] = [[Bavarian Forest]]
| [[Berchtesgadener Alpen]] = [[Berchtesgaden Alps]]
| [[Böhmerwald]] = [[Bohemian Forest]]
| [[Böhmische Schweiz]] = [[Bohemian Switzerland]]
| [[Brandenberger Alpen]] = [[Brandenberg Alps]]
| [[Chiemgauer Alpen]] = [[Chiemgau Alps]]
| [[Elbsandsteingebirge]] = [[Elbe Sandstone Mountains]]
| [[Erzgebirge]] = [[Ore Mountains]]
| [[Estergebirge]] = [[Ester Mountains]]
| [[Gutensteiner Alpen]] = [[Gutenstein Alps]]
| [[Haardt (Pfälzerwald)|Haardt]] = [[Haardt]]
| [[Harz (Mittelgebirge)|Harz]] = [[Harz Mountains]]
| [[Hornbachkette]], [[Allgäuer Alpen]] = [[Hornbach chain]], [[Allgäu Alps]]
| [[Kaufunger Wald]] = [[Kaufungen Forest]]
| [[Kitzbüheler Alpen]] = [[Kitzbühel Alps]]
| [[Kitzbühler Alpen]] = [[Kitzbühel Alps]]
| [[Lechquellengebirge]] = [[Lechquellen Mountains]]
| [[Lipper Bergland]] = [[Lippe Uplands]]
| [[Mangfallgebirge]] = [[Mangfall Mountains]]
| [[Mangfallgebirge]] ([[Schlierseer Berge]]) = [[Mangfall Mountains]] ([[Schliersee Mountains]])
| [[Oberlausitzer Bergland]] = [[Upper Lusatian Highlands]]
| [[Oberpfälzer Wald]] = [[Upper Palatine Forest]]
| [[Nordpfälzer Bergland]] = [[North Palatine Uplands]]
| [[Pfälzerwald]] = [[Palatine Forest]]
| [[Sächsische Schweiz]] = [[Saxon Switzerland]]
| [[Schlierseer Berge]] = [[Schliersee Mountains]]
| [[Schwäbische Alb]] = [[Swabian Jura]]
| [[Schwarzwald]] = [[Black Forest]]
| [[Sonnjochgruppe]], [[Karwendel]] = [[Sonnjoch Group]], [[Karwendel]]
| [[Tannheimer Berge]], [[Allgäuer Alpen]] = [[Tannheim Mountains]], [[Allgäu Alps]]
| [[Teutoburger Wald]] = [[Teutoburg Forest]]
| [[Thüringer Wald]] = [[Thuringian Forest]]
| [[Tuxer Alpen]] = [[Tux Alps]]
| [[Voralpen]] ([[Bayerische Voralpen]]) = [[Prealps]] ([[Bavarian Prealps]])
| [[Walliser Alpen]] = [[Pennine Alps]]
| [[Weserbergland]] = [[Weser Uplands]]
| [[Wettersteingebirge]] = [[Wetterstein Mountains]]
| [[Wettersteingebirge]], [[Ostalpen]] = [[Wetterstein Mountains]], [[Eastern Alps]]
| [[Zittauer Gebirge]] = [[Zittau Mountains]]
| #default = {{{GEBIRGE|}}}
}}
| parent_peak =
| location = {{<includeonly>safesubst:</includeonly>#switch: {{{LAGE|}}}
| [[Baden-Württemberg]], [[Deutschland]] = [[Baden-Württemberg]], {{GER}}
| [[Bayern]] = [[Bavaria]], {{GER}}
| [[Bayern]], [[Deutschland]] = [[Bavaria]], {{GER}}
| [[Bayern]]/[[Hessen]], [[Deutschland]] = [[Bavaria]]/[[Hesse]], {{GER}}
| Grenze [[Bayern]], [[Deutschland]]/ [[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Bavaria]], {{GER}} / [[Tyrol (state)|Tyrol]], {{AUT}}
| [[Hochsauerland]], [[Nordrhein-Westfalen]] = [[Hochsauerland]], [[North Rhine-Westphalia]], {{GER}}
| [[Italien]] = {{ITA}}
| [[Niederösterreich]] = [[Lower Austria]], {{AUT}}
| [[Niederösterreich]], [[Österreich]] = [[Lower Austria]], {{AUT}}
| [[Niederösterreich]] ([[Österreich]]) = [[Lower Austria]], {{AUT}}
| [[Niedersachsen]], [[Deutschland]] = [[Lower Saxony]], {{GER}}
| [[Nordpfalz]] ([[Rheinland-Pfalz]], [[Deutschland]]) = [[North Palatine]], [[Rhineland-Palatinate]], {{GER}}
| [[Nordrhein-Westfalen]], [[Deutschland]] = [[North Rhine-Westphalia]], {{GER}}
| [[Pfälzerwald]] ([[Rheinland-Pfalz]], [[Deutschland]]) = [[Palatine Forest]], [[Rhineland-Palatinate]], {{GER}}
| [[Rheinland-Pfalz]], [[Deutschland]] = [[Rhineland-Palatinate]], {{GER}}
| [[Rheinland-Pfalz]], ([[Deutschland]]) = [[Rhineland-Palatinate]], {{GER}}
| [[Sauerland]], [[Nordrhein-Westfalen]], [[Deutschland]]= [[Sauerland]], [[North Rhine-Westphalia]], {{GER}}
| [[Sachsen|Freistaat Sachsen]], [[Deutschland]] = [[Saxony]], {{GER}}
| [[Sachsen]], [[Deutschland]] = [[Saxony]], {{GER}}
| [[Sachsen]] ([[Deutschland]]) = [[Saxony]], {{GER}}
| [[Deutschland]], [[Sachsen]] = [[Saxony]], {{GER}}
| [[Sachsen-Anhalt]], [[Deutschland]] = [[Saxony-Anhalt]], {{GER}}
| [[Salzburg (Bundesland)|Salzburg]], [[Österreich]] = [[Salzburg (state)|Salzburg]], {{AUT}}
| [[Steiermark]], [[Österreich]] = [[Styria]], {{AUT}}
| [[Thüringen]], [[Deutschland]] = [[Thuringia]], {{GER}}
| [[Thüringen]] ([[Deutschland]]) = [[Thuringia]], {{GER}}
| [[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Tyrol (state)|Tyrol]], {{AUT}}
| [[Tschechien]] = {{CZE}}
| [[Vorarlberg]], [[Österreich]] = [[Vorarlberg]], [[Austria]]
| #default = {{{LAGE|}}}
}}
| map = {{<includeonly>safesubst:</includeonly>#if:{{{KARTE|}}}
|
|{{<includeonly>safesubst:</includeonly>#if:{{{POSKARTE|}}}
|
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}
|{{<includeonly>safesubst:</includeonly>Infobox Berg/map|{{<includeonly>safesubst:</includeonly>#titleparts:{{{REGION-ISO|}}}|1|1}}}}
}}
}}
}}
}}
| map_image = {{<includeonly>safesubst:</includeonly>#if:{{{KARTE|}}}
|{{{KARTE|}}}
|{{<includeonly>safesubst:</includeonly>#if:{{{POSKARTE|}}}
|{{{POSKARTE|}}}
|{{{ALTERNATIVKARTE|}}}
}}
}}
| map_alt =
| map_caption =
| map_relief =
| map_size =
| label =
| label_position =
| coordinates = {{<includeonly>safesubst:</includeonly>#if: {{{COORD|}}}
|{{{COORD}}}
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>German coord convert|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}|type:mountain{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}|_region:{{{REGION-ISO|}}}}}|format=dms|display=inline,title}}
|{{<includeonly>safesubst:</includeonly>#if:{{{GEO-LAGE|}}}|{{{GEO-LAGE}}}<span style="display:none">[[Template:Coordinate/Wartung/Berg|dep1]]</span>}}
}}
}}
| topo = {{{TOPO-KARTE|}}}
| type = {{<includeonly>safesubst:</includeonly>#switch: {{{TYP|}}}
| Bergrücken = [[ridge]]
| [[Bergrücken]] = [[ridge]]
| Doppelgipfel = double summit
| erloschener [[Vulkan]] = extinct [[volcano]]
| Felsmassiv = rock [[massif]]
| Felsberg = rock summit
| [[Kegelberg]] = cone mountain
| [[Quellkuppe]] = [[cryptodome]]
| [[Schlackenkegel]] = [[cinder cone]]
| [[Tafelberg]] = [[table mountain]]
| [[Vulkan]] = [[volcano]]
| #default = {{{TYP|}}}
}}
| geology = {{<includeonly>safesubst:</includeonly>#switch: {{{GESTEIN|}}}
| [[Basalt]] und [[Tuff]] = [[Basalt]] and [[tuff]]
| [[Buntsandstein]] = [[Bunter Sandstone]]
| [[Dachsteinkalk]] = [[Dachstein limestone]]
| [[Gneis]] = [[Gneiss]]
| [[Granit]] = [[Granite]]
| Granit = [[Granite]]
| [[Hauptdolomit]] = [[main dolomite]]
| Hauptdolomit = [[main dolomite]]
| [[Rhyolith]] = [[Rhyolite]]
| [[Sandstein]] = [[Sandstone]]
| [[Weißer Jura]] = [[White Jurassic]]
| Weißer Jura = [[White Jurassic]]
| [[Wettersteinkalk]] = [[Wetterstein limestone]]
| [[Vorberge (Geomorphologie)|Vorgebirge]] = [[foothills]]
| [[Vulkan]] = [[volcano]]
| #default = {{{GESTEIN|}}}
}}
| volcanic_arc/belt =
| age = {{<includeonly>safesubst:</includeonly>#switch: {{{ALTER|}}}
| variskisch = [[Hercynian]]
| [[Kreide (Geologie)|Kreide]] = [[Cretaceous]]
| [[Trias (Geologie)|Trias]] = [[Triassic]]
| #default = {{{ALTER|}}}
}}
| last_eruption = {{{LETZTE ERUPTION|}}}
| first_ascent = {{{ERSTBESTEIGUNG|}}}
| access = {{{ERSCHLIESSUNG|}}}
| easiest_route = {{{LEICHTESTE ROUTE|}}}
| normal_route = {{{NORMALWEG|}}}
}}<noinclude>
{{Documentation}}
</noinclude>
18wl248w6euy7m95y5vjdyqdyc4lyac
74827
74826
2026-08-24T00:20:41Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mountain/Berg]]
74826
wikitext
text/x-wiki
{{Infobox mountain
| name = {{<includeonly>safesubst:</includeonly>#if: {{{NAME|}}}|{{{NAME}}}|{{<includeonly>safesubst:</includeonly>PAGENAME}}}}
| image = {{{BILD|}}}
| image_size = {{<includeonly>safesubst:</includeonly>#if:{{{BILD-BREITE|}}}|{{{BILD-BREITE|}}}|282px}}
| image_alt =
| image_caption = {{{BILDBESCHREIBUNG|}}}
{{<includeonly>safesubst:</includeonly>br separated entries
| 1 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD1|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD1}}}|size={{{BILD1-BREITE|}}}|{{{BILD1-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 2 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD1|}}}|{{{BILD1-BESCHREIBUNG|}}}}}
| 3 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD2|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD2}}}|size={{{BILD2-BREITE|}}}|{{{BILD2-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 4 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD2|}}}|{{{BILD2-BESCHREIBUNG|}}}}}
| 5 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD3|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD3}}}|size={{{BILD3-BREITE|}}}|{{{BILD3-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 6 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD3|}}}|{{{BILD3-BESCHREIBUNG|}}}}}
| 7 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD4|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD4}}}|size={{{BILD4-BREITE|}}}|{{{BILD4-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 8 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD4|}}}|{{{BILD4-BESCHREIBUNG|}}}}}
| 9 = {{<includeonly>safesubst:</includeonly>#if:{{{BILD5|}}}|{{<includeonly>safesubst:</includeonly>#invoke:InfoboxImage|InfoboxImage|image={{{BILD5}}}|size={{{BILD5-BREITE|}}}|{{{BILD5-BREITE}}}|sizedefault=282px|maxwidth=282|title=center}}}}
| 10= {{<includeonly>safesubst:</includeonly>#if:{{{BILD5|}}}|{{{BILD5-BESCHREIBUNG|}}}}}
}}
| elevation = {{<includeonly>safesubst:</includeonly>#if: {{{HÖHE|}}}|{{Höhe|{{{HÖHE|}}}|{{{HÖHE-BEZUG|}}}|link={{<includeonly>safesubst:</includeonly>#if:{{{HÖHE-BEZUG|}}}|true|false}} }} ({{convert|{{{HÖHE|}}}|m|ft|disp=output only|abbr=on}}) {{{HÖHE-ANMERKUNG|}}} }}
| elevation_ref = {{<includeonly>safesubst:</includeonly>#ifeq:{{<includeonly>safesubst:</includeonly>NAMESPACE}}|{{<includeonly>safesubst:</includeonly>ns:0}}
|{{<includeonly>safesubst:</includeonly>#if: {{{HÖHE|}}}
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 8000 | [[Category:Eight-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 7000 | [[Category:Seven-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 6000 | [[Category:Six-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 5000 | [[Category:Five-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 4000 | [[Category:Four-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 3000 | [[Category:Three-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 2000 | [[Category:Two-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 1000 | [[Category:One-thousanders]]
|{{<includeonly>safesubst:</includeonly>#ifexpr: {{{HÖHE}}} >= 611 | [[Category:Mountains under 1000 metres]]
}}
}}
}}
}}
}}
}}
}}
}}
}}
}}}}
| isolation = {{<includeonly>safesubst:</includeonly>#if:{{{DOMINANZ|}}}|{{<includeonly>safesubst:</includeonly>formatnum: {{{DOMINANZ|}}}}} km{{<includeonly>safesubst:</includeonly>#if:{{{DOMINANZ-BEZUG|}}}|<span title="to"> → </span>{{{DOMINANZ-BEZUG}}}}} }}
| isolation_ref =
| prominence = {{<includeonly>safesubst:</includeonly>#if:{{{SCHARTENHÖHE|}}}|{{<includeonly>safesubst:</includeonly>formatnum:{{{SCHARTENHÖHE|}}}}} m{{<includeonly>safesubst:</includeonly>#if:{{{SCHARTE|}}}|<span title="above the wind-gap"> ↓ </span>{{{SCHARTE}}}}}{{<includeonly>safesubst:</includeonly>#if:{{{SCHARTE-BEZUG|}}}|<span title="to"> → </span>{{{SCHARTE-BEZUG}}}}} }}
| prominence_ref =
| listing = {{<includeonly>safesubst:</includeonly>#if:{{{BESONDERHEITEN|}}}|{{{BESONDERHEITEN}}}}}
| range = {{<includeonly>safesubst:</includeonly>#switch: {{{GEBIRGE|}}}
| [[Ammergauer Alpen]] = [[Ammergau Alps]]
| [[Bayerische Voralpen]] = [[Bavarian Prealps]]
| [[Bayerischer Wald]] = [[Bavarian Forest]]
| [[Berchtesgadener Alpen]] = [[Berchtesgaden Alps]]
| [[Böhmerwald]] = [[Bohemian Forest]]
| [[Böhmische Schweiz]] = [[Bohemian Switzerland]]
| [[Brandenberger Alpen]] = [[Brandenberg Alps]]
| [[Chiemgauer Alpen]] = [[Chiemgau Alps]]
| [[Elbsandsteingebirge]] = [[Elbe Sandstone Mountains]]
| [[Erzgebirge]] = [[Ore Mountains]]
| [[Estergebirge]] = [[Ester Mountains]]
| [[Gutensteiner Alpen]] = [[Gutenstein Alps]]
| [[Haardt (Pfälzerwald)|Haardt]] = [[Haardt]]
| [[Harz (Mittelgebirge)|Harz]] = [[Harz Mountains]]
| [[Hornbachkette]], [[Allgäuer Alpen]] = [[Hornbach chain]], [[Allgäu Alps]]
| [[Kaufunger Wald]] = [[Kaufungen Forest]]
| [[Kitzbüheler Alpen]] = [[Kitzbühel Alps]]
| [[Kitzbühler Alpen]] = [[Kitzbühel Alps]]
| [[Lechquellengebirge]] = [[Lechquellen Mountains]]
| [[Lipper Bergland]] = [[Lippe Uplands]]
| [[Mangfallgebirge]] = [[Mangfall Mountains]]
| [[Mangfallgebirge]] ([[Schlierseer Berge]]) = [[Mangfall Mountains]] ([[Schliersee Mountains]])
| [[Oberlausitzer Bergland]] = [[Upper Lusatian Highlands]]
| [[Oberpfälzer Wald]] = [[Upper Palatine Forest]]
| [[Nordpfälzer Bergland]] = [[North Palatine Uplands]]
| [[Pfälzerwald]] = [[Palatine Forest]]
| [[Sächsische Schweiz]] = [[Saxon Switzerland]]
| [[Schlierseer Berge]] = [[Schliersee Mountains]]
| [[Schwäbische Alb]] = [[Swabian Jura]]
| [[Schwarzwald]] = [[Black Forest]]
| [[Sonnjochgruppe]], [[Karwendel]] = [[Sonnjoch Group]], [[Karwendel]]
| [[Tannheimer Berge]], [[Allgäuer Alpen]] = [[Tannheim Mountains]], [[Allgäu Alps]]
| [[Teutoburger Wald]] = [[Teutoburg Forest]]
| [[Thüringer Wald]] = [[Thuringian Forest]]
| [[Tuxer Alpen]] = [[Tux Alps]]
| [[Voralpen]] ([[Bayerische Voralpen]]) = [[Prealps]] ([[Bavarian Prealps]])
| [[Walliser Alpen]] = [[Pennine Alps]]
| [[Weserbergland]] = [[Weser Uplands]]
| [[Wettersteingebirge]] = [[Wetterstein Mountains]]
| [[Wettersteingebirge]], [[Ostalpen]] = [[Wetterstein Mountains]], [[Eastern Alps]]
| [[Zittauer Gebirge]] = [[Zittau Mountains]]
| #default = {{{GEBIRGE|}}}
}}
| parent_peak =
| location = {{<includeonly>safesubst:</includeonly>#switch: {{{LAGE|}}}
| [[Baden-Württemberg]], [[Deutschland]] = [[Baden-Württemberg]], {{GER}}
| [[Bayern]] = [[Bavaria]], {{GER}}
| [[Bayern]], [[Deutschland]] = [[Bavaria]], {{GER}}
| [[Bayern]]/[[Hessen]], [[Deutschland]] = [[Bavaria]]/[[Hesse]], {{GER}}
| Grenze [[Bayern]], [[Deutschland]]/ [[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Bavaria]], {{GER}} / [[Tyrol (state)|Tyrol]], {{AUT}}
| [[Hochsauerland]], [[Nordrhein-Westfalen]] = [[Hochsauerland]], [[North Rhine-Westphalia]], {{GER}}
| [[Italien]] = {{ITA}}
| [[Niederösterreich]] = [[Lower Austria]], {{AUT}}
| [[Niederösterreich]], [[Österreich]] = [[Lower Austria]], {{AUT}}
| [[Niederösterreich]] ([[Österreich]]) = [[Lower Austria]], {{AUT}}
| [[Niedersachsen]], [[Deutschland]] = [[Lower Saxony]], {{GER}}
| [[Nordpfalz]] ([[Rheinland-Pfalz]], [[Deutschland]]) = [[North Palatine]], [[Rhineland-Palatinate]], {{GER}}
| [[Nordrhein-Westfalen]], [[Deutschland]] = [[North Rhine-Westphalia]], {{GER}}
| [[Pfälzerwald]] ([[Rheinland-Pfalz]], [[Deutschland]]) = [[Palatine Forest]], [[Rhineland-Palatinate]], {{GER}}
| [[Rheinland-Pfalz]], [[Deutschland]] = [[Rhineland-Palatinate]], {{GER}}
| [[Rheinland-Pfalz]], ([[Deutschland]]) = [[Rhineland-Palatinate]], {{GER}}
| [[Sauerland]], [[Nordrhein-Westfalen]], [[Deutschland]]= [[Sauerland]], [[North Rhine-Westphalia]], {{GER}}
| [[Sachsen|Freistaat Sachsen]], [[Deutschland]] = [[Saxony]], {{GER}}
| [[Sachsen]], [[Deutschland]] = [[Saxony]], {{GER}}
| [[Sachsen]] ([[Deutschland]]) = [[Saxony]], {{GER}}
| [[Deutschland]], [[Sachsen]] = [[Saxony]], {{GER}}
| [[Sachsen-Anhalt]], [[Deutschland]] = [[Saxony-Anhalt]], {{GER}}
| [[Salzburg (Bundesland)|Salzburg]], [[Österreich]] = [[Salzburg (state)|Salzburg]], {{AUT}}
| [[Steiermark]], [[Österreich]] = [[Styria]], {{AUT}}
| [[Thüringen]], [[Deutschland]] = [[Thuringia]], {{GER}}
| [[Thüringen]] ([[Deutschland]]) = [[Thuringia]], {{GER}}
| [[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Tyrol (state)|Tyrol]], {{AUT}}
| [[Tschechien]] = {{CZE}}
| [[Vorarlberg]], [[Österreich]] = [[Vorarlberg]], [[Austria]]
| #default = {{{LAGE|}}}
}}
| map = {{<includeonly>safesubst:</includeonly>#if:{{{KARTE|}}}
|
|{{<includeonly>safesubst:</includeonly>#if:{{{POSKARTE|}}}
|
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}
|{{<includeonly>safesubst:</includeonly>Infobox Berg/map|{{<includeonly>safesubst:</includeonly>#titleparts:{{{REGION-ISO|}}}|1|1}}}}
}}
}}
}}
}}
| map_image = {{<includeonly>safesubst:</includeonly>#if:{{{KARTE|}}}
|{{{KARTE|}}}
|{{<includeonly>safesubst:</includeonly>#if:{{{POSKARTE|}}}
|{{{POSKARTE|}}}
|{{{ALTERNATIVKARTE|}}}
}}
}}
| map_alt =
| map_caption =
| map_relief =
| map_size =
| label =
| label_position =
| coordinates = {{<includeonly>safesubst:</includeonly>#if: {{{COORD|}}}
|{{{COORD}}}
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>German coord convert|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}|type:mountain{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}|_region:{{{REGION-ISO|}}}}}|format=dms|display=inline,title}}
|{{<includeonly>safesubst:</includeonly>#if:{{{GEO-LAGE|}}}|{{{GEO-LAGE}}}<span style="display:none">[[Template:Coordinate/Wartung/Berg|dep1]]</span>}}
}}
}}
| topo = {{{TOPO-KARTE|}}}
| type = {{<includeonly>safesubst:</includeonly>#switch: {{{TYP|}}}
| Bergrücken = [[ridge]]
| [[Bergrücken]] = [[ridge]]
| Doppelgipfel = double summit
| erloschener [[Vulkan]] = extinct [[volcano]]
| Felsmassiv = rock [[massif]]
| Felsberg = rock summit
| [[Kegelberg]] = cone mountain
| [[Quellkuppe]] = [[cryptodome]]
| [[Schlackenkegel]] = [[cinder cone]]
| [[Tafelberg]] = [[table mountain]]
| [[Vulkan]] = [[volcano]]
| #default = {{{TYP|}}}
}}
| geology = {{<includeonly>safesubst:</includeonly>#switch: {{{GESTEIN|}}}
| [[Basalt]] und [[Tuff]] = [[Basalt]] and [[tuff]]
| [[Buntsandstein]] = [[Bunter Sandstone]]
| [[Dachsteinkalk]] = [[Dachstein limestone]]
| [[Gneis]] = [[Gneiss]]
| [[Granit]] = [[Granite]]
| Granit = [[Granite]]
| [[Hauptdolomit]] = [[main dolomite]]
| Hauptdolomit = [[main dolomite]]
| [[Rhyolith]] = [[Rhyolite]]
| [[Sandstein]] = [[Sandstone]]
| [[Weißer Jura]] = [[White Jurassic]]
| Weißer Jura = [[White Jurassic]]
| [[Wettersteinkalk]] = [[Wetterstein limestone]]
| [[Vorberge (Geomorphologie)|Vorgebirge]] = [[foothills]]
| [[Vulkan]] = [[volcano]]
| #default = {{{GESTEIN|}}}
}}
| volcanic_arc/belt =
| age = {{<includeonly>safesubst:</includeonly>#switch: {{{ALTER|}}}
| variskisch = [[Hercynian]]
| [[Kreide (Geologie)|Kreide]] = [[Cretaceous]]
| [[Trias (Geologie)|Trias]] = [[Triassic]]
| #default = {{{ALTER|}}}
}}
| last_eruption = {{{LETZTE ERUPTION|}}}
| first_ascent = {{{ERSTBESTEIGUNG|}}}
| access = {{{ERSCHLIESSUNG|}}}
| easiest_route = {{{LEICHTESTE ROUTE|}}}
| normal_route = {{{NORMALWEG|}}}
}}<noinclude>
{{Documentation}}
</noinclude>
18wl248w6euy7m95y5vjdyqdyc4lyac
Template:Höhe
10
8951
74816
2025-05-04T18:04:45Z
en>Useddenim
0
English!!
74816
wikitext
text/x-wiki
<includeonly><span style="border-width:0px; padding:0px; margin:0px;" >{{#ifeq: {{formatnum:{{#expr:1*{{{1}}} }} }}|Expression error: Unrecognised punctuation character "."|<!-- generate hidden link--><span style="display:none">[[Template:Höhe/Error in parameter list]]</span>|<!-- nothing, value correct -->}}<!--no leading '-' for negative values, this disrupts the tables-->{{#if: {{{1|}}}
|{{#if: {{{2|}}}
<!-- give height reference -->
|{{#switch: {{uc:{{{2|}}} }}
<!-- Austria normal-orthometric height - 1875 Triest tide gauge; no heights below sea level German: "Meter über Adria" -->
| AT = {{formatnum:{{#expr:1*{{{1}}}<!-- wegen -0 --> }} }} {{#ifeq:{{{link|}}}|true|[[Metres above the Adriatic{{!}}m (AA)]]|m above sea level (AA)}}
<!-- Liechtenstein == Switzerland -->
| LI
<!-- Switzerland levelled height Marseille; no heights below sea level -->
<!-- Cases where 4000<=x<4100 must be specially considered, because the formatting of the HZE places leading zeroes are not given -->
| CH = {{#ifexpr: ({{{1|}}}>=0)
|{{#ifexpr: ({{{1|}}} >= 1000) | {{#expr: (trunc ({{{1|0}}}/1000))}}<!--'-->,{{<!--Fall 4004m!-->#ifexpr: {{{1|}}}mod1000<10|00|{{#ifexpr: {{{1|}}}mod1000<100|0|}} }}|}}{{formatnum:{{#expr:{{{1|}}}mod1000+{{{1|}}}-(trunc ({{{1|0}}}))}} }}<!-- Commanull -->{{#ifexpr: ({{{1|0}}}=trunc ({{{1|0}}})) and (({{{1|0}}}1 round 1)={{{1|0}}})|<!--,-->.0}} {{#ifeq:{{{link|}}}|true|[[Meter über Meer{{!}}<!--m ü. M.-->m above the sea]]|<!--m ü. M.-->m above the sea}}
|{{#ifexpr: ({{{1|}}} <= -1000) | {{#expr: (trunc ({{{1|0}}}/-1000))}}<!--'-->,{{<!--Fall 4044m!-->#ifexpr: -{{{1|}}}mod1000<10|00|{{#ifexpr: -{{{1|}}}mod1000<100|0|}} }}|}}{{formatnum:{{#expr:(trunc ({{{1|0}}}))-{{{1|}}}mod1000-{{{1|}}} }} }}<!-- Commanull -->{{#ifexpr: ({{{1|0}}}=trunc ({{{1|0}}})) and (({{{1|0}}}1 round 1)={{{1|0}}})|<!--,-->.0}} {{#ifeq:{{{link|}}}|true|[[Meter über Meer{{!}}m below Sea]]|m below the sea}}
}}
<!-- the following two entries create Swiss-formatted figures, but no m.ü.M., only m
code identical apart from 2 places, at which the height reference is created. Please keep these invariants -->
<!-- Liechtenstein == Switzerland -->
| LI-M
| CH-M = {{#ifexpr: ({{{1|}}}>=0)
|{{#ifexpr: ({{{1|}}} >= 1000) | {{#expr: (trunc ({{{1|0}}}/1000))}}'{{<!--Fall 4004m!-->#ifexpr: {{{1|}}}mod1000<10|00|{{#ifexpr: {{{1|}}}mod1000<100|0|}} }}|}}{{formatnum:{{#expr:{{{1|}}}mod1000+{{{1|}}}-(trunc ({{{1|0}}}))}} }}<!-- kommanull -->{{#ifexpr: ({{{1|0}}}=trunc ({{{1|0}}})) and (({{{1|0}}}1 round 1)={{{1|0}}})|,0}} {{#ifeq:{{{link|}}}|true|[[Meter über Meer{{!}}m]]|m}}
|{{#ifexpr: ({{{1|}}} <= -1000) | {{#expr: (trunc|{{{1|0}}}/-1000))}}'{{<!--Fall 4044m!-->#ifexpr: -{{{1|}}}mod1000<10|00|{{#ifexpr: -{{{1|}}}mod1000<100|0|}} }}|}}{{formatnum:{{#expr:(trunc ({{{1|0}}}))-{{{1|}}}mod1000-{{{1|}}} }} }}<!-- kommanull -->{{#ifexpr: ({{{1|0}}}=trunc ({{{1|0}}})) and (({{{1|0}}}1 round 1)={{{1|0}}})|,0}} {{#ifeq:{{{link|}}}|true|[[Meter über Meer{{!}}m]]|m}}
}}
<!-- Germany, unspecified height system -->
| DE =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Height above sea level{{!}}m above sea level]]|m}}
|{{formatnum:{{#expr:-1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Height above sea level{{!}}m below sea level]]|m below sea level}}
}}
<!-- DHHN12 normal-orthometric height Amsterdam aka Normal-Null or Normaal Amsterdams Peil (Amsterdam tide gauge - European standard). Superseded in Germany by NHN (see below) -->
| DE-NN =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} m above
|{{formatnum:{{#expr:-1*{{{1}}} }} }} m below
}} {{#ifeq:{{{link|}}}|true|[[Normalnull{{!}}sea level (NN)]]|NN}}
<!-- DDR (SNN76) Normalhöhe Kronstadt tide gauge (used in East Germany) -->
| DE-HN =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} m above
|{{formatnum:{{#expr:-1*{{{1}}} }} }} m below
}} {{#ifeq:{{{link|}}}|true|[[Höhennormal{{!}}sea level (HN)]]|HN}}
<!-- DHHN92 Normal height Amsterdam tide gauge (European standard) -->
| DE-NHN =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} m above
|{{formatnum:{{#expr:-1*{{{1}}} }} }} m below
}} {{#ifeq:{{{link|}}}|true|[[Normalhöhennull{{!}}sea level (NHN)]]|NHN}}
<!-- Slovakia Normal height; no heights below sea level -->
| SK = <span title="metrov nad morom">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m n.m.]]|m n.m.}}</span>
<!-- Czech Republic Normal height Kronstadt; no heights below sea level -->
| CZ = <span title="metrů nad mořem">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m n.m.]]|m n.m.}}</span>
<!-- Hungary Normal height Kronstadt; No heights below sea level -->
| HU = <span title="Tengerszint feletti magasság">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel (Ungarn){{!}}m]]|m}}</span>
<!-- === NO DISTINCTION OF NEGATIVE HEIGHTS FOR THE FOLLOWING ISO CODES, AS THERE IS NO LABELLING FOR THEM === -->
<!-- France (without overseas) Normal height Marseille; -->
<!-- French-Guayana GF
French Polynesia PF
French Southern and Antarctic Territories TF -->
| FR|FX = <span title="Metres of altitude">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}</span>
<!-- Italy Orthometric height Genoa -->
| IT = <span title="Metres above sea level">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m s.l.m.]]|m s.l.m.}}</span>
<!-- Croatia Normal-orthometric height Trieste 1900 -->
| HR = <span title="Nadmorska visina">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m/nv]]|m/nv}}</span>
<!-- Netherlands Orthometric height Amsterdam -->
| NL = {{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}
<!-- Norwegian Normal-orthometric height Tredge -->
| NO = <span title="meter over havet">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}moh.]]|moh.}}</span>
<!-- Poland Normal height Kronstadt -->
| PL = <span title="metry nad poziomem morza">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m n.p.m.]]|m n.p.m.}}</span>
<!-- Slovenia Normal-orthometric height Trieste 1900 -->
| SI = {{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}
<!-- Sweden Normal height Amsterdam -->
| SE = <span title="Meter over havet">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m ö.h.]]|m ö.h.}}</span>
<!-- Spain Orthometric height Alicante -->
| ES = <span title="Meters above sea level">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}msnm]]|msnm}}</span>
<!-- All ISO 3166-1 codes, as not defined above. Interim solution until we know better -->
|AF <!-- AFGHANISTAN -->
|AX <!-- ALAND ISLANDS -->
|AL <!-- ALBANIA -->
|DZ <!-- ALGERIA -->
|AS <!-- AMERICAN SAMOA -->
|AD <!-- ANDORRA -->
|AO <!-- ANGOLA -->
|AI <!-- ANGUILLA -->
|AQ <!-- ANTARCTICA -->
|AG <!-- ANTIGUA AND BARBUDA -->
|AR <!-- ARGENTINA -->
|AM <!-- ARMENIA -->
|AW <!-- ARUBA -->
|AU <!-- AUSTRALIA -->
|AZ <!-- AZERBAIJAN -->
|BS <!-- BAHAMAS -->
|BH <!-- BAHRAIN -->
|BD <!-- BANGLADESH -->
|BB <!-- BARBADOS -->
|BY <!-- BELARUS -->
|BE <!-- BELGIUM -->
|BZ <!-- BELIZE -->
|BJ <!-- BENIN -->
|BM <!-- BERMUDA -->
|BT <!-- BHUTAN -->
|BO <!-- BOLIVIA -->
|BA <!-- BOSNIA AND HERZEGOVINA -->
|BW <!-- BOTSWANA -->
|BV <!-- BOUVET ISLAND -->
|BR <!-- BRAZIL -->
|IO <!-- BRITISH INDIAN OCEAN TERRITORY -->
|BN <!-- BRUNEI DARUSSALAM -->
|BG <!-- BULGARIA -->
|BF <!-- BURKINA FASO -->
|BI <!-- BURUNDI -->
|KH <!-- CAMBODIA -->
|CM <!-- CAMEROON -->
|CA <!-- CANADA -->
|CV <!-- CAPE VERDE -->
|KY <!-- CAYMAN ISLANDS -->
|CF <!-- CENTRAL AFRICAN REPUBLIC -->
|TD <!-- CHAD -->
|CL <!-- CHILE -->
|CN <!-- CHINA -->
|CX <!-- CHRISTMAS ISLAND -->
|CC <!-- COCOS (KEELING) ISLANDS -->
|CO <!-- COLOMBIA -->
|KM <!-- COMOROS -->
|CG <!-- CONGO -->
|CD <!-- CONGO, THE DEMOCRATIC REPUBLIC OF THE -->
|CK <!-- COOK ISLANDS -->
|CR <!-- COSTA RICA -->
|CI <!-- COTE D'IVOIRE -->
|CU <!-- CUBA -->
|CY <!-- CYPRUS -->
|DK <!-- DENMARK -->
|DJ <!-- DJIBOUTI -->
|DM <!-- DOMINICA -->
|DO <!-- DOMINICAN REPUBLIC -->
|EC <!-- ECUADOR -->
|EG <!-- EGYPT -->
|SV <!-- EL SALVADOR -->
|GQ <!-- EQUATORIAL GUINEA -->
|ER <!-- ERITREA -->
|EE <!-- ESTONIA -->
|ET <!-- ETHIOPIA -->
|FK <!-- FALKLAND ISLANDS (MALVINAS) -->
|FO <!-- FAROE ISLANDS -->
|FJ <!-- FIJI -->
|FI <!-- FINLAND -->
|GF <!-- FRENCH GUIANA -->
|PF <!-- FRENCH POLYNESIA -->
|TF <!-- FRENCH SOUTHERN TERRITORIES -->
|GA <!-- GABON -->
|GM <!-- GAMBIA -->
|GE <!-- GEORGIA -->
|GH <!-- GHANA -->
|GI <!-- GIBRALTAR -->
|GR <!-- GREECE -->
|GL <!-- GREENLAND -->
|GD <!-- GRENADA -->
|GP <!-- GUADELOUPE -->
|GU <!-- GUAM -->
|GT <!-- GUATEMALA -->
|GG <!-- GUERNSEY -->
|GN <!-- GUINEA -->
|GW <!-- GUINEA-BISSAU -->
|GY <!-- GUYANA -->
|HT <!-- HAITI -->
|HM <!-- HEARD ISLAND AND MCDONALD ISLANDS -->
|VA <!-- HOLY SEE (VATICAN CITY STATE) -->
|HN <!-- HONDURAS -->
|HK <!-- HONG KONG -->
|IS <!-- ICELAND -->
|IN <!-- INDIA -->
|ID <!-- INDONESIA -->
|IR <!-- IRAN, ISLAMIC REPUBLIC OF -->
|IQ <!-- IRAQ -->
|IE <!-- IRELAND -->
|IM <!-- ISLE OF MAN -->
|IL <!-- ISRAEL -->
|JM <!-- JAMAICA -->
|JP <!-- JAPAN -->
|JE <!-- JERSEY -->
|JO <!-- JORDAN -->
|KZ <!-- KAZAKHSTAN -->
|KE <!-- KENYA -->
|KI <!-- KIRIBATI -->
|KP <!-- KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF -->
|KR <!-- KOREA, REPUBLIC OF -->
|KW <!-- KUWAIT -->
|KG <!-- KYRGYZSTAN -->
|LA <!-- LAO PEOPLE'S DEMOCRATIC REPUBLIC -->
|LV <!-- LATVIA -->
|LB <!-- LEBANON -->
|LS <!-- LESOTHO -->
|LR <!-- LIBERIA -->
|LY <!-- LIBYAN ARAB JAMAHIRIYA -->
|LT <!-- LITHUANIA -->
|LU <!-- LUXEMBOURG -->
|MO <!-- MACAO -->
|MK <!-- MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF -->
|MG <!-- MADAGASCAR -->
|MW <!-- MALAWI -->
|MY <!-- MALAYSIA -->
|MV <!-- MALDIVES -->
|ML <!-- MALI -->
|MT <!-- MALTA -->
|MH <!-- MARSHALL ISLANDS -->
|MQ <!-- MARTINIQUE -->
|MR <!-- MAURITANIA -->
|MU <!-- MAURITIUS -->
|YT <!-- MAYOTTE -->
|MX <!-- MEXICO -->
|FM <!-- MICRONESIA, FEDERATED STATES OF -->
|MD <!-- MOLDOVA, REPUBLIC OF -->
|MC <!-- MONACO -->
|MN <!-- MONGOLIA -->
|ME <!-- MONTENEGRO -->
|MS <!-- MONTSERRAT -->
|MA <!-- MOROCCO -->
|MZ <!-- MOZAMBIQUE -->
|MM <!-- MYANMAR -->
|NA <!-- NAMIBIA -->
|NR <!-- NAURU -->
|NP <!-- NEPAL -->
|AN <!-- NETHERLANDS ANTILLES -->
|NC <!-- NEW CALEDONIA -->
|NZ <!-- NEW ZEALAND -->
|NI <!-- NICARAGUA -->
|NE <!-- NIGER -->
|NG <!-- NIGERIA -->
|NU <!-- NIUE -->
|NF <!-- NORFOLK ISLAND -->
|MP <!-- NORTHERN MARIANA ISLANDS -->
|OM <!-- OMAN -->
|PK <!-- PAKISTAN -->
|PW <!-- PALAU -->
|PS <!-- PALESTINIAN TERRITORY, OCCUPIED -->
|PA <!-- PANAMA -->
|PG <!-- PAPUA NEW GUINEA -->
|PY <!-- PARAGUAY -->
|PE <!-- PERU -->
|PH <!-- PHILIPPINES -->
|PN <!-- PITCAIRN -->
|PT <!-- PORTUGAL -->
|PR <!-- PUERTO RICO -->
|QA <!-- QATAR -->
|RE <!-- REUNION -->
|RO <!-- ROMANIA -->
|RU <!-- RUSSIAN FEDERATION -->
|RW <!-- RWANDA -->
|SH <!-- SAINT HELENA -->
|KN <!-- SAINT KITTS AND NEVIS -->
|LC <!-- SAINT LUCIA -->
|PM <!-- SAINT PIERRE AND MIQUELON -->
|VC <!-- SAINT VINCENT AND THE GRENADINES -->
|WS <!-- SAMOA -->
|SM <!-- SAN MARINO -->
|ST <!-- SAO TOME AND PRINCIPE -->
|SA <!-- SAUDI ARABIA -->
|SN <!-- SENEGAL -->
|RS <!-- SERBIA -->
|SC <!-- SEYCHELLES -->
|SL <!-- SIERRA LEONE -->
|SG <!-- SINGAPORE -->
|SB <!-- SOLOMON ISLANDS -->
|SO <!-- SOMALIA -->
|ZA <!-- SOUTH AFRICA -->
|GS <!-- SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS -->
|LK <!-- SRI LANKA -->
|SD <!-- SUDAN -->
|SR <!-- SURINAME -->
|SJ <!-- SVALBARD AND JAN MAYEN -->
|SZ <!-- SWAZILAND -->
|SY <!-- SYRIAN ARAB REPUBLIC -->
|TW <!-- TAIWAN, PROVINCE OF CHINA -->
|TJ <!-- TAJIKISTAN -->
|TZ <!-- TANZANIA, UNITED REPUBLIC OF -->
|TH <!-- THAILAND -->
|TL <!-- TIMOR-LESTE -->
|TG <!-- TOGO -->
|TK <!-- TOKELAU -->
|TO <!-- TONGA -->
|TT <!-- TRINIDAD AND TOBAGO -->
|TN <!-- TUNISIA -->
|TR <!-- TURKEY -->
|TM <!-- TURKMENISTAN -->
|TC <!-- TURKS AND CAICOS ISLANDS -->
|TV <!-- TUVALU -->
|UG <!-- UGANDA -->
|UA <!-- UKRAINE -->
|AE <!-- UNITED ARAB EMIRATES -->
|GB <!-- UNITED KINGDOM -->
|US <!-- UNITED STATES -->
|UM <!-- UNITED STATES MINOR OUTLYING ISLANDS -->
|UY <!-- URUGUAY -->
|UZ <!-- UZBEKISTAN -->
|VU <!-- VANUATU -->
|VE <!-- VENEZUELA -->
|VN <!-- VIET NAM -->
|VG <!-- VIRGIN ISLANDS, BRITISH -->
|VI <!-- VIRGIN ISLANDS, U.S. -->
|WF <!-- WALLIS AND FUTUNA -->
|EH <!-- WESTERN SAHARA -->
|YE <!-- YEMEN -->
|ZM <!-- ZAMBIA -->
|ZW <!-- ZIMBABWE -->
=
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}
|{{formatnum:{{#expr:-1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m unter dem Meeresspiegel]]|m unter dem Meeresspiegel}}
}}
<!-- Our 8 planets, above uc: !! -->
|MERCURY| VENUS| EARTH| MARS| JUPITER| SATURN| URANUS| NEPTUNE =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} m ü.
|{{formatnum:{{#expr:-1*{{{1}}} }} }} m unter
}} {{#ifeq:{{{link|}}}|true|[[Nullniveau]]|Nullniveau}}
<!-- False indication of m or metre is ignored and treated as if no indication -->
|M
|METER =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Height above sea level{{!}}m]]|m}}
|{{formatnum:{{#expr:-1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Height above sea level{{!}}m below sea level]]|m below sea level}}
}}
| #default = {{formatnum:{{#expr:1*{{{1}}}}}}} {{{2|}}} <!-- here generally no link --><span style="display:none">[[Template:Höhe/unknown reference]]</span>
}}
<!-- no height reference given, implementation identical with M|METER above!-->
|{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}
|{{formatnum:{{#expr:-1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m unter dem Meeresspiegel]]|m unter dem Meeresspiegel}}
}}
}}
| <b class="hintergrundfarbe8">Height missing, see [[Template:Höhe|template documentation]]</b><!-- create hidden link --><span style="display:none">[[Template:Höhe/Erro in parameter list]]</span>
}}</span></includeonly><noinclude>{{Documentation}}</noinclude>
czwye1hvzgmb66x9su9767lh804ycul
74817
74816
2026-08-24T00:16:59Z
Robertsky
10424
1 versaun husi [[:en:Template:Höhe]]
74816
wikitext
text/x-wiki
<includeonly><span style="border-width:0px; padding:0px; margin:0px;" >{{#ifeq: {{formatnum:{{#expr:1*{{{1}}} }} }}|Expression error: Unrecognised punctuation character "."|<!-- generate hidden link--><span style="display:none">[[Template:Höhe/Error in parameter list]]</span>|<!-- nothing, value correct -->}}<!--no leading '-' for negative values, this disrupts the tables-->{{#if: {{{1|}}}
|{{#if: {{{2|}}}
<!-- give height reference -->
|{{#switch: {{uc:{{{2|}}} }}
<!-- Austria normal-orthometric height - 1875 Triest tide gauge; no heights below sea level German: "Meter über Adria" -->
| AT = {{formatnum:{{#expr:1*{{{1}}}<!-- wegen -0 --> }} }} {{#ifeq:{{{link|}}}|true|[[Metres above the Adriatic{{!}}m (AA)]]|m above sea level (AA)}}
<!-- Liechtenstein == Switzerland -->
| LI
<!-- Switzerland levelled height Marseille; no heights below sea level -->
<!-- Cases where 4000<=x<4100 must be specially considered, because the formatting of the HZE places leading zeroes are not given -->
| CH = {{#ifexpr: ({{{1|}}}>=0)
|{{#ifexpr: ({{{1|}}} >= 1000) | {{#expr: (trunc ({{{1|0}}}/1000))}}<!--'-->,{{<!--Fall 4004m!-->#ifexpr: {{{1|}}}mod1000<10|00|{{#ifexpr: {{{1|}}}mod1000<100|0|}} }}|}}{{formatnum:{{#expr:{{{1|}}}mod1000+{{{1|}}}-(trunc ({{{1|0}}}))}} }}<!-- Commanull -->{{#ifexpr: ({{{1|0}}}=trunc ({{{1|0}}})) and (({{{1|0}}}1 round 1)={{{1|0}}})|<!--,-->.0}} {{#ifeq:{{{link|}}}|true|[[Meter über Meer{{!}}<!--m ü. M.-->m above the sea]]|<!--m ü. M.-->m above the sea}}
|{{#ifexpr: ({{{1|}}} <= -1000) | {{#expr: (trunc ({{{1|0}}}/-1000))}}<!--'-->,{{<!--Fall 4044m!-->#ifexpr: -{{{1|}}}mod1000<10|00|{{#ifexpr: -{{{1|}}}mod1000<100|0|}} }}|}}{{formatnum:{{#expr:(trunc ({{{1|0}}}))-{{{1|}}}mod1000-{{{1|}}} }} }}<!-- Commanull -->{{#ifexpr: ({{{1|0}}}=trunc ({{{1|0}}})) and (({{{1|0}}}1 round 1)={{{1|0}}})|<!--,-->.0}} {{#ifeq:{{{link|}}}|true|[[Meter über Meer{{!}}m below Sea]]|m below the sea}}
}}
<!-- the following two entries create Swiss-formatted figures, but no m.ü.M., only m
code identical apart from 2 places, at which the height reference is created. Please keep these invariants -->
<!-- Liechtenstein == Switzerland -->
| LI-M
| CH-M = {{#ifexpr: ({{{1|}}}>=0)
|{{#ifexpr: ({{{1|}}} >= 1000) | {{#expr: (trunc ({{{1|0}}}/1000))}}'{{<!--Fall 4004m!-->#ifexpr: {{{1|}}}mod1000<10|00|{{#ifexpr: {{{1|}}}mod1000<100|0|}} }}|}}{{formatnum:{{#expr:{{{1|}}}mod1000+{{{1|}}}-(trunc ({{{1|0}}}))}} }}<!-- kommanull -->{{#ifexpr: ({{{1|0}}}=trunc ({{{1|0}}})) and (({{{1|0}}}1 round 1)={{{1|0}}})|,0}} {{#ifeq:{{{link|}}}|true|[[Meter über Meer{{!}}m]]|m}}
|{{#ifexpr: ({{{1|}}} <= -1000) | {{#expr: (trunc|{{{1|0}}}/-1000))}}'{{<!--Fall 4044m!-->#ifexpr: -{{{1|}}}mod1000<10|00|{{#ifexpr: -{{{1|}}}mod1000<100|0|}} }}|}}{{formatnum:{{#expr:(trunc ({{{1|0}}}))-{{{1|}}}mod1000-{{{1|}}} }} }}<!-- kommanull -->{{#ifexpr: ({{{1|0}}}=trunc ({{{1|0}}})) and (({{{1|0}}}1 round 1)={{{1|0}}})|,0}} {{#ifeq:{{{link|}}}|true|[[Meter über Meer{{!}}m]]|m}}
}}
<!-- Germany, unspecified height system -->
| DE =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Height above sea level{{!}}m above sea level]]|m}}
|{{formatnum:{{#expr:-1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Height above sea level{{!}}m below sea level]]|m below sea level}}
}}
<!-- DHHN12 normal-orthometric height Amsterdam aka Normal-Null or Normaal Amsterdams Peil (Amsterdam tide gauge - European standard). Superseded in Germany by NHN (see below) -->
| DE-NN =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} m above
|{{formatnum:{{#expr:-1*{{{1}}} }} }} m below
}} {{#ifeq:{{{link|}}}|true|[[Normalnull{{!}}sea level (NN)]]|NN}}
<!-- DDR (SNN76) Normalhöhe Kronstadt tide gauge (used in East Germany) -->
| DE-HN =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} m above
|{{formatnum:{{#expr:-1*{{{1}}} }} }} m below
}} {{#ifeq:{{{link|}}}|true|[[Höhennormal{{!}}sea level (HN)]]|HN}}
<!-- DHHN92 Normal height Amsterdam tide gauge (European standard) -->
| DE-NHN =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} m above
|{{formatnum:{{#expr:-1*{{{1}}} }} }} m below
}} {{#ifeq:{{{link|}}}|true|[[Normalhöhennull{{!}}sea level (NHN)]]|NHN}}
<!-- Slovakia Normal height; no heights below sea level -->
| SK = <span title="metrov nad morom">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m n.m.]]|m n.m.}}</span>
<!-- Czech Republic Normal height Kronstadt; no heights below sea level -->
| CZ = <span title="metrů nad mořem">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m n.m.]]|m n.m.}}</span>
<!-- Hungary Normal height Kronstadt; No heights below sea level -->
| HU = <span title="Tengerszint feletti magasság">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel (Ungarn){{!}}m]]|m}}</span>
<!-- === NO DISTINCTION OF NEGATIVE HEIGHTS FOR THE FOLLOWING ISO CODES, AS THERE IS NO LABELLING FOR THEM === -->
<!-- France (without overseas) Normal height Marseille; -->
<!-- French-Guayana GF
French Polynesia PF
French Southern and Antarctic Territories TF -->
| FR|FX = <span title="Metres of altitude">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}</span>
<!-- Italy Orthometric height Genoa -->
| IT = <span title="Metres above sea level">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m s.l.m.]]|m s.l.m.}}</span>
<!-- Croatia Normal-orthometric height Trieste 1900 -->
| HR = <span title="Nadmorska visina">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m/nv]]|m/nv}}</span>
<!-- Netherlands Orthometric height Amsterdam -->
| NL = {{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}
<!-- Norwegian Normal-orthometric height Tredge -->
| NO = <span title="meter over havet">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}moh.]]|moh.}}</span>
<!-- Poland Normal height Kronstadt -->
| PL = <span title="metry nad poziomem morza">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m n.p.m.]]|m n.p.m.}}</span>
<!-- Slovenia Normal-orthometric height Trieste 1900 -->
| SI = {{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}
<!-- Sweden Normal height Amsterdam -->
| SE = <span title="Meter over havet">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m ö.h.]]|m ö.h.}}</span>
<!-- Spain Orthometric height Alicante -->
| ES = <span title="Meters above sea level">{{formatnum:{{#expr:1*{{{1}}}}}}} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}msnm]]|msnm}}</span>
<!-- All ISO 3166-1 codes, as not defined above. Interim solution until we know better -->
|AF <!-- AFGHANISTAN -->
|AX <!-- ALAND ISLANDS -->
|AL <!-- ALBANIA -->
|DZ <!-- ALGERIA -->
|AS <!-- AMERICAN SAMOA -->
|AD <!-- ANDORRA -->
|AO <!-- ANGOLA -->
|AI <!-- ANGUILLA -->
|AQ <!-- ANTARCTICA -->
|AG <!-- ANTIGUA AND BARBUDA -->
|AR <!-- ARGENTINA -->
|AM <!-- ARMENIA -->
|AW <!-- ARUBA -->
|AU <!-- AUSTRALIA -->
|AZ <!-- AZERBAIJAN -->
|BS <!-- BAHAMAS -->
|BH <!-- BAHRAIN -->
|BD <!-- BANGLADESH -->
|BB <!-- BARBADOS -->
|BY <!-- BELARUS -->
|BE <!-- BELGIUM -->
|BZ <!-- BELIZE -->
|BJ <!-- BENIN -->
|BM <!-- BERMUDA -->
|BT <!-- BHUTAN -->
|BO <!-- BOLIVIA -->
|BA <!-- BOSNIA AND HERZEGOVINA -->
|BW <!-- BOTSWANA -->
|BV <!-- BOUVET ISLAND -->
|BR <!-- BRAZIL -->
|IO <!-- BRITISH INDIAN OCEAN TERRITORY -->
|BN <!-- BRUNEI DARUSSALAM -->
|BG <!-- BULGARIA -->
|BF <!-- BURKINA FASO -->
|BI <!-- BURUNDI -->
|KH <!-- CAMBODIA -->
|CM <!-- CAMEROON -->
|CA <!-- CANADA -->
|CV <!-- CAPE VERDE -->
|KY <!-- CAYMAN ISLANDS -->
|CF <!-- CENTRAL AFRICAN REPUBLIC -->
|TD <!-- CHAD -->
|CL <!-- CHILE -->
|CN <!-- CHINA -->
|CX <!-- CHRISTMAS ISLAND -->
|CC <!-- COCOS (KEELING) ISLANDS -->
|CO <!-- COLOMBIA -->
|KM <!-- COMOROS -->
|CG <!-- CONGO -->
|CD <!-- CONGO, THE DEMOCRATIC REPUBLIC OF THE -->
|CK <!-- COOK ISLANDS -->
|CR <!-- COSTA RICA -->
|CI <!-- COTE D'IVOIRE -->
|CU <!-- CUBA -->
|CY <!-- CYPRUS -->
|DK <!-- DENMARK -->
|DJ <!-- DJIBOUTI -->
|DM <!-- DOMINICA -->
|DO <!-- DOMINICAN REPUBLIC -->
|EC <!-- ECUADOR -->
|EG <!-- EGYPT -->
|SV <!-- EL SALVADOR -->
|GQ <!-- EQUATORIAL GUINEA -->
|ER <!-- ERITREA -->
|EE <!-- ESTONIA -->
|ET <!-- ETHIOPIA -->
|FK <!-- FALKLAND ISLANDS (MALVINAS) -->
|FO <!-- FAROE ISLANDS -->
|FJ <!-- FIJI -->
|FI <!-- FINLAND -->
|GF <!-- FRENCH GUIANA -->
|PF <!-- FRENCH POLYNESIA -->
|TF <!-- FRENCH SOUTHERN TERRITORIES -->
|GA <!-- GABON -->
|GM <!-- GAMBIA -->
|GE <!-- GEORGIA -->
|GH <!-- GHANA -->
|GI <!-- GIBRALTAR -->
|GR <!-- GREECE -->
|GL <!-- GREENLAND -->
|GD <!-- GRENADA -->
|GP <!-- GUADELOUPE -->
|GU <!-- GUAM -->
|GT <!-- GUATEMALA -->
|GG <!-- GUERNSEY -->
|GN <!-- GUINEA -->
|GW <!-- GUINEA-BISSAU -->
|GY <!-- GUYANA -->
|HT <!-- HAITI -->
|HM <!-- HEARD ISLAND AND MCDONALD ISLANDS -->
|VA <!-- HOLY SEE (VATICAN CITY STATE) -->
|HN <!-- HONDURAS -->
|HK <!-- HONG KONG -->
|IS <!-- ICELAND -->
|IN <!-- INDIA -->
|ID <!-- INDONESIA -->
|IR <!-- IRAN, ISLAMIC REPUBLIC OF -->
|IQ <!-- IRAQ -->
|IE <!-- IRELAND -->
|IM <!-- ISLE OF MAN -->
|IL <!-- ISRAEL -->
|JM <!-- JAMAICA -->
|JP <!-- JAPAN -->
|JE <!-- JERSEY -->
|JO <!-- JORDAN -->
|KZ <!-- KAZAKHSTAN -->
|KE <!-- KENYA -->
|KI <!-- KIRIBATI -->
|KP <!-- KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF -->
|KR <!-- KOREA, REPUBLIC OF -->
|KW <!-- KUWAIT -->
|KG <!-- KYRGYZSTAN -->
|LA <!-- LAO PEOPLE'S DEMOCRATIC REPUBLIC -->
|LV <!-- LATVIA -->
|LB <!-- LEBANON -->
|LS <!-- LESOTHO -->
|LR <!-- LIBERIA -->
|LY <!-- LIBYAN ARAB JAMAHIRIYA -->
|LT <!-- LITHUANIA -->
|LU <!-- LUXEMBOURG -->
|MO <!-- MACAO -->
|MK <!-- MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF -->
|MG <!-- MADAGASCAR -->
|MW <!-- MALAWI -->
|MY <!-- MALAYSIA -->
|MV <!-- MALDIVES -->
|ML <!-- MALI -->
|MT <!-- MALTA -->
|MH <!-- MARSHALL ISLANDS -->
|MQ <!-- MARTINIQUE -->
|MR <!-- MAURITANIA -->
|MU <!-- MAURITIUS -->
|YT <!-- MAYOTTE -->
|MX <!-- MEXICO -->
|FM <!-- MICRONESIA, FEDERATED STATES OF -->
|MD <!-- MOLDOVA, REPUBLIC OF -->
|MC <!-- MONACO -->
|MN <!-- MONGOLIA -->
|ME <!-- MONTENEGRO -->
|MS <!-- MONTSERRAT -->
|MA <!-- MOROCCO -->
|MZ <!-- MOZAMBIQUE -->
|MM <!-- MYANMAR -->
|NA <!-- NAMIBIA -->
|NR <!-- NAURU -->
|NP <!-- NEPAL -->
|AN <!-- NETHERLANDS ANTILLES -->
|NC <!-- NEW CALEDONIA -->
|NZ <!-- NEW ZEALAND -->
|NI <!-- NICARAGUA -->
|NE <!-- NIGER -->
|NG <!-- NIGERIA -->
|NU <!-- NIUE -->
|NF <!-- NORFOLK ISLAND -->
|MP <!-- NORTHERN MARIANA ISLANDS -->
|OM <!-- OMAN -->
|PK <!-- PAKISTAN -->
|PW <!-- PALAU -->
|PS <!-- PALESTINIAN TERRITORY, OCCUPIED -->
|PA <!-- PANAMA -->
|PG <!-- PAPUA NEW GUINEA -->
|PY <!-- PARAGUAY -->
|PE <!-- PERU -->
|PH <!-- PHILIPPINES -->
|PN <!-- PITCAIRN -->
|PT <!-- PORTUGAL -->
|PR <!-- PUERTO RICO -->
|QA <!-- QATAR -->
|RE <!-- REUNION -->
|RO <!-- ROMANIA -->
|RU <!-- RUSSIAN FEDERATION -->
|RW <!-- RWANDA -->
|SH <!-- SAINT HELENA -->
|KN <!-- SAINT KITTS AND NEVIS -->
|LC <!-- SAINT LUCIA -->
|PM <!-- SAINT PIERRE AND MIQUELON -->
|VC <!-- SAINT VINCENT AND THE GRENADINES -->
|WS <!-- SAMOA -->
|SM <!-- SAN MARINO -->
|ST <!-- SAO TOME AND PRINCIPE -->
|SA <!-- SAUDI ARABIA -->
|SN <!-- SENEGAL -->
|RS <!-- SERBIA -->
|SC <!-- SEYCHELLES -->
|SL <!-- SIERRA LEONE -->
|SG <!-- SINGAPORE -->
|SB <!-- SOLOMON ISLANDS -->
|SO <!-- SOMALIA -->
|ZA <!-- SOUTH AFRICA -->
|GS <!-- SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS -->
|LK <!-- SRI LANKA -->
|SD <!-- SUDAN -->
|SR <!-- SURINAME -->
|SJ <!-- SVALBARD AND JAN MAYEN -->
|SZ <!-- SWAZILAND -->
|SY <!-- SYRIAN ARAB REPUBLIC -->
|TW <!-- TAIWAN, PROVINCE OF CHINA -->
|TJ <!-- TAJIKISTAN -->
|TZ <!-- TANZANIA, UNITED REPUBLIC OF -->
|TH <!-- THAILAND -->
|TL <!-- TIMOR-LESTE -->
|TG <!-- TOGO -->
|TK <!-- TOKELAU -->
|TO <!-- TONGA -->
|TT <!-- TRINIDAD AND TOBAGO -->
|TN <!-- TUNISIA -->
|TR <!-- TURKEY -->
|TM <!-- TURKMENISTAN -->
|TC <!-- TURKS AND CAICOS ISLANDS -->
|TV <!-- TUVALU -->
|UG <!-- UGANDA -->
|UA <!-- UKRAINE -->
|AE <!-- UNITED ARAB EMIRATES -->
|GB <!-- UNITED KINGDOM -->
|US <!-- UNITED STATES -->
|UM <!-- UNITED STATES MINOR OUTLYING ISLANDS -->
|UY <!-- URUGUAY -->
|UZ <!-- UZBEKISTAN -->
|VU <!-- VANUATU -->
|VE <!-- VENEZUELA -->
|VN <!-- VIET NAM -->
|VG <!-- VIRGIN ISLANDS, BRITISH -->
|VI <!-- VIRGIN ISLANDS, U.S. -->
|WF <!-- WALLIS AND FUTUNA -->
|EH <!-- WESTERN SAHARA -->
|YE <!-- YEMEN -->
|ZM <!-- ZAMBIA -->
|ZW <!-- ZIMBABWE -->
=
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}
|{{formatnum:{{#expr:-1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m unter dem Meeresspiegel]]|m unter dem Meeresspiegel}}
}}
<!-- Our 8 planets, above uc: !! -->
|MERCURY| VENUS| EARTH| MARS| JUPITER| SATURN| URANUS| NEPTUNE =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} m ü.
|{{formatnum:{{#expr:-1*{{{1}}} }} }} m unter
}} {{#ifeq:{{{link|}}}|true|[[Nullniveau]]|Nullniveau}}
<!-- False indication of m or metre is ignored and treated as if no indication -->
|M
|METER =
{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Height above sea level{{!}}m]]|m}}
|{{formatnum:{{#expr:-1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Height above sea level{{!}}m below sea level]]|m below sea level}}
}}
| #default = {{formatnum:{{#expr:1*{{{1}}}}}}} {{{2|}}} <!-- here generally no link --><span style="display:none">[[Template:Höhe/unknown reference]]</span>
}}
<!-- no height reference given, implementation identical with M|METER above!-->
|{{#ifexpr: ({{{1|}}}>=0)
|{{formatnum:{{#expr:+1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m]]|m}}
|{{formatnum:{{#expr:-1*{{{1}}} }} }} {{#ifeq:{{{link|}}}|true|[[Höhe über dem Meeresspiegel{{!}}m unter dem Meeresspiegel]]|m unter dem Meeresspiegel}}
}}
}}
| <b class="hintergrundfarbe8">Height missing, see [[Template:Höhe|template documentation]]</b><!-- create hidden link --><span style="display:none">[[Template:Höhe/Erro in parameter list]]</span>
}}</span></includeonly><noinclude>{{Documentation}}</noinclude>
czwye1hvzgmb66x9su9767lh804ycul
Template:Substituted
10
8952
74818
2022-06-29T03:52:53Z
en>Wbm1058
0
removing over-categorization (via [[WP:JWB]])
74818
wikitext
text/x-wiki
#REDIRECT [[Template:Always substitute]]
{{Redirect category shell|
{{R from merge}}
{{R from related word}}
}}
geyha6cb1eowaozuvu6fi4fuci26w5m
74819
74818
2026-08-24T00:17:00Z
Robertsky
10424
1 versaun husi [[:en:Template:Substituted]]
74818
wikitext
text/x-wiki
#REDIRECT [[Template:Always substitute]]
{{Redirect category shell|
{{R from merge}}
{{R from related word}}
}}
geyha6cb1eowaozuvu6fi4fuci26w5m
Template:Infobox mountain/Berg/doc
10
8953
74820
2025-10-05T01:35:40Z
en>Jonesey95
0
fix text color in dark mode; this generally works but may cause problems, in which case revert or try specifying a different CSS value
74820
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{substituted|auto=yes}}
== Usage ==
This template enables data on mountains imported from German Wikipedia (using [[:de:Vorlage:Infobox Berg]]) to be translated and displayed in English Wikipedia. This saves the enormous amount of work otherwise entailed in translating parameters and data into en.wiki templates. Some of this translation involves technical terms that may not be obvious to some translators. In addition, en.wiki templates are not capable of displaying all the information provided here.
The template is available for the hundreds of articles on German, Austrian and Swiss mountains being translated into English Wikipedia that will be able to take full advantage of its features.
When translating an article from German Wikipedia, just import the infobox and translate any free text. It is worth previewing the result first as data in several parameters will be automatically translated if recognised; otherwise it defaults to the entered text. This feature is being enhanced continually. Blank parameters are ignored. The parameter text is shown below; their use is explained in the '''Parameters''' section.
=== Coordinates ===
The display of coordinates has now been automated.
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox Berg
| NAME =
| BILD =
| BILDBESCHREIBUNG =
| HÖHE =
| HÖHE-BEZUG =
| LAGE =
| GEBIRGE =
| BREITENGRAD =
| LÄNGENGRAD =
| REGION-ISO =
| TYP =
| GESTEIN =
| ALTER =
| ERSTBESTEIGUNG =
| NORMALWEG =
| BESONDERHEITEN =
}}
</syntaxhighlight>
The following parameters are relevant for [[Topographic isolation|isolation]] and [[Topographic prominence|prominence]] information:
<syntaxhighlight lang="wikitext" style="overflow: auto;">
| DOMINANZ =
| SCHARTENHÖHE =
| DOMINANZ-BEZUG =
| SCHARTE =
| SCHARTE-BEZUG =
</syntaxhighlight>
== Parameters ==
{| class="wikitable sortable" style="width: 100%"
|- style="background-color:#f2f2f4; color:inherit;"
! Parameter
| Meaning
! class="unsortable"| Type
! class="unsortable"|Explanation
|-
| '''NAME'''
| '''Name'''
| optional
| Name in the header of the infobox; default is the article name.
|-
| '''NEBENBOX'''
| '''Additional box'''
| <small>(Value equal)</small>
| If this parameter is set the creation of article sections outside the box is suppressed, for example the article coordinates. This is necessary if more than one box is used in an article. All boxes apart from one must then be marked with '''NEBENBOX'''. If, in addition, the location map is to be suppressed, because it is the same for several boxes, the code <code>POSKARTE=none</code> must also be set (see below)
|-
| '''BILD'''
| '''Image'''
| optional
| Name of an image with a '''view of the mountain'''.<br />Landscape views work better than portrait views and should be preferred.<br />Images that show the whole mountain should be preferred over those with just a shot of the summit. Images that do not show the mountain, but are simply a ''view from the mountain'', or just a ''map'', are better entered under '''BILD1''' to '''BILD5''', because these parameters are used for checking missing images.
|-
| '''BILD-BREITE'''
| '''Image width'''
| optional
| Used for entering the width of the image at '''BILD'''; inevitably this has an impact on the image height as well. The default is <code>324x300px</code>. This defines the largest surrounding rectangle, images will not be cropped.
|-
| '''BILDBESCHREIBUNG'''
| '''Caption'''
| optional
| The caption underneath the image.<br />It should be clear from the text, which (of several) mountains in an image is the subject of the article. Entering the following information in the text is useful: direction of shot ("from the north", The north face of the ''XXX'', …), location (seen from YYY) and time of year if relevant. At the least this information should be available in detail at the image page itself.
|-
| '''HÖHE'''
| '''Height'''
| optional
| Height as a number without thousand separator, e.g. <code>4321</code>. It will be automatically formatted by the template e.g. <code>4,321</code>. Entries with decimal places '''must''' use a decimal point not a comma, e.g. <code>1234.5</code> in order to be displayed correctly <code>1,234.5</code>.
Based on the height the category from [[:Category:One-thousanders]] … [[:Category:Eight-thousanders]] will be entered, i. e. the category does not have to be entered manually.
|-
| '''HÖHE-BEZUG'''
| '''Height datum'''
| optional
| Entry of the mountain's [[height above sea level|height datum]], on which the height is based
* in Germany
** "<nowiki>DE-NN</nowiki>" for m above [[Normalnull|NN]] (alt)
** "<nowiki>DE-NHN</nowiki>" for m above [[Normalhöhennull|NHN]] (new)
** "<nowiki>DE-HN</nowiki>" for m above [[Höhennormal|HN]] (GDR)
* in Austria: "<nowiki>AT</nowiki>" for [[Metres above the Adriatic|m above Adriatic]]
* in Switzerland: "<nowiki>CH</nowiki>" for [[Meter über Meer|m above Meer]]
* Other values under [[Template:Höhe]].
'''If the height datum is not known, do not enter anything in this parameter!''' This will automatically generate "[[Height above sea level|m]]" (for metres). Entering "m" or "metres" is counter-productive and should not be done.
|-
| '''HÖHE-ANMERKUNG'''
| '''Height remarks'''
| optional
| Any remarks about the height which are entered on the same line in the infobox. These could be other measurements that are important enough for the infobox or, for mountains on country borders, the different heights in different reference systems (HÖHE-BEZUG).
Examples:
<syntaxhighlight lang="wikitext" style="overflow: auto; width: 32em;">
| HÖHE = 3401
| HÖHE-BEZUG = AT
| HÖHE-ANMERKUNG = ({{Höhe|3402|CH}} (Switzerland) or {{Höhe|3399|IT}} (Italy))
</syntaxhighlight>
expands in the infobox to
Height: {{Höhe|3401|AT|link=true}} (3,402 m above M (Switzerland) or 3,399 m s.l.m. (Italy))
<syntaxhighlight lang="wikitext" style="overflow: auto; width: 32em;">
| HÖHE = 3401
| HÖHE-BEZUG = AT
| HÖHE-ANMERKUNG = (according to other sources {{Höhe|3399|AT}})
}}
</syntaxhighlight>
expands in the infobox to
Height: {{Höhe|3401|AT|link=true}} (according to other sources 3,399 m above A.).
|-
| '''LAGE'''
| '''Location'''
| optional
| The location of the mountain, e. g. "[[Tyrol (state)|Tyrol]], [[Austria]]" or even "Border of [[Tyrol (state)|Tyrol]], [[Austria]] / [[Italy]]", the entries should be linked.
|-
| '''GEBIRGE'''
| '''Range'''
| optional
| The range in which the mountain lies, e. g. "[[Bernese Alps]]".
|-
| '''DOMINANZ'''
| '''Isolation'''
| optional, numerical
| The [[Topographic isolation|isolation]] gives the distance (in kilometres) to the next higher mountain.
|-
| '''DOMINANZ-BEZUG'''
| '''Isolation datum'''
| optional
| The next higher mountain; can be linked.
|-
| '''SCHARTENHÖHE'''
| '''Prominence'''
| optional, numerical
| The [[Topographic prominence|prominence]] is a measurement (in metres) for the 'independence' of a mountain.
|-
| '''SCHARTE-BEZUG'''
| '''Prominence datum'''
| optional
| The higher mountain, which can be reached with the least loss of height. This mountain need not be the same as the '''nearest''' dominating mountain. It is '''a''' dominant mountain, but not necessarily the nearest. Can be linked.
|-
| '''SCHARTE'''
| '''Wind-gap'''
| optional
| Name of the wind-gap related to the prominence above.
|-
| '''BREITENGRAD''' und '''LÄNGENGRAD'''
| '''Latitude''' and '''Longitude'''
| optional
| The [[World Geodetic System 1984|WGS84]] coordinates for the (highest) summit on the mountain. Should be given in decimal format; the template automatically converts this to dms in the display. If not, convert to decimal or enter the dms data under the '''COORD''' parameter, as the format is not supported by [[:Template:Coord]].
|-
| '''COORD'''
| '''Coordinates'''
| optional
| Enter the coordinates using [[:Template:Coord]]. May be used if data are in dms format. Entry here will suppress any preceding '''BREITENGRAD''' und '''LÄNGENGRAD''' entries. Location map will not display as it cannot interpret [[:Template:Coord]]. Better to use decimal data under '''BREITENGRAD''' und '''LÄNGENGRAD''', which will automatically display in dms format anyway.
|-
| '''REGION-ISO'''
| '''ISO region'''
| optional
| A combination of the relevant [[ISO 3166-1]] or [[ISO 3166-2]] codes. Especially for mountains that often lie on state borders, the value consists of more than one ISO code, these should be separated by "/" (NB: not tested). e. g. <code>AT-7/DE-BY</code> for a mountain on the Tyrolean-Bavarian border.
The default location map will be taken from the first section of a multiple ISO code entry. For that reason the sequence of codes is relevant.
|-
| '''KARTE'''
| '''Map'''
| optional
| Name of an image for a map. If this parameter is set, this map will be used instead of the automatically generated location map.
|-
| '''POSKARTE'''
| '''Location map'''
| optional
| Name of an alternative location map. This will overwrite the location map derived from '''REGION-ISO'''. Setting this to '''none''' will suppress the display of a location map.
|-
| '''ALTERNATIVKARTE'''
| '''Alternative map'''
| optional
| Alternative map (image) in relation to a POSKARTE or REGION-ISO fixed datum.
|-
| '''TOPO-KARTE'''
| '''Relief map'''
| optional
| Link to a relief map.
|-
| '''TYP'''
| '''Type of mountain'''
| optional
| The type of mountain. Valid entries include: [[Volcano]] (''Vulkan''), ''Felsgipfel'', ''Kegelberg'', [[mesa]] (''Tafelberg''), [[ridge]] (''Bergrücken''), [[Ice age]] [[moraine]] (''eiszeitliche Moräne''), [[Schuttberg]] (''Trümmerberg'') (an artificially amassed hill) etc.
|-
| '''GESTEIN'''
| '''Rock'''
| optional
| The rock forming the mountain, e. g. [[sandstone]] (''Sandstein''), [[basalt]], etc.
|-
| '''ALTER'''
| '''Age'''
| optional
| The geological age of the rock, e. g. "[[Turonian]]".
|-
| '''LETZTE ERUPTION'''
| '''Last eruption'''
| optional
| The last [[volcanic eruption]] (only for volcanos).
|-
| '''ERSTBESTEIGUNG'''
| '''First climbed'''
| optional
| Date and individual(s) who first climbed the summit. People may be linked.
|-
| '''ERSCHLIESSUNG'''
| '''Access'''
| optional
| Man-made access to or on the mountain e. g. construction of a cable car, an observation tower, etc.
|-
| '''NORMALWEG'''
| '''Normal route'''
| optional
| Entry for the normal route to the top e. g. "South arete" with details of the Alpine level of difficulty. Can be given as e. g. "Hike"
|-
| '''BESONDERHEITEN'''
| '''Remarks'''
| optional
| Additional remarks or features e. g. "Highest mountain in the Eifel"
|-
| '''BILD1''' bis '''BILD5'''
| '''Image1''' to '''Image5'''
| optional
| Optional images added below the infobox
|-
| '''BILD1-BREITE''' bis '''BILD5-BREITE'''
| '''Image1 width''' to '''Image2 width'''
| optional
| The width of the images '''BILD1''' to '''BILD5''' above; defaults to <code>324x300px</code>. See remarks for main image above.
|-
| '''BILD1-BESCHREIBUNG''' bis '''BILD5-BESCHREIBUNG'''
| '''Caption1''' to '''Caption5'''
| optional
| Captions for the extra images
|}
== Example ==
In this example all parameters are completed to give a feel for the functionality of the infobox.
{{Infobox mountain
| name = Testberg
| photo = HoheachtRassberg.jpg
| photo_size = 282px
| photo_alt =
| photo_caption = The Testberg
[[File:weltkarte.jpg|282px|center]]<br />[[File:weltkarte.jpg|250px]]<br />World map
| elevation = {{Höhe|999.9 || link=false }} ({{convert|999.9|m|ft|disp=output only|abbr=on}}) <br />(would be {{Höhe|1000.2|DE-HNH}})
| elevation_ref =
| isolation = 0.1 km<span title="to"> → </span>[[Mont Blanc]]
| isolation_ref =
| prominence = 200 m<span title="above the wind-gap"> ↓ </span>[[Maloja Pass]]<span title="to"> → </span>[[Großglockner]]
| prominence_ref =
| listing =
| range = Testgebirge
| parent_peak =
| location = South of Testland
| map =
| map_alt =
| map_caption =
| map_relief =
| map_size =
| map_image =
| label =
| label_position =
| coordinates = {{coord|45.3456|6.5059|region:FR_type:mountain|format=dms|display=inline,title}}
| coordinates_ref =
| topo =
| type = [[Dolomite (mineral)|Dolomite]]<br />Dormant [[volcano]]
| rock = [[Dolomite (mineral)|Dolomite]]
| volcanic_arc/belt =
| age = [[Tertiary period|Tertiary]]
| last_eruption = 2000
| first_ascent = 17 March 1875 by Hans Müller
| access = Neudorf Cable Car
| easiest_route = Cable car
| normal_route = From mountain hut via the east arete
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox Berg1
| NAME = Testberg
| BILD = HoheachtRassberg.jpg
| BILDBESCHREIBUNG = The Testberg
| HÖHE = 999.9
| HÖHE-ANMERKUNG = <br />(would be {{Höhe|1000.2|DE-HNH}})
| LAGE = South of Testland
| GEBIRGE = Testgebirge
| DOMINANZ = 0.1
| SCHARTENHÖHE = 200
| DOMINANZ-BEZUG = [[Mont Blanc]]
| SCHARTE = [[Maloja Pass]]
| SCHARTE-BEZUG = [[Großglockner]]
| BREITENGRAD = 45.3456<!-- 45{{!}}40{{!}}39 -->
| LÄNGENGRAD = 6.5059
| REGION-ISO = FR
| TYP = Dormant [[volcano]]
| GESTEIN = [[Dolomite (mineral)|Dolomite]]
| ALTER = [[Tertiary period|Tertiary]]
| LETZTE ERUPTION = 2000
| ERSTBESTEIGUNG = 17 March 1875 by Hans Müller
| ERSCHLIESSUNG = Neudorf Cable Car
| LEICHTESTE ROUTE = Cable car
| NORMALWEG = From mountain hut via the east arete
| BESONDERHEITEN = Only a fictional mountain!
| BILD1 = weltkarte.jpg
| BILD2 = weltkarte.jpg
| BILD2-BREITE = 250px
| BILD2-BESCHREIBUNG = World map
}}
</syntaxhighlight>
{{clear}}
== See also ==
* [[Template:Infobox mountain]] (used by this template)
* [[Template:Infobox Gebirgsgruppe]] (German version of [[Template:Infobox mountain range]])
<includeonly>{{basepage subpage|
<!-- Categories below this line -->
[[Category:Germany geography templates|Berg]]
[[Category:Mountain templates]]
[[Category:Infobox importer templates]]
}}</includeonly>
qyjesipvwr72xrcxm5gt4r0h4i0xkg3
74821
74820
2026-08-24T00:17:00Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mountain/Berg/doc]]
74820
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{substituted|auto=yes}}
== Usage ==
This template enables data on mountains imported from German Wikipedia (using [[:de:Vorlage:Infobox Berg]]) to be translated and displayed in English Wikipedia. This saves the enormous amount of work otherwise entailed in translating parameters and data into en.wiki templates. Some of this translation involves technical terms that may not be obvious to some translators. In addition, en.wiki templates are not capable of displaying all the information provided here.
The template is available for the hundreds of articles on German, Austrian and Swiss mountains being translated into English Wikipedia that will be able to take full advantage of its features.
When translating an article from German Wikipedia, just import the infobox and translate any free text. It is worth previewing the result first as data in several parameters will be automatically translated if recognised; otherwise it defaults to the entered text. This feature is being enhanced continually. Blank parameters are ignored. The parameter text is shown below; their use is explained in the '''Parameters''' section.
=== Coordinates ===
The display of coordinates has now been automated.
<syntaxhighlight lang="wikitext" style="overflow: auto">
{{Infobox Berg
| NAME =
| BILD =
| BILDBESCHREIBUNG =
| HÖHE =
| HÖHE-BEZUG =
| LAGE =
| GEBIRGE =
| BREITENGRAD =
| LÄNGENGRAD =
| REGION-ISO =
| TYP =
| GESTEIN =
| ALTER =
| ERSTBESTEIGUNG =
| NORMALWEG =
| BESONDERHEITEN =
}}
</syntaxhighlight>
The following parameters are relevant for [[Topographic isolation|isolation]] and [[Topographic prominence|prominence]] information:
<syntaxhighlight lang="wikitext" style="overflow: auto;">
| DOMINANZ =
| SCHARTENHÖHE =
| DOMINANZ-BEZUG =
| SCHARTE =
| SCHARTE-BEZUG =
</syntaxhighlight>
== Parameters ==
{| class="wikitable sortable" style="width: 100%"
|- style="background-color:#f2f2f4; color:inherit;"
! Parameter
| Meaning
! class="unsortable"| Type
! class="unsortable"|Explanation
|-
| '''NAME'''
| '''Name'''
| optional
| Name in the header of the infobox; default is the article name.
|-
| '''NEBENBOX'''
| '''Additional box'''
| <small>(Value equal)</small>
| If this parameter is set the creation of article sections outside the box is suppressed, for example the article coordinates. This is necessary if more than one box is used in an article. All boxes apart from one must then be marked with '''NEBENBOX'''. If, in addition, the location map is to be suppressed, because it is the same for several boxes, the code <code>POSKARTE=none</code> must also be set (see below)
|-
| '''BILD'''
| '''Image'''
| optional
| Name of an image with a '''view of the mountain'''.<br />Landscape views work better than portrait views and should be preferred.<br />Images that show the whole mountain should be preferred over those with just a shot of the summit. Images that do not show the mountain, but are simply a ''view from the mountain'', or just a ''map'', are better entered under '''BILD1''' to '''BILD5''', because these parameters are used for checking missing images.
|-
| '''BILD-BREITE'''
| '''Image width'''
| optional
| Used for entering the width of the image at '''BILD'''; inevitably this has an impact on the image height as well. The default is <code>324x300px</code>. This defines the largest surrounding rectangle, images will not be cropped.
|-
| '''BILDBESCHREIBUNG'''
| '''Caption'''
| optional
| The caption underneath the image.<br />It should be clear from the text, which (of several) mountains in an image is the subject of the article. Entering the following information in the text is useful: direction of shot ("from the north", The north face of the ''XXX'', …), location (seen from YYY) and time of year if relevant. At the least this information should be available in detail at the image page itself.
|-
| '''HÖHE'''
| '''Height'''
| optional
| Height as a number without thousand separator, e.g. <code>4321</code>. It will be automatically formatted by the template e.g. <code>4,321</code>. Entries with decimal places '''must''' use a decimal point not a comma, e.g. <code>1234.5</code> in order to be displayed correctly <code>1,234.5</code>.
Based on the height the category from [[:Category:One-thousanders]] … [[:Category:Eight-thousanders]] will be entered, i. e. the category does not have to be entered manually.
|-
| '''HÖHE-BEZUG'''
| '''Height datum'''
| optional
| Entry of the mountain's [[height above sea level|height datum]], on which the height is based
* in Germany
** "<nowiki>DE-NN</nowiki>" for m above [[Normalnull|NN]] (alt)
** "<nowiki>DE-NHN</nowiki>" for m above [[Normalhöhennull|NHN]] (new)
** "<nowiki>DE-HN</nowiki>" for m above [[Höhennormal|HN]] (GDR)
* in Austria: "<nowiki>AT</nowiki>" for [[Metres above the Adriatic|m above Adriatic]]
* in Switzerland: "<nowiki>CH</nowiki>" for [[Meter über Meer|m above Meer]]
* Other values under [[Template:Höhe]].
'''If the height datum is not known, do not enter anything in this parameter!''' This will automatically generate "[[Height above sea level|m]]" (for metres). Entering "m" or "metres" is counter-productive and should not be done.
|-
| '''HÖHE-ANMERKUNG'''
| '''Height remarks'''
| optional
| Any remarks about the height which are entered on the same line in the infobox. These could be other measurements that are important enough for the infobox or, for mountains on country borders, the different heights in different reference systems (HÖHE-BEZUG).
Examples:
<syntaxhighlight lang="wikitext" style="overflow: auto; width: 32em;">
| HÖHE = 3401
| HÖHE-BEZUG = AT
| HÖHE-ANMERKUNG = ({{Höhe|3402|CH}} (Switzerland) or {{Höhe|3399|IT}} (Italy))
</syntaxhighlight>
expands in the infobox to
Height: {{Höhe|3401|AT|link=true}} (3,402 m above M (Switzerland) or 3,399 m s.l.m. (Italy))
<syntaxhighlight lang="wikitext" style="overflow: auto; width: 32em;">
| HÖHE = 3401
| HÖHE-BEZUG = AT
| HÖHE-ANMERKUNG = (according to other sources {{Höhe|3399|AT}})
}}
</syntaxhighlight>
expands in the infobox to
Height: {{Höhe|3401|AT|link=true}} (according to other sources 3,399 m above A.).
|-
| '''LAGE'''
| '''Location'''
| optional
| The location of the mountain, e. g. "[[Tyrol (state)|Tyrol]], [[Austria]]" or even "Border of [[Tyrol (state)|Tyrol]], [[Austria]] / [[Italy]]", the entries should be linked.
|-
| '''GEBIRGE'''
| '''Range'''
| optional
| The range in which the mountain lies, e. g. "[[Bernese Alps]]".
|-
| '''DOMINANZ'''
| '''Isolation'''
| optional, numerical
| The [[Topographic isolation|isolation]] gives the distance (in kilometres) to the next higher mountain.
|-
| '''DOMINANZ-BEZUG'''
| '''Isolation datum'''
| optional
| The next higher mountain; can be linked.
|-
| '''SCHARTENHÖHE'''
| '''Prominence'''
| optional, numerical
| The [[Topographic prominence|prominence]] is a measurement (in metres) for the 'independence' of a mountain.
|-
| '''SCHARTE-BEZUG'''
| '''Prominence datum'''
| optional
| The higher mountain, which can be reached with the least loss of height. This mountain need not be the same as the '''nearest''' dominating mountain. It is '''a''' dominant mountain, but not necessarily the nearest. Can be linked.
|-
| '''SCHARTE'''
| '''Wind-gap'''
| optional
| Name of the wind-gap related to the prominence above.
|-
| '''BREITENGRAD''' und '''LÄNGENGRAD'''
| '''Latitude''' and '''Longitude'''
| optional
| The [[World Geodetic System 1984|WGS84]] coordinates for the (highest) summit on the mountain. Should be given in decimal format; the template automatically converts this to dms in the display. If not, convert to decimal or enter the dms data under the '''COORD''' parameter, as the format is not supported by [[:Template:Coord]].
|-
| '''COORD'''
| '''Coordinates'''
| optional
| Enter the coordinates using [[:Template:Coord]]. May be used if data are in dms format. Entry here will suppress any preceding '''BREITENGRAD''' und '''LÄNGENGRAD''' entries. Location map will not display as it cannot interpret [[:Template:Coord]]. Better to use decimal data under '''BREITENGRAD''' und '''LÄNGENGRAD''', which will automatically display in dms format anyway.
|-
| '''REGION-ISO'''
| '''ISO region'''
| optional
| A combination of the relevant [[ISO 3166-1]] or [[ISO 3166-2]] codes. Especially for mountains that often lie on state borders, the value consists of more than one ISO code, these should be separated by "/" (NB: not tested). e. g. <code>AT-7/DE-BY</code> for a mountain on the Tyrolean-Bavarian border.
The default location map will be taken from the first section of a multiple ISO code entry. For that reason the sequence of codes is relevant.
|-
| '''KARTE'''
| '''Map'''
| optional
| Name of an image for a map. If this parameter is set, this map will be used instead of the automatically generated location map.
|-
| '''POSKARTE'''
| '''Location map'''
| optional
| Name of an alternative location map. This will overwrite the location map derived from '''REGION-ISO'''. Setting this to '''none''' will suppress the display of a location map.
|-
| '''ALTERNATIVKARTE'''
| '''Alternative map'''
| optional
| Alternative map (image) in relation to a POSKARTE or REGION-ISO fixed datum.
|-
| '''TOPO-KARTE'''
| '''Relief map'''
| optional
| Link to a relief map.
|-
| '''TYP'''
| '''Type of mountain'''
| optional
| The type of mountain. Valid entries include: [[Volcano]] (''Vulkan''), ''Felsgipfel'', ''Kegelberg'', [[mesa]] (''Tafelberg''), [[ridge]] (''Bergrücken''), [[Ice age]] [[moraine]] (''eiszeitliche Moräne''), [[Schuttberg]] (''Trümmerberg'') (an artificially amassed hill) etc.
|-
| '''GESTEIN'''
| '''Rock'''
| optional
| The rock forming the mountain, e. g. [[sandstone]] (''Sandstein''), [[basalt]], etc.
|-
| '''ALTER'''
| '''Age'''
| optional
| The geological age of the rock, e. g. "[[Turonian]]".
|-
| '''LETZTE ERUPTION'''
| '''Last eruption'''
| optional
| The last [[volcanic eruption]] (only for volcanos).
|-
| '''ERSTBESTEIGUNG'''
| '''First climbed'''
| optional
| Date and individual(s) who first climbed the summit. People may be linked.
|-
| '''ERSCHLIESSUNG'''
| '''Access'''
| optional
| Man-made access to or on the mountain e. g. construction of a cable car, an observation tower, etc.
|-
| '''NORMALWEG'''
| '''Normal route'''
| optional
| Entry for the normal route to the top e. g. "South arete" with details of the Alpine level of difficulty. Can be given as e. g. "Hike"
|-
| '''BESONDERHEITEN'''
| '''Remarks'''
| optional
| Additional remarks or features e. g. "Highest mountain in the Eifel"
|-
| '''BILD1''' bis '''BILD5'''
| '''Image1''' to '''Image5'''
| optional
| Optional images added below the infobox
|-
| '''BILD1-BREITE''' bis '''BILD5-BREITE'''
| '''Image1 width''' to '''Image2 width'''
| optional
| The width of the images '''BILD1''' to '''BILD5''' above; defaults to <code>324x300px</code>. See remarks for main image above.
|-
| '''BILD1-BESCHREIBUNG''' bis '''BILD5-BESCHREIBUNG'''
| '''Caption1''' to '''Caption5'''
| optional
| Captions for the extra images
|}
== Example ==
In this example all parameters are completed to give a feel for the functionality of the infobox.
{{Infobox mountain
| name = Testberg
| photo = HoheachtRassberg.jpg
| photo_size = 282px
| photo_alt =
| photo_caption = The Testberg
[[File:weltkarte.jpg|282px|center]]<br />[[File:weltkarte.jpg|250px]]<br />World map
| elevation = {{Höhe|999.9 || link=false }} ({{convert|999.9|m|ft|disp=output only|abbr=on}}) <br />(would be {{Höhe|1000.2|DE-HNH}})
| elevation_ref =
| isolation = 0.1 km<span title="to"> → </span>[[Mont Blanc]]
| isolation_ref =
| prominence = 200 m<span title="above the wind-gap"> ↓ </span>[[Maloja Pass]]<span title="to"> → </span>[[Großglockner]]
| prominence_ref =
| listing =
| range = Testgebirge
| parent_peak =
| location = South of Testland
| map =
| map_alt =
| map_caption =
| map_relief =
| map_size =
| map_image =
| label =
| label_position =
| coordinates = {{coord|45.3456|6.5059|region:FR_type:mountain|format=dms|display=inline,title}}
| coordinates_ref =
| topo =
| type = [[Dolomite (mineral)|Dolomite]]<br />Dormant [[volcano]]
| rock = [[Dolomite (mineral)|Dolomite]]
| volcanic_arc/belt =
| age = [[Tertiary period|Tertiary]]
| last_eruption = 2000
| first_ascent = 17 March 1875 by Hans Müller
| access = Neudorf Cable Car
| easiest_route = Cable car
| normal_route = From mountain hut via the east arete
}}
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox Berg1
| NAME = Testberg
| BILD = HoheachtRassberg.jpg
| BILDBESCHREIBUNG = The Testberg
| HÖHE = 999.9
| HÖHE-ANMERKUNG = <br />(would be {{Höhe|1000.2|DE-HNH}})
| LAGE = South of Testland
| GEBIRGE = Testgebirge
| DOMINANZ = 0.1
| SCHARTENHÖHE = 200
| DOMINANZ-BEZUG = [[Mont Blanc]]
| SCHARTE = [[Maloja Pass]]
| SCHARTE-BEZUG = [[Großglockner]]
| BREITENGRAD = 45.3456<!-- 45{{!}}40{{!}}39 -->
| LÄNGENGRAD = 6.5059
| REGION-ISO = FR
| TYP = Dormant [[volcano]]
| GESTEIN = [[Dolomite (mineral)|Dolomite]]
| ALTER = [[Tertiary period|Tertiary]]
| LETZTE ERUPTION = 2000
| ERSTBESTEIGUNG = 17 March 1875 by Hans Müller
| ERSCHLIESSUNG = Neudorf Cable Car
| LEICHTESTE ROUTE = Cable car
| NORMALWEG = From mountain hut via the east arete
| BESONDERHEITEN = Only a fictional mountain!
| BILD1 = weltkarte.jpg
| BILD2 = weltkarte.jpg
| BILD2-BREITE = 250px
| BILD2-BESCHREIBUNG = World map
}}
</syntaxhighlight>
{{clear}}
== See also ==
* [[Template:Infobox mountain]] (used by this template)
* [[Template:Infobox Gebirgsgruppe]] (German version of [[Template:Infobox mountain range]])
<includeonly>{{basepage subpage|
<!-- Categories below this line -->
[[Category:Germany geography templates|Berg]]
[[Category:Mountain templates]]
[[Category:Infobox importer templates]]
}}</includeonly>
qyjesipvwr72xrcxm5gt4r0h4i0xkg3
Template:German coord convert
10
8954
74822
2024-09-02T11:50:07Z
en>DB1729
0
Category:Coordinates conversion templates
74822
wikitext
text/x-wiki
<includeonly>{{safesubst:#invoke:German coord convert|main|{{{1|}}}|{{{2|}}}|{{{3|}}}|format={{{format|}}}|name={{{name|}}}|display={{{display|}}}|notes={{{notes|}}}|subst={{safesubst:ifsubst|yes|}}}}</includeonly><noinclude>
{{documentation|content=
{{lua|Module:German coord convert}}
== Example ==
*<code><nowiki>{{German coord convert|47/19/20/N|11/11/27/E}}</nowiki></code> → {{German coord convert|47/19/20/N|11/11/27/E}}
*<code><nowiki>{{German coord convert|47/19/20/S|11/11/27/W}}</nowiki></code> → {{German coord convert|47/19/20/S|11/11/27/W}}
*<code><nowiki>{{German coord convert|47.314134|11.19083}}</nowiki></code> → {{German coord convert|47.314134|11.19083}}
*<code><nowiki>{{German coord convert|47/19.1/N|11/11.5/E}}</nowiki></code> → {{German coord convert|47/19.1/N|11/11.5/E}}
*<code><nowiki>{{German coord convert|47/19.1/S|11/11.5/W}}</nowiki></code> → {{German coord convert|47/19.1/S|11/11.5/W}}
*<code><nowiki>{{German coord convert|47/19.1//N|11/11.5//E}}</nowiki></code> → {{German coord convert|47/19.1//N|11/11.5//E}}
*<code><nowiki>{{German coord convert|47/19.1//S|11/11.5//W}}</nowiki></code> → {{German coord convert|47/19.1//S|11/11.5//W}}
*<code><nowiki>{{German coord convert|47.2/N|11.1/E}}</nowiki></code> → {{German coord convert|47.2/N|11.1/E}}
*<code><nowiki>{{German coord convert|47.2/S|11.1/W}}</nowiki></code> → {{German coord convert|47.2/S|11.1/W}}
*<code><nowiki>{{German coord convert|47.2//N|11.1//E}}</nowiki></code> → {{German coord convert|47.2//N|11.1//E}}
*<code><nowiki>{{German coord convert|47.2//S|11.1//W}}</nowiki></code> → {{German coord convert|47.2//S|11.1//W}}
*<code><nowiki>{{German coord convert|47.2///N|11.1///E}}</nowiki></code> → {{German coord convert|47.2///N|11.1///E}}
*<code><nowiki>{{German coord convert|47.2///S|11.1///W}}</nowiki></code> → {{German coord convert|47.2///S|11.1///W}}
[[Category:Coordinates conversion templates]]
}}</noinclude>
mn68uwojmpweiqhzv9p3srechyyr6aa
74823
74822
2026-08-24T00:18:18Z
Robertsky
10424
1 versaun husi [[:en:Template:German_coord_convert]]
74822
wikitext
text/x-wiki
<includeonly>{{safesubst:#invoke:German coord convert|main|{{{1|}}}|{{{2|}}}|{{{3|}}}|format={{{format|}}}|name={{{name|}}}|display={{{display|}}}|notes={{{notes|}}}|subst={{safesubst:ifsubst|yes|}}}}</includeonly><noinclude>
{{documentation|content=
{{lua|Module:German coord convert}}
== Example ==
*<code><nowiki>{{German coord convert|47/19/20/N|11/11/27/E}}</nowiki></code> → {{German coord convert|47/19/20/N|11/11/27/E}}
*<code><nowiki>{{German coord convert|47/19/20/S|11/11/27/W}}</nowiki></code> → {{German coord convert|47/19/20/S|11/11/27/W}}
*<code><nowiki>{{German coord convert|47.314134|11.19083}}</nowiki></code> → {{German coord convert|47.314134|11.19083}}
*<code><nowiki>{{German coord convert|47/19.1/N|11/11.5/E}}</nowiki></code> → {{German coord convert|47/19.1/N|11/11.5/E}}
*<code><nowiki>{{German coord convert|47/19.1/S|11/11.5/W}}</nowiki></code> → {{German coord convert|47/19.1/S|11/11.5/W}}
*<code><nowiki>{{German coord convert|47/19.1//N|11/11.5//E}}</nowiki></code> → {{German coord convert|47/19.1//N|11/11.5//E}}
*<code><nowiki>{{German coord convert|47/19.1//S|11/11.5//W}}</nowiki></code> → {{German coord convert|47/19.1//S|11/11.5//W}}
*<code><nowiki>{{German coord convert|47.2/N|11.1/E}}</nowiki></code> → {{German coord convert|47.2/N|11.1/E}}
*<code><nowiki>{{German coord convert|47.2/S|11.1/W}}</nowiki></code> → {{German coord convert|47.2/S|11.1/W}}
*<code><nowiki>{{German coord convert|47.2//N|11.1//E}}</nowiki></code> → {{German coord convert|47.2//N|11.1//E}}
*<code><nowiki>{{German coord convert|47.2//S|11.1//W}}</nowiki></code> → {{German coord convert|47.2//S|11.1//W}}
*<code><nowiki>{{German coord convert|47.2///N|11.1///E}}</nowiki></code> → {{German coord convert|47.2///N|11.1///E}}
*<code><nowiki>{{German coord convert|47.2///S|11.1///W}}</nowiki></code> → {{German coord convert|47.2///S|11.1///W}}
[[Category:Coordinates conversion templates]]
}}</noinclude>
mn68uwojmpweiqhzv9p3srechyyr6aa
Módulo:German coord convert
828
8955
74824
2020-02-02T18:14:30Z
en>MusikBot II
0
Protected "[[Module:German coord convert]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
74824
Scribunto
text/plain
-- This module converts German Wikipedia-style coordinates to a formatted
-- invocation of the [[template:coord]] template
local p = {}
function p.main(frame)
local latstr = frame.args[1] or ''
local lonstr = frame.args[2] or ''
local tstr = frame.args[3] or ''
local fstr = frame.args['format'] or ''
local dstr = frame.args['display'] or ''
local nmstr = frame.args['name'] or ''
local ntstr = frame.args['notes'] or ''
local issubst= frame.args['subst'] or ''
latstr = mw.ustring.gsub(latstr, '[%s]', '')
lonstr = mw.ustring.gsub(lonstr, '[%s]', '')
latstr = mw.ustring.gsub(latstr, ',', '.')
lonstr = mw.ustring.gsub(lonstr, ',', '.')
lonstr = mw.ustring.gsub(lonstr, '[Oo]', 'E')
while mw.ustring.match(tstr, 'region:[^_/:%s]*/') do
tstr = mw.ustring.gsub(tstr, '(region:[^_/:%s]*)%s*/', '%1_region:')
end
tstr = mw.ustring.gsub(tstr, '%s', '_')
tstr = mw.ustring.gsub(tstr, '___*', '_')
if (issubst ~= '') then
local res = ''
if (tstr ~= '' ) then
res = '|' .. tstr
end
if (fstr ~= '' ) then
res = res .. '|format=' .. fstr
end
if (dstr ~= '' ) then
res = res .. '|display=' .. dstr
end
if (nmstr ~= '' ) then
res = res .. '|name=' .. nmstr
end
if (ntstr ~= '' ) then
res = res .. '|notes=' .. ntstr
end
latstr = mw.ustring.gsub(latstr, '/[/]*', '|')
lonstr = mw.ustring.gsub(lonstr, '/[/]*', '|')
return '{{coord|' .. latstr .. '|' .. lonstr .. res .. '}}'
else
local targs = mw.text.split( latstr .. '/' .. lonstr .. '/' .. tstr, '%s*/[%s/]*')
if fstr ~= '' then
targs['format'] = fstr
end
if dstr ~= '' then
targs['display'] = dstr
end
if nmstr ~= '' then
targs['name'] = nmstr
end
if ntstr ~= '' then
targs['notes'] = ntstr
end
return frame:expandTemplate{ title = 'coord', args = targs }
end
end
return p
pkewww61f42y2c74zwggeymhhoirckq
74825
74824
2026-08-24T00:18:18Z
Robertsky
10424
1 versaun husi [[:en:Module:German_coord_convert]]
74824
Scribunto
text/plain
-- This module converts German Wikipedia-style coordinates to a formatted
-- invocation of the [[template:coord]] template
local p = {}
function p.main(frame)
local latstr = frame.args[1] or ''
local lonstr = frame.args[2] or ''
local tstr = frame.args[3] or ''
local fstr = frame.args['format'] or ''
local dstr = frame.args['display'] or ''
local nmstr = frame.args['name'] or ''
local ntstr = frame.args['notes'] or ''
local issubst= frame.args['subst'] or ''
latstr = mw.ustring.gsub(latstr, '[%s]', '')
lonstr = mw.ustring.gsub(lonstr, '[%s]', '')
latstr = mw.ustring.gsub(latstr, ',', '.')
lonstr = mw.ustring.gsub(lonstr, ',', '.')
lonstr = mw.ustring.gsub(lonstr, '[Oo]', 'E')
while mw.ustring.match(tstr, 'region:[^_/:%s]*/') do
tstr = mw.ustring.gsub(tstr, '(region:[^_/:%s]*)%s*/', '%1_region:')
end
tstr = mw.ustring.gsub(tstr, '%s', '_')
tstr = mw.ustring.gsub(tstr, '___*', '_')
if (issubst ~= '') then
local res = ''
if (tstr ~= '' ) then
res = '|' .. tstr
end
if (fstr ~= '' ) then
res = res .. '|format=' .. fstr
end
if (dstr ~= '' ) then
res = res .. '|display=' .. dstr
end
if (nmstr ~= '' ) then
res = res .. '|name=' .. nmstr
end
if (ntstr ~= '' ) then
res = res .. '|notes=' .. ntstr
end
latstr = mw.ustring.gsub(latstr, '/[/]*', '|')
lonstr = mw.ustring.gsub(lonstr, '/[/]*', '|')
return '{{coord|' .. latstr .. '|' .. lonstr .. res .. '}}'
else
local targs = mw.text.split( latstr .. '/' .. lonstr .. '/' .. tstr, '%s*/[%s/]*')
if fstr ~= '' then
targs['format'] = fstr
end
if dstr ~= '' then
targs['display'] = dstr
end
if nmstr ~= '' then
targs['name'] = nmstr
end
if ntstr ~= '' then
targs['notes'] = ntstr
end
return frame:expandTemplate{ title = 'coord', args = targs }
end
end
return p
pkewww61f42y2c74zwggeymhhoirckq
Template:Infobox Berg/map
10
8956
74828
2017-02-26T14:15:37Z
en>Jenks24
0
Jenks24 moved page [[Template:Infobox Berg1/map]] to [[Template:Infobox Berg/map]]: per requested move discussion, see talk
74828
wikitext
text/x-wiki
<noinclude>
In the following list please adhere to the alphabetic order as per the [[ISO 3166-2|ISO 3166-2-Code]].
<poem></noinclude><includeonly>{{{{{|safesubst:}}}#switch: {{{1}}}
|#default = </includeonly>
|AD|AD-02|AD-03|AD-04|AD-05|AD-06|AD-07|AD-08 = Andorra
|AE|AE-AZ|AE-AJ|AE-DU|AE-FU|AE-RK|AE-SH|AE-UQ = United Arab Emirates
|AF|AF-BAL|AF-BAM|AF-BDG|AF-BDS|AF-BGL|AF-DAY|AF-FRA
|AF-FYB|AF-GHA|AF-GHO|AF-HEL|AF-HER|AF-JOW|AF-KAB|AF-KAN
|AF-KAP|AF-KDZ|AF-KHO|AF-KNR|AF-LAG|AF-LOW|AF-NAN|AF-NIM
|AF-NUR|AF-ORU|AF-PAN|AF-PAR|AF-PIA|AF-PKA|AF-SAM|AF-SAR
|AF-TAK|AF-WAR|AF-ZAB = Afghanistan
|AG = Antigua and Barbuda
|AL|AL-BR|AL-BU|AL-DL|AL-DV|AL-DI|AL-DR|AL-EL|AL-FR|AL-GJ
|AL-GR|AL-HA|AL-KA|AL-ER|AL-KO|AL-KR|AL-KC|AL-KU|AL-KB|AL-LE
|AL-LB|AL-LU|AL-MM|AL-MK|AL-MT|AL-MR|AL-PQ|AL-PR|AL-PG|AL-PU
|AL-SR|AL-SK|AL-SH|AL-TE|AL-TR|AL-TP|AL-VL = Albania
|AM|AM-AG|AM-AR|AM-AV|AM-ER|AM-GR|AM-KT|AM-LO|AM-SH|AM-SU
|AM-TV|AM-VD = Armenia
|AO|AO-BGO|AO-BGU|AO-BIE|AO-CAB|AO-CCU|AO-CNO|AO-CUS|AO-CNN
|AO-HUA|AO-HUI|AO-LUA|AO-LNO|AO-LSU|AO-MAL|AO-MOX|AO-NAM
|AO-UIG|AO-ZAI = Angola
|AQ = Antarctica
|AR|AR-C|AR-B|AR-K|AR-H|AR-U|AR-X|AR-W|AR-E|AR-P|AR-Y|AR-L
|AR-F|AR-M|AR-N|AR-Q|AR-R|AR-A|AR-J|AR-D|AR-Z|AR-S|AR-G
|AR-V|AR-T = Argentina
|AT|AT-1|AT-2|AT-3|AT-4|AT-5|AT-6|AT-7|AT-8|AT-9 = Austria
|AU|AU-ACT|AU-CT|AU-JBT|AU-JT = Australia
|AU-NS|AU-NSW = Australia New South Wales
|AU-NT = Australia Northern Territory
|AU-QL|AU-QLD = Australia Queensland
|AU-SA = Australia South Australia
|AU-TAS|AU-TS = Australia Tasmania
|AU-VI|AU-VIC = Australia Victoria
|AU-WA = Australia Western Australia
|AW|AW-AUA|AW-BAR|AW-BUS|AW-DEU|AW-ORJ|AW-SNL = Aruba
|AZ = Azerbaijan
|BA|BA-BIH|BA-SRP = Bosnia and Herzegovina
|BB = Barbados
|BD|BD-05|BD-01|BD-02|BD-06|BD-07|BD-03|BD-04|BD-09|BD-10
|BD-12|BD-11|BD-13|BD-14|BD-15|BD-16|BD-19|BD-18|BD-17|BD-20
|BD-24|BD-21|BD-22|BD-25|BD-23|BD-29|BD-27|BD-26|BD-08|BD-28
|BD-30|BD-31|BD-32|BD-36|BD-37|BD-33|BD-39|BD-38|BD-35|BD-34
|BD-48|BD-43|BD-40|BD-42|BD-44|BD-45|BD-41|BD-46|BD-47|BD-49
|BD-52|BD-51|BD-50|BD-53|BD-54|BD-56|BD-55|BD-58|BD-62|BD-57
|BD-59|BD-61|BD-60|BD-63|BD-64 = Bangladesh
|BE|BE-BRU|BE-VAN|BE-VBR|BE-VLG|BE-VOV|BE-VWV|BE-WAL
|BE-WBR|BE-WHT|BE-WLG|BE-VLI|BE-WLX|BE-WNA = Belgium
|BF|BF-BAL|BF-BAM|BF-BAN|BF-BAZ|BF-BGR|BF-BLG|BF-BLK|BF-COM
|BF-GAN|BF-GNA|BF-GOU|BF-HOU|BF-IOB|BF-KAD|BF-KEN|BF-KMD
|BF-KMP|BF-KOP|BF-KOS|BF-KOT|BF-KOW|BF-LER|BF-LOR|BF-MOU
|BF-NAM|BF-NAO|BF-NAY|BF-NOU|BF-OUB|BF-OUD|BF-PAS|BF-PON
|BF-SEN|BF-SIS|BF-SMT|BF-SNG|BF-SOM|BF-SOR|BF-TAP|BF-TUI
|BF-YAG|BF-YAT|BF-ZIR|BF-ZON|BF-ZOU = Burkina Faso
|BG|BG-01|BG-02|BG-03|BG-04|BG-05|BG-06|BG-07|BG-08|BG-09
|BG-10|BG-11|BG-12|BG-13|BG-14|BG-15|BG-16|BG-17|BG-18
|BG-19|BG-20|BG-21|BG-22|BG-23|BG-24|BG-25|BG-26|BG-27
|BG-28 = Bulgaria
|BH|BH-13|BH-14|BH-15|BH-16|BH-17 = Bahrain
|BI|BI-BB|BI-BJ|BI-BR|BI-CA|BI-CI|BI-GI|BI-KR|BI-KY|BI-KI
|BI-MA|BI-MU|BI-MY|BI-MW|BI-NG|BI-RT|BI-RY = Burundi
|BJ|BJ-AL|BJ-AK|BJ-AQ|BJ-BO|BJ-CO|BJ-KO|BJ-DO|BJ-LI|BJ-MO
|BJ-OU|BJ-PL|BJ-ZO = Benin
|BN|BN-BE|BN-BM|BN-TE|BN-TU = Brunei
|BO|BO-B|BO-H|BO-C|BO-L|BO-O|BO-N|BO-P|BO-S|BO-T = Bolivia
|BR|BR-AC|BR-AL|BR-AM|BR-AP|BR-BA|BR-CE|BR-DF|BR-ES|BR-GO
|BR-MA|BR-MG|BR-MS|BR-MT|BR-PA|BR-PB|BR-PE|BR-PI|BR-PR|BR-RJ
|BR-RN|BR-RO|BR-RR|BR-RS|BR-SC|BR-SE|BR-SP|BR-TO = Brazil
|BS|BS-AC|BS-BI|BS-CI|BS-EX|BS-FP|BS-FC|BS-GH|BS-GT|BS-HI
|BS-HR|BS-IN|BS-KB|BS-LI|BS-MH|BS-MG|BS-NP|BS-NB|BS-RI
|BS-RS|BS-SP|BS-SR = Bahamas
|BT|BT-33|BT-12|BT-22|BT-GA|BT-13|BT-44|BT-42|BT-11|BT-43
|BT-23|BT-45|BT-14|BT-31|BT-15|BT-41|BT-TY|BT-32|BT-21
|BT-24|BT-34 = Bhutan
|BW|BW-GH|BW-KG|BW-KL|BW-KW|BW-NE|BW-NW|BW-SE|BW-SO = Botswana
|BY|BY-BR|BY-HO|BY-HR|BY-MA|BY-MI|BY-VI = Belarus
|BZ|BZ-BZ|BZ-CY|BZ-CZL|BZ-OW|BZ-SC|BZ-TOL = Belize
|CA|CA-AB|CA-NB|CA-NL|CA-NS|CA-NT|CA-NU|CA-ON|CA-PE|CA-QC
|CA-YU|CA-YT = Canada
|CA-BC = Canada British Columbia
|CA-MB = Canada Manitoba
|CA-SK = Canada Saskatchewan
|CD|CD-BN|CD-BC|CD-EQ|CD-KA|CD-KW|CD-KE|CD-KN|CD-MA|CD-NK
|CD-OR|CD-SK = Democratic Republic of the Congo
|CF|CF-BB|CF-BGF|CF-BK|CF-HM|CF-HK|CF-KG|CF-LB|CF-HS|CF-MB
|CF-KB|CF-NM|CF-MP|CF-UK|CF-AC|CF-OP|CF-SE|CF-VR = Central African Republic
|CG|CG-11|CG-BZV|CG-8|CG-15|CG-2|CG-5|CG-7|CG-9|CG-14
|CG-12|CG-13 = Republic of the Congo
|CH|CH-AG|CH-AI|CH-AR|CH-BE|CH-BL|CH-BS|CH-FR|CH-GE
|CH-GL|CH-GR|CH-JU|CH-LU|CH-NE|CH-NW|CH-OW|CH-SG
|CH-SH|CH-SO|CH-SZ|CH-TG|CH-TI|CH-UR|CH-VD|CH-VS
|CH-ZG|CH-ZH = Switzerland
|CI|CI-16|CI-09|CI-10|CI-06|CI-02|CI-07|CI-01|CI-12|CI-05
|CI-11|CI-03|CI-15|CI-13|CI-04|CI-14|CI-08 = Ivory Coast
|CL|CL-RM|CL-TA|CL-AN|CL-AT|CL-CO|CL-VS|CL-LI|CL-ML|CL-BI
|CL-AR|CL-LL|CL-AI|CL-MA = Chile
|CM|CM-AD|CM-CE|CM-ES|CM-EN|CM-LT|CM-NO|CM-NW|CM-OU|CM-SU
|CM-SW = Cameroon
|CN|CN-34|CN-35|CN-62|CN-44|CN-52|CN-46|CN-13|CN-23|CN-41
|CN-42|CN-43|CN-32|CN-36|CN-22|CN-21|CN-63|CN-61|CN-37|CN-14
|CN-51|CN-53|CN-33|CN-45|CN-15|CN-64|CN-54|CN-65|CN-11|CN-50
|CN-31|CN-12|CN-91|CN-92 = China
|CN-71 = Taiwan
|CO|CO-DC|CO-AMA|CO-ANT|CO-ARA|CO-ATL|CO-BOL|CO-BOY|CO-CAL
|CO-CAQ|CO-CAS|CO-CAU|CO-CES|CO-CHO|CO-COR|CO-CUN|CO-GUA|CO-GUV
|CO-HUI|CO-LAG|CO-MAG|CO-MET|CO-NAR|CO-NSA|CO-PUT|CO-QUI|CO-RIS
|CO-SAP|CO-SAN|CO-SUC|CO-TOL|CO-VAC|CO-VAU|CO-VID = Colombia
|CR|CR-A|CR-C|CR-G|CR-H|CR-L|CR-P|CR-SJ = Costa Rica
|CS|CS-SR|CS-VO = Serbia
|CS-CG = Montenegro
|CS-KM = Kosovo
|CU|CU-01|CU-02|CU-03|CU-04|CU-05|CU-06|CU-07|CU-08|CU-09
|CU-10|CU-11|CU-12|CU-13|CU-14|CU-99 = Cuba
|CV|CV-BV|CV-BR|CV-MA|CV-MO|CV-PA|CV-PN|CV-PR|CV-RG|CV-SL
|CV-CA|CV-CR|CV-SD|CV-SF|CV-CS|CV-SN|CV-SV|CV-TA = Cape Verde
|CY|CY-03|CY-01|CY-04|CY-05|CY-02|CY-06 = Cyprus
|CZ|CZ-JC|CZ-JM|CZ-KA|CZ-KR|CZ-LI|CZ-MO|CZ-OL|CZ-PA|CZ-PL
|CZ-PR|CZ-ST|CZ-US|CZ-VY|CZ-ZL = Czech Republic
|DE = Germany
|DE-BE = Germany Berlin
|DE-BR = Germany Brandenburg
|DE-BW = Germany Baden-Württemberg
|DE-BY = Germany Bavaria
|DE-HB|DE-NI = Germany Lower Saxony
|DE-HE = Germany Hesse
|DE-HH = Germany Hamburg
|DE-MV = Germany Mecklenburg-Vorpommern
|DE-NW = Germany North Rhine-Westphalia
|DE-RP = Germany Rhineland-Palatinate
|DE-SH = Germany Schleswig-Holstein
|DE-SL = Germany Saarland
|DE-SN = Germany Saxony
|DE-ST = Germany Saxony-Anhalt
|DE-TH = Germany Thuringia
|DJ|DJ-AS|DJ-DI|DJ-DJ|DJ-OB|DJ-TA|DJ-AR = Djibouti
|DK|DK-015|DK-020|DK-025|DK-030|DK-035|DK-040|DK-042|DK-050
|DK-055|DK-060|DK-065|DK-070|DK-076|DK-080|DK-81|DK-82
|DK-83|DK-84|DK-85|DK-101|DK-147 = Denmark
|DM|DM-02|DM-03|DM-04|DM-05|DM-06|DM-07|DM-08|DM-09
|DM-10|DM-11 = Dominica
|DO|DO-02|DO-03|DO-04|DO-05|DO-01|DO-06|DO-07|DO-08|DO-09
|DO-30|DO-10|DO-11|DO-12|DO-13|DO-14|DO-28|DO-15|DO-29
|DO-16|DO-17|DO-18|DO-19|DO-20|DO-21|DO-22|DO-23|DO-24
|DO-25|DO-26|DO-27 = Dominican Republic
|DZ|DZ-01|DZ-44|DZ-46|DZ-16|DZ-23|DZ-05|DZ-08|DZ-06|DZ-07
|DZ-09|DZ-34|DZ-10|DZ-35|DZ-02|DZ-25|DZ-17|DZ-32|DZ-39|DZ-36
|DZ-47|DZ-24|DZ-33|DZ-18|DZ-40|DZ-03|DZ-26|DZ-43|DZ-27|DZ-29
|DZ-28|DZ-45|DZ-31|DZ-30|DZ-04|DZ-48|DZ-20 = Algeria
|EC|EC-A|EC-B|EC-C|EC-D|EC-E|EC-F|EC-G|EC-H|EC-I|EC-L|EC-M
|EC-N|EC-O|EC-P|EC-R|EC-S|EC-T|EC-U|EC-W|EC-X|EC-Y|EC-Z = Ecuador
|EE|EE-37|EE-39|EE-44|EE-49|EE-51|EE-57|EE-59|EE-65|EE-67
|EE-70|EE-74|EE-78|EE-82|EE-84|EE-86 = Estonia
|EG|EG-DK|EG-BA|EG-BH|EG-FYM|EG-GH|EG-ALX|EG-IS|EG-GZ|EG-MNF
|EG-MN|EG-C|EG-KB|EG-WAD|EG-SHR|EG-SUZ|EG-ASN|EG-AST|EG-BNS
|EG-PTS|EG-DT|EG-JS|EG-KFS|EG-MT|EG-KN|EG-SIN|EG-SHG = Egypt
|ER|ER-AN|ER-DK|ER-DU|ER-GB|ER-MA|ER-SK = Eritrea
|ES|ES-AN|ES-AR|ES-O|ES-IB|ES-PV|ES-EX|ES-GA|ES-CA|ES-S|ES-CM
|ES-CL|ES-CT|ES-LO|ES-M|ES-MU|ES-NA|ES-VC|ES-VI|ES-AB|ES-A
|ES-AL|ES-AV|ES-BA|ES-B|ES-BU|ES-CC|ES-S|ES-CS|ES-CR
|ES-CO|ES-CU|ES-GI|ES-GR|ES-GU|ES-SS|ES-H|ES-HU|ES-J|ES-C
|ES-LO|ES-LE|ES-L|ES-LU|ES-M|ES-MA|ES-MU|ES-NA|ES-OR
|ES-P|ES-PO|ES-SA|ES-SG|ES-SE|ES-SO|ES-T|ES-TE|ES-TO
|ES-V|ES-VA|ES-BI|ES-ZA|ES-Z = Spain
|ES-CN|ES-GC|ES-TF = Spain Canary Islands
|ES-CT = Spain Catalonia
|ES-O = Spain Asturias
|ET|ET-AA|ET-AF|ET-AM|ET-BE|ET-DD|ET-GA|ET-HA|ET-OR
|ET-SO|ET-SN|ET-TI = Ethiopia
|FI|FI-AL|FI-ES|FI-IS|FI-LL|FI-LS|FI-OL = Finland
|FJ|FJ-C|FJ-E|FJ-N|FJ-R|FJ-W = Fiji
|FK = Falkland Islands
|FO = Faroe Islands
|FR|FR-01|FR-02|FR-03|FR-04|FR-05|FR-06|FR-07|FR-08|FR-09
|FR-10|FR-11|FR-12|FR-13|FR-14|FR-15|FR-16|FR-17|FR-18
|FR-19|FR-21|FR-22|FR-23|FR-24|FR-25|FR-26|FR-27|FR-28
|FR-29|FR-30|FR-31|FR-32|FR-33|FR-34|FR-35
|FR-36|FR-37|FR-38|FR-39|FR-40|FR-41|FR-42|FR-43|FR-44
|FR-45|FR-46|FR-47|FR-48|FR-49|FR-50|FR-51|FR-52|FR-53
|FR-54|FR-55|FR-56|FR-57|FR-58|FR-59|FR-60|FR-61|FR-62
|FR-63|FR-64|FR-65|FR-66|FR-67|FR-68|FR-69|FR-70|FR-71
|FR-72|FR-73|FR-74|FR-75|FR-76|FR-77|FR-78|FR-79|FR-80
|FR-81|FR-82|FR-83|FR-84|FR-85|FR-86|FR-87|FR-88|FR-89
|FR-90|FR-91|FR-92|FR-93|FR-94|FR-95|FR-A|FR-B|FR-C|FR-D
|FR-E|FR-F|FR-G|FR-I|FR-J|FR-K|FR-L|FR-M|FR-N|FR-O
|FR-P|FR-Q|FR-R|FR-S|FR-T|FR-U|FR-V = France
|FR-GF = French Guiana
|FR-GP = Guadeloupe
|FR-H|FR-2A|FR-2B = France Corsica
|FR-MQ = Martinique
|FR-RE = Réunion
|GA|GA-1|GA-2|GA-3|GA-4|GA-5|GA-6|GA-7|GA-8|GA-9 = Gabon
|GB|GB-BGW|GB-BGE|GB-CAY|GB-CRF|GB-CMN|GB-CGN|GB-CWY|GB-DEN
|GB-FLN|GB-GWN|GB-AGY|GB-MTY|GB-MON|GB-NTL|GB-NWP|GB-PEM
|GB-POW|GB-RCT|GB-SWA|GB-TOF|GB-VGL|GB-WRX|GB-GSY|GB-JSY|GB-IOM = United Kingdom
|GB-BDG|GB-BNE|GB-BNS|GB-BAS|GB-BDF|GB-BEX|GB-BIR|GB-BBD
|GB-BPL|GB-BOL|GB-BMH|GB-BRC|GB-BRD|GB-BEN|GB-BNH|GB-BST|GB-BRY
|GB-BKM|GB-BUR|GB-CLD|GB-CAM|GB-CMD|GB-CHS|GB-CON|GB-COV|GB-CRY
|GB-CMA|GB-DAL|GB-DER|GB-DBY|GB-DEV|GB-DNC|GB-DOR|GB-DUD|GB-DUR
|GB-EAL|GB-ERY|GB-ESX|GB-ENF|GB-ESS|GB-GAT|GB-GLS|GB-GRE|GB-HCK
|GB-HAL|GB-HMF|GB-HAM|GB-HRY|GB-HRW|GB-HPL|GB-HAV|GB-HEF|GB-HRT
|GB-HIL|GB-HNS|GB-IOW|GB-IOS|GB-ISL|GB-KEC|GB-KEN|GB-KHL|GB-KTT
|GB-KIR|GB-KWL|GB-LBH|GB-LAN|GB-LDS|GB-LCE|GB-LEC|GB-LEW|GB-LIN
|GB-LIV|GB-LND|GB-LUT|GB-MAN|GB-MDW|GB-MRT|GB-MDB|GB-MIK|GB-NET
|GB-NWM|GB-NFK|GB-NEL|GB-NLN|GB-NSM|GB-NTY|GB-NYK|GB-NTH|GB-NBL
|GB-NGM|GB-NTT|GB-OLD|GB-OXF|GB-PTE|GB-PLY|GB-POL|GB-POR|GB-RDG
|GB-RDB|GB-RCC|GB-RIC|GB-RCH|GB-ROT|GB-RUT|GB-SHN|GB-SLF|GB-SAW
|GB-SFT|GB-SHF|GB-SHR|GB-SLG|GB-SOL|GB-SOM|GB-SGC|GB-STY|GB-STH
|GB-SOS|GB-SWK|GB-STS|GB-SKP|GB-STT|GB-STE|GB-SFK|GB-SND|GB-SRY
|GB-STN|GB-SWD|GB-TAM|GB-TFW|GB-THR|GB-TOB|GB-TWH|GB-TRF|GB-WKF
|GB-WLL|GB-WFT|GB-WND|GB-WRT|GB-WAR|GB-WBK|GB-WSX|GB-WSM|GB-WGN
|GB-WIL|GB-WNM|GB-WRL|GB-WOK|GB-WLV|GB-WOR|GB-YOR = UK England
|GB-ABE|GB-ABD|GB-ANS|GB-AGB|GB-CLK|GB-DGY|GB-DND|GB-EAY|GB-EDU
|GB-ELN|GB-ERW|GB-EDH|GB-ELS|GB-FAL|GB-FIF|GB-GLG|GB-HLD|GB-IVC
|GB-MLN|GB-MRY|GB-NAY|GB-NLK|GB-ORK|GB-PKN|GB-RFW|GB-SCB|GB-ZET
|GB-SAY|GB-SLK|GB-STG|GB-WDU|GB-WLN = UK Scotland
|GB-ANT|GB-ARD|GB-ARM|GB-BLA|GB-BLY|GB-BNB|GB-BFS|GB-CKF|GB-CSR
|GB-CLR|GB-CKT|GB-CGV|GB-DRY|GB-DOW|GB-DGN|GB-FER|GB-LRN|GB-LMV
|GB-LSB|GB-MFT|GB-MYL|GB-NYM|GB-NTA|GB-NDN|GB-OMH|GB-STB = Northern Ireland
|GD|GD-01|GD-02|GD-03|GD-04|GD-05|GD-06|GD-10 = Grenada
|GE|GE-AB|GE-AJ|GE-TB|GE-GU|GE-IM|GE-KA|GE-KK|GE-MM
|GE-RL|GE-SZ|GE-SJ|GE-SK = Georgia
|GF = French Guiana
|GH|GH-AH|GH-BA|GH-CP|GH-EP|GH-AA|GH-NP|GH-UE|GH-UW|GH-TV
|GH-WP = Ghana
|GL = Greenland
|GM|GM-C|GM-B|GM-L|GM-N|GM-U|GM-W = Gambia
|GN|GN-C|GN-B|GN-F|GN-K|GN-D|GN-L|GN-M|GN-N|GN-BE|GN-BF|GN-BK
|GN-CO|GN-DB|GN-DI|GN-DL|GN-DU|GN-FA|GN-FO|GN-FR|GN-GA|GN-GU|GN-KA
|GN-KB|GN-KD|GN-KE|GN-KN|GN-KO|GN-KS|GN-LA|GN-LE|GN-LO|GN-MC|GN-MD
|GN-ML|GN-MM|GN-NZ|GN-PI|GN-SI|GN-TE|GN-TO|GN-YO = Guinea
|GP = Guadeloupe
|GQ|GQ-AN|GQ-BN|GQ-BS|GQ-CS|GQ-KN|GQ-LI|GQ-WN = Equatorial Guinea
|GR|GR-13|GR-11|GR-12|GR-31|GR-01|GR-A1|GR-69|GR-03|GR-64
|GR-94|GR-85|GR-81|GR-52|GR-14|GR-04|GR-05|GR-71|GR-63|GR-51
|GR-53|GR-33|GR-91|GR-41|GR-56|GR-55|GR-23|GR-57|GR-22|GR-15
|GR-58|GR-82|GR-16|GR-42|GR-92|GR-24|GR-83|GR-43|GR-17|GR-59
|GR-06|GR-07|GR-61|GR-34|GR-93|GR-73|GR-84|GR-62|GR-32|GR-54
|GR-44|GR-72|GR-21 = Greece
|GT|GT-AV|GT-BV|GT-CM|GT-CQ|GT-PE|GT-PR|GT-QC|GT-ES|GT-GU
|GT-HU|GT-IZ|GT-JA|GT-JU|GT-QZ|GT-RE|GT-SA|GT-SM|GT-SR
|GT-SO|GT-SU|GT-TO|GT-ZA = Guatemala
|GW|GW-BA|GW-BM|GW-BS|GW-BL|GW-CA|GW-GA|GW-OI|GW-QU|GW-TO = Guinea-Bissau
|GY|GY-BA|GY-CU|GY-DE|GY-EB|GY-ES|GY-MA|GY-PM|GY-PT|GY-UD
|GY-UT = Guyana
|HN|HN-AT|HN-CH|HN-CL|HN-CM|HN-CP|HN-CR|HN-EP|HN-FM|HN-GD
|HN-IN|HN-IB|HN-LP|HN-LE|HN-OC|HN-OL|HN-SB|HN-VA|HN-YO = Honduras
|HR-01|HR-02|HR-03|HR-04|HR-05|HR-06|HR-07|HR-08|HR-09
|HR-10|HR-11|HR-12|HR-13|HR-14|HR-15|HR-16|HR-17|HR-18
|HR-19|HR-20|HR-21|HR = Croatia
|HT|HT-CE|HT-GA|HT-ND|HT-NE|HT-NO|HT-OU|HT-SD|HT-SE = Haiti
|HU|HU-BK|HU-BA|HU-BE|HU-BC|HU-BZ|HU-BU|HU-CS|HU-DE|HU-DU
|HU-EG|HU-FE|HU-GY|HU-GS|HU-HB|HU-HE|HU-HV|HU-JN|HU-KV|HU-KM
|HU-KE|HU-MI|HU-NK|HU-NO|HU-NY|HU-PS|HU-PE|HU-ST|HU-SO|HU-SN
|HU-SZ|HU-SD|HU-SF|HU-SS|HU-SK|HU-SH|HU-TB|HU-TO|HU-VA|HU-VM
|HU-VE|HU-ZA|HU-ZE = Hungary
|ID|ID-BA|ID-BB|ID-BT|ID-BE|ID-GO|ID-JA|ID-JB|ID-JT|ID-JI
|ID-KB|ID-KS|ID-KT|ID-KI|ID-KR|ID-LA|ID-MA|ID-MU|ID-NB|ID-NT
|ID-PA|ID-RI|ID-SR|ID-SN|ID-ST|ID-SG|ID-SA|ID-SB|ID-SS|ID-SU
|ID-AC|ID-JK|ID-YO = Indonesia
|IE|IE-CW|IE-CN|IE-CE|IE-C|IE-DL|IE-D|IE-G|IE-KY|IE-KE|IE-KK
|IE-LS|IE-LM|IE-LK|IE-LD|IE-LO|IE-MO|IE-MH|IE-MN|IE-OY|IE-RN
|IE-SO|IE-TA|IE-WD|IE-WH|IE-WX|IE-WW = Ireland
|IL|IL-D|IL-HA|IL-JM|IL-M|IL-TA|IL-Z = Israel
|IN|IN-AP|IN-AR|IN-AS|IN-BR|IN-CG|IN-GA|IN-GJ|IN-HR|IN-HP
|IN-JK|IN-JH|IN-KA|IN-KL|IN-MP|IN-MH|IN-MN|IN-ML|IN-MZ|IN-NL
|IN-OR|IN-PB|IN-RJ|IN-SK|IN-TR|IN-UA|IN-UP|IN-WB|IN-AN
|IN-CH|IN-DN|IN-DD|IN-DL|IN-LD|IN-PY = India
|IN-TN = India Tamil Nadu
|IS|IS-1|IS-6|IS-5|IS-7|IS-8|IS-2|IS-3|IS-4 = Iceland
|IQ|IQ-AN|IQ-AR|IQ-BB|IQ-BG|IQ-BA|IQ-DA|IQ-DQ|IQ-DI|IQ-KA
|IQ-MA|IQ-MU|IQ-NA|IQ-NI|IQ-QA|IQ-SD|IQ-SU|IQ-TS|IQ-WA = Iraq
|IR|IR-01|IR-02|IR-03|IR-04|IR-05|IR-06|IR-07|IR-08|IR-09
|IR-10|IR-11|IR-12|IR-13|IR-14|IR-15|IR-16|IR-17|IR-18|IR-19
|IR-20|IR-21|IR-22|IR-23|IR-24|IR-25|IR-26|IR-27|IR-28 = Iran
|IT|IT-65|IT-75|IT-23|IT-77|IT-45|IT-36|IT-78|IT-72|IT-62
|IT-42|IT-25|IT-57|IT-67|IT-21|IT-88|IT-82|IT-52|IT-32|IT-55
|IT-34|IT-AL|IT-AN|IT-AO|IT-AP|IT-AQ|IT-AR|IT-AT|IT-AV|IT-BA
|IT-BG|IT-BI|IT-BL|IT-BN|IT-BO|IT-BR|IT-BS|IT-BZ|IT-CA|IT-CB
|IT-CE|IT-CH|IT-CI|IT-CL|IT-CN|IT-CO|IT-CR|IT-CS|IT-CT|IT-CZ
|IT-EN|IT-FE|IT-FG|IT-FI|IT-FO|IT-FR|IT-GE|IT-GO|IT-GR|IT-IM
|IT-IS|IT-KR|IT-LC|IT-LE|IT-LI|IT-LO|IT-LT|IT-LU|IT-MC|IT-MD
|IT-ME|IT-MI|IT-MN|IT-MO|IT-MS|IT-MT|IT-NA|IT-NO|IT-NU|IT-OG
|IT-OR|IT-OT|IT-PA|IT-PC|IT-PD|IT-PE|IT-PG|IT-PI|IT-PN|IT-PO
|IT-PR|IT-PT|IT-PU|IT-PV|IT-PZ|IT-RA|IT-RC|IT-RE|IT-RG|IT-RI
|IT-RM|IT-RN|IT-RO|IT-SA|IT-SI|IT-SO|IT-SP|IT-SR|IT-SS|IT-SV
|IT-TA|IT-TE|IT-TN|IT-TO|IT-TP|IT-TR|IT-TS|IT-TV|IT-UD|IT-VA
|IT-VB|IT-VC|IT-VE|IT-VI|IT-VR|IT-VT|IT-VV = Italy
|JM|JM-13|JM-09|JM-01|JM-12|JM-04|JM-02|JM-06|JM-14|JM-11
|JM-08|JM-05|JM-03|JM-07|JM-10 = Jamaica
|JO = Jordan
|JP|JP-01|JP-02|JP-03|JP-04|JP-05|JP-06|JP-07|JP-08|JP-09
|JP-10|JP-11|JP-12|JP-13|JP-14|JP-15|JP-16|JP-17|JP-18
|JP-19|JP-20|JP-21|JP-22|JP-23|JP-24|JP-25|JP-26|JP-27
|JP-28|JP-29|JP-30|JP-31|JP-32|JP-33|JP-34|JP-35|JP-36
|JP-37|JP-38|JP-39|JP-40|JP-41|JP-42|JP-43|JP-44|JP-45
|JP-46|JP-47 = Japan
|KE|KE-200|KE-300|KE-400|KE-110|KE-500|KE-600|KE-700
|KE-900 = Kenya
|KG|KG-B|KG-GB|KG-J|KG-N|KG-O|KG-T|KG-C|KG-Y = Kyrgyzstan
|KH|KH-1|KH-2|KH-7|KH-8|KH-9|KH-3|KH-4|KH-5|KH-6|KH-10|KH-11
|KH-22|KH-15|KH-13|KH-14|KH-16|KH-17|KH-19|KH-20|KH-21|KH-23
|KH-24|KH-12|KH-18 = Cambodia
|KM|KM-A|KM-G|KM-M = Comoros
|KP|KP-CHA|KP-HAB|KP-HAN|KP-HWB|KP-HWN|KP-KAN|KP-PYB|KP-PYN
|KP-YAN|KP-KAE|KP-NAJ|KP-NAM|KP-PYO = North Korea
|KR|KR-26|KR-43|KR-44|KR-27|KR-30|KR-42|KR-29|KR-41|KR-47
|KR-48|KR-28|KR-49|KR-45|KR-46|KR-11|KR-31 = South Korea
|KW|KW-AH|KW-JA|KW-FA|KW-KU|KW-HW|KW-MU = Kuwait
|KZ|KZ-ALM|KZ-AKM|KZ-AKT|KZ-ATY|KZ-MAN|KZ-SEV|KZ-VOS|KZ-PAV
|KZ-KAR|KZ-KUS|KZ-KZY|KZ-ZHA|KZ-YUZ|KZ-ZAP = Kazakhstan
|LA|LA-AT|LA-BK|LA-BL|LA-CH|LA-HO|LA-KH|LA-LM|LA-LP|LA-OU
|LA-PH|LA-SL|LA-SV|LA-VI|LA-VT|LA-XA|LA-XE|LA-XI|LA-XN = Laos
|LB|LB-NL|LB-BA|LB-BI|LB-JL|LB-NA|LB-AS|LB-JA = Lebanon
|LI|LI-01|LI-02|LI-03|LI-04|LI-05|LI-06|LI-07|LI-08|LI-09
|LI-10|LI-11 = Liechtenstein
|LK|LK-52|LK-71|LK-81|LK-51|LK-11|LK-31|LK-12|LK-33|LK-41
|LK-13|LK-21|LK-92|LK-42|LK-61|LK-43|LK-22|LK-32|LK-82|LK-45
|LK-23|LK-72|LK-62|LK-91|LK-53|LK-44 = Sri Lanka
|LR|LR-BM|LR-BG|LR-GP|LR-CM|LR-GB|LR-GG|LR-GK|LR-LO|LR-MG
|LR-MY|LR-MO|LR-NI|LR-RI|LR-RG|LR-I = Liberia
|LS|LS-A|LS-B|LS-C|LS-D|LS-E|LS-F|LS-G|LS-H|LS-J|LS-K = Lesotho
|LT|LT-AL|LT-KU|LT-KL|LT-MR|LT-PN|LT-SA|LT-TA|LT-TE
|LT-UT|LT-VL = Lithuania
|LU|LU-D|LU-G|LU-L = Luxembourg
|LV|LV-AI|LV-AL|LV-BL|LV-BU|LV-CE|LV-DGV|LV-DA|LV-DO|LV-GU
|LV-JEL|LV-JL|LV-JUR|LV-KR|LV-KU|LV-LPX|LV-LE|LV-LM|LV-LU
|LV-MA|LV-OG|LV-PR|LV-REZ|LV-RE|LV-RIX|LV-RI|LV-SA|LV-TA
|LV-TU|LV-VK|LV-VM|LV-VE|LV-VEN = Latvia
|LY|LY-AJ|LY-BW|LY-BA|LY-BU|LY-HZ|LY-JA|LY-JI|LY-JU|LY-KF
|LY-MJ|LY-MB|LY-QB|LY-WA|LY-NQ|LY-ZA|LY-DR|LY-GD|LY-GR
|LY-GT|LY-MI|LY-MZ|LY-MQ|LY-NL|LY-SB|LY-SS|LY-SR|LY-TN
|LY-TB|LY-TM|LY-WD|LY-SH|LY-YJ = Libya
|MA|MA-09|MA-10|MA-05|MA-02|MA-08|MA-14|MA-15|MA-11|MA-06
|MA-04|MA-16|MA-07|MA-13|MA-12|MA-01|MA-03|MA-BES|MA-KHO|MA-SET
|MA-JDI|MA-SAF|MA-BOM|MA-FES|MA-SEF|MA-KEN|MA-SIK|MA-CAS|MA-ASZ
|MA-ESM|MA-GUE|MA-TNT|MA-TAT|MA-BOD|MA-LAA|MA-CHI|MA-KES|MA-ESI
|MA-MAR|MA-HAJ|MA-ERR|MA-IFR|MA-KHN|MA-MEK|MA-BER|MA-FIG|MA-JRA
|MA-NAD|MA-OUJ|MA-OUD|MA-KHE|MA-RBA|MA-AGD|MA-BAH|MA-MEL|MA-OUA
|MA-TAR|MA-TIZ|MA-AZI|MA-BEM|MA-CHE|MA-LAR|MA-TNG|MA-TET|MA-HOC
|MA-TAO|MA-TAZ = Morocco
|MD|MD-GA|MD-CU|MD-BA|MD-CA|MD-CH|MD-ED|MD-LA|MD-OR|MD-SO
|MD-TA|MD-TI|MD-UN|MD-SN = Moldova
|ME|ME-01|ME-02|ME-03|ME-04|ME-05|ME-06|ME-07|ME-08|ME-09
|ME-10|ME-11|ME-12|ME-13|ME-14|ME-15|ME-16|ME-17|ME-18
|ME-19|ME-20|ME-21 = Montenegro
|MG|MG-T|MG-D|MG-F|MG-M|MG-A|MG-U = Madagascar
|MH = Marshall islands
|MK = Macedonia
|ML|ML-BK0|ML-7|ML-1|ML-8|ML-2|ML-5|ML-4|ML-3|ML-6 = Mali
|MM|MM-14|MM-11|MM-12|MM-13|MM-15|MM-16|MM-17|MM-02|MM-07
|MM-03|MM-04|MM-01|MM-05|MM-06 = Myanmar
|MN|MN-073|MN-071|MN-069|MN-067|MN-039|MN-043|MN-041|MN-037
|MN-063|MN-061|MN-059|MN-065|MN-064|MN-035|MN-053|MN-055
|MN-049|MN-051|MN-047|MN-1|MN-046|MN-057 = Mongolia
|MP = Northern Mariana Islands
|MQ = Martinique
|MR|MR-07|MR-03|MR-05|MR-08|MR-04|MR-10|MR-01|MR-02|MR-12
|MR-NKC|MR-09|MR-11|MR-06 = Mauritania
|MT = Malta
|MU|MU-BR|MU-CU|MU-PU|MU-QB|MU-VP|MU-AG|MU-CC|MU-RO|MU-BL
|MU-FL|MU-GP|MU-MO|MU-PA|MU-PW|MU-PL|MU-RR|MU-SA = Mauritius
|MV = Maldives
|MW|MW-N|MW-S|MW-Z|MW-BA|MW-BL|MW-CK|MW-CR|MW-CT|MW-DE|MW-DO|MW-KR
|MW-KS|MW-LK|MW-LI|MW-MH|MW-MG|MW-MC|MW-MU|MW-MW|MW-MZ|MW-NB|MW-NK
|MW-NS|MW-NU|MW-NI|MW-PH|MW-RU|MW-SA|MW-TH|MW-ZO = Malawi
|MX|MX-AGU|MX-BCN|MX-BCS|MX-CAM|MX-CHP|MX-CHH|MX-COA|MX-COL
|MX-DIF|MX-DUR|MX-GUA|MX-GRO|MX-HID|MX-JAL|MX-MEX|MX-MIC
|MX-MOR|MX-NAY|MX-NLE|MX-OAX|MX-PUE|MX-QUE|MX-ROO|MX-SLP
|MX-SIN|MX-SON|MX-TAB|MX-TAM|MX-TLA|MX-VER|MX-YUC|MX-ZAC = Mexico
|MY|MY-01|MY-02|MY-03|MY-04|MY-05|MY-06|MY-08|MY-09|MY-07
|MY-12|MY-13|MY-10|MY-11|MY-14|MY-15|MY-16 = Malaysia
|MZ|MZ-P|MZ-G|MZ-I|MZ-B|MZ-MPM|MZ-L|MZ-N|MZ-A
|MZ-S|MZ-T|MZ-Q = Mozambique
|NA|NA-CA|NA-ER|NA-HA|NA-KA|NA-OK|NA-KH|NA-KU|NA-OW|NA-OH
|NA-OS|NA-ON|NA-OT|NA-OD = Namibia
|NE|NE-1|NE-2|NE-3|NE-4|NE-8|NE-5|NE-6|NE-7 = Niger
|NG|NG-AB|NG-AD|NG-AK|NG-AN|NG-BA|NG-BY|NG-BE|NG-BO|NG-CR
|NG-DE|NG-EB|NG-ED|NG-EK|NG-EN|NG-FC|NG-GO|NG-IM|NG-JI|NG-KD
|NG-KN|NG-KT|NG-KE|NG-KO|NG-KW|NG-LA|NG-NA|NG-NI|NG-OG|NG-ON
|NG-OS|NG-OY|NG-PL|NG-RI|NG-SO|NG-TA|NG-YO|NG-ZA = Nigeria
|NI|NI-AN|NI-AS|NI-BO|NI-CA|NI-CI|NI-CO|NI-ES|NI-GR|NI-JI
|NI-LE|NI-MD|NI-MN|NI-MS|NI-MT|NI-NS|NI-SJ|NI-RI = Nicaragua
|NL|NL-FL|NL-FR|NL-GR|NL-LI|NL-NB|NL-NH|NL-OV
|NL-ZH|NL-UT = Netherlands
|NL-DR = Netherlands Drenthe
|NL-GE = Netherlands Gelderland
|NL-UT = Netherlands Utrecht
|NO|NO-01|NO-02|NO-03|NO-04|NO-05|NO-06|NO-07|NO-08|NO-09|NO-10
|NO-11|NO-12|NO-14|NO-15|NO-16|NO-17|NO-18|NO-19|NO-20 = Norway
|NP|NP-BA|NP-BH|NP-DH|NP-GA|NP-JA|NP-KA|NP-KO|NP-LU|NP-MA
|NP-ME|NP-NA|NP-RA|NP-SA|NP-SE = Nepal
|NZ|NZ-AUK|NZ-BOP|NZ-CAN|NZ-GIS|NZ-HKB|NZ-MWT|NZ-MBH|NZ-NSN
|NZ-NTL|NZ-OTA|NZ-STL|NZ-TKI|NZ-TAS|NZ-WKO|NZ-WGN|NZ-WTC = New Zealand
|OM|OM-DA|OM-ZA|OM-SH|OM-BA|OM-JA|OM-MA|OM-MU|OM-WU = Oman
|PA|PA-1|PA-2|PA-3|PA-4|PA-5|PA-6|PA-Q|PA-7|PA-8|PA-9 = Panama
|PE|PE-AMA|PE-ANC|PE-APU|PE-ARE|PE-AYA|PE-CAJ|PE-CAL|PE-CUS
|PE-HUV|PE-HUC|PE-ICA|PE-JUN|PE-LAL|PE-LAM|PE-LIM|PE-LOR|PE-MDD
|PE-MOQ|PE-PAS|PE-PIU|PE-PUN|PE-SAM|PE-TAC|PE-TUM|PE-UCA = Peru
|PG|PG-CPM|PG-CPK|PG-EHG|PG-EBR|PG-ESW|PG-EPW|PG-GPK|PG-MPM
|PG-MRL|PG-MBA|PG-MPL|PG-NCD|PG-NIK|PG-NPP|PG-NSA|PG-SAN
|PG-SHM|PG-WPD|PG-WHM|PG-WBK = Papua New Guinea
|PH|PH-00|PH-01|PH-02|PH-03|PH-04|PH-05|PH-06|PH-07|PH-08
|PH-09|PH-10|PH-11|PH-12|PH-13|PH-14|PH-15|PH-ABR|PH-AGN|PH-AKL
|PH-ALB|PH-ANT|PH-APA|PH-AUR|PH-BAN|PH-BAS|PH-BEN|PH-BIL|PH-BOH
|PH-BTG|PH-BTN|PH-BUK|PH-BUL|PH-CAG|PH-CAM|PH-CAN|PH-CAP|PH-CAS
|PH-CAT|PH-CAV|PH-CEB|PH-COM|PH-DAO|PH-DAS|PH-DAV|PH-EAS|PH-GUI
|PH-IFU|PH-ILI|PH-ILN|PH-ILS|PH-ISA|PH-KAL|PH-LAG|PH-LAN|PH-LAS
|PH-LEY|PH-LUN|PH-MAD|PH-MAG|PH-MAS|PH-MDC|PH-MDR|PH-MOU|PH-MSC
|PH-MSR|PH-NCO|PH-NSA|PH-NEC|PH-NER|PH-NUE|PH-NUV|PH-PAM|PH-PAN
|PH-PLW|PH-QUE|PH-QUI|PH-RIZ|PH-ROM|PH-SAR|PH-SCO|PH-SIG|PH-SLE
|PH-SLU|PH-SOR|PH-SUK|PH-SUN|PH-SUR|PH-TAR|PH-TAW|PH-WSA|PH-ZAN
|PH-ZAS|PH-ZMB|PH-ZSI = Philippines
|PK|PK-BA|PK-IS|PK-JK|PK-NA|PK-NW|PK-PB|PK-SD|PK-TA = Pakistan
|PL|PL-WN|PL-WP|PL-SK|PL-PK|PL-MA|PL-KP|PL-LB|PL-LU|PL-LD
|PL-MZ|PL-DS|PL-OP|PL-PD|PL-PM|PL-SL|PL-ZP = Poland
|PS = Palestine
|PT|PT-01|PT-02|PT-03|PT-04|PT-05|PT-06|PT-07|PT-08|PT-09
|PT-10|PT-11|PT-12|PT-13|PT-14|PT-15|PT-16|PT-17|PT-18 = Portugal
|PT-20 = Portugal Azores
|PT-30 = Portugal Madeira
|PY|PY-16|PY-10|PY-13|PY-19|PY-5|PY-6|PY-14|PY-11|PY-1|PY-3
|PY-ASU|PY-4|PY-7|PY-8|PY-12|PY-9|PY-15|PY-2 = Paraguay
|QA = Qatar
|RE = Réunion
|RO|RO-B|RO-AB|RO-AR|RO-AG|RO-BC|RO-BH|RO-BN|RO-BT|RO-BR
|RO-BV|RO-BZ|RO-CS|RO-CL|RO-CJ|RO-CT|RO-CV|RO-DB|RO-DJ|RO-GL
|RO-GR|RO-GJ|RO-HR|RO-HD|RO-IL|RO-IS|RO-IF|RO-MM|RO-MH|RO-MS
|RO-NT|RO-OT|RO-PH|RO-SJ|RO-SM|RO-SB|RO-SV|RO-TR|RO-TM|RO-TL
|RO-VL|RO-VS|RO-VN = Romania
|RS|RS-00|RS-01|RS-02|RS-03|RS-04|RS-05|RS-06|RS-07|RS-08
|RS-09|RS-10|RS-11|RS-12|RS-13|RS-14|RS-15|RS-16|RS-17
|RS-18|RS-19|RS-20|RS-21|RS-22|RS-23|RS-24|RS-VO = Serbia
|RS-25|RS-26|RS-27|RS-28|RS-29|RS-KM = Kosovo
|RU|RU-AD|RU-AGB|RU-AMU|RU-AST|RU-BA|RU-BEL|RU-BRY|RU-BU
|RU-CE|RU-CHE|RU-CHI|RU-CU|RU-EVE|RU-IN|RU-IRK|RU-IVA
|RU-KAM|RU-KB|RU-KC|RU-KEM|RU-KGN|RU-KHA|RU-KHM|RU-KIR
|RU-KK|RU-KL|RU-KLU|RU-KO|RU-KOR|RU-KRS|RU-KYA|RU-MAG
|RU-ME|RU-MO|RU-MOV|RU-NEN|RU-NVS|RU-OMS|RU-ORE|RU-ORL
|RU-PER|RU-PNZ|RU-PSK|RU-ROS|RU-SA|RU-SAK|RU-SAM|RU-SAR
|RU-SE|RU-STA|RU-TA|RU-TAM|RU-TAY|RU-TUL|RU-TY|RU-TYU
|RU-UD|RU-ULY|RU-UOB|RU-VGG|RU-YAN|RU-YAR|RU-YEV = Russia
|RU-AL|RU-ALT = Russia Altai Krai
|RU-ARK = Russia Arkhangelsk Oblast
|RU-CHU = Russia Chukotka Autonomous Okrug
|RU-DA = Russia Dagestan
|RU-KOS = Russia Kostroma Oblast
|RU-KDA = Russia Krasnodar Krai
|RU-KGD = Russia Kaliningrad Oblast
|RU-KR = Russia Republic of Karelia
|RU-LEN = Russia Leningrad Oblast
|RU-LIP = Russia Lipetsk Oblast
|RU-MOS = Russia Moscow Oblast
|RU-MUR = Russia Murmansk Oblast
|RU-NIZ = Russia Nizhny Novgorod Oblast
|RU-NGR = Russia Novgorod Oblast
|RU-PRI = Russia Primorsky Krai
|RU-RYA = Russia Ryazanskaya Oblast
|RU-SMO = Russia Smolensk Oblast
|RU-SPE = Russia Saint Petersburg
|RU-SVE = Russia Sverdlovsk Oblast
|RU-TOM = Russia Tomsk Oblast
|RU-TVE = Russia Tver Oblast
|RU-VLA = Russia Vladimir Oblast
|RU-VLG = Russia Vologda Oblast
|RU-VOR = Russia Voronezh Oblast
|RW|RW-C|RW-I|RW-E|RW-D|RW-G|RW-B|RW-J|RW-F|RW-L|RW-K
|RW-H|RW-M = Rwanda
|SA = Saudi Arabia
|SC|SC-01|SC-02|SC-03|SC-04|SC-05|SC-06|SC-07|SC-08|SC-09
|SC-10|SC-11|SC-12|SC-13|SC-14|SC-15|SC-16|SC-17|SC-18
|SC-19|SC-20|SC-21|SC-22|SC-23 = Seychelles
|SD|SD-23|SD-26|SD-18|SD-03|SD-07|SD-17|SD-06|SD-22|SD-08
|SD-24|SD-01|SD-11|SD-13|SD-20|SD-14|SD-12|SD-10|SD-16|SD-05
|SD-04|SD-25|SD-15|SD-02|SD-09|SD-19|SD-21 = Sudan
|SE|SE-K|SE-W|SE-I|SE-X|SE-N|SE-Z|SE-F|SE-H|SE-G|SE-BD
|SE-M|SE-AB|SE-D|SE-C|SE-S|SE-AC|SE-Y|SE-U|SE-O|SE-T|SE-E = Sweden
|SI|SI-001|SI-002|SI-148|SI-149|SI-003|SI-150|SI-004|SI-005
|SI-006|SI-151|SI-007|SI-009|SI-008|SI-152|SI-011|SI-012|SI-013
|SI-014|SI-153|SI-015|SI-016|SI-017|SI-018|SI-019|SI-154|SI-020
|SI-155|SI-021|SI-156|SI-022|SI-157|SI-023|SI-024|SI-025|SI-026
|SI-027|SI-028|SI-029|SI-030|SI-031|SI-158|SI-032|SI-159|SI-160
|SI-161|SI-162|SI-034|SI-035|SI-036|SI-037|SI-038|SI-039|SI-040
|SI-041|SI-163|SI-042|SI-043|SI-044|SI-045|SI-046|SI-047|SI-048
|SI-049|SI-164|SI-050|SI-165|SI-051|SI-052|SI-053|SI-166|SI-054
|SI-055|SI-056|SI-057|SI-058|SI-059|SI-060|SI-061|SI-062|SI-063
|SI-064|SI-065|SI-066|SI-167|SI-067|SI-068|SI-069|SI-070|SI-168
|SI-071|SI-072|SI-073|SI-074|SI-169|SI-075|SI-170|SI-076|SI-077
|SI-078|SI-079|SI-080|SI-081|SI-082|SI-083|SI-084|SI-085|SI-086
|SI-171|SI-087|SI-088|SI-089|SI-090|SI-091|SI-092|SI-172|SI-093
|SI-173|SI-094|SI-174|SI-095|SI-175|SI-096|SI-097|SI-098|SI-099
|SI-100|SI-101|SI-102|SI-103|SI-176|SI-104|SI-177|SI-106|SI-105
|SI-107|SI-108|SI-033|SI-178|SI-109|SI-183|SI-117|SI-118|SI-119
|SI-120|SI-110|SI-111|SI-121|SI-122|SI-123|SI-112|SI-113|SI-114
|SI-124|SI-125|SI-194|SI-179|SI-180|SI-126|SI-115|SI-127|SI-181
|SI-182|SI-116|SI-184|SI-010|SI-128|SI-129|SI-130|SI-185|SI-131
|SI-186|SI-132|SI-133|SI-187|SI-134|SI-188|SI-135|SI-136|SI-137
|SI-138|SI-139|SI-189|SI-140|SI-141|SI-142|SI-190|SI-143|SI-146
|SI-191|SI-147|SI-192|SI-144|SI-193 = Slovenia
|SJ = Svalbard
|SK|SK-BC|SK-BL|SK-KI|SK-NJ|SK-PV|SK-TC|SK-TA|SK-ZI = Slovakia
|SL|SL-E|SL-N|SL-S|SL-W = Sierra Leone
|SN|SN-DB|SN-DK|SN-FK|SN-KL|SN-KD|SN-LG|SN-MT|SN-SL
|SN-TC|SN-TH|SN-ZG = Senegal
|SO|SO-AD|SO-BK|SO-BN|SO-BR|SO-BY|SO-GG|SO-GD|SO-HR|SO-JD
|SO-JH|SO-MD|SO-NG|SO-SG|SO-SD|SO-SH|SO-SL|SO-TG|SO-WG = Somalia
|SR|SR-BR|SR-CM|SR-CR|SR-MA|SR-NI|SR-PR|SR-PM|SR-SA
|SR-SI|SR-WA = Suriname
|ST|ST-P|ST-S = São Tomé and Príncipe
|SV|SV-AH|SV-CA|SV-CH|SV-CU|SV-LI|SV-PA|SV-UN|SV-MO|SV-SM
|SV-SS|SV-SV|SV-SA|SV-SO|SV-US = El Salvador
|SY|SY-HA|SY-QU|SY-HL|SY-RA|SY-SU|SY-DY|SY-DI|SY-DR|SY-HM
|SY-HI|SY-ID|SY-LA|SY-RD|SY-TA = Syria
|SZ|SZ-HH|SZ-LU|SZ-MA|SZ-SH = Swaziland
|TD|TD-BA|TD-BI|TD-BET|TD-CB|TD-GR|TD-KA|TD-LC|TD-LR|TD-LO
|TD-MK|TD-MC|TD-OD|TD-SA|TD-TA = Chad
|TG|TG-C|TG-K|TG-M|TG-P|TG-S = Togo
|TH|TH-10|TH-11|TH-12|TH-13|TH-14|TH-15|TH-16|TH-17|TH-18
|TH-19|TH-20|TH-21|TH-22|TH-23|TH-24|TH-25|TH-26|TH-27|TH-30
|TH-31|TH-32|TH-33|TH-34|TH-35|TH-36|TH-37|TH-39|TH-40|TH-41
|TH-42|TH-43|TH-44|TH-45|TH-46|TH-47|TH-48|TH-49|TH-50|TH-51
|TH-52|TH-53|TH-54|TH-55|TH-56|TH-57|TH-58|TH-60|TH-61|TH-62
|TH-63|TH-64|TH-65|TH-66|TH-67|TH-70|TH-71|TH-72|TH-73|TH-74
|TH-75|TH-76|TH-77|TH-80|TH-81|TH-82|TH-83|TH-84|TH-85|TH-86
|TH-90|TH-91|TH-92|TH-93|TH-94|TH-95|TH-96|TH-S = Thailand
|TJ|TJ-GB|TJ-KT|TJ-SU = Tajikistan
|TL|TL-AL|TL-AN|TL-BA|TL-BO|TL-CO|TL-DI|TL-ER|TL-LA|TL-LI
|TL-MT|TL-MF|TL-OE|TL-VI = East Timor
|TM|TM-A|TM-B|TM-D|TM-L|TM-M = Turkmenistan
|TN|TN-12|TN-31|TN-13|TN-23|TN-71|TN-81|TN-32|TN-41|TN-42
|TN-73|TN-33|TN-53|TN-14|TN-82|TN-52|TN-21|TN-61|TN-43
|TN-34|TN-51|TN-83|TN-72|TN-11|TN-22 = Tunisia
|TR|TR-01|TR-02|TR-03|TR-04|TR-05|TR-06|TR-07|TR-08|TR-09|TR-10
|TR-11|TR-12|TR-13|TR-14|TR-15|TR-16|TR-17|TR-18|TR-19|TR-20
|TR-21|TR-22|TR-23|TR-24|TR-25|TR-26|TR-27|TR-28|TR-29|TR-30
|TR-31|TR-32|TR-33|TR-34|TR-35|TR-36|TR-37|TR-38|TR-39|TR-40
|TR-41|TR-42|TR-43|TR-44|TR-45|TR-46|TR-47|TR-48|TR-49|TR-50
|TR-51|TR-52|TR-53|TR-54|TR-55|TR-56|TR-57|TR-58|TR-59|TR-60
|TR-61|TR-62|TR-63|TR-64|TR-65|TR-66|TR-67|TR-68|TR-69|TR-70
|TR-71|TR-72|TR-73|TR-74|TR-75|TR-76|TR-77|TR-78|TR-79|TR-80
|TR-81 = Turkey
|TT|TT-ARI|TT-CHA|TT-CTT|TT-DMN|TT-ETO|TT-RCM|TT-PED|TT-PTF
|TT-POS|TT-PRT|TT-SFO|TT-SGE|TT-SJL|TT-SIP|TT-TUP|TT-WTO = Trinidad and Tobago
|TW = Taiwan
|TZ|TZ-01|TZ-02|TZ-03|TZ-04|TZ-05|TZ-08|TZ-09|TZ-12|TZ-13
|TZ-26|TZ-14|TZ-16|TZ-17|TZ-18|TZ-06|TZ-10|TZ-20|TZ-19|TZ-21
|TZ-22|TZ-23|TZ-24|TZ-25|TZ-11|TZ-07|TZ-15 = Tanzania
|UA|UA-63|UA-65|UA-68|UA-77|UA-12|UA-14|UA-26|UA-30|UA-32
|UA-35|UA-46|UA-09|UA-48|UA-51|UA-53|UA-19|UA-23|UA-18
|UA-40|UA-59|UA-61|UA-21|UA-71|UA-74|UA-05|UA-07 = Ukraine
|UA-43 = Ukraine Crimea
|UG|UG-ADJ|UG-APC|UG-ARU|UG-BSH|UG-BUG|UG-BUN|UG-BUS|UG-GUL
|UG-HOI|UG-IGA|UG-JIN|UG-KAB|UG-KAL|UG-KAM|UG-KAN|UG-KAR|UG-KAS
|UG-KAY|UG-KBA|UG-KBL|UG-KIB|UG-KIS|UG-KIT|UG-KML|UG-KMP|UG-KOT
|UG-KPC|UG-KTK|UG-KUM|UG-KYE|UG-LIR|UG-LUW|UG-MAS|UG-MAY|UG-MBA
|UG-MBR|UG-MOY|UG-MPI|UG-MRT|UG-MSN|UG-MUB|UG-MUK|UG-NAK|UG-NEB
|UG-NKS|UG-NTU|UG-PAD|UG-PAL|UG-RAK|UG-RUK|UG-SEM|UG-SIR|UG-SOR
|UG-TOR|UG-WAK|UG-YUM = Uganda<!--unvollständig, siehe [[ISO 3166-2:UG]]-->
|US|US-DC = USA
|US-AK = USA Alaska
|US-AL = USA Alabama
|US-AR = USA Arkansas
|US-AZ = USA Arizona
|US-CA = USA California
|US-CO = USA Colorado
|US-CT = USA Connecticut
|US-DE = USA Delaware
|US-FL = USA Florida
|US-GA = USA Georgia
|US-GU = USA Guam
|US-HI = USA Hawaii
|US-IA = USA Iowa
|US-ID = USA Idaho
|US-IL = USA Illinois
|US-IN = USA Indiana
|US-KS = USA Kansas
|US-KY = USA Kentucky
|US-LA = USA Louisiana
|US-MA = USA Massachusetts
|US-MD = USA Maryland
|US-ME = USA Maine
|US-MI = USA Michigan
|US-MN = USA Minnesota
|US-MO = USA Missouri
|US-MS = USA Mississippi
|US-MT = USA Montana
|US-NC = USA North Carolina
|US-ND = USA North Dakota
|US-NE = USA Nebraska
|US-NH = USA New Hampshire
|US-NJ = USA New Jersey
|US-NM = USA New Mexico
|US-NV = USA Nevada
|US-NY = USA New York
|US-OH = USA Ohio
|US-OK = USA Oklahoma
|US-OR = USA Oregon
|US-PA = USA Pennsylvania
|US-PR = USA Puerto Rico
|US-RI = USA Rhode Island
|US-SC = USA South Carolina
|US-SD = USA South Dakota
|US-TN = USA Tennessee
|US-TX = USA Texas
|US-UT = USA Utah
|US-VA = USA Virginia
|US-VI = USA Virgin Islands
|US-VT = USA Vermont
|US-WA = USA Washington
|US-WI = USA Wisconsin
|US-WV = USA West Virginia
|US-WY = USA Wyoming
|UY|UY-AR|UY-CA|UY-CL|UY-CO|UY-DU|UY-FS|UY-FD|UY-LA|UY-MA|UY-MO
|UY-PA|UY-RN|UY-RV|UY-RO|UY-SA|UY-SJ|UY-SO|UY-TA|UY-TT = Uruguay
|UZ|UZ-AN|UZ-BU|UZ-FA|UZ-JI|UZ-NG|UZ-NW|UZ-QA|UZ-QR|UZ-SA
|UZ-SI|UZ-SU|UZ-TK|UZ-TO|UZ-XO = Uzbekistan
|VE|VE-B|VE-Z|VE-C|VE-D|VE-E|VE-F|VE-G|VE-H|VE-Y|VE-W|VE-A
|VE-I|VE-J|VE-K|VE-L|VE-M|VE-N|VE-O|VE-P|VE-R|VE-S|VE-T
|VE-X|VE-U|VE-V = Venezuela
|VN|VN-44|VN-43|VN-53|VN-54|VN-55|VN-56|VN-50|VN-31|VN-57
|VN-58|VN-40|VN-59|VN-48|VN-04|VN-60|VN-33|VN-72|VN-71|VN-39
|VN-45|VN-30|VN-03|VN-63|VN-64|VN-15|VN-23|VN-61|VN-62|VN-73
|VN-65|VN-14|VN-66|VN-34|VN-47|VN-28|VN-01|VN-35|VN-09|VN-02
|VN-41|VN-67|VN-22|VN-18|VN-36|VN-68|VN-32|VN-24|VN-27|VN-29
|VN-13|VN-25|VN-52|VN-05|VN-37|VN-20|VN-69|VN-21|VN-26|VN-46
|VN-51|VN-07|VN-49|VN-70|VN-06 = Vietnam
|VU|VU-MAP|VU-PAM|VU-SAM|VU-SEE|VU-TAE|VU-TOB = Vanuatu
|YE|YE-AB|YE-DA|YE-BA|YE-HU|YE-JA|YE-MR|YE-MW|YE-AD|YE-AM|YE-DH
|YE-HD|YE-HJ|YE-IB|YE-LA|YE-MA|YE-SN|YE-SD|YE-SH|YE-TA = Yemen
|ZA|ZA-FS|ZA-GT|ZA-EC|ZA-NL|ZA-LP|ZA-MP|ZA-NC|ZA-NW|ZA-WC = South Africa
|ZM|ZM-08|ZM-04|ZM-09|ZM-05|ZM-06|ZM-03|ZM-07|ZM-01|ZM-02 = Zambia
|ZW|ZW-BU|ZW-HA|ZW-MA|ZW-MC|ZW-ME|ZW-MW|ZW-MV|ZW-MN
|ZW-MS|ZW-MI = Zimbabwe
<includeonly>}}</includeonly><noinclude></poem></noinclude>
rznwtpfcujq3jyjb7mnozhxbidox7pg
74829
74828
2026-08-24T00:22:10Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_Berg/map]]
74828
wikitext
text/x-wiki
<noinclude>
In the following list please adhere to the alphabetic order as per the [[ISO 3166-2|ISO 3166-2-Code]].
<poem></noinclude><includeonly>{{{{{|safesubst:}}}#switch: {{{1}}}
|#default = </includeonly>
|AD|AD-02|AD-03|AD-04|AD-05|AD-06|AD-07|AD-08 = Andorra
|AE|AE-AZ|AE-AJ|AE-DU|AE-FU|AE-RK|AE-SH|AE-UQ = United Arab Emirates
|AF|AF-BAL|AF-BAM|AF-BDG|AF-BDS|AF-BGL|AF-DAY|AF-FRA
|AF-FYB|AF-GHA|AF-GHO|AF-HEL|AF-HER|AF-JOW|AF-KAB|AF-KAN
|AF-KAP|AF-KDZ|AF-KHO|AF-KNR|AF-LAG|AF-LOW|AF-NAN|AF-NIM
|AF-NUR|AF-ORU|AF-PAN|AF-PAR|AF-PIA|AF-PKA|AF-SAM|AF-SAR
|AF-TAK|AF-WAR|AF-ZAB = Afghanistan
|AG = Antigua and Barbuda
|AL|AL-BR|AL-BU|AL-DL|AL-DV|AL-DI|AL-DR|AL-EL|AL-FR|AL-GJ
|AL-GR|AL-HA|AL-KA|AL-ER|AL-KO|AL-KR|AL-KC|AL-KU|AL-KB|AL-LE
|AL-LB|AL-LU|AL-MM|AL-MK|AL-MT|AL-MR|AL-PQ|AL-PR|AL-PG|AL-PU
|AL-SR|AL-SK|AL-SH|AL-TE|AL-TR|AL-TP|AL-VL = Albania
|AM|AM-AG|AM-AR|AM-AV|AM-ER|AM-GR|AM-KT|AM-LO|AM-SH|AM-SU
|AM-TV|AM-VD = Armenia
|AO|AO-BGO|AO-BGU|AO-BIE|AO-CAB|AO-CCU|AO-CNO|AO-CUS|AO-CNN
|AO-HUA|AO-HUI|AO-LUA|AO-LNO|AO-LSU|AO-MAL|AO-MOX|AO-NAM
|AO-UIG|AO-ZAI = Angola
|AQ = Antarctica
|AR|AR-C|AR-B|AR-K|AR-H|AR-U|AR-X|AR-W|AR-E|AR-P|AR-Y|AR-L
|AR-F|AR-M|AR-N|AR-Q|AR-R|AR-A|AR-J|AR-D|AR-Z|AR-S|AR-G
|AR-V|AR-T = Argentina
|AT|AT-1|AT-2|AT-3|AT-4|AT-5|AT-6|AT-7|AT-8|AT-9 = Austria
|AU|AU-ACT|AU-CT|AU-JBT|AU-JT = Australia
|AU-NS|AU-NSW = Australia New South Wales
|AU-NT = Australia Northern Territory
|AU-QL|AU-QLD = Australia Queensland
|AU-SA = Australia South Australia
|AU-TAS|AU-TS = Australia Tasmania
|AU-VI|AU-VIC = Australia Victoria
|AU-WA = Australia Western Australia
|AW|AW-AUA|AW-BAR|AW-BUS|AW-DEU|AW-ORJ|AW-SNL = Aruba
|AZ = Azerbaijan
|BA|BA-BIH|BA-SRP = Bosnia and Herzegovina
|BB = Barbados
|BD|BD-05|BD-01|BD-02|BD-06|BD-07|BD-03|BD-04|BD-09|BD-10
|BD-12|BD-11|BD-13|BD-14|BD-15|BD-16|BD-19|BD-18|BD-17|BD-20
|BD-24|BD-21|BD-22|BD-25|BD-23|BD-29|BD-27|BD-26|BD-08|BD-28
|BD-30|BD-31|BD-32|BD-36|BD-37|BD-33|BD-39|BD-38|BD-35|BD-34
|BD-48|BD-43|BD-40|BD-42|BD-44|BD-45|BD-41|BD-46|BD-47|BD-49
|BD-52|BD-51|BD-50|BD-53|BD-54|BD-56|BD-55|BD-58|BD-62|BD-57
|BD-59|BD-61|BD-60|BD-63|BD-64 = Bangladesh
|BE|BE-BRU|BE-VAN|BE-VBR|BE-VLG|BE-VOV|BE-VWV|BE-WAL
|BE-WBR|BE-WHT|BE-WLG|BE-VLI|BE-WLX|BE-WNA = Belgium
|BF|BF-BAL|BF-BAM|BF-BAN|BF-BAZ|BF-BGR|BF-BLG|BF-BLK|BF-COM
|BF-GAN|BF-GNA|BF-GOU|BF-HOU|BF-IOB|BF-KAD|BF-KEN|BF-KMD
|BF-KMP|BF-KOP|BF-KOS|BF-KOT|BF-KOW|BF-LER|BF-LOR|BF-MOU
|BF-NAM|BF-NAO|BF-NAY|BF-NOU|BF-OUB|BF-OUD|BF-PAS|BF-PON
|BF-SEN|BF-SIS|BF-SMT|BF-SNG|BF-SOM|BF-SOR|BF-TAP|BF-TUI
|BF-YAG|BF-YAT|BF-ZIR|BF-ZON|BF-ZOU = Burkina Faso
|BG|BG-01|BG-02|BG-03|BG-04|BG-05|BG-06|BG-07|BG-08|BG-09
|BG-10|BG-11|BG-12|BG-13|BG-14|BG-15|BG-16|BG-17|BG-18
|BG-19|BG-20|BG-21|BG-22|BG-23|BG-24|BG-25|BG-26|BG-27
|BG-28 = Bulgaria
|BH|BH-13|BH-14|BH-15|BH-16|BH-17 = Bahrain
|BI|BI-BB|BI-BJ|BI-BR|BI-CA|BI-CI|BI-GI|BI-KR|BI-KY|BI-KI
|BI-MA|BI-MU|BI-MY|BI-MW|BI-NG|BI-RT|BI-RY = Burundi
|BJ|BJ-AL|BJ-AK|BJ-AQ|BJ-BO|BJ-CO|BJ-KO|BJ-DO|BJ-LI|BJ-MO
|BJ-OU|BJ-PL|BJ-ZO = Benin
|BN|BN-BE|BN-BM|BN-TE|BN-TU = Brunei
|BO|BO-B|BO-H|BO-C|BO-L|BO-O|BO-N|BO-P|BO-S|BO-T = Bolivia
|BR|BR-AC|BR-AL|BR-AM|BR-AP|BR-BA|BR-CE|BR-DF|BR-ES|BR-GO
|BR-MA|BR-MG|BR-MS|BR-MT|BR-PA|BR-PB|BR-PE|BR-PI|BR-PR|BR-RJ
|BR-RN|BR-RO|BR-RR|BR-RS|BR-SC|BR-SE|BR-SP|BR-TO = Brazil
|BS|BS-AC|BS-BI|BS-CI|BS-EX|BS-FP|BS-FC|BS-GH|BS-GT|BS-HI
|BS-HR|BS-IN|BS-KB|BS-LI|BS-MH|BS-MG|BS-NP|BS-NB|BS-RI
|BS-RS|BS-SP|BS-SR = Bahamas
|BT|BT-33|BT-12|BT-22|BT-GA|BT-13|BT-44|BT-42|BT-11|BT-43
|BT-23|BT-45|BT-14|BT-31|BT-15|BT-41|BT-TY|BT-32|BT-21
|BT-24|BT-34 = Bhutan
|BW|BW-GH|BW-KG|BW-KL|BW-KW|BW-NE|BW-NW|BW-SE|BW-SO = Botswana
|BY|BY-BR|BY-HO|BY-HR|BY-MA|BY-MI|BY-VI = Belarus
|BZ|BZ-BZ|BZ-CY|BZ-CZL|BZ-OW|BZ-SC|BZ-TOL = Belize
|CA|CA-AB|CA-NB|CA-NL|CA-NS|CA-NT|CA-NU|CA-ON|CA-PE|CA-QC
|CA-YU|CA-YT = Canada
|CA-BC = Canada British Columbia
|CA-MB = Canada Manitoba
|CA-SK = Canada Saskatchewan
|CD|CD-BN|CD-BC|CD-EQ|CD-KA|CD-KW|CD-KE|CD-KN|CD-MA|CD-NK
|CD-OR|CD-SK = Democratic Republic of the Congo
|CF|CF-BB|CF-BGF|CF-BK|CF-HM|CF-HK|CF-KG|CF-LB|CF-HS|CF-MB
|CF-KB|CF-NM|CF-MP|CF-UK|CF-AC|CF-OP|CF-SE|CF-VR = Central African Republic
|CG|CG-11|CG-BZV|CG-8|CG-15|CG-2|CG-5|CG-7|CG-9|CG-14
|CG-12|CG-13 = Republic of the Congo
|CH|CH-AG|CH-AI|CH-AR|CH-BE|CH-BL|CH-BS|CH-FR|CH-GE
|CH-GL|CH-GR|CH-JU|CH-LU|CH-NE|CH-NW|CH-OW|CH-SG
|CH-SH|CH-SO|CH-SZ|CH-TG|CH-TI|CH-UR|CH-VD|CH-VS
|CH-ZG|CH-ZH = Switzerland
|CI|CI-16|CI-09|CI-10|CI-06|CI-02|CI-07|CI-01|CI-12|CI-05
|CI-11|CI-03|CI-15|CI-13|CI-04|CI-14|CI-08 = Ivory Coast
|CL|CL-RM|CL-TA|CL-AN|CL-AT|CL-CO|CL-VS|CL-LI|CL-ML|CL-BI
|CL-AR|CL-LL|CL-AI|CL-MA = Chile
|CM|CM-AD|CM-CE|CM-ES|CM-EN|CM-LT|CM-NO|CM-NW|CM-OU|CM-SU
|CM-SW = Cameroon
|CN|CN-34|CN-35|CN-62|CN-44|CN-52|CN-46|CN-13|CN-23|CN-41
|CN-42|CN-43|CN-32|CN-36|CN-22|CN-21|CN-63|CN-61|CN-37|CN-14
|CN-51|CN-53|CN-33|CN-45|CN-15|CN-64|CN-54|CN-65|CN-11|CN-50
|CN-31|CN-12|CN-91|CN-92 = China
|CN-71 = Taiwan
|CO|CO-DC|CO-AMA|CO-ANT|CO-ARA|CO-ATL|CO-BOL|CO-BOY|CO-CAL
|CO-CAQ|CO-CAS|CO-CAU|CO-CES|CO-CHO|CO-COR|CO-CUN|CO-GUA|CO-GUV
|CO-HUI|CO-LAG|CO-MAG|CO-MET|CO-NAR|CO-NSA|CO-PUT|CO-QUI|CO-RIS
|CO-SAP|CO-SAN|CO-SUC|CO-TOL|CO-VAC|CO-VAU|CO-VID = Colombia
|CR|CR-A|CR-C|CR-G|CR-H|CR-L|CR-P|CR-SJ = Costa Rica
|CS|CS-SR|CS-VO = Serbia
|CS-CG = Montenegro
|CS-KM = Kosovo
|CU|CU-01|CU-02|CU-03|CU-04|CU-05|CU-06|CU-07|CU-08|CU-09
|CU-10|CU-11|CU-12|CU-13|CU-14|CU-99 = Cuba
|CV|CV-BV|CV-BR|CV-MA|CV-MO|CV-PA|CV-PN|CV-PR|CV-RG|CV-SL
|CV-CA|CV-CR|CV-SD|CV-SF|CV-CS|CV-SN|CV-SV|CV-TA = Cape Verde
|CY|CY-03|CY-01|CY-04|CY-05|CY-02|CY-06 = Cyprus
|CZ|CZ-JC|CZ-JM|CZ-KA|CZ-KR|CZ-LI|CZ-MO|CZ-OL|CZ-PA|CZ-PL
|CZ-PR|CZ-ST|CZ-US|CZ-VY|CZ-ZL = Czech Republic
|DE = Germany
|DE-BE = Germany Berlin
|DE-BR = Germany Brandenburg
|DE-BW = Germany Baden-Württemberg
|DE-BY = Germany Bavaria
|DE-HB|DE-NI = Germany Lower Saxony
|DE-HE = Germany Hesse
|DE-HH = Germany Hamburg
|DE-MV = Germany Mecklenburg-Vorpommern
|DE-NW = Germany North Rhine-Westphalia
|DE-RP = Germany Rhineland-Palatinate
|DE-SH = Germany Schleswig-Holstein
|DE-SL = Germany Saarland
|DE-SN = Germany Saxony
|DE-ST = Germany Saxony-Anhalt
|DE-TH = Germany Thuringia
|DJ|DJ-AS|DJ-DI|DJ-DJ|DJ-OB|DJ-TA|DJ-AR = Djibouti
|DK|DK-015|DK-020|DK-025|DK-030|DK-035|DK-040|DK-042|DK-050
|DK-055|DK-060|DK-065|DK-070|DK-076|DK-080|DK-81|DK-82
|DK-83|DK-84|DK-85|DK-101|DK-147 = Denmark
|DM|DM-02|DM-03|DM-04|DM-05|DM-06|DM-07|DM-08|DM-09
|DM-10|DM-11 = Dominica
|DO|DO-02|DO-03|DO-04|DO-05|DO-01|DO-06|DO-07|DO-08|DO-09
|DO-30|DO-10|DO-11|DO-12|DO-13|DO-14|DO-28|DO-15|DO-29
|DO-16|DO-17|DO-18|DO-19|DO-20|DO-21|DO-22|DO-23|DO-24
|DO-25|DO-26|DO-27 = Dominican Republic
|DZ|DZ-01|DZ-44|DZ-46|DZ-16|DZ-23|DZ-05|DZ-08|DZ-06|DZ-07
|DZ-09|DZ-34|DZ-10|DZ-35|DZ-02|DZ-25|DZ-17|DZ-32|DZ-39|DZ-36
|DZ-47|DZ-24|DZ-33|DZ-18|DZ-40|DZ-03|DZ-26|DZ-43|DZ-27|DZ-29
|DZ-28|DZ-45|DZ-31|DZ-30|DZ-04|DZ-48|DZ-20 = Algeria
|EC|EC-A|EC-B|EC-C|EC-D|EC-E|EC-F|EC-G|EC-H|EC-I|EC-L|EC-M
|EC-N|EC-O|EC-P|EC-R|EC-S|EC-T|EC-U|EC-W|EC-X|EC-Y|EC-Z = Ecuador
|EE|EE-37|EE-39|EE-44|EE-49|EE-51|EE-57|EE-59|EE-65|EE-67
|EE-70|EE-74|EE-78|EE-82|EE-84|EE-86 = Estonia
|EG|EG-DK|EG-BA|EG-BH|EG-FYM|EG-GH|EG-ALX|EG-IS|EG-GZ|EG-MNF
|EG-MN|EG-C|EG-KB|EG-WAD|EG-SHR|EG-SUZ|EG-ASN|EG-AST|EG-BNS
|EG-PTS|EG-DT|EG-JS|EG-KFS|EG-MT|EG-KN|EG-SIN|EG-SHG = Egypt
|ER|ER-AN|ER-DK|ER-DU|ER-GB|ER-MA|ER-SK = Eritrea
|ES|ES-AN|ES-AR|ES-O|ES-IB|ES-PV|ES-EX|ES-GA|ES-CA|ES-S|ES-CM
|ES-CL|ES-CT|ES-LO|ES-M|ES-MU|ES-NA|ES-VC|ES-VI|ES-AB|ES-A
|ES-AL|ES-AV|ES-BA|ES-B|ES-BU|ES-CC|ES-S|ES-CS|ES-CR
|ES-CO|ES-CU|ES-GI|ES-GR|ES-GU|ES-SS|ES-H|ES-HU|ES-J|ES-C
|ES-LO|ES-LE|ES-L|ES-LU|ES-M|ES-MA|ES-MU|ES-NA|ES-OR
|ES-P|ES-PO|ES-SA|ES-SG|ES-SE|ES-SO|ES-T|ES-TE|ES-TO
|ES-V|ES-VA|ES-BI|ES-ZA|ES-Z = Spain
|ES-CN|ES-GC|ES-TF = Spain Canary Islands
|ES-CT = Spain Catalonia
|ES-O = Spain Asturias
|ET|ET-AA|ET-AF|ET-AM|ET-BE|ET-DD|ET-GA|ET-HA|ET-OR
|ET-SO|ET-SN|ET-TI = Ethiopia
|FI|FI-AL|FI-ES|FI-IS|FI-LL|FI-LS|FI-OL = Finland
|FJ|FJ-C|FJ-E|FJ-N|FJ-R|FJ-W = Fiji
|FK = Falkland Islands
|FO = Faroe Islands
|FR|FR-01|FR-02|FR-03|FR-04|FR-05|FR-06|FR-07|FR-08|FR-09
|FR-10|FR-11|FR-12|FR-13|FR-14|FR-15|FR-16|FR-17|FR-18
|FR-19|FR-21|FR-22|FR-23|FR-24|FR-25|FR-26|FR-27|FR-28
|FR-29|FR-30|FR-31|FR-32|FR-33|FR-34|FR-35
|FR-36|FR-37|FR-38|FR-39|FR-40|FR-41|FR-42|FR-43|FR-44
|FR-45|FR-46|FR-47|FR-48|FR-49|FR-50|FR-51|FR-52|FR-53
|FR-54|FR-55|FR-56|FR-57|FR-58|FR-59|FR-60|FR-61|FR-62
|FR-63|FR-64|FR-65|FR-66|FR-67|FR-68|FR-69|FR-70|FR-71
|FR-72|FR-73|FR-74|FR-75|FR-76|FR-77|FR-78|FR-79|FR-80
|FR-81|FR-82|FR-83|FR-84|FR-85|FR-86|FR-87|FR-88|FR-89
|FR-90|FR-91|FR-92|FR-93|FR-94|FR-95|FR-A|FR-B|FR-C|FR-D
|FR-E|FR-F|FR-G|FR-I|FR-J|FR-K|FR-L|FR-M|FR-N|FR-O
|FR-P|FR-Q|FR-R|FR-S|FR-T|FR-U|FR-V = France
|FR-GF = French Guiana
|FR-GP = Guadeloupe
|FR-H|FR-2A|FR-2B = France Corsica
|FR-MQ = Martinique
|FR-RE = Réunion
|GA|GA-1|GA-2|GA-3|GA-4|GA-5|GA-6|GA-7|GA-8|GA-9 = Gabon
|GB|GB-BGW|GB-BGE|GB-CAY|GB-CRF|GB-CMN|GB-CGN|GB-CWY|GB-DEN
|GB-FLN|GB-GWN|GB-AGY|GB-MTY|GB-MON|GB-NTL|GB-NWP|GB-PEM
|GB-POW|GB-RCT|GB-SWA|GB-TOF|GB-VGL|GB-WRX|GB-GSY|GB-JSY|GB-IOM = United Kingdom
|GB-BDG|GB-BNE|GB-BNS|GB-BAS|GB-BDF|GB-BEX|GB-BIR|GB-BBD
|GB-BPL|GB-BOL|GB-BMH|GB-BRC|GB-BRD|GB-BEN|GB-BNH|GB-BST|GB-BRY
|GB-BKM|GB-BUR|GB-CLD|GB-CAM|GB-CMD|GB-CHS|GB-CON|GB-COV|GB-CRY
|GB-CMA|GB-DAL|GB-DER|GB-DBY|GB-DEV|GB-DNC|GB-DOR|GB-DUD|GB-DUR
|GB-EAL|GB-ERY|GB-ESX|GB-ENF|GB-ESS|GB-GAT|GB-GLS|GB-GRE|GB-HCK
|GB-HAL|GB-HMF|GB-HAM|GB-HRY|GB-HRW|GB-HPL|GB-HAV|GB-HEF|GB-HRT
|GB-HIL|GB-HNS|GB-IOW|GB-IOS|GB-ISL|GB-KEC|GB-KEN|GB-KHL|GB-KTT
|GB-KIR|GB-KWL|GB-LBH|GB-LAN|GB-LDS|GB-LCE|GB-LEC|GB-LEW|GB-LIN
|GB-LIV|GB-LND|GB-LUT|GB-MAN|GB-MDW|GB-MRT|GB-MDB|GB-MIK|GB-NET
|GB-NWM|GB-NFK|GB-NEL|GB-NLN|GB-NSM|GB-NTY|GB-NYK|GB-NTH|GB-NBL
|GB-NGM|GB-NTT|GB-OLD|GB-OXF|GB-PTE|GB-PLY|GB-POL|GB-POR|GB-RDG
|GB-RDB|GB-RCC|GB-RIC|GB-RCH|GB-ROT|GB-RUT|GB-SHN|GB-SLF|GB-SAW
|GB-SFT|GB-SHF|GB-SHR|GB-SLG|GB-SOL|GB-SOM|GB-SGC|GB-STY|GB-STH
|GB-SOS|GB-SWK|GB-STS|GB-SKP|GB-STT|GB-STE|GB-SFK|GB-SND|GB-SRY
|GB-STN|GB-SWD|GB-TAM|GB-TFW|GB-THR|GB-TOB|GB-TWH|GB-TRF|GB-WKF
|GB-WLL|GB-WFT|GB-WND|GB-WRT|GB-WAR|GB-WBK|GB-WSX|GB-WSM|GB-WGN
|GB-WIL|GB-WNM|GB-WRL|GB-WOK|GB-WLV|GB-WOR|GB-YOR = UK England
|GB-ABE|GB-ABD|GB-ANS|GB-AGB|GB-CLK|GB-DGY|GB-DND|GB-EAY|GB-EDU
|GB-ELN|GB-ERW|GB-EDH|GB-ELS|GB-FAL|GB-FIF|GB-GLG|GB-HLD|GB-IVC
|GB-MLN|GB-MRY|GB-NAY|GB-NLK|GB-ORK|GB-PKN|GB-RFW|GB-SCB|GB-ZET
|GB-SAY|GB-SLK|GB-STG|GB-WDU|GB-WLN = UK Scotland
|GB-ANT|GB-ARD|GB-ARM|GB-BLA|GB-BLY|GB-BNB|GB-BFS|GB-CKF|GB-CSR
|GB-CLR|GB-CKT|GB-CGV|GB-DRY|GB-DOW|GB-DGN|GB-FER|GB-LRN|GB-LMV
|GB-LSB|GB-MFT|GB-MYL|GB-NYM|GB-NTA|GB-NDN|GB-OMH|GB-STB = Northern Ireland
|GD|GD-01|GD-02|GD-03|GD-04|GD-05|GD-06|GD-10 = Grenada
|GE|GE-AB|GE-AJ|GE-TB|GE-GU|GE-IM|GE-KA|GE-KK|GE-MM
|GE-RL|GE-SZ|GE-SJ|GE-SK = Georgia
|GF = French Guiana
|GH|GH-AH|GH-BA|GH-CP|GH-EP|GH-AA|GH-NP|GH-UE|GH-UW|GH-TV
|GH-WP = Ghana
|GL = Greenland
|GM|GM-C|GM-B|GM-L|GM-N|GM-U|GM-W = Gambia
|GN|GN-C|GN-B|GN-F|GN-K|GN-D|GN-L|GN-M|GN-N|GN-BE|GN-BF|GN-BK
|GN-CO|GN-DB|GN-DI|GN-DL|GN-DU|GN-FA|GN-FO|GN-FR|GN-GA|GN-GU|GN-KA
|GN-KB|GN-KD|GN-KE|GN-KN|GN-KO|GN-KS|GN-LA|GN-LE|GN-LO|GN-MC|GN-MD
|GN-ML|GN-MM|GN-NZ|GN-PI|GN-SI|GN-TE|GN-TO|GN-YO = Guinea
|GP = Guadeloupe
|GQ|GQ-AN|GQ-BN|GQ-BS|GQ-CS|GQ-KN|GQ-LI|GQ-WN = Equatorial Guinea
|GR|GR-13|GR-11|GR-12|GR-31|GR-01|GR-A1|GR-69|GR-03|GR-64
|GR-94|GR-85|GR-81|GR-52|GR-14|GR-04|GR-05|GR-71|GR-63|GR-51
|GR-53|GR-33|GR-91|GR-41|GR-56|GR-55|GR-23|GR-57|GR-22|GR-15
|GR-58|GR-82|GR-16|GR-42|GR-92|GR-24|GR-83|GR-43|GR-17|GR-59
|GR-06|GR-07|GR-61|GR-34|GR-93|GR-73|GR-84|GR-62|GR-32|GR-54
|GR-44|GR-72|GR-21 = Greece
|GT|GT-AV|GT-BV|GT-CM|GT-CQ|GT-PE|GT-PR|GT-QC|GT-ES|GT-GU
|GT-HU|GT-IZ|GT-JA|GT-JU|GT-QZ|GT-RE|GT-SA|GT-SM|GT-SR
|GT-SO|GT-SU|GT-TO|GT-ZA = Guatemala
|GW|GW-BA|GW-BM|GW-BS|GW-BL|GW-CA|GW-GA|GW-OI|GW-QU|GW-TO = Guinea-Bissau
|GY|GY-BA|GY-CU|GY-DE|GY-EB|GY-ES|GY-MA|GY-PM|GY-PT|GY-UD
|GY-UT = Guyana
|HN|HN-AT|HN-CH|HN-CL|HN-CM|HN-CP|HN-CR|HN-EP|HN-FM|HN-GD
|HN-IN|HN-IB|HN-LP|HN-LE|HN-OC|HN-OL|HN-SB|HN-VA|HN-YO = Honduras
|HR-01|HR-02|HR-03|HR-04|HR-05|HR-06|HR-07|HR-08|HR-09
|HR-10|HR-11|HR-12|HR-13|HR-14|HR-15|HR-16|HR-17|HR-18
|HR-19|HR-20|HR-21|HR = Croatia
|HT|HT-CE|HT-GA|HT-ND|HT-NE|HT-NO|HT-OU|HT-SD|HT-SE = Haiti
|HU|HU-BK|HU-BA|HU-BE|HU-BC|HU-BZ|HU-BU|HU-CS|HU-DE|HU-DU
|HU-EG|HU-FE|HU-GY|HU-GS|HU-HB|HU-HE|HU-HV|HU-JN|HU-KV|HU-KM
|HU-KE|HU-MI|HU-NK|HU-NO|HU-NY|HU-PS|HU-PE|HU-ST|HU-SO|HU-SN
|HU-SZ|HU-SD|HU-SF|HU-SS|HU-SK|HU-SH|HU-TB|HU-TO|HU-VA|HU-VM
|HU-VE|HU-ZA|HU-ZE = Hungary
|ID|ID-BA|ID-BB|ID-BT|ID-BE|ID-GO|ID-JA|ID-JB|ID-JT|ID-JI
|ID-KB|ID-KS|ID-KT|ID-KI|ID-KR|ID-LA|ID-MA|ID-MU|ID-NB|ID-NT
|ID-PA|ID-RI|ID-SR|ID-SN|ID-ST|ID-SG|ID-SA|ID-SB|ID-SS|ID-SU
|ID-AC|ID-JK|ID-YO = Indonesia
|IE|IE-CW|IE-CN|IE-CE|IE-C|IE-DL|IE-D|IE-G|IE-KY|IE-KE|IE-KK
|IE-LS|IE-LM|IE-LK|IE-LD|IE-LO|IE-MO|IE-MH|IE-MN|IE-OY|IE-RN
|IE-SO|IE-TA|IE-WD|IE-WH|IE-WX|IE-WW = Ireland
|IL|IL-D|IL-HA|IL-JM|IL-M|IL-TA|IL-Z = Israel
|IN|IN-AP|IN-AR|IN-AS|IN-BR|IN-CG|IN-GA|IN-GJ|IN-HR|IN-HP
|IN-JK|IN-JH|IN-KA|IN-KL|IN-MP|IN-MH|IN-MN|IN-ML|IN-MZ|IN-NL
|IN-OR|IN-PB|IN-RJ|IN-SK|IN-TR|IN-UA|IN-UP|IN-WB|IN-AN
|IN-CH|IN-DN|IN-DD|IN-DL|IN-LD|IN-PY = India
|IN-TN = India Tamil Nadu
|IS|IS-1|IS-6|IS-5|IS-7|IS-8|IS-2|IS-3|IS-4 = Iceland
|IQ|IQ-AN|IQ-AR|IQ-BB|IQ-BG|IQ-BA|IQ-DA|IQ-DQ|IQ-DI|IQ-KA
|IQ-MA|IQ-MU|IQ-NA|IQ-NI|IQ-QA|IQ-SD|IQ-SU|IQ-TS|IQ-WA = Iraq
|IR|IR-01|IR-02|IR-03|IR-04|IR-05|IR-06|IR-07|IR-08|IR-09
|IR-10|IR-11|IR-12|IR-13|IR-14|IR-15|IR-16|IR-17|IR-18|IR-19
|IR-20|IR-21|IR-22|IR-23|IR-24|IR-25|IR-26|IR-27|IR-28 = Iran
|IT|IT-65|IT-75|IT-23|IT-77|IT-45|IT-36|IT-78|IT-72|IT-62
|IT-42|IT-25|IT-57|IT-67|IT-21|IT-88|IT-82|IT-52|IT-32|IT-55
|IT-34|IT-AL|IT-AN|IT-AO|IT-AP|IT-AQ|IT-AR|IT-AT|IT-AV|IT-BA
|IT-BG|IT-BI|IT-BL|IT-BN|IT-BO|IT-BR|IT-BS|IT-BZ|IT-CA|IT-CB
|IT-CE|IT-CH|IT-CI|IT-CL|IT-CN|IT-CO|IT-CR|IT-CS|IT-CT|IT-CZ
|IT-EN|IT-FE|IT-FG|IT-FI|IT-FO|IT-FR|IT-GE|IT-GO|IT-GR|IT-IM
|IT-IS|IT-KR|IT-LC|IT-LE|IT-LI|IT-LO|IT-LT|IT-LU|IT-MC|IT-MD
|IT-ME|IT-MI|IT-MN|IT-MO|IT-MS|IT-MT|IT-NA|IT-NO|IT-NU|IT-OG
|IT-OR|IT-OT|IT-PA|IT-PC|IT-PD|IT-PE|IT-PG|IT-PI|IT-PN|IT-PO
|IT-PR|IT-PT|IT-PU|IT-PV|IT-PZ|IT-RA|IT-RC|IT-RE|IT-RG|IT-RI
|IT-RM|IT-RN|IT-RO|IT-SA|IT-SI|IT-SO|IT-SP|IT-SR|IT-SS|IT-SV
|IT-TA|IT-TE|IT-TN|IT-TO|IT-TP|IT-TR|IT-TS|IT-TV|IT-UD|IT-VA
|IT-VB|IT-VC|IT-VE|IT-VI|IT-VR|IT-VT|IT-VV = Italy
|JM|JM-13|JM-09|JM-01|JM-12|JM-04|JM-02|JM-06|JM-14|JM-11
|JM-08|JM-05|JM-03|JM-07|JM-10 = Jamaica
|JO = Jordan
|JP|JP-01|JP-02|JP-03|JP-04|JP-05|JP-06|JP-07|JP-08|JP-09
|JP-10|JP-11|JP-12|JP-13|JP-14|JP-15|JP-16|JP-17|JP-18
|JP-19|JP-20|JP-21|JP-22|JP-23|JP-24|JP-25|JP-26|JP-27
|JP-28|JP-29|JP-30|JP-31|JP-32|JP-33|JP-34|JP-35|JP-36
|JP-37|JP-38|JP-39|JP-40|JP-41|JP-42|JP-43|JP-44|JP-45
|JP-46|JP-47 = Japan
|KE|KE-200|KE-300|KE-400|KE-110|KE-500|KE-600|KE-700
|KE-900 = Kenya
|KG|KG-B|KG-GB|KG-J|KG-N|KG-O|KG-T|KG-C|KG-Y = Kyrgyzstan
|KH|KH-1|KH-2|KH-7|KH-8|KH-9|KH-3|KH-4|KH-5|KH-6|KH-10|KH-11
|KH-22|KH-15|KH-13|KH-14|KH-16|KH-17|KH-19|KH-20|KH-21|KH-23
|KH-24|KH-12|KH-18 = Cambodia
|KM|KM-A|KM-G|KM-M = Comoros
|KP|KP-CHA|KP-HAB|KP-HAN|KP-HWB|KP-HWN|KP-KAN|KP-PYB|KP-PYN
|KP-YAN|KP-KAE|KP-NAJ|KP-NAM|KP-PYO = North Korea
|KR|KR-26|KR-43|KR-44|KR-27|KR-30|KR-42|KR-29|KR-41|KR-47
|KR-48|KR-28|KR-49|KR-45|KR-46|KR-11|KR-31 = South Korea
|KW|KW-AH|KW-JA|KW-FA|KW-KU|KW-HW|KW-MU = Kuwait
|KZ|KZ-ALM|KZ-AKM|KZ-AKT|KZ-ATY|KZ-MAN|KZ-SEV|KZ-VOS|KZ-PAV
|KZ-KAR|KZ-KUS|KZ-KZY|KZ-ZHA|KZ-YUZ|KZ-ZAP = Kazakhstan
|LA|LA-AT|LA-BK|LA-BL|LA-CH|LA-HO|LA-KH|LA-LM|LA-LP|LA-OU
|LA-PH|LA-SL|LA-SV|LA-VI|LA-VT|LA-XA|LA-XE|LA-XI|LA-XN = Laos
|LB|LB-NL|LB-BA|LB-BI|LB-JL|LB-NA|LB-AS|LB-JA = Lebanon
|LI|LI-01|LI-02|LI-03|LI-04|LI-05|LI-06|LI-07|LI-08|LI-09
|LI-10|LI-11 = Liechtenstein
|LK|LK-52|LK-71|LK-81|LK-51|LK-11|LK-31|LK-12|LK-33|LK-41
|LK-13|LK-21|LK-92|LK-42|LK-61|LK-43|LK-22|LK-32|LK-82|LK-45
|LK-23|LK-72|LK-62|LK-91|LK-53|LK-44 = Sri Lanka
|LR|LR-BM|LR-BG|LR-GP|LR-CM|LR-GB|LR-GG|LR-GK|LR-LO|LR-MG
|LR-MY|LR-MO|LR-NI|LR-RI|LR-RG|LR-I = Liberia
|LS|LS-A|LS-B|LS-C|LS-D|LS-E|LS-F|LS-G|LS-H|LS-J|LS-K = Lesotho
|LT|LT-AL|LT-KU|LT-KL|LT-MR|LT-PN|LT-SA|LT-TA|LT-TE
|LT-UT|LT-VL = Lithuania
|LU|LU-D|LU-G|LU-L = Luxembourg
|LV|LV-AI|LV-AL|LV-BL|LV-BU|LV-CE|LV-DGV|LV-DA|LV-DO|LV-GU
|LV-JEL|LV-JL|LV-JUR|LV-KR|LV-KU|LV-LPX|LV-LE|LV-LM|LV-LU
|LV-MA|LV-OG|LV-PR|LV-REZ|LV-RE|LV-RIX|LV-RI|LV-SA|LV-TA
|LV-TU|LV-VK|LV-VM|LV-VE|LV-VEN = Latvia
|LY|LY-AJ|LY-BW|LY-BA|LY-BU|LY-HZ|LY-JA|LY-JI|LY-JU|LY-KF
|LY-MJ|LY-MB|LY-QB|LY-WA|LY-NQ|LY-ZA|LY-DR|LY-GD|LY-GR
|LY-GT|LY-MI|LY-MZ|LY-MQ|LY-NL|LY-SB|LY-SS|LY-SR|LY-TN
|LY-TB|LY-TM|LY-WD|LY-SH|LY-YJ = Libya
|MA|MA-09|MA-10|MA-05|MA-02|MA-08|MA-14|MA-15|MA-11|MA-06
|MA-04|MA-16|MA-07|MA-13|MA-12|MA-01|MA-03|MA-BES|MA-KHO|MA-SET
|MA-JDI|MA-SAF|MA-BOM|MA-FES|MA-SEF|MA-KEN|MA-SIK|MA-CAS|MA-ASZ
|MA-ESM|MA-GUE|MA-TNT|MA-TAT|MA-BOD|MA-LAA|MA-CHI|MA-KES|MA-ESI
|MA-MAR|MA-HAJ|MA-ERR|MA-IFR|MA-KHN|MA-MEK|MA-BER|MA-FIG|MA-JRA
|MA-NAD|MA-OUJ|MA-OUD|MA-KHE|MA-RBA|MA-AGD|MA-BAH|MA-MEL|MA-OUA
|MA-TAR|MA-TIZ|MA-AZI|MA-BEM|MA-CHE|MA-LAR|MA-TNG|MA-TET|MA-HOC
|MA-TAO|MA-TAZ = Morocco
|MD|MD-GA|MD-CU|MD-BA|MD-CA|MD-CH|MD-ED|MD-LA|MD-OR|MD-SO
|MD-TA|MD-TI|MD-UN|MD-SN = Moldova
|ME|ME-01|ME-02|ME-03|ME-04|ME-05|ME-06|ME-07|ME-08|ME-09
|ME-10|ME-11|ME-12|ME-13|ME-14|ME-15|ME-16|ME-17|ME-18
|ME-19|ME-20|ME-21 = Montenegro
|MG|MG-T|MG-D|MG-F|MG-M|MG-A|MG-U = Madagascar
|MH = Marshall islands
|MK = Macedonia
|ML|ML-BK0|ML-7|ML-1|ML-8|ML-2|ML-5|ML-4|ML-3|ML-6 = Mali
|MM|MM-14|MM-11|MM-12|MM-13|MM-15|MM-16|MM-17|MM-02|MM-07
|MM-03|MM-04|MM-01|MM-05|MM-06 = Myanmar
|MN|MN-073|MN-071|MN-069|MN-067|MN-039|MN-043|MN-041|MN-037
|MN-063|MN-061|MN-059|MN-065|MN-064|MN-035|MN-053|MN-055
|MN-049|MN-051|MN-047|MN-1|MN-046|MN-057 = Mongolia
|MP = Northern Mariana Islands
|MQ = Martinique
|MR|MR-07|MR-03|MR-05|MR-08|MR-04|MR-10|MR-01|MR-02|MR-12
|MR-NKC|MR-09|MR-11|MR-06 = Mauritania
|MT = Malta
|MU|MU-BR|MU-CU|MU-PU|MU-QB|MU-VP|MU-AG|MU-CC|MU-RO|MU-BL
|MU-FL|MU-GP|MU-MO|MU-PA|MU-PW|MU-PL|MU-RR|MU-SA = Mauritius
|MV = Maldives
|MW|MW-N|MW-S|MW-Z|MW-BA|MW-BL|MW-CK|MW-CR|MW-CT|MW-DE|MW-DO|MW-KR
|MW-KS|MW-LK|MW-LI|MW-MH|MW-MG|MW-MC|MW-MU|MW-MW|MW-MZ|MW-NB|MW-NK
|MW-NS|MW-NU|MW-NI|MW-PH|MW-RU|MW-SA|MW-TH|MW-ZO = Malawi
|MX|MX-AGU|MX-BCN|MX-BCS|MX-CAM|MX-CHP|MX-CHH|MX-COA|MX-COL
|MX-DIF|MX-DUR|MX-GUA|MX-GRO|MX-HID|MX-JAL|MX-MEX|MX-MIC
|MX-MOR|MX-NAY|MX-NLE|MX-OAX|MX-PUE|MX-QUE|MX-ROO|MX-SLP
|MX-SIN|MX-SON|MX-TAB|MX-TAM|MX-TLA|MX-VER|MX-YUC|MX-ZAC = Mexico
|MY|MY-01|MY-02|MY-03|MY-04|MY-05|MY-06|MY-08|MY-09|MY-07
|MY-12|MY-13|MY-10|MY-11|MY-14|MY-15|MY-16 = Malaysia
|MZ|MZ-P|MZ-G|MZ-I|MZ-B|MZ-MPM|MZ-L|MZ-N|MZ-A
|MZ-S|MZ-T|MZ-Q = Mozambique
|NA|NA-CA|NA-ER|NA-HA|NA-KA|NA-OK|NA-KH|NA-KU|NA-OW|NA-OH
|NA-OS|NA-ON|NA-OT|NA-OD = Namibia
|NE|NE-1|NE-2|NE-3|NE-4|NE-8|NE-5|NE-6|NE-7 = Niger
|NG|NG-AB|NG-AD|NG-AK|NG-AN|NG-BA|NG-BY|NG-BE|NG-BO|NG-CR
|NG-DE|NG-EB|NG-ED|NG-EK|NG-EN|NG-FC|NG-GO|NG-IM|NG-JI|NG-KD
|NG-KN|NG-KT|NG-KE|NG-KO|NG-KW|NG-LA|NG-NA|NG-NI|NG-OG|NG-ON
|NG-OS|NG-OY|NG-PL|NG-RI|NG-SO|NG-TA|NG-YO|NG-ZA = Nigeria
|NI|NI-AN|NI-AS|NI-BO|NI-CA|NI-CI|NI-CO|NI-ES|NI-GR|NI-JI
|NI-LE|NI-MD|NI-MN|NI-MS|NI-MT|NI-NS|NI-SJ|NI-RI = Nicaragua
|NL|NL-FL|NL-FR|NL-GR|NL-LI|NL-NB|NL-NH|NL-OV
|NL-ZH|NL-UT = Netherlands
|NL-DR = Netherlands Drenthe
|NL-GE = Netherlands Gelderland
|NL-UT = Netherlands Utrecht
|NO|NO-01|NO-02|NO-03|NO-04|NO-05|NO-06|NO-07|NO-08|NO-09|NO-10
|NO-11|NO-12|NO-14|NO-15|NO-16|NO-17|NO-18|NO-19|NO-20 = Norway
|NP|NP-BA|NP-BH|NP-DH|NP-GA|NP-JA|NP-KA|NP-KO|NP-LU|NP-MA
|NP-ME|NP-NA|NP-RA|NP-SA|NP-SE = Nepal
|NZ|NZ-AUK|NZ-BOP|NZ-CAN|NZ-GIS|NZ-HKB|NZ-MWT|NZ-MBH|NZ-NSN
|NZ-NTL|NZ-OTA|NZ-STL|NZ-TKI|NZ-TAS|NZ-WKO|NZ-WGN|NZ-WTC = New Zealand
|OM|OM-DA|OM-ZA|OM-SH|OM-BA|OM-JA|OM-MA|OM-MU|OM-WU = Oman
|PA|PA-1|PA-2|PA-3|PA-4|PA-5|PA-6|PA-Q|PA-7|PA-8|PA-9 = Panama
|PE|PE-AMA|PE-ANC|PE-APU|PE-ARE|PE-AYA|PE-CAJ|PE-CAL|PE-CUS
|PE-HUV|PE-HUC|PE-ICA|PE-JUN|PE-LAL|PE-LAM|PE-LIM|PE-LOR|PE-MDD
|PE-MOQ|PE-PAS|PE-PIU|PE-PUN|PE-SAM|PE-TAC|PE-TUM|PE-UCA = Peru
|PG|PG-CPM|PG-CPK|PG-EHG|PG-EBR|PG-ESW|PG-EPW|PG-GPK|PG-MPM
|PG-MRL|PG-MBA|PG-MPL|PG-NCD|PG-NIK|PG-NPP|PG-NSA|PG-SAN
|PG-SHM|PG-WPD|PG-WHM|PG-WBK = Papua New Guinea
|PH|PH-00|PH-01|PH-02|PH-03|PH-04|PH-05|PH-06|PH-07|PH-08
|PH-09|PH-10|PH-11|PH-12|PH-13|PH-14|PH-15|PH-ABR|PH-AGN|PH-AKL
|PH-ALB|PH-ANT|PH-APA|PH-AUR|PH-BAN|PH-BAS|PH-BEN|PH-BIL|PH-BOH
|PH-BTG|PH-BTN|PH-BUK|PH-BUL|PH-CAG|PH-CAM|PH-CAN|PH-CAP|PH-CAS
|PH-CAT|PH-CAV|PH-CEB|PH-COM|PH-DAO|PH-DAS|PH-DAV|PH-EAS|PH-GUI
|PH-IFU|PH-ILI|PH-ILN|PH-ILS|PH-ISA|PH-KAL|PH-LAG|PH-LAN|PH-LAS
|PH-LEY|PH-LUN|PH-MAD|PH-MAG|PH-MAS|PH-MDC|PH-MDR|PH-MOU|PH-MSC
|PH-MSR|PH-NCO|PH-NSA|PH-NEC|PH-NER|PH-NUE|PH-NUV|PH-PAM|PH-PAN
|PH-PLW|PH-QUE|PH-QUI|PH-RIZ|PH-ROM|PH-SAR|PH-SCO|PH-SIG|PH-SLE
|PH-SLU|PH-SOR|PH-SUK|PH-SUN|PH-SUR|PH-TAR|PH-TAW|PH-WSA|PH-ZAN
|PH-ZAS|PH-ZMB|PH-ZSI = Philippines
|PK|PK-BA|PK-IS|PK-JK|PK-NA|PK-NW|PK-PB|PK-SD|PK-TA = Pakistan
|PL|PL-WN|PL-WP|PL-SK|PL-PK|PL-MA|PL-KP|PL-LB|PL-LU|PL-LD
|PL-MZ|PL-DS|PL-OP|PL-PD|PL-PM|PL-SL|PL-ZP = Poland
|PS = Palestine
|PT|PT-01|PT-02|PT-03|PT-04|PT-05|PT-06|PT-07|PT-08|PT-09
|PT-10|PT-11|PT-12|PT-13|PT-14|PT-15|PT-16|PT-17|PT-18 = Portugal
|PT-20 = Portugal Azores
|PT-30 = Portugal Madeira
|PY|PY-16|PY-10|PY-13|PY-19|PY-5|PY-6|PY-14|PY-11|PY-1|PY-3
|PY-ASU|PY-4|PY-7|PY-8|PY-12|PY-9|PY-15|PY-2 = Paraguay
|QA = Qatar
|RE = Réunion
|RO|RO-B|RO-AB|RO-AR|RO-AG|RO-BC|RO-BH|RO-BN|RO-BT|RO-BR
|RO-BV|RO-BZ|RO-CS|RO-CL|RO-CJ|RO-CT|RO-CV|RO-DB|RO-DJ|RO-GL
|RO-GR|RO-GJ|RO-HR|RO-HD|RO-IL|RO-IS|RO-IF|RO-MM|RO-MH|RO-MS
|RO-NT|RO-OT|RO-PH|RO-SJ|RO-SM|RO-SB|RO-SV|RO-TR|RO-TM|RO-TL
|RO-VL|RO-VS|RO-VN = Romania
|RS|RS-00|RS-01|RS-02|RS-03|RS-04|RS-05|RS-06|RS-07|RS-08
|RS-09|RS-10|RS-11|RS-12|RS-13|RS-14|RS-15|RS-16|RS-17
|RS-18|RS-19|RS-20|RS-21|RS-22|RS-23|RS-24|RS-VO = Serbia
|RS-25|RS-26|RS-27|RS-28|RS-29|RS-KM = Kosovo
|RU|RU-AD|RU-AGB|RU-AMU|RU-AST|RU-BA|RU-BEL|RU-BRY|RU-BU
|RU-CE|RU-CHE|RU-CHI|RU-CU|RU-EVE|RU-IN|RU-IRK|RU-IVA
|RU-KAM|RU-KB|RU-KC|RU-KEM|RU-KGN|RU-KHA|RU-KHM|RU-KIR
|RU-KK|RU-KL|RU-KLU|RU-KO|RU-KOR|RU-KRS|RU-KYA|RU-MAG
|RU-ME|RU-MO|RU-MOV|RU-NEN|RU-NVS|RU-OMS|RU-ORE|RU-ORL
|RU-PER|RU-PNZ|RU-PSK|RU-ROS|RU-SA|RU-SAK|RU-SAM|RU-SAR
|RU-SE|RU-STA|RU-TA|RU-TAM|RU-TAY|RU-TUL|RU-TY|RU-TYU
|RU-UD|RU-ULY|RU-UOB|RU-VGG|RU-YAN|RU-YAR|RU-YEV = Russia
|RU-AL|RU-ALT = Russia Altai Krai
|RU-ARK = Russia Arkhangelsk Oblast
|RU-CHU = Russia Chukotka Autonomous Okrug
|RU-DA = Russia Dagestan
|RU-KOS = Russia Kostroma Oblast
|RU-KDA = Russia Krasnodar Krai
|RU-KGD = Russia Kaliningrad Oblast
|RU-KR = Russia Republic of Karelia
|RU-LEN = Russia Leningrad Oblast
|RU-LIP = Russia Lipetsk Oblast
|RU-MOS = Russia Moscow Oblast
|RU-MUR = Russia Murmansk Oblast
|RU-NIZ = Russia Nizhny Novgorod Oblast
|RU-NGR = Russia Novgorod Oblast
|RU-PRI = Russia Primorsky Krai
|RU-RYA = Russia Ryazanskaya Oblast
|RU-SMO = Russia Smolensk Oblast
|RU-SPE = Russia Saint Petersburg
|RU-SVE = Russia Sverdlovsk Oblast
|RU-TOM = Russia Tomsk Oblast
|RU-TVE = Russia Tver Oblast
|RU-VLA = Russia Vladimir Oblast
|RU-VLG = Russia Vologda Oblast
|RU-VOR = Russia Voronezh Oblast
|RW|RW-C|RW-I|RW-E|RW-D|RW-G|RW-B|RW-J|RW-F|RW-L|RW-K
|RW-H|RW-M = Rwanda
|SA = Saudi Arabia
|SC|SC-01|SC-02|SC-03|SC-04|SC-05|SC-06|SC-07|SC-08|SC-09
|SC-10|SC-11|SC-12|SC-13|SC-14|SC-15|SC-16|SC-17|SC-18
|SC-19|SC-20|SC-21|SC-22|SC-23 = Seychelles
|SD|SD-23|SD-26|SD-18|SD-03|SD-07|SD-17|SD-06|SD-22|SD-08
|SD-24|SD-01|SD-11|SD-13|SD-20|SD-14|SD-12|SD-10|SD-16|SD-05
|SD-04|SD-25|SD-15|SD-02|SD-09|SD-19|SD-21 = Sudan
|SE|SE-K|SE-W|SE-I|SE-X|SE-N|SE-Z|SE-F|SE-H|SE-G|SE-BD
|SE-M|SE-AB|SE-D|SE-C|SE-S|SE-AC|SE-Y|SE-U|SE-O|SE-T|SE-E = Sweden
|SI|SI-001|SI-002|SI-148|SI-149|SI-003|SI-150|SI-004|SI-005
|SI-006|SI-151|SI-007|SI-009|SI-008|SI-152|SI-011|SI-012|SI-013
|SI-014|SI-153|SI-015|SI-016|SI-017|SI-018|SI-019|SI-154|SI-020
|SI-155|SI-021|SI-156|SI-022|SI-157|SI-023|SI-024|SI-025|SI-026
|SI-027|SI-028|SI-029|SI-030|SI-031|SI-158|SI-032|SI-159|SI-160
|SI-161|SI-162|SI-034|SI-035|SI-036|SI-037|SI-038|SI-039|SI-040
|SI-041|SI-163|SI-042|SI-043|SI-044|SI-045|SI-046|SI-047|SI-048
|SI-049|SI-164|SI-050|SI-165|SI-051|SI-052|SI-053|SI-166|SI-054
|SI-055|SI-056|SI-057|SI-058|SI-059|SI-060|SI-061|SI-062|SI-063
|SI-064|SI-065|SI-066|SI-167|SI-067|SI-068|SI-069|SI-070|SI-168
|SI-071|SI-072|SI-073|SI-074|SI-169|SI-075|SI-170|SI-076|SI-077
|SI-078|SI-079|SI-080|SI-081|SI-082|SI-083|SI-084|SI-085|SI-086
|SI-171|SI-087|SI-088|SI-089|SI-090|SI-091|SI-092|SI-172|SI-093
|SI-173|SI-094|SI-174|SI-095|SI-175|SI-096|SI-097|SI-098|SI-099
|SI-100|SI-101|SI-102|SI-103|SI-176|SI-104|SI-177|SI-106|SI-105
|SI-107|SI-108|SI-033|SI-178|SI-109|SI-183|SI-117|SI-118|SI-119
|SI-120|SI-110|SI-111|SI-121|SI-122|SI-123|SI-112|SI-113|SI-114
|SI-124|SI-125|SI-194|SI-179|SI-180|SI-126|SI-115|SI-127|SI-181
|SI-182|SI-116|SI-184|SI-010|SI-128|SI-129|SI-130|SI-185|SI-131
|SI-186|SI-132|SI-133|SI-187|SI-134|SI-188|SI-135|SI-136|SI-137
|SI-138|SI-139|SI-189|SI-140|SI-141|SI-142|SI-190|SI-143|SI-146
|SI-191|SI-147|SI-192|SI-144|SI-193 = Slovenia
|SJ = Svalbard
|SK|SK-BC|SK-BL|SK-KI|SK-NJ|SK-PV|SK-TC|SK-TA|SK-ZI = Slovakia
|SL|SL-E|SL-N|SL-S|SL-W = Sierra Leone
|SN|SN-DB|SN-DK|SN-FK|SN-KL|SN-KD|SN-LG|SN-MT|SN-SL
|SN-TC|SN-TH|SN-ZG = Senegal
|SO|SO-AD|SO-BK|SO-BN|SO-BR|SO-BY|SO-GG|SO-GD|SO-HR|SO-JD
|SO-JH|SO-MD|SO-NG|SO-SG|SO-SD|SO-SH|SO-SL|SO-TG|SO-WG = Somalia
|SR|SR-BR|SR-CM|SR-CR|SR-MA|SR-NI|SR-PR|SR-PM|SR-SA
|SR-SI|SR-WA = Suriname
|ST|ST-P|ST-S = São Tomé and Príncipe
|SV|SV-AH|SV-CA|SV-CH|SV-CU|SV-LI|SV-PA|SV-UN|SV-MO|SV-SM
|SV-SS|SV-SV|SV-SA|SV-SO|SV-US = El Salvador
|SY|SY-HA|SY-QU|SY-HL|SY-RA|SY-SU|SY-DY|SY-DI|SY-DR|SY-HM
|SY-HI|SY-ID|SY-LA|SY-RD|SY-TA = Syria
|SZ|SZ-HH|SZ-LU|SZ-MA|SZ-SH = Swaziland
|TD|TD-BA|TD-BI|TD-BET|TD-CB|TD-GR|TD-KA|TD-LC|TD-LR|TD-LO
|TD-MK|TD-MC|TD-OD|TD-SA|TD-TA = Chad
|TG|TG-C|TG-K|TG-M|TG-P|TG-S = Togo
|TH|TH-10|TH-11|TH-12|TH-13|TH-14|TH-15|TH-16|TH-17|TH-18
|TH-19|TH-20|TH-21|TH-22|TH-23|TH-24|TH-25|TH-26|TH-27|TH-30
|TH-31|TH-32|TH-33|TH-34|TH-35|TH-36|TH-37|TH-39|TH-40|TH-41
|TH-42|TH-43|TH-44|TH-45|TH-46|TH-47|TH-48|TH-49|TH-50|TH-51
|TH-52|TH-53|TH-54|TH-55|TH-56|TH-57|TH-58|TH-60|TH-61|TH-62
|TH-63|TH-64|TH-65|TH-66|TH-67|TH-70|TH-71|TH-72|TH-73|TH-74
|TH-75|TH-76|TH-77|TH-80|TH-81|TH-82|TH-83|TH-84|TH-85|TH-86
|TH-90|TH-91|TH-92|TH-93|TH-94|TH-95|TH-96|TH-S = Thailand
|TJ|TJ-GB|TJ-KT|TJ-SU = Tajikistan
|TL|TL-AL|TL-AN|TL-BA|TL-BO|TL-CO|TL-DI|TL-ER|TL-LA|TL-LI
|TL-MT|TL-MF|TL-OE|TL-VI = East Timor
|TM|TM-A|TM-B|TM-D|TM-L|TM-M = Turkmenistan
|TN|TN-12|TN-31|TN-13|TN-23|TN-71|TN-81|TN-32|TN-41|TN-42
|TN-73|TN-33|TN-53|TN-14|TN-82|TN-52|TN-21|TN-61|TN-43
|TN-34|TN-51|TN-83|TN-72|TN-11|TN-22 = Tunisia
|TR|TR-01|TR-02|TR-03|TR-04|TR-05|TR-06|TR-07|TR-08|TR-09|TR-10
|TR-11|TR-12|TR-13|TR-14|TR-15|TR-16|TR-17|TR-18|TR-19|TR-20
|TR-21|TR-22|TR-23|TR-24|TR-25|TR-26|TR-27|TR-28|TR-29|TR-30
|TR-31|TR-32|TR-33|TR-34|TR-35|TR-36|TR-37|TR-38|TR-39|TR-40
|TR-41|TR-42|TR-43|TR-44|TR-45|TR-46|TR-47|TR-48|TR-49|TR-50
|TR-51|TR-52|TR-53|TR-54|TR-55|TR-56|TR-57|TR-58|TR-59|TR-60
|TR-61|TR-62|TR-63|TR-64|TR-65|TR-66|TR-67|TR-68|TR-69|TR-70
|TR-71|TR-72|TR-73|TR-74|TR-75|TR-76|TR-77|TR-78|TR-79|TR-80
|TR-81 = Turkey
|TT|TT-ARI|TT-CHA|TT-CTT|TT-DMN|TT-ETO|TT-RCM|TT-PED|TT-PTF
|TT-POS|TT-PRT|TT-SFO|TT-SGE|TT-SJL|TT-SIP|TT-TUP|TT-WTO = Trinidad and Tobago
|TW = Taiwan
|TZ|TZ-01|TZ-02|TZ-03|TZ-04|TZ-05|TZ-08|TZ-09|TZ-12|TZ-13
|TZ-26|TZ-14|TZ-16|TZ-17|TZ-18|TZ-06|TZ-10|TZ-20|TZ-19|TZ-21
|TZ-22|TZ-23|TZ-24|TZ-25|TZ-11|TZ-07|TZ-15 = Tanzania
|UA|UA-63|UA-65|UA-68|UA-77|UA-12|UA-14|UA-26|UA-30|UA-32
|UA-35|UA-46|UA-09|UA-48|UA-51|UA-53|UA-19|UA-23|UA-18
|UA-40|UA-59|UA-61|UA-21|UA-71|UA-74|UA-05|UA-07 = Ukraine
|UA-43 = Ukraine Crimea
|UG|UG-ADJ|UG-APC|UG-ARU|UG-BSH|UG-BUG|UG-BUN|UG-BUS|UG-GUL
|UG-HOI|UG-IGA|UG-JIN|UG-KAB|UG-KAL|UG-KAM|UG-KAN|UG-KAR|UG-KAS
|UG-KAY|UG-KBA|UG-KBL|UG-KIB|UG-KIS|UG-KIT|UG-KML|UG-KMP|UG-KOT
|UG-KPC|UG-KTK|UG-KUM|UG-KYE|UG-LIR|UG-LUW|UG-MAS|UG-MAY|UG-MBA
|UG-MBR|UG-MOY|UG-MPI|UG-MRT|UG-MSN|UG-MUB|UG-MUK|UG-NAK|UG-NEB
|UG-NKS|UG-NTU|UG-PAD|UG-PAL|UG-RAK|UG-RUK|UG-SEM|UG-SIR|UG-SOR
|UG-TOR|UG-WAK|UG-YUM = Uganda<!--unvollständig, siehe [[ISO 3166-2:UG]]-->
|US|US-DC = USA
|US-AK = USA Alaska
|US-AL = USA Alabama
|US-AR = USA Arkansas
|US-AZ = USA Arizona
|US-CA = USA California
|US-CO = USA Colorado
|US-CT = USA Connecticut
|US-DE = USA Delaware
|US-FL = USA Florida
|US-GA = USA Georgia
|US-GU = USA Guam
|US-HI = USA Hawaii
|US-IA = USA Iowa
|US-ID = USA Idaho
|US-IL = USA Illinois
|US-IN = USA Indiana
|US-KS = USA Kansas
|US-KY = USA Kentucky
|US-LA = USA Louisiana
|US-MA = USA Massachusetts
|US-MD = USA Maryland
|US-ME = USA Maine
|US-MI = USA Michigan
|US-MN = USA Minnesota
|US-MO = USA Missouri
|US-MS = USA Mississippi
|US-MT = USA Montana
|US-NC = USA North Carolina
|US-ND = USA North Dakota
|US-NE = USA Nebraska
|US-NH = USA New Hampshire
|US-NJ = USA New Jersey
|US-NM = USA New Mexico
|US-NV = USA Nevada
|US-NY = USA New York
|US-OH = USA Ohio
|US-OK = USA Oklahoma
|US-OR = USA Oregon
|US-PA = USA Pennsylvania
|US-PR = USA Puerto Rico
|US-RI = USA Rhode Island
|US-SC = USA South Carolina
|US-SD = USA South Dakota
|US-TN = USA Tennessee
|US-TX = USA Texas
|US-UT = USA Utah
|US-VA = USA Virginia
|US-VI = USA Virgin Islands
|US-VT = USA Vermont
|US-WA = USA Washington
|US-WI = USA Wisconsin
|US-WV = USA West Virginia
|US-WY = USA Wyoming
|UY|UY-AR|UY-CA|UY-CL|UY-CO|UY-DU|UY-FS|UY-FD|UY-LA|UY-MA|UY-MO
|UY-PA|UY-RN|UY-RV|UY-RO|UY-SA|UY-SJ|UY-SO|UY-TA|UY-TT = Uruguay
|UZ|UZ-AN|UZ-BU|UZ-FA|UZ-JI|UZ-NG|UZ-NW|UZ-QA|UZ-QR|UZ-SA
|UZ-SI|UZ-SU|UZ-TK|UZ-TO|UZ-XO = Uzbekistan
|VE|VE-B|VE-Z|VE-C|VE-D|VE-E|VE-F|VE-G|VE-H|VE-Y|VE-W|VE-A
|VE-I|VE-J|VE-K|VE-L|VE-M|VE-N|VE-O|VE-P|VE-R|VE-S|VE-T
|VE-X|VE-U|VE-V = Venezuela
|VN|VN-44|VN-43|VN-53|VN-54|VN-55|VN-56|VN-50|VN-31|VN-57
|VN-58|VN-40|VN-59|VN-48|VN-04|VN-60|VN-33|VN-72|VN-71|VN-39
|VN-45|VN-30|VN-03|VN-63|VN-64|VN-15|VN-23|VN-61|VN-62|VN-73
|VN-65|VN-14|VN-66|VN-34|VN-47|VN-28|VN-01|VN-35|VN-09|VN-02
|VN-41|VN-67|VN-22|VN-18|VN-36|VN-68|VN-32|VN-24|VN-27|VN-29
|VN-13|VN-25|VN-52|VN-05|VN-37|VN-20|VN-69|VN-21|VN-26|VN-46
|VN-51|VN-07|VN-49|VN-70|VN-06 = Vietnam
|VU|VU-MAP|VU-PAM|VU-SAM|VU-SEE|VU-TAE|VU-TOB = Vanuatu
|YE|YE-AB|YE-DA|YE-BA|YE-HU|YE-JA|YE-MR|YE-MW|YE-AD|YE-AM|YE-DH
|YE-HD|YE-HJ|YE-IB|YE-LA|YE-MA|YE-SN|YE-SD|YE-SH|YE-TA = Yemen
|ZA|ZA-FS|ZA-GT|ZA-EC|ZA-NL|ZA-LP|ZA-MP|ZA-NC|ZA-NW|ZA-WC = South Africa
|ZM|ZM-08|ZM-04|ZM-09|ZM-05|ZM-06|ZM-03|ZM-07|ZM-01|ZM-02 = Zambia
|ZW|ZW-BU|ZW-HA|ZW-MA|ZW-MC|ZW-ME|ZW-MW|ZW-MV|ZW-MN
|ZW-MS|ZW-MI = Zimbabwe
<includeonly>}}</includeonly><noinclude></poem></noinclude>
rznwtpfcujq3jyjb7mnozhxbidox7pg
74832
74829
2026-08-24T00:26:17Z
Robertsky
10424
fix
74832
wikitext
text/x-wiki
<noinclude>
In the following list please adhere to the alphabetic order as per the [[ISO 3166-2|ISO 3166-2-Code]].
<poem></noinclude><includeonly>{{{{{|safesubst:}}}#switch: {{{1}}}
|#default = </includeonly>
|AD|AD-02|AD-03|AD-04|AD-05|AD-06|AD-07|AD-08 = Andorra
|AE|AE-AZ|AE-AJ|AE-DU|AE-FU|AE-RK|AE-SH|AE-UQ = United Arab Emirates
|AF|AF-BAL|AF-BAM|AF-BDG|AF-BDS|AF-BGL|AF-DAY|AF-FRA
|AF-FYB|AF-GHA|AF-GHO|AF-HEL|AF-HER|AF-JOW|AF-KAB|AF-KAN
|AF-KAP|AF-KDZ|AF-KHO|AF-KNR|AF-LAG|AF-LOW|AF-NAN|AF-NIM
|AF-NUR|AF-ORU|AF-PAN|AF-PAR|AF-PIA|AF-PKA|AF-SAM|AF-SAR
|AF-TAK|AF-WAR|AF-ZAB = Afghanistan
|AG = Antigua and Barbuda
|AL|AL-BR|AL-BU|AL-DL|AL-DV|AL-DI|AL-DR|AL-EL|AL-FR|AL-GJ
|AL-GR|AL-HA|AL-KA|AL-ER|AL-KO|AL-KR|AL-KC|AL-KU|AL-KB|AL-LE
|AL-LB|AL-LU|AL-MM|AL-MK|AL-MT|AL-MR|AL-PQ|AL-PR|AL-PG|AL-PU
|AL-SR|AL-SK|AL-SH|AL-TE|AL-TR|AL-TP|AL-VL = Albania
|AM|AM-AG|AM-AR|AM-AV|AM-ER|AM-GR|AM-KT|AM-LO|AM-SH|AM-SU
|AM-TV|AM-VD = Armenia
|AO|AO-BGO|AO-BGU|AO-BIE|AO-CAB|AO-CCU|AO-CNO|AO-CUS|AO-CNN
|AO-HUA|AO-HUI|AO-LUA|AO-LNO|AO-LSU|AO-MAL|AO-MOX|AO-NAM
|AO-UIG|AO-ZAI = Angola
|AQ = Antarctica
|AR|AR-C|AR-B|AR-K|AR-H|AR-U|AR-X|AR-W|AR-E|AR-P|AR-Y|AR-L
|AR-F|AR-M|AR-N|AR-Q|AR-R|AR-A|AR-J|AR-D|AR-Z|AR-S|AR-G
|AR-V|AR-T = Argentina
|AT|AT-1|AT-2|AT-3|AT-4|AT-5|AT-6|AT-7|AT-8|AT-9 = Austria
|AU|AU-ACT|AU-CT|AU-JBT|AU-JT = Australia
|AU-NS|AU-NSW = Australia New South Wales
|AU-NT = Australia Northern Territory
|AU-QL|AU-QLD = Australia Queensland
|AU-SA = Australia South Australia
|AU-TAS|AU-TS = Australia Tasmania
|AU-VI|AU-VIC = Australia Victoria
|AU-WA = Australia Western Australia
|AW|AW-AUA|AW-BAR|AW-BUS|AW-DEU|AW-ORJ|AW-SNL = Aruba
|AZ = Azerbaijan
|BA|BA-BIH|BA-SRP = Bosnia and Herzegovina
|BB = Barbados
|BD|BD-05|BD-01|BD-02|BD-06|BD-07|BD-03|BD-04|BD-09|BD-10
|BD-12|BD-11|BD-13|BD-14|BD-15|BD-16|BD-19|BD-18|BD-17|BD-20
|BD-24|BD-21|BD-22|BD-25|BD-23|BD-29|BD-27|BD-26|BD-08|BD-28
|BD-30|BD-31|BD-32|BD-36|BD-37|BD-33|BD-39|BD-38|BD-35|BD-34
|BD-48|BD-43|BD-40|BD-42|BD-44|BD-45|BD-41|BD-46|BD-47|BD-49
|BD-52|BD-51|BD-50|BD-53|BD-54|BD-56|BD-55|BD-58|BD-62|BD-57
|BD-59|BD-61|BD-60|BD-63|BD-64 = Bangladesh
|BE|BE-BRU|BE-VAN|BE-VBR|BE-VLG|BE-VOV|BE-VWV|BE-WAL
|BE-WBR|BE-WHT|BE-WLG|BE-VLI|BE-WLX|BE-WNA = Belgium
|BF|BF-BAL|BF-BAM|BF-BAN|BF-BAZ|BF-BGR|BF-BLG|BF-BLK|BF-COM
|BF-GAN|BF-GNA|BF-GOU|BF-HOU|BF-IOB|BF-KAD|BF-KEN|BF-KMD
|BF-KMP|BF-KOP|BF-KOS|BF-KOT|BF-KOW|BF-LER|BF-LOR|BF-MOU
|BF-NAM|BF-NAO|BF-NAY|BF-NOU|BF-OUB|BF-OUD|BF-PAS|BF-PON
|BF-SEN|BF-SIS|BF-SMT|BF-SNG|BF-SOM|BF-SOR|BF-TAP|BF-TUI
|BF-YAG|BF-YAT|BF-ZIR|BF-ZON|BF-ZOU = Burkina Faso
|BG|BG-01|BG-02|BG-03|BG-04|BG-05|BG-06|BG-07|BG-08|BG-09
|BG-10|BG-11|BG-12|BG-13|BG-14|BG-15|BG-16|BG-17|BG-18
|BG-19|BG-20|BG-21|BG-22|BG-23|BG-24|BG-25|BG-26|BG-27
|BG-28 = Bulgaria
|BH|BH-13|BH-14|BH-15|BH-16|BH-17 = Bahrain
|BI|BI-BB|BI-BJ|BI-BR|BI-CA|BI-CI|BI-GI|BI-KR|BI-KY|BI-KI
|BI-MA|BI-MU|BI-MY|BI-MW|BI-NG|BI-RT|BI-RY = Burundi
|BJ|BJ-AL|BJ-AK|BJ-AQ|BJ-BO|BJ-CO|BJ-KO|BJ-DO|BJ-LI|BJ-MO
|BJ-OU|BJ-PL|BJ-ZO = Benin
|BN|BN-BE|BN-BM|BN-TE|BN-TU = Brunei
|BO|BO-B|BO-H|BO-C|BO-L|BO-O|BO-N|BO-P|BO-S|BO-T = Bolivia
|BR|BR-AC|BR-AL|BR-AM|BR-AP|BR-BA|BR-CE|BR-DF|BR-ES|BR-GO
|BR-MA|BR-MG|BR-MS|BR-MT|BR-PA|BR-PB|BR-PE|BR-PI|BR-PR|BR-RJ
|BR-RN|BR-RO|BR-RR|BR-RS|BR-SC|BR-SE|BR-SP|BR-TO = Brazil
|BS|BS-AC|BS-BI|BS-CI|BS-EX|BS-FP|BS-FC|BS-GH|BS-GT|BS-HI
|BS-HR|BS-IN|BS-KB|BS-LI|BS-MH|BS-MG|BS-NP|BS-NB|BS-RI
|BS-RS|BS-SP|BS-SR = Bahamas
|BT|BT-33|BT-12|BT-22|BT-GA|BT-13|BT-44|BT-42|BT-11|BT-43
|BT-23|BT-45|BT-14|BT-31|BT-15|BT-41|BT-TY|BT-32|BT-21
|BT-24|BT-34 = Bhutan
|BW|BW-GH|BW-KG|BW-KL|BW-KW|BW-NE|BW-NW|BW-SE|BW-SO = Botswana
|BY|BY-BR|BY-HO|BY-HR|BY-MA|BY-MI|BY-VI = Belarus
|BZ|BZ-BZ|BZ-CY|BZ-CZL|BZ-OW|BZ-SC|BZ-TOL = Belize
|CA|CA-AB|CA-NB|CA-NL|CA-NS|CA-NT|CA-NU|CA-ON|CA-PE|CA-QC
|CA-YU|CA-YT = Canada
|CA-BC = Canada British Columbia
|CA-MB = Canada Manitoba
|CA-SK = Canada Saskatchewan
|CD|CD-BN|CD-BC|CD-EQ|CD-KA|CD-KW|CD-KE|CD-KN|CD-MA|CD-NK
|CD-OR|CD-SK = Democratic Republic of the Congo
|CF|CF-BB|CF-BGF|CF-BK|CF-HM|CF-HK|CF-KG|CF-LB|CF-HS|CF-MB
|CF-KB|CF-NM|CF-MP|CF-UK|CF-AC|CF-OP|CF-SE|CF-VR = Central African Republic
|CG|CG-11|CG-BZV|CG-8|CG-15|CG-2|CG-5|CG-7|CG-9|CG-14
|CG-12|CG-13 = Republic of the Congo
|CH|CH-AG|CH-AI|CH-AR|CH-BE|CH-BL|CH-BS|CH-FR|CH-GE
|CH-GL|CH-GR|CH-JU|CH-LU|CH-NE|CH-NW|CH-OW|CH-SG
|CH-SH|CH-SO|CH-SZ|CH-TG|CH-TI|CH-UR|CH-VD|CH-VS
|CH-ZG|CH-ZH = Switzerland
|CI|CI-16|CI-09|CI-10|CI-06|CI-02|CI-07|CI-01|CI-12|CI-05
|CI-11|CI-03|CI-15|CI-13|CI-04|CI-14|CI-08 = Ivory Coast
|CL|CL-RM|CL-TA|CL-AN|CL-AT|CL-CO|CL-VS|CL-LI|CL-ML|CL-BI
|CL-AR|CL-LL|CL-AI|CL-MA = Chile
|CM|CM-AD|CM-CE|CM-ES|CM-EN|CM-LT|CM-NO|CM-NW|CM-OU|CM-SU
|CM-SW = Cameroon
|CN|CN-34|CN-35|CN-62|CN-44|CN-52|CN-46|CN-13|CN-23|CN-41
|CN-42|CN-43|CN-32|CN-36|CN-22|CN-21|CN-63|CN-61|CN-37|CN-14
|CN-51|CN-53|CN-33|CN-45|CN-15|CN-64|CN-54|CN-65|CN-11|CN-50
|CN-31|CN-12|CN-91|CN-92 = China
|CN-71 = Taiwan
|CO|CO-DC|CO-AMA|CO-ANT|CO-ARA|CO-ATL|CO-BOL|CO-BOY|CO-CAL
|CO-CAQ|CO-CAS|CO-CAU|CO-CES|CO-CHO|CO-COR|CO-CUN|CO-GUA|CO-GUV
|CO-HUI|CO-LAG|CO-MAG|CO-MET|CO-NAR|CO-NSA|CO-PUT|CO-QUI|CO-RIS
|CO-SAP|CO-SAN|CO-SUC|CO-TOL|CO-VAC|CO-VAU|CO-VID = Colombia
|CR|CR-A|CR-C|CR-G|CR-H|CR-L|CR-P|CR-SJ = Costa Rica
|CS|CS-SR|CS-VO = Serbia
|CS-CG = Montenegro
|CS-KM = Kosovo
|CU|CU-01|CU-02|CU-03|CU-04|CU-05|CU-06|CU-07|CU-08|CU-09
|CU-10|CU-11|CU-12|CU-13|CU-14|CU-99 = Cuba
|CV|CV-BV|CV-BR|CV-MA|CV-MO|CV-PA|CV-PN|CV-PR|CV-RG|CV-SL
|CV-CA|CV-CR|CV-SD|CV-SF|CV-CS|CV-SN|CV-SV|CV-TA = Cape Verde
|CY|CY-03|CY-01|CY-04|CY-05|CY-02|CY-06 = Cyprus
|CZ|CZ-JC|CZ-JM|CZ-KA|CZ-KR|CZ-LI|CZ-MO|CZ-OL|CZ-PA|CZ-PL
|CZ-PR|CZ-ST|CZ-US|CZ-VY|CZ-ZL = Czech Republic
|DE = Germany
|DE-BE = Germany Berlin
|DE-BR = Germany Brandenburg
|DE-BW = Germany Baden-Württemberg
|DE-BY = Germany Bavaria
|DE-HB|DE-NI = Germany Lower Saxony
|DE-HE = Germany Hesse
|DE-HH = Germany Hamburg
|DE-MV = Germany Mecklenburg-Vorpommern
|DE-NW = Germany North Rhine-Westphalia
|DE-RP = Germany Rhineland-Palatinate
|DE-SH = Germany Schleswig-Holstein
|DE-SL = Germany Saarland
|DE-SN = Germany Saxony
|DE-ST = Germany Saxony-Anhalt
|DE-TH = Germany Thuringia
|DJ|DJ-AS|DJ-DI|DJ-DJ|DJ-OB|DJ-TA|DJ-AR = Djibouti
|DK|DK-015|DK-020|DK-025|DK-030|DK-035|DK-040|DK-042|DK-050
|DK-055|DK-060|DK-065|DK-070|DK-076|DK-080|DK-81|DK-82
|DK-83|DK-84|DK-85|DK-101|DK-147 = Denmark
|DM|DM-02|DM-03|DM-04|DM-05|DM-06|DM-07|DM-08|DM-09
|DM-10|DM-11 = Dominica
|DO|DO-02|DO-03|DO-04|DO-05|DO-01|DO-06|DO-07|DO-08|DO-09
|DO-30|DO-10|DO-11|DO-12|DO-13|DO-14|DO-28|DO-15|DO-29
|DO-16|DO-17|DO-18|DO-19|DO-20|DO-21|DO-22|DO-23|DO-24
|DO-25|DO-26|DO-27 = Dominican Republic
|DZ|DZ-01|DZ-44|DZ-46|DZ-16|DZ-23|DZ-05|DZ-08|DZ-06|DZ-07
|DZ-09|DZ-34|DZ-10|DZ-35|DZ-02|DZ-25|DZ-17|DZ-32|DZ-39|DZ-36
|DZ-47|DZ-24|DZ-33|DZ-18|DZ-40|DZ-03|DZ-26|DZ-43|DZ-27|DZ-29
|DZ-28|DZ-45|DZ-31|DZ-30|DZ-04|DZ-48|DZ-20 = Algeria
|EC|EC-A|EC-B|EC-C|EC-D|EC-E|EC-F|EC-G|EC-H|EC-I|EC-L|EC-M
|EC-N|EC-O|EC-P|EC-R|EC-S|EC-T|EC-U|EC-W|EC-X|EC-Y|EC-Z = Ecuador
|EE|EE-37|EE-39|EE-44|EE-49|EE-51|EE-57|EE-59|EE-65|EE-67
|EE-70|EE-74|EE-78|EE-82|EE-84|EE-86 = Estonia
|EG|EG-DK|EG-BA|EG-BH|EG-FYM|EG-GH|EG-ALX|EG-IS|EG-GZ|EG-MNF
|EG-MN|EG-C|EG-KB|EG-WAD|EG-SHR|EG-SUZ|EG-ASN|EG-AST|EG-BNS
|EG-PTS|EG-DT|EG-JS|EG-KFS|EG-MT|EG-KN|EG-SIN|EG-SHG = Egypt
|ER|ER-AN|ER-DK|ER-DU|ER-GB|ER-MA|ER-SK = Eritrea
|ES|ES-AN|ES-AR|ES-O|ES-IB|ES-PV|ES-EX|ES-GA|ES-CA|ES-S|ES-CM
|ES-CL|ES-CT|ES-LO|ES-M|ES-MU|ES-NA|ES-VC|ES-VI|ES-AB|ES-A
|ES-AL|ES-AV|ES-BA|ES-B|ES-BU|ES-CC|ES-S|ES-CS|ES-CR
|ES-CO|ES-CU|ES-GI|ES-GR|ES-GU|ES-SS|ES-H|ES-HU|ES-J|ES-C
|ES-LO|ES-LE|ES-L|ES-LU|ES-M|ES-MA|ES-MU|ES-NA|ES-OR
|ES-P|ES-PO|ES-SA|ES-SG|ES-SE|ES-SO|ES-T|ES-TE|ES-TO
|ES-V|ES-VA|ES-BI|ES-ZA|ES-Z = Spain
|ES-CN|ES-GC|ES-TF = Spain Canary Islands
|ES-CT = Spain Catalonia
|ES-O = Spain Asturias
|ET|ET-AA|ET-AF|ET-AM|ET-BE|ET-DD|ET-GA|ET-HA|ET-OR
|ET-SO|ET-SN|ET-TI = Ethiopia
|FI|FI-AL|FI-ES|FI-IS|FI-LL|FI-LS|FI-OL = Finland
|FJ|FJ-C|FJ-E|FJ-N|FJ-R|FJ-W = Fiji
|FK = Falkland Islands
|FO = Faroe Islands
|FR|FR-01|FR-02|FR-03|FR-04|FR-05|FR-06|FR-07|FR-08|FR-09
|FR-10|FR-11|FR-12|FR-13|FR-14|FR-15|FR-16|FR-17|FR-18
|FR-19|FR-21|FR-22|FR-23|FR-24|FR-25|FR-26|FR-27|FR-28
|FR-29|FR-30|FR-31|FR-32|FR-33|FR-34|FR-35
|FR-36|FR-37|FR-38|FR-39|FR-40|FR-41|FR-42|FR-43|FR-44
|FR-45|FR-46|FR-47|FR-48|FR-49|FR-50|FR-51|FR-52|FR-53
|FR-54|FR-55|FR-56|FR-57|FR-58|FR-59|FR-60|FR-61|FR-62
|FR-63|FR-64|FR-65|FR-66|FR-67|FR-68|FR-69|FR-70|FR-71
|FR-72|FR-73|FR-74|FR-75|FR-76|FR-77|FR-78|FR-79|FR-80
|FR-81|FR-82|FR-83|FR-84|FR-85|FR-86|FR-87|FR-88|FR-89
|FR-90|FR-91|FR-92|FR-93|FR-94|FR-95|FR-A|FR-B|FR-C|FR-D
|FR-E|FR-F|FR-G|FR-I|FR-J|FR-K|FR-L|FR-M|FR-N|FR-O
|FR-P|FR-Q|FR-R|FR-S|FR-T|FR-U|FR-V = France
|FR-GF = French Guiana
|FR-GP = Guadeloupe
|FR-H|FR-2A|FR-2B = France Corsica
|FR-MQ = Martinique
|FR-RE = Réunion
|GA|GA-1|GA-2|GA-3|GA-4|GA-5|GA-6|GA-7|GA-8|GA-9 = Gabon
|GB|GB-BGW|GB-BGE|GB-CAY|GB-CRF|GB-CMN|GB-CGN|GB-CWY|GB-DEN
|GB-FLN|GB-GWN|GB-AGY|GB-MTY|GB-MON|GB-NTL|GB-NWP|GB-PEM
|GB-POW|GB-RCT|GB-SWA|GB-TOF|GB-VGL|GB-WRX|GB-GSY|GB-JSY|GB-IOM = United Kingdom
|GB-BDG|GB-BNE|GB-BNS|GB-BAS|GB-BDF|GB-BEX|GB-BIR|GB-BBD
|GB-BPL|GB-BOL|GB-BMH|GB-BRC|GB-BRD|GB-BEN|GB-BNH|GB-BST|GB-BRY
|GB-BKM|GB-BUR|GB-CLD|GB-CAM|GB-CMD|GB-CHS|GB-CON|GB-COV|GB-CRY
|GB-CMA|GB-DAL|GB-DER|GB-DBY|GB-DEV|GB-DNC|GB-DOR|GB-DUD|GB-DUR
|GB-EAL|GB-ERY|GB-ESX|GB-ENF|GB-ESS|GB-GAT|GB-GLS|GB-GRE|GB-HCK
|GB-HAL|GB-HMF|GB-HAM|GB-HRY|GB-HRW|GB-HPL|GB-HAV|GB-HEF|GB-HRT
|GB-HIL|GB-HNS|GB-IOW|GB-IOS|GB-ISL|GB-KEC|GB-KEN|GB-KHL|GB-KTT
|GB-KIR|GB-KWL|GB-LBH|GB-LAN|GB-LDS|GB-LCE|GB-LEC|GB-LEW|GB-LIN
|GB-LIV|GB-LND|GB-LUT|GB-MAN|GB-MDW|GB-MRT|GB-MDB|GB-MIK|GB-NET
|GB-NWM|GB-NFK|GB-NEL|GB-NLN|GB-NSM|GB-NTY|GB-NYK|GB-NTH|GB-NBL
|GB-NGM|GB-NTT|GB-OLD|GB-OXF|GB-PTE|GB-PLY|GB-POL|GB-POR|GB-RDG
|GB-RDB|GB-RCC|GB-RIC|GB-RCH|GB-ROT|GB-RUT|GB-SHN|GB-SLF|GB-SAW
|GB-SFT|GB-SHF|GB-SHR|GB-SLG|GB-SOL|GB-SOM|GB-SGC|GB-STY|GB-STH
|GB-SOS|GB-SWK|GB-STS|GB-SKP|GB-STT|GB-STE|GB-SFK|GB-SND|GB-SRY
|GB-STN|GB-SWD|GB-TAM|GB-TFW|GB-THR|GB-TOB|GB-TWH|GB-TRF|GB-WKF
|GB-WLL|GB-WFT|GB-WND|GB-WRT|GB-WAR|GB-WBK|GB-WSX|GB-WSM|GB-WGN
|GB-WIL|GB-WNM|GB-WRL|GB-WOK|GB-WLV|GB-WOR|GB-YOR = UK England
|GB-ABE|GB-ABD|GB-ANS|GB-AGB|GB-CLK|GB-DGY|GB-DND|GB-EAY|GB-EDU
|GB-ELN|GB-ERW|GB-EDH|GB-ELS|GB-FAL|GB-FIF|GB-GLG|GB-HLD|GB-IVC
|GB-MLN|GB-MRY|GB-NAY|GB-NLK|GB-ORK|GB-PKN|GB-RFW|GB-SCB|GB-ZET
|GB-SAY|GB-SLK|GB-STG|GB-WDU|GB-WLN = UK Scotland
|GB-ANT|GB-ARD|GB-ARM|GB-BLA|GB-BLY|GB-BNB|GB-BFS|GB-CKF|GB-CSR
|GB-CLR|GB-CKT|GB-CGV|GB-DRY|GB-DOW|GB-DGN|GB-FER|GB-LRN|GB-LMV
|GB-LSB|GB-MFT|GB-MYL|GB-NYM|GB-NTA|GB-NDN|GB-OMH|GB-STB = Northern Ireland
|GD|GD-01|GD-02|GD-03|GD-04|GD-05|GD-06|GD-10 = Grenada
|GE|GE-AB|GE-AJ|GE-TB|GE-GU|GE-IM|GE-KA|GE-KK|GE-MM
|GE-RL|GE-SZ|GE-SJ|GE-SK = Georgia
|GF = French Guiana
|GH|GH-AH|GH-BA|GH-CP|GH-EP|GH-AA|GH-NP|GH-UE|GH-UW|GH-TV
|GH-WP = Ghana
|GL = Greenland
|GM|GM-C|GM-B|GM-L|GM-N|GM-U|GM-W = Gambia
|GN|GN-C|GN-B|GN-F|GN-K|GN-D|GN-L|GN-M|GN-N|GN-BE|GN-BF|GN-BK
|GN-CO|GN-DB|GN-DI|GN-DL|GN-DU|GN-FA|GN-FO|GN-FR|GN-GA|GN-GU|GN-KA
|GN-KB|GN-KD|GN-KE|GN-KN|GN-KO|GN-KS|GN-LA|GN-LE|GN-LO|GN-MC|GN-MD
|GN-ML|GN-MM|GN-NZ|GN-PI|GN-SI|GN-TE|GN-TO|GN-YO = Guinea
|GP = Guadeloupe
|GQ|GQ-AN|GQ-BN|GQ-BS|GQ-CS|GQ-KN|GQ-LI|GQ-WN = Equatorial Guinea
|GR|GR-13|GR-11|GR-12|GR-31|GR-01|GR-A1|GR-69|GR-03|GR-64
|GR-94|GR-85|GR-81|GR-52|GR-14|GR-04|GR-05|GR-71|GR-63|GR-51
|GR-53|GR-33|GR-91|GR-41|GR-56|GR-55|GR-23|GR-57|GR-22|GR-15
|GR-58|GR-82|GR-16|GR-42|GR-92|GR-24|GR-83|GR-43|GR-17|GR-59
|GR-06|GR-07|GR-61|GR-34|GR-93|GR-73|GR-84|GR-62|GR-32|GR-54
|GR-44|GR-72|GR-21 = Greece
|GT|GT-AV|GT-BV|GT-CM|GT-CQ|GT-PE|GT-PR|GT-QC|GT-ES|GT-GU
|GT-HU|GT-IZ|GT-JA|GT-JU|GT-QZ|GT-RE|GT-SA|GT-SM|GT-SR
|GT-SO|GT-SU|GT-TO|GT-ZA = Guatemala
|GW|GW-BA|GW-BM|GW-BS|GW-BL|GW-CA|GW-GA|GW-OI|GW-QU|GW-TO = Guinea-Bissau
|GY|GY-BA|GY-CU|GY-DE|GY-EB|GY-ES|GY-MA|GY-PM|GY-PT|GY-UD
|GY-UT = Guyana
|HN|HN-AT|HN-CH|HN-CL|HN-CM|HN-CP|HN-CR|HN-EP|HN-FM|HN-GD
|HN-IN|HN-IB|HN-LP|HN-LE|HN-OC|HN-OL|HN-SB|HN-VA|HN-YO = Honduras
|HR-01|HR-02|HR-03|HR-04|HR-05|HR-06|HR-07|HR-08|HR-09
|HR-10|HR-11|HR-12|HR-13|HR-14|HR-15|HR-16|HR-17|HR-18
|HR-19|HR-20|HR-21|HR = Croatia
|HT|HT-CE|HT-GA|HT-ND|HT-NE|HT-NO|HT-OU|HT-SD|HT-SE = Haiti
|HU|HU-BK|HU-BA|HU-BE|HU-BC|HU-BZ|HU-BU|HU-CS|HU-DE|HU-DU
|HU-EG|HU-FE|HU-GY|HU-GS|HU-HB|HU-HE|HU-HV|HU-JN|HU-KV|HU-KM
|HU-KE|HU-MI|HU-NK|HU-NO|HU-NY|HU-PS|HU-PE|HU-ST|HU-SO|HU-SN
|HU-SZ|HU-SD|HU-SF|HU-SS|HU-SK|HU-SH|HU-TB|HU-TO|HU-VA|HU-VM
|HU-VE|HU-ZA|HU-ZE = Hungary
|ID|ID-BA|ID-BB|ID-BT|ID-BE|ID-GO|ID-JA|ID-JB|ID-JT|ID-JI
|ID-KB|ID-KS|ID-KT|ID-KI|ID-KR|ID-LA|ID-MA|ID-MU|ID-NB|ID-NT
|ID-PA|ID-RI|ID-SR|ID-SN|ID-ST|ID-SG|ID-SA|ID-SB|ID-SS|ID-SU
|ID-AC|ID-JK|ID-YO = Indonesia
|IE|IE-CW|IE-CN|IE-CE|IE-C|IE-DL|IE-D|IE-G|IE-KY|IE-KE|IE-KK
|IE-LS|IE-LM|IE-LK|IE-LD|IE-LO|IE-MO|IE-MH|IE-MN|IE-OY|IE-RN
|IE-SO|IE-TA|IE-WD|IE-WH|IE-WX|IE-WW = Ireland
|IL|IL-D|IL-HA|IL-JM|IL-M|IL-TA|IL-Z = Israel
|IN|IN-AP|IN-AR|IN-AS|IN-BR|IN-CG|IN-GA|IN-GJ|IN-HR|IN-HP
|IN-JK|IN-JH|IN-KA|IN-KL|IN-MP|IN-MH|IN-MN|IN-ML|IN-MZ|IN-NL
|IN-OR|IN-PB|IN-RJ|IN-SK|IN-TR|IN-UA|IN-UP|IN-WB|IN-AN
|IN-CH|IN-DN|IN-DD|IN-DL|IN-LD|IN-PY = India
|IN-TN = India Tamil Nadu
|IS|IS-1|IS-6|IS-5|IS-7|IS-8|IS-2|IS-3|IS-4 = Iceland
|IQ|IQ-AN|IQ-AR|IQ-BB|IQ-BG|IQ-BA|IQ-DA|IQ-DQ|IQ-DI|IQ-KA
|IQ-MA|IQ-MU|IQ-NA|IQ-NI|IQ-QA|IQ-SD|IQ-SU|IQ-TS|IQ-WA = Iraq
|IR|IR-01|IR-02|IR-03|IR-04|IR-05|IR-06|IR-07|IR-08|IR-09
|IR-10|IR-11|IR-12|IR-13|IR-14|IR-15|IR-16|IR-17|IR-18|IR-19
|IR-20|IR-21|IR-22|IR-23|IR-24|IR-25|IR-26|IR-27|IR-28 = Iran
|IT|IT-65|IT-75|IT-23|IT-77|IT-45|IT-36|IT-78|IT-72|IT-62
|IT-42|IT-25|IT-57|IT-67|IT-21|IT-88|IT-82|IT-52|IT-32|IT-55
|IT-34|IT-AL|IT-AN|IT-AO|IT-AP|IT-AQ|IT-AR|IT-AT|IT-AV|IT-BA
|IT-BG|IT-BI|IT-BL|IT-BN|IT-BO|IT-BR|IT-BS|IT-BZ|IT-CA|IT-CB
|IT-CE|IT-CH|IT-CI|IT-CL|IT-CN|IT-CO|IT-CR|IT-CS|IT-CT|IT-CZ
|IT-EN|IT-FE|IT-FG|IT-FI|IT-FO|IT-FR|IT-GE|IT-GO|IT-GR|IT-IM
|IT-IS|IT-KR|IT-LC|IT-LE|IT-LI|IT-LO|IT-LT|IT-LU|IT-MC|IT-MD
|IT-ME|IT-MI|IT-MN|IT-MO|IT-MS|IT-MT|IT-NA|IT-NO|IT-NU|IT-OG
|IT-OR|IT-OT|IT-PA|IT-PC|IT-PD|IT-PE|IT-PG|IT-PI|IT-PN|IT-PO
|IT-PR|IT-PT|IT-PU|IT-PV|IT-PZ|IT-RA|IT-RC|IT-RE|IT-RG|IT-RI
|IT-RM|IT-RN|IT-RO|IT-SA|IT-SI|IT-SO|IT-SP|IT-SR|IT-SS|IT-SV
|IT-TA|IT-TE|IT-TN|IT-TO|IT-TP|IT-TR|IT-TS|IT-TV|IT-UD|IT-VA
|IT-VB|IT-VC|IT-VE|IT-VI|IT-VR|IT-VT|IT-VV = Italy
|JM|JM-13|JM-09|JM-01|JM-12|JM-04|JM-02|JM-06|JM-14|JM-11
|JM-08|JM-05|JM-03|JM-07|JM-10 = Jamaica
|JO = Jordan
|JP|JP-01|JP-02|JP-03|JP-04|JP-05|JP-06|JP-07|JP-08|JP-09
|JP-10|JP-11|JP-12|JP-13|JP-14|JP-15|JP-16|JP-17|JP-18
|JP-19|JP-20|JP-21|JP-22|JP-23|JP-24|JP-25|JP-26|JP-27
|JP-28|JP-29|JP-30|JP-31|JP-32|JP-33|JP-34|JP-35|JP-36
|JP-37|JP-38|JP-39|JP-40|JP-41|JP-42|JP-43|JP-44|JP-45
|JP-46|JP-47 = Japan
|KE|KE-200|KE-300|KE-400|KE-110|KE-500|KE-600|KE-700
|KE-900 = Kenya
|KG|KG-B|KG-GB|KG-J|KG-N|KG-O|KG-T|KG-C|KG-Y = Kyrgyzstan
|KH|KH-1|KH-2|KH-7|KH-8|KH-9|KH-3|KH-4|KH-5|KH-6|KH-10|KH-11
|KH-22|KH-15|KH-13|KH-14|KH-16|KH-17|KH-19|KH-20|KH-21|KH-23
|KH-24|KH-12|KH-18 = Cambodia
|KM|KM-A|KM-G|KM-M = Comoros
|KP|KP-CHA|KP-HAB|KP-HAN|KP-HWB|KP-HWN|KP-KAN|KP-PYB|KP-PYN
|KP-YAN|KP-KAE|KP-NAJ|KP-NAM|KP-PYO = North Korea
|KR|KR-26|KR-43|KR-44|KR-27|KR-30|KR-42|KR-29|KR-41|KR-47
|KR-48|KR-28|KR-49|KR-45|KR-46|KR-11|KR-31 = South Korea
|KW|KW-AH|KW-JA|KW-FA|KW-KU|KW-HW|KW-MU = Kuwait
|KZ|KZ-ALM|KZ-AKM|KZ-AKT|KZ-ATY|KZ-MAN|KZ-SEV|KZ-VOS|KZ-PAV
|KZ-KAR|KZ-KUS|KZ-KZY|KZ-ZHA|KZ-YUZ|KZ-ZAP = Kazakhstan
|LA|LA-AT|LA-BK|LA-BL|LA-CH|LA-HO|LA-KH|LA-LM|LA-LP|LA-OU
|LA-PH|LA-SL|LA-SV|LA-VI|LA-VT|LA-XA|LA-XE|LA-XI|LA-XN = Laos
|LB|LB-NL|LB-BA|LB-BI|LB-JL|LB-NA|LB-AS|LB-JA = Lebanon
|LI|LI-01|LI-02|LI-03|LI-04|LI-05|LI-06|LI-07|LI-08|LI-09
|LI-10|LI-11 = Liechtenstein
|LK|LK-52|LK-71|LK-81|LK-51|LK-11|LK-31|LK-12|LK-33|LK-41
|LK-13|LK-21|LK-92|LK-42|LK-61|LK-43|LK-22|LK-32|LK-82|LK-45
|LK-23|LK-72|LK-62|LK-91|LK-53|LK-44 = Sri Lanka
|LR|LR-BM|LR-BG|LR-GP|LR-CM|LR-GB|LR-GG|LR-GK|LR-LO|LR-MG
|LR-MY|LR-MO|LR-NI|LR-RI|LR-RG|LR-I = Liberia
|LS|LS-A|LS-B|LS-C|LS-D|LS-E|LS-F|LS-G|LS-H|LS-J|LS-K = Lesotho
|LT|LT-AL|LT-KU|LT-KL|LT-MR|LT-PN|LT-SA|LT-TA|LT-TE
|LT-UT|LT-VL = Lithuania
|LU|LU-D|LU-G|LU-L = Luxembourg
|LV|LV-AI|LV-AL|LV-BL|LV-BU|LV-CE|LV-DGV|LV-DA|LV-DO|LV-GU
|LV-JEL|LV-JL|LV-JUR|LV-KR|LV-KU|LV-LPX|LV-LE|LV-LM|LV-LU
|LV-MA|LV-OG|LV-PR|LV-REZ|LV-RE|LV-RIX|LV-RI|LV-SA|LV-TA
|LV-TU|LV-VK|LV-VM|LV-VE|LV-VEN = Latvia
|LY|LY-AJ|LY-BW|LY-BA|LY-BU|LY-HZ|LY-JA|LY-JI|LY-JU|LY-KF
|LY-MJ|LY-MB|LY-QB|LY-WA|LY-NQ|LY-ZA|LY-DR|LY-GD|LY-GR
|LY-GT|LY-MI|LY-MZ|LY-MQ|LY-NL|LY-SB|LY-SS|LY-SR|LY-TN
|LY-TB|LY-TM|LY-WD|LY-SH|LY-YJ = Libya
|MA|MA-09|MA-10|MA-05|MA-02|MA-08|MA-14|MA-15|MA-11|MA-06
|MA-04|MA-16|MA-07|MA-13|MA-12|MA-01|MA-03|MA-BES|MA-KHO|MA-SET
|MA-JDI|MA-SAF|MA-BOM|MA-FES|MA-SEF|MA-KEN|MA-SIK|MA-CAS|MA-ASZ
|MA-ESM|MA-GUE|MA-TNT|MA-TAT|MA-BOD|MA-LAA|MA-CHI|MA-KES|MA-ESI
|MA-MAR|MA-HAJ|MA-ERR|MA-IFR|MA-KHN|MA-MEK|MA-BER|MA-FIG|MA-JRA
|MA-NAD|MA-OUJ|MA-OUD|MA-KHE|MA-RBA|MA-AGD|MA-BAH|MA-MEL|MA-OUA
|MA-TAR|MA-TIZ|MA-AZI|MA-BEM|MA-CHE|MA-LAR|MA-TNG|MA-TET|MA-HOC
|MA-TAO|MA-TAZ = Morocco
|MD|MD-GA|MD-CU|MD-BA|MD-CA|MD-CH|MD-ED|MD-LA|MD-OR|MD-SO
|MD-TA|MD-TI|MD-UN|MD-SN = Moldova
|ME|ME-01|ME-02|ME-03|ME-04|ME-05|ME-06|ME-07|ME-08|ME-09
|ME-10|ME-11|ME-12|ME-13|ME-14|ME-15|ME-16|ME-17|ME-18
|ME-19|ME-20|ME-21 = Montenegro
|MG|MG-T|MG-D|MG-F|MG-M|MG-A|MG-U = Madagascar
|MH = Marshall islands
|MK = Macedonia
|ML|ML-BK0|ML-7|ML-1|ML-8|ML-2|ML-5|ML-4|ML-3|ML-6 = Mali
|MM|MM-14|MM-11|MM-12|MM-13|MM-15|MM-16|MM-17|MM-02|MM-07
|MM-03|MM-04|MM-01|MM-05|MM-06 = Myanmar
|MN|MN-073|MN-071|MN-069|MN-067|MN-039|MN-043|MN-041|MN-037
|MN-063|MN-061|MN-059|MN-065|MN-064|MN-035|MN-053|MN-055
|MN-049|MN-051|MN-047|MN-1|MN-046|MN-057 = Mongolia
|MP = Northern Mariana Islands
|MQ = Martinique
|MR|MR-07|MR-03|MR-05|MR-08|MR-04|MR-10|MR-01|MR-02|MR-12
|MR-NKC|MR-09|MR-11|MR-06 = Mauritania
|MT = Malta
|MU|MU-BR|MU-CU|MU-PU|MU-QB|MU-VP|MU-AG|MU-CC|MU-RO|MU-BL
|MU-FL|MU-GP|MU-MO|MU-PA|MU-PW|MU-PL|MU-RR|MU-SA = Mauritius
|MV = Maldives
|MW|MW-N|MW-S|MW-Z|MW-BA|MW-BL|MW-CK|MW-CR|MW-CT|MW-DE|MW-DO|MW-KR
|MW-KS|MW-LK|MW-LI|MW-MH|MW-MG|MW-MC|MW-MU|MW-MW|MW-MZ|MW-NB|MW-NK
|MW-NS|MW-NU|MW-NI|MW-PH|MW-RU|MW-SA|MW-TH|MW-ZO = Malawi
|MX|MX-AGU|MX-BCN|MX-BCS|MX-CAM|MX-CHP|MX-CHH|MX-COA|MX-COL
|MX-DIF|MX-DUR|MX-GUA|MX-GRO|MX-HID|MX-JAL|MX-MEX|MX-MIC
|MX-MOR|MX-NAY|MX-NLE|MX-OAX|MX-PUE|MX-QUE|MX-ROO|MX-SLP
|MX-SIN|MX-SON|MX-TAB|MX-TAM|MX-TLA|MX-VER|MX-YUC|MX-ZAC = Mexico
|MY|MY-01|MY-02|MY-03|MY-04|MY-05|MY-06|MY-08|MY-09|MY-07
|MY-12|MY-13|MY-10|MY-11|MY-14|MY-15|MY-16 = Malaysia
|MZ|MZ-P|MZ-G|MZ-I|MZ-B|MZ-MPM|MZ-L|MZ-N|MZ-A
|MZ-S|MZ-T|MZ-Q = Mozambique
|NA|NA-CA|NA-ER|NA-HA|NA-KA|NA-OK|NA-KH|NA-KU|NA-OW|NA-OH
|NA-OS|NA-ON|NA-OT|NA-OD = Namibia
|NE|NE-1|NE-2|NE-3|NE-4|NE-8|NE-5|NE-6|NE-7 = Niger
|NG|NG-AB|NG-AD|NG-AK|NG-AN|NG-BA|NG-BY|NG-BE|NG-BO|NG-CR
|NG-DE|NG-EB|NG-ED|NG-EK|NG-EN|NG-FC|NG-GO|NG-IM|NG-JI|NG-KD
|NG-KN|NG-KT|NG-KE|NG-KO|NG-KW|NG-LA|NG-NA|NG-NI|NG-OG|NG-ON
|NG-OS|NG-OY|NG-PL|NG-RI|NG-SO|NG-TA|NG-YO|NG-ZA = Nigeria
|NI|NI-AN|NI-AS|NI-BO|NI-CA|NI-CI|NI-CO|NI-ES|NI-GR|NI-JI
|NI-LE|NI-MD|NI-MN|NI-MS|NI-MT|NI-NS|NI-SJ|NI-RI = Nicaragua
|NL|NL-FL|NL-FR|NL-GR|NL-LI|NL-NB|NL-NH|NL-OV
|NL-ZH|NL-UT = Netherlands
|NL-DR = Netherlands Drenthe
|NL-GE = Netherlands Gelderland
|NL-UT = Netherlands Utrecht
|NO|NO-01|NO-02|NO-03|NO-04|NO-05|NO-06|NO-07|NO-08|NO-09|NO-10
|NO-11|NO-12|NO-14|NO-15|NO-16|NO-17|NO-18|NO-19|NO-20 = Norway
|NP|NP-BA|NP-BH|NP-DH|NP-GA|NP-JA|NP-KA|NP-KO|NP-LU|NP-MA
|NP-ME|NP-NA|NP-RA|NP-SA|NP-SE = Nepal
|NZ|NZ-AUK|NZ-BOP|NZ-CAN|NZ-GIS|NZ-HKB|NZ-MWT|NZ-MBH|NZ-NSN
|NZ-NTL|NZ-OTA|NZ-STL|NZ-TKI|NZ-TAS|NZ-WKO|NZ-WGN|NZ-WTC = New Zealand
|OM|OM-DA|OM-ZA|OM-SH|OM-BA|OM-JA|OM-MA|OM-MU|OM-WU = Oman
|PA|PA-1|PA-2|PA-3|PA-4|PA-5|PA-6|PA-Q|PA-7|PA-8|PA-9 = Panama
|PE|PE-AMA|PE-ANC|PE-APU|PE-ARE|PE-AYA|PE-CAJ|PE-CAL|PE-CUS
|PE-HUV|PE-HUC|PE-ICA|PE-JUN|PE-LAL|PE-LAM|PE-LIM|PE-LOR|PE-MDD
|PE-MOQ|PE-PAS|PE-PIU|PE-PUN|PE-SAM|PE-TAC|PE-TUM|PE-UCA = Peru
|PG|PG-CPM|PG-CPK|PG-EHG|PG-EBR|PG-ESW|PG-EPW|PG-GPK|PG-MPM
|PG-MRL|PG-MBA|PG-MPL|PG-NCD|PG-NIK|PG-NPP|PG-NSA|PG-SAN
|PG-SHM|PG-WPD|PG-WHM|PG-WBK = Papua New Guinea
|PH|PH-00|PH-01|PH-02|PH-03|PH-04|PH-05|PH-06|PH-07|PH-08
|PH-09|PH-10|PH-11|PH-12|PH-13|PH-14|PH-15|PH-ABR|PH-AGN|PH-AKL
|PH-ALB|PH-ANT|PH-APA|PH-AUR|PH-BAN|PH-BAS|PH-BEN|PH-BIL|PH-BOH
|PH-BTG|PH-BTN|PH-BUK|PH-BUL|PH-CAG|PH-CAM|PH-CAN|PH-CAP|PH-CAS
|PH-CAT|PH-CAV|PH-CEB|PH-COM|PH-DAO|PH-DAS|PH-DAV|PH-EAS|PH-GUI
|PH-IFU|PH-ILI|PH-ILN|PH-ILS|PH-ISA|PH-KAL|PH-LAG|PH-LAN|PH-LAS
|PH-LEY|PH-LUN|PH-MAD|PH-MAG|PH-MAS|PH-MDC|PH-MDR|PH-MOU|PH-MSC
|PH-MSR|PH-NCO|PH-NSA|PH-NEC|PH-NER|PH-NUE|PH-NUV|PH-PAM|PH-PAN
|PH-PLW|PH-QUE|PH-QUI|PH-RIZ|PH-ROM|PH-SAR|PH-SCO|PH-SIG|PH-SLE
|PH-SLU|PH-SOR|PH-SUK|PH-SUN|PH-SUR|PH-TAR|PH-TAW|PH-WSA|PH-ZAN
|PH-ZAS|PH-ZMB|PH-ZSI = Philippines
|PK|PK-BA|PK-IS|PK-JK|PK-NA|PK-NW|PK-PB|PK-SD|PK-TA = Pakistan
|PL|PL-WN|PL-WP|PL-SK|PL-PK|PL-MA|PL-KP|PL-LB|PL-LU|PL-LD
|PL-MZ|PL-DS|PL-OP|PL-PD|PL-PM|PL-SL|PL-ZP = Poland
|PS = Palestine
|PT|PT-01|PT-02|PT-03|PT-04|PT-05|PT-06|PT-07|PT-08|PT-09
|PT-10|PT-11|PT-12|PT-13|PT-14|PT-15|PT-16|PT-17|PT-18 = Portugal
|PT-20 = Portugal Azores
|PT-30 = Portugal Madeira
|PY|PY-16|PY-10|PY-13|PY-19|PY-5|PY-6|PY-14|PY-11|PY-1|PY-3
|PY-ASU|PY-4|PY-7|PY-8|PY-12|PY-9|PY-15|PY-2 = Paraguay
|QA = Qatar
|RE = Réunion
|RO|RO-B|RO-AB|RO-AR|RO-AG|RO-BC|RO-BH|RO-BN|RO-BT|RO-BR
|RO-BV|RO-BZ|RO-CS|RO-CL|RO-CJ|RO-CT|RO-CV|RO-DB|RO-DJ|RO-GL
|RO-GR|RO-GJ|RO-HR|RO-HD|RO-IL|RO-IS|RO-IF|RO-MM|RO-MH|RO-MS
|RO-NT|RO-OT|RO-PH|RO-SJ|RO-SM|RO-SB|RO-SV|RO-TR|RO-TM|RO-TL
|RO-VL|RO-VS|RO-VN = Romania
|RS|RS-00|RS-01|RS-02|RS-03|RS-04|RS-05|RS-06|RS-07|RS-08
|RS-09|RS-10|RS-11|RS-12|RS-13|RS-14|RS-15|RS-16|RS-17
|RS-18|RS-19|RS-20|RS-21|RS-22|RS-23|RS-24|RS-VO = Serbia
|RS-25|RS-26|RS-27|RS-28|RS-29|RS-KM = Kosovo
|RU|RU-AD|RU-AGB|RU-AMU|RU-AST|RU-BA|RU-BEL|RU-BRY|RU-BU
|RU-CE|RU-CHE|RU-CHI|RU-CU|RU-EVE|RU-IN|RU-IRK|RU-IVA
|RU-KAM|RU-KB|RU-KC|RU-KEM|RU-KGN|RU-KHA|RU-KHM|RU-KIR
|RU-KK|RU-KL|RU-KLU|RU-KO|RU-KOR|RU-KRS|RU-KYA|RU-MAG
|RU-ME|RU-MO|RU-MOV|RU-NEN|RU-NVS|RU-OMS|RU-ORE|RU-ORL
|RU-PER|RU-PNZ|RU-PSK|RU-ROS|RU-SA|RU-SAK|RU-SAM|RU-SAR
|RU-SE|RU-STA|RU-TA|RU-TAM|RU-TAY|RU-TUL|RU-TY|RU-TYU
|RU-UD|RU-ULY|RU-UOB|RU-VGG|RU-YAN|RU-YAR|RU-YEV = Russia
|RU-AL|RU-ALT = Russia Altai Krai
|RU-ARK = Russia Arkhangelsk Oblast
|RU-CHU = Russia Chukotka Autonomous Okrug
|RU-DA = Russia Dagestan
|RU-KOS = Russia Kostroma Oblast
|RU-KDA = Russia Krasnodar Krai
|RU-KGD = Russia Kaliningrad Oblast
|RU-KR = Russia Republic of Karelia
|RU-LEN = Russia Leningrad Oblast
|RU-LIP = Russia Lipetsk Oblast
|RU-MOS = Russia Moscow Oblast
|RU-MUR = Russia Murmansk Oblast
|RU-NIZ = Russia Nizhny Novgorod Oblast
|RU-NGR = Russia Novgorod Oblast
|RU-PRI = Russia Primorsky Krai
|RU-RYA = Russia Ryazanskaya Oblast
|RU-SMO = Russia Smolensk Oblast
|RU-SPE = Russia Saint Petersburg
|RU-SVE = Russia Sverdlovsk Oblast
|RU-TOM = Russia Tomsk Oblast
|RU-TVE = Russia Tver Oblast
|RU-VLA = Russia Vladimir Oblast
|RU-VLG = Russia Vologda Oblast
|RU-VOR = Russia Voronezh Oblast
|RW|RW-C|RW-I|RW-E|RW-D|RW-G|RW-B|RW-J|RW-F|RW-L|RW-K
|RW-H|RW-M = Rwanda
|SA = Saudi Arabia
|SC|SC-01|SC-02|SC-03|SC-04|SC-05|SC-06|SC-07|SC-08|SC-09
|SC-10|SC-11|SC-12|SC-13|SC-14|SC-15|SC-16|SC-17|SC-18
|SC-19|SC-20|SC-21|SC-22|SC-23 = Seychelles
|SD|SD-23|SD-26|SD-18|SD-03|SD-07|SD-17|SD-06|SD-22|SD-08
|SD-24|SD-01|SD-11|SD-13|SD-20|SD-14|SD-12|SD-10|SD-16|SD-05
|SD-04|SD-25|SD-15|SD-02|SD-09|SD-19|SD-21 = Sudan
|SE|SE-K|SE-W|SE-I|SE-X|SE-N|SE-Z|SE-F|SE-H|SE-G|SE-BD
|SE-M|SE-AB|SE-D|SE-C|SE-S|SE-AC|SE-Y|SE-U|SE-O|SE-T|SE-E = Sweden
|SI|SI-001|SI-002|SI-148|SI-149|SI-003|SI-150|SI-004|SI-005
|SI-006|SI-151|SI-007|SI-009|SI-008|SI-152|SI-011|SI-012|SI-013
|SI-014|SI-153|SI-015|SI-016|SI-017|SI-018|SI-019|SI-154|SI-020
|SI-155|SI-021|SI-156|SI-022|SI-157|SI-023|SI-024|SI-025|SI-026
|SI-027|SI-028|SI-029|SI-030|SI-031|SI-158|SI-032|SI-159|SI-160
|SI-161|SI-162|SI-034|SI-035|SI-036|SI-037|SI-038|SI-039|SI-040
|SI-041|SI-163|SI-042|SI-043|SI-044|SI-045|SI-046|SI-047|SI-048
|SI-049|SI-164|SI-050|SI-165|SI-051|SI-052|SI-053|SI-166|SI-054
|SI-055|SI-056|SI-057|SI-058|SI-059|SI-060|SI-061|SI-062|SI-063
|SI-064|SI-065|SI-066|SI-167|SI-067|SI-068|SI-069|SI-070|SI-168
|SI-071|SI-072|SI-073|SI-074|SI-169|SI-075|SI-170|SI-076|SI-077
|SI-078|SI-079|SI-080|SI-081|SI-082|SI-083|SI-084|SI-085|SI-086
|SI-171|SI-087|SI-088|SI-089|SI-090|SI-091|SI-092|SI-172|SI-093
|SI-173|SI-094|SI-174|SI-095|SI-175|SI-096|SI-097|SI-098|SI-099
|SI-100|SI-101|SI-102|SI-103|SI-176|SI-104|SI-177|SI-106|SI-105
|SI-107|SI-108|SI-033|SI-178|SI-109|SI-183|SI-117|SI-118|SI-119
|SI-120|SI-110|SI-111|SI-121|SI-122|SI-123|SI-112|SI-113|SI-114
|SI-124|SI-125|SI-194|SI-179|SI-180|SI-126|SI-115|SI-127|SI-181
|SI-182|SI-116|SI-184|SI-010|SI-128|SI-129|SI-130|SI-185|SI-131
|SI-186|SI-132|SI-133|SI-187|SI-134|SI-188|SI-135|SI-136|SI-137
|SI-138|SI-139|SI-189|SI-140|SI-141|SI-142|SI-190|SI-143|SI-146
|SI-191|SI-147|SI-192|SI-144|SI-193 = Slovenia
|SJ = Svalbard
|SK|SK-BC|SK-BL|SK-KI|SK-NJ|SK-PV|SK-TC|SK-TA|SK-ZI = Slovakia
|SL|SL-E|SL-N|SL-S|SL-W = Sierra Leone
|SN|SN-DB|SN-DK|SN-FK|SN-KL|SN-KD|SN-LG|SN-MT|SN-SL
|SN-TC|SN-TH|SN-ZG = Senegal
|SO|SO-AD|SO-BK|SO-BN|SO-BR|SO-BY|SO-GG|SO-GD|SO-HR|SO-JD
|SO-JH|SO-MD|SO-NG|SO-SG|SO-SD|SO-SH|SO-SL|SO-TG|SO-WG = Somalia
|SR|SR-BR|SR-CM|SR-CR|SR-MA|SR-NI|SR-PR|SR-PM|SR-SA
|SR-SI|SR-WA = Suriname
|ST|ST-P|ST-S = São Tomé and Príncipe
|SV|SV-AH|SV-CA|SV-CH|SV-CU|SV-LI|SV-PA|SV-UN|SV-MO|SV-SM
|SV-SS|SV-SV|SV-SA|SV-SO|SV-US = El Salvador
|SY|SY-HA|SY-QU|SY-HL|SY-RA|SY-SU|SY-DY|SY-DI|SY-DR|SY-HM
|SY-HI|SY-ID|SY-LA|SY-RD|SY-TA = Syria
|SZ|SZ-HH|SZ-LU|SZ-MA|SZ-SH = Swaziland
|TD|TD-BA|TD-BI|TD-BET|TD-CB|TD-GR|TD-KA|TD-LC|TD-LR|TD-LO
|TD-MK|TD-MC|TD-OD|TD-SA|TD-TA = Chad
|TG|TG-C|TG-K|TG-M|TG-P|TG-S = Togo
|TH|TH-10|TH-11|TH-12|TH-13|TH-14|TH-15|TH-16|TH-17|TH-18
|TH-19|TH-20|TH-21|TH-22|TH-23|TH-24|TH-25|TH-26|TH-27|TH-30
|TH-31|TH-32|TH-33|TH-34|TH-35|TH-36|TH-37|TH-39|TH-40|TH-41
|TH-42|TH-43|TH-44|TH-45|TH-46|TH-47|TH-48|TH-49|TH-50|TH-51
|TH-52|TH-53|TH-54|TH-55|TH-56|TH-57|TH-58|TH-60|TH-61|TH-62
|TH-63|TH-64|TH-65|TH-66|TH-67|TH-70|TH-71|TH-72|TH-73|TH-74
|TH-75|TH-76|TH-77|TH-80|TH-81|TH-82|TH-83|TH-84|TH-85|TH-86
|TH-90|TH-91|TH-92|TH-93|TH-94|TH-95|TH-96|TH-S = Thailand
|TJ|TJ-GB|TJ-KT|TJ-SU = Tajikistan
|TL|TL-AL|TL-AN|TL-BA|TL-BO|TL-CO|TL-DI|TL-ER|TL-LA|TL-LI
|TL-MT|TL-MF|TL-OE|TL-VI = Timor-Leste
|TM|TM-A|TM-B|TM-D|TM-L|TM-M = Turkmenistan
|TN|TN-12|TN-31|TN-13|TN-23|TN-71|TN-81|TN-32|TN-41|TN-42
|TN-73|TN-33|TN-53|TN-14|TN-82|TN-52|TN-21|TN-61|TN-43
|TN-34|TN-51|TN-83|TN-72|TN-11|TN-22 = Tunisia
|TR|TR-01|TR-02|TR-03|TR-04|TR-05|TR-06|TR-07|TR-08|TR-09|TR-10
|TR-11|TR-12|TR-13|TR-14|TR-15|TR-16|TR-17|TR-18|TR-19|TR-20
|TR-21|TR-22|TR-23|TR-24|TR-25|TR-26|TR-27|TR-28|TR-29|TR-30
|TR-31|TR-32|TR-33|TR-34|TR-35|TR-36|TR-37|TR-38|TR-39|TR-40
|TR-41|TR-42|TR-43|TR-44|TR-45|TR-46|TR-47|TR-48|TR-49|TR-50
|TR-51|TR-52|TR-53|TR-54|TR-55|TR-56|TR-57|TR-58|TR-59|TR-60
|TR-61|TR-62|TR-63|TR-64|TR-65|TR-66|TR-67|TR-68|TR-69|TR-70
|TR-71|TR-72|TR-73|TR-74|TR-75|TR-76|TR-77|TR-78|TR-79|TR-80
|TR-81 = Turkey
|TT|TT-ARI|TT-CHA|TT-CTT|TT-DMN|TT-ETO|TT-RCM|TT-PED|TT-PTF
|TT-POS|TT-PRT|TT-SFO|TT-SGE|TT-SJL|TT-SIP|TT-TUP|TT-WTO = Trinidad and Tobago
|TW = Taiwan
|TZ|TZ-01|TZ-02|TZ-03|TZ-04|TZ-05|TZ-08|TZ-09|TZ-12|TZ-13
|TZ-26|TZ-14|TZ-16|TZ-17|TZ-18|TZ-06|TZ-10|TZ-20|TZ-19|TZ-21
|TZ-22|TZ-23|TZ-24|TZ-25|TZ-11|TZ-07|TZ-15 = Tanzania
|UA|UA-63|UA-65|UA-68|UA-77|UA-12|UA-14|UA-26|UA-30|UA-32
|UA-35|UA-46|UA-09|UA-48|UA-51|UA-53|UA-19|UA-23|UA-18
|UA-40|UA-59|UA-61|UA-21|UA-71|UA-74|UA-05|UA-07 = Ukraine
|UA-43 = Ukraine Crimea
|UG|UG-ADJ|UG-APC|UG-ARU|UG-BSH|UG-BUG|UG-BUN|UG-BUS|UG-GUL
|UG-HOI|UG-IGA|UG-JIN|UG-KAB|UG-KAL|UG-KAM|UG-KAN|UG-KAR|UG-KAS
|UG-KAY|UG-KBA|UG-KBL|UG-KIB|UG-KIS|UG-KIT|UG-KML|UG-KMP|UG-KOT
|UG-KPC|UG-KTK|UG-KUM|UG-KYE|UG-LIR|UG-LUW|UG-MAS|UG-MAY|UG-MBA
|UG-MBR|UG-MOY|UG-MPI|UG-MRT|UG-MSN|UG-MUB|UG-MUK|UG-NAK|UG-NEB
|UG-NKS|UG-NTU|UG-PAD|UG-PAL|UG-RAK|UG-RUK|UG-SEM|UG-SIR|UG-SOR
|UG-TOR|UG-WAK|UG-YUM = Uganda<!--unvollständig, siehe [[ISO 3166-2:UG]]-->
|US|US-DC = USA
|US-AK = USA Alaska
|US-AL = USA Alabama
|US-AR = USA Arkansas
|US-AZ = USA Arizona
|US-CA = USA California
|US-CO = USA Colorado
|US-CT = USA Connecticut
|US-DE = USA Delaware
|US-FL = USA Florida
|US-GA = USA Georgia
|US-GU = USA Guam
|US-HI = USA Hawaii
|US-IA = USA Iowa
|US-ID = USA Idaho
|US-IL = USA Illinois
|US-IN = USA Indiana
|US-KS = USA Kansas
|US-KY = USA Kentucky
|US-LA = USA Louisiana
|US-MA = USA Massachusetts
|US-MD = USA Maryland
|US-ME = USA Maine
|US-MI = USA Michigan
|US-MN = USA Minnesota
|US-MO = USA Missouri
|US-MS = USA Mississippi
|US-MT = USA Montana
|US-NC = USA North Carolina
|US-ND = USA North Dakota
|US-NE = USA Nebraska
|US-NH = USA New Hampshire
|US-NJ = USA New Jersey
|US-NM = USA New Mexico
|US-NV = USA Nevada
|US-NY = USA New York
|US-OH = USA Ohio
|US-OK = USA Oklahoma
|US-OR = USA Oregon
|US-PA = USA Pennsylvania
|US-PR = USA Puerto Rico
|US-RI = USA Rhode Island
|US-SC = USA South Carolina
|US-SD = USA South Dakota
|US-TN = USA Tennessee
|US-TX = USA Texas
|US-UT = USA Utah
|US-VA = USA Virginia
|US-VI = USA Virgin Islands
|US-VT = USA Vermont
|US-WA = USA Washington
|US-WI = USA Wisconsin
|US-WV = USA West Virginia
|US-WY = USA Wyoming
|UY|UY-AR|UY-CA|UY-CL|UY-CO|UY-DU|UY-FS|UY-FD|UY-LA|UY-MA|UY-MO
|UY-PA|UY-RN|UY-RV|UY-RO|UY-SA|UY-SJ|UY-SO|UY-TA|UY-TT = Uruguay
|UZ|UZ-AN|UZ-BU|UZ-FA|UZ-JI|UZ-NG|UZ-NW|UZ-QA|UZ-QR|UZ-SA
|UZ-SI|UZ-SU|UZ-TK|UZ-TO|UZ-XO = Uzbekistan
|VE|VE-B|VE-Z|VE-C|VE-D|VE-E|VE-F|VE-G|VE-H|VE-Y|VE-W|VE-A
|VE-I|VE-J|VE-K|VE-L|VE-M|VE-N|VE-O|VE-P|VE-R|VE-S|VE-T
|VE-X|VE-U|VE-V = Venezuela
|VN|VN-44|VN-43|VN-53|VN-54|VN-55|VN-56|VN-50|VN-31|VN-57
|VN-58|VN-40|VN-59|VN-48|VN-04|VN-60|VN-33|VN-72|VN-71|VN-39
|VN-45|VN-30|VN-03|VN-63|VN-64|VN-15|VN-23|VN-61|VN-62|VN-73
|VN-65|VN-14|VN-66|VN-34|VN-47|VN-28|VN-01|VN-35|VN-09|VN-02
|VN-41|VN-67|VN-22|VN-18|VN-36|VN-68|VN-32|VN-24|VN-27|VN-29
|VN-13|VN-25|VN-52|VN-05|VN-37|VN-20|VN-69|VN-21|VN-26|VN-46
|VN-51|VN-07|VN-49|VN-70|VN-06 = Vietnam
|VU|VU-MAP|VU-PAM|VU-SAM|VU-SEE|VU-TAE|VU-TOB = Vanuatu
|YE|YE-AB|YE-DA|YE-BA|YE-HU|YE-JA|YE-MR|YE-MW|YE-AD|YE-AM|YE-DH
|YE-HD|YE-HJ|YE-IB|YE-LA|YE-MA|YE-SN|YE-SD|YE-SH|YE-TA = Yemen
|ZA|ZA-FS|ZA-GT|ZA-EC|ZA-NL|ZA-LP|ZA-MP|ZA-NC|ZA-NW|ZA-WC = South Africa
|ZM|ZM-08|ZM-04|ZM-09|ZM-05|ZM-06|ZM-03|ZM-07|ZM-01|ZM-02 = Zambia
|ZW|ZW-BU|ZW-HA|ZW-MA|ZW-MC|ZW-ME|ZW-MW|ZW-MV|ZW-MN
|ZW-MS|ZW-MI = Zimbabwe
<includeonly>}}</includeonly><noinclude></poem></noinclude>
647tgyrlsfegwt27bmbrxxvwlej9bn8
Template:Infobox Berg
10
8957
74833
2019-02-12T10:37:01Z
en>Pigsonthewing
0
Pigsonthewing moved page [[Template:Infobox Berg]] to [[Template:Infobox mountain/Berg]]: standardlise; make purpose clear
74833
wikitext
text/x-wiki
#REDIRECT [[Template:Infobox mountain/Berg]]
{{R from move}}
hd8s1sxpmfysmh5339odkb1cig49bia
74834
74833
2026-08-24T00:27:42Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_Berg]]
74833
wikitext
text/x-wiki
#REDIRECT [[Template:Infobox mountain/Berg]]
{{R from move}}
hd8s1sxpmfysmh5339odkb1cig49bia
Template:Infobox mountain range/Gebirgsgruppe
10
8958
74835
2019-02-12T10:56:05Z
en>Pigsonthewing
0
Pigsonthewing moved page [[Template:Infobox Gebirgsgruppe]] to [[Template:Infobox mountain range/Gebirgsgruppe]]: standardlise; make purpose clear
74835
wikitext
text/x-wiki
{{Infobox mountain range
| name = {{{NAME|}}}
| map_image = {{{KARTE|}}}
| map_caption = {{{KARTENBESCHREIBUNG|}}}
| pushpin_map = {{{POSKARTE|}}}
| pushpin_map_image = {{{ALTERNATIVKARTE|}}}
| photo = {{{BILD|}}}
| photo_caption = {{{BILDBESCHREIBUNG|}}}
| state = {{<includeonly>safesubst:</includeonly>#switch:{{{LAGE-POLITISCH|}}}
|Bayern (Deutschland) = Bavaria
|[[Niederösterreich]] = Lower Austria
|[[Steiermark]] = Styria
|[[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Tyrol (state)|Tyrol]]
|[[Dortmund]], [[Hagen]], [[Ennepe-Ruhr-Kreis]],<br />[[Kreis Unna|Unna]], [[North Rhine-Westphalia]], {{GER}} = North Rhine-Westphalia
|[[Kreis Coesfeld|Coesfeld district]], [[Münsterland]], [[NRW]]
= North Rhine-Westphalia
|[[Kreis Warendorf|Warendorf]] and [[Kreis Soest|Soest]] districts<br />[[Münsterland]], [[NRW]], {{GER}} = North Rhine-Westphalia
|North Rhine-Westphalia = North Rhine-Westphalia
|[[Lower Saxony]], {{GER}} = Lower Saxony
|[[South Moravian Region]], [[Czech Republic]] = South Moravian Region
|#default = {{{LAGE-POLITISCH|}}}
}}
| parent = {{<includeonly>safesubst:</includeonly>#switch:{{{LAGE-GEBIRGE|}}}
|[[Bayerische Voralpen|Bayerischen Voralpen]] = [[Bavarian Prealps]]
|[[Nördliche Kalkalpen|Nördlichen Kalkalpen]] = [[Northern Limestone Alps]]
|[[Nördliche Kalkalpen]] = [[Northern Limestone Alps]]
|#default = {{{LAGE-GEBIRGE|}}}
}}
| location = {{{LAGE|}}}
| geology = {{{GESTEIN|}}}
| period = {{{ALTER|}}}
| area_km2 = {{{FLÄCHE|}}}
| orogeny = {{{TYP|}}}
| highest = {{{HÖCHSTER GIPFEL|}}}
| elevation_m = {{{MAX-HÖHE|}}}
| height_datum = {{{MAX-HÖHE-BEZUG|}}}
| length_km = {{{MAX-LÄNGE|}}}
| range_coordinates = {{<includeonly>safesubst:</includeonly>#if: {{{COORD|}}}
|{{{COORD}}}
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>German coord convert|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}|type:mountain{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}|_region:{{{REGION-ISO|}}}}}|format=dms|display=inline,title}}
|{{<includeonly>safesubst:</includeonly>#if:{{{GEO-LAGE|}}}|{{{GEO-LAGE}}}<span style="display:none">[[Template:Coordinate/Wartung/Gebirgsgruppe|dep1]]</span>}}
}}
}}
}}<noinclude>
{{Documentation}}
</noinclude>
tw9pzvljfbod57umv9god6b6gkll890
74836
74835
2026-08-24T00:33:37Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mountain_range/Gebirgsgruppe]]
74835
wikitext
text/x-wiki
{{Infobox mountain range
| name = {{{NAME|}}}
| map_image = {{{KARTE|}}}
| map_caption = {{{KARTENBESCHREIBUNG|}}}
| pushpin_map = {{{POSKARTE|}}}
| pushpin_map_image = {{{ALTERNATIVKARTE|}}}
| photo = {{{BILD|}}}
| photo_caption = {{{BILDBESCHREIBUNG|}}}
| state = {{<includeonly>safesubst:</includeonly>#switch:{{{LAGE-POLITISCH|}}}
|Bayern (Deutschland) = Bavaria
|[[Niederösterreich]] = Lower Austria
|[[Steiermark]] = Styria
|[[Tirol (Bundesland)|Tirol]], [[Österreich]] = [[Tyrol (state)|Tyrol]]
|[[Dortmund]], [[Hagen]], [[Ennepe-Ruhr-Kreis]],<br />[[Kreis Unna|Unna]], [[North Rhine-Westphalia]], {{GER}} = North Rhine-Westphalia
|[[Kreis Coesfeld|Coesfeld district]], [[Münsterland]], [[NRW]]
= North Rhine-Westphalia
|[[Kreis Warendorf|Warendorf]] and [[Kreis Soest|Soest]] districts<br />[[Münsterland]], [[NRW]], {{GER}} = North Rhine-Westphalia
|North Rhine-Westphalia = North Rhine-Westphalia
|[[Lower Saxony]], {{GER}} = Lower Saxony
|[[South Moravian Region]], [[Czech Republic]] = South Moravian Region
|#default = {{{LAGE-POLITISCH|}}}
}}
| parent = {{<includeonly>safesubst:</includeonly>#switch:{{{LAGE-GEBIRGE|}}}
|[[Bayerische Voralpen|Bayerischen Voralpen]] = [[Bavarian Prealps]]
|[[Nördliche Kalkalpen|Nördlichen Kalkalpen]] = [[Northern Limestone Alps]]
|[[Nördliche Kalkalpen]] = [[Northern Limestone Alps]]
|#default = {{{LAGE-GEBIRGE|}}}
}}
| location = {{{LAGE|}}}
| geology = {{{GESTEIN|}}}
| period = {{{ALTER|}}}
| area_km2 = {{{FLÄCHE|}}}
| orogeny = {{{TYP|}}}
| highest = {{{HÖCHSTER GIPFEL|}}}
| elevation_m = {{{MAX-HÖHE|}}}
| height_datum = {{{MAX-HÖHE-BEZUG|}}}
| length_km = {{{MAX-LÄNGE|}}}
| range_coordinates = {{<includeonly>safesubst:</includeonly>#if: {{{COORD|}}}
|{{{COORD}}}
|{{<includeonly>safesubst:</includeonly>#if:{{<includeonly>safesubst:</includeonly>both|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}}}
|{{<includeonly>safesubst:</includeonly>German coord convert|{{{BREITENGRAD|}}}|{{{LÄNGENGRAD|}}}|type:mountain{{<includeonly>safesubst:</includeonly>#if:{{{REGION-ISO|}}}|_region:{{{REGION-ISO|}}}}}|format=dms|display=inline,title}}
|{{<includeonly>safesubst:</includeonly>#if:{{{GEO-LAGE|}}}|{{{GEO-LAGE}}}<span style="display:none">[[Template:Coordinate/Wartung/Gebirgsgruppe|dep1]]</span>}}
}}
}}
}}<noinclude>
{{Documentation}}
</noinclude>
tw9pzvljfbod57umv9god6b6gkll890
Template:Country data Australia
10
8959
74837
2025-06-17T00:56:49Z
en>CommonsDelinker
0
Replacing Naval_Ensign_of_the_United_Kingdom.svg with [[File:Naval_ensign_of_the_United_Kingdom.svg]] (by [[commons:User:CommonsDelinker|CommonsDelinker]] because: [[:c:COM:FR|File renamed]]: [[:c:COM:FR#FR6|Criterion 6]]).
74837
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Australia
| flag alias = Flag of Australia (converted).svg
| flag alias-1901 = Flag of Australia (1901-1903).svg
| flag alias-1903 = Flag of Australia (1903-1908).svg
| flag alias-union = Flag of the United Kingdom.svg
| flag alias-colonial = Australian Colonial Flag.svg
| flag alias-civil = Civil Ensign of Australia.svg
| flag alias-naval = Naval Ensign of Australia.svg
| flag alias-naval-1913 = Naval ensign of the United Kingdom.svg
| link alias-naval = Royal Australian Navy
| link alias-army = Australian Army
| flag alias-air force = Air Force Ensign of Australia.svg
| link alias-air force = Royal Australian Air Force
| flag alias-air force-1948 = Air Force Ensign of Australia (1948–1982).svg
| flag alias-air force-1922 = Air Force Ensign of the United Kingdom.svg
| link alias-football = Australia {{{mw|men's}}} national {{{age|}}} soccer {{{class|}}} team
| flag alias-marines=UCP 2RAR.svg
| link alias-marines=2nd Battalion, Royal Australian Regiment
| flag alias-navy = Naval Ensign of Australia.svg
| link alias-navy = Royal Australian Navy
| flag alias-military = Ensign of the Australian Defence Force.svg
| link alias-military = Australian Defence Force
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| altvar = {{{altvar|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1901
| var2 = 1903
| var3 = colonial
| var4 = civil
| var5 = naval-1913
| redir1 = AUS
| related1 = Australasia
</noinclude>
}}
bupuzriclbwizhit0bubjwiat7eqhxa
74838
74837
2026-08-24T00:33:38Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_Australia]]
74837
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Australia
| flag alias = Flag of Australia (converted).svg
| flag alias-1901 = Flag of Australia (1901-1903).svg
| flag alias-1903 = Flag of Australia (1903-1908).svg
| flag alias-union = Flag of the United Kingdom.svg
| flag alias-colonial = Australian Colonial Flag.svg
| flag alias-civil = Civil Ensign of Australia.svg
| flag alias-naval = Naval Ensign of Australia.svg
| flag alias-naval-1913 = Naval ensign of the United Kingdom.svg
| link alias-naval = Royal Australian Navy
| link alias-army = Australian Army
| flag alias-air force = Air Force Ensign of Australia.svg
| link alias-air force = Royal Australian Air Force
| flag alias-air force-1948 = Air Force Ensign of Australia (1948–1982).svg
| flag alias-air force-1922 = Air Force Ensign of the United Kingdom.svg
| link alias-football = Australia {{{mw|men's}}} national {{{age|}}} soccer {{{class|}}} team
| flag alias-marines=UCP 2RAR.svg
| link alias-marines=2nd Battalion, Royal Australian Regiment
| flag alias-navy = Naval Ensign of Australia.svg
| link alias-navy = Royal Australian Navy
| flag alias-military = Ensign of the Australian Defence Force.svg
| link alias-military = Australian Defence Force
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| altvar = {{{altvar|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1901
| var2 = 1903
| var3 = colonial
| var4 = civil
| var5 = naval-1913
| redir1 = AUS
| related1 = Australasia
</noinclude>
}}
bupuzriclbwizhit0bubjwiat7eqhxa
Template:Country data France
10
8960
74839
2022-11-21T21:23:02Z
en>Paine Ellsworth
0
Undid revision 1069486652 by [[Special:Contributions/Paine Ellsworth|Paine Ellsworth]] ([[User talk:Paine Ellsworth|talk]]) srv per talk page
74839
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = France
| flag alias = Flag of France.svg
| flag alias-1790 = Flag of France (1790–1794).svg
| flag alias-1794 = Flag of France (1794–1815, 1830–1958).svg
| flag alias-1814 = Flag of the Kingdom of France (1814-1830).svg
| flag alias-1830 = Flag of France (1794–1815, 1830–1958).svg
| flag alias-1848 = Drapeau france 1848.svg
| flag alias-1848a = Drapeau france 1848.svg
| flag alias-1848b = Flag of France (1794–1815, 1830–1958).svg
| flag alias-1974 = Flag of France (lighter variant).svg
| flag alias-naval = Civil and Naval Ensign of France.svg
| flag alias-naval-1790 = Flag of French-Navy-Revolution.svg
| flag alias-air force = Flag of France.svg
| link alias-air force = French Air and Space Force
| flag alias-coast guard = French Maritime Gendarmerie racing stripe.svg
| border-coast guard =
| link alias-coast guard = French Maritime Gendarmerie
| flag alias-army = Flag of France.svg
| link alias-army = French Army
| link alias-naval = French Navy
| flag alias-navy = Civil and Naval Ensign of France.svg
| link alias-navy = French Navy
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1790
| var2 = 1794
| var3 = 1814
| var4 = 1830
| var5 = 1848a
| var6 = 1848b
| var7 = 1974
| var8 = naval-1790
| redir1 = FRA
| related1 = Kingdom of France
| related2 = Free France
</noinclude>
}}
bqsb3mto8cwy2zydmk0u1oi9eos454u
74840
74839
2026-08-24T00:33:38Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_France]]
74839
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = France
| flag alias = Flag of France.svg
| flag alias-1790 = Flag of France (1790–1794).svg
| flag alias-1794 = Flag of France (1794–1815, 1830–1958).svg
| flag alias-1814 = Flag of the Kingdom of France (1814-1830).svg
| flag alias-1830 = Flag of France (1794–1815, 1830–1958).svg
| flag alias-1848 = Drapeau france 1848.svg
| flag alias-1848a = Drapeau france 1848.svg
| flag alias-1848b = Flag of France (1794–1815, 1830–1958).svg
| flag alias-1974 = Flag of France (lighter variant).svg
| flag alias-naval = Civil and Naval Ensign of France.svg
| flag alias-naval-1790 = Flag of French-Navy-Revolution.svg
| flag alias-air force = Flag of France.svg
| link alias-air force = French Air and Space Force
| flag alias-coast guard = French Maritime Gendarmerie racing stripe.svg
| border-coast guard =
| link alias-coast guard = French Maritime Gendarmerie
| flag alias-army = Flag of France.svg
| link alias-army = French Army
| link alias-naval = French Navy
| flag alias-navy = Civil and Naval Ensign of France.svg
| link alias-navy = French Navy
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1790
| var2 = 1794
| var3 = 1814
| var4 = 1830
| var5 = 1848a
| var6 = 1848b
| var7 = 1974
| var8 = naval-1790
| redir1 = FRA
| related1 = Kingdom of France
| related2 = Free France
</noinclude>
}}
bqsb3mto8cwy2zydmk0u1oi9eos454u
Template:Country data Netherlands
10
8961
74841
2026-01-04T06:10:37Z
en>Ziv
0
→ File has been renamed on Commons ([[:c:GR]])
74841
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Netherlands
| flag alias = Flag of the Netherlands.svg
| flag alias-prinsengeus = Naval Jack of the Netherlands.svg
| flag alias-army =Flag of the Royal Netherlands Army.svg
| flag alias-air force= Flag of the Royal Netherlands Air and Space Force.svg
| link alias-air force= Royal Netherlands Air and Space Force
| link alias-army= Royal Netherlands Army
| flag alias-naval = Flag of the Netherlands.svg
| link alias-naval = Royal Netherlands Navy
| flag alias-navy = Naval Jack of the Netherlands.svg
| link alias-navy=Royal Netherlands Navy
| flag alias-marines = Naval Jack of the Netherlands.svg
| link alias-marines = Netherlands Marine Corps
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = prinsengeus
| redir1 = NLD
| redir2 = NED
| redir3 = The Netherlands
| related1 = Kingdom of the Netherlands
| related2 = Dutch Republic
| related3 = Batavian Republic
</noinclude>
}}
p1y111rqrwf51o14yfarvox7fd026h3
74842
74841
2026-08-24T00:33:39Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_Netherlands]]
74841
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Netherlands
| flag alias = Flag of the Netherlands.svg
| flag alias-prinsengeus = Naval Jack of the Netherlands.svg
| flag alias-army =Flag of the Royal Netherlands Army.svg
| flag alias-air force= Flag of the Royal Netherlands Air and Space Force.svg
| link alias-air force= Royal Netherlands Air and Space Force
| link alias-army= Royal Netherlands Army
| flag alias-naval = Flag of the Netherlands.svg
| link alias-naval = Royal Netherlands Navy
| flag alias-navy = Naval Jack of the Netherlands.svg
| link alias-navy=Royal Netherlands Navy
| flag alias-marines = Naval Jack of the Netherlands.svg
| link alias-marines = Netherlands Marine Corps
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = prinsengeus
| redir1 = NLD
| redir2 = NED
| redir3 = The Netherlands
| related1 = Kingdom of the Netherlands
| related2 = Dutch Republic
| related3 = Batavian Republic
</noinclude>
}}
p1y111rqrwf51o14yfarvox7fd026h3
Template:Country data Russia
10
8962
74843
2025-09-21T20:19:10Z
en>Primefac
0
add more (TPER)
74843
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Russia
| flag alias = Flag of Russia.svg
| flag alias-1668 = Flag of Russia (1668).svg
| flag alias-1696 = Flag of Russia.svg
| flag alias-1858 = Romanov Flag.svg
| flag alias-1918a = Flag of Russia (1918).svg
| flag alias-1918 = Flag of Russia (1918–1920).svg
| flag alias-1925 = Flag of the Russian SFSR (1920-1937).svg
| flag alias-1937 = Flag of the Russian SFSR (1937-1954).svg
| flag alias-1954 = Flag of the Russian SFSR.svg
| flag alias-1991 = Flag of Russia (1991–1993).svg
<!-- MILITARY -->
| flag alias-military = Banner of the Armed Forces of the Russian Federation (obverse).svg
| link alias-military = Russian Armed Forces
| flag alias-army = Flag of the Russian ground forces.svg
| link alias-army = Russian Ground Forces
| flag alias-naval = Naval Jack of Russia.svg
| link alias-naval = {{#switch:{{{variant|}}}|VV MVD naval-1992=Russian Internal Troops|VV MVD naval=Russian Internal Troops|NGF naval-2016=National Guard Naval Service Corps{{!}}Russian National Guard|NGF naval=National Guard Naval Service Corps{{!}}Russian National Guard|Russian Navy}}
| flag alias-VV MVD naval-1992 = Russia, Naval flag of ships and vessels of the Interior Force 1992.svg
| flag alias-VV MVD naval = Russia, Naval flag of ships and vessels of the Interior Force 2000.svg
| flag alias-NGF naval-2016 = Russia, Naval flag of ships and vessels of the Interior Force 2000.svg
| flag alias-NGF naval = Russia, Flag of ships and vessels of the National Guard.svg
| flag alias-navy = Naval Ensign of Russia.svg
| link alias-navy = Russian Navy
| flag alias-navy-1992 = Naval ensign of Russia (1992).svg
| flag alias-air force = Flag of the Air Force of the Russian Federation.svg
| link alias-air force = {{#switch:{{{variant|}}}|aerospace forces=Russian Aerospace Forces|Russian Air Force}}
| flag alias-aerospace forces = Flag of the Russian Aerospace Forces.svg
| flag alias-space force = Russian military space troops flag.svg
| link alias-space force = Russian Space Forces
| flag alias-marines = Флаг Морской пехоты ВМФ России (2021).jpg
| link alias-marines = Russian Naval Infantry
| flag alias-coast guard = Russia, Flag of border service 2008.svg
| link alias-coast guard = Russian Coast Guard
| flag alias-coast guard-1993 = Russia. Flag of ships of Border Guard Force 1993.svg
| link alias-coast guard-1993 = Russian Coast Guard
| flag alias-strategic force = Flag of the Strategic Missile Forces.svg
| link alias-strategic force = Strategic Rocket Forces
<!-- SPORTS -->
| flag alias-roc-olympics = Russian Olympic Committee flag.png
| flag alias-nbfr-badminton = Nbfr logo.png
| flag alias-rwf-wrestling = RWF logo.svg
| flag alias-tennis = Rtf tennis flag vector.svg
| flag alias-auto = Russian Automobile Federation flag.svg
| link alias-auto = Russian Automobile Federation
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1668
| var2 = 1696
| var3 = 1858
| var4 = 1918a
| var5 = 1918
| var6 = 1925
| var7 = 1937
| var8 = 1954
| var9 = 1991
<!-- SPORTS -->
| var10 = roc-olympics
| var11 = nbfr-badminton
| var12 = rwf-wrestling
| var13 = tennis
| var14 = auto
<!-- MILITARY -->
| var15 = navy-1992
| var16 = VV MVD naval-1992
| var17 = VV MVD naval
| var18 = NGF naval
| var19 = coast guard-1993
| var20 = aerospace forces
| redir1 = RUS
| redir2 = Russian Federation
</noinclude>
}}
s7lcwz9w4nd8gjikeu41wqkr372337o
74844
74843
2026-08-24T00:33:39Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_Russia]]
74843
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Russia
| flag alias = Flag of Russia.svg
| flag alias-1668 = Flag of Russia (1668).svg
| flag alias-1696 = Flag of Russia.svg
| flag alias-1858 = Romanov Flag.svg
| flag alias-1918a = Flag of Russia (1918).svg
| flag alias-1918 = Flag of Russia (1918–1920).svg
| flag alias-1925 = Flag of the Russian SFSR (1920-1937).svg
| flag alias-1937 = Flag of the Russian SFSR (1937-1954).svg
| flag alias-1954 = Flag of the Russian SFSR.svg
| flag alias-1991 = Flag of Russia (1991–1993).svg
<!-- MILITARY -->
| flag alias-military = Banner of the Armed Forces of the Russian Federation (obverse).svg
| link alias-military = Russian Armed Forces
| flag alias-army = Flag of the Russian ground forces.svg
| link alias-army = Russian Ground Forces
| flag alias-naval = Naval Jack of Russia.svg
| link alias-naval = {{#switch:{{{variant|}}}|VV MVD naval-1992=Russian Internal Troops|VV MVD naval=Russian Internal Troops|NGF naval-2016=National Guard Naval Service Corps{{!}}Russian National Guard|NGF naval=National Guard Naval Service Corps{{!}}Russian National Guard|Russian Navy}}
| flag alias-VV MVD naval-1992 = Russia, Naval flag of ships and vessels of the Interior Force 1992.svg
| flag alias-VV MVD naval = Russia, Naval flag of ships and vessels of the Interior Force 2000.svg
| flag alias-NGF naval-2016 = Russia, Naval flag of ships and vessels of the Interior Force 2000.svg
| flag alias-NGF naval = Russia, Flag of ships and vessels of the National Guard.svg
| flag alias-navy = Naval Ensign of Russia.svg
| link alias-navy = Russian Navy
| flag alias-navy-1992 = Naval ensign of Russia (1992).svg
| flag alias-air force = Flag of the Air Force of the Russian Federation.svg
| link alias-air force = {{#switch:{{{variant|}}}|aerospace forces=Russian Aerospace Forces|Russian Air Force}}
| flag alias-aerospace forces = Flag of the Russian Aerospace Forces.svg
| flag alias-space force = Russian military space troops flag.svg
| link alias-space force = Russian Space Forces
| flag alias-marines = Флаг Морской пехоты ВМФ России (2021).jpg
| link alias-marines = Russian Naval Infantry
| flag alias-coast guard = Russia, Flag of border service 2008.svg
| link alias-coast guard = Russian Coast Guard
| flag alias-coast guard-1993 = Russia. Flag of ships of Border Guard Force 1993.svg
| link alias-coast guard-1993 = Russian Coast Guard
| flag alias-strategic force = Flag of the Strategic Missile Forces.svg
| link alias-strategic force = Strategic Rocket Forces
<!-- SPORTS -->
| flag alias-roc-olympics = Russian Olympic Committee flag.png
| flag alias-nbfr-badminton = Nbfr logo.png
| flag alias-rwf-wrestling = RWF logo.svg
| flag alias-tennis = Rtf tennis flag vector.svg
| flag alias-auto = Russian Automobile Federation flag.svg
| link alias-auto = Russian Automobile Federation
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1668
| var2 = 1696
| var3 = 1858
| var4 = 1918a
| var5 = 1918
| var6 = 1925
| var7 = 1937
| var8 = 1954
| var9 = 1991
<!-- SPORTS -->
| var10 = roc-olympics
| var11 = nbfr-badminton
| var12 = rwf-wrestling
| var13 = tennis
| var14 = auto
<!-- MILITARY -->
| var15 = navy-1992
| var16 = VV MVD naval-1992
| var17 = VV MVD naval
| var18 = NGF naval
| var19 = coast guard-1993
| var20 = aerospace forces
| redir1 = RUS
| redir2 = Russian Federation
</noinclude>
}}
s7lcwz9w4nd8gjikeu41wqkr372337o
Template:Country data Spain
10
8963
74845
2026-07-21T13:19:47Z
en>CommonsDelinker
0
Replacing Flag_of_the_First_Spanish_Republic.svg with [[File:Flag_of_Spain_(1873–1874).svg]] (by [[commons:User:CommonsDelinker|CommonsDelinker]] because: [[:c:COM:FR|File renamed]]: [[:c:COM:FR#FR4|Criterion 4]]).
74845
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Spain
| flag alias = Flag of Spain.svg
| flag alias-1506 = Flag of Cross of Burgundy.svg
| flag alias-1701 = Bandera de España 1701-1748.svg
| flag alias-1748 = Bandera de España 1748-1785.svg
| flag alias-1760 = Bandera de España 1760-1785.svg
| flag alias-1785 = Flag of Spain (1785–1873, 1875–1931).svg
| flag alias-1873 = Flag of Spain (1873–1874).svg
| flag alias-1874 = Flag of Spain (1785–1873, 1875–1931).svg
| flag alias-1931 = Flag of Spain (1931–1939).svg
| flag alias-civil-1931 = Flag of the Second Spanish Republic (plain).svg
| flag alias-1936 = Flag of the Bando Nacional (1936–1938).svg
| flag alias-1938 = Flag of Spain (1938–1945).svg
| flag alias-1945 = Flag of Spain (1945–1977).svg
| flag alias-1977 = Flag of Spain (1977–1981).svg
| flag alias-civil = Flag of Spain (civil).svg
| flag alias-civil-1785 = BandMercante1785.svg
| flag alias-navy = Flag of Spain.svg
| link alias-navy = Spanish Navy
| flag alias-marines = Flag of Spain.svg
| link alias-marines = Spanish Marine Infantry
| flag alias-army = Flag of Spain.svg
| link alias-army = Spanish Army
| flag alias-naval = Naval Jack of Spain.svg
| link alias-naval = Spanish Navy
| flag alias-air force = Flag of Spain.svg
| link alias-air force = Spanish Air and Space Force
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1506
| var2 = 1701
| var3 = 1748
| var4 = 1760
| var5 = 1785
| var6 = 1873
| var7 = 1874
| var8 = 1931
| var9 = civil-1931
| var10 = 1936
| var11 = 1938
| var12 = 1945
| var13 = 1977
| var14 = civil
| var15 = civil-1785
| redir1 = ESP
| redir2 = SPA
| related1 = Spanish Empire
| related2 = Kingdom of Spain
| related3 = Spanish Republic
| related4 = Spanish State
| related5 = Francoist Spain
</noinclude>
}}
qhwl9ckk71j106hbsvixwmrywd2ansf
74846
74845
2026-08-24T00:33:39Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_Spain]]
74845
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Spain
| flag alias = Flag of Spain.svg
| flag alias-1506 = Flag of Cross of Burgundy.svg
| flag alias-1701 = Bandera de España 1701-1748.svg
| flag alias-1748 = Bandera de España 1748-1785.svg
| flag alias-1760 = Bandera de España 1760-1785.svg
| flag alias-1785 = Flag of Spain (1785–1873, 1875–1931).svg
| flag alias-1873 = Flag of Spain (1873–1874).svg
| flag alias-1874 = Flag of Spain (1785–1873, 1875–1931).svg
| flag alias-1931 = Flag of Spain (1931–1939).svg
| flag alias-civil-1931 = Flag of the Second Spanish Republic (plain).svg
| flag alias-1936 = Flag of the Bando Nacional (1936–1938).svg
| flag alias-1938 = Flag of Spain (1938–1945).svg
| flag alias-1945 = Flag of Spain (1945–1977).svg
| flag alias-1977 = Flag of Spain (1977–1981).svg
| flag alias-civil = Flag of Spain (civil).svg
| flag alias-civil-1785 = BandMercante1785.svg
| flag alias-navy = Flag of Spain.svg
| link alias-navy = Spanish Navy
| flag alias-marines = Flag of Spain.svg
| link alias-marines = Spanish Marine Infantry
| flag alias-army = Flag of Spain.svg
| link alias-army = Spanish Army
| flag alias-naval = Naval Jack of Spain.svg
| link alias-naval = Spanish Navy
| flag alias-air force = Flag of Spain.svg
| link alias-air force = Spanish Air and Space Force
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1506
| var2 = 1701
| var3 = 1748
| var4 = 1760
| var5 = 1785
| var6 = 1873
| var7 = 1874
| var8 = 1931
| var9 = civil-1931
| var10 = 1936
| var11 = 1938
| var12 = 1945
| var13 = 1977
| var14 = civil
| var15 = civil-1785
| redir1 = ESP
| redir2 = SPA
| related1 = Spanish Empire
| related2 = Kingdom of Spain
| related3 = Spanish Republic
| related4 = Spanish State
| related5 = Francoist Spain
</noinclude>
}}
qhwl9ckk71j106hbsvixwmrywd2ansf
Template:Country data India
10
8964
74847
2026-03-08T16:55:11Z
en>CommonsDelinker
0
Replacing Flag_of_Indian_Armed_Forces.svg with [[File:Flag_of_the_Indian_Armed_Forces.svg]] (by [[commons:User:CommonsDelinker|CommonsDelinker]] because: [[:c:COM:FR|File renamed]]: [[:c:COM:FR#FR3|Criterion 3]] (obvious error)).
74847
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = India
| flag alias = Flag of India.svg
| flag alias-1880 = British Raj Red Ensign.svg
| flag alias-British = British Raj Red Ensign.svg
| flag alias-1931 = 1931 Flag of India.svg
| flag alias-civil = Civil Ensign of India.svg
| flag alias-army = Flag of Indian Army.svg
| link alias-army = Indian Army
| flag alias-naval-1879 = Flag of Imperial India.svg
| flag alias-naval-1884 = Flag of Imperial India.svg
| flag alias-naval-1928 = Naval ensign of the United Kingdom.svg
| flag alias-naval-1947 = Naval ensign of the United Kingdom.svg
| flag alias-naval-1950 = Naval Ensign of India (1950–2001).svg
| flag alias-naval-2001 = Naval Ensign of India (2001–2004).svg
| flag alias-naval-2004 = Naval Ensign of India (2004–2014).svg
| flag alias-naval-2014 = Naval Ensign of India (2014–2022).svg
| flag alias-naval-2022 = Naval Ensign of India (2022).svg
| flag alias-naval = Naval Ensign of India.svg
| flag alias-air force-1950 = Air Force Ensign of India (1950–2023).svg
| flag alias-air force = Air Force Ensign of India.svg
| flag alias-coast guard = Indian Coast Guard flag.svg
| link alias-coast guard = Indian Coast Guard
| link alias-naval = Indian Navy
| link alias-air force = Indian Air Force
| flag alias-navy = Naval Ensign of India.svg
| link alias-navy = Indian Navy
| flag alias-military = Flag of the Indian Armed Forces.svg
| link alias-military = Indian Armed Forces
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1880
| var2 = British
| var3= 1931
| var4 = civil
| var5 = naval-1879
| var6 = naval-1884
| var7 = naval-1928
| var8 = naval-1947
| var9 = naval-1950
| var10 = naval-2001
| var11 = naval-2004
| var12 = naval-2014
| var13 = naval-2022
| var14 = air force-1950
| redir1 = IND
| related1 = British Raj
| related2 = Dominion of India
</noinclude>
}}
0jtlc032who7v4t7bi8mjckbh478bc9
74848
74847
2026-08-24T00:33:39Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_India]]
74847
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = India
| flag alias = Flag of India.svg
| flag alias-1880 = British Raj Red Ensign.svg
| flag alias-British = British Raj Red Ensign.svg
| flag alias-1931 = 1931 Flag of India.svg
| flag alias-civil = Civil Ensign of India.svg
| flag alias-army = Flag of Indian Army.svg
| link alias-army = Indian Army
| flag alias-naval-1879 = Flag of Imperial India.svg
| flag alias-naval-1884 = Flag of Imperial India.svg
| flag alias-naval-1928 = Naval ensign of the United Kingdom.svg
| flag alias-naval-1947 = Naval ensign of the United Kingdom.svg
| flag alias-naval-1950 = Naval Ensign of India (1950–2001).svg
| flag alias-naval-2001 = Naval Ensign of India (2001–2004).svg
| flag alias-naval-2004 = Naval Ensign of India (2004–2014).svg
| flag alias-naval-2014 = Naval Ensign of India (2014–2022).svg
| flag alias-naval-2022 = Naval Ensign of India (2022).svg
| flag alias-naval = Naval Ensign of India.svg
| flag alias-air force-1950 = Air Force Ensign of India (1950–2023).svg
| flag alias-air force = Air Force Ensign of India.svg
| flag alias-coast guard = Indian Coast Guard flag.svg
| link alias-coast guard = Indian Coast Guard
| link alias-naval = Indian Navy
| link alias-air force = Indian Air Force
| flag alias-navy = Naval Ensign of India.svg
| link alias-navy = Indian Navy
| flag alias-military = Flag of the Indian Armed Forces.svg
| link alias-military = Indian Armed Forces
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1880
| var2 = British
| var3= 1931
| var4 = civil
| var5 = naval-1879
| var6 = naval-1884
| var7 = naval-1928
| var8 = naval-1947
| var9 = naval-1950
| var10 = naval-2001
| var11 = naval-2004
| var12 = naval-2014
| var13 = naval-2022
| var14 = air force-1950
| redir1 = IND
| related1 = British Raj
| related2 = Dominion of India
</noinclude>
}}
0jtlc032who7v4t7bi8mjckbh478bc9
Template:Country data Italy
10
8965
74849
2026-05-18T01:36:03Z
en>Paine Ellsworth
0
per edit request on talk page - changed naval alias to the naval jack and added aliases for the state ensign and war flag
74849
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Italy
| flag alias = Flag of Italy.svg
| flag alias-1861 = Flag of Italy (1861–1946).svg
| flag alias-1943 = War flag of the Italian Social Republic.svg
| flag alias-2003 = Flag of Italy (2003–2006).svg
| flag alias-civil = Civil Ensign of Italy.svg
| flag alias-state = State ensign of Italy.svg
| flag alias-war = War flag of Italy.svg
| flag alias-naval = Naval jack of Italy.svg
| flag alias-navy-1947 = Naval Ensign of Italy (1947-2013).svg
| link alias-naval = Italian Navy
| link alias-air force = Italian Air Force
| link alias-army = Italian Army
| flag alias-navy = Naval ensign of Italy.svg
| link alias-navy = Italian Navy
| link alias-roller hockey = Italy {{{mw}}} national roller hockey team
| size = {{{size|}}}
| name = {{{name|}}}
| variant = {{{variant|}}}
| altlink = {{{altlink|}}}
| altvar = {{{altvar|}}}
<noinclude>
| var1 = 1861
| var2 = 1943
| var4 = 2003
| var5 = civil
| var6 = state
| var7 = war
| var8 = navy-1947
| redir1 = ITA
| related1 = Kingdom of Italy
| related2 = Fascist Italy
| related3 = Italian Social Republic
| related4 = Napoleonic Italy
</noinclude>
}}
pr240mua5th4gv4cd6es3rj1k42zo0w
74850
74849
2026-08-24T00:33:39Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_Italy]]
74849
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Italy
| flag alias = Flag of Italy.svg
| flag alias-1861 = Flag of Italy (1861–1946).svg
| flag alias-1943 = War flag of the Italian Social Republic.svg
| flag alias-2003 = Flag of Italy (2003–2006).svg
| flag alias-civil = Civil Ensign of Italy.svg
| flag alias-state = State ensign of Italy.svg
| flag alias-war = War flag of Italy.svg
| flag alias-naval = Naval jack of Italy.svg
| flag alias-navy-1947 = Naval Ensign of Italy (1947-2013).svg
| link alias-naval = Italian Navy
| link alias-air force = Italian Air Force
| link alias-army = Italian Army
| flag alias-navy = Naval ensign of Italy.svg
| link alias-navy = Italian Navy
| link alias-roller hockey = Italy {{{mw}}} national roller hockey team
| size = {{{size|}}}
| name = {{{name|}}}
| variant = {{{variant|}}}
| altlink = {{{altlink|}}}
| altvar = {{{altvar|}}}
<noinclude>
| var1 = 1861
| var2 = 1943
| var4 = 2003
| var5 = civil
| var6 = state
| var7 = war
| var8 = navy-1947
| redir1 = ITA
| related1 = Kingdom of Italy
| related2 = Fascist Italy
| related3 = Italian Social Republic
| related4 = Napoleonic Italy
</noinclude>
}}
pr240mua5th4gv4cd6es3rj1k42zo0w
Template:Country data Japan
10
8966
74851
2024-12-18T18:50:47Z
en>CommonsDelinker
0
Replacing Flag_of_US_Occupied_Ryukyu_Islands.svg with [[File:Civil_ensign_of_the_Ryukyu_Islands_(1952–1967).svg]] (by [[commons:User:CommonsDelinker|CommonsDelinker]] because: [[:c:COM:FR|File renamed]]: [[:c:COM:FR#FR3|Criterion 3]] (obvious error) · Thi
74851
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Japan
| flag alias = Flag of Japan.svg
| flag alias-1870 = Flag of Japan (1870-1999).svg
| link alias-1870 = Empire of Japan
| flag alias-1945 = Flag of Allied Occupied Japan.svg
| border-1945 =
| flag alias-1947 = Flag of Japan (1870-1999).svg
| flag alias-ryukyu = Civil ensign of the Ryukyu Islands (1952–1967).svg
| border-ryukyu =
| flag alias-naval = Naval Ensign of Japan.svg
| flag alias-coast guard = Ensign of the Japanese Coast Guard.svg
| link alias-coast guard = Japan Coast Guard
| link alias-naval = Japan Maritime Self-Defense Force
| flag alias-army = Flag of JSDF.svg
| link alias-army = Japan Ground Self-Defense Force
| flag alias-air force = Flag of the Japan Air Self-Defense Force.svg
| link alias-air force = Japan Air Self-Defense Force
| flag alias-air force-1955 = Flag of the Japan Air Self-Defense Force (1955-1957).png
| link alias-air force-1955 = Japan Air Self-Defense Force
| flag alias-air force-1957 = Flag of the Japan Air Self-Defense Force (1957-1972).png
| link alias-air force-1957 = Japan Air Self-Defense Force
| flag alias-air force-1972 = Flag of the Japan Air Self-Defense Force (1972-2001).png
| link alias-air force-1972 = Japan Air Self-Defense Force
| flag alias-military=Flag of the Japan Self-Defense Forces.svg
| link alias-military=Japan Self-Defense Forces
| flag alias-marines=Flag of JSDF.svg
| link alias-marines=Japanese Amphibious Rapid Deployment Brigade
| flag alias-navy = Naval Ensign of Japan.svg
| link alias-navy = Japan Maritime Self-Defense Force
| {{#ifeq:{{{altlink}}}|A national rugby union team|link alias-rugby union|empty}} = Junior Japan
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1870
| var2 = 1945
| var3 = 1947
| var4 = ryukyu
| redir1 = JPN
| related1 = Empire of Japan
</noinclude>
}}
tfs7kx3untc5s4onfe3ba7rga6hl1hi
74852
74851
2026-08-24T00:33:39Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_Japan]]
74851
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Japan
| flag alias = Flag of Japan.svg
| flag alias-1870 = Flag of Japan (1870-1999).svg
| link alias-1870 = Empire of Japan
| flag alias-1945 = Flag of Allied Occupied Japan.svg
| border-1945 =
| flag alias-1947 = Flag of Japan (1870-1999).svg
| flag alias-ryukyu = Civil ensign of the Ryukyu Islands (1952–1967).svg
| border-ryukyu =
| flag alias-naval = Naval Ensign of Japan.svg
| flag alias-coast guard = Ensign of the Japanese Coast Guard.svg
| link alias-coast guard = Japan Coast Guard
| link alias-naval = Japan Maritime Self-Defense Force
| flag alias-army = Flag of JSDF.svg
| link alias-army = Japan Ground Self-Defense Force
| flag alias-air force = Flag of the Japan Air Self-Defense Force.svg
| link alias-air force = Japan Air Self-Defense Force
| flag alias-air force-1955 = Flag of the Japan Air Self-Defense Force (1955-1957).png
| link alias-air force-1955 = Japan Air Self-Defense Force
| flag alias-air force-1957 = Flag of the Japan Air Self-Defense Force (1957-1972).png
| link alias-air force-1957 = Japan Air Self-Defense Force
| flag alias-air force-1972 = Flag of the Japan Air Self-Defense Force (1972-2001).png
| link alias-air force-1972 = Japan Air Self-Defense Force
| flag alias-military=Flag of the Japan Self-Defense Forces.svg
| link alias-military=Japan Self-Defense Forces
| flag alias-marines=Flag of JSDF.svg
| link alias-marines=Japanese Amphibious Rapid Deployment Brigade
| flag alias-navy = Naval Ensign of Japan.svg
| link alias-navy = Japan Maritime Self-Defense Force
| {{#ifeq:{{{altlink}}}|A national rugby union team|link alias-rugby union|empty}} = Junior Japan
| size = {{{size|}}}
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = 1870
| var2 = 1945
| var3 = 1947
| var4 = ryukyu
| redir1 = JPN
| related1 = Empire of Japan
</noinclude>
}}
tfs7kx3untc5s4onfe3ba7rga6hl1hi
Template:Country data Poland
10
8967
74853
2025-06-17T03:29:05Z
en>CommonsDelinker
0
Replacing PL_air_force_flag_IIIRP.svg with [[File:Flag_of_the_Polish_Air_Force.svg]] (by [[commons:User:CommonsDelinker|CommonsDelinker]] because: [[:c:COM:FR|File renamed]]: [[:c:COM:FR#FR2|Criterion 2]]).
74853
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Poland
| flag alias = Flag of Poland.svg
| flag alias-state = Flag of Poland (with coat of arms).svg
| flag alias-1815 = Flag of the Congress of Poland.svg
| flag alias-1919 = Flag of Poland (1919-1928).svg
| flag alias-1928 = Flag of Poland (1928–1980).svg
| flag alias-1955 = Flag of Poland (with coat of arms, 1955-1980).svg
| flag alias-1980 = Flag of Poland (with coat of arms, 1980-1990).svg
| flag alias-1990 = Flag of Poland (with coat of arms).svg
| flag alias-naval = PL navy flag IIIRP.svg
| border-naval =
| flag alias-naval-1919 = Naval Ensign of IIRP v1.svg
| border-naval-1919 =
| flag alias-naval-1946 = Naval Ensign of PRL v1.svg
| border-naval-1946 =
| flag alias-naval-auxiliary = Flaga pomocniczych jednostek pływających Polskiej Marynarki Wojennej.svg
| flag alias-naval-auxiliary-1955 = POL Bandera pjp PRL v1.svg
| link alias-naval = Polish Navy
| flag alias-navy = Naval Ensign of Poland.svg
| border-navy =
| link alias-navy = Polish Navy
| flag alias-marines = Flag of the Polish Land Forces.svg
| border-marines =
| link alias-marines = Polish 7th Coastal Defense Brigade
| flag alias-air force = Flag of the Polish Air Force.svg
| border-air force =
| link alias-air force = Polish Air Force
| flag alias-army = Flag of the Polish Land Forces.svg
| border-army =
| link alias-army = Polish Land Forces
| size = {{{size|}}}
| size flag alias-naval = 25px
| size flag alias-naval-1919 = 25px
| size flag alias-naval-1946 = 25px
| size flag alias-air force = 25px
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = state
| var2 = 1815
| var3 = 1919
| var4 = 1928
| var5 = 1955
| var6 = 1980
| var7 = 1990
| var10 = naval-1919
| var11 = naval-1946
| var12 = naval-auxiliary
| var13 = naval-auxiliary-1955
| redir1 = POL
</noinclude>
}}
r458meyoo86seb5bgd7e1amfhyt1mw8
74854
74853
2026-08-24T00:33:39Z
Robertsky
10424
1 versaun husi [[:en:Template:Country_data_Poland]]
74853
wikitext
text/x-wiki
{{ {{{1<noinclude>|country showdata</noinclude>}}}
| alias = Poland
| flag alias = Flag of Poland.svg
| flag alias-state = Flag of Poland (with coat of arms).svg
| flag alias-1815 = Flag of the Congress of Poland.svg
| flag alias-1919 = Flag of Poland (1919-1928).svg
| flag alias-1928 = Flag of Poland (1928–1980).svg
| flag alias-1955 = Flag of Poland (with coat of arms, 1955-1980).svg
| flag alias-1980 = Flag of Poland (with coat of arms, 1980-1990).svg
| flag alias-1990 = Flag of Poland (with coat of arms).svg
| flag alias-naval = PL navy flag IIIRP.svg
| border-naval =
| flag alias-naval-1919 = Naval Ensign of IIRP v1.svg
| border-naval-1919 =
| flag alias-naval-1946 = Naval Ensign of PRL v1.svg
| border-naval-1946 =
| flag alias-naval-auxiliary = Flaga pomocniczych jednostek pływających Polskiej Marynarki Wojennej.svg
| flag alias-naval-auxiliary-1955 = POL Bandera pjp PRL v1.svg
| link alias-naval = Polish Navy
| flag alias-navy = Naval Ensign of Poland.svg
| border-navy =
| link alias-navy = Polish Navy
| flag alias-marines = Flag of the Polish Land Forces.svg
| border-marines =
| link alias-marines = Polish 7th Coastal Defense Brigade
| flag alias-air force = Flag of the Polish Air Force.svg
| border-air force =
| link alias-air force = Polish Air Force
| flag alias-army = Flag of the Polish Land Forces.svg
| border-army =
| link alias-army = Polish Land Forces
| size = {{{size|}}}
| size flag alias-naval = 25px
| size flag alias-naval-1919 = 25px
| size flag alias-naval-1946 = 25px
| size flag alias-air force = 25px
| name = {{{name|}}}
| altlink = {{{altlink|}}}
| variant = {{{variant|}}}
<noinclude>
| var1 = state
| var2 = 1815
| var3 = 1919
| var4 = 1928
| var5 = 1955
| var6 = 1980
| var7 = 1990
| var10 = naval-1919
| var11 = naval-1946
| var12 = naval-auxiliary
| var13 = naval-auxiliary-1955
| redir1 = POL
</noinclude>
}}
r458meyoo86seb5bgd7e1amfhyt1mw8
Módulo:CountryData
828
8968
74855
2021-05-05T20:40:05Z
en>GKFX
0
Add optional caching layer for most-used templates via loadData. Reduces rendering time as tested on [[List_of_twin_towns_and_sister_cities_in_Germany]]
74855
Scribunto
text/plain
local p = {}
local mostUsed = mw.loadData('Module:CountryData/summary')
local function getcontents(frame,country,params)
return frame:expandTemplate({title="Country data "..country;args=params})
end
function p.getcachedtable(frame, country, params)
country = mostUsed.redirects[country] or country
if params and next(params) then return p.gettable(frame, country, params) end
-- Uses mw.loadData to cache data for the most-used templates
if mostUsed.pages[country] then
local cache = mw.loadData('Module:CountryData/cache' .. mostUsed.pages[country])
if cache.data[country] then return cache.data[country] end
end
-- if not in cache
return p.gettable(frame, country, params)
end
function p.gettable(frame,country,params)
--Returns the parameters of a country data template as a Lua table
--If not a valid data template, return empty table
local bool, s = pcall(getcontents,frame,country,params or {})
if bool and (string.find(s,"^%{%{ *%{%{%{1") or string.find(s,"^%{%{safesubst: *%{%{%{1"))
then
--Replace parameter delimiters with arbitrary control characters
--to avoid clashes if param values contain equals/pipe signs
s = string.gsub(s,"|([^|=]-)=","\1\1%1\2")
s = string.gsub(s,"}}%s*$","\1")
--Loop over string and add params to table
local part = {}
for par in string.gmatch(s,"\1[^\1\2]-\2[^\1\2]-\1") do
local k = string.match(par,"\1%s*(.-)%s*\2")
local v = string.match(par,"\2%s*(.-)%s*\1")
if v and not (v=="" and string.find(k,"^flag alias")) then
part[k] = v
end
end
return part
else
return {}
end
end
function p.getalias(frame)
--Returns a single parameter value from a data template
local part = p.gettable(frame,frame.args[1])
if frame.args.variant
then return tostring(part[frame.args[2].."-"..frame.args.variant]
or part[frame.args[2]] or frame.args.def)
else return tostring(part[frame.args[2]] or frame.args.def)
end
end
function p.gettemplate(frame)
--For testing, recreates the country data from the created Lua table
--Get data table
local data = p.gettable(frame,frame.args[1])
--Concatenate fields into a template-like string
local out = "{{ {{{1}}}"
for k,v in pairs(data) do
out = out.."\n| "..k.." = "..v
end
return out.."\n}}"
end
return p
cceq9gf8ovsa0t1xy826rbloh46yv3o
74856
74855
2026-08-24T00:33:40Z
Robertsky
10424
1 versaun husi [[:en:Module:CountryData]]
74855
Scribunto
text/plain
local p = {}
local mostUsed = mw.loadData('Module:CountryData/summary')
local function getcontents(frame,country,params)
return frame:expandTemplate({title="Country data "..country;args=params})
end
function p.getcachedtable(frame, country, params)
country = mostUsed.redirects[country] or country
if params and next(params) then return p.gettable(frame, country, params) end
-- Uses mw.loadData to cache data for the most-used templates
if mostUsed.pages[country] then
local cache = mw.loadData('Module:CountryData/cache' .. mostUsed.pages[country])
if cache.data[country] then return cache.data[country] end
end
-- if not in cache
return p.gettable(frame, country, params)
end
function p.gettable(frame,country,params)
--Returns the parameters of a country data template as a Lua table
--If not a valid data template, return empty table
local bool, s = pcall(getcontents,frame,country,params or {})
if bool and (string.find(s,"^%{%{ *%{%{%{1") or string.find(s,"^%{%{safesubst: *%{%{%{1"))
then
--Replace parameter delimiters with arbitrary control characters
--to avoid clashes if param values contain equals/pipe signs
s = string.gsub(s,"|([^|=]-)=","\1\1%1\2")
s = string.gsub(s,"}}%s*$","\1")
--Loop over string and add params to table
local part = {}
for par in string.gmatch(s,"\1[^\1\2]-\2[^\1\2]-\1") do
local k = string.match(par,"\1%s*(.-)%s*\2")
local v = string.match(par,"\2%s*(.-)%s*\1")
if v and not (v=="" and string.find(k,"^flag alias")) then
part[k] = v
end
end
return part
else
return {}
end
end
function p.getalias(frame)
--Returns a single parameter value from a data template
local part = p.gettable(frame,frame.args[1])
if frame.args.variant
then return tostring(part[frame.args[2].."-"..frame.args.variant]
or part[frame.args[2]] or frame.args.def)
else return tostring(part[frame.args[2]] or frame.args.def)
end
end
function p.gettemplate(frame)
--For testing, recreates the country data from the created Lua table
--Get data table
local data = p.gettable(frame,frame.args[1])
--Concatenate fields into a template-like string
local out = "{{ {{{1}}}"
for k,v in pairs(data) do
out = out.."\n| "..k.." = "..v
end
return out.."\n}}"
end
return p
cceq9gf8ovsa0t1xy826rbloh46yv3o
Módulo:CountryData/summary
828
8969
74857
2021-05-06T17:59:48Z
en>MusikBot II
0
Protected "[[Module:CountryData/summary]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74857
Scribunto
text/plain
local p = {}
p.pages = {Afghanistan='K', Albania='H', Algeria='F', Angola='K', Argentina='B', Armenia='G', Australia='A', Austria='B', Azerbaijan='F', Bahrain='K', Bangladesh='I', Belarus='D', Belgium='B', Bolivia='J', Bosnia_and_Herzegovina='F', Brazil='B', Bulgaria='D', Cameroon='I', Canada='A', Chile='D', China='B', Chinese_Taipei='H', Colombia='D', Costa_Rica='I', Croatia='D', Cuba='G', Cyprus='G', Czech_Republic='B', Czechoslovakia='H', Democratic_Republic_of_the_Congo='K', Denmark='C', Dominican_Republic='H', East_Germany='K', Ecuador='G', Egypt='E', El_Salvador='J', England='B', Estonia='E', Ethiopia='J', Fiji='K', Finland='C', France='A', Germany='A', Ghana='G', Great_Britain='C', Greece='D', Guatemala='J', Honduras='K', Hong_Kong='F', Hungary='C', Iceland='G', India='A', Indonesia='E', Iran='B', Iraq='J', Ireland='E', Israel='D', Italy='A', Ivory_Coast='I', Jamaica='G', Japan='A', Jordan='K', Kazakhstan='E', Kenya='H', Kuwait='K', Latvia='F', Lebanon='J', Lithuania='F', Luxembourg='G', Malaysia='E', Mali='K', Malta='I', Mexico='C', Moldova='I', Montenegro='H', Morocco='F', Myanmar='J', Nepal='I', Netherlands='A', New_Zealand='C', Nigeria='E', North_Korea='J', North_Macedonia='I', Northern_Ireland='J', Norway='C', Pakistan='F', Panama='I', Paraguay='G', Peru='E', Philippines='E', Poland='A', Portugal='C', Puerto_Rico='H', Qatar='I', Republic_of_Ireland='F', Romania='C', Russia='A', Saudi_Arabia='H', Scotland='D', Senegal='I', Serbia='D', Singapore='F', Slovakia='D', Slovenia='D', South_Africa='C', South_Korea='C', Soviet_Union='E', Spain='A', Sri_Lanka='H', Sweden='B', Switzerland='B', Syria='J', Taiwan='K', Tanzania='K', Thailand='D', Trinidad_and_Tobago='J', Tunisia='G', Turkey='B', Uganda='J', Ukraine='C', United_Arab_Emirates='H', United_Kingdom='B', United_States='A', Uruguay='F', Uzbekistan='H', Venezuela='E', Vietnam='G', Wales='E', West_Germany='G', Yugoslavia='H', Zimbabwe='I', ['Georgia_(country)']='F'}
p.redirects = {AFG='Afghanistan', ALB='Albania', ALG='Algeria', AND='Andorra', ANG='Angola', ARG='Argentina', ARM='Armenia', ARU='Aruba', ATG='Antigua and Barbuda', AUS='Australia', AUT='Austria', AZE='Azerbaijan', BAH='Bahamas', BAN='Bangladesh', BAR='Barbados', BDI='Burundi', BEL='Belgium', BEN='Benin', BER='Bermuda', BFA='Burkina Faso', BHR='Bahrain', BIH='Bosnia and Herzegovina', BLR='Belarus', BOL='Bolivia', BOT='Botswana', BRA='Brazil', BRU='Brunei', BUL='Bulgaria', BWA='Botswana', CAM='Cambodia', CAN='Canada', CAY='Cayman Islands', CGO='Republic of the Congo', CHE='Switzerland', CHI='Chile', CHL='Chile', CHN='China', CIS='Commonwealth of Independent States', CIV='Ivory Coast', CMR='Cameroon', COD='Democratic Republic of the Congo', COK='Cook Islands', COL='Colombia', CPV='Cape Verde', CRC='Costa Rica', CRO='Croatia', CSA='Confederate States of America', CSK='Czechoslovakia', CUB='Cuba', CUR='Curaçao', CYP='Cyprus', CZE='Czech Republic', Congo='Republic of the Congo', DEN='Denmark', DEU='Germany', DNK='Denmark', DOM='Dominican Republic', DRC='Democratic Republic of the Congo', ECU='Ecuador', EGY='Egypt', ENG='England', ESA='El Salvador', ESP='Spain', EST='Estonia', ETH='Ethiopia', EU='European Union', FIJ='Fiji', FIN='Finland', FJI='Fiji', FRA='France', FRG='West Germany', FRO='Faroe Islands', GAB='Gabon', GAM='Gambia', GBR='Great Britain', GDR='East Germany', GEO='Georgia (country)', GER='Germany', GHA='Ghana', GIB='Gibraltar', GRC='Greece', GRE='Greece', GRN='Grenada', GUA='Guatemala', GUI='Guinea', GUM='Guam', GUY='Guyana', Georgia='Georgia (country)', HAI='Haiti', HKG='Hong Kong', HON='Honduras', HRV='Croatia', HUN='Hungary', IDN='Indonesia', INA='Indonesia', IND='India', IRE='Ireland', IRI='Iran', IRL='Republic of Ireland', IRN='Iran', IRQ='Iraq', ISL='Iceland', ISR='Israel', ITA='Italy', JAM='Jamaica', JOR='Jordan', JP='Japan', JPN='Japan', KAZ='Kazakhstan', KEN='Kenya', KGZ='Kyrgyzstan', KOR='South Korea', KOS='Kosovo', KSA='Saudi Arabia', KUW='Kuwait', LAO='Laos', LAT='Latvia', LBN='Lebanon', LBR='Liberia', LBY='Libya', LCA='Saint Lucia', LIB='Lebanon', LIE='Liechtenstein', LIT='Lithuania', LTU='Lithuania', LUX='Luxembourg', LVA='Latvia', MAC='Macau', MAD='Madagascar', MAR='Morocco', MAS='Malaysia', MCO='Monaco', MDA='Moldova', MDV='Maldives', MEX='Mexico', MGL='Mongolia', MKD='North Macedonia', MLI='Mali', MLT='Malta', MNE='Montenegro', MON='Monaco', MOZ='Mozambique', MRI='Mauritius', MYA='Myanmar', MYS='Malaysia', NAM='Namibia', NCA='Nicaragua', NCL='New Caledonia', NED='Netherlands', NEP='Nepal', NGA='Nigeria', NGR='Nigeria', NIC='Nicaragua', NIG='Niger', NIR='Northern Ireland', NLD='Netherlands', NOR='Norway', NZ='New Zealand', NZL='New Zealand', OMA='Oman', PAK='Pakistan', PAN='Panama', PAR='Paraguay', PER='Peru', PHI='Philippines', PHL='Philippines', PLE='Palestine', PNG='Papua New Guinea', POL='Poland', POR='Portugal', PRC='China', PRI='Puerto Rico', PRK='North Korea', PRT='Portugal', PUR='Puerto Rico', QAT='Qatar', ROC='Republic of China', ROM='Romania', ROU='Romania', RSA='South Africa', RUS='Russia', RWA='Rwanda', SAM='Samoa', SCG='Serbia and Montenegro', SCO='Scotland', SEN='Senegal', SER='Serbia', SGP='Singapore', SIN='Singapore', SKN='Saint Kitts and Nevis', SLE='Sierra Leone', SLO='Slovenia', SLV='El Salvador', SMR='San Marino', SPA='Spain', SRB='Serbia', SRI='Sri Lanka', SUD='Sudan', SUI='Switzerland', SUR='Suriname', SVK='Slovakia', SVN='Slovenia', SWE='Sweden', SWI='Switzerland', SYR='Syria', TAN='Tanzania', TCH='Czechoslovakia', THA='Thailand', TJK='Tajikistan', TKM='Turkmenistan', TOG='Togo', TON='Tonga', TPE='Chinese Taipei', TRI='Trinidad and Tobago', TTO='Trinidad and Tobago', TUN='Tunisia', TUR='Turkey', TWN='Taiwan', UAE='United Arab Emirates', UGA='Uganda', UK='United Kingdom', UKGBI='United Kingdom of Great Britain and Ireland', UKR='Ukraine', UN='United Nations', URS='Soviet Union', URU='Uruguay', US='United States', USA='United States', USSR='Soviet Union', UZB='Uzbekistan', VAN='Vanuatu', VEN='Venezuela', VIE='Vietnam', WAL='Wales', WIN='West Indies', Washington='Washington (state)', YEM='Yemen', YUG='Yugoslavia', ZAF='South Africa', ZAM='Zambia', ZIM='Zimbabwe', ['Côte d\'Ivoire']='Ivory Coast', ['DR Congo']='Democratic Republic of the Congo', ['New York']='New York (state)', ['People\'s Republic of China']='China', ['SFR Yugoslavia']='Yugoslavia', ['Timor-Leste']='East Timor', ['United States Virgin Islands']='U.S. Virgin Islands', ['United States of America']='United States'}
return p
0ymib7yb210s3i6vqfqrmfh8nkkjhgw
74858
74857
2026-08-24T00:33:40Z
Robertsky
10424
1 versaun husi [[:en:Module:CountryData/summary]]
74857
Scribunto
text/plain
local p = {}
p.pages = {Afghanistan='K', Albania='H', Algeria='F', Angola='K', Argentina='B', Armenia='G', Australia='A', Austria='B', Azerbaijan='F', Bahrain='K', Bangladesh='I', Belarus='D', Belgium='B', Bolivia='J', Bosnia_and_Herzegovina='F', Brazil='B', Bulgaria='D', Cameroon='I', Canada='A', Chile='D', China='B', Chinese_Taipei='H', Colombia='D', Costa_Rica='I', Croatia='D', Cuba='G', Cyprus='G', Czech_Republic='B', Czechoslovakia='H', Democratic_Republic_of_the_Congo='K', Denmark='C', Dominican_Republic='H', East_Germany='K', Ecuador='G', Egypt='E', El_Salvador='J', England='B', Estonia='E', Ethiopia='J', Fiji='K', Finland='C', France='A', Germany='A', Ghana='G', Great_Britain='C', Greece='D', Guatemala='J', Honduras='K', Hong_Kong='F', Hungary='C', Iceland='G', India='A', Indonesia='E', Iran='B', Iraq='J', Ireland='E', Israel='D', Italy='A', Ivory_Coast='I', Jamaica='G', Japan='A', Jordan='K', Kazakhstan='E', Kenya='H', Kuwait='K', Latvia='F', Lebanon='J', Lithuania='F', Luxembourg='G', Malaysia='E', Mali='K', Malta='I', Mexico='C', Moldova='I', Montenegro='H', Morocco='F', Myanmar='J', Nepal='I', Netherlands='A', New_Zealand='C', Nigeria='E', North_Korea='J', North_Macedonia='I', Northern_Ireland='J', Norway='C', Pakistan='F', Panama='I', Paraguay='G', Peru='E', Philippines='E', Poland='A', Portugal='C', Puerto_Rico='H', Qatar='I', Republic_of_Ireland='F', Romania='C', Russia='A', Saudi_Arabia='H', Scotland='D', Senegal='I', Serbia='D', Singapore='F', Slovakia='D', Slovenia='D', South_Africa='C', South_Korea='C', Soviet_Union='E', Spain='A', Sri_Lanka='H', Sweden='B', Switzerland='B', Syria='J', Taiwan='K', Tanzania='K', Thailand='D', Trinidad_and_Tobago='J', Tunisia='G', Turkey='B', Uganda='J', Ukraine='C', United_Arab_Emirates='H', United_Kingdom='B', United_States='A', Uruguay='F', Uzbekistan='H', Venezuela='E', Vietnam='G', Wales='E', West_Germany='G', Yugoslavia='H', Zimbabwe='I', ['Georgia_(country)']='F'}
p.redirects = {AFG='Afghanistan', ALB='Albania', ALG='Algeria', AND='Andorra', ANG='Angola', ARG='Argentina', ARM='Armenia', ARU='Aruba', ATG='Antigua and Barbuda', AUS='Australia', AUT='Austria', AZE='Azerbaijan', BAH='Bahamas', BAN='Bangladesh', BAR='Barbados', BDI='Burundi', BEL='Belgium', BEN='Benin', BER='Bermuda', BFA='Burkina Faso', BHR='Bahrain', BIH='Bosnia and Herzegovina', BLR='Belarus', BOL='Bolivia', BOT='Botswana', BRA='Brazil', BRU='Brunei', BUL='Bulgaria', BWA='Botswana', CAM='Cambodia', CAN='Canada', CAY='Cayman Islands', CGO='Republic of the Congo', CHE='Switzerland', CHI='Chile', CHL='Chile', CHN='China', CIS='Commonwealth of Independent States', CIV='Ivory Coast', CMR='Cameroon', COD='Democratic Republic of the Congo', COK='Cook Islands', COL='Colombia', CPV='Cape Verde', CRC='Costa Rica', CRO='Croatia', CSA='Confederate States of America', CSK='Czechoslovakia', CUB='Cuba', CUR='Curaçao', CYP='Cyprus', CZE='Czech Republic', Congo='Republic of the Congo', DEN='Denmark', DEU='Germany', DNK='Denmark', DOM='Dominican Republic', DRC='Democratic Republic of the Congo', ECU='Ecuador', EGY='Egypt', ENG='England', ESA='El Salvador', ESP='Spain', EST='Estonia', ETH='Ethiopia', EU='European Union', FIJ='Fiji', FIN='Finland', FJI='Fiji', FRA='France', FRG='West Germany', FRO='Faroe Islands', GAB='Gabon', GAM='Gambia', GBR='Great Britain', GDR='East Germany', GEO='Georgia (country)', GER='Germany', GHA='Ghana', GIB='Gibraltar', GRC='Greece', GRE='Greece', GRN='Grenada', GUA='Guatemala', GUI='Guinea', GUM='Guam', GUY='Guyana', Georgia='Georgia (country)', HAI='Haiti', HKG='Hong Kong', HON='Honduras', HRV='Croatia', HUN='Hungary', IDN='Indonesia', INA='Indonesia', IND='India', IRE='Ireland', IRI='Iran', IRL='Republic of Ireland', IRN='Iran', IRQ='Iraq', ISL='Iceland', ISR='Israel', ITA='Italy', JAM='Jamaica', JOR='Jordan', JP='Japan', JPN='Japan', KAZ='Kazakhstan', KEN='Kenya', KGZ='Kyrgyzstan', KOR='South Korea', KOS='Kosovo', KSA='Saudi Arabia', KUW='Kuwait', LAO='Laos', LAT='Latvia', LBN='Lebanon', LBR='Liberia', LBY='Libya', LCA='Saint Lucia', LIB='Lebanon', LIE='Liechtenstein', LIT='Lithuania', LTU='Lithuania', LUX='Luxembourg', LVA='Latvia', MAC='Macau', MAD='Madagascar', MAR='Morocco', MAS='Malaysia', MCO='Monaco', MDA='Moldova', MDV='Maldives', MEX='Mexico', MGL='Mongolia', MKD='North Macedonia', MLI='Mali', MLT='Malta', MNE='Montenegro', MON='Monaco', MOZ='Mozambique', MRI='Mauritius', MYA='Myanmar', MYS='Malaysia', NAM='Namibia', NCA='Nicaragua', NCL='New Caledonia', NED='Netherlands', NEP='Nepal', NGA='Nigeria', NGR='Nigeria', NIC='Nicaragua', NIG='Niger', NIR='Northern Ireland', NLD='Netherlands', NOR='Norway', NZ='New Zealand', NZL='New Zealand', OMA='Oman', PAK='Pakistan', PAN='Panama', PAR='Paraguay', PER='Peru', PHI='Philippines', PHL='Philippines', PLE='Palestine', PNG='Papua New Guinea', POL='Poland', POR='Portugal', PRC='China', PRI='Puerto Rico', PRK='North Korea', PRT='Portugal', PUR='Puerto Rico', QAT='Qatar', ROC='Republic of China', ROM='Romania', ROU='Romania', RSA='South Africa', RUS='Russia', RWA='Rwanda', SAM='Samoa', SCG='Serbia and Montenegro', SCO='Scotland', SEN='Senegal', SER='Serbia', SGP='Singapore', SIN='Singapore', SKN='Saint Kitts and Nevis', SLE='Sierra Leone', SLO='Slovenia', SLV='El Salvador', SMR='San Marino', SPA='Spain', SRB='Serbia', SRI='Sri Lanka', SUD='Sudan', SUI='Switzerland', SUR='Suriname', SVK='Slovakia', SVN='Slovenia', SWE='Sweden', SWI='Switzerland', SYR='Syria', TAN='Tanzania', TCH='Czechoslovakia', THA='Thailand', TJK='Tajikistan', TKM='Turkmenistan', TOG='Togo', TON='Tonga', TPE='Chinese Taipei', TRI='Trinidad and Tobago', TTO='Trinidad and Tobago', TUN='Tunisia', TUR='Turkey', TWN='Taiwan', UAE='United Arab Emirates', UGA='Uganda', UK='United Kingdom', UKGBI='United Kingdom of Great Britain and Ireland', UKR='Ukraine', UN='United Nations', URS='Soviet Union', URU='Uruguay', US='United States', USA='United States', USSR='Soviet Union', UZB='Uzbekistan', VAN='Vanuatu', VEN='Venezuela', VIE='Vietnam', WAL='Wales', WIN='West Indies', Washington='Washington (state)', YEM='Yemen', YUG='Yugoslavia', ZAF='South Africa', ZAM='Zambia', ZIM='Zimbabwe', ['Côte d\'Ivoire']='Ivory Coast', ['DR Congo']='Democratic Republic of the Congo', ['New York']='New York (state)', ['People\'s Republic of China']='China', ['SFR Yugoslavia']='Yugoslavia', ['Timor-Leste']='East Timor', ['United States Virgin Islands']='U.S. Virgin Islands', ['United States of America']='United States'}
return p
0ymib7yb210s3i6vqfqrmfh8nkkjhgw
Template:DEU
10
8970
74859
2024-02-01T01:48:19Z
en>Ahecht
0
Reduce [[WP:PEIS|post-expand include size]] (via [[WP:JWB]])
74859
wikitext
text/x-wiki
{{#invoke:flag||Germany}}<noinclude>
{{flag template documentation|Germany|DEU|GER|GER}}
</noinclude>
rx47ni6ek9k71nm522dlfa20lrjqbt4
74860
74859
2026-08-24T00:33:40Z
Robertsky
10424
1 versaun husi [[:en:Template:DEU]]
74859
wikitext
text/x-wiki
{{#invoke:flag||Germany}}<noinclude>
{{flag template documentation|Germany|DEU|GER|GER}}
</noinclude>
rx47ni6ek9k71nm522dlfa20lrjqbt4
Template:GER
10
8971
74861
2017-04-07T20:51:47Z
en>Jo-Jo Eumerus
0
Changed protection level for "[[Template:GER]]": Matching redirect target ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74861
wikitext
text/x-wiki
#REDIRECT [[Template:DEU]]
joh2ozugset37cizcwqvy8cvvdbxpx1
74862
74861
2026-08-24T00:33:40Z
Robertsky
10424
1 versaun husi [[:en:Template:GER]]
74861
wikitext
text/x-wiki
#REDIRECT [[Template:DEU]]
joh2ozugset37cizcwqvy8cvvdbxpx1
Módulo:CountryData/cacheA
828
8972
74863
2023-01-21T18:01:31Z
en>MusikBot II
0
Changed protection settings for "[[Module:CountryData/cacheA]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 11729 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74863
Scribunto
text/plain
local CountryData = require('Module:CountryData')
local pages = {'Australia', 'Canada', 'France', 'Germany', 'India', 'Italy', 'Japan', 'Netherlands', 'Poland', 'Russia', 'Spain', 'United_States'}
local p = {
data = {}
}
local frame = mw.getCurrentFrame()
for _,v in ipairs(pages) do
p.data[v] = CountryData.gettable(frame, v, {})
end
return p
96fdyeg6uibqh66zu8o0bzeys1oed10
74864
74863
2026-08-24T00:33:40Z
Robertsky
10424
1 versaun husi [[:en:Module:CountryData/cacheA]]
74863
Scribunto
text/plain
local CountryData = require('Module:CountryData')
local pages = {'Australia', 'Canada', 'France', 'Germany', 'India', 'Italy', 'Japan', 'Netherlands', 'Poland', 'Russia', 'Spain', 'United_States'}
local p = {
data = {}
}
local frame = mw.getCurrentFrame()
for _,v in ipairs(pages) do
p.data[v] = CountryData.gettable(frame, v, {})
end
return p
96fdyeg6uibqh66zu8o0bzeys1oed10
Módulo:Flagg
828
8973
74865
2025-11-03T22:18:43Z
en>Ahecht
0
expand module name per [[WP:TPN]]
74865
Scribunto
text/plain
local titleSelf = mw.title.new(... or mw.getCurrentFrame():getTitle())
local titleCountryData = mw.title.new[[Module:CountryData]]
if titleSelf.isSubpage then
local sandbox = titleSelf.subpageText:match[[^sandbox]]
if sandbox then
titleCountryData = titleCountryData:subPageTitle(sandbox)
end
end
local CountryData = require(tostring(titleCountryData))
local p = {}
function p.main(frame)
--Get input arguments
local args = require('Module:Arguments').getArgs(frame,{valueFunc =
function(key,value)
if value then
value = mw.text.trim(value)
--Change empty string to nil for all args except 'image' and 'border'
if key=="image" or key=="border" or value~="" then
return value
end
end
return nil
end
})
--Call main function
return p.luaMain(frame,args)
end
function p.luaMain(frame,args)
local function emp2nil(x)
if x=="" then return nil else return x end
end
local function space2emp(x)
if string.find(x,"^%s*$") then return "" else return x end
end
local function nopx(x)
if x~=nil and (string.find(x,"^%d+$") or string.find(x,"^%d+px$")) then return string.gsub(x,"^(.*)px","%1") else return nil end
end
--Country & mode parameters
local mode = string.lower(args[1] or "usc")
local mi = string.sub(mode,1,1)
local ms = string.sub(mode,2,2)
local mn = string.sub(mode,3,3)
local me = string.sub(mode,4,-1)
local country = args[2] or ""
local countryDataCountry = country
if string.find(me, "i") then
local titleIocCountryData = mw.title.new[[Module:Country alias/data]]
local IocCountryData = require(tostring(titleIocCountryData))
local iocCountryAlias = IocCountryData.countryAliases[country] or country
countryDataCountry = IocCountryData.countries[iocCountryAlias]["countrydata_name"] or IocCountryData.countries[iocCountryAlias]["name"]
end
local avar = args["avar"] or args["altvar"]
local clink = args["clink"] or args["link"]
--Get country data & altvar data
local data, alink, amap, asuf
if avar then
local age = args["age"] or ""
local aalias
amap, aalias = require("Module:Flagg/Altvar data").alttable(age)
avar = string.gsub(string.lower(avar or ""),"[ -]","")
avar = aalias[avar] or avar
if not amap[avar] then error("Unknown avar") end
local apar = {altvar=amap[avar].altvar;mw=amap[avar].mw;age=amap[avar].age;variant=args["variant"] or args[3]}
data = CountryData.getcachedtable(frame, countryDataCountry, apar)
asuf = amap[avar].altlink
alink = data["link alias-"..amap[avar].altvar] or (clink or data["shortname alias"] or data.alias or country).." "..asuf
else
data = (args["nodata"] and {}) or CountryData.getcachedtable(frame, countryDataCountry, {variant=args["variant"] or args[3]})
avar = ""
amap = {[""]={altvar=""}}
end
--Name and link parameters
clink = clink or data.alias or country
local pref = args["pref"]
local suff = args["suff"] or asuf
local pref2 = args["pref2"]
local suff2 = args["suff2"]
if not pref and not suff then --Default prefix
pref = "Flag of"
end
local yn_map = {[""]=0; ["0"]=0; ["no"]=0; ["n"]=0; ["1"]=1; ["yes"]=1; ["y"]=1}
local fthe = (args["pthe"] and yn_map[args["pthe"]]~=0) or (args["the"] and yn_map[args["the"]]~=0)
local nthe = (args["nthe"] and yn_map[args["nthe"]]~=0) or (args["the"] and yn_map[args["the"]]~=0)
fthe = fthe and (pref and "t" or "T").."he " or ""
nthe = nthe and (pref and "t" or "T").."he " or ""
local flink = args["plink"] or args["flink"] or alink
or clink=="" and "" or space2emp((pref or "").." ")..fthe..clink..space2emp(" "..(suff or ""))
local flink2
if args["plink2"] or args["flink2"] or pref2 or suff2 then
flink2 = args["plink2"] or args["flink2"] or clink=="" and "" or space2emp((pref2 or "").." ")..fthe..clink..space2emp(" "..(suff2 or ""))
else
flink2 = flink
end
local fsec = args["psection"] or args["section"]
local fsec2 = args["psection2"] or args["section"]
local csec = args["csection"] or args["section"]
fsec = fsec and "#"..fsec or ""
fsec2 = fsec2 and "#"..fsec2 or ""
csec = csec and "#"..csec or ""
if string.find(me,"f") then
if mw.title.new( flink ).exists == false then
if flink2 ~= flink and mw.title.new ( flink2 ).exists == true then
flink = flink2
fsec = fsec2
else
flink = clink
end
end
end
local name = args["name"]
if not name then
local cname = string.find(me,"e") and (data["name alias-"..amap[avar].altvar] or data["shortname alias"] or data.alias) or country
if mn == "f" then
name = cname=="" and "" or space2emp((pref or "").." ")..nthe..cname..space2emp(" "..(suff or ""))
else
name = cname
end
end
--Image parameters
local pimage = args["image"]
local placeholder = "Flag placeholder.svg"
local variant = args["variant"] or args[3] or ""
local image_map = {[""]=placeholder; ["none"]=placeholder; ["blank"]=placeholder}
if pimage then --Remove namespace
pimage = string.gsub(pimage,"^[Ff][Ii][Ll][Ee]:","")
pimage = string.gsub(pimage,"^[Ii][Mm][Aa][Gg][Ee]:","")
end
local iname = image_map[pimage] or pimage
local size = args["size"] or args["sz"]
local size_map = {xs="12x8px"; s="17x11px"; m="23x15px"; l="32x21px"; xl="46x30px"}
if size==nil or string.find(size,"^%d*x?%d+px$") then
--valid EIS size (..px, x..px or ..x..px) or unset
elseif string.find(size,"^%d*x?%d+$") then --EIS size without "px" suffix
size=size.."px"
else --size from map, or invalid value
size = size_map[size] or nil
end
local border = args["border"]
if iname then
size = size or "23x15px"
if yn_map[border]==0 then border = "" else border = "|border" end
else
iname = data["flag alias-"..amap[avar].altvar.."-"..variant] or data["flag alias-"..variant] or data["flag alias-"..amap[avar].altvar] or data["flag alias"] or placeholder
size = size or emp2nil(data.size) or "23x15px"
if border then
if yn_map[border]==0 then border = "" else border = "|border" end
else
local autoborder = data["border-"..variant] or data["border-"..amap[avar].altvar] or data.border
if autoborder and autoborder~="border" then border = "" else border = "|border" end
end
end
local am = ""
if args["alt"] or string.find(me,"a") then
am = args["alt"] or args["name"] or country
am = am.."|"..am
end
--Build display name
local text = args["text"]
if not text then
if mn=="x" then --no text
text = ""
elseif mn=="p" or mn=="f" or mn == "*" then --prefix/suffix link
text = flink=="" and name or "[["..flink..fsec.."|"..name.."]]"
-- By the principle of least surprise, there should be some
-- indication that the link [[X of Country|Country]] does not
-- go to [[Country]].
if mn == "*" and clink ~= flink then
text = text:sub(1, -3) .. "\226\128\175*]]" end
elseif mn=="l" then --display link target
text = flink=="" and name or "[["..flink..fsec.."|"..(args["name"] or flink).."]]"
elseif mn=="b" then --both prefix/suffix and normal country link
local preflink = pref and (flink=="" and pref.." " or "[["..flink..fsec.."|"..pref.."]] ") or ""
local sufflink = suff and (flink=="" and " "..suff or " [["..flink..fsec.."|"..suff.."]]") or ""
local namelink = (name=="" and "" or nthe)..(clink=="" and name or "[["..clink..csec.."|"..name.."]]")
text = preflink..namelink..sufflink
elseif mn=="d" then --data template
local title = mw.title.new("Template:Country data "..country)
--check if redirect
if title.isRedirect then
text = "<span class=\"plainlinks\">["..title:fullUrl("redirect=no").." "..name.."]</span>"
else
text = "[["..title.fullText.."|"..name.."]]"
end
elseif mn=="u" then --unlinked
text = name
elseif mn=="a" then --abbr
text = name==country and (clink==country and country or "<abbr title='"..clink.."'>"..country.."</abbr>") or ("<abbr title='"..name.."'>"..country.."</abbr>")
else --country link (default)
text = clink=="" and name or "[["..clink..csec.."|"..name.."]]"
end
if string.find(me,"p") then
text = "("..text..")"
end
end
if type(text) == 'function' then
text = text(data)
end
--Define separator
local separator = " "
if ms=="x" then --no separator
separator = ""
elseif ms=="l" then --line break
separator = "<br />"
end
--Add preftext, if used
local preftext = args["preftext"]
if (preftext or "") ~= "" then
text = preftext..separator..text
end
--Build image
local ilink = args["ilink"]
if not ilink then
if mi=="x" or (iname==placeholder and pimage~=placeholder) then --no image/invisible image
iname = placeholder
border = ""
ilink = "|link="
am = ""
elseif mi=="i" then --image page link
ilink = ""
elseif mi=="c" then --country link
ilink = "|link="..clink..(clink=="" and "" or csec)
elseif mi=="p" or mi=="f" then --prefix/suffix link
ilink = "|link="..flink..(flink=="" and "" or fsec)
elseif mi=="d" then --data template
local title = mw.title.new("Template:Country data "..country)
--check if redirect
if title.isRedirect then
ilink = "|link="..title:fullUrl("redirect=no")
else
ilink = "|link="..title.fullText
end
else --unlinked (default)
ilink = "|link="
end
end
if am == "" and string.find(me,"l") then
am = mw.ustring.sub(ilink,7,-1)
end
local image = "[[File:"..iname.."|"..size..border..ilink.."|alt="..am.."]]"
if iname==placeholder then
if require('Module:yesno')(args["noredlink"]) == false or args["noredlink"] == "notext" then
if country ~= '' and data.alias == nil then
iname = ''
image = "[[:Template:Country data "..country.."]]"
if args["noredlink"] == "notext" then
text = ''
end
end
end
if (args["missingcategory"] or '') ~= '' then
image = image..args["missingcategory"]
end
if string.find(me,"b") then
text = ''
end
end
--Combine image and name with separator
local align_map = {left="left", l="left", center="center", centre="center", c="center", middle="center", m="center", right="right", r="right"}
local align = align_map[args["align"] or args["al"]]
local nalign = align_map[args["nalign"] or args["nal"]]
local out
if string.find(me,"r") then
--image right of name
if (ms=="x" and mi=="x") or (string.find(me,"o") and iname==placeholder and pimage~=placeholder) then --name only
out = text
elseif ms=="x" or ms=="n" or ms=="l" then --no separator, non-breaking space, or line break
out = text.."<span class=\"flagicon nowrap\">"..separator..image.."</span>"
elseif ms=="t" then --table cell
out = "style=\"text-align:"..(nalign or "left").."\"|"..text.."||style=\"text-align:"..(align or "center").."\"|<span class=\"flagicon\">"..image.."</span>"
else --fixed-width span box (default)
local width = args["width"] or args["w"] or require("Module:Flag list").luawidth(size)
out = text.."<span class=\"nowrap\"> <span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(align or "right").."\">"..image.."</span></span>"
end
else --image left of name
if (ms=="x" and mi=="x") or (string.find(me,"o") and iname==placeholder and pimage~=placeholder) then --name only
out = text
elseif ms=="x" or ms=="n" or ms=="l" then --no separator, non-breaking space, or line break
out = "<span class=\"flagicon\">"..image..separator.."</span>"..text
elseif ms=="t" then --table cell
out = "style=\"text-align:"..(align or "center")..";\"|<span class=\"flagicon\">"..image.."</span>||style=\"text-align:"..(nalign or "left").."\"|"..text
else --fixed-width span box (default)
local width = nopx(args["width"] or args["w"]) or require("Module:Flag list").luawidth(size)
out = "<span class=\"nowrap\"><span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(align or "left").."\">"..image.."</span> </span>"..text
end
end
-- align in table
if me:find("t") then
out = 'style="text-align:'..(align or 'left')..'"|'..out
end
--Tracking categories
local cat = ""
if pimage and not image_map[pimage] and country~="" and data["flag alias"] and not args.demo then
cat = "[[Category:Pages using Flagg with specified image instead of data template image]]"
end
return out..cat
end
p[''] = p.main
return p
5ccusrx57387gqcom4sz1tzbt0w2ggk
74866
74865
2026-08-24T00:33:40Z
Robertsky
10424
1 versaun husi [[:en:Module:Flagg]]
74865
Scribunto
text/plain
local titleSelf = mw.title.new(... or mw.getCurrentFrame():getTitle())
local titleCountryData = mw.title.new[[Module:CountryData]]
if titleSelf.isSubpage then
local sandbox = titleSelf.subpageText:match[[^sandbox]]
if sandbox then
titleCountryData = titleCountryData:subPageTitle(sandbox)
end
end
local CountryData = require(tostring(titleCountryData))
local p = {}
function p.main(frame)
--Get input arguments
local args = require('Module:Arguments').getArgs(frame,{valueFunc =
function(key,value)
if value then
value = mw.text.trim(value)
--Change empty string to nil for all args except 'image' and 'border'
if key=="image" or key=="border" or value~="" then
return value
end
end
return nil
end
})
--Call main function
return p.luaMain(frame,args)
end
function p.luaMain(frame,args)
local function emp2nil(x)
if x=="" then return nil else return x end
end
local function space2emp(x)
if string.find(x,"^%s*$") then return "" else return x end
end
local function nopx(x)
if x~=nil and (string.find(x,"^%d+$") or string.find(x,"^%d+px$")) then return string.gsub(x,"^(.*)px","%1") else return nil end
end
--Country & mode parameters
local mode = string.lower(args[1] or "usc")
local mi = string.sub(mode,1,1)
local ms = string.sub(mode,2,2)
local mn = string.sub(mode,3,3)
local me = string.sub(mode,4,-1)
local country = args[2] or ""
local countryDataCountry = country
if string.find(me, "i") then
local titleIocCountryData = mw.title.new[[Module:Country alias/data]]
local IocCountryData = require(tostring(titleIocCountryData))
local iocCountryAlias = IocCountryData.countryAliases[country] or country
countryDataCountry = IocCountryData.countries[iocCountryAlias]["countrydata_name"] or IocCountryData.countries[iocCountryAlias]["name"]
end
local avar = args["avar"] or args["altvar"]
local clink = args["clink"] or args["link"]
--Get country data & altvar data
local data, alink, amap, asuf
if avar then
local age = args["age"] or ""
local aalias
amap, aalias = require("Module:Flagg/Altvar data").alttable(age)
avar = string.gsub(string.lower(avar or ""),"[ -]","")
avar = aalias[avar] or avar
if not amap[avar] then error("Unknown avar") end
local apar = {altvar=amap[avar].altvar;mw=amap[avar].mw;age=amap[avar].age;variant=args["variant"] or args[3]}
data = CountryData.getcachedtable(frame, countryDataCountry, apar)
asuf = amap[avar].altlink
alink = data["link alias-"..amap[avar].altvar] or (clink or data["shortname alias"] or data.alias or country).." "..asuf
else
data = (args["nodata"] and {}) or CountryData.getcachedtable(frame, countryDataCountry, {variant=args["variant"] or args[3]})
avar = ""
amap = {[""]={altvar=""}}
end
--Name and link parameters
clink = clink or data.alias or country
local pref = args["pref"]
local suff = args["suff"] or asuf
local pref2 = args["pref2"]
local suff2 = args["suff2"]
if not pref and not suff then --Default prefix
pref = "Flag of"
end
local yn_map = {[""]=0; ["0"]=0; ["no"]=0; ["n"]=0; ["1"]=1; ["yes"]=1; ["y"]=1}
local fthe = (args["pthe"] and yn_map[args["pthe"]]~=0) or (args["the"] and yn_map[args["the"]]~=0)
local nthe = (args["nthe"] and yn_map[args["nthe"]]~=0) or (args["the"] and yn_map[args["the"]]~=0)
fthe = fthe and (pref and "t" or "T").."he " or ""
nthe = nthe and (pref and "t" or "T").."he " or ""
local flink = args["plink"] or args["flink"] or alink
or clink=="" and "" or space2emp((pref or "").." ")..fthe..clink..space2emp(" "..(suff or ""))
local flink2
if args["plink2"] or args["flink2"] or pref2 or suff2 then
flink2 = args["plink2"] or args["flink2"] or clink=="" and "" or space2emp((pref2 or "").." ")..fthe..clink..space2emp(" "..(suff2 or ""))
else
flink2 = flink
end
local fsec = args["psection"] or args["section"]
local fsec2 = args["psection2"] or args["section"]
local csec = args["csection"] or args["section"]
fsec = fsec and "#"..fsec or ""
fsec2 = fsec2 and "#"..fsec2 or ""
csec = csec and "#"..csec or ""
if string.find(me,"f") then
if mw.title.new( flink ).exists == false then
if flink2 ~= flink and mw.title.new ( flink2 ).exists == true then
flink = flink2
fsec = fsec2
else
flink = clink
end
end
end
local name = args["name"]
if not name then
local cname = string.find(me,"e") and (data["name alias-"..amap[avar].altvar] or data["shortname alias"] or data.alias) or country
if mn == "f" then
name = cname=="" and "" or space2emp((pref or "").." ")..nthe..cname..space2emp(" "..(suff or ""))
else
name = cname
end
end
--Image parameters
local pimage = args["image"]
local placeholder = "Flag placeholder.svg"
local variant = args["variant"] or args[3] or ""
local image_map = {[""]=placeholder; ["none"]=placeholder; ["blank"]=placeholder}
if pimage then --Remove namespace
pimage = string.gsub(pimage,"^[Ff][Ii][Ll][Ee]:","")
pimage = string.gsub(pimage,"^[Ii][Mm][Aa][Gg][Ee]:","")
end
local iname = image_map[pimage] or pimage
local size = args["size"] or args["sz"]
local size_map = {xs="12x8px"; s="17x11px"; m="23x15px"; l="32x21px"; xl="46x30px"}
if size==nil or string.find(size,"^%d*x?%d+px$") then
--valid EIS size (..px, x..px or ..x..px) or unset
elseif string.find(size,"^%d*x?%d+$") then --EIS size without "px" suffix
size=size.."px"
else --size from map, or invalid value
size = size_map[size] or nil
end
local border = args["border"]
if iname then
size = size or "23x15px"
if yn_map[border]==0 then border = "" else border = "|border" end
else
iname = data["flag alias-"..amap[avar].altvar.."-"..variant] or data["flag alias-"..variant] or data["flag alias-"..amap[avar].altvar] or data["flag alias"] or placeholder
size = size or emp2nil(data.size) or "23x15px"
if border then
if yn_map[border]==0 then border = "" else border = "|border" end
else
local autoborder = data["border-"..variant] or data["border-"..amap[avar].altvar] or data.border
if autoborder and autoborder~="border" then border = "" else border = "|border" end
end
end
local am = ""
if args["alt"] or string.find(me,"a") then
am = args["alt"] or args["name"] or country
am = am.."|"..am
end
--Build display name
local text = args["text"]
if not text then
if mn=="x" then --no text
text = ""
elseif mn=="p" or mn=="f" or mn == "*" then --prefix/suffix link
text = flink=="" and name or "[["..flink..fsec.."|"..name.."]]"
-- By the principle of least surprise, there should be some
-- indication that the link [[X of Country|Country]] does not
-- go to [[Country]].
if mn == "*" and clink ~= flink then
text = text:sub(1, -3) .. "\226\128\175*]]" end
elseif mn=="l" then --display link target
text = flink=="" and name or "[["..flink..fsec.."|"..(args["name"] or flink).."]]"
elseif mn=="b" then --both prefix/suffix and normal country link
local preflink = pref and (flink=="" and pref.." " or "[["..flink..fsec.."|"..pref.."]] ") or ""
local sufflink = suff and (flink=="" and " "..suff or " [["..flink..fsec.."|"..suff.."]]") or ""
local namelink = (name=="" and "" or nthe)..(clink=="" and name or "[["..clink..csec.."|"..name.."]]")
text = preflink..namelink..sufflink
elseif mn=="d" then --data template
local title = mw.title.new("Template:Country data "..country)
--check if redirect
if title.isRedirect then
text = "<span class=\"plainlinks\">["..title:fullUrl("redirect=no").." "..name.."]</span>"
else
text = "[["..title.fullText.."|"..name.."]]"
end
elseif mn=="u" then --unlinked
text = name
elseif mn=="a" then --abbr
text = name==country and (clink==country and country or "<abbr title='"..clink.."'>"..country.."</abbr>") or ("<abbr title='"..name.."'>"..country.."</abbr>")
else --country link (default)
text = clink=="" and name or "[["..clink..csec.."|"..name.."]]"
end
if string.find(me,"p") then
text = "("..text..")"
end
end
if type(text) == 'function' then
text = text(data)
end
--Define separator
local separator = " "
if ms=="x" then --no separator
separator = ""
elseif ms=="l" then --line break
separator = "<br />"
end
--Add preftext, if used
local preftext = args["preftext"]
if (preftext or "") ~= "" then
text = preftext..separator..text
end
--Build image
local ilink = args["ilink"]
if not ilink then
if mi=="x" or (iname==placeholder and pimage~=placeholder) then --no image/invisible image
iname = placeholder
border = ""
ilink = "|link="
am = ""
elseif mi=="i" then --image page link
ilink = ""
elseif mi=="c" then --country link
ilink = "|link="..clink..(clink=="" and "" or csec)
elseif mi=="p" or mi=="f" then --prefix/suffix link
ilink = "|link="..flink..(flink=="" and "" or fsec)
elseif mi=="d" then --data template
local title = mw.title.new("Template:Country data "..country)
--check if redirect
if title.isRedirect then
ilink = "|link="..title:fullUrl("redirect=no")
else
ilink = "|link="..title.fullText
end
else --unlinked (default)
ilink = "|link="
end
end
if am == "" and string.find(me,"l") then
am = mw.ustring.sub(ilink,7,-1)
end
local image = "[[File:"..iname.."|"..size..border..ilink.."|alt="..am.."]]"
if iname==placeholder then
if require('Module:yesno')(args["noredlink"]) == false or args["noredlink"] == "notext" then
if country ~= '' and data.alias == nil then
iname = ''
image = "[[:Template:Country data "..country.."]]"
if args["noredlink"] == "notext" then
text = ''
end
end
end
if (args["missingcategory"] or '') ~= '' then
image = image..args["missingcategory"]
end
if string.find(me,"b") then
text = ''
end
end
--Combine image and name with separator
local align_map = {left="left", l="left", center="center", centre="center", c="center", middle="center", m="center", right="right", r="right"}
local align = align_map[args["align"] or args["al"]]
local nalign = align_map[args["nalign"] or args["nal"]]
local out
if string.find(me,"r") then
--image right of name
if (ms=="x" and mi=="x") or (string.find(me,"o") and iname==placeholder and pimage~=placeholder) then --name only
out = text
elseif ms=="x" or ms=="n" or ms=="l" then --no separator, non-breaking space, or line break
out = text.."<span class=\"flagicon nowrap\">"..separator..image.."</span>"
elseif ms=="t" then --table cell
out = "style=\"text-align:"..(nalign or "left").."\"|"..text.."||style=\"text-align:"..(align or "center").."\"|<span class=\"flagicon\">"..image.."</span>"
else --fixed-width span box (default)
local width = args["width"] or args["w"] or require("Module:Flag list").luawidth(size)
out = text.."<span class=\"nowrap\"> <span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(align or "right").."\">"..image.."</span></span>"
end
else --image left of name
if (ms=="x" and mi=="x") or (string.find(me,"o") and iname==placeholder and pimage~=placeholder) then --name only
out = text
elseif ms=="x" or ms=="n" or ms=="l" then --no separator, non-breaking space, or line break
out = "<span class=\"flagicon\">"..image..separator.."</span>"..text
elseif ms=="t" then --table cell
out = "style=\"text-align:"..(align or "center")..";\"|<span class=\"flagicon\">"..image.."</span>||style=\"text-align:"..(nalign or "left").."\"|"..text
else --fixed-width span box (default)
local width = nopx(args["width"] or args["w"]) or require("Module:Flag list").luawidth(size)
out = "<span class=\"nowrap\"><span class=\"flagicon\" style=\"display:inline-block;width:"..width.."px;text-align:"..(align or "left").."\">"..image.."</span> </span>"..text
end
end
-- align in table
if me:find("t") then
out = 'style="text-align:'..(align or 'left')..'"|'..out
end
--Tracking categories
local cat = ""
if pimage and not image_map[pimage] and country~="" and data["flag alias"] and not args.demo then
cat = "[[Category:Pages using Flagg with specified image instead of data template image]]"
end
return out..cat
end
p[''] = p.main
return p
5ccusrx57387gqcom4sz1tzbt0w2ggk
Módulo:Flag
828
8974
74867
2026-06-03T14:15:29Z
en>Ahecht
0
Fix preview warning for flagicon
74867
Scribunto
text/plain
local margs = require('Module:Arguments')
local notblank = function (v) return (v or '') ~= '' end
local function _main(frame, name, mode, key)
local categories = {
['Flag icon'] = '[[Category:Flag icons missing country data templates]]' ..
frame:expandTemplate{title = 'Preview warning', args = {'Unrecognized country in Template:flag icon'}},
['Flag decoration'] = '[[Category:Flag decoration missing country data templates]]',
}
local yesno = require('Module:Yesno')
--Get input arguments
local args = margs.getArgs(frame, {
frameOnly = notblank(frame.args.frameonly), valueFunc =
function(argkey,value)
if value then
value = mw.text.trim(value)
--Change empty string to nil for all args except 'image' and 'border'
if argkey=="image" or argkey=="border" or value~="" then
return value
end
end
return nil
end
} )
local preftext, sufftext = "", ""
if name == 'Flag+link' then
args.pref = args[1]
elseif name == 'Flag athlete' then
args.preftext = args[1]
args[2] = args.code or args[2] or ""
args.variant = args.variant or args[3]
elseif name == 'Flag medalist' then
preftext = (args[1] or "") .. "<br/>"
args[2] = args.code or args[2] or ""
args.variant = args.variant or args[3]
elseif name == 'Flag link' then
args.suff = args[2]
args[2] = args[1] or ""
args.variant = args.variant or args[3]
elseif key ~= nil then
args.variant = args.variant or args[1]
args[2] = key
else
local sports = {
['3x3'] = '3x3',
bb = 'bb',
fb = 'fb',
fbicon = 'fb',
ru = 'ru',
fba = 'fba',
fbw = 'fbw',
fbaicon = 'fba',
futsal = 'futsal'
}
if sports[name]then
args.avar = args[1] and sports[name] or nil
if name == 'fb' and yesno(args.align) == true then
args.align='c'
elseif sports[name] == 'fba' then
if args[1] then
local list = require("Module:Fba/list")
local old = notblank(args.old) and "_old" or ""
local country = args[1]
local fba = list.fbas[country .. old]
if not fba then -- look for aliases
local countryTable = require('Module:CountryData').getcachedtable(frame, country)
if countryTable and countryTable.alias then
country = countryTable.alias
fba = list.fbas[country .. old]
end
end
if args.name == "code" then
args.name = list.codes[country] or country
elseif args.name == "full" then
args.name = fba
end
if fba then
mode = string.gsub(mode, "p", "c")
args.link = fba
end
args.altlink = args.old
elseif args.name == "code" or args.name == "full" then
args.name = ""
end
end
elseif name == "Flag team" and (args.code or args[1]) then
sufftext = ' <span style="font-size:90%;">('..(args.code or args[1])..')</span>'
end
args.variant = args.variant or args[2]
args[2] = args[1] or ""
end
args[1] = mode .. (args.opts or '')
args.missingcategory = notblank(args[2]) and categories[name] or nil
args.noredlink = args.noredlink or 'notext'
if args.placeholder and yesno(args.placeholder) ~= true then
args[1] = args[1] .. 'o'
end
local check = ''
if name == 'Flag icon' and mw.title.getCurrentTitle().namespace == 0 then
local unknown = '[[Category:Pages using ' .. mw.ustring.lower(name) ..
' template with unknown parameters|_VALUE_' .. frame:getParent():getTitle() .. ']]'
local opts = {
unknown=unknown,
preview='Page using [[Template:' .. name .. ']] with unknown parameter "_VALUE_"',
ignoreblank='y',
'1','2','variant','image','size','sz','border','align','al','width',
'w','alt','ilink','noredlink','missingcategory','name','clink','link',
'pref','suff','plink','the','section','altvar','avar','age','nalign',
'nal','text','nodata','opts','placeholder','getParent','frameonly'
}
check = require('Module:Check for unknown parameters')._check(opts,args)
end
return preftext .. require('Module:Flagg').luaMain(frame,args) .. sufftext .. check
end
local p = {
[''] = function (frame) return _main(frame, 'Flag', 'unc' ) end,
decoration = function (frame) return _main(frame, 'Flag decoration', 'uxx' ) end,
icon = function (frame) return _main(frame, 'Flag icon', 'cxxl' ) end,
link = function (frame) return _main(frame, 'Flag link', 'unpe' ) end,
['+link'] = function (frame) return _main(frame, 'Flag+link', 'unpefo') end,
u = function (frame) return _main(frame, 'Flag', 'unu' ) end,
country = function (frame) return _main(frame, 'Flag country', 'unce' ) end,
list = function (frame) return _main(frame, 'Flag list', 'usc' ) end,
team = function (frame) return _main(frame, 'Flag team', 'unce' ) end,
athlete = function (frame) return _main(frame, 'Flag athlete', 'unape' ) end,
medalist = function (frame) return _main(frame, 'Flag medalist', 'unce' ) end,
['3x3'] = function (frame) return _main(frame, '3x3', 'unpe' ) end,
bb = function (frame) return _main(frame, 'bb', 'unpe' ) end,
fb = function (frame) return _main(frame, 'fb', 'unpe' ) end,
fba = function (frame) return _main(frame, 'fba', 'unpe' ) end,
['fb-rt'] = function (frame) return _main(frame, 'fb', 'unpre' ) end,
fbw = function (frame) return _main(frame, 'fbw', 'unpe' ) end,
['fbw-rt'] = function (frame) return _main(frame, 'fbw', 'unpre' ) end,
fbicon = function (frame) return _main(frame, 'fbicon', 'pxxl' ) end,
fbaicon = function (frame) return _main(frame, 'fbaicon', 'pxxl' ) end,
futsal = function (frame) return _main(frame, 'futsal', 'unpe' ) end,
['futsal-rt'] = function (frame) return _main(frame, 'futsal', 'unpre' ) end,
ru = function (frame) return _main(frame, 'ru', 'unpe' ) end,
IOC = function (frame) return require('Module:Country_alias').flagIOC(frame:newChild{ title = 'Template:Flag IOC' }) end,
IOC2 = function (frame) return require('Module:Country_alias').flagXYZ(frame:newChild{ title = 'Template:Flag IOC 2', args = {name = margs.getArgs(frame).name or '', type = 'name'} }) end,
IOCathlete = function (frame) return require('Module:Country_alias').flagXYZ(frame:newChild{ title = 'Template:Flag IOC athlete', args = {type = 'athlete-O'} }) end,
}
p['deco'] = p.decoration
p['IOC 2'] = p.IOC2
p['IOC athlete'] = p.IOCathlete
return setmetatable (p, {['__index'] = -- returns table p with the metatable __index set so that, if the table KEY isn't recognized, it returns
function (_, key) -- this anonymous function called as function(p, KEY)
return function (frame) return _main(frame, 'Flag', 'unc', key) end -- which interprets the module call as {{flag|KEY}} and passes it to _main()
end
})
apela3nej9rul4uuteiz2dfzqnvoyyz
74868
74867
2026-08-24T00:33:41Z
Robertsky
10424
1 versaun husi [[:en:Module:Flag]]
74867
Scribunto
text/plain
local margs = require('Module:Arguments')
local notblank = function (v) return (v or '') ~= '' end
local function _main(frame, name, mode, key)
local categories = {
['Flag icon'] = '[[Category:Flag icons missing country data templates]]' ..
frame:expandTemplate{title = 'Preview warning', args = {'Unrecognized country in Template:flag icon'}},
['Flag decoration'] = '[[Category:Flag decoration missing country data templates]]',
}
local yesno = require('Module:Yesno')
--Get input arguments
local args = margs.getArgs(frame, {
frameOnly = notblank(frame.args.frameonly), valueFunc =
function(argkey,value)
if value then
value = mw.text.trim(value)
--Change empty string to nil for all args except 'image' and 'border'
if argkey=="image" or argkey=="border" or value~="" then
return value
end
end
return nil
end
} )
local preftext, sufftext = "", ""
if name == 'Flag+link' then
args.pref = args[1]
elseif name == 'Flag athlete' then
args.preftext = args[1]
args[2] = args.code or args[2] or ""
args.variant = args.variant or args[3]
elseif name == 'Flag medalist' then
preftext = (args[1] or "") .. "<br/>"
args[2] = args.code or args[2] or ""
args.variant = args.variant or args[3]
elseif name == 'Flag link' then
args.suff = args[2]
args[2] = args[1] or ""
args.variant = args.variant or args[3]
elseif key ~= nil then
args.variant = args.variant or args[1]
args[2] = key
else
local sports = {
['3x3'] = '3x3',
bb = 'bb',
fb = 'fb',
fbicon = 'fb',
ru = 'ru',
fba = 'fba',
fbw = 'fbw',
fbaicon = 'fba',
futsal = 'futsal'
}
if sports[name]then
args.avar = args[1] and sports[name] or nil
if name == 'fb' and yesno(args.align) == true then
args.align='c'
elseif sports[name] == 'fba' then
if args[1] then
local list = require("Module:Fba/list")
local old = notblank(args.old) and "_old" or ""
local country = args[1]
local fba = list.fbas[country .. old]
if not fba then -- look for aliases
local countryTable = require('Module:CountryData').getcachedtable(frame, country)
if countryTable and countryTable.alias then
country = countryTable.alias
fba = list.fbas[country .. old]
end
end
if args.name == "code" then
args.name = list.codes[country] or country
elseif args.name == "full" then
args.name = fba
end
if fba then
mode = string.gsub(mode, "p", "c")
args.link = fba
end
args.altlink = args.old
elseif args.name == "code" or args.name == "full" then
args.name = ""
end
end
elseif name == "Flag team" and (args.code or args[1]) then
sufftext = ' <span style="font-size:90%;">('..(args.code or args[1])..')</span>'
end
args.variant = args.variant or args[2]
args[2] = args[1] or ""
end
args[1] = mode .. (args.opts or '')
args.missingcategory = notblank(args[2]) and categories[name] or nil
args.noredlink = args.noredlink or 'notext'
if args.placeholder and yesno(args.placeholder) ~= true then
args[1] = args[1] .. 'o'
end
local check = ''
if name == 'Flag icon' and mw.title.getCurrentTitle().namespace == 0 then
local unknown = '[[Category:Pages using ' .. mw.ustring.lower(name) ..
' template with unknown parameters|_VALUE_' .. frame:getParent():getTitle() .. ']]'
local opts = {
unknown=unknown,
preview='Page using [[Template:' .. name .. ']] with unknown parameter "_VALUE_"',
ignoreblank='y',
'1','2','variant','image','size','sz','border','align','al','width',
'w','alt','ilink','noredlink','missingcategory','name','clink','link',
'pref','suff','plink','the','section','altvar','avar','age','nalign',
'nal','text','nodata','opts','placeholder','getParent','frameonly'
}
check = require('Module:Check for unknown parameters')._check(opts,args)
end
return preftext .. require('Module:Flagg').luaMain(frame,args) .. sufftext .. check
end
local p = {
[''] = function (frame) return _main(frame, 'Flag', 'unc' ) end,
decoration = function (frame) return _main(frame, 'Flag decoration', 'uxx' ) end,
icon = function (frame) return _main(frame, 'Flag icon', 'cxxl' ) end,
link = function (frame) return _main(frame, 'Flag link', 'unpe' ) end,
['+link'] = function (frame) return _main(frame, 'Flag+link', 'unpefo') end,
u = function (frame) return _main(frame, 'Flag', 'unu' ) end,
country = function (frame) return _main(frame, 'Flag country', 'unce' ) end,
list = function (frame) return _main(frame, 'Flag list', 'usc' ) end,
team = function (frame) return _main(frame, 'Flag team', 'unce' ) end,
athlete = function (frame) return _main(frame, 'Flag athlete', 'unape' ) end,
medalist = function (frame) return _main(frame, 'Flag medalist', 'unce' ) end,
['3x3'] = function (frame) return _main(frame, '3x3', 'unpe' ) end,
bb = function (frame) return _main(frame, 'bb', 'unpe' ) end,
fb = function (frame) return _main(frame, 'fb', 'unpe' ) end,
fba = function (frame) return _main(frame, 'fba', 'unpe' ) end,
['fb-rt'] = function (frame) return _main(frame, 'fb', 'unpre' ) end,
fbw = function (frame) return _main(frame, 'fbw', 'unpe' ) end,
['fbw-rt'] = function (frame) return _main(frame, 'fbw', 'unpre' ) end,
fbicon = function (frame) return _main(frame, 'fbicon', 'pxxl' ) end,
fbaicon = function (frame) return _main(frame, 'fbaicon', 'pxxl' ) end,
futsal = function (frame) return _main(frame, 'futsal', 'unpe' ) end,
['futsal-rt'] = function (frame) return _main(frame, 'futsal', 'unpre' ) end,
ru = function (frame) return _main(frame, 'ru', 'unpe' ) end,
IOC = function (frame) return require('Module:Country_alias').flagIOC(frame:newChild{ title = 'Template:Flag IOC' }) end,
IOC2 = function (frame) return require('Module:Country_alias').flagXYZ(frame:newChild{ title = 'Template:Flag IOC 2', args = {name = margs.getArgs(frame).name or '', type = 'name'} }) end,
IOCathlete = function (frame) return require('Module:Country_alias').flagXYZ(frame:newChild{ title = 'Template:Flag IOC athlete', args = {type = 'athlete-O'} }) end,
}
p['deco'] = p.decoration
p['IOC 2'] = p.IOC2
p['IOC athlete'] = p.IOCathlete
return setmetatable (p, {['__index'] = -- returns table p with the metatable __index set so that, if the table KEY isn't recognized, it returns
function (_, key) -- this anonymous function called as function(p, KEY)
return function (frame) return _main(frame, 'Flag', 'unc', key) end -- which interprets the module call as {{flag|KEY}} and passes it to _main()
end
})
apela3nej9rul4uuteiz2dfzqnvoyyz
Template:Infobox mountain range
10
8975
74869
2018-02-23T17:02:30Z
en>Primefac
0
Changed protection level for "[[Template:Infobox mountain range]]": [[WP:HIGHRISK|high-risk]] template with 2000+ transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74869
wikitext
text/x-wiki
#REDIRECT [[Template:Infobox mountain]]
{{R after merge}}
l5uqeudp9w2ze334zoqh6rsrhafdral
74870
74869
2026-08-24T00:33:41Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mountain_range]]
74869
wikitext
text/x-wiki
#REDIRECT [[Template:Infobox mountain]]
{{R after merge}}
l5uqeudp9w2ze334zoqh6rsrhafdral
Template:Infobox mountain range/Gebirgsgruppe/doc
10
8976
74871
2023-05-21T06:47:52Z
en>WOSlinker
0
syntaxhighlight lang="wikitext"
74871
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{substituted|auto=yes}}
== Usage ==
This template, {{tl|Infobox mountain range/Gebirgsgruppe}}, is designed to support articles on German, Austrian and Swiss mountain ranges that are being translated from German Wikipedia. It works by shimming the German parameters into those used by {{Tl|Infobox mountain range}}, such that all parameters are automatically translated, along with many of the standard data entries. This massively reduces the workload for translators and facilitates the rapid transfer of tabular information from German Wikipedia.
It should always be ''subst:''ituted.
{{Parameter names example
| NAME
| BILD
| BILDBESCHREIBUNG
| HÖCHSTER GIPFEL
| MAX-HÖHE =
| MAX-HÖHE-BEZUG
| MAX-LÄNGE =
| FLÄCHE =
| KARTE
| KARTENBESCHREIBUNG
| LAGE
| LAGE-POLITISCH
| BREITENGRAD =
| LÄNGENGRAD =
| LAGE-GEBIRGE
| TYP
| ALTER
| GESTEIN
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox mountain range/Gebirgsgruppe
| NAME = <!-- name-->
| BILD = <!-- photo -->
| BILDBESCHREIBUNG = <!-- photo_caption -->
| HÖCHSTER GIPFEL = <!-- highest -->
| MAX-HÖHE = <!-- elevation -->
| MAX-HÖHE-BEZUG = <!-- height_datum -->
| MAX-LÄNGE = <!-- length_km -->
| FLÄCHE = <!-- area_km2 -->
| KARTE = <!-- map -->
| KARTENBESCHREIBUNG = <!-- map_caption -->
| LAGE = <!-- location -->
| LAGE-POLITISCH = <!-- state -->
| BREITENGRAD = <!-- range_lat_d -->
| LÄNGENGRAD = <!-- range_long_d -->
| LAGE-GEBIRGE = <!-- parent -->
| TYP = <!-- orogeny -->
| ALTER = <!-- period -->
| GESTEIN = <!-- geology -->
}}
</syntaxhighlight>
{{clear}}
== Example ==
{{Infobox mountain range
| name = Fichtel Mountains<br>(''Fichtelgebirge'')
| map_image = Vierländerregion Bayern - Thüringen - Sachsen - Böhmen DE.png
| map_caption = The Fichtel Mountains in northeast Bavaria
| photo = Fichtelgebirge von Heinersreuth aus.jpg
| photo_caption = The [[Schneeberg (Fichtelgebirge)|Schneeberg]] (left) and the [[Ochsenkopf (Fichtelgebirge)|Ochsenkopf]] (right), seen from [[Heinersreuth]]
| state = [[Bavaria]] & [[Czech Republic]]
| parent = [[Thuringian-Franconian Highlands]]
| location =
| geology =
| period =
| area_km2 =
| orogeny =
| highest = [[Schneeberg (Fichtelgebirge)|Schneeberg]]
| elevation_m = 1051
| height_datum = DE-NN
| length_km =
| range_coordinates = {{coord|50.05|11.85|type:mountain_region:DE-BY/CZ-KA|format=dms|display=inline,title}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox mountain range/Gebirgsgruppe
| NAME = Fichtel Mountains<br>(''Fichtelgebirge'')
| KARTE = Vierländerregion Bayern - Thüringen - Sachsen - Böhmen DE.png
| KARTENBESCHREIBUNG = The Fichtel Mountains in northeast Bavaria
| BILD = Fichtelgebirge von Heinersreuth aus.jpg
| BILDBESCHREIBUNG = The [[Schneeberg (Fichtelgebirge)|Schneeberg]] (left) and the [[Ochsenkopf (Fichtelgebirge)|Ochsenkopf]] (right), seen from [[Heinersreuth]]
| LAGE-POLITISCH = [[Bavaria]] & [[Czech Republic]]
| EINTEILUNG NACH = [[Handbuch der naturräumlichen Gliederung Deutschlands]]
| LAGE-GEBIRGE = [[Thuringian-Franconian Highlands]]
| LAGE-GEBIRGE-BEZ = Part of
| HÖCHSTER GIPFEL = [[Schneeberg (Fichtelgebirge)|Schneeberg]]
| MAX-HÖHE = 1051
| MAX-HÖHE-BEZUG = DE-NN
| BREITENGRAD = 50.05
| LÄNGENGRAD = 11.85
| REGION-ISO = DE-BY/CZ-KA
| MAX-LÄNGE =
| POSKARTE = Deutschland Bayern
| ALTERNATIVKARTE = Bavaria relief location map.jpg
| TYP =
| GESTEIN =
| ALTER =
| FLÄCHE =
| BESONDERHEITEN =
}}
</syntaxhighlight>
{{clear}}
== See also ==
* [[Template:Infobox mountain range]] (used by this template)
* [[Template:Infobox mountain/Berg]] (for importing the German version of {{tl|Infobox mountain}})
<includeonly>{{Sandbox other||
<!-- Categories below this line -->
[[Category:Austria geography templates|Gebirgsgruppe]]
[[Category:Germany geography templates|Gebirgsgruppe]]
[[Category:Infobox importer templates]]
}}</includeonly>
izxenixd6q8kcrv2nu8cop0pkge1amg
74872
74871
2026-08-24T00:33:41Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_mountain_range/Gebirgsgruppe/doc]]
74871
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{substituted|auto=yes}}
== Usage ==
This template, {{tl|Infobox mountain range/Gebirgsgruppe}}, is designed to support articles on German, Austrian and Swiss mountain ranges that are being translated from German Wikipedia. It works by shimming the German parameters into those used by {{Tl|Infobox mountain range}}, such that all parameters are automatically translated, along with many of the standard data entries. This massively reduces the workload for translators and facilitates the rapid transfer of tabular information from German Wikipedia.
It should always be ''subst:''ituted.
{{Parameter names example
| NAME
| BILD
| BILDBESCHREIBUNG
| HÖCHSTER GIPFEL
| MAX-HÖHE =
| MAX-HÖHE-BEZUG
| MAX-LÄNGE =
| FLÄCHE =
| KARTE
| KARTENBESCHREIBUNG
| LAGE
| LAGE-POLITISCH
| BREITENGRAD =
| LÄNGENGRAD =
| LAGE-GEBIRGE
| TYP
| ALTER
| GESTEIN
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox mountain range/Gebirgsgruppe
| NAME = <!-- name-->
| BILD = <!-- photo -->
| BILDBESCHREIBUNG = <!-- photo_caption -->
| HÖCHSTER GIPFEL = <!-- highest -->
| MAX-HÖHE = <!-- elevation -->
| MAX-HÖHE-BEZUG = <!-- height_datum -->
| MAX-LÄNGE = <!-- length_km -->
| FLÄCHE = <!-- area_km2 -->
| KARTE = <!-- map -->
| KARTENBESCHREIBUNG = <!-- map_caption -->
| LAGE = <!-- location -->
| LAGE-POLITISCH = <!-- state -->
| BREITENGRAD = <!-- range_lat_d -->
| LÄNGENGRAD = <!-- range_long_d -->
| LAGE-GEBIRGE = <!-- parent -->
| TYP = <!-- orogeny -->
| ALTER = <!-- period -->
| GESTEIN = <!-- geology -->
}}
</syntaxhighlight>
{{clear}}
== Example ==
{{Infobox mountain range
| name = Fichtel Mountains<br>(''Fichtelgebirge'')
| map_image = Vierländerregion Bayern - Thüringen - Sachsen - Böhmen DE.png
| map_caption = The Fichtel Mountains in northeast Bavaria
| photo = Fichtelgebirge von Heinersreuth aus.jpg
| photo_caption = The [[Schneeberg (Fichtelgebirge)|Schneeberg]] (left) and the [[Ochsenkopf (Fichtelgebirge)|Ochsenkopf]] (right), seen from [[Heinersreuth]]
| state = [[Bavaria]] & [[Czech Republic]]
| parent = [[Thuringian-Franconian Highlands]]
| location =
| geology =
| period =
| area_km2 =
| orogeny =
| highest = [[Schneeberg (Fichtelgebirge)|Schneeberg]]
| elevation_m = 1051
| height_datum = DE-NN
| length_km =
| range_coordinates = {{coord|50.05|11.85|type:mountain_region:DE-BY/CZ-KA|format=dms|display=inline,title}}
}}
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox mountain range/Gebirgsgruppe
| NAME = Fichtel Mountains<br>(''Fichtelgebirge'')
| KARTE = Vierländerregion Bayern - Thüringen - Sachsen - Böhmen DE.png
| KARTENBESCHREIBUNG = The Fichtel Mountains in northeast Bavaria
| BILD = Fichtelgebirge von Heinersreuth aus.jpg
| BILDBESCHREIBUNG = The [[Schneeberg (Fichtelgebirge)|Schneeberg]] (left) and the [[Ochsenkopf (Fichtelgebirge)|Ochsenkopf]] (right), seen from [[Heinersreuth]]
| LAGE-POLITISCH = [[Bavaria]] & [[Czech Republic]]
| EINTEILUNG NACH = [[Handbuch der naturräumlichen Gliederung Deutschlands]]
| LAGE-GEBIRGE = [[Thuringian-Franconian Highlands]]
| LAGE-GEBIRGE-BEZ = Part of
| HÖCHSTER GIPFEL = [[Schneeberg (Fichtelgebirge)|Schneeberg]]
| MAX-HÖHE = 1051
| MAX-HÖHE-BEZUG = DE-NN
| BREITENGRAD = 50.05
| LÄNGENGRAD = 11.85
| REGION-ISO = DE-BY/CZ-KA
| MAX-LÄNGE =
| POSKARTE = Deutschland Bayern
| ALTERNATIVKARTE = Bavaria relief location map.jpg
| TYP =
| GESTEIN =
| ALTER =
| FLÄCHE =
| BESONDERHEITEN =
}}
</syntaxhighlight>
{{clear}}
== See also ==
* [[Template:Infobox mountain range]] (used by this template)
* [[Template:Infobox mountain/Berg]] (for importing the German version of {{tl|Infobox mountain}})
<includeonly>{{Sandbox other||
<!-- Categories below this line -->
[[Category:Austria geography templates|Gebirgsgruppe]]
[[Category:Germany geography templates|Gebirgsgruppe]]
[[Category:Infobox importer templates]]
}}</includeonly>
izxenixd6q8kcrv2nu8cop0pkge1amg
Template:Infobox Gebirgsgruppe
10
8977
74875
2019-02-12T10:56:06Z
en>Pigsonthewing
0
Pigsonthewing moved page [[Template:Infobox Gebirgsgruppe]] to [[Template:Infobox mountain range/Gebirgsgruppe]]: standardlise; make purpose clear
74875
wikitext
text/x-wiki
#REDIRECT [[Template:Infobox mountain range/Gebirgsgruppe]]
{{R from move}}
keocrfhqg4awhxyif1emymcie1kqhg1
74876
74875
2026-08-24T00:34:04Z
Robertsky
10424
1 versaun husi [[:en:Template:Infobox_Gebirgsgruppe]]
74875
wikitext
text/x-wiki
#REDIRECT [[Template:Infobox mountain range/Gebirgsgruppe]]
{{R from move}}
keocrfhqg4awhxyif1emymcie1kqhg1
Template:R after merge
10
8978
74877
2022-03-12T12:33:16Z
en>Redireditor
0
Added {{[[Template:R from alternative name|R from alternative name]]}} – this is a rewording of the rcat name
74877
wikitext
text/x-wiki
#REDIRECT [[Template:R from merge]]
{{Redirect category shell|
{{R to redirect template}}
{{R from alternative name}}
}}
mprxhpgdsfpr8smzsgd5r3e28zc74uj
74878
74877
2026-08-24T00:34:26Z
Robertsky
10424
1 versaun husi [[:en:Template:R_after_merge]]
74877
wikitext
text/x-wiki
#REDIRECT [[Template:R from merge]]
{{Redirect category shell|
{{R to redirect template}}
{{R from alternative name}}
}}
mprxhpgdsfpr8smzsgd5r3e28zc74uj
Módulo:WikidataIB/doc
828
8979
74880
2025-12-20T20:30:35Z
en>Jonesey95
0
/* Limiting the returned values */ explain that it picks the first one
74880
wikitext
text/x-wiki
{{Module rating |protected}}
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{ombox|text=For a more user-friendly wrapper of this module see {{t|wdib}}.}}
This module is intended to be used inside {{t|infobox}} (letters Wikidata'''IB''' stand for ''Info Box'', hence the name) or other templates and designed specifically to allow editors of an article (as opposed to editors of the infobox the article uses) to control whether Wikidata values are displayed.
One of the two sandboxes should be used for testing anything other than trivial amendments.
Test examples for the main module and the two sandboxes are available.
{| class="wikitable plainrowheaders
|+ Modules and test cases
|-
!
! scope="col" | Module
! scope="col" | Test cases
|-
! scope="row" | Main
| [[Module:WikidataIB]]
| [[Module talk:WikidataIB/testing]]
|-
! scope="row" | sandbox
| [[Module:WikidataIB/sandbox]] ({{Compare pages|Module:WikidataIB|Module:WikidataIB/sandbox|diff}})
| [[Module talk:WikidataIB/sandbox/testing]] ({{Compare pages|Module talk:WikidataIB/testing|Module talk:WikidataIB/sandbox/testing|diff}})
|-
! scope="row" | sandbox1
| [[Module:WikidataIB/sandbox1]] ({{Compare pages|Module:WikidataIB|Module:WikidataIB/sandbox1|diff}})
| [[Module talk:WikidataIB/sandbox1/testing]] ({{Compare pages|Module talk:WikidataIB/testing|Module talk:WikidataIB/sandbox1/testing|diff}})
|}
== Overview ==
The module provides these calls specifically for use in infoboxes at present:
# <code>getValue</code> - main call, used to get the value(s) of a given property
# <code>getQualifierValue</code> - given: (1) a property; (2) its value; (3) a qualifier's propertyID, returns values which match
# <code>getValueByQual</code> gets the value of a property which has a qualifier with a given entity value
# <code>getValueByLang</code> gets the value of a property which has a qualifier P407("language of work or name") whose value has the given language code
# <code>getValueByRefSource</code> gets the value of a property which has a reference "stated in" (P248) whose value has the given entity-ID
# <code>getPropOfProp</code> if the value(s) of prop1 are of type "wikibase-item" then it returns the value(s) of prop2 of each of those wikibase-items
# <code>getAwardCat</code> if the item has values of P166 (award received), then it examines each of those awards for P2517 (category for recipients of this award) and it returns the corresponding category, with the item's P734 (family name) as sort key, or no sort key if there is no family name
# <code>getIntersectCat</code> for each value of the prop1 it fetches the value's main category and then each value of prop2, then it returns all of the categories representing the intersection of those properties
# <code>getSumOfParts</code> scans the property 'has part' (P527) for values matching a list. If the matched values have a qualifier 'quantity' (P1114), those quantities are summed and returned (but zero returns nil)
# <code>getCoords</code> gets coordinates and passes them through {{t|Coord}}
# <code>getPreferredValue</code> - {{color|red|'''Deprecated'''}} but retained for backward compatibility. Use the <code>|getValue|rank=best</code> parameters instead
The obsolete call getSourcedValue has now been removed as it is redundant to getValue which can do the same job using the {{para|onlysourced|true}} parameter (which is set by default).
===Utilities functions===
# <code>getLink</code> if there is a sitelink to an article on the local Wiki, it returns a link to the article with the Wikidata label as the displayed text. If there is no sitelink, it returns the label as plain text. If there is no label in the local language, it returns the entity-ID
# <code>getAT</code> (Article Title) If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text, otherwise nothing
# <code>getSiteLink</code> gets the plain text link to an article on a given wiki
# <code>getLabel</code> returns the Wikidata label for the local language as plain text. If there is no label in the local language, it returns the entity-ID
# <code>getAllLabels</code> fetches the set of labels and formats it for display as wikitext
# <code>labelorid</code> returns the label with all wikitext removed, or the entity-ID if no label
# <code>getDescription</code> returns the article description for the Wikidata entity if the local parameter is "Wikidata"
# <code>getAllDescriptions</code> fetches the set of descriptions and formats it for display as wikitext
# <code>getAliases</code> returns the aliases for the entity in the current or given language
# <code>getAllAliases</code> fetches the set of aliases and formats it for display as wikitext
# <code>pageId</code> returns the connected Wikidata page id (entity-ID, Q-number) of the current page
# <code>formatDate</code> takes a datetime of the usual format from mw.wikibase.entity:formatPropertyValues and formats it according to the df (date format) and bc parameters
# <code>formatNumber</code> formats a number according to the supplied language code
# <code>checkBlacklist</code> returns true if the field is ''not'' blacklisted (i.e. allowed)
# <code>emptyor</code> returns nil if the parameter is just punctuation, whitespace or html tags, otherwise returns the argument unchanged
# <code>getLang</code> returns the MediaWiki language code or the full language name of the current content
# <code>getItemLangCode</code> looks for country (P17), then for that country's official language (P37), and returns its language code (P424)
# <code>findLanguage</code> returns (1) supplied language if valid; or (2) the user's set language; or (3) the language of the current wiki
# <code>getQid</code> returns (1) the entity-ID, if supplied; or (2) the entity ID of the "category's main topic (P301)"; or (3) the entity ID associated with the current page; or (4) nothing
# <code>followQid</code> given a list of properties, looks for each property in turn and returns the entity-ID of the first value that matches (optionally, returns all entity-IDs that match)
# <code>getGlobe</code> returns the entity-ID of the globe used in P625 (coordinate location), or nil if there isn't one
# <code>getCommonsLink</code> returns one of the following in order of preference: the Commons sitelink of the linked Wikidata item; the Commons sitelink of the topic's main category of the linked Wikidata item
# <code>siteID</code> returns the root of the globalSiteID, e.g. "en" for "enwiki", "enwikisource", "en-gb", etc.
# <code>projID</code> same as siteID
# <code>location</code> scans from the current location upwards along the chain of higher-level locations, returning each one until it reaches a country
# <code>examine</code> returns a formatted dump of the given property
# <code>url2</code> takes a parameter that is a proper url and formats it for use in an infobox; it accepts its own output as input
# <code>getWebsite</code> fetches the Official website (P856) and formats it for use in an infobox
# <code>checkvalue</code> looks through a property for a given entity-ID as its value and returns that entity-ID if found; otherwise nil
# <code>checkValidity</code> returns whether the first unnamed parameter represents a valid entity-id
# <code>showNoLinks</code> displays the article titles that should not be linked
===Examples of calls===
<nowiki>{{#invoke:WikidataIB |getValue |<PropertyID> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no> |noicon=<yes/no> |df=<dmy/mdy/y> |bc=<BC/BCE> |qual=<ALL/DATES/P999> |list=<ubl/hlist/prose> |linked=<yes/no> |<local parameter>}}</nowiki>
<nowiki>{{#invoke:WikidataIB |getCoords |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |<local parameter>}}</nowiki>
<nowiki>{{#invoke:WikidataIB |getQualifierValue |<PropertyID> |pval=<ID of target value for the property> |qual=<qualifier ID for that target value> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no>}}</nowiki>
<nowiki>{{#invoke:WikidataIB |getValueByQual |<PropertyID> |qualID=<qualifier property ID to match> |qvalue=<QID of target value for the qualifier property> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no>}}</nowiki>
<nowiki>{{#invoke:WikidataIB |getValueByLang |<PropertyID> |lang=<language code to match> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no>}}</nowiki>
== Function getValue ==
=== Parameters to getValue ===
{| class ="wikitable sortable"
|-
! scope="col" | Name
! scope="col" | Alias
! scope="col" | Function
! scope="col" | Default
|-
| (first unnamed)
| 1
| The property-ID whose values are returned. Required.
|
|-
|-
| (second unnamed)
| 2
| A locally supplied value that, if it is not empty, will be returned in preference to the value on Wikidata.
| empty
|-
| qid
|
| The Q-number (entity-ID) of the entity that the property belongs to. If not supplied or empty, defaults to the associated Wikidata entry of the current page – uses [[:mw:Extension:Wikibase Client/Lua #mw.wikibase.getEntityIdForCurrentPage|mw.wikibase.getEntityIdForCurrentPage()]].
| Item id for current page
|-
| eid
|
| An alternative to qid. Except for <code>eid</code>, all parameters to getValue treat nil and the empty string the same. So, setting {{para|x}} gives the same result as omitting the parameter. However, to provide some compatibility with other modules, using {{para|eid}} always returns an empty string, while omitting <code>eid</code> allows <code>qid</code> to work as normal.
| Item id for current page
|-
| rank
|
| [Case insensitive] When set to <code>best</code>, returns preferred values if present, otherwise returns normal values. When set to <code>preferred</code> returns preferred values. When set to <code>normal</code>, returns normal values. When set to <code>deprecated</code> returns deprecated values. Any parameter value beginning with "b" is "best"; beginning with "p" is "preferred"; beginning with "n" is "normal"; beginning with "d" is deprecated. Multiple values are allowed: "p n d" would return all ranks. "Best" overrides the other flags. Other values are ignored and if no ranks are requested, preferred and normal are returned.
| preferred and normal
|-
| qual
|
| A punctuation-separated list of property-IDs of qualifiers that are to be returned in parentheses after the property. Setting <code>qual=ALL</code> returns all qualifiers. Setting <code>qual=DATES</code> returns {{q|P580}} and {{q|P582}} with a date separator.
| none
|-
| qualsonly
| qo
| A boolean which enables the display of just the qualifier(s), without the property value or parentheses. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| fetchwikidata
| fwd
| List of fields to fetch values from. <code>ALL</code> fetches all fields. A value of <code>NONE</code> or blank or omitting the parameter fetches no fields.
| none
|-
| suppressfields
| spf
| List of fields which will never display. This will even force a local value in the field not to display.
| none
|-
| name
|
| Name of the field. When encoding an infobox, this is the name that fetchwikidata and suppressfields will recognise. Required if fetchwikidata or suppressfields is specified (except when <code>fetchwikidata=ALL</code>).
| nil
|-
| onlysourced
| osd
| A boolean which will filter out Wikidata values that are unsourced or only sourced to Wikipedia. [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion|This 2018 RFC]] requires that Wikidata values displayed in article infoboxes must be sourced. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| true
|-
| df
|
| Date format: may be <code>dmy</code> (day before month) or <code>mdy</code> (month before day) or <code>y</code> (year alone).
| dmy
|-
| qdf
|
| Date format of qualifiers. If omitted, defaults to parameter <code>df</code>, or "y" if <code>df</code> is also omitted.
| value of df or "y"
|-
| bc
|
| Format of the BC/BCE suffix for dates.
| BCE
|-
| plaindate
| pd
| String to modify formatting of dates. Setting "true"/"yes"/"1" disables adding "sourcing cirumstances" (P1480) and any links. Setting "adj" does the same but uses the adjectival form of the date.
| false
|-
| linked
|
| A boolean that enables the link to a local page via its sitelink on Wikidata. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| true
|-
| displaytext
| dt
| A string that overrides the displayed text of a linked item if it is non-empty.
| empty
|-
| shortname
| sn
| A boolean that enables the use of shortname (P1813) instead of label for a linked item. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| uselabel
| uselbl
| A boolean that forces the display of the label instead of the disambiguated sitelink for a linked item. Labels are much more prone to vandalism that sitelinks. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| wdlinks
| wdl
| A boolean that enables the display of links to Wikidata when no local article exists. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| unitabbr
| uabbr
| A boolean that enables unit abbreviations for common units. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| convert
| conv
| A boolean that enables passing of quantities to Template:Cvt. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| showunits
| su
| A boolean that enables showing units for quantities. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| true
|-
| scale
|
| A string that sets scaling for format of quantities. Values are: "a"=automatic; "0"=no scaling; "3"=thousand; "6"=million; "9"=billion; "12"=trillion.
| 0
|-
| maxvals
|
| Sets the maximum number of values to be returned when multiple values are available. Setting it to 1 is useful where the returned string is used within another call, e.g. image. Values <code>0</code> and empty return all values.
| 0 (all)
|-
| collapse
|
| Sets the maximum number of values to be returned before the content is auto-collapsed. Values <code>0</code> and empty allow all content to be displayed uncollapsed.
| 0 (all)
|-
| linkprefix
| lp
| A link prefix that is prepended to the linked value when linked. Applies only to items that have articles and to strings (e.g. url). It triggers linking of strings. Any double-quotes " are stripped out, so that spaces may be passed.
| empty
|-
| linkpostfix
|
| A link postfix that is appended to the linked value when linked. Applies only to items that have articles and to strings (e.g. url). It triggers linking of strings. Any double-quotes " are stripped out, so that spaces may be passed.
| empty
|-
| prefix
|
| A prefix that is prepended to the displayed value of strings (e.g. url). Any double-quotes " are stripped out, so that spaces may be passed.
| empty
|-
| postfix
|
| A postfix that is appended to the displayed value of strings (e.g. url). Any double-quotes " are stripped out, so that spaces may be passed.
| empty
|-
| qlinkprefix
| qlp
| Qualifier link prefix (see linkprefix).
| empty
|-
| qlinkpostfix
|
| Qualifier link postfix (see linkpostfix).
| empty
|-
| qprefix
|
| Qualifier prefix (see prefix).
| empty
|-
| qpostfix
|
| Qualifier postfix (see postfix).
| empty
|-
| sorted
|
| A boolean which enables sorting of the values returned. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| qsorted
|
| A boolean which enables sorting of the qualifier values within each item returned. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| noicon
|
| A boolean which will suppress the trailing "edit at Wikidata" pen-icon. Useful for when the returned value is to be further processed. Values <code>no</code>, <code>false</code> and <code>0</code> are all false (i.e. shows the icon); anything else is true (i.e. suppresses the icon).
| false
|-
| list
|
| The name of a template that the list of multiple values is then passed through. Examples include "cslist", "hlist", "ubl", "blist", "olist", "p-1". A special value, <code>prose</code>, produces "1, 2, 3 and 4".
| none
|-
| sep
|
| Customises the string that is used to separate multiple returned values. Any double-quotes " are stripped out, so that spaces may be passed. If nothing or an empty string is passed it is set to the default list separator (", " in English).
| ", "
|-
| qsep
|
| Customises the string that is used to separate multiple returned qualifier values. Any double-quotes " are stripped out, so that spaces may be passed. If nothing or an empty string is passed it is set to the default list separator (", " in English).
| ", "
|-
| format
|
| Determines whether global coordinates should be rendered as degree/minute/second or as decimal degrees. Any value beginning "dec" (case insensitive) will render as decimal. Anything else will render as DMS.
| dms
|-
| show
|
| Determines how global coordinates should be returned. The value "longlat" will return <code>longitude, latitude</code>. Any other value beginning "lon" (case insensitive) will return just longitude. Any value beginning "lat" (case insensitive) will return just latitude. When used with {{para|noicon|true}}, all of these will be pure numbers in decimal degrees (signed: N and E as positive), which are intended for use in mapping templates, etc. Anything other value (or nothing) will render the usual coordinate values as DMS or decimal with "NSEW" qualifiers, etc.
| empty
|-
| lang
|
| Allows an unlinked value to be returned in the chosen language. Takes a standard ISO language code recognised by MediaWiki. If not supplied or blank, the local language (or set language for multi-lingual wikis) is used as normal.
| local language
|-
| parameterset
| ps
| Convenience parameter to allow commonly used sets of parameters to be specified with a single parameter: ps=1 gets a simple linked value wherever possible; ps=2 represents a plain text value. See [[#Parameter sets|Parameter sets]].
|
|-
| linkredir
|
| Boolean to switch on or off the check for a redirect with the same name as the label when there is no sitelink on Wikidata for the value. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|}
=== Base parameters ===
* getValue can also take a named parameter {{para|qid}} which is the Wikidata ID for an article. This will not normally be used as omitting it defaults to the current article.
* The property whose value is to be returned is passed in the first unnamed property and is required.
* The second unnamed parameter, if supplied, will become the returned value and no call to Wikidata will be made.
=== Whitelist and blacklist ===
* The name of the field that this function is called from is passed in the named parameter {{para|name}}, which is first checked against a blacklist of fields that are never to be displayed, (i.e. the call must return nil in all circumstances). If the field is not on the blacklist, it is then checked against a whitelist. If the name of the field matches, the call will return any locally supplied value if it is supplied as the second unnamed parameter, or the Wikidata value otherwise.
* Specifying {{para|fetchwikidata|ALL}} is a shortcut to return all fields that are not blacklisted.
* The name is compulsory when the blacklist or whitelist is used, so the module returns nil if it is not supplied, other than when {{para|fetchwikidata|ALL}}.
* The blacklist is passed in the named parameter {{para|suppressfields}}
* The whitelist is passed in the named parameter {{para|fetchwikidata}}
=== Sourcing ===
The getValue function will accept a boolean parameter <code>onlysourced</code> which will suppress return of Wikidata values that are unsourced or only sourced to a Wikimedia project. The absence of the parameter, an empty parameter ({{para|onlysourced}}) and the empty string (<code>""</code>) all default to true (i.e. only referenced values are returned). The values <code>no</code>, <code>false</code> and <code>0</code> are treated as false (i.e. all values are returned); any other value is true (although {{para|onlysourced|yes/no}} is recommended for readability).
=== Link to Wikidata ===
The getValue function will accept a boolean parameter <code>noicon</code> which will suppress the trailing "edit at Wikidata" icon and link for cases when the returned value is to be further processed by the infobox (e.g. a url). The absence of the parameter or an empty parameter ({{para|noicon}}) default to false (i.e. the icon is added). The empty string (<code>""</code>) and the values <code>no</code>, <code>false</code> and <code>0</code> are treated as false; any other value is true (although {{para|noicon|true}} is recommended for readability).
Following a discussion at [[Module talk:WikidataIB #Visibility of pen icon]], the pen icon is hidden from users who are not autoconfirmed. This means that most readers don't see the pen icon, and represents a balance between aesthetics and vandalism at Wikidata on the one hand, and the desire to encourage editing Wikidata on the other.
=== Dates ===
In order to handle the requirement for dates in mdy, dmy or just year formats, getValue accepts a named parameter {{para|df}} that may take the values "dmy", "mdy", or "y" - default is "dmy".
As an article may require either of suffixes BC and BCE, getValue accepts a named parameter {{para|bc}} that may take the values "BC", or "BCE" - default is "BCE". Some test cases are shown at [[Module talk:WikidataIB/testing #Calls to getValue for dates]].
=== Ranks ===
The {{para|rank}} parameter, when set to preferred, returns only preferred values; when set to normal, returns only normal values; when set to deprecated, returns only deprecated values. If the parameter is set to best, it returns preferred values if present, otherwise normal values. Any parameter value beginning with "p" is "preferred"; any parameter value beginning with "n" is "normal"; any parameter value beginning with "d" is "deprecated"; any parameter value beginning with "b" is "best". Combinations of values are allowed, e.g. {{para|rank|p n}} returns all the preferred and normal values (which is the default), although "best" overrides any other parameters.
==== Specific value-type handlers ====
The module has specific handlers for the following data types:
# Items that correspond to an article in some Wikipedia, called "wikibase-items". These will be linked to the corresponding (and disambiguated) article on English Wikipedia where possible.
# Items that represent dates. These may be centuries, years, years and months, or years, months and days.
# Items that represent Commons media, urls, external ids, or other sorts of plain text.
# Items that represent quantities. All of these may have an associated unit, or be dimensionless, and may have a range.
# Items that represent global coordinates. These will be in degrees of latitude and longitude and will have an associated precision.
Items that represent other types of data are not handled at present.
The third class of data types may be used with the parameters:
* {{para|prefix}}, {{para|postfix}}, {{para|linkprefix}}, {{para|linkpostfix}}
If you don't supply at least one of {{para|linkprefix}} or {{para|linkpostfix}}, then just {{para|prefix}} and {{para|postfix}} are used. For example, when getting the {{Q|P717}} in {{Q|Q532127|}}:
* <code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix="before " |postfix=" after" |qid=Q532127}}</nowiki></code> → {{#invoke:WikidataIB/sandbox |getValue |P717 |fetchwikidata=ALL|onlysourced=no |prefix="before " |postfix=" after" |qid=Q532127}}
Use double-quotes to enclose the parameter value if it has leading or trailing spaces (otherwise they are stripped out). If you supply {{para|linkprefix}} or {{para|linkpostfix}}, then all four parameters are used and a link is made for each value like this:
* <code><nowiki>[[ linkprefix WikidataValue1 linkpostfix | prefix WikidataValue1 postfix]], [[ linkprefix WikidataValue2 linkpostfix | prefix WikidataValue2 postfix]], etc.</nowiki></code>
That allows multiple links to be made to different sections of a list article, such as [[List of observatory codes]]. For example, when getting the {{Q|P717}} in {{Q|Q532127|}} we can make the links:
*<code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix= |postfix= |linkprefix="List of observatory codes#" |linkpostfix= |qid=Q532127}}</nowiki></code> → {{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix= |postfix= |linkprefix="List of observatory codes#" |linkpostfix= |qid=Q532127}}
The parameters {{para|prefix}}, {{para|postfix}}, {{para|linkprefix}}, {{para|linkpostfix}} are also applied to wikibase-items if they are linked.
==== Formatting multiple returned values ====
* {{para|sorted|<yes{{!}}no>}} is a boolean passed to enable sorting of the values returned. No parameter, or an empty string, or "false", or "no", or "0" disables sorting. It's only a very dumb alphabetical sort and sorts linked values as "[[ ..."
* {{para|sep|<separator characters>}} allows the separator between multiple returned values to be defined. The default is <code>", "</code> (comma plus normal space). If the separator has leading or trailing spaces, enclose it in double quotes (e.g. {{para|sep|" - "}}). Any double quotes are stripped from the separator. The pipe character (<code>|</code>) must be escaped as <code><nowiki>{{!}}</nowiki></code>. For reasons of accessibility (see [[MOS:PLIST]]), do not use {{para|sep|<br>}} for vertical unbulleted lists; use {{para|list|ubl}} instead.
* {{para|list|<prose{{!}}cslist{{!}}hlist{{!}}ubl{{!}}blist{{!}}olist>}} allows multiple returned values to be displayed as a sentence with last two values separated by "and" ({{para|list|prose}}), a horizontal comma-separated list ({{para|list|cslist}}, not to be used in prose), a horizontal list ({{para|list|hlist}}), a vertical unbulleted list ({{para|list|ubl}}), a vertical bulleted list ({{para|list|blist}}), or a vertical ordered list ({{para|list|olist}}). These override the separator and do not display the 'pen icon' linked to "Edit at Wikidata".
* {{para|list|p-1}} displays the last value. Combine with {{para|maxvals|''n''}} to display the ''n''th value.
=== Limiting the returned values ===
Sometimes a property is expected to have a single value, such as {{q|P18}}, but may have multiple values on Wikidata. Setting {{para|maxvals|1}} will limit the number of values returned to 1, returning the first available value. Any other value is possible and functions as expected, but zero is treated as "no limit". See the section above for instructions on how to return the last available value.
=== Unlinking ===
A returned value that represents an article on the local wiki will be linked by default. This includes redirects, but not dab pages. Sometimes there is a need not to link that returned values and this may be accomplished by setting {{para|linked|no}}.
=== Unit abbreviations ===
When the returned value is a quantity, the name of the units in which it is expressed is appended. Infoboxes may wish to use abbreviations instead for common units. This can be done by setting {{para|unitabbr|true}}.
=== Qualifiers ===
A parameter {{para|qual}} may be supplied, which will return qualifiers of the required property, if they exist. If the value is set to a punctuation-separated list of property-IDs (e.g. P123, P456), then only the values of qualifiers with that property will be returned. If the value is set to {{para|qual|ALL}}, then all of the qualifier values are returned. If the value is set to {{para|qual|DATES}} then the {{q|P580}} and the {{q|P582}} of the property are returned with a date separator. In each case, any qualifier values returned follow the property value, and are enclosed in parentheses. If multiple qualifier values are returned, they will be separated by commas by default, although the separator can be changed by specifying {{para|qsep}} (which may be enclosed in double-quotes, which are stripped out, so that spaces can be included). Setting the parameter {{para|qsorted|yes}} will sort the returned qualifier values alphanumerically.
=== Short form of parameters ===
Some of the longer parameters may be abbreviated to make infobox designs more compact:
* <code>fwd → fetchwikidata</code>
* <code>osd → onlysourced</code>
* <code>spf → suppressfields</code>
* <code>wdl → wdlinks</code>
=== Parameter sets ===
Generally, <code>getValue</code> has a set of defaults for its parameters that represent consensus decisions by editors. For example, {{para|onlysourced}} defaults to <code>true</code> so only Wikidata values that are sourced to something better than "Wikipedia" will be returned, and {{para|fetchwikidata}} defaults to <code>none</code> so nothing is returned until it is enabled by setting some field names or "ALL". This represents the fail-safe condition and allows infoboxes to be made Wikidata-capable without changing any article until enabled ''for that article''.
To simplify the use of <code>getValue</code> in other circumstances, common combinations of parameters can be specified with {{para|parameterset}} or its alias {{para|ps}} for convenience. Two combinations are implemented at present and these are:
;ps=1 : a common set of overrides to get a simple value, linked where possible (this is not for use in infoboxes, per [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion |the 2018 RFC]], which requires sourced information):
<pre>
|rank ="best"
|fetchwikidata="ALL"
|onlysourced ="no"
|noicon ="true"
</pre>
;ps=2 : a sort of raw value in plain text (this is not for use in infoboxes, per [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion |the 2018 RFC]], which requires sourced information):
<pre>
|rank = "best"
|fetchwikidata = "ALL"
|onlysourced = "no"
|noicon = "true"
|linked = "no"
|plaindate = "true"
</pre>
;ps=3 : parameter set 1, but with {{para|onlysourced|yes}}, so usable in infoboxes:
<pre>
|rank = "best"
|fetchwikidata = "ALL"
|onlysourced = "yes"
|noicon = "true"
|linked = "no"
|plaindate = "true"
</pre>
Other sets could be created if there is a demand.
=== Wrapper template ===
The template {{tl|wdib}} can be used as a convenient wrapper for <code><nowiki>{{#invoke:WikidataIB |getValue}}</nowiki></code>.
== Other main functions ==
=== Function getPreferredValue ===
The getPreferredValue function works exactly like getValue, taking the same parameters, but if any values for a property have the preferred rank set, it will only return those values. This is now deprecated in favour of <code>getValue|rank=best</code>.
=== Function getCoords ===
* getCoords can also take a named parameter {{para|qid}} which is the Wikidata ID for an article. This will not normally be used as omitting it defaults to the current article.
* The first unnamed parameter, if supplied, will become the returned value and no call to Wikidata will be made.
* The coordinates from Wikidata are parsed and passed to [[Template:Coord]] which returns the display as if it were called manually.
* The blacklist of fields that are never to be displayed, and the whitelist are implemented in the same way as for getValue using {{para|suppressfields}} and {{para|fetchwikidata}}
* The <code>format</code> parameter sets the display format to decimal or dms. Any value beginning with "dec" sets decimal; anything else sets dms.
* The <code>display</code> parameter sets the display position to "inline", "title" or "inline, title". Default is nothing (so uses default for {{tl|Coord}}, currently "inline").
=== Function getQualifierValue ===
The getQualifierValue function is for use when we want to fetch the value of a qualifier. We need to know the property and the value of the property that the qualifier relates to. The parameters are:
* The property ID passed in the unnamed parameter (or {{para|1}})
* The target value for that property in {{para|pval}}
* The qualifier ID for that target value in {{para|qual}}
* The same parameters to implement whitelisting and blacklisting of the property as in getValue
* Optional boolean to specify whether only sourced values of the property are returned (defaults to "no") in {{para|onlysourced}}
* Optional item ID for arbitrary access in {{para|qid}}
* The same parameters to format output as in getValue
==== Example of getQualifierValue ====
In {{Q|Q1513315}} there is a property {{Q|P793}}, which has a value {{Q|Q385378}}. That has two qualifiers, {{Q|P580}} and {{Q|P582}}. To get the start date:
* <code><nowiki>{{#invoke:WikidataIB |getQualifierValue |qid=Q1513315 |P793 |pval=Q385378 |qual=P580 |name=xyz |fetchwikidata=ALL }}</nowiki></code>
In [[South Pole Telescope]] it returns:
* {{#invoke:WikidataIB |getQualifierValue |P793 |pval=Q385378 |qual=P580 |name=xyz |fetchwikidata=ALL |qid=Q1513315}}
=== Function getValueByQual ===
The getValueByQual function returns the value of a property which has a qualifier with a given entity value. The parameters are:
* The property ID passed in the unnamed parameter (or {{para|1}})
* The property ID for a qualifier (or "ALL" or "DATES") in {{para|qualID}}
* The Wikibase-entity ID of a value for that qualifier in {{para|qvalue}}
* The same parameters to implement whitelisting and blacklisting of the property as in getValue
* Optional boolean to specify whether only sourced values of the property are returned (defaults to "no") in {{para|onlysourced}}
* Optional item ID for arbitrary access in {{para|qid}}
* The same parameters to format output as in getValue
==== Example of getValueByQual ====
In {{Q|Q10990}} there is a property {{Q|P443}} that has multiple values, each of which has a qualifier {{Q|P407}}. We can return the property value whose qualifier has the value {{Q|13955}}
* <code><nowiki>{{#invoke:WikidataIB |getValueByQual |qid=Q10990 |P443 |qualID=P407 |qvalue=Q13955 |fwd=ALL |osd=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValueByQual |qid=Q10990 |P443 |qualID=P407 |qvalue=Q13955 |fwd=ALL |osd=no |noicon=true}}
=== Function getValueByLang ===
The getValueByLang function returns the value of a property which has a qualifier {{Q|P407}} whose value has the given language code. The parameters are:
* The property ID passed in the unnamed parameter (or {{para|1}})
* The {{Q|P424}} to match the language whose code is given by {{para|lang|xx[-yy]}}. If no code is supplied, it uses the default language.
* The same parameters to implement whitelisting and blacklisting of the property as in getValue
* Optional boolean to specify whether only sourced values of the property are returned (defaults to "no") in {{para|onlysourced}}
* Optional item ID for arbitrary access in {{para|qid}}
* The same parameters to format output as in getValue
==== Example of getValueByLang ====
In {{Q|Q7565108}} there is a property {{Q|P856}} that has multiple values, each of which has a qualifier {{Q|P407}}. We can return the property value whose {{Q|P407}} qualifier value (a WD item) itself has the {{Q|P424}} property that is "ja", i.e, {{Q|Q5287}}
* <code><nowiki>{{#invoke:WikidataIB |getValueByLang |qid=Q7565108 |P856 |lang=ja |fwd=ALL |osd=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValueByLang |qid=Q7565108 |P856 |lang=ja |fwd=ALL |osd=no |noicon=true}}
If {{para|lang}} is unspecified, we can obtain the same value with the default language (here that is the {{Q|Q1860}} and its {{Q|P424}} is "en")
* <code><nowiki>{{#invoke:WikidataIB |getValueByLang |qid=Q7565108 |P856 |fwd=ALL |osd=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValueByLang |qid=Q7565108 |P856 |fwd=ALL |osd=no |noicon=true}}
== Utility functions ==
=== Function getLink ===
getLink has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
If there is a sitelink to an article on the local Wiki, it returns a link to the article with the Wikidata label as the displayed text.
If there is no sitelink, it returns the label as plain text.
If there is no label in the local language, it displays the qid instead.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getLink |Q29016906}}</nowiki></code> → {{#invoke:WikidataIB |getLink |Q29016906}}
* <code><nowiki>{{#invoke:WikidataIB |getLink |Q3621491}}</nowiki></code> → {{#invoke:WikidataIB |getLink |Q3621491}}
=== Function getLabel ===
getLabel has the qid of a Wikidata entity passed as the first unnamed parameter or as {{para|qid}}
It returns the Wikidata label in the local language for an item by the given qid.
If there is no label in the local language, it returns the qid instead.
Note that this is the label given to the Wikidata entry in the same language as the current Wiki, if the label exists.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getLabel |Q29016906}}</nowiki></code> → {{#invoke:WikidataIB |getLabel |Q29016906}}
* <code><nowiki>{{#invoke:WikidataIB |getLabel |Q3621491}}</nowiki></code> → {{#invoke:WikidataIB |getLabel |Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getLabel |Q19805408}}</nowiki></code> → {{#invoke:WikidataIB |getLabel |Q19805408}}
=== Function label ===
label has the qid of a Wikidata entity passed as the first unnamed parameter or as {{para|qid}}
It returns the Wikidata label in the local language for an item by the given qid or linked to the current page.
If there is no label in the local language, it returns an empty string.
Note that this is the label given to the Wikidata entry in the same language as the current Wiki, if the label exists.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |label |Q29016906}}</nowiki></code> → {{#invoke:WikidataIB |label |Q29016906}}
* <code><nowiki>{{#invoke:WikidataIB |label |Q3621491}}</nowiki></code> → {{#invoke:WikidataIB |label |Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |label |Q19805408}}</nowiki></code> → {{#invoke:WikidataIB |label |Q19805408}}
=== Function getAT ===
getAT has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text, i.e. the article title.
If there is no sitelink, it returns nothing.
Note that this is the title of the article in the current Wikipedia, if the interlanguage link exists in the Wikidata entry.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getAT |Q29016906}}</nowiki></code> → {{#invoke:WikidataIB |getAT |Q29016906}}
* <code><nowiki>{{#invoke:WikidataIB |getAT |Q3621491}}</nowiki></code> → {{#invoke:WikidataIB |getAT |Q3621491}}
=== Function getDescription ===
getDescription has the qid of a Wikidata entity passed as |qid= (it defaults to the associated qid of the current article if omitted).
It has a local parameter passed as the first unnamed parameter.
Any local parameter passed (other than "Wikidata" or "none") becomes the return value.
It returns the article description for the Wikidata entity in plain text if the local parameter is "Wikidata".
Nothing is returned if the description doesn't exist or "none" is passed as the local parameter.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |wikidata}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q29016906 |wikidata}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |A painting}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q29016906 |A painting}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |none}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q29016906 |none}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |wikidata}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q3621491 |wikidata}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |A profession}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q3621491 |A profession}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |none}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q3621491 |none}}
=== Function formatDate ===
formatDate accepts a datetime of the usual format from mw.wikibase.entity:formatPropertyValues, like "1 August 30 BCE" as parameter 1 and formats it according to the df (date format) and bc parameters.
* <code><nowiki>{{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BCE |df=dmy}}</nowiki></code> → {{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BCE |df=dmy}}
* <code><nowiki>{{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BC |df=mdy}}</nowiki></code> → {{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BC |df=mdy}}
* df = "dmy" / "mdy" / "y" - default is "dmy"
* bc = "BC" / "BCE" - default is "BCE"
=== Function checkBlacklist ===
checkBlacklist allows a test to check whether a named field is allowed.
It returns true if the field is not blacklisted (i.e. allowed)
It returns false if the field is blacklisted (i.e. disallowed)
Example:
* <code><nowiki>{{#if:{{#invoke:WikidataIB |checkBlacklist |name=nationality |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}</nowiki></code> → {{#if:{{#invoke:WikidataIB |checkBlacklist |name=nationality |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}
* <code><nowiki>{{#if:{{#invoke:WikidataIB |checkBlacklist |name=birth_place |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}</nowiki></code> → {{#if:{{#invoke:WikidataIB |checkBlacklist |name=birth_place |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}
=== Function emptyor ===
emptyor returns nil if its first unnamed argument is just punctuation, whitespace or html tags otherwise it returns the argument unchanged (including leading/trailing space).
If the argument could contain "=", then it must be called explicitly:
* <code><nowiki>| 1 = whatever-the-argument-is</nowiki></code>
In that case, leading and trailing spaces are trimmed.
It finds use in infoboxes where it can replace tests like:
* <code><nowiki>{{#if: {{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}} | <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> | }}</nowiki></code>
with a form that uses just a single call to Wikidata:
* <code><nowiki>{{#invoke |WikidataIB |emptyor |1= <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> }}</nowiki></code>
=== Function labelorid ===
labelorid is a public function to expose the output of labelOrId().
The Q-number (entity ID) is passed as |qid= or as an unnamed parameter.
It returns the Wikidata label for that entity or the qid if no label exists.
=== Function getQid ===
* getQid works with the current page and its associated Wikidata entry.
* It returns qid, if supplied as the first unnamed parameter or as {{para|qid}};
* failing that, the Wikidata entity ID of the "category's main topic (P301)", if it exists;
* failing that, the Wikidata entity ID associated with the current page, if it exists;
* otherwise, nothing
=== Function examine ===
examine provides a dump of the entire property given in the first unnamed parameter (or in {{para|pid}} as a named alias) from the item given by the parameter 'qid', or from the item corresponding to the current page if qid is not supplied. Both parameters may be unnamed and given in any order.
It works in a similar manner to the [[Module:Wikidata|Dump]] function, but only loads a single claim, rather than the whole Wikidata entry.
* Example: <code><nowiki>{{#invoke:WikidataIB |examine |qid=Q1396889 |P50}}</nowiki></code>
There is a [[Template:Examine]] which acts as a wrapper for the call.
* Example: <code><nowiki>{{examine |Q4048254 |P31}}</nowiki></code> →
{{examine |Q4048254 |P31}}
=== Function url2 ===
url2 takes a parameter url= that is a proper url and formats it for use in an infobox.
Examples:
{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= http://www.example.com/ }}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= http://www.example.com/path/ }}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= {{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}} }}</nowiki>
}}{{nowiki template demo|prefix=#:|format=inline|output=nowiki+|code=<nowiki>{{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= {{url|http://www.example.com/}} }}</nowiki>
}}
Comparison with output of {{tl|URL}}:
{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | http://www.example.com/ }}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | http://www.example.com/path/ }}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | {{wikidata|property|Q23317|P856}} }}</nowiki>
}}{{nowiki template demo|prefix=#:|format=inline|output=nowiki+|code=<nowiki>{{wikidata|property|Q23317|P856}}</nowiki>}}
==== See also ====
* {{ml|URL|url}} & {{ml|URL|url2}}
== Coding into an infobox ==
Typically, the getValue call will be invoked in an infobox definition, using appropriate template parameters. One simple implementation is given as an example in [[:Template:Infobox book/Wikidata/Sandbox]]. As an illustration, the 'author' field in the infobox is coded like this:
<pre style="line-height:1.2em;">
| label2 = Author{{#if:{{{authors|}}}|s}}
| data2 = {{#invoke:WikidataIB |getValue |P50 |name=author |fetchwikidata={{{fetchwikidata|}}} |suppressfields={{{suppressfields|}}} |{{{authors|{{{author|}}}}}} }}
</pre>
The property to be fetched is the first unnamed parameter. In this case it is {{Q|P50}}.
The name of the field is passed in {{para|name}} and that name is checked against the blacklist and the whitelist. To always suppress the author field in a particular article, an editor will set {{para|suppressfields|author}} in the infobox. The author field will then never be displayed.
If the field is not blacklisted, then the infobox can be set to display a locally supplied value for author simply by setting {{para|author|[[George Orwell]]}}, for example, in the infobox. It also accepts {{para|authors}}. If the name of the field is on the whitelist, e.g. {{para|fetchwikidata|author; genre; pub_date; pages; dewey; congress}}, ''and'' the local value is not supplied, then the infobox will display the value retrieved from Wikidata. Any separators can be used, except | and {}.
As a shorthand, {{para|fetchwikidata|ALL}} will fetch all of the fields that are not blacklisted, as long as no local value is already provided in the article for a given field.
Since Wikidata labels are normally lower case, the ucfirst function from [[Module:String2]] can be used to capitalise the first letter of the returned text, e.g.
* <code><nowiki>{{#invoke:String2 | ucfirst | {{#invoke:WikidataIB |getValue |P136 |name=genre |fetchwikidata=ALL |onlysourced=false}} }}</nowiki></code> in {{Q|Q1396889}} produces:
* {{#invoke:String2 | ucfirst | {{#invoke:WikidataIB |getValue |P136 |name=genre |fetchwikidata=ALL |onlysourced=false |qid=Q1396889}} }}
=== Example of calls in an infobox ===
Basic use of getValue:
*<code><nowiki>{{#invoke:WikidataIB |getValue |P000 |name=fieldname |qid={{{qid|}}} |fetchwikidata={{{fetchwikidata|}}} |onlysourced={{{onlysourced|}}} |{{{localparameter|}}} }}</nowiki></code>
Full collection of parameters:
*<code><nowiki>{{#invoke:WikidataIB |getValue |P000 |name=fieldname |qid={{{qid|}}} |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}} |onlysourced={{{onlysourced|}}} |noicon={{{noicon|}}} |wdl={{{wikidatalink|}}} |df={{dateformat|}} |bc={{{bc|}}} |prefix= |postfix= |linkprefix= |linkpostfix= |sorted={{{sorted|}}} |sep={{{separator|}}} |list={{listtype|}}} |{{{localparameter|}}} }}</nowiki></code>
Any of the parameters can, of course, be fixed for a given field in an infobox, rather than taking the parameter supplied to the infobox, which will affect all fields. For example, one field may set {{para|list|hlist}} where a series of short words is expected; whereas another field could use {{para|list|ubl}} where an unbulleted vertical list of several words on each line is required.
=== Coordinates ===
The getCoords call will display the output of [[Template:Coord]] when supplied with the coordinates returned from Wikidata. It can be coded like this:
<pre style="line-height:1.2em;">
|label20 = Coordinates
| data20 = {{#invoke:WikidataIB |getCoords |name=coordinates |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}} |{{{coordinates|}}} }}
</pre>
An example is [[Template:Infobox biosphere reserve]]
<pre style="line-height:1.2em;">
{{Infobox biosphere reserve
| fetchwikidata = ALL
}}
</pre>
Displays coordinates in the usual positions when used in an article where Wikidata has coordinates.
=== Upgrading existing infoboxes ===
Since the parameter {{para|fetchwikidata}} is needed for any Wikidata functionality, an existing infobox may be replaced by an infobox incorporating these calls without any change whatsoever to any article. Each article using the new infobox can later be enabled by supplying {{para|fetchwikidata|ALL}}, or a list of required fields for that article. At that point, the onus is on the editor enabling the functionality to check that no unwanted fields are now being displayed. If so, they can be added to a blacklist for the article by setting {{para|suppressfields}} to the list of unwanted fields.
=== Verifiability ===
Where it will always be essential for a particular field to only contain values that are referenced, use <code>getValue</code>, making sure that {{para|onlysourced}} is ''not'' set to 'false', '0' or 'no'. By default it will exclude values that are unsourced or only sourced to a Wikipedia, thus making the job of checking easier at the article level. If unsourced data is acceptable (!), set {{para|onlysourced|no}}. As it is beyond my wit to produce an automated mechanism that knows whether an existing source is reliable or not in a given context, that job must still be performed at the article level by an editor familiar with the subject. It should always be done when first enabling Wikidata for that article.
=== Helper templates ===
; [[Template:If then show]] : tests whether the first unnamed parameter is not an empty string and returns it if it isn't. Otherwise it returns the second unnamed parameter. Optional third and fourth unnamed parameters provide a prefix and a suffix for the first parameter when returned. Useful when the first parameter is a call to Wikidata.
; [[Template:Ifnoteq then show]] : tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter. This is useful when the first parameter is a <code><nowiki>{{#invoke:</nowiki></code> of a Lua module that returns a value for which a specific exception is required.
; [[Template:If then wikilink]] : tests whether the first unnamed parameter is not an empty string and if it isn't, it returns the parameter formatted as piped wiki-link using an optional namespace prefix.
; [[Template:Formatter link]] : takes an external identifier code as {{para|code}} and uses a formatter url as {{para|url}} to construct a link to the external resource, which uses the code as display.
; [[Template:Emptyor]] : tests a piece of text to ascertain whether it's effectively empty or contains some text. If the unnamed parameter consists only of html tags, punctuation (e.g. wiki markup) and whitespace, then Emptyor returns nothing; otherwise it returns the parameter unchanged. Wrapper for p.emptyor function.
== Example of use: Infobox book ==
This section is taken from [[Template:Infobox book/Wikidata/Sandbox/doc]].
=== No Wikidata ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| suppressfields =
| fetchwikidata =
| name = Animal Farm
| title_orig = Animal Farm: A Fairy Story
| image = Animal Farm - 1st edition.jpg
| image_size = 200px
| caption = First edition cover
| author = [[George Orwell]]
| country = United Kingdom
| language = English
| genre = Political satire
}}
</pre>
Works as a non-aware infobox: only locally supplied parameters are displayed.
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| name = Animal Farm
| title_orig = Animal Farm: A Fairy Story
| image = Animal Farm - 1st edition.jpg
| image_size = 200px
| caption = First edition cover
| author = [[George Orwell]]
| country = United Kingdom
| language = English
| genre = Political satire
}}
</pre>
The blacklist and whitelist can be omitted if unused
=== All Wikidata ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
}}
</pre>
Fetches the author, publication date, number of pages, Dewey index, and Library of Congress catalogue number values from Wikidata.
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| fetchwikidata = ALL
}}
</pre>
As shorthand, the {{para|fetchwikidata}} parameter can be set to ALL to fetch all available fields.
Any field can be suppressed by naming it in {{para|suppressfields}}, or overridden by supplying a local value.
=== Never display genre ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| suppressfields = genre
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
}}
</pre>
The genre field will always be suppressed, even if a local value is supplied.
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| suppressfields = genre
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
| genre = Political satire
}}
</pre>
=== Local override ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
| genre = Political satire
}}
</pre>
The genre field is set to display "Political satire", no matter what is stored in Wikidata.
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| fetchwikidata = ALL
| genre = Novel
}}
</pre>
The genre field is set to display "Novel", no matter what is stored in Wikidata.
=== Don't fetch genre ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| suppressfields =
| fetchwikidata = author; pub_date; pages; dewey; congress
}}
</pre>
The genre field will not be fetched from Wikidata. Only the author, publication date, number of pages, Dewey index, and Library of Congress catalogue number are imported. A local value for genre will display.
== Exporting the module ==
WikidataIB has been developed to run on any language wiki (or Wikimedia project) with a minimum of modification. An optional sub-module [[Module:WikidataIB/i18n]] may be created to replace the values for error messages, ordinal suffixes etc. as shown in the local i18n definitions in the module. Although the same result can be arrived at by directly editing those values in WikidataIB, using the sub-module will allow an updated version of WikidataIB to directly replace the older module without having to re-edit the i18n definitions.
=== Linked items ===
If the target Wiki has a convention that certain items are not normally linked (see [[:en:Wikipedia:Manual of Style/Linking #What generally should not be linked]] for an example), then a sub-module [[Module:WikidataIB/nolinks]] can be created to list items that should not be linked, using the English Wikipedia sub-module as an exemplar.
=== Italic titles ===
If the target Wiki has a convention that certain works should be italicised or quoted (see [[:en:Wikipedia:Manual of Style/Text formatting #Names and titles]] for an example), then a sub-module [[Module:WikidataIB/titleformats]] can be created to list items that should be italicised or quoted, using the English Wikipedia sub-module as an exemplar.
=== Complex date ===
Most of the output from the module will use the local language (or any user-specified one on multi-lingual wikis) where the sitelink or label exists on Wikidata. However, dates are more complicated and not handled perfectly in all languages. To solve this, WikidataIB uses [[Module:Complex date]] – developed on Commons by {{u|Jarekt}} – which allows expansion to support a wider variety of languages. As a result, it is necessary to install Complex date and its dependencies alongside WikidataIB when installing on another Wikimedia project.
==== Complex date dependencies ====
[[Module:Complex_date]] relies on the following modules:
* [[Module:ISOdate]]
** [[Module:DateI18n]] (no dependencies)
* [[Module:i18n/complex date]]
** [[Module:Ordinal]] (lazy loading)
*** [[Module:I18n/ordinal]] (no dependencies)
*** [[Module:Yesno]] (from en.wikipedia) (no dependencies)
*** [[Module:Formatnum]] (no dependencies)
** [[Module:Roman]] (lazy loading with no dependencies)
Unless otherwise noted, the authoritative version of each module can be found on [https://commons.wikimedia.org/ Commons] although the versions on English Wikipedia are usually kept in sync.
==See also==
* [[Module:Wikidata]], handling Wikidata more basically
* [[Template:WikidataOI]], a template that uses [[Module:Wd]] but also has and "opt-in" options {{para|fetch}} and {{para|ifeq}} similar to this module's {{para|fetchwikidata}} or {{para|fwd}}
==Tracking categories==
* {{clc|Articles with missing Wikidata information}}
{{Wikidata infoboxes}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wikidata modules]]
}}</includeonly>
j0ghyj05t0e1apshapdm1w6vzona9za
74881
74880
2026-08-24T00:42:40Z
Robertsky
10424
1 versaun husi [[:en:Module:WikidataIB/doc]]
74880
wikitext
text/x-wiki
{{Module rating |protected}}
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
{{ombox|text=For a more user-friendly wrapper of this module see {{t|wdib}}.}}
This module is intended to be used inside {{t|infobox}} (letters Wikidata'''IB''' stand for ''Info Box'', hence the name) or other templates and designed specifically to allow editors of an article (as opposed to editors of the infobox the article uses) to control whether Wikidata values are displayed.
One of the two sandboxes should be used for testing anything other than trivial amendments.
Test examples for the main module and the two sandboxes are available.
{| class="wikitable plainrowheaders
|+ Modules and test cases
|-
!
! scope="col" | Module
! scope="col" | Test cases
|-
! scope="row" | Main
| [[Module:WikidataIB]]
| [[Module talk:WikidataIB/testing]]
|-
! scope="row" | sandbox
| [[Module:WikidataIB/sandbox]] ({{Compare pages|Module:WikidataIB|Module:WikidataIB/sandbox|diff}})
| [[Module talk:WikidataIB/sandbox/testing]] ({{Compare pages|Module talk:WikidataIB/testing|Module talk:WikidataIB/sandbox/testing|diff}})
|-
! scope="row" | sandbox1
| [[Module:WikidataIB/sandbox1]] ({{Compare pages|Module:WikidataIB|Module:WikidataIB/sandbox1|diff}})
| [[Module talk:WikidataIB/sandbox1/testing]] ({{Compare pages|Module talk:WikidataIB/testing|Module talk:WikidataIB/sandbox1/testing|diff}})
|}
== Overview ==
The module provides these calls specifically for use in infoboxes at present:
# <code>getValue</code> - main call, used to get the value(s) of a given property
# <code>getQualifierValue</code> - given: (1) a property; (2) its value; (3) a qualifier's propertyID, returns values which match
# <code>getValueByQual</code> gets the value of a property which has a qualifier with a given entity value
# <code>getValueByLang</code> gets the value of a property which has a qualifier P407("language of work or name") whose value has the given language code
# <code>getValueByRefSource</code> gets the value of a property which has a reference "stated in" (P248) whose value has the given entity-ID
# <code>getPropOfProp</code> if the value(s) of prop1 are of type "wikibase-item" then it returns the value(s) of prop2 of each of those wikibase-items
# <code>getAwardCat</code> if the item has values of P166 (award received), then it examines each of those awards for P2517 (category for recipients of this award) and it returns the corresponding category, with the item's P734 (family name) as sort key, or no sort key if there is no family name
# <code>getIntersectCat</code> for each value of the prop1 it fetches the value's main category and then each value of prop2, then it returns all of the categories representing the intersection of those properties
# <code>getSumOfParts</code> scans the property 'has part' (P527) for values matching a list. If the matched values have a qualifier 'quantity' (P1114), those quantities are summed and returned (but zero returns nil)
# <code>getCoords</code> gets coordinates and passes them through {{t|Coord}}
# <code>getPreferredValue</code> - {{color|red|'''Deprecated'''}} but retained for backward compatibility. Use the <code>|getValue|rank=best</code> parameters instead
The obsolete call getSourcedValue has now been removed as it is redundant to getValue which can do the same job using the {{para|onlysourced|true}} parameter (which is set by default).
===Utilities functions===
# <code>getLink</code> if there is a sitelink to an article on the local Wiki, it returns a link to the article with the Wikidata label as the displayed text. If there is no sitelink, it returns the label as plain text. If there is no label in the local language, it returns the entity-ID
# <code>getAT</code> (Article Title) If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text, otherwise nothing
# <code>getSiteLink</code> gets the plain text link to an article on a given wiki
# <code>getLabel</code> returns the Wikidata label for the local language as plain text. If there is no label in the local language, it returns the entity-ID
# <code>getAllLabels</code> fetches the set of labels and formats it for display as wikitext
# <code>labelorid</code> returns the label with all wikitext removed, or the entity-ID if no label
# <code>getDescription</code> returns the article description for the Wikidata entity if the local parameter is "Wikidata"
# <code>getAllDescriptions</code> fetches the set of descriptions and formats it for display as wikitext
# <code>getAliases</code> returns the aliases for the entity in the current or given language
# <code>getAllAliases</code> fetches the set of aliases and formats it for display as wikitext
# <code>pageId</code> returns the connected Wikidata page id (entity-ID, Q-number) of the current page
# <code>formatDate</code> takes a datetime of the usual format from mw.wikibase.entity:formatPropertyValues and formats it according to the df (date format) and bc parameters
# <code>formatNumber</code> formats a number according to the supplied language code
# <code>checkBlacklist</code> returns true if the field is ''not'' blacklisted (i.e. allowed)
# <code>emptyor</code> returns nil if the parameter is just punctuation, whitespace or html tags, otherwise returns the argument unchanged
# <code>getLang</code> returns the MediaWiki language code or the full language name of the current content
# <code>getItemLangCode</code> looks for country (P17), then for that country's official language (P37), and returns its language code (P424)
# <code>findLanguage</code> returns (1) supplied language if valid; or (2) the user's set language; or (3) the language of the current wiki
# <code>getQid</code> returns (1) the entity-ID, if supplied; or (2) the entity ID of the "category's main topic (P301)"; or (3) the entity ID associated with the current page; or (4) nothing
# <code>followQid</code> given a list of properties, looks for each property in turn and returns the entity-ID of the first value that matches (optionally, returns all entity-IDs that match)
# <code>getGlobe</code> returns the entity-ID of the globe used in P625 (coordinate location), or nil if there isn't one
# <code>getCommonsLink</code> returns one of the following in order of preference: the Commons sitelink of the linked Wikidata item; the Commons sitelink of the topic's main category of the linked Wikidata item
# <code>siteID</code> returns the root of the globalSiteID, e.g. "en" for "enwiki", "enwikisource", "en-gb", etc.
# <code>projID</code> same as siteID
# <code>location</code> scans from the current location upwards along the chain of higher-level locations, returning each one until it reaches a country
# <code>examine</code> returns a formatted dump of the given property
# <code>url2</code> takes a parameter that is a proper url and formats it for use in an infobox; it accepts its own output as input
# <code>getWebsite</code> fetches the Official website (P856) and formats it for use in an infobox
# <code>checkvalue</code> looks through a property for a given entity-ID as its value and returns that entity-ID if found; otherwise nil
# <code>checkValidity</code> returns whether the first unnamed parameter represents a valid entity-id
# <code>showNoLinks</code> displays the article titles that should not be linked
===Examples of calls===
<nowiki>{{#invoke:WikidataIB |getValue |<PropertyID> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no> |noicon=<yes/no> |df=<dmy/mdy/y> |bc=<BC/BCE> |qual=<ALL/DATES/P999> |list=<ubl/hlist/prose> |linked=<yes/no> |<local parameter>}}</nowiki>
<nowiki>{{#invoke:WikidataIB |getCoords |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |<local parameter>}}</nowiki>
<nowiki>{{#invoke:WikidataIB |getQualifierValue |<PropertyID> |pval=<ID of target value for the property> |qual=<qualifier ID for that target value> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no>}}</nowiki>
<nowiki>{{#invoke:WikidataIB |getValueByQual |<PropertyID> |qualID=<qualifier property ID to match> |qvalue=<QID of target value for the qualifier property> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no>}}</nowiki>
<nowiki>{{#invoke:WikidataIB |getValueByLang |<PropertyID> |lang=<language code to match> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no>}}</nowiki>
== Function getValue ==
=== Parameters to getValue ===
{| class ="wikitable sortable"
|-
! scope="col" | Name
! scope="col" | Alias
! scope="col" | Function
! scope="col" | Default
|-
| (first unnamed)
| 1
| The property-ID whose values are returned. Required.
|
|-
|-
| (second unnamed)
| 2
| A locally supplied value that, if it is not empty, will be returned in preference to the value on Wikidata.
| empty
|-
| qid
|
| The Q-number (entity-ID) of the entity that the property belongs to. If not supplied or empty, defaults to the associated Wikidata entry of the current page – uses [[:mw:Extension:Wikibase Client/Lua #mw.wikibase.getEntityIdForCurrentPage|mw.wikibase.getEntityIdForCurrentPage()]].
| Item id for current page
|-
| eid
|
| An alternative to qid. Except for <code>eid</code>, all parameters to getValue treat nil and the empty string the same. So, setting {{para|x}} gives the same result as omitting the parameter. However, to provide some compatibility with other modules, using {{para|eid}} always returns an empty string, while omitting <code>eid</code> allows <code>qid</code> to work as normal.
| Item id for current page
|-
| rank
|
| [Case insensitive] When set to <code>best</code>, returns preferred values if present, otherwise returns normal values. When set to <code>preferred</code> returns preferred values. When set to <code>normal</code>, returns normal values. When set to <code>deprecated</code> returns deprecated values. Any parameter value beginning with "b" is "best"; beginning with "p" is "preferred"; beginning with "n" is "normal"; beginning with "d" is deprecated. Multiple values are allowed: "p n d" would return all ranks. "Best" overrides the other flags. Other values are ignored and if no ranks are requested, preferred and normal are returned.
| preferred and normal
|-
| qual
|
| A punctuation-separated list of property-IDs of qualifiers that are to be returned in parentheses after the property. Setting <code>qual=ALL</code> returns all qualifiers. Setting <code>qual=DATES</code> returns {{q|P580}} and {{q|P582}} with a date separator.
| none
|-
| qualsonly
| qo
| A boolean which enables the display of just the qualifier(s), without the property value or parentheses. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| fetchwikidata
| fwd
| List of fields to fetch values from. <code>ALL</code> fetches all fields. A value of <code>NONE</code> or blank or omitting the parameter fetches no fields.
| none
|-
| suppressfields
| spf
| List of fields which will never display. This will even force a local value in the field not to display.
| none
|-
| name
|
| Name of the field. When encoding an infobox, this is the name that fetchwikidata and suppressfields will recognise. Required if fetchwikidata or suppressfields is specified (except when <code>fetchwikidata=ALL</code>).
| nil
|-
| onlysourced
| osd
| A boolean which will filter out Wikidata values that are unsourced or only sourced to Wikipedia. [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion|This 2018 RFC]] requires that Wikidata values displayed in article infoboxes must be sourced. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| true
|-
| df
|
| Date format: may be <code>dmy</code> (day before month) or <code>mdy</code> (month before day) or <code>y</code> (year alone).
| dmy
|-
| qdf
|
| Date format of qualifiers. If omitted, defaults to parameter <code>df</code>, or "y" if <code>df</code> is also omitted.
| value of df or "y"
|-
| bc
|
| Format of the BC/BCE suffix for dates.
| BCE
|-
| plaindate
| pd
| String to modify formatting of dates. Setting "true"/"yes"/"1" disables adding "sourcing cirumstances" (P1480) and any links. Setting "adj" does the same but uses the adjectival form of the date.
| false
|-
| linked
|
| A boolean that enables the link to a local page via its sitelink on Wikidata. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| true
|-
| displaytext
| dt
| A string that overrides the displayed text of a linked item if it is non-empty.
| empty
|-
| shortname
| sn
| A boolean that enables the use of shortname (P1813) instead of label for a linked item. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| uselabel
| uselbl
| A boolean that forces the display of the label instead of the disambiguated sitelink for a linked item. Labels are much more prone to vandalism that sitelinks. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| wdlinks
| wdl
| A boolean that enables the display of links to Wikidata when no local article exists. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| unitabbr
| uabbr
| A boolean that enables unit abbreviations for common units. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| convert
| conv
| A boolean that enables passing of quantities to Template:Cvt. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| showunits
| su
| A boolean that enables showing units for quantities. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| true
|-
| scale
|
| A string that sets scaling for format of quantities. Values are: "a"=automatic; "0"=no scaling; "3"=thousand; "6"=million; "9"=billion; "12"=trillion.
| 0
|-
| maxvals
|
| Sets the maximum number of values to be returned when multiple values are available. Setting it to 1 is useful where the returned string is used within another call, e.g. image. Values <code>0</code> and empty return all values.
| 0 (all)
|-
| collapse
|
| Sets the maximum number of values to be returned before the content is auto-collapsed. Values <code>0</code> and empty allow all content to be displayed uncollapsed.
| 0 (all)
|-
| linkprefix
| lp
| A link prefix that is prepended to the linked value when linked. Applies only to items that have articles and to strings (e.g. url). It triggers linking of strings. Any double-quotes " are stripped out, so that spaces may be passed.
| empty
|-
| linkpostfix
|
| A link postfix that is appended to the linked value when linked. Applies only to items that have articles and to strings (e.g. url). It triggers linking of strings. Any double-quotes " are stripped out, so that spaces may be passed.
| empty
|-
| prefix
|
| A prefix that is prepended to the displayed value of strings (e.g. url). Any double-quotes " are stripped out, so that spaces may be passed.
| empty
|-
| postfix
|
| A postfix that is appended to the displayed value of strings (e.g. url). Any double-quotes " are stripped out, so that spaces may be passed.
| empty
|-
| qlinkprefix
| qlp
| Qualifier link prefix (see linkprefix).
| empty
|-
| qlinkpostfix
|
| Qualifier link postfix (see linkpostfix).
| empty
|-
| qprefix
|
| Qualifier prefix (see prefix).
| empty
|-
| qpostfix
|
| Qualifier postfix (see postfix).
| empty
|-
| sorted
|
| A boolean which enables sorting of the values returned. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| qsorted
|
| A boolean which enables sorting of the qualifier values within each item returned. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|-
| noicon
|
| A boolean which will suppress the trailing "edit at Wikidata" pen-icon. Useful for when the returned value is to be further processed. Values <code>no</code>, <code>false</code> and <code>0</code> are all false (i.e. shows the icon); anything else is true (i.e. suppresses the icon).
| false
|-
| list
|
| The name of a template that the list of multiple values is then passed through. Examples include "cslist", "hlist", "ubl", "blist", "olist", "p-1". A special value, <code>prose</code>, produces "1, 2, 3 and 4".
| none
|-
| sep
|
| Customises the string that is used to separate multiple returned values. Any double-quotes " are stripped out, so that spaces may be passed. If nothing or an empty string is passed it is set to the default list separator (", " in English).
| ", "
|-
| qsep
|
| Customises the string that is used to separate multiple returned qualifier values. Any double-quotes " are stripped out, so that spaces may be passed. If nothing or an empty string is passed it is set to the default list separator (", " in English).
| ", "
|-
| format
|
| Determines whether global coordinates should be rendered as degree/minute/second or as decimal degrees. Any value beginning "dec" (case insensitive) will render as decimal. Anything else will render as DMS.
| dms
|-
| show
|
| Determines how global coordinates should be returned. The value "longlat" will return <code>longitude, latitude</code>. Any other value beginning "lon" (case insensitive) will return just longitude. Any value beginning "lat" (case insensitive) will return just latitude. When used with {{para|noicon|true}}, all of these will be pure numbers in decimal degrees (signed: N and E as positive), which are intended for use in mapping templates, etc. Anything other value (or nothing) will render the usual coordinate values as DMS or decimal with "NSEW" qualifiers, etc.
| empty
|-
| lang
|
| Allows an unlinked value to be returned in the chosen language. Takes a standard ISO language code recognised by MediaWiki. If not supplied or blank, the local language (or set language for multi-lingual wikis) is used as normal.
| local language
|-
| parameterset
| ps
| Convenience parameter to allow commonly used sets of parameters to be specified with a single parameter: ps=1 gets a simple linked value wherever possible; ps=2 represents a plain text value. See [[#Parameter sets|Parameter sets]].
|
|-
| linkredir
|
| Boolean to switch on or off the check for a redirect with the same name as the label when there is no sitelink on Wikidata for the value. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| false
|}
=== Base parameters ===
* getValue can also take a named parameter {{para|qid}} which is the Wikidata ID for an article. This will not normally be used as omitting it defaults to the current article.
* The property whose value is to be returned is passed in the first unnamed property and is required.
* The second unnamed parameter, if supplied, will become the returned value and no call to Wikidata will be made.
=== Whitelist and blacklist ===
* The name of the field that this function is called from is passed in the named parameter {{para|name}}, which is first checked against a blacklist of fields that are never to be displayed, (i.e. the call must return nil in all circumstances). If the field is not on the blacklist, it is then checked against a whitelist. If the name of the field matches, the call will return any locally supplied value if it is supplied as the second unnamed parameter, or the Wikidata value otherwise.
* Specifying {{para|fetchwikidata|ALL}} is a shortcut to return all fields that are not blacklisted.
* The name is compulsory when the blacklist or whitelist is used, so the module returns nil if it is not supplied, other than when {{para|fetchwikidata|ALL}}.
* The blacklist is passed in the named parameter {{para|suppressfields}}
* The whitelist is passed in the named parameter {{para|fetchwikidata}}
=== Sourcing ===
The getValue function will accept a boolean parameter <code>onlysourced</code> which will suppress return of Wikidata values that are unsourced or only sourced to a Wikimedia project. The absence of the parameter, an empty parameter ({{para|onlysourced}}) and the empty string (<code>""</code>) all default to true (i.e. only referenced values are returned). The values <code>no</code>, <code>false</code> and <code>0</code> are treated as false (i.e. all values are returned); any other value is true (although {{para|onlysourced|yes/no}} is recommended for readability).
=== Link to Wikidata ===
The getValue function will accept a boolean parameter <code>noicon</code> which will suppress the trailing "edit at Wikidata" icon and link for cases when the returned value is to be further processed by the infobox (e.g. a url). The absence of the parameter or an empty parameter ({{para|noicon}}) default to false (i.e. the icon is added). The empty string (<code>""</code>) and the values <code>no</code>, <code>false</code> and <code>0</code> are treated as false; any other value is true (although {{para|noicon|true}} is recommended for readability).
Following a discussion at [[Module talk:WikidataIB #Visibility of pen icon]], the pen icon is hidden from users who are not autoconfirmed. This means that most readers don't see the pen icon, and represents a balance between aesthetics and vandalism at Wikidata on the one hand, and the desire to encourage editing Wikidata on the other.
=== Dates ===
In order to handle the requirement for dates in mdy, dmy or just year formats, getValue accepts a named parameter {{para|df}} that may take the values "dmy", "mdy", or "y" - default is "dmy".
As an article may require either of suffixes BC and BCE, getValue accepts a named parameter {{para|bc}} that may take the values "BC", or "BCE" - default is "BCE". Some test cases are shown at [[Module talk:WikidataIB/testing #Calls to getValue for dates]].
=== Ranks ===
The {{para|rank}} parameter, when set to preferred, returns only preferred values; when set to normal, returns only normal values; when set to deprecated, returns only deprecated values. If the parameter is set to best, it returns preferred values if present, otherwise normal values. Any parameter value beginning with "p" is "preferred"; any parameter value beginning with "n" is "normal"; any parameter value beginning with "d" is "deprecated"; any parameter value beginning with "b" is "best". Combinations of values are allowed, e.g. {{para|rank|p n}} returns all the preferred and normal values (which is the default), although "best" overrides any other parameters.
==== Specific value-type handlers ====
The module has specific handlers for the following data types:
# Items that correspond to an article in some Wikipedia, called "wikibase-items". These will be linked to the corresponding (and disambiguated) article on English Wikipedia where possible.
# Items that represent dates. These may be centuries, years, years and months, or years, months and days.
# Items that represent Commons media, urls, external ids, or other sorts of plain text.
# Items that represent quantities. All of these may have an associated unit, or be dimensionless, and may have a range.
# Items that represent global coordinates. These will be in degrees of latitude and longitude and will have an associated precision.
Items that represent other types of data are not handled at present.
The third class of data types may be used with the parameters:
* {{para|prefix}}, {{para|postfix}}, {{para|linkprefix}}, {{para|linkpostfix}}
If you don't supply at least one of {{para|linkprefix}} or {{para|linkpostfix}}, then just {{para|prefix}} and {{para|postfix}} are used. For example, when getting the {{Q|P717}} in {{Q|Q532127|}}:
* <code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix="before " |postfix=" after" |qid=Q532127}}</nowiki></code> → {{#invoke:WikidataIB/sandbox |getValue |P717 |fetchwikidata=ALL|onlysourced=no |prefix="before " |postfix=" after" |qid=Q532127}}
Use double-quotes to enclose the parameter value if it has leading or trailing spaces (otherwise they are stripped out). If you supply {{para|linkprefix}} or {{para|linkpostfix}}, then all four parameters are used and a link is made for each value like this:
* <code><nowiki>[[ linkprefix WikidataValue1 linkpostfix | prefix WikidataValue1 postfix]], [[ linkprefix WikidataValue2 linkpostfix | prefix WikidataValue2 postfix]], etc.</nowiki></code>
That allows multiple links to be made to different sections of a list article, such as [[List of observatory codes]]. For example, when getting the {{Q|P717}} in {{Q|Q532127|}} we can make the links:
*<code><nowiki>{{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix= |postfix= |linkprefix="List of observatory codes#" |linkpostfix= |qid=Q532127}}</nowiki></code> → {{#invoke:WikidataIB/sandbox|getValue|P717|fetchwikidata=ALL|onlysourced=no |prefix= |postfix= |linkprefix="List of observatory codes#" |linkpostfix= |qid=Q532127}}
The parameters {{para|prefix}}, {{para|postfix}}, {{para|linkprefix}}, {{para|linkpostfix}} are also applied to wikibase-items if they are linked.
==== Formatting multiple returned values ====
* {{para|sorted|<yes{{!}}no>}} is a boolean passed to enable sorting of the values returned. No parameter, or an empty string, or "false", or "no", or "0" disables sorting. It's only a very dumb alphabetical sort and sorts linked values as "[[ ..."
* {{para|sep|<separator characters>}} allows the separator between multiple returned values to be defined. The default is <code>", "</code> (comma plus normal space). If the separator has leading or trailing spaces, enclose it in double quotes (e.g. {{para|sep|" - "}}). Any double quotes are stripped from the separator. The pipe character (<code>|</code>) must be escaped as <code><nowiki>{{!}}</nowiki></code>. For reasons of accessibility (see [[MOS:PLIST]]), do not use {{para|sep|<br>}} for vertical unbulleted lists; use {{para|list|ubl}} instead.
* {{para|list|<prose{{!}}cslist{{!}}hlist{{!}}ubl{{!}}blist{{!}}olist>}} allows multiple returned values to be displayed as a sentence with last two values separated by "and" ({{para|list|prose}}), a horizontal comma-separated list ({{para|list|cslist}}, not to be used in prose), a horizontal list ({{para|list|hlist}}), a vertical unbulleted list ({{para|list|ubl}}), a vertical bulleted list ({{para|list|blist}}), or a vertical ordered list ({{para|list|olist}}). These override the separator and do not display the 'pen icon' linked to "Edit at Wikidata".
* {{para|list|p-1}} displays the last value. Combine with {{para|maxvals|''n''}} to display the ''n''th value.
=== Limiting the returned values ===
Sometimes a property is expected to have a single value, such as {{q|P18}}, but may have multiple values on Wikidata. Setting {{para|maxvals|1}} will limit the number of values returned to 1, returning the first available value. Any other value is possible and functions as expected, but zero is treated as "no limit". See the section above for instructions on how to return the last available value.
=== Unlinking ===
A returned value that represents an article on the local wiki will be linked by default. This includes redirects, but not dab pages. Sometimes there is a need not to link that returned values and this may be accomplished by setting {{para|linked|no}}.
=== Unit abbreviations ===
When the returned value is a quantity, the name of the units in which it is expressed is appended. Infoboxes may wish to use abbreviations instead for common units. This can be done by setting {{para|unitabbr|true}}.
=== Qualifiers ===
A parameter {{para|qual}} may be supplied, which will return qualifiers of the required property, if they exist. If the value is set to a punctuation-separated list of property-IDs (e.g. P123, P456), then only the values of qualifiers with that property will be returned. If the value is set to {{para|qual|ALL}}, then all of the qualifier values are returned. If the value is set to {{para|qual|DATES}} then the {{q|P580}} and the {{q|P582}} of the property are returned with a date separator. In each case, any qualifier values returned follow the property value, and are enclosed in parentheses. If multiple qualifier values are returned, they will be separated by commas by default, although the separator can be changed by specifying {{para|qsep}} (which may be enclosed in double-quotes, which are stripped out, so that spaces can be included). Setting the parameter {{para|qsorted|yes}} will sort the returned qualifier values alphanumerically.
=== Short form of parameters ===
Some of the longer parameters may be abbreviated to make infobox designs more compact:
* <code>fwd → fetchwikidata</code>
* <code>osd → onlysourced</code>
* <code>spf → suppressfields</code>
* <code>wdl → wdlinks</code>
=== Parameter sets ===
Generally, <code>getValue</code> has a set of defaults for its parameters that represent consensus decisions by editors. For example, {{para|onlysourced}} defaults to <code>true</code> so only Wikidata values that are sourced to something better than "Wikipedia" will be returned, and {{para|fetchwikidata}} defaults to <code>none</code> so nothing is returned until it is enabled by setting some field names or "ALL". This represents the fail-safe condition and allows infoboxes to be made Wikidata-capable without changing any article until enabled ''for that article''.
To simplify the use of <code>getValue</code> in other circumstances, common combinations of parameters can be specified with {{para|parameterset}} or its alias {{para|ps}} for convenience. Two combinations are implemented at present and these are:
;ps=1 : a common set of overrides to get a simple value, linked where possible (this is not for use in infoboxes, per [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion |the 2018 RFC]], which requires sourced information):
<pre>
|rank ="best"
|fetchwikidata="ALL"
|onlysourced ="no"
|noicon ="true"
</pre>
;ps=2 : a sort of raw value in plain text (this is not for use in infoboxes, per [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion |the 2018 RFC]], which requires sourced information):
<pre>
|rank = "best"
|fetchwikidata = "ALL"
|onlysourced = "no"
|noicon = "true"
|linked = "no"
|plaindate = "true"
</pre>
;ps=3 : parameter set 1, but with {{para|onlysourced|yes}}, so usable in infoboxes:
<pre>
|rank = "best"
|fetchwikidata = "ALL"
|onlysourced = "yes"
|noicon = "true"
|linked = "no"
|plaindate = "true"
</pre>
Other sets could be created if there is a demand.
=== Wrapper template ===
The template {{tl|wdib}} can be used as a convenient wrapper for <code><nowiki>{{#invoke:WikidataIB |getValue}}</nowiki></code>.
== Other main functions ==
=== Function getPreferredValue ===
The getPreferredValue function works exactly like getValue, taking the same parameters, but if any values for a property have the preferred rank set, it will only return those values. This is now deprecated in favour of <code>getValue|rank=best</code>.
=== Function getCoords ===
* getCoords can also take a named parameter {{para|qid}} which is the Wikidata ID for an article. This will not normally be used as omitting it defaults to the current article.
* The first unnamed parameter, if supplied, will become the returned value and no call to Wikidata will be made.
* The coordinates from Wikidata are parsed and passed to [[Template:Coord]] which returns the display as if it were called manually.
* The blacklist of fields that are never to be displayed, and the whitelist are implemented in the same way as for getValue using {{para|suppressfields}} and {{para|fetchwikidata}}
* The <code>format</code> parameter sets the display format to decimal or dms. Any value beginning with "dec" sets decimal; anything else sets dms.
* The <code>display</code> parameter sets the display position to "inline", "title" or "inline, title". Default is nothing (so uses default for {{tl|Coord}}, currently "inline").
=== Function getQualifierValue ===
The getQualifierValue function is for use when we want to fetch the value of a qualifier. We need to know the property and the value of the property that the qualifier relates to. The parameters are:
* The property ID passed in the unnamed parameter (or {{para|1}})
* The target value for that property in {{para|pval}}
* The qualifier ID for that target value in {{para|qual}}
* The same parameters to implement whitelisting and blacklisting of the property as in getValue
* Optional boolean to specify whether only sourced values of the property are returned (defaults to "no") in {{para|onlysourced}}
* Optional item ID for arbitrary access in {{para|qid}}
* The same parameters to format output as in getValue
==== Example of getQualifierValue ====
In {{Q|Q1513315}} there is a property {{Q|P793}}, which has a value {{Q|Q385378}}. That has two qualifiers, {{Q|P580}} and {{Q|P582}}. To get the start date:
* <code><nowiki>{{#invoke:WikidataIB |getQualifierValue |qid=Q1513315 |P793 |pval=Q385378 |qual=P580 |name=xyz |fetchwikidata=ALL }}</nowiki></code>
In [[South Pole Telescope]] it returns:
* {{#invoke:WikidataIB |getQualifierValue |P793 |pval=Q385378 |qual=P580 |name=xyz |fetchwikidata=ALL |qid=Q1513315}}
=== Function getValueByQual ===
The getValueByQual function returns the value of a property which has a qualifier with a given entity value. The parameters are:
* The property ID passed in the unnamed parameter (or {{para|1}})
* The property ID for a qualifier (or "ALL" or "DATES") in {{para|qualID}}
* The Wikibase-entity ID of a value for that qualifier in {{para|qvalue}}
* The same parameters to implement whitelisting and blacklisting of the property as in getValue
* Optional boolean to specify whether only sourced values of the property are returned (defaults to "no") in {{para|onlysourced}}
* Optional item ID for arbitrary access in {{para|qid}}
* The same parameters to format output as in getValue
==== Example of getValueByQual ====
In {{Q|Q10990}} there is a property {{Q|P443}} that has multiple values, each of which has a qualifier {{Q|P407}}. We can return the property value whose qualifier has the value {{Q|13955}}
* <code><nowiki>{{#invoke:WikidataIB |getValueByQual |qid=Q10990 |P443 |qualID=P407 |qvalue=Q13955 |fwd=ALL |osd=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValueByQual |qid=Q10990 |P443 |qualID=P407 |qvalue=Q13955 |fwd=ALL |osd=no |noicon=true}}
=== Function getValueByLang ===
The getValueByLang function returns the value of a property which has a qualifier {{Q|P407}} whose value has the given language code. The parameters are:
* The property ID passed in the unnamed parameter (or {{para|1}})
* The {{Q|P424}} to match the language whose code is given by {{para|lang|xx[-yy]}}. If no code is supplied, it uses the default language.
* The same parameters to implement whitelisting and blacklisting of the property as in getValue
* Optional boolean to specify whether only sourced values of the property are returned (defaults to "no") in {{para|onlysourced}}
* Optional item ID for arbitrary access in {{para|qid}}
* The same parameters to format output as in getValue
==== Example of getValueByLang ====
In {{Q|Q7565108}} there is a property {{Q|P856}} that has multiple values, each of which has a qualifier {{Q|P407}}. We can return the property value whose {{Q|P407}} qualifier value (a WD item) itself has the {{Q|P424}} property that is "ja", i.e, {{Q|Q5287}}
* <code><nowiki>{{#invoke:WikidataIB |getValueByLang |qid=Q7565108 |P856 |lang=ja |fwd=ALL |osd=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValueByLang |qid=Q7565108 |P856 |lang=ja |fwd=ALL |osd=no |noicon=true}}
If {{para|lang}} is unspecified, we can obtain the same value with the default language (here that is the {{Q|Q1860}} and its {{Q|P424}} is "en")
* <code><nowiki>{{#invoke:WikidataIB |getValueByLang |qid=Q7565108 |P856 |fwd=ALL |osd=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValueByLang |qid=Q7565108 |P856 |fwd=ALL |osd=no |noicon=true}}
== Utility functions ==
=== Function getLink ===
getLink has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
If there is a sitelink to an article on the local Wiki, it returns a link to the article with the Wikidata label as the displayed text.
If there is no sitelink, it returns the label as plain text.
If there is no label in the local language, it displays the qid instead.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getLink |Q29016906}}</nowiki></code> → {{#invoke:WikidataIB |getLink |Q29016906}}
* <code><nowiki>{{#invoke:WikidataIB |getLink |Q3621491}}</nowiki></code> → {{#invoke:WikidataIB |getLink |Q3621491}}
=== Function getLabel ===
getLabel has the qid of a Wikidata entity passed as the first unnamed parameter or as {{para|qid}}
It returns the Wikidata label in the local language for an item by the given qid.
If there is no label in the local language, it returns the qid instead.
Note that this is the label given to the Wikidata entry in the same language as the current Wiki, if the label exists.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getLabel |Q29016906}}</nowiki></code> → {{#invoke:WikidataIB |getLabel |Q29016906}}
* <code><nowiki>{{#invoke:WikidataIB |getLabel |Q3621491}}</nowiki></code> → {{#invoke:WikidataIB |getLabel |Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getLabel |Q19805408}}</nowiki></code> → {{#invoke:WikidataIB |getLabel |Q19805408}}
=== Function label ===
label has the qid of a Wikidata entity passed as the first unnamed parameter or as {{para|qid}}
It returns the Wikidata label in the local language for an item by the given qid or linked to the current page.
If there is no label in the local language, it returns an empty string.
Note that this is the label given to the Wikidata entry in the same language as the current Wiki, if the label exists.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |label |Q29016906}}</nowiki></code> → {{#invoke:WikidataIB |label |Q29016906}}
* <code><nowiki>{{#invoke:WikidataIB |label |Q3621491}}</nowiki></code> → {{#invoke:WikidataIB |label |Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |label |Q19805408}}</nowiki></code> → {{#invoke:WikidataIB |label |Q19805408}}
=== Function getAT ===
getAT has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text, i.e. the article title.
If there is no sitelink, it returns nothing.
Note that this is the title of the article in the current Wikipedia, if the interlanguage link exists in the Wikidata entry.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getAT |Q29016906}}</nowiki></code> → {{#invoke:WikidataIB |getAT |Q29016906}}
* <code><nowiki>{{#invoke:WikidataIB |getAT |Q3621491}}</nowiki></code> → {{#invoke:WikidataIB |getAT |Q3621491}}
=== Function getDescription ===
getDescription has the qid of a Wikidata entity passed as |qid= (it defaults to the associated qid of the current article if omitted).
It has a local parameter passed as the first unnamed parameter.
Any local parameter passed (other than "Wikidata" or "none") becomes the return value.
It returns the article description for the Wikidata entity in plain text if the local parameter is "Wikidata".
Nothing is returned if the description doesn't exist or "none" is passed as the local parameter.
: Wikidata: {{q|Q29016906}} and {{q|Q3621491}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |wikidata}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q29016906 |wikidata}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |A painting}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q29016906 |A painting}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q29016906 |none}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q29016906 |none}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |wikidata}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q3621491 |wikidata}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |A profession}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q3621491 |A profession}}
* <code><nowiki>{{#invoke:WikidataIB |getDescription |qid=Q3621491 |none}}</nowiki></code> → {{#invoke:WikidataIB |getDescription |qid=Q3621491 |none}}
=== Function formatDate ===
formatDate accepts a datetime of the usual format from mw.wikibase.entity:formatPropertyValues, like "1 August 30 BCE" as parameter 1 and formats it according to the df (date format) and bc parameters.
* <code><nowiki>{{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BCE |df=dmy}}</nowiki></code> → {{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BCE |df=dmy}}
* <code><nowiki>{{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BC |df=mdy}}</nowiki></code> → {{#invoke:WikidataIB |formatDate | 1 August 30 BCE |bc=BC |df=mdy}}
* df = "dmy" / "mdy" / "y" - default is "dmy"
* bc = "BC" / "BCE" - default is "BCE"
=== Function checkBlacklist ===
checkBlacklist allows a test to check whether a named field is allowed.
It returns true if the field is not blacklisted (i.e. allowed)
It returns false if the field is blacklisted (i.e. disallowed)
Example:
* <code><nowiki>{{#if:{{#invoke:WikidataIB |checkBlacklist |name=nationality |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}</nowiki></code> → {{#if:{{#invoke:WikidataIB |checkBlacklist |name=nationality |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}
* <code><nowiki>{{#if:{{#invoke:WikidataIB |checkBlacklist |name=birth_place |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}</nowiki></code> → {{#if:{{#invoke:WikidataIB |checkBlacklist |name=birth_place |suppressfields=residence; nationality; citizenship}} | not blacklisted | blacklisted}}
=== Function emptyor ===
emptyor returns nil if its first unnamed argument is just punctuation, whitespace or html tags otherwise it returns the argument unchanged (including leading/trailing space).
If the argument could contain "=", then it must be called explicitly:
* <code><nowiki>| 1 = whatever-the-argument-is</nowiki></code>
In that case, leading and trailing spaces are trimmed.
It finds use in infoboxes where it can replace tests like:
* <code><nowiki>{{#if: {{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}} | <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> | }}</nowiki></code>
with a form that uses just a single call to Wikidata:
* <code><nowiki>{{#invoke |WikidataIB |emptyor |1= <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> }}</nowiki></code>
=== Function labelorid ===
labelorid is a public function to expose the output of labelOrId().
The Q-number (entity ID) is passed as |qid= or as an unnamed parameter.
It returns the Wikidata label for that entity or the qid if no label exists.
=== Function getQid ===
* getQid works with the current page and its associated Wikidata entry.
* It returns qid, if supplied as the first unnamed parameter or as {{para|qid}};
* failing that, the Wikidata entity ID of the "category's main topic (P301)", if it exists;
* failing that, the Wikidata entity ID associated with the current page, if it exists;
* otherwise, nothing
=== Function examine ===
examine provides a dump of the entire property given in the first unnamed parameter (or in {{para|pid}} as a named alias) from the item given by the parameter 'qid', or from the item corresponding to the current page if qid is not supplied. Both parameters may be unnamed and given in any order.
It works in a similar manner to the [[Module:Wikidata|Dump]] function, but only loads a single claim, rather than the whole Wikidata entry.
* Example: <code><nowiki>{{#invoke:WikidataIB |examine |qid=Q1396889 |P50}}</nowiki></code>
There is a [[Template:Examine]] which acts as a wrapper for the call.
* Example: <code><nowiki>{{examine |Q4048254 |P31}}</nowiki></code> →
{{examine |Q4048254 |P31}}
=== Function url2 ===
url2 takes a parameter url= that is a proper url and formats it for use in an infobox.
Examples:
{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= http://www.example.com/ }}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= http://www.example.com/path/ }}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= {{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}} }}</nowiki>
}}{{nowiki template demo|prefix=#:|format=inline|output=nowiki+|code=<nowiki>{{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{#invoke:WikidataIB |url2 |url= {{url|http://www.example.com/}} }}</nowiki>
}}
Comparison with output of {{tl|URL}}:
{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | http://www.example.com/ }}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | http://www.example.com/path/ }}</nowiki>
}}{{nowiki template demo|prefix=#|format=inline|output=nowiki+|code=<nowiki>{{URL | {{wikidata|property|Q23317|P856}} }}</nowiki>
}}{{nowiki template demo|prefix=#:|format=inline|output=nowiki+|code=<nowiki>{{wikidata|property|Q23317|P856}}</nowiki>}}
==== See also ====
* {{ml|URL|url}} & {{ml|URL|url2}}
== Coding into an infobox ==
Typically, the getValue call will be invoked in an infobox definition, using appropriate template parameters. One simple implementation is given as an example in [[:Template:Infobox book/Wikidata/Sandbox]]. As an illustration, the 'author' field in the infobox is coded like this:
<pre style="line-height:1.2em;">
| label2 = Author{{#if:{{{authors|}}}|s}}
| data2 = {{#invoke:WikidataIB |getValue |P50 |name=author |fetchwikidata={{{fetchwikidata|}}} |suppressfields={{{suppressfields|}}} |{{{authors|{{{author|}}}}}} }}
</pre>
The property to be fetched is the first unnamed parameter. In this case it is {{Q|P50}}.
The name of the field is passed in {{para|name}} and that name is checked against the blacklist and the whitelist. To always suppress the author field in a particular article, an editor will set {{para|suppressfields|author}} in the infobox. The author field will then never be displayed.
If the field is not blacklisted, then the infobox can be set to display a locally supplied value for author simply by setting {{para|author|[[George Orwell]]}}, for example, in the infobox. It also accepts {{para|authors}}. If the name of the field is on the whitelist, e.g. {{para|fetchwikidata|author; genre; pub_date; pages; dewey; congress}}, ''and'' the local value is not supplied, then the infobox will display the value retrieved from Wikidata. Any separators can be used, except | and {}.
As a shorthand, {{para|fetchwikidata|ALL}} will fetch all of the fields that are not blacklisted, as long as no local value is already provided in the article for a given field.
Since Wikidata labels are normally lower case, the ucfirst function from [[Module:String2]] can be used to capitalise the first letter of the returned text, e.g.
* <code><nowiki>{{#invoke:String2 | ucfirst | {{#invoke:WikidataIB |getValue |P136 |name=genre |fetchwikidata=ALL |onlysourced=false}} }}</nowiki></code> in {{Q|Q1396889}} produces:
* {{#invoke:String2 | ucfirst | {{#invoke:WikidataIB |getValue |P136 |name=genre |fetchwikidata=ALL |onlysourced=false |qid=Q1396889}} }}
=== Example of calls in an infobox ===
Basic use of getValue:
*<code><nowiki>{{#invoke:WikidataIB |getValue |P000 |name=fieldname |qid={{{qid|}}} |fetchwikidata={{{fetchwikidata|}}} |onlysourced={{{onlysourced|}}} |{{{localparameter|}}} }}</nowiki></code>
Full collection of parameters:
*<code><nowiki>{{#invoke:WikidataIB |getValue |P000 |name=fieldname |qid={{{qid|}}} |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}} |onlysourced={{{onlysourced|}}} |noicon={{{noicon|}}} |wdl={{{wikidatalink|}}} |df={{dateformat|}} |bc={{{bc|}}} |prefix= |postfix= |linkprefix= |linkpostfix= |sorted={{{sorted|}}} |sep={{{separator|}}} |list={{listtype|}}} |{{{localparameter|}}} }}</nowiki></code>
Any of the parameters can, of course, be fixed for a given field in an infobox, rather than taking the parameter supplied to the infobox, which will affect all fields. For example, one field may set {{para|list|hlist}} where a series of short words is expected; whereas another field could use {{para|list|ubl}} where an unbulleted vertical list of several words on each line is required.
=== Coordinates ===
The getCoords call will display the output of [[Template:Coord]] when supplied with the coordinates returned from Wikidata. It can be coded like this:
<pre style="line-height:1.2em;">
|label20 = Coordinates
| data20 = {{#invoke:WikidataIB |getCoords |name=coordinates |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}} |{{{coordinates|}}} }}
</pre>
An example is [[Template:Infobox biosphere reserve]]
<pre style="line-height:1.2em;">
{{Infobox biosphere reserve
| fetchwikidata = ALL
}}
</pre>
Displays coordinates in the usual positions when used in an article where Wikidata has coordinates.
=== Upgrading existing infoboxes ===
Since the parameter {{para|fetchwikidata}} is needed for any Wikidata functionality, an existing infobox may be replaced by an infobox incorporating these calls without any change whatsoever to any article. Each article using the new infobox can later be enabled by supplying {{para|fetchwikidata|ALL}}, or a list of required fields for that article. At that point, the onus is on the editor enabling the functionality to check that no unwanted fields are now being displayed. If so, they can be added to a blacklist for the article by setting {{para|suppressfields}} to the list of unwanted fields.
=== Verifiability ===
Where it will always be essential for a particular field to only contain values that are referenced, use <code>getValue</code>, making sure that {{para|onlysourced}} is ''not'' set to 'false', '0' or 'no'. By default it will exclude values that are unsourced or only sourced to a Wikipedia, thus making the job of checking easier at the article level. If unsourced data is acceptable (!), set {{para|onlysourced|no}}. As it is beyond my wit to produce an automated mechanism that knows whether an existing source is reliable or not in a given context, that job must still be performed at the article level by an editor familiar with the subject. It should always be done when first enabling Wikidata for that article.
=== Helper templates ===
; [[Template:If then show]] : tests whether the first unnamed parameter is not an empty string and returns it if it isn't. Otherwise it returns the second unnamed parameter. Optional third and fourth unnamed parameters provide a prefix and a suffix for the first parameter when returned. Useful when the first parameter is a call to Wikidata.
; [[Template:Ifnoteq then show]] : tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter. This is useful when the first parameter is a <code><nowiki>{{#invoke:</nowiki></code> of a Lua module that returns a value for which a specific exception is required.
; [[Template:If then wikilink]] : tests whether the first unnamed parameter is not an empty string and if it isn't, it returns the parameter formatted as piped wiki-link using an optional namespace prefix.
; [[Template:Formatter link]] : takes an external identifier code as {{para|code}} and uses a formatter url as {{para|url}} to construct a link to the external resource, which uses the code as display.
; [[Template:Emptyor]] : tests a piece of text to ascertain whether it's effectively empty or contains some text. If the unnamed parameter consists only of html tags, punctuation (e.g. wiki markup) and whitespace, then Emptyor returns nothing; otherwise it returns the parameter unchanged. Wrapper for p.emptyor function.
== Example of use: Infobox book ==
This section is taken from [[Template:Infobox book/Wikidata/Sandbox/doc]].
=== No Wikidata ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| suppressfields =
| fetchwikidata =
| name = Animal Farm
| title_orig = Animal Farm: A Fairy Story
| image = Animal Farm - 1st edition.jpg
| image_size = 200px
| caption = First edition cover
| author = [[George Orwell]]
| country = United Kingdom
| language = English
| genre = Political satire
}}
</pre>
Works as a non-aware infobox: only locally supplied parameters are displayed.
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| name = Animal Farm
| title_orig = Animal Farm: A Fairy Story
| image = Animal Farm - 1st edition.jpg
| image_size = 200px
| caption = First edition cover
| author = [[George Orwell]]
| country = United Kingdom
| language = English
| genre = Political satire
}}
</pre>
The blacklist and whitelist can be omitted if unused
=== All Wikidata ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
}}
</pre>
Fetches the author, publication date, number of pages, Dewey index, and Library of Congress catalogue number values from Wikidata.
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| fetchwikidata = ALL
}}
</pre>
As shorthand, the {{para|fetchwikidata}} parameter can be set to ALL to fetch all available fields.
Any field can be suppressed by naming it in {{para|suppressfields}}, or overridden by supplying a local value.
=== Never display genre ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| suppressfields = genre
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
}}
</pre>
The genre field will always be suppressed, even if a local value is supplied.
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| suppressfields = genre
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
| genre = Political satire
}}
</pre>
=== Local override ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| fetchwikidata = author; genre; pub_date; pages; dewey; congress
| genre = Political satire
}}
</pre>
The genre field is set to display "Political satire", no matter what is stored in Wikidata.
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| fetchwikidata = ALL
| genre = Novel
}}
</pre>
The genre field is set to display "Novel", no matter what is stored in Wikidata.
=== Don't fetch genre ===
<pre style="line-height:1.2em;">
{{Infobox book/Wikidata/Sandbox
| suppressfields =
| fetchwikidata = author; pub_date; pages; dewey; congress
}}
</pre>
The genre field will not be fetched from Wikidata. Only the author, publication date, number of pages, Dewey index, and Library of Congress catalogue number are imported. A local value for genre will display.
== Exporting the module ==
WikidataIB has been developed to run on any language wiki (or Wikimedia project) with a minimum of modification. An optional sub-module [[Module:WikidataIB/i18n]] may be created to replace the values for error messages, ordinal suffixes etc. as shown in the local i18n definitions in the module. Although the same result can be arrived at by directly editing those values in WikidataIB, using the sub-module will allow an updated version of WikidataIB to directly replace the older module without having to re-edit the i18n definitions.
=== Linked items ===
If the target Wiki has a convention that certain items are not normally linked (see [[:en:Wikipedia:Manual of Style/Linking #What generally should not be linked]] for an example), then a sub-module [[Module:WikidataIB/nolinks]] can be created to list items that should not be linked, using the English Wikipedia sub-module as an exemplar.
=== Italic titles ===
If the target Wiki has a convention that certain works should be italicised or quoted (see [[:en:Wikipedia:Manual of Style/Text formatting #Names and titles]] for an example), then a sub-module [[Module:WikidataIB/titleformats]] can be created to list items that should be italicised or quoted, using the English Wikipedia sub-module as an exemplar.
=== Complex date ===
Most of the output from the module will use the local language (or any user-specified one on multi-lingual wikis) where the sitelink or label exists on Wikidata. However, dates are more complicated and not handled perfectly in all languages. To solve this, WikidataIB uses [[Module:Complex date]] – developed on Commons by {{u|Jarekt}} – which allows expansion to support a wider variety of languages. As a result, it is necessary to install Complex date and its dependencies alongside WikidataIB when installing on another Wikimedia project.
==== Complex date dependencies ====
[[Module:Complex_date]] relies on the following modules:
* [[Module:ISOdate]]
** [[Module:DateI18n]] (no dependencies)
* [[Module:i18n/complex date]]
** [[Module:Ordinal]] (lazy loading)
*** [[Module:I18n/ordinal]] (no dependencies)
*** [[Module:Yesno]] (from en.wikipedia) (no dependencies)
*** [[Module:Formatnum]] (no dependencies)
** [[Module:Roman]] (lazy loading with no dependencies)
Unless otherwise noted, the authoritative version of each module can be found on [https://commons.wikimedia.org/ Commons] although the versions on English Wikipedia are usually kept in sync.
==See also==
* [[Module:Wikidata]], handling Wikidata more basically
* [[Template:WikidataOI]], a template that uses [[Module:Wd]] but also has and "opt-in" options {{para|fetch}} and {{para|ifeq}} similar to this module's {{para|fetchwikidata}} or {{para|fwd}}
==Tracking categories==
* {{clc|Articles with missing Wikidata information}}
{{Wikidata infoboxes}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wikidata modules]]
}}</includeonly>
j0ghyj05t0e1apshapdm1w6vzona9za
Template:Wdib
10
8980
74884
2019-12-19T17:05:39Z
en>RexxS
0
Undid revision 931560015 by [[Special:Contributions/RexxS|RexxS]] ([[User talk:RexxS|talk]]) rv test
74884
wikitext
text/x-wiki
{{#invoke:WikidataIB|getValue}}<noinclude>
{{documentation}}
</noinclude>
t9d3ehgkq1uwxupd66kuww7i118e6vk
74885
74884
2026-08-24T00:42:42Z
Robertsky
10424
1 versaun husi [[:en:Template:Wdib]]
74884
wikitext
text/x-wiki
{{#invoke:WikidataIB|getValue}}<noinclude>
{{documentation}}
</noinclude>
t9d3ehgkq1uwxupd66kuww7i118e6vk
Template:Url
10
8981
74888
2026-02-06T17:52:27Z
en>Paine Ellsworth
0
per edit request on talk page - add [[WP:RCAT|rcat template]]s
74888
wikitext
text/x-wiki
#REDIRECT [[Template:URL]]
{{Rcat shell|
{{R from move}}
{{R from miscapitalization}}
{{R from template shortcut}}
}}
ab1ad4t51jahctsvs84z5poq7dlpw87
74889
74888
2026-08-24T00:42:43Z
Robertsky
10424
1 versaun husi [[:en:Template:Url]]
74888
wikitext
text/x-wiki
#REDIRECT [[Template:URL]]
{{Rcat shell|
{{R from move}}
{{R from miscapitalization}}
{{R from template shortcut}}
}}
ab1ad4t51jahctsvs84z5poq7dlpw87
Template:Compare pages
10
8982
74890
2022-04-03T00:31:35Z
en>NguoiDungKhongDinhDanh
0
Oops
74890
wikitext
text/x-wiki
<includeonly><!--
-->{{#switch:<!--
-->|{{{1|}}}|{{{2|}}} = {{Error|Two pages are needed to compare.}}<!--
-->|#default = <!--
-->{{Plain link<!--
-->|url = {{fullurl:Special:ComparePages|<!--
-->{{#iferror:{{#expr:{{{1|}}} + 1}}<!--
-->|page1={{urlencode:{{{1}}}}}<!--
-->|rev1={{{1}}}<!--
-->}}&<!--
-->{{#iferror:{{#expr:{{{2|}}} + 1}}<!--
-->|page2={{urlencode:{{{2}}}}}<!--
-->|rev2={{{2}}}<!--
-->}}}}<!--
-->|name = {{{label|{{{3|compare {{{label1|{{{1}}}}}} to {{{label2|{{{2}}}}}}}}}}}}<!--
-->}}<!--
-->}}</includeonly><noinclude>
{{documentation}}
</noinclude>
n64vutlx0vxrvgamv909809p4ni0nyv
74891
74890
2026-08-24T00:42:43Z
Robertsky
10424
1 versaun husi [[:en:Template:Compare_pages]]
74890
wikitext
text/x-wiki
<includeonly><!--
-->{{#switch:<!--
-->|{{{1|}}}|{{{2|}}} = {{Error|Two pages are needed to compare.}}<!--
-->|#default = <!--
-->{{Plain link<!--
-->|url = {{fullurl:Special:ComparePages|<!--
-->{{#iferror:{{#expr:{{{1|}}} + 1}}<!--
-->|page1={{urlencode:{{{1}}}}}<!--
-->|rev1={{{1}}}<!--
-->}}&<!--
-->{{#iferror:{{#expr:{{{2|}}} + 1}}<!--
-->|page2={{urlencode:{{{2}}}}}<!--
-->|rev2={{{2}}}<!--
-->}}}}<!--
-->|name = {{{label|{{{3|compare {{{label1|{{{1}}}}}} to {{{label2|{{{2}}}}}}}}}}}}<!--
-->}}<!--
-->}}</includeonly><noinclude>
{{documentation}}
</noinclude>
n64vutlx0vxrvgamv909809p4ni0nyv
Módulo:WikidataIB/sandbox
828
8983
74894
2025-12-21T23:49:07Z
en>The Equalizer
0
Restored revision 1326419389 by [[Special:Contributions/Lucas Werkmeister|Lucas Werkmeister]] ([[User talk:Lucas Werkmeister|talk]]): Restore
74894
Scribunto
text/plain
-- Version: 2023-07-10
-- Module to implement use of a blacklist and whitelist for infobox fields
-- Can take a named parameter |qid which is the Wikidata ID for the article
-- if not supplied, it will use the Wikidata ID associated with the current page.
-- Fields in blacklist are never to be displayed, i.e. module must return nil in all circumstances
-- Fields in whitelist return local value if it exists or the Wikidata value otherwise
-- The name of the field that this function is called from is passed in named parameter |name
-- The name is compulsory when blacklist or whitelist is used,
-- so the module returns nil if it is not supplied.
-- blacklist is passed in named parameter |suppressfields (or |spf)
-- whitelist is passed in named parameter |fetchwikidata (or |fwd)
require("strict")
local p = {}
local cdate -- initialise as nil and only load _complex_date function if needed
-- Module:Complex date is loaded lazily and has the following dependencies:
-- Module:Calendar
-- Module:ISOdate
-- Module:DateI18n
-- Module:I18n/complex date
-- Module:Ordinal
-- Module:I18n/ordinal
-- Module:Yesno
-- Module:Formatnum
-- Module:Linguistic
--
-- The following, taken from https://www.mediawiki.org/wiki/Wikibase/DataModel#Dates_and_times,
-- is needed to use Module:Complex date which seemingly requires date precision as a string.
-- It would work better if only the authors of the mediawiki page could spell 'millennium'.
local dp = {
[6] = "millennium",
[7] = "century",
[8] = "decade",
[9] = "year",
[10] = "month",
[11] = "day",
}
local i18n =
{
["errors"] =
{
["property-not-found"] = "Property not found.",
["No property supplied"] = "No property supplied",
["entity-not-found"] = "Wikidata entity not found.",
["unknown-claim-type"] = "Unknown claim type.",
["unknown-entity-type"] = "Unknown entity type.",
["qualifier-not-found"] = "Qualifier not found.",
["site-not-found"] = "Wikimedia project not found.",
["labels-not-found"] = "No labels found.",
["descriptions-not-found"] = "No descriptions found.",
["aliases-not-found"] = "No aliases found.",
["unknown-datetime-format"] = "Unknown datetime format.",
["local-article-not-found"] = "Article is available on Wikidata, but not on Wikipedia",
["dab-page"] = " (dab)",
},
["months"] =
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
},
["century"] = "century",
["BC"] = "BC",
["BCE"] = "BCE",
["ordinal"] =
{
[1] = "st",
[2] = "nd",
[3] = "rd",
["default"] = "th"
},
["filespace"] = "File",
["Unknown"] = "Unknown",
["NaN"] = "Not a number",
-- set the following to the name of a tracking category,
-- e.g. "[[Category:Articles with missing Wikidata information]]", or "" to disable:
["missinginfocat"] = "[[Category:Articles with missing Wikidata information]]",
["editonwikidata"] = "Edit this on Wikidata",
["latestdatequalifier"] = function (date) return "before " .. date end,
-- some languages, e.g. Bosnian use a period as a suffix after each number in a date
["datenumbersuffix"] = "",
["list separator"] = ", ",
["multipliers"] = {
[0] = "",
[3] = " thousand",
[6] = " million",
[9] = " billion",
[12] = " trillion",
}
}
-- This allows an internationisation module to override the above table
if 'en' ~= mw.getContentLanguage():getCode() then
require("Module:i18n").loadI18n("Module:WikidataIB/i18n", i18n)
end
-- This piece of html implements a collapsible container. Check the classes exist on your wiki.
local collapsediv = '<div class="mw-collapsible mw-collapsed" style="width:100%; overflow:auto;" data-expandtext="{{int:show}}" data-collapsetext="{{int:hide}}">'
-- Some items should not be linked.
-- Each wiki can create a list of those in Module:WikidataIB/nolinks
-- It should return a table called itemsindex, containing true for each item not to be linked
local donotlink = {}
local nolinks_exists, nolinks = pcall(mw.loadData, "Module:WikidataIB/nolinks")
if nolinks_exists then
donotlink = nolinks.itemsindex
end
-- To satisfy Wikipedia:Manual of Style/Titles, certain types of items are italicised, and others are quoted.
-- The submodule [[Module:WikidataIB/titleformats]] lists the entity-ids used in 'instance of' (P31),
-- which allows this module to identify the values that should be formatted.
-- WikidataIB/titleformats exports a table p.formats, which is indexed by entity-id, and contains the value " or ''
local formats = {}
local titleformats_exists, titleformats = pcall(mw.loadData, "Module:WikidataIB/titleformats")
if titleformats_exists then
formats = titleformats.formats
end
-------------------------------------------------------------------------------
-- Private functions
-------------------------------------------------------------------------------
--
-------------------------------------------------------------------------------
-- makeOrdinal needs to be internationalised along with the above:
-- takes cardinal number as a numeric and returns the ordinal as a string
-- we need three exceptions in English for 1st, 2nd, 3rd, 21st, .. 31st, etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local makeOrdinal = function(cardinal)
local ordsuffix = i18n.ordinal.default
if cardinal % 10 == 1 then
ordsuffix = i18n.ordinal[1]
elseif cardinal % 10 == 2 then
ordsuffix = i18n.ordinal[2]
elseif cardinal % 10 == 3 then
ordsuffix = i18n.ordinal[3]
end
-- In English, 1, 21, 31, etc. use 'st', but 11, 111, etc. use 'th'
-- similarly for 12 and 13, etc.
if (cardinal % 100 == 11) or (cardinal % 100 == 12) or (cardinal % 100 == 13) then
ordsuffix = i18n.ordinal.default
end
return tostring(cardinal) .. ordsuffix
end
-------------------------------------------------------------------------------
-- findLang takes a "langcode" parameter if supplied and valid
-- otherwise it tries to create it from the user's set language ({{int:lang}})
-- failing that it uses the wiki's content language.
-- It returns a language object
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local findLang = function(langcode)
local langobj
langcode = mw.text.trim(langcode or "")
if mw.language.isKnownLanguageTag(langcode) then
langobj = mw.language.new( langcode )
else
langcode = mw.getCurrentFrame():callParserFunction('int', {'lang'})
if mw.language.isKnownLanguageTag(langcode) then
langobj = mw.language.new( langcode )
else
langobj = mw.language.getContentLanguage()
end
end
return langobj
end
-------------------------------------------------------------------------------
-- _getItemLangCode takes a qid parameter (using the current page's qid if blank)
-- If the item for that qid has property country (P17) it looks at the first preferred value
-- If the country has an official language (P37), it looks at the first preferred value
-- If that official language has a language code (P424), it returns the first preferred value
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local _getItemLangCode = function(qid)
qid = mw.text.trim(qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return end
local prop17 = mw.wikibase.getBestStatements(qid, "P17")[1]
if not prop17 or prop17.mainsnak.snaktype ~= "value" then return end
local qid17 = prop17.mainsnak.datavalue.value.id
local prop37 = mw.wikibase.getBestStatements(qid17, "P37")[1]
if not prop37 or prop37.mainsnak.snaktype ~= "value" then return end
local qid37 = prop37.mainsnak.datavalue.value.id
local prop424 = mw.wikibase.getBestStatements(qid37, "P424")[1]
if not prop424 or prop424.mainsnak.snaktype ~= "value" then return end
return prop424.mainsnak.datavalue.value
end
-------------------------------------------------------------------------------
-- roundto takes a number (x)
-- and returns it rounded to (sf) significant figures
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local roundto = function(x, sf)
if x == 0 then return 0 end
local s = 1
if x < 0 then
x = -x
s = -1
end
if sf < 1 then sf = 1 end
local p = 10 ^ (math.floor(math.log10(x)) - sf + 1)
x = math.floor(x / p + 0.5) * p * s
-- if it's integral, cast to an integer:
if x == math.floor(x) then x = math.floor(x) end
return x
end
-------------------------------------------------------------------------------
-- decimalToDMS takes a decimal degrees (x) with precision (p)
-- and returns degrees/minutes/seconds according to the precision
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local decimalToDMS = function(x, p)
-- if p is not supplied, use a precision around 0.1 seconds
if not tonumber(p) then p = 1e-4 end
local d = math.floor(x)
local ms = (x - d) * 60
if p > 0.5 then -- precision is > 1/2 a degree
if ms > 30 then d = d + 1 end
ms = 0
end
local m = math.floor(ms)
local s = (ms - m) * 60
if p > 0.008 then -- precision is > 1/2 a minute
if s > 30 then m = m +1 end
s = 0
elseif p > 0.00014 then -- precision is > 1/2 a second
s = math.floor(s + 0.5)
elseif p > 0.000014 then -- precision is > 1/20 second
s = math.floor(10 * s + 0.5) / 10
elseif p > 0.0000014 then -- precision is > 1/200 second
s = math.floor(100 * s + 0.5) / 100
else -- cap it at 3 dec places for now
s = math.floor(1000 * s + 0.5) / 1000
end
return d, m, s
end
-------------------------------------------------------------------------------
-- decimalPrecision takes a decimal (x) with precision (p)
-- and returns x rounded approximately to the given precision
-- precision should be between 1 and 1e-6, preferably a power of 10.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local decimalPrecision = function(x, p)
local s = 1
if x < 0 then
x = -x
s = -1
end
-- if p is not supplied, pick an arbitrary precision
if not tonumber(p) then p = 1e-4
elseif p > 1 then p = 1
elseif p < 1e-6 then p = 1e-6
else p = 10 ^ math.floor(math.log10(p))
end
x = math.floor(x / p + 0.5) * p * s
-- if it's integral, cast to an integer:
if x == math.floor(x) then x = math.floor(x) end
-- if it's less than 1e-4, it will be in exponent form, so return a string with 6dp
-- 9e-5 becomes 0.000090
if math.abs(x) < 1e-4 then x = string.format("%f", x) end
return x
end
-------------------------------------------------------------------------------
-- formatDate takes a datetime of the usual format from mw.wikibase.entity:formatPropertyValues
-- like "1 August 30 BCE" as parameter 1
-- and formats it according to the df (date format) and bc parameters
-- df = ["dmy" / "mdy" / "y"] default will be "dmy"
-- bc = ["BC" / "BCE"] default will be "BCE"
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local format_Date = function(datetime, dateformat, bc)
local datetime = datetime or "1 August 30 BCE" -- in case of nil value
-- chop off multiple vales and/or any hours, mins, etc.
-- keep anything before punctuation - we just want a single date:
local dateval = string.match( datetime, "[%w ]+")
local dateformat = string.lower(dateformat or "dmy") -- default to dmy
local bc = string.upper(bc or "") -- can't use nil for bc
-- we only want to accept two possibilities: BC or default to BCE
if bc == "BC" then
bc = " " .. i18n["BC"] -- prepend a non-breaking space.
else
bc = " " .. i18n["BCE"]
end
local postchrist = true -- start by assuming no BCE
local dateparts = {}
for word in string.gmatch(dateval, "%w+") do
if word == "BCE" or word == "BC" then -- *** internationalise later ***
postchrist = false
else
-- we'll keep the parts that are not 'BCE' in a table
dateparts[#dateparts + 1] = word
end
end
if postchrist then bc = "" end -- set AD dates to no suffix *** internationalise later ***
local sep = " " -- separator is nbsp
local fdate = table.concat(dateparts, sep) -- set formatted date to same order as input
-- if we have day month year, check dateformat
if #dateparts == 3 then
if dateformat == "y" then
fdate = dateparts[3]
elseif dateformat == "mdy" then
fdate = dateparts[2] .. sep .. dateparts[1] .. "," .. sep .. dateparts[3]
end
elseif #dateparts == 2 and dateformat == "y" then
fdate = dateparts[2]
end
return fdate .. bc
end
-------------------------------------------------------------------------------
-- dateFormat is the handler for properties that are of type "time"
-- It takes timestamp, precision (6 to 11 per mediawiki), dateformat (y/dmy/mdy), BC format (BC/BCE),
-- a plaindate switch (yes/no/adj) to en/disable "sourcing circumstances"/use adjectival form,
-- any qualifiers for the property, the language, and any adjective to use like 'before'.
-- It passes the date through the "complex date" function
-- and returns a string with the internatonalised date formatted according to preferences.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); cdate(); dp[]
-------------------------------------------------------------------------------
local dateFormat = function(timestamp, dprec, df, bcf, pd, qualifiers, lang, adj, model)
-- output formatting according to preferences (y/dmy/mdy/ymd)
df = (df or ""):lower()
-- if ymd is required, return the part of the timestamp in YYYY-MM-DD form
-- but apply Year zero#Astronomers fix: 1 BC = 0000; 2 BC = -0001; etc.
if df == "ymd" then
if timestamp:sub(1,1) == "+" then
return timestamp:sub(2,11)
else
local yr = tonumber(timestamp:sub(2,5)) - 1
yr = ("000" .. yr):sub(-4)
if yr ~= "0000" then yr = "-" .. yr end
return yr .. timestamp:sub(6,11)
end
end
-- A year can be stored like this: "+1872-00-00T00:00:00Z",
-- which is processed here as if it were the day before "+1872-01-01T00:00:00Z",
-- and that's the last day of 1871, so the year is wrong.
-- So fix the month 0, day 0 timestamp to become 1 January instead:
timestamp = timestamp:gsub("%-00%-00T", "-01-01T")
-- just in case date precision is missing
dprec = dprec or 11
-- override more precise dates if required dateformat is year alone:
if df == "y" and dprec > 9 then dprec = 9 end
-- complex date only deals with precisions from 6 to 11, so clip range
dprec = dprec>11 and 11 or dprec
dprec = dprec<6 and 6 or dprec
-- BC format is "BC" or "BCE"
bcf = (bcf or ""):upper()
-- plaindate only needs the first letter (y/n/a)
pd = (pd or ""):sub(1,1):lower()
if pd == "" or pd == "n" or pd == "f" or pd == "0" then pd = false end
-- in case language isn't passed
lang = lang or findLang().code
-- set adj as empty if nil
adj = adj or ""
-- extract the day, month, year from the timestamp
local bc = timestamp:sub(1, 1)=="-" and "BC" or ""
local year, month, day = timestamp:match("[+-](%d*)-(%d*)-(%d*)T")
local iso = tonumber(year) -- if year is missing, let it throw an error
-- this will adjust the date format to be compatible with cdate
-- possible formats are Y, YY, YYY0, YYYY, YYYY-MM, YYYY-MM-DD
if dprec == 6 then iso = math.floor( (iso - 1) / 1000 ) + 1 end
if dprec == 7 then iso = math.floor( (iso - 1) / 100 ) + 1 end
if dprec == 8 then iso = math.floor( iso / 10 ) .. "0" end
if dprec == 10 then iso = year .. "-" .. month end
if dprec == 11 then iso = year .. "-" .. month .. "-" .. day end
-- add "circa" (Q5727902) from "sourcing circumstances" (P1480)
local sc = not pd and qualifiers and qualifiers.P1480
if sc then
for k1, v1 in pairs(sc) do
if v1.datavalue and v1.datavalue.value.id == "Q5727902" then
adj = "circa"
break
end
end
end
-- deal with Julian dates:
-- no point in saying that dates before 1582 are Julian - they are by default
-- doesn't make sense for dates less precise than year
-- we can suppress it by setting |plaindate, e.g. for use in constructing categories.
local calendarmodel = ""
if tonumber(year) > 1582
and dprec > 8
and not pd
and model == "http://www.wikidata.org/entity/Q1985786" then
calendarmodel = "julian"
end
if not cdate then
cdate = require("Module:Complex date")._complex_date
end
local fdate = cdate(calendarmodel, adj, tostring(iso), dp[dprec], bc, "", "", "", "", lang, 1)
-- this may have QuickStatements info appended to it in a div, so remove that
fdate = fdate:gsub(' <div style="display: none;">[^<]*</div>', '')
-- it may also be returned wrapped in a microformat, so remove that
fdate = fdate:gsub("<[^>]*>", "")
-- there may be leading zeros that we should remove
fdate = fdate:gsub("^0*", "")
-- if a plain date is required, then remove any links (like BC linked)
if pd then
fdate = fdate:gsub("%[%[.*|", ""):gsub("]]", "")
end
-- if 'circa', use the abbreviated form *** internationalise later ***
fdate = fdate:gsub('circa ', '<abbr title="circa">c.</abbr> ')
-- deal with BC/BCE
if bcf == "BCE" then
fdate = fdate:gsub('BC', 'BCE')
end
-- deal with mdy format
if df == "mdy" then
fdate = fdate:gsub("(%d+) (%w+) (%d+)", "%2 %1, %3")
end
-- deal with adjectival form *** internationalise later ***
if pd == "a" then
fdate = fdate:gsub(' century', '-century')
end
return fdate
end
-------------------------------------------------------------------------------
-- parseParam takes a (string) parameter, e.g. from the list of frame arguments,
-- and makes "false", "no", and "0" into the (boolean) false
-- it makes the empty string and nil into the (boolean) value passed as default
-- allowing the parameter to be true or false by default.
-- It returns a boolean.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local parseParam = function(param, default)
if type(param) == "boolean" then param = tostring(param) end
if param and param ~= "" then
param = param:lower()
if (param == "false") or (param:sub(1,1) == "n") or (param == "0") then
return false
else
return true
end
else
return default
end
end
-------------------------------------------------------------------------------
-- _getSitelink takes the qid of a Wikidata entity passed as |qid=
-- It takes an optional parameter |wiki= to determine which wiki is to be checked for a sitelink
-- If the parameter is blank, then it uses the local wiki.
-- If there is a sitelink to an article available, it returns the plain text link to the article
-- If there is no sitelink, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local _getSitelink = function(qid, wiki)
qid = (qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
wiki = wiki or ""
local sitelink
if wiki == "" then
sitelink = mw.wikibase.getSitelink(qid)
else
sitelink = mw.wikibase.getSitelink(qid, wiki)
end
return sitelink
end
-------------------------------------------------------------------------------
-- _getCommonslink takes an optional qid of a Wikidata entity passed as |qid=
-- It returns one of the following in order of preference:
-- the Commons sitelink of the Wikidata entity - but not if onlycat=true and it's not a category;
-- the Commons sitelink of the topic's main category of the Wikidata entity;
-- the Commons category of the Wikidata entity - unless fallback=false.
-------------------------------------------------------------------------------
-- Dependencies: _getSitelink(); parseParam()
-------------------------------------------------------------------------------
local _getCommonslink = function(qid, onlycat, fallback)
qid = (qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
onlycat = parseParam(onlycat, false)
if fallback == "" then fallback = nil end
local sitelink = _getSitelink(qid, "commonswiki")
if onlycat and sitelink and sitelink:sub(1,9) ~= "Category:" then sitelink = nil end
if not sitelink then
-- check for topic's main category
local prop910 = mw.wikibase.getBestStatements(qid, "P910")[1]
if prop910 then
local tmcid = prop910.mainsnak.datavalue and prop910.mainsnak.datavalue.value.id
sitelink = _getSitelink(tmcid, "commonswiki")
end
if not sitelink then
-- check for list's main category
local prop1754 = mw.wikibase.getBestStatements(qid, "P1754")[1]
if prop1754 then
local tmcid = prop1754.mainsnak.datavalue and prop1754.mainsnak.datavalue.value.id
sitelink = _getSitelink(tmcid, "commonswiki")
end
end
end
if not sitelink and fallback then
-- check for Commons category (string value)
local prop373 = mw.wikibase.getBestStatements(qid, "P373")[1]
if prop373 then
sitelink = prop373.mainsnak.datavalue and prop373.mainsnak.datavalue.value
if sitelink then sitelink = "Category:" .. sitelink end
end
end
return sitelink
end
-------------------------------------------------------------------------------
-- The label in a Wikidata item is subject to vulnerabilities
-- that an attacker might try to exploit.
-- It needs to be 'sanitised' by removing any wikitext before use.
-- If it doesn't exist, return the id for the item
-- a second (boolean) value is also returned, value is true when the label exists
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local labelOrId = function(id, lang)
if lang == "default" then lang = findLang().code end
local label
if lang then
label = mw.wikibase.getLabelByLang(id, lang)
else
label = mw.wikibase.getLabel(id)
end
if label then
return mw.text.nowiki(label), true
else
return id, false
end
end
-------------------------------------------------------------------------------
-- linkedItem takes an entity-id and returns a string, linked if possible.
-- This is the handler for "wikibase-item". Preferences:
-- 1. Display linked disambiguated sitelink if it exists
-- 2. Display linked label if it is a redirect
-- 3. TBA: Display an inter-language link for the label if it exists other than in default language
-- 4. Display unlinked label if it exists
-- 5. Display entity-id for now to indicate a label could be provided
-- dtxt is text to be used instead of label, or nil.
-- shortname is boolean switch to use P1813 (short name) instead of label if true.
-- lang is the current language code.
-- uselbl is boolean switch to force display of the label instead of the sitelink (default: false)
-- linkredir is boolean switch to allow linking to a redirect (default: false)
-- formatvalue is boolean switch to allow formatting as italics or quoted (default: false)
-------------------------------------------------------------------------------
-- Dependencies: labelOrId(); donotlink[]
-------------------------------------------------------------------------------
local linkedItem = function(id, args)
local lprefix = (args.lp or args.lprefix or args.linkprefix or ""):gsub('"', '') -- toughen against nil values passed
local lpostfix = (args.lpostfix or ""):gsub('"', '')
local prefix = (args.prefix or ""):gsub('"', '')
local postfix = (args.postfix or ""):gsub('"', '')
local dtxt = args.dtxt
local shortname = args.shortname or args.sn
local lang = args.lang or "en" -- fallback to default if missing
local uselbl = args.uselabel or args.uselbl
uselbl = parseParam(uselbl, false)
local linkredir = args.linkredir
linkredir = parseParam(linkredir, false)
local formatvalue = args.formatvalue or args.fv
formatvalue = parseParam(formatvalue, false)
-- see if item might need italics or quotes
local fmt = ""
if next(formats) and formatvalue then
for k, v in ipairs( mw.wikibase.getBestStatements(id, "P31") ) do
if v.mainsnak.datavalue and formats[v.mainsnak.datavalue.value.id] then
fmt = formats[v.mainsnak.datavalue.value.id]
break -- pick the first match
end
end
end
local disp
local sitelink = mw.wikibase.getSitelink(id)
local label, islabel
if dtxt then
label, islabel = dtxt, true
elseif shortname then
-- see if there is a shortname in our language, and set label to it
for k, v in ipairs( mw.wikibase.getBestStatements(id, "P1813") ) do
if v.mainsnak.datavalue.value.language == lang then
label, islabel = v.mainsnak.datavalue.value.text, true
break
end -- test for language match
end -- loop through values of short name
-- if we have no label set, then there was no shortname available
if not islabel then
label, islabel = labelOrId(id)
shortname = false
end
else
label, islabel = labelOrId(id)
end
if mw.site.siteName ~= "Wikimedia Commons" then
if sitelink then
if not (dtxt or shortname) then
-- if sitelink and label are the same except for case, no need to process further
if sitelink:lower() ~= label:lower() then
-- strip any namespace or dab from the sitelink
local pos = sitelink:find(":") or 0
local slink = sitelink
if pos > 0 then
local pfx = sitelink:sub(1,pos-1)
if mw.site.namespaces[pfx] then -- that prefix is a valid namespace, so remove it
slink = sitelink:sub(pos+1)
end
end
-- remove stuff after commas or inside parentheses - ie. dabs
slink = slink:gsub("%s%(.+%)$", ""):gsub(",.+$", "")
-- if uselbl is false, use sitelink instead of label
if not uselbl then
-- use slink as display, preserving label case - find("^%u") is true for 1st char uppercase
if label:find("^%u") then
label = slink:gsub("^(%l)", string.upper)
else
label = slink:gsub("^(%u)", string.lower)
end
end
end
end
if donotlink[label] then
disp = prefix .. fmt .. label .. fmt .. postfix
else
disp = "[[" .. lprefix .. sitelink .. lpostfix .. "|" .. prefix .. fmt .. label .. fmt .. postfix .. "]]"
end
elseif islabel then
-- no sitelink, label exists, so check if a redirect with that title exists, if linkredir is true
-- display plain label by default
disp = prefix .. fmt .. label .. fmt .. postfix
if linkredir then
local artitle = mw.title.new(label, 0) -- only nil if label has invalid chars
if not donotlink[label] and artitle and artitle.redirectTarget then
-- there's a redirect with the same title as the label, so let's link to that
disp = "[[".. lprefix .. label .. lpostfix .. "|" .. prefix .. fmt .. label .. fmt .. postfix .. "]]"
end
end -- test if article title exists as redirect on current Wiki
else
-- no sitelink and no label, so return whatever was returned from labelOrId for now
-- add tracking category [[Category:Articles with missing Wikidata information]]
-- for enwiki, just return the tracking category
if mw.wikibase.getGlobalSiteId() == "enwiki" then
disp = i18n.missinginfocat
else
disp = prefix .. label .. postfix .. i18n.missinginfocat
end
end
else
local ccat = mw.wikibase.getBestStatements(id, "P373")[1]
if ccat and ccat.mainsnak.datavalue then
ccat = ccat.mainsnak.datavalue.value
disp = "[[" .. lprefix .. "Category:" .. ccat .. lpostfix .. "|" .. prefix .. label .. postfix .. "]]"
elseif sitelink then
-- this asumes that if a sitelink exists, then a label also exists
disp = "[[" .. lprefix .. sitelink .. lpostfix .. "|" .. prefix .. label .. postfix .. "]]"
else
-- no sitelink and no Commons cat, so return label from labelOrId for now
disp = prefix .. label .. postfix
end
end
return disp
end
-------------------------------------------------------------------------------
-- sourced takes a table representing a statement that may or may not have references
-- it looks for a reference sourced to something not containing the word "wikipedia"
-- it returns a boolean = true if it finds a sourced reference.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local sourced = function(claim)
if claim.references then
for kr, vr in pairs(claim.references) do
local ref = mw.wikibase.renderSnaks(vr.snaks)
if not ref:find("Wiki") then
return true
end
end
end
end
-------------------------------------------------------------------------------
-- setRanks takes a flag (parameter passed) that requests the values to return
-- "b[est]" returns preferred if available, otherwise normal
-- "p[referred]" returns preferred
-- "n[ormal]" returns normal
-- "d[eprecated]" returns deprecated
-- multiple values are allowed, e.g. "preferred normal" (which is the default)
-- "best" will override the other flags, and set p and n
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local setRanks = function(rank)
rank = (rank or ""):lower()
-- if nothing passed, return preferred and normal
-- if rank == "" then rank = "p n" end
local ranks = {}
for w in string.gmatch(rank, "%a+") do
w = w:sub(1,1)
if w == "b" or w == "p" or w == "n" or w == "d" then
ranks[w] = true
end
end
-- check if "best" is requested or no ranks requested; and if so, set preferred and normal
if ranks.b or not next(ranks) then
ranks.p = true
ranks.n = true
end
return ranks
end
-------------------------------------------------------------------------------
-- parseInput processes the Q-id , the blacklist and the whitelist
-- if an input parameter is supplied, it returns that and ends the call.
-- it returns (1) either the qid or nil indicating whether or not the call should continue
-- and (2) a table containing all of the statements for the propertyID and relevant Qid
-- if "best" ranks are requested, it returns those instead of all non-deprecated ranks
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local parseInput = function(frame, input_parm, property_id)
-- There may be a local parameter supplied, if it's blank, set it to nil
input_parm = mw.text.trim(input_parm or "")
if input_parm == "" then input_parm = nil end
-- return nil if Wikidata is not available
if not mw.wikibase then return false, input_parm end
local args = frame.args
-- can take a named parameter |qid which is the Wikidata ID for the article.
-- if it's not supplied, use the id for the current page
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
-- if there's no Wikidata item for the current page return nil
if not qid then return false, input_parm end
-- The blacklist is passed in named parameter |suppressfields
local blacklist = args.suppressfields or args.spf or ""
-- The whitelist is passed in named parameter |fetchwikidata
local whitelist = args.fetchwikidata or args.fwd or ""
if whitelist == "" then whitelist = "NONE" end
-- The name of the field that this function is called from is passed in named parameter |name
local fieldname = args.name or ""
if blacklist ~= "" then
-- The name is compulsory when blacklist is used, so return nil if it is not supplied
if fieldname == "" then return false, nil end
-- If this field is on the blacklist, then return nil
if blacklist:find(fieldname) then return false, nil end
end
-- If we got this far then we're not on the blacklist
-- The blacklist overrides any locally supplied parameter as well
-- If a non-blank input parameter was supplied return it
if input_parm then return false, input_parm end
-- We can filter out non-valid properties
if property_id:sub(1,1):upper() ~="P" or property_id == "P0" then return false, nil end
-- Otherwise see if this field is on the whitelist:
-- needs a bit more logic because find will return its second value = 0 if fieldname is ""
-- but nil if fieldname not found on whitelist
local _, found = whitelist:find(fieldname)
found = ((found or 0) > 0)
if whitelist ~= 'ALL' and (whitelist:upper() == "NONE" or not found) then
return false, nil
end
-- See what's on Wikidata (the call always returns a table, but it may be empty):
local props = {}
if args.reqranks.b then
props = mw.wikibase.getBestStatements(qid, property_id)
else
props = mw.wikibase.getAllStatements(qid, property_id)
end
if props[1] then
return qid, props
end
-- no property on Wikidata
return false, nil
end
-------------------------------------------------------------------------------
-- createicon assembles the "Edit at Wikidata" pen icon.
-- It returns a wikitext string inside a span class="penicon"
-- if entityID is nil or empty, the ID associated with current page is used
-- langcode and propertyID may be nil or empty
-------------------------------------------------------------------------------
-- Dependencies: i18n[];
-------------------------------------------------------------------------------
local createicon = function(langcode, entityID, propertyID)
langcode = langcode or ""
if not entityID or entityID == "" then entityID= mw.wikibase.getEntityIdForCurrentPage() end
propertyID = propertyID or ""
local icon = " <span class='penicon autoconfirmed-show'>[["
-- " <span data-bridge-edit-flow='overwrite' class='penicon'>[[" -> enable Wikidata Bridge
.. i18n["filespace"]
.. ":OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt="
.. i18n["editonwikidata"]
.. "|link=https://www.wikidata.org/wiki/" .. entityID
if langcode ~= "" then icon = icon .. "?uselang=" .. langcode end
if propertyID ~= "" then icon = icon .. "#" .. propertyID end
icon = icon .. "|" .. i18n["editonwikidata"] .. "]]</span>"
return icon
end
-------------------------------------------------------------------------------
-- assembleoutput takes the sequence table containing the property values
-- and formats it according to switches given. It returns a string or nil.
-- It uses the entityID (and optionally propertyID) to create a link in the pen icon.
-------------------------------------------------------------------------------
-- Dependencies: parseParam();
-------------------------------------------------------------------------------
local assembleoutput = function(out, args, entityID, propertyID)
-- sorted is a boolean passed to enable sorting of the values returned
-- if nothing or an empty string is passed set it false
-- if "false" or "no" or "0" is passed set it false
local sorted = parseParam(args.sorted, false)
-- noicon is a boolean passed to suppress the trailing "edit at Wikidata" icon
-- for use when the value is processed further by the infobox
-- if nothing or an empty string is passed set it false
-- if "false" or "no" or "0" is passed set it false
local noic = parseParam(args.noicon, false)
-- list is the name of a template that a list of multiple values is passed through
-- examples include "hlist" and "ubl"
-- setting it to "prose" produces something like "1, 2, 3, and 4"
local list = args.list or ""
-- sep is a string that is used to separate multiple returned values
-- if nothing or an empty string is passed set it to the default
-- any double-quotes " are stripped out, so that spaces may be passed
-- e.g. |sep=" - "
local sepdefault = i18n["list separator"]
local separator = args.sep or ""
separator = string.gsub(separator, '"', '')
if separator == "" then
separator = sepdefault
end
-- collapse is a number that determines the maximum number of returned values
-- before the output is collapsed.
-- Zero or not a number result in no collapsing (default becomes 0).
local collapse = tonumber(args.collapse) or 0
-- replacetext (rt) is a string that is returned instead of any non-empty Wikidata value
-- this is useful for tracking and debugging
local replacetext = mw.text.trim(args.rt or args.replacetext or "")
-- if there's anything to return, then return a list
-- comma-separated by default, but may be specified by the sep parameter
-- optionally specify a hlist or ubl or a prose list, etc.
local strout
if #out > 0 then
if sorted then table.sort(out) end
-- if there's something to display and a pen icon is wanted, add it the end of the last value
local hasdisplay = false
for i, v in ipairs(out) do
if v ~= i18n.missinginfocat then
hasdisplay = true
break
end
end
if not noic and hasdisplay then
out[#out] = out[#out] .. createicon(args.langobj.code, entityID, propertyID)
end
if list == "" then
strout = table.concat(out, separator)
elseif list:lower() == "prose" then
strout = mw.text.listToText( out )
else
strout = mw.getCurrentFrame():expandTemplate{title = list, args = out}
end
if collapse >0 and #out > collapse then
strout = collapsediv .. strout .. "</div>"
end
else
strout = nil -- no items had valid reference
end
if replacetext ~= "" and strout then strout = replacetext end
return strout
end
-------------------------------------------------------------------------------
-- rendersnak takes a table (propval) containing the information stored on one property value
-- and returns the value as a string and its language if monolingual text.
-- It handles data of type:
-- wikibase-item
-- time
-- string, url, commonsMedia, external-id
-- quantity
-- globe-coordinate
-- monolingualtext
-- It also requires linked, the link/pre/postfixes, uabbr, and the arguments passed from frame.
-- The optional filter parameter allows quantities to be be filtered by unit Qid.
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); labelOrId(); i18n[]; dateFormat();
-- roundto(); decimalPrecision(); decimalToDMS(); linkedItem();
-------------------------------------------------------------------------------
local rendersnak = function(propval, args, linked, lpre, lpost, pre, post, uabbr, filter)
lpre = lpre or ""
lpost = lpost or ""
pre = pre or ""
post = post or ""
args.lang = args.lang or findLang().code
-- allow values to display a fixed text instead of label
local dtxt = args.displaytext or args.dt
if dtxt == "" then dtxt = nil end
-- switch to use display of short name (P1813) instead of label
local shortname = args.shortname or args.sn
shortname = parseParam(shortname, false)
local snak = propval.mainsnak or propval
local dtype = snak.datatype
local dv = snak.datavalue
dv = dv and dv.value
-- value and monolingual text language code returned
local val, mlt
if propval.rank and not args.reqranks[propval.rank:sub(1, 1)] then
-- val is nil: value has a rank that isn't requested
------------------------------------
elseif snak.snaktype == "somevalue" then -- value is unknown
val = i18n["Unknown"]
------------------------------------
elseif snak.snaktype == "novalue" then -- value is none
-- val = "No value" -- don't return anything
------------------------------------
elseif dtype == "wikibase-item" then -- data type is a wikibase item:
-- it's wiki-linked value, so output as link if enabled and possible
local qnumber = dv.id
if linked then
val = linkedItem(qnumber, args)
else -- no link wanted so check for display-text, otherwise test for lang code
local label, islabel
if dtxt then
label = dtxt
else
label, islabel = labelOrId(qnumber)
local langlabel = mw.wikibase.getLabelByLang(qnumber, args.lang)
if langlabel then
label = mw.text.nowiki( langlabel )
end
end
val = pre .. label .. post
end -- test for link required
------------------------------------
elseif dtype == "time" then -- data type is time:
-- time is in timestamp format
-- date precision is integer per mediawiki
-- output formatting according to preferences (y/dmy/mdy)
-- BC format as BC or BCE
-- plaindate is passed to disable looking for "sourcing cirumstances"
-- or to set the adjectival form
-- qualifiers (if any) is a nested table or nil
-- lang is given, or user language, or site language
--
-- Here we can check whether args.df has a value
-- If not, use code from Module:Sandbox/RexxS/Getdateformat to set it from templates like {{Use mdy dates}}
val = dateFormat(dv.time, dv.precision, args.df, args.bc, args.pd, propval.qualifiers, args.lang, "", dv.calendarmodel)
------------------------------------
-- data types which are strings:
elseif dtype == "commonsMedia" or dtype == "external-id" or dtype == "string" or dtype == "url" then
-- commonsMedia or external-id or string or url
-- all have mainsnak.datavalue.value as string
if (lpre == "" or lpre == ":") and lpost == "" then
-- don't link if no linkpre/postfix or linkprefix is just ":"
val = pre .. dv .. post
elseif dtype == "external-id" then
val = "[" .. lpre .. dv .. lpost .. " " .. pre .. dv .. post .. "]"
else
val = "[[" .. lpre .. dv .. lpost .. "|" .. pre .. dv .. post .. "]]"
end -- check for link requested (i.e. either linkprefix or linkpostfix exists)
------------------------------------
-- data types which are quantities:
elseif dtype == "quantity" then
-- quantities have mainsnak.datavalue.value.amount and mainsnak.datavalue.value.unit
-- the unit is of the form http://www.wikidata.org/entity/Q829073
--
-- implement a switch to turn on/off numerical formatting later
local fnum = true
--
-- a switch to turn on/off conversions - only for en-wiki
local conv = parseParam(args.conv or args.convert, false)
-- if we have conversions, we won't have formatted numbers or scales
if conv then
uabbr = true
fnum = false
args.scale = "0"
end
--
-- a switch to turn on/off showing units, default is true
local showunits = parseParam(args.su or args.showunits, true)
--
-- convert amount to a number
local amount = tonumber(dv.amount) or i18n["NaN"]
--
-- scale factor for millions, billions, etc.
local sc = tostring(args.scale or ""):sub(1,1):lower()
local scale
if sc == "a" then
-- automatic scaling
if amount > 1e15 then
scale = 12
elseif amount > 1e12 then
scale = 9
elseif amount > 1e9 then
scale = 6
elseif amount > 1e6 then
scale = 3
else
scale = 0
end
else
scale = tonumber(args.scale) or 0
if scale < 0 or scale > 12 then scale = 0 end
scale = math.floor(scale/3) * 3
end
local factor = 10^scale
amount = amount / factor
-- ranges:
local range = ""
-- check if upper and/or lower bounds are given and significant
local upb = tonumber(dv.upperBound)
local lowb = tonumber(dv.lowerBound)
if upb and lowb then
-- differences rounded to 2 sig fig:
local posdif = roundto(upb - amount, 2) / factor
local negdif = roundto(amount - lowb, 2) / factor
upb, lowb = amount + posdif, amount - negdif
-- round scaled numbers to integers or 4 sig fig
if (scale > 0 or sc == "a") then
if amount < 1e4 then
amount = roundto(amount, 4)
else
amount = math.floor(amount + 0.5)
end
end
if fnum then amount = args.langobj:formatNum( amount ) end
if posdif ~= negdif then
-- non-symmetrical
range = " +" .. posdif .. " -" .. negdif
elseif posdif ~= 0 then
-- symmetrical and non-zero
range = " ±" .. posdif
else
-- otherwise range is zero, so leave it as ""
end
else
-- round scaled numbers to integers or 4 sig fig
if (scale > 0 or sc == "a") then
if amount < 1e4 then
amount = roundto(amount, 4)
else
amount = math.floor(amount + 0.5)
end
end
if fnum then amount = args.langobj:formatNum( amount ) end
end
-- unit names and symbols:
-- extract the qid in the form 'Qnnn' from the value.unit url
-- and then fetch the label from that - or symbol if unitabbr is true
local unit = ""
local usep = ""
local usym = ""
local unitqid = string.match( dv.unit, "(Q%d+)" )
if filter and unitqid ~= filter then return nil end
if unitqid and showunits then
local uname = mw.wikibase.getLabelByLang(unitqid, args.lang) or ""
if uname ~= "" then usep, unit = " ", uname end
if uabbr then
-- see if there's a unit symbol (P5061)
local unitsymbols = mw.wikibase.getBestStatements(unitqid, "P5061")
-- construct fallback table, add local lang and multiple languages
local fbtbl = mw.language.getFallbacksFor( args.lang, mw.language.FALLBACK_STRICT )
table.insert( fbtbl, 1, args.lang )
table.insert( fbtbl, "mul" )
table.insert( fbtbl, "en" )
local found = false
for idx1, us in ipairs(unitsymbols) do
for idx2, fblang in ipairs(fbtbl) do
if us.mainsnak.datavalue.value.language == fblang then
usym = us.mainsnak.datavalue.value.text
found = true
break
end
end -- loop through fallback table
if found then break end
end -- loop through values of P5061
if found then usep, unit = " ", usym end
end
end
-- format display:
if conv then
if range == "" then
val = mw.getCurrentFrame():expandTemplate{title = "cvt", args = {amount, unit}}
else
val = mw.getCurrentFrame():expandTemplate{title = "cvt", args = {lowb, "to", upb, unit}}
end
elseif unit == "$" or unit == "£" then
val = unit .. amount .. range .. i18n.multipliers[scale]
else
val = amount .. range .. i18n.multipliers[scale] .. usep .. unit
end
------------------------------------
-- datatypes which are global coordinates:
elseif dtype == "globe-coordinate" then
-- 'display' parameter defaults to "inline, title" *** unused for now ***
-- local disp = args.display or ""
-- if disp == "" then disp = "inline, title" end
--
-- format parameter switches from deg/min/sec to decimal degrees
-- default is deg/min/sec -- decimal degrees needs |format = dec
local form = (args.format or ""):lower():sub(1,3)
if form ~= "dec" then form = "dms" end -- not needed for now
--
-- show parameter allows just the latitude, or just the longitude, or both
-- to be returned as a signed decimal, ignoring the format parameter.
local show = (args.show or ""):lower()
if show ~= "longlat" then show = show:sub(1,3) end
--
local lat, long, prec = dv.latitude, dv.longitude, dv.precision
if show == "lat" then
val = decimalPrecision(lat, prec)
elseif show == "lon" then
val = decimalPrecision(long, prec)
elseif show == "longlat" then
val = decimalPrecision(long, prec) .. ", " .. decimalPrecision(lat, prec)
else
local ns = "N"
local ew = "E"
if lat < 0 then
ns = "S"
lat = - lat
end
if long < 0 then
ew = "W"
long = - long
end
if form == "dec" then
lat = decimalPrecision(lat, prec)
long = decimalPrecision(long, prec)
val = lat .. "°" .. ns .. " " .. long .. "°" .. ew
else
local latdeg, latmin, latsec = decimalToDMS(lat, prec)
local longdeg, longmin, longsec = decimalToDMS(long, prec)
if latsec == 0 and longsec == 0 then
if latmin == 0 and longmin == 0 then
val = latdeg .. "°" .. ns .. " " .. longdeg .. "°" .. ew
else
val = latdeg .. "°" .. latmin .. "′" .. ns .. " "
val = val .. longdeg .. "°".. longmin .. "′" .. ew
end
else
val = latdeg .. "°" .. latmin .. "′" .. latsec .. "″" .. ns .. " "
val = val .. longdeg .. "°" .. longmin .. "′" .. longsec .. "″" .. ew
end
end
end
------------------------------------
elseif dtype == "monolingualtext" then -- data type is Monolingual text:
-- has mainsnak.datavalue.value as a table containing language/text pairs
-- collect all the values in 'out' and languages in 'mlt' and process them later
val = pre .. dv.text .. post
mlt = dv.language
------------------------------------
else
-- some other data type so write a specific handler
val = "unknown data type: " .. dtype
end -- of datatype/unknown value/sourced check
return val, mlt
end
-------------------------------------------------------------------------------
-- propertyvalueandquals takes a property object, the arguments passed from frame,
-- and a qualifier propertyID.
-- It returns a sequence (table) of values representing the values of that property
-- and qualifiers that match the qualifierID if supplied.
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); sourced(); labelOrId(); i18n.latestdatequalifier(); format_Date();
-- makeOrdinal(); roundto(); decimalPrecision(); decimalToDMS(); assembleoutput();
-------------------------------------------------------------------------------
local function propertyvalueandquals(objproperty, args, qualID)
-- needs this style of declaration because it's re-entrant
-- onlysourced is a boolean passed to return only values sourced to other than Wikipedia
-- if nothing or an empty string is passed set it true
local onlysrc = parseParam(args.onlysourced or args.osd, true)
-- linked is a a boolean that enables the link to a local page via sitelink
-- if nothing or an empty string is passed set it true
local linked = parseParam(args.linked, true)
-- prefix is a string that may be nil, empty (""), or a string of characters
-- this is prefixed to each value
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local prefix = (args.prefix or ""):gsub('"', '')
-- postfix is a string that may be nil, empty (""), or a string of characters
-- this is postfixed to each value
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local postfix = (args.postfix or ""):gsub('"', '')
-- linkprefix is a string that may be nil, empty (""), or a string of characters
-- this creates a link and is then prefixed to each value
-- useful when when multiple values are returned and indirect links are needed
-- any double-quotes " are stripped out, so that spaces may be passed
local lprefix = (args.linkprefix or args.lp or ""):gsub('"', '')
-- linkpostfix is a string that may be nil, empty (""), or a string of characters
-- this is postfixed to each value when linking is enabled with lprefix
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local lpostfix = (args.linkpostfix or ""):gsub('"', '')
-- wdlinks is a boolean passed to enable links to Wikidata when no article exists
-- if nothing or an empty string is passed set it false
local wdl = parseParam(args.wdlinks or args.wdl, false)
-- unitabbr is a boolean passed to enable unit abbreviations for common units
-- if nothing or an empty string is passed set it false
local uabbr = parseParam(args.unitabbr or args.uabbr, false)
-- qualsonly is a boolean passed to return just the qualifiers
-- if nothing or an empty string is passed set it false
local qualsonly = parseParam(args.qualsonly or args.qo, false)
-- maxvals is a string that may be nil, empty (""), or a number
-- this determines how many items may be returned when multiple values are available
-- setting it = 1 is useful where the returned string is used within another call, e.g. image
local maxvals = tonumber(args.maxvals) or 0
-- pd (plain date) is a string: yes/true/1 | no/false/0 | adj
-- to disable/enable "sourcing cirumstances" or use adjectival form for the plain date
local pd = args.plaindate or args.pd or "no"
args.pd = pd
-- allow qualifiers to have a different date format; default to year unless qualsonly is set
args.qdf = args.qdf or args.qualifierdateformat or args.df or (not qualsonly and "y")
local lang = args.lang or findLang().code
-- qualID is a string list of wanted qualifiers or "ALL"
qualID = qualID or ""
-- capitalise list of wanted qualifiers and substitute "DATES"
qualID = qualID:upper():gsub("DATES", "P580, P582")
local allflag = (qualID == "ALL")
-- create table of wanted qualifiers as key
local qwanted = {}
-- create sequence of wanted qualifiers
local qorder = {}
for q in mw.text.gsplit(qualID, "%p") do -- split at punctuation and iterate
local qtrim = mw.text.trim(q)
if qtrim ~= "" then
qwanted[mw.text.trim(q)] = true
qorder[#qorder+1] = qtrim
end
end
-- qsep is the output separator for rendering qualifier list
local qsep = (args.qsep or ""):gsub('"', '')
-- qargs are the arguments to supply to assembleoutput()
local qargs = {
["osd"] = "false",
["linked"] = tostring(linked),
["prefix"] = args.qprefix,
["postfix"] = args.qpostfix,
["linkprefix"] = args.qlinkprefix or args.qlp,
["linkpostfix"] = args.qlinkpostfix,
["wdl"] = "false",
["unitabbr"] = tostring(uabbr),
["maxvals"] = 0,
["sorted"] = tostring(args.qsorted),
["noicon"] = "true",
["list"] = args.qlist,
["sep"] = qsep,
["langobj"] = args.langobj,
["lang"] = args.langobj.code,
["df"] = args.qdf,
["sn"] = parseParam(args.qsn or args.qshortname, false),
}
-- all proper values of a Wikidata property will be the same type as the first
-- qualifiers don't have a mainsnak, properties do
local datatype = objproperty[1].datatype or objproperty[1].mainsnak.datatype
-- out[] holds the a list of returned values for this property
-- mlt[] holds the language code if the datatype is monolingual text
local out = {}
local mlt = {}
for k, v in ipairs(objproperty) do
local hasvalue = true
if (onlysrc and not sourced(v)) then
-- no value: it isn't sourced when onlysourced=true
hasvalue = false
else
local val, lcode = rendersnak(v, args, linked, lprefix, lpostfix, prefix, postfix, uabbr)
if not val then
hasvalue = false -- rank doesn't match
elseif qualsonly and qualID then
-- suppress value returned: only qualifiers are requested
else
out[#out+1], mlt[#out+1] = val, lcode
end
end
-- See if qualifiers are to be returned:
local snak = v.mainsnak or v
if hasvalue and v.qualifiers and qualID ~= "" and snak.snaktype~="novalue" then
-- collect all wanted qualifier values returned in qlist, indexed by propertyID
local qlist = {}
local timestart, timeend = "", ""
-- loop through qualifiers
for k1, v1 in pairs(v.qualifiers) do
if allflag or qwanted[k1] then
if k1 == "P1326" then
local ts = v1[1].datavalue.value.time
local dp = v1[1].datavalue.value.precision
qlist[k1] = dateFormat(ts, dp, args.qdf, args.bc, pd, "", lang, "before")
elseif k1 == "P1319" then
local ts = v1[1].datavalue.value.time
local dp = v1[1].datavalue.value.precision
qlist[k1] = dateFormat(ts, dp, args.qdf, args.bc, pd, "", lang, "after")
elseif k1 == "P580" then
timestart = propertyvalueandquals(v1, qargs)[1] or "" -- treat only one start time as valid
elseif k1 == "P582" then
timeend = propertyvalueandquals(v1, qargs)[1] or "" -- treat only one end time as valid
else
local q = assembleoutput(propertyvalueandquals(v1, qargs), qargs)
-- we already deal with circa via 'sourcing circumstances' if the datatype was time
-- circa may be either linked or unlinked *** internationalise later ***
if datatype ~= "time" or q ~= "circa" and not (type(q) == "string" and q:find("circa]]")) then
qlist[k1] = q
end
end
end -- of test for wanted
end -- of loop through qualifiers
-- set date separator
local t = timestart .. timeend
-- *** internationalise date separators later ***
local dsep = "–"
if t:find("%s") or t:find(" ") then dsep = " – " end
-- set the order for the list of qualifiers returned; start time and end time go last
if next(qlist) then
local qlistout = {}
if allflag then
for k2, v2 in pairs(qlist) do
qlistout[#qlistout+1] = v2
end
else
for i2, v2 in ipairs(qorder) do
qlistout[#qlistout+1] = qlist[v2]
end
end
if t ~= "" then
qlistout[#qlistout+1] = timestart .. dsep .. timeend
end
local qstr = assembleoutput(qlistout, qargs)
if qualsonly then
out[#out+1] = qstr
else
out[#out] = out[#out] .. " (" .. qstr .. ")"
end
elseif t ~= "" then
if qualsonly then
if timestart == "" then
out[#out+1] = timeend
elseif timeend == "" then
out[#out+1] = timestart
else
out[#out+1] = timestart .. dsep .. timeend
end
else
out[#out] = out[#out] .. " (" .. timestart .. dsep .. timeend .. ")"
end
end
end -- of test for qualifiers wanted
if maxvals > 0 and #out >= maxvals then break end
end -- of for each value loop
-- we need to pick one value to return if the datatype was "monolingualtext"
-- if there's only one value, use that
-- otherwise look through the fallback languages for a match
if datatype == "monolingualtext" and #out >1 then
lang = mw.text.split( lang, '-', true )[1]
local fbtbl = mw.language.getFallbacksFor( lang )
table.insert( fbtbl, 1, lang )
local bestval = ""
local found = false
for idx1, lang1 in ipairs(fbtbl) do
for idx2, lang2 in ipairs(mlt) do
if (lang1 == lang2) and not found then
bestval = out[idx2]
found = true
break
end
end -- loop through values of property
end -- loop through fallback languages
if found then
-- replace output table with a table containing the best value
out = { bestval }
else
-- more than one value and none of them on the list of fallback languages
-- sod it, just give them the first one
out = { out[1] }
end
end
return out
end
-------------------------------------------------------------------------------
-- Common code for p.getValueByQual and p.getValueByLang
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
local _getvaluebyqual = function(frame, qualID, checkvalue)
-- The property ID that will have a qualifier is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or "")
if propertyID == "" then return "no property supplied" end
if qualID == "" then return "no qualifier supplied" end
-- onlysourced is a boolean passed to return property values
-- only when property values are sourced to something other than Wikipedia
-- if nothing or an empty string is passed set it true
-- if "false" or "no" or 0 is passed set it false
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- set a language object and code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
-- check for locally supplied parameter in second unnamed parameter
-- success means no local parameter and the property exists
local qid, props = parseInput(frame, args[2], propertyID)
local linked = parseParam(args.linked, true)
local lpre = (args.linkprefix or args.lp or ""):gsub('"', '')
local lpost = (args.linkpostfix or ""):gsub('"', '')
local pre = (args.prefix or ""):gsub('"', '')
local post = (args.postfix or ""):gsub('"', '')
local uabbr = parseParam(args.unitabbr or args.uabbr, false)
local filter = (args.unit or ""):upper()
local maxvals = tonumber(args.maxvals) or 0
if filter == "" then filter = nil end
if qid then
local out = {}
-- Scan through the values of the property
-- we want something like property is "pronunciation audio (P443)" in propertyID
-- with a qualifier like "language of work or name (P407)" in qualID
-- whose value has the required ID, like "British English (Q7979)", in qval
for k1, v1 in ipairs(props) do
if v1.mainsnak.snaktype == "value" then
-- check if it has the right qualifier
local v1q = v1.qualifiers
if v1q and v1q[qualID] then
if onlysrc == false or sourced(v1) then
-- if we've got this far, we have a (sourced) claim with qualifiers
-- so see if matches the required value
-- We'll only deal with wikibase-items and strings for now
if v1q[qualID][1].datatype == "wikibase-item" then
if checkvalue(v1q[qualID][1].datavalue.value.id) then
out[#out + 1] = rendersnak(v1, args, linked, lpre, lpost, pre, post, uabbr, filter)
end
elseif v1q[qualID][1].datatype == "string" then
if checkvalue(v1q[qualID][1].datavalue.value) then
out[#out + 1] = rendersnak(v1, args, linked, lpre, lpost, pre, post, uabbr, filter)
end
end
end -- of check for sourced
end -- of check for matching required value and has qualifiers
else
return nil
end -- of check for string
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of propertyID
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- either local parameter or nothing
end -- of test for success
return nil
end
-------------------------------------------------------------------------------
-- _location takes Q-id and follows P276 (location)
-- or P131 (located in the administrative territorial entity) or P706 (located on terrain feature)
-- from the initial item to higher level territories/locations until it reaches the highest.
-- An optional boolean, 'first', determines whether the first item is returned (default: false).
-- An optional boolean 'skip' toggles the display to skip to the last item (default: false).
-- It returns a table containing the locations - linked where possible, except for the highest.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); labelOrId(); linkedItem
-------------------------------------------------------------------------------
local _location = function(qid, first, skip)
first = parseParam(first, false)
skip = parseParam(skip, false)
local locs = {"P276", "P131", "P706"}
local out = {}
local langcode = findLang():getCode()
local finished = false
local count = 0
local prevqid = "Q0"
repeat
local prop
for i1, v1 in ipairs(locs) do
local proptbl = mw.wikibase.getBestStatements(qid, v1)
if #proptbl > 1 then
-- there is more than one higher location
local prevP131, prevP131id
if prevqid ~= "Q0" then
prevP131 = mw.wikibase.getBestStatements(prevqid, "P131")[1]
prevP131id = prevP131
and prevP131.mainsnak.datavalue
and prevP131.mainsnak.datavalue.value.id
end
for i2, v2 in ipairs(proptbl) do
local parttbl = v2.qualifiers and v2.qualifiers.P518
if parttbl then
-- this higher location has qualifier 'applies to part' (P518)
for i3, v3 in ipairs(parttbl) do
if v3.snaktype == "value" and v3.datavalue.value.id == prevqid then
-- it has a value equal to the previous location
prop = proptbl[i2]
break
end -- of test for matching last location
end -- of loop through values of 'applies to part'
else
-- there's no qualifier 'applies to part' (P518)
-- so check if the previous location had a P131 that matches this alternate
if qid == prevP131id then
prop = proptbl[i2]
break
end -- of test for matching previous P131
end
end -- of loop through parent locations
-- fallback to second value if match not found
prop = prop or proptbl[2]
elseif #proptbl > 0 then
prop = proptbl[1]
end
if prop then break end
end
-- check if it's an instance of (P31) a country (Q6256) or sovereign state (Q3624078)
-- and terminate the chain if it is
local inst = mw.wikibase.getAllStatements(qid, "P31")
if #inst > 0 then
for k, v in ipairs(inst) do
local instid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
-- stop if it's a country (or a country within the United Kingdom if skip is true)
if instid == "Q6256" or instid == "Q3624078" or (skip and instid == "Q3336843") then
prop = nil -- this will ensure this is treated as top-level location
break
end
end
end
-- get the name of this location and update qid to point to the parent location
if prop and prop.mainsnak.datavalue then
if not skip or count == 0 then
local args = { lprefix = ":" }
out[#out+1] = linkedItem(qid, args) -- get a linked value if we can
end
qid, prevqid = prop.mainsnak.datavalue.value.id, qid
else
-- This is top-level location, so get short name except when this is the first item
-- Use full label if there's no short name or this is the first item
local prop1813 = mw.wikibase.getAllStatements(qid, "P1813")
-- if there's a short name and this isn't the only item
if prop1813[1] and (#out > 0)then
local shortname
-- short name is monolingual text, so look for match to the local language
-- choose the shortest 'short name' in that language
for k, v in pairs(prop1813) do
if v.mainsnak.datavalue.value.language == langcode then
local name = v.mainsnak.datavalue.value.text
if (not shortname) or (#name < #shortname) then
shortname = name
end
end
end
-- add the shortname if one is found, fallback to the label
-- but skip it if it's "USA"
if shortname ~= "USA" then
out[#out+1] = shortname or labelOrId(qid)
else
if skip then out[#out+1] = "US" end
end
else
-- no shortname, so just add the label
local loc = labelOrId(qid)
-- exceptions go here:
if loc == "United States of America" then
out[#out+1] = "United States"
else
out[#out+1] = loc
end
end
finished = true
end
count = count + 1
until finished or count >= 10 -- limit to 10 levels to avoid infinite loops
-- remove the first location if not required
if not first then table.remove(out, 1) end
-- we might have duplicate text for consecutive locations, so remove them
if #out > 2 then
local plain = {}
for i, v in ipairs(out) do
-- strip any links
plain[i] = v:gsub("^%[%[[^|]*|", ""):gsub("]]$", "")
end
local idx = 2
repeat
if plain[idx] == plain[idx-1] then
-- duplicate found
local removeidx = 0
if (plain[idx] ~= out[idx]) and (plain[idx-1] == out[idx-1]) then
-- only second one is linked, so drop the first
removeidx = idx - 1
elseif (plain[idx] == out[idx]) and (plain[idx-1] ~= out[idx-1]) then
-- only first one is linked, so drop the second
removeidx = idx
else
-- pick one
removeidx = idx - (os.time()%2)
end
table.remove(out, removeidx)
table.remove(plain, removeidx)
else
idx = idx +1
end
until idx >= #out
end
return out
end
-------------------------------------------------------------------------------
-- _getsumofparts scans the property 'has part' (P527) for values matching a list.
-- The list (args.vlist) consists of a string of Qids separated by spaces or any usual punctuation.
-- If the matched values have a qualifer 'quantity' (P1114), those quantites are summed.
-- The sum is returned as a number (i.e. 0 if none)
-- a table of arguments is supplied implementing the usual parameters.
-------------------------------------------------------------------------------
-- Dependencies: setRanks; parseParam; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
local _getsumofparts = function(args)
local vallist = (args.vlist or ""):upper()
if vallist == "" then return end
args.reqranks = setRanks(args.rank)
local f = {}
f.args = args
local qid, props = parseInput(f, "", "P527")
if not qid then return 0 end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local sum = 0
for k1, v1 in ipairs(props) do
if (onlysrc == false or sourced(v1))
and v1.mainsnak.snaktype == "value"
and v1.mainsnak.datavalue.type == "wikibase-entityid"
and vallist:match( v1.mainsnak.datavalue.value.id )
and v1.qualifiers
then
local quals = v1.qualifiers["P1114"]
if quals then
for k2, v2 in ipairs(quals) do
sum = sum + v2.datavalue.value.amount
end
end
end
end
return sum
end
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Public functions
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- _getValue makes the functionality of getValue available to other modules
-------------------------------------------------------------------------------
-- Dependencies: setRanks; parseInput; propertyvalueandquals; assembleoutput; parseParam; sourced;
-- labelOrId; i18n.latestdatequalifier; format_Date; makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p._getValue = function(args)
-- parameter sets for commonly used groups of parameters
local paraset = tonumber(args.ps or args.parameterset or 0)
if paraset == 1 then
-- a common setting, not usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
elseif paraset == 2 then
-- equivalent to raw, not usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
args.linked = "no"
args.pd = "true"
elseif paraset == 3 then
-- parameterset 1, but usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "yes"
args.noicon = "true"
end
-- implement eid parameter
local eid = args.eid
if eid == "" then
return nil
elseif eid then
args.qid = eid
end
local propertyID = mw.text.trim(args[1] or "")
args.reqranks = setRanks(args.rank)
-- replacetext (rt) is a string that is returned instead of any non-empty Wikidata value
-- this is useful for tracking and debugging, so we set fetchwikidata=ALL to fill the whitelist
local replacetext = mw.text.trim(args.rt or args.replacetext or "")
if replacetext ~= "" then
args.fetchwikidata = "ALL"
end
local f = {}
f.args = args
local entityid, props = parseInput(f, f.args[2], propertyID)
if not entityid then
return props -- either the input parameter or nothing
end
-- qual is a string containing the property ID of the qualifier(s) to be returned
-- if qual == "ALL" then all qualifiers returned
-- if qual == "DATES" then qualifiers P580 (start time) and P582 (end time) returned
-- if nothing or an empty string is passed set it nil -> no qualifiers returned
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
-- set a language object and code in the args table
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- table 'out' stores the return value(s):
local out = propertyvalueandquals(props, args, qualID)
-- format the table of values and return it as a string:
return assembleoutput(out, args, entityid, propertyID)
end
-------------------------------------------------------------------------------
-- getValue is used to get the value(s) of a property
-- The property ID is passed as the first unnamed parameter and is required.
-- A locally supplied parameter may optionaly be supplied as the second unnamed parameter.
-- The function will now also return qualifiers if parameter qual is supplied
-------------------------------------------------------------------------------
-- Dependencies: _getValue; setRanks; parseInput; propertyvalueandquals; assembleoutput; parseParam; sourced;
-- labelOrId; i18n.latestdatequalifier; format_Date; makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p.getValue = function(frame)
local args= frame.args
if not args[1] then
args = frame:getParent().args
if not args[1] then return i18n.errors["No property supplied"] end
end
return p._getValue(args)
end
-------------------------------------------------------------------------------
-- getPreferredValue is used to get a value,
-- (or a comma separated list of them if multiple values exist).
-- If preferred ranks are set, it will return those values, otherwise values with normal ranks
-- now redundant to getValue with |rank=best
-------------------------------------------------------------------------------
-- Dependencies: p.getValue; setRanks; parseInput; propertyvalueandquals; assembleoutput;
-- parseParam; sourced; labelOrId; i18n.latestdatequalifier; format_Date;
-- makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p.getPreferredValue = function(frame)
frame.args.rank = "best"
return p.getValue(frame)
end
-------------------------------------------------------------------------------
-- getCoords is used to get coordinates for display in an infobox
-- whitelist and blacklist are implemented
-- optional 'display' parameter is allowed, defaults to nil - was "inline, title"
-------------------------------------------------------------------------------
-- Dependencies: setRanks(); parseInput(); decimalPrecision();
-------------------------------------------------------------------------------
p.getCoords = function(frame)
local propertyID = "P625"
-- if there is a 'display' parameter supplied, use it
-- otherwise default to nothing
local disp = frame.args.display or ""
if disp == "" then
disp = nil -- default to not supplying display parameter, was "inline, title"
end
-- there may be a format parameter to switch from deg/min/sec to decimal degrees
-- default is deg/min/sec
-- decimal degrees needs |format = dec
local form = (frame.args.format or ""):lower():sub(1,3)
if form ~= "dec" then
form = "dms"
end
-- just deal with best values
frame.args.reqranks = setRanks("best")
local qid, props = parseInput(frame, frame.args[1], propertyID)
if not qid then
return props -- either local parameter or nothing
else
local dv = props[1].mainsnak.datavalue.value
local lat, long, prec = dv.latitude, dv.longitude, dv.precision
lat = decimalPrecision(lat, prec)
long = decimalPrecision(long, prec)
local lat_long = { lat, long }
lat_long["display"] = disp
lat_long["format"] = form
-- invoke template Coord with the values stored in the table
return frame:expandTemplate{title = 'coord', args = lat_long}
end
end
-------------------------------------------------------------------------------
-- getQualifierValue is used to get a formatted value of a qualifier
--
-- The call needs: a property (the unnamed parameter or 1=)
-- a target value for that property (pval=)
-- a qualifier for that target value (qual=)
-- The usual whitelisting and blacklisting of the property is implemented
-- The boolean onlysourced= parameter can be set to return nothing
-- when the property is unsourced (or only sourced to Wikipedia)
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); setRanks(); parseInput(); sourced();
-- propertyvalueandquals(); assembleoutput();
-- labelOrId(); i18n.latestdatequalifier(); format_Date();
-- findLang(); makeOrdinal(); roundto(); decimalPrecision(); decimalToDMS();
-------------------------------------------------------------------------------
p.getQualifierValue = function(frame)
-- The property ID that will have a qualifier is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or "")
-- The value of the property we want to match whose qualifier value is to be returned
-- is passed in named parameter |pval=
local propvalue = frame.args.pval
-- The property ID of the qualifier
-- whose value is to be returned is passed in named parameter |qual=
local qualifierID = frame.args.qual
-- A filter can be set like this: filter=P642==Q22674854
local filter, fprop, fval
local ftable = mw.text.split(frame.args.filter or "", "==")
if ftable[2] then
fprop = mw.text.trim(ftable[1])
fval = mw.text.trim(ftable[2])
filter = true
end
-- onlysourced is a boolean passed to return qualifiers
-- only when property values are sourced to something other than Wikipedia
-- if nothing or an empty string is passed set it true
-- if "false" or "no" or 0 is passed set it false
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set a language object and language code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- check for locally supplied parameter in second unnamed parameter
-- success means no local parameter and the property exists
local qid, props = parseInput(frame, frame.args[2], propertyID)
if qid then
local out = {}
-- Scan through the values of the property
-- we want something like property is P793, significant event (in propertyID)
-- whose value is something like Q385378, construction (in propvalue)
-- then we can return the value(s) of a qualifier such as P580, start time (in qualifierID)
for k1, v1 in pairs(props) do
if v1.mainsnak.snaktype == "value" and v1.mainsnak.datavalue.type == "wikibase-entityid" then
-- It's a wiki-linked value, so check if it's the target (in propvalue) and if it has qualifiers
if v1.mainsnak.datavalue.value.id == propvalue and v1.qualifiers then
if onlysrc == false or sourced(v1) then
-- if we've got this far, we have a (sourced) claim with qualifiers
-- which matches the target, so apply the filter and find the value(s) of the qualifier we want
if not filter or (v1.qualifiers[fprop] and v1.qualifiers[fprop][1].datavalue.value.id == fval) then
local quals = v1.qualifiers[qualifierID]
if quals then
-- can't reference qualifer, so set onlysourced = "no" (args are strings, not boolean)
local qargs = frame.args
qargs.onlysourced = "no"
local vals = propertyvalueandquals(quals, qargs, qid)
for k, v in ipairs(vals) do
out[#out + 1] = v
end
end
end
end -- of check for sourced
end -- of check for matching required value and has qualifiers
end -- of check for wikibase entity
end -- of loop through values of propertyID
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- either local parameter or nothing
end -- of test for success
return nil
end
-------------------------------------------------------------------------------
-- getSumOfParts scans the property 'has part' (P527) for values matching a list.
-- The list is passed in parameter vlist.
-- It consists of a string of Qids separated by spaces or any usual punctuation.
-- If the matched values have a qualifier 'quantity' (P1114), those quantities are summed.
-- The sum is returned as a number or nothing if zero.
-------------------------------------------------------------------------------
-- Dependencies: _getsumofparts;
-------------------------------------------------------------------------------
p.getSumOfParts = function(frame)
local sum = _getsumofparts(frame.args)
if sum == 0 then return end
return sum
end
-------------------------------------------------------------------------------
-- getValueByQual gets the value of a property which has a qualifier with a given entity value
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the ID of a qualifier for that property (qualID=Pyyy)
-- either the Wikibase-entity ID of a value for that qualifier (qvalue=Qzzz)
-- or a string value for that qualifier (qvalue=abc123)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: _getvaluebyqual; parseParam; setRanks; parseInput; sourced;
-- assembleoutput;
-------------------------------------------------------------------------------
p.getValueByQual = function(frame)
local qualID = frame.args.qualID
-- The Q-id of the value for the qualifier we want to match is in named parameter |qvalue=
local qval = frame.args.qvalue or ""
if qval == "" then return "no qualifier value supplied" end
local function checkQID(id)
return id == qval
end
return _getvaluebyqual(frame, qualID, checkQID)
end
-------------------------------------------------------------------------------
-- getValueByLang gets the value of a property which has a qualifier P407
-- ("language of work or name") whose value has the given language code
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the MediaWiki language code to match the language (lang=xx[-yy])
-- (if no code is supplied, it uses the default language)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: _getvaluebyqual; parseParam; setRanks; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
p.getValueByLang = function(frame)
-- The language code for the qualifier we want to match is in named parameter |lang=
local langcode = findLang(frame.args.lang).code
local function checkLanguage(id)
-- id should represent a language like "British English (Q7979)"
-- it should have string property "Wikimedia language code (P424)"
-- qlcode will be a table:
local qlcode = mw.wikibase.getBestStatements(id, "P424")
if (#qlcode > 0) and (qlcode[1].mainsnak.datavalue.value == langcode) then
return true
end
end
return _getvaluebyqual(frame, "P407", checkLanguage)
end
-------------------------------------------------------------------------------
-- getValueByRefSource gets the value of a property which has a reference "stated in" (P248)
-- whose value has the given entity-ID.
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the entity ID of a value to match where the reference is stated in (match=Qzzz)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getValueByRefSource = function(frame)
-- The property ID that we want to check is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or ""):upper()
if propertyID == "" then return "no property supplied" end
-- The Q-id of the value we want to match is in named parameter |qvalue=
local qval = (frame.args.match or ""):upper()
if qval == "" then qval = "Q21540096" end
local unit = (frame.args.unit or ""):upper()
if unit == "" then unit = "Q4917" end
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- set a language object and code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local linked = parseParam(frame.args.linked, true)
local uabbr = parseParam(frame.args.uabbr or frame.args.unitabbr, false)
-- qid not nil means no local parameter and the property exists
local qid, props = parseInput(frame, frame.args[2], propertyID)
if qid then
local out = {}
local mlt= {}
for k1, v1 in ipairs(props) do
if onlysrc == false or sourced(v1) then
if v1.references then
for k2, v2 in ipairs(v1.references) do
if v2.snaks.P248 then
for k3, v3 in ipairs(v2.snaks.P248) do
if v3.datavalue.value.id == qval then
out[#out+1], mlt[#out+1] = rendersnak(v1, frame.args, linked, "", "", "", "", uabbr, unit)
if not mlt[#out] then
-- we only need one match per property value
-- unless datatype was monolingual text
break
end
end -- of test for match
end -- of loop through values "stated in"
end -- of test that "stated in" exists
end -- of loop through references
end -- of test that references exist
end -- of test for sourced
end -- of loop through values of propertyID
if #mlt > 0 then
local langcode = frame.args.lang
langcode = mw.text.split( langcode, '-', true )[1]
local fbtbl = mw.language.getFallbacksFor( langcode )
table.insert( fbtbl, 1, langcode )
local bestval = ""
local found = false
for idx1, lang1 in ipairs(fbtbl) do
for idx2, lang2 in ipairs(mlt) do
if (lang1 == lang2) and not found then
bestval = out[idx2]
found = true
break
end
end -- loop through values of property
end -- loop through fallback languages
if found then
-- replace output table with a table containing the best value
out = { bestval }
else
-- more than one value and none of them on the list of fallback languages
-- sod it, just give them the first one
out = { out[1] }
end
end
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- no property or local parameter supplied
end -- of test for success
end
-------------------------------------------------------------------------------
-- getPropertyIDs takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- It returns the Entity-IDs (Qids) of the values of a property if it is a Wikibase-Entity.
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p._getPropertyIDs = function(args)
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- change default for noicon to true
args.noicon = tostring(parseParam(args.noicon or "", true))
local f = {}
f.args = args
local pid = mw.text.trim(args[1] or ""):upper()
-- get the qid and table of claims for the property, or nothing and the local value passed
local qid, props = parseInput(f, args[2], pid)
if not qid then return props end
if not props[1] then return nil end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local out = {}
for i, v in ipairs(props) do
local snak = v.mainsnak
if ( snak.datatype == "wikibase-item" )
and ( v.rank and args.reqranks[v.rank:sub(1, 1)] )
and ( snak.snaktype == "value" )
and ( sourced(v) or not onlysrc )
then
out[#out+1] = snak.datavalue.value.id
end
if maxvals > 0 and #out >= maxvals then break end
end
return assembleoutput(out, args, qid, pid)
end
p.getPropertyIDs = function(frame)
local args = frame.args
return p._getPropertyIDs(args)
end
-------------------------------------------------------------------------------
-- getQualifierIDs takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- It takes a property-id as the first unnamed parameter, and an optional parameter qlist
-- which is a list of qualifier property-ids to search for (default is "ALL")
-- It returns the Entity-IDs (Qids) of the values of a property if it is a Wikibase-Entity.
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getQualifierIDs = function(frame)
local args = frame.args
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- change default for noicon to true
args.noicon = tostring(parseParam(args.noicon or "", true))
local f = {}
f.args = args
local pid = mw.text.trim(args[1] or ""):upper()
-- get the qid and table of claims for the property, or nothing and the local value passed
local qid, props = parseInput(f, args[2], pid)
if not qid then return props end
if not props[1] then return nil end
-- get the other parameters
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qlist = args.qlist or ""
if qlist == "" then qlist = "ALL" end
qlist = qlist:gsub("[%p%s]+", " ") .. " "
local out = {}
for i, v in ipairs(props) do
local snak = v.mainsnak
if ( v.rank and args.reqranks[v.rank:sub(1, 1)] )
and ( snak.snaktype == "value" )
and ( sourced(v) or not onlysrc )
then
if v.qualifiers then
for k1, v1 in pairs(v.qualifiers) do
if qlist == "ALL " or qlist:match(k1 .. " ") then
for i2, v2 in ipairs(v1) do
if v2.datatype == "wikibase-item" and v2.snaktype == "value" then
out[#out+1] = v2.datavalue.value.id
end -- of test that id exists
end -- of loop through qualifier values
end -- of test for kq in qlist
end -- of loop through qualifiers
end -- of test for qualifiers
end -- of test for rank value, sourced, and value exists
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through property values
return assembleoutput(out, args, qid, pid)
end
-------------------------------------------------------------------------------
-- getPropOfProp takes two propertyIDs: prop1 and prop2 (as well as the usual parameters)
-- If the value(s) of prop1 are of type "wikibase-item" then it returns the value(s) of prop2
-- of each of those wikibase-items.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p._getPropOfProp = function(args)
-- parameter sets for commonly used groups of parameters
local paraset = tonumber(args.ps or args.parameterset or 0)
if paraset == 1 then
-- a common setting
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
elseif paraset == 2 then
-- equivalent to raw
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
args.linked = "no"
args.pd = "true"
elseif paraset == 3 then
-- third set goes here
end
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
local pid1 = args.prop1 or args.pid1 or ""
local pid2 = args.prop2 or args.pid2 or ""
if pid1 == "" or pid2 == "" then return nil end
local f = {}
f.args = args
local qid1, statements1 = parseInput(f, args[1], pid1)
-- parseInput nulls empty args[1] and returns args[1] if nothing on Wikidata
if not qid1 then return statements1 end
-- otherwise it returns the qid and a table for the statement
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
local out = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
local snak = v.mainsnak
if snak.datatype == "wikibase-item" and snak.snaktype == "value" then
local qid2 = snak.datavalue.value.id
local statements2 = {}
if args.reqranks.b then
statements2 = mw.wikibase.getBestStatements(qid2, pid2)
else
statements2 = mw.wikibase.getAllStatements(qid2, pid2)
end
if statements2[1] then
local out2 = propertyvalueandquals(statements2, args, qualID)
out[#out+1] = assembleoutput(out2, args, qid2, pid2)
end
end -- of test for valid property1 value
end -- of test for sourced
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of property1
return assembleoutput(out, args, qid1, pid1)
end
p.getPropOfProp = function(frame)
local args= frame.args
if not args.prop1 and not args.pid1 then
args = frame:getParent().args
if not args.prop1 and not args.pid1 then return i18n.errors["No property supplied"] end
end
return p._getPropOfProp(args)
end
-------------------------------------------------------------------------------
-- getAwardCat takes most of the usual parameters. If the item has values of P166 (award received),
-- then it examines each of those awards for P2517 (category for recipients of this award).
-- If it exists, it returns the corresponding category,
-- with the item's P734 (family name) as sort key, or no sort key if there is no family name.
-- The sort key may be overridden by the parameter |sortkey (alias |sk).
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getAwardCat = function(frame)
frame.args.reqranks = setRanks(frame.args.rank)
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
args.sep = " "
local pid1 = args.prop1 or "P166"
local pid2 = args.prop2 or "P2517"
if pid1 == "" or pid2 == "" then return nil end
-- locally supplied value:
local localval = mw.text.trim(args[1] or "")
local qid1, statements1 = parseInput(frame, localval, pid1)
if not qid1 then return localval end
-- linkprefix (strip quotes)
local lp = (args.linkprefix or args.lp or ""):gsub('"', '')
-- sort key (strip quotes, hyphens and periods):
local sk = (args.sortkey or args.sk or ""):gsub('["-.]', '')
-- family name:
local famname = ""
if sk == "" then
local p734 = mw.wikibase.getBestStatements(qid1, "P734")[1]
local p734id = p734 and p734.mainsnak.snaktype == "value" and p734.mainsnak.datavalue.value.id or ""
famname = mw.wikibase.getSitelink(p734id) or ""
-- strip namespace and disambigation
local pos = famname:find(":") or 0
famname = famname:sub(pos+1):gsub("%s%(.+%)$", "")
if famname == "" then
local lbl = mw.wikibase.getLabel(p734id)
famname = lbl and mw.text.nowiki(lbl) or ""
end
end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
local out = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
local snak = v.mainsnak
if snak.datatype == "wikibase-item" and snak.snaktype == "value" then
local qid2 = snak.datavalue.value.id
local statements2 = {}
if args.reqranks.b then
statements2 = mw.wikibase.getBestStatements(qid2, pid2)
else
statements2 = mw.wikibase.getAllStatements(qid2, pid2)
end
if statements2[1] and statements2[1].mainsnak.snaktype == "value" then
local qid3 = statements2[1].mainsnak.datavalue.value.id
local sitelink = mw.wikibase.getSitelink(qid3)
-- if there's no local sitelink, create the sitelink from English label
if not sitelink then
local lbl = mw.wikibase.getLabelByLang(qid3, "en")
if lbl then
if lbl:sub(1,9) == "Category:" then
sitelink = mw.text.nowiki(lbl)
else
sitelink = "Category:" .. mw.text.nowiki(lbl)
end
end
end
if sitelink then
if sk ~= "" then
out[#out+1] = "[[" .. lp .. sitelink .. "|" .. sk .. "]]"
elseif famname ~= "" then
out[#out+1] = "[[" .. lp .. sitelink .. "|" .. famname .. "]]"
else
out[#out+1] = "[[" .. lp .. sitelink .. "]]"
end -- of check for sort keys
end -- of test for sitelink
end -- of test for category
end -- of test for wikibase item has a value
end -- of test for sourced
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of property1
return assembleoutput(out, args, qid1, pid1)
end
-------------------------------------------------------------------------------
-- getIntersectCat takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-- It takes two properties, |prop1 and |prop2 (e.g. occupation and country of citizenship)
-- Each property's value is a wiki-base entity
-- For each value of the first parameter (ranks implemented) it fetches the value's main category
-- and then each value of the second parameter (possibly substituting a simpler description)
-- then it returns all of the categories representing the intersection of those properties,
-- (e.g. Category:Actors from Canada). A joining term may be supplied (e.g. |join=from).
-- The item's P734 (family name) is the sort key, or no sort key if there is no family name.
-- The sort key may be overridden by the parameter |sortkey (alias |sk).
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getIntersectCat = function(frame)
frame.args.reqranks = setRanks(frame.args.rank)
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
args.sep = " "
args.linked = "no"
local pid1 = args.prop1 or "P106"
local pid2 = args.prop2 or "P27"
if pid1 == "" or pid2 == "" then return nil end
local qid, statements1 = parseInput(frame, "", pid1)
if not qid then return nil end
local qid, statements2 = parseInput(frame, "", pid2)
if not qid then return nil end
-- topics like countries may have different names in categories from their label in Wikidata
local subs_exists, subs = pcall(mw.loadData, "Module:WikidataIB/subs")
local join = args.join or ""
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
-- linkprefix (strip quotes)
local lp = (args.linkprefix or args.lp or ""):gsub('"', '')
-- sort key (strip quotes, hyphens and periods):
local sk = (args.sortkey or args.sk or ""):gsub('["-.]', '')
-- family name:
local famname = ""
if sk == "" then
local p734 = mw.wikibase.getBestStatements(qid, "P734")[1]
local p734id = p734 and p734.mainsnak.snaktype == "value" and p734.mainsnak.datavalue.value.id or ""
famname = mw.wikibase.getSitelink(p734id) or ""
-- strip namespace and disambigation
local pos = famname:find(":") or 0
famname = famname:sub(pos+1):gsub("%s%(.+%)$", "")
if famname == "" then
local lbl = mw.wikibase.getLabel(p734id)
famname = lbl and mw.text.nowiki(lbl) or ""
end
end
local cat1 = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
-- get the ID representing the value of the property
local pvalID = (v.mainsnak.snaktype == "value") and v.mainsnak.datavalue.value.id
if pvalID then
-- get the topic's main category (P910) for that entity
local p910 = mw.wikibase.getBestStatements(pvalID, "P910")[1]
if p910 and p910.mainsnak.snaktype == "value" then
local tmcID = p910.mainsnak.datavalue.value.id
-- use sitelink or the English label for the cat
local cat = mw.wikibase.getSitelink(tmcID)
if not cat then
local lbl = mw.wikibase.getLabelByLang(tmcID, "en")
if lbl then
if lbl:sub(1,9) == "Category:" then
cat = mw.text.nowiki(lbl)
else
cat = "Category:" .. mw.text.nowiki(lbl)
end
end
end
cat1[#cat1+1] = cat
end -- of test for topic's main category exists
end -- of test for property has vaild value
end -- of test for sourced
if maxvals > 0 and #cat1 >= maxvals then break end
end
local cat2 = {}
for k, v in ipairs(statements2) do
if not onlysrc or sourced(v) then
local cat = rendersnak(v, args)
if subs[cat] then cat = subs[cat] end
cat2[#cat2+1] = cat
end
if maxvals > 0 and #cat2 >= maxvals then break end
end
local out = {}
for k1, v1 in ipairs(cat1) do
for k2, v2 in ipairs(cat2) do
if sk ~= "" then
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "|" .. sk .. "]]"
elseif famname ~= "" then
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "|" .. famname .. "]]"
else
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "]]"
end -- of check for sort keys
end
end
args.noicon = "true"
return assembleoutput(out, args, qid, pid1)
end
-------------------------------------------------------------------------------
-- qualsToTable takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- A qid may be given, and the first unnamed parameter is the property ID, which is of type wikibase item.
-- It takes a list of qualifier property IDs as |quals=
-- For a given qid and property, it creates the rows of an html table,
-- each row being a value of the property (optionally only if the property matches the value in |pval= )
-- each cell being the first value of the qualifier corresponding to the list in |quals
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced;
-------------------------------------------------------------------------------
p.qualsToTable = function(frame)
local args = frame.args
local quals = args.quals or ""
if quals == "" then return "" end
args.reqranks = setRanks(args.rank)
local propertyID = mw.text.trim(args[1] or "")
local f = {}
f.args = args
local entityid, props = parseInput(f, "", propertyID)
if not entityid then return "" end
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
local pval = args.pval or ""
local qplist = mw.text.split(quals, "%p") -- split at punctuation and make a sequential table
for i, v in ipairs(qplist) do
qplist[i] = mw.text.trim(v):upper() -- remove whitespace and capitalise
end
local col1 = args.firstcol or ""
if col1 ~= "" then
col1 = col1 .. "</td><td>"
end
local emptycell = args.emptycell or " "
-- construct a 2-D array of qualifier values in qvals
local qvals = {}
for i, v in ipairs(props) do
local skip = false
if pval ~= "" then
local pid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
if pid ~= pval then skip = true end
end
if not skip then
local qval = {}
local vqualifiers = v.qualifiers or {}
-- go through list of wanted qualifier properties
for i1, v1 in ipairs(qplist) do
-- check for that property ID in the statement's qualifiers
local qv, qtype
if vqualifiers[v1] then
qtype = vqualifiers[v1][1].datatype
if qtype == "time" then
if vqualifiers[v1][1].snaktype == "value" then
qv = mw.wikibase.renderSnak(vqualifiers[v1][1])
qv = frame:expandTemplate{title="dts", args={qv}}
else
qv = "?"
end
elseif qtype == "url" then
if vqualifiers[v1][1].snaktype == "value" then
qv = mw.wikibase.renderSnak(vqualifiers[v1][1])
local display = mw.ustring.match( mw.uri.decode(qv, "WIKI"), "([%w ]+)$" )
if display then
qv = "[" .. qv .. " " .. display .. "]"
end
end
else
qv = mw.wikibase.formatValue(vqualifiers[v1][1])
end
end
-- record either the value or a placeholder
qval[i1] = qv or emptycell
end -- of loop through list of qualifiers
-- add the list of qualifier values as a "row" in the main list
qvals[#qvals+1] = qval
end
end -- of for each value loop
local out = {}
for i, v in ipairs(qvals) do
out[i] = "<tr><td>" .. col1 .. table.concat(qvals[i], "</td><td>") .. "</td></tr>"
end
return table.concat(out, "\n")
end
-------------------------------------------------------------------------------
-- getGlobe takes an optional qid of a Wikidata entity passed as |qid=
-- otherwise it uses the linked item for the current page.
-- If returns the Qid of the globe used in P625 (coordinate location),
-- or nil if there isn't one.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getGlobe = function(frame)
local qid = frame.args.qid or frame.args[1] or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
local coords = mw.wikibase.getBestStatements(qid, "P625")[1]
local globeid
if coords and coords.mainsnak.snaktype == "value" then
globeid = coords.mainsnak.datavalue.value.globe:match("(Q%d+)")
end
return globeid
end
-------------------------------------------------------------------------------
-- getCommonsLink takes an optional qid of a Wikidata entity passed as |qid=
-- It returns one of the following in order of preference:
-- the Commons sitelink of the linked Wikidata item;
-- the Commons sitelink of the topic's main category of the linked Wikidata item;
-------------------------------------------------------------------------------
-- Dependencies: _getCommonslink(); _getSitelink(); parseParam()
-------------------------------------------------------------------------------
p.getCommonsLink = function(frame)
local oc = frame.args.onlycat or frame.args.onlycategories
local fb = parseParam(frame.args.fallback or frame.args.fb, true)
return _getCommonslink(frame.args.qid, oc, fb)
end
-------------------------------------------------------------------------------
-- getSitelink takes the qid of a Wikidata entity passed as |qid=
-- It takes an optional parameter |wiki= to determine which wiki is to be checked for a sitelink
-- If the parameter is blank, then it uses the local wiki.
-- If there is a sitelink to an article available, it returns the plain text link to the article
-- If there is no sitelink, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getSiteLink = function(frame)
return _getSitelink(frame.args.qid, frame.args.wiki or mw.text.trim(frame.args[1] or ""))
end
-------------------------------------------------------------------------------
-- getLink has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- If there is a sitelink to an article on the local Wiki, it returns a link to the article
-- with the Wikidata label as the displayed text.
-- If there is no sitelink, it returns the label as plain text.
-- If there is no label in the local language, it displays the qid instead.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLink = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
local sitelink = mw.wikibase.getSitelink(itemID)
local label = labelOrId(itemID)
if sitelink then
return "[[:" .. sitelink .. "|" .. label .. "]]"
else
return label
end
end
-------------------------------------------------------------------------------
-- getLabel has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- It returns the Wikidata label for the local language as plain text.
-- If there is no label in the local language, it displays the qid instead.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLabel = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
local lang = frame.args.lang or ""
if lang == "" then lang = nil end
local label = labelOrId(itemID, lang)
return label
end
-------------------------------------------------------------------------------
-- label has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- if no qid is supplied, it uses the qid associated with the current page.
-- It returns the Wikidata label for the local language as plain text.
-- If there is no label in the local language, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.label = function(frame)
local qid = mw.text.trim(frame.args[1] or frame.args.qid or "")
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return end
local lang = frame.args.lang or ""
if lang == "" then lang = nil end
local label, success = labelOrId(qid, lang)
if success then return label end
end
-------------------------------------------------------------------------------
-- getAT (Article Title)
-- has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text.
-- If there is no sitelink or qid supplied, it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAT = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
return mw.wikibase.getSitelink(itemID)
end
-------------------------------------------------------------------------------
-- getDescription has the qid of a Wikidata entity passed as |qid=
-- (it defaults to the associated qid of the current article if omitted)
-- and a local parameter passed as the first unnamed parameter.
-- Any local parameter passed (other than "Wikidata" or "none") becomes the return value.
-- It returns the article description for the Wikidata entity if the local parameter is "Wikidata".
-- Nothing is returned if the description doesn't exist or "none" is passed as the local parameter.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getDescription = function(frame)
local desc = mw.text.trim(frame.args[1] or "")
local itemID = mw.text.trim(frame.args.qid or "")
if itemID == "" then itemID = nil end
if desc:lower() == 'wikidata' then
return mw.wikibase.getDescription(itemID)
elseif desc:lower() == 'none' then
return nil
else
return desc
end
end
-------------------------------------------------------------------------------
-- getAliases has the qid of a Wikidata entity passed as |qid=
-- (it defaults to the associated qid of the current article if omitted)
-- and a local parameter passed as the first unnamed parameter.
-- It implements blacklisting and whitelisting with a field name of "alias" by default.
-- Any local parameter passed becomes the return value.
-- Otherwise it returns the aliases for the Wikidata entity with the usual list options.
-- Nothing is returned if the aliases do not exist.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); assembleoutput()
-------------------------------------------------------------------------------
p.getAliases = function(frame)
local args = frame.args
local fieldname = args.name or ""
if fieldname == "" then fieldname = "alias" end
local blacklist = args.suppressfields or args.spf or ""
if blacklist:find(fieldname) then return nil end
local localval = mw.text.trim(args[1] or "")
if localval ~= "" then return localval end
local whitelist = args.fetchwikidata or args.fwd or ""
if whitelist == "" then whitelist = "NONE" end
if not (whitelist == 'ALL' or whitelist:find(fieldname)) then return nil end
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return nil end
local aliases = mw.wikibase.getEntity(qid).aliases
if not aliases then return nil end
args.langobj = findLang(args.lang)
local langcode = args.langobj.code
args.lang = langcode
local out = {}
for k1, v1 in pairs(aliases) do
if v1[1].language == langcode then
for k1, v2 in ipairs(v1) do
out[#out+1] = v2.value
end
break
end
end
return assembleoutput(out, args, qid)
end
-------------------------------------------------------------------------------
-- pageId returns the page id (entity ID, Qnnn) of the current page
-- returns nothing if the page is not connected to Wikidata
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.pageId = function(frame)
return mw.wikibase.getEntityIdForCurrentPage()
end
-------------------------------------------------------------------------------
-- formatDate is a wrapper to export the private function format_Date
-------------------------------------------------------------------------------
-- Dependencies: format_Date();
-------------------------------------------------------------------------------
p.formatDate = function(frame)
return format_Date(frame.args[1], frame.args.df, frame.args.bc)
end
-------------------------------------------------------------------------------
-- location is a wrapper to export the private function _location
-- it takes the entity-id as qid or the first unnamed parameter
-- optional boolean parameter first toggles the display of the first item
-- optional boolean parameter skip toggles the display to skip to the last item
-- parameter debug=<y/n> (default 'n') adds error msg if not a location
-------------------------------------------------------------------------------
-- Dependencies: _location();
-------------------------------------------------------------------------------
p.location = function(frame)
local debug = (frame.args.debug or ""):sub(1, 1):lower()
if debug == "" then debug = "n" end
local qid = mw.text.trim(frame.args.qid or frame.args[1] or ""):upper()
if qid == "" then qid=mw.wikibase.getEntityIdForCurrentPage() end
if not qid then
if debug ~= "n" then
return i18n.errors["entity-not-found"]
else
return nil
end
end
local first = mw.text.trim(frame.args.first or "")
local skip = mw.text.trim(frame.args.skip or "")
return table.concat( _location(qid, first, skip), ", " )
end
-------------------------------------------------------------------------------
-- checkBlacklist implements a test to check whether a named field is allowed
-- returns true if the field is not blacklisted (i.e. allowed)
-- returns false if the field is blacklisted (i.e. disallowed)
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Joe |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}
-- displays "blacklisted"
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Jim |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}
-- displays "not blacklisted"
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.checkBlacklist = function(frame)
local blacklist = frame.args.suppressfields or frame.args.spf or ""
local fieldname = frame.args.name or ""
if blacklist ~= "" and fieldname ~= "" then
if blacklist:find(fieldname) then
return false
else
return true
end
else
-- one of the fields is missing: let's call that "not on the list"
return true
end
end
-------------------------------------------------------------------------------
-- emptyor returns nil if its first unnamed argument is just punctuation, whitespace or html tags
-- otherwise it returns the argument unchanged (including leading/trailing space).
-- If the argument may contain "=", then it must be called explicitly:
-- |1=arg
-- (In that case, leading and trailing spaces are trimmed)
-- It finds use in infoboxes where it can replace tests like:
-- {{#if: {{#invoke:WikidatIB |getvalue |P99 |fwd=ALL}} | <span class="xxx">{{#invoke:WikidatIB |getvalue |P99 |fwd=ALL}}</span> | }}
-- with a form that uses just a single call to Wikidata:
-- {{#invoke |WikidataIB |emptyor |1= <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> }}
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.emptyor = function(frame)
local s = frame.args[1] or ""
if s == "" then return nil end
local sx = s:gsub("%s", ""):gsub("<[^>]*>", ""):gsub("%p", "")
if sx == "" then
return nil
else
return s
end
end
-------------------------------------------------------------------------------
-- labelorid is a public function to expose the output of labelOrId()
-- Pass the Q-number as |qid= or as an unnamed parameter.
-- It returns the Wikidata label for that entity or the qid if no label exists.
-------------------------------------------------------------------------------
-- Dependencies: labelOrId
-------------------------------------------------------------------------------
p.labelorid = function(frame)
return (labelOrId(frame.args.qid or frame.args[1]))
end
-------------------------------------------------------------------------------
-- getLang returns the MediaWiki language code of the current content.
-- If optional parameter |style=full, it returns the language name.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLang = function(frame)
local style = (frame.args.style or ""):lower()
local langcode = mw.language.getContentLanguage().code
if style == "full" then
return mw.language.fetchLanguageName( langcode )
end
return langcode
end
-------------------------------------------------------------------------------
-- getItemLangCode takes a qid parameter (using the current page's qid if blank)
-- If the item for that qid has property country (P17) it looks at the first preferred value
-- If the country has an official language (P37), it looks at the first preferred value
-- If that official language has a language code (P424), it returns the first preferred value
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: _getItemLangCode()
-------------------------------------------------------------------------------
p.getItemLangCode = function(frame)
return _getItemLangCode(frame.args.qid or frame.args[1])
end
-------------------------------------------------------------------------------
-- findLanguage exports the local findLang() function
-- It takes an optional language code and returns, in order of preference:
-- the code if a known language;
-- the user's language, if set;
-- the server's content language.
-------------------------------------------------------------------------------
-- Dependencies: findLang
-------------------------------------------------------------------------------
p.findLanguage = function(frame)
return findLang(frame.args.lang or frame.args[1]).code
end
-------------------------------------------------------------------------------
-- getQid returns the qid, if supplied
-- failing that, the Wikidata entity ID of the "category's main topic (P301)", if it exists
-- failing that, the Wikidata entity ID associated with the current page, if it exists
-- otherwise, nothing
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getQid = function(frame)
local qid = (frame.args.qid or ""):upper()
-- check if a qid was passed; if so, return it:
if qid ~= "" then return qid end
-- check if there's a "category's main topic (P301)":
qid = mw.wikibase.getEntityIdForCurrentPage()
if qid then
local prop301 = mw.wikibase.getBestStatements(qid, "P301")
if prop301[1] then
local mctid = prop301[1].mainsnak.datavalue.value.id
if mctid then return mctid end
end
end
-- otherwise return the page qid (if any)
return qid
end
-------------------------------------------------------------------------------
-- followQid takes four optional parameters: qid, props, list and all.
-- If qid is not given, it uses the qid for the connected page
-- or returns nil if there isn't one.
-- props is a list of properties, separated by punctuation.
-- If props is given, the Wikidata item for the qid is examined for each property in turn.
-- If that property contains a value that is another Wikibase-item, that item's qid is returned,
-- and the search terminates, unless |all=y when all of the qids are returned, separated by spaces.
-- If |list= is set to a template, the qids are passed as arguments to the template.
-- If props is not given, the qid is returned.
-------------------------------------------------------------------------------
-- Dependencies: parseParam()
-------------------------------------------------------------------------------
p._followQid = function(args)
local qid = (args.qid or ""):upper()
local all = parseParam(args.all, false)
local list = args.list or ""
if list == "" then list = nil end
if qid == "" then
qid = mw.wikibase.getEntityIdForCurrentPage()
end
if not qid then return nil end
local out = {}
local props = (args.props or ""):upper()
if props ~= "" then
for p in mw.text.gsplit(props, "%p") do -- split at punctuation and iterate
p = mw.text.trim(p)
for i, v in ipairs( mw.wikibase.getBestStatements(qid, p) ) do
local linkedid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
if linkedid then
if all then
out[#out+1] = linkedid
else
return linkedid
end -- test for all or just the first one found
end -- test for value exists for that property
end -- loop through values of property to follow
end -- loop through list of properties to follow
end
if #out > 0 then
local ret = ""
if list then
ret = mw.getCurrentFrame():expandTemplate{title = list, args = out}
else
ret = table.concat(out, " ")
end
return ret
else
return qid
end
end
p.followQid = function(frame)
return p._followQid(frame.args)
end
-------------------------------------------------------------------------------
-- globalSiteID returns the globalSiteID for the current wiki
-- e.g. returns "enwiki" for the English Wikipedia, "enwikisource" for English Wikisource, etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.globalSiteID = function(frame)
return mw.wikibase.getGlobalSiteId()
end
-------------------------------------------------------------------------------
-- siteID returns the root of the globalSiteID
-- e.g. "en" for "enwiki", "enwikisource", etc.
-- treats "en-gb" as "en", etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.siteID = function(frame)
local txtlang = frame:callParserFunction('int', {'lang'}) or ""
-- This deals with specific exceptions: be-tarask -> be-x-old
if txtlang == "be-tarask" then
return "be_x_old"
end
local pos = txtlang:find("-")
local ret = ""
if pos then
ret = txtlang:sub(1, pos-1)
else
ret = txtlang
end
return ret
end
-------------------------------------------------------------------------------
-- projID returns the code used to link to the reader's language's project
-- e.g "en" for [[:en:WikidataIB]]
-- treats "en-gb" as "en", etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.projID = function(frame)
local txtlang = frame:callParserFunction('int', {'lang'}) or ""
-- This deals with specific exceptions: be-tarask -> be-x-old
if txtlang == "be-tarask" then
return "be-x-old"
end
local pos = txtlang:find("-")
local ret = ""
if pos then
ret = txtlang:sub(1, pos-1)
else
ret = txtlang
end
return ret
end
-------------------------------------------------------------------------------
-- formatNumber formats a number according to the the supplied language code ("|lang=")
-- or the default language if not supplied.
-- The number is the first unnamed parameter or "|num="
-------------------------------------------------------------------------------
-- Dependencies: findLang()
-------------------------------------------------------------------------------
p.formatNumber = function(frame)
local lang
local num = tonumber(frame.args[1] or frame.args.num) or 0
lang = findLang(frame.args.lang)
return lang:formatNum( num )
end
-------------------------------------------------------------------------------
-- examine dumps the property (the unnamed parameter or pid)
-- from the item given by the parameter 'qid' (or the other unnamed parameter)
-- or from the item corresponding to the current page if qid is not supplied.
-- e.g. {{#invoke:WikidataIB |examine |pid=P26 |qid=Q42}}
-- or {{#invoke:WikidataIB |examine |P26 |Q42}} or any combination of these
-- or {{#invoke:WikidataIB |examine |P26}} for the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.examine = function( frame )
local args
if frame.args[1] or frame.args.pid or frame.args.qid then
args = frame.args
else
args = frame:getParent().args
end
local par = {}
local pid = (args.pid or ""):upper()
local qid = (args.qid or ""):upper()
par[1] = mw.text.trim( args[1] or "" ):upper()
par[2] = mw.text.trim( args[2] or "" ):upper()
table.sort(par)
if par[2]:sub(1,1) == "P" then par[1], par[2] = par[2], par[1] end
if pid == "" then pid = par[1] end
if qid == "" then qid = par[2] end
local q1 = qid:sub(1,1)
if pid:sub(1,1) ~= "P" then return "No property supplied" end
if q1 ~= "Q" and q1 ~= "M" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return "No item for this page" end
return "<pre>" .. mw.dumpObject( mw.wikibase.getAllStatements( qid, pid ) ) .. "</pre>"
end
-------------------------------------------------------------------------------
-- checkvalue looks for 'val' as a wikibase-item value of a property (the unnamed parameter or pid)
-- from the item given by the parameter 'qid'
-- or from the Wikidata item associated with the current page if qid is not supplied.
-- It only checks ranks that are requested (preferred and normal by default)
-- If property is not supplied, then P31 (instance of) is assumed.
-- It returns val if found or nothing if not found.
-- e.g. {{#invoke:WikidataIB |checkvalue |val=Q5 |pid=P31 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |P31 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |P31}} for the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.checkvalue = function( frame )
local args
if frame.args.val then
args = frame.args
else
args = frame:getParent().args
end
local val = args.val
if not val then return nil end
local pid = mw.text.trim(args.pid or args[1] or "P31"):upper()
local qid = (args.qid or ""):upper()
if pid:sub(1,1) ~= "P" then return nil end
if qid:sub(1,1) ~= "Q" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
local ranks = setRanks(args.rank)
local stats = {}
if ranks.b then
stats = mw.wikibase.getBestStatements(qid, pid)
else
stats = mw.wikibase.getAllStatements( qid, pid )
end
if not stats[1] then return nil end
if stats[1].mainsnak.datatype == "wikibase-item" then
for k, v in pairs( stats ) do
local ms = v.mainsnak
if ranks[v.rank:sub(1,1)] and ms.snaktype == "value" and ms.datavalue.value.id == val then
return val
end
end
end
return nil
end
-------------------------------------------------------------------------------
-- url2 takes a parameter url= that is a proper url and formats it for use in an infobox.
-- If no parameter is supplied, it returns nothing.
-- This is the equivalent of Template:URL
-- but it keeps the "edit at Wikidata" pen icon out of the microformat.
-- Usually it will take its url parameter directly from a Wikidata call:
-- e.g. {{#invoke:WikidataIB |url2 |url={{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}} }}
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.url2 = function(frame)
local txt = frame.args.url or ""
if txt == "" then return nil end
-- extract any icon
local url, icon = txt:match("(.+) (.+)")
-- make sure there's at least a space at the end
url = (url or txt) .. " "
icon = icon or ""
-- extract any protocol like https://
local prot = url:match("(https*://).+[ \"\']")
-- extract address
local addr = ""
if prot then
addr = url:match("https*://(.+)[ \"\']") or " "
else
prot = "//"
addr = url:match("[^%p%s]+%.(.+)[ \"\']") or " "
end
-- strip trailing / from end of domain-only url and add <wbr/> before . and /
local disp, n = addr:gsub( "^([^/]+)/$", "%1" ):gsub("%/", "<wbr/>/"):gsub("%.", "<wbr/>.")
return '<span class="url">[' .. prot .. addr .. " " .. disp .. "]</span> " .. icon
end
-------------------------------------------------------------------------------
-- getWebsite fetches the Official website (P856) and formats it for use in an infobox.
-- This is similar to Template:Official website but with a url displayed,
-- and it adds the "edit at Wikidata" pen icon beyond the microformat if enabled.
-- A local value will override the Wikidata value. "NONE" returns nothing.
-- e.g. {{#invoke:WikidataIB |getWebsite |qid= |noicon= |lang= |url= }}
-------------------------------------------------------------------------------
-- Dependencies: findLang(); parseParam();
-------------------------------------------------------------------------------
p.getWebsite = function(frame)
local url = frame.args.url or ""
if url:upper() == "NONE" then return nil end
local urls = {}
local quals = {}
local qid = frame.args.qid or ""
if url and url ~= "" then
urls[1] = url
else
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
local prop856 = mw.wikibase.getBestStatements(qid, "P856")
for k, v in pairs(prop856) do
if v.mainsnak.snaktype == "value" then
urls[#urls+1] = v.mainsnak.datavalue.value
if v.qualifiers and v.qualifiers["P1065"] then
-- just take the first archive url (P1065)
local au = v.qualifiers["P1065"][1]
if au.snaktype == "value" then
quals[#urls] = au.datavalue.value
end -- test for archive url having a value
end -- test for qualifers
end -- test for website having a value
end -- loop through website(s)
end
if #urls == 0 then return nil end
local out = {}
for i, u in ipairs(urls) do
local link = quals[i] or u
local prot, addr = u:match("(http[s]*://)(.+)")
addr = addr or u
local disp, n = addr:gsub("%.", "<wbr/>%.")
out[#out+1] = '<span class="url">[' .. link .. " " .. disp .. "]</span>"
end
local langcode = findLang(frame.args.lang).code
local noicon = parseParam(frame.args.noicon, false)
if url == "" and not noicon then
out[#out] = out[#out] .. createicon(langcode, qid, "P856")
end
local ret = ""
if #out > 1 then
ret = mw.getCurrentFrame():expandTemplate{title = "ubl", args = out}
else
ret = out[1]
end
return ret
end
-------------------------------------------------------------------------------
-- getAllLabels fetches the set of labels and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllLabels = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local labels = mw.wikibase.getEntity(qid).labels
if not labels then return i18n["labels-not-found"] end
local out = {}
for k, v in pairs(labels) do
out[#out+1] = v.value .. " (" .. v.language .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- getAllDescriptions fetches the set of descriptions and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllDescriptions = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local descriptions = mw.wikibase.getEntity(qid).descriptions
if not descriptions then return i18n["descriptions-not-found"] end
local out = {}
for k, v in pairs(descriptions) do
out[#out+1] = v.value .. " (" .. v.language .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- getAllAliases fetches the set of aliases and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllAliases = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local aliases = mw.wikibase.getEntity(qid).aliases
if not aliases then return i18n["aliases-not-found"] end
local out = {}
for k1, v1 in pairs(aliases) do
local lang = v1[1].language
local val = {}
for k1, v2 in ipairs(v1) do
val[#val+1] = v2.value
end
out[#out+1] = table.concat(val, ", ") .. " (" .. lang .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- showNoLinks displays the article titles that should not be linked.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.showNoLinks = function(frame)
local out = {}
for k, v in pairs(donotlink) do
out[#out+1] = k
end
table.sort( out )
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- checkValidity checks whether the first unnamed parameter represents a valid entity-id,
-- that is, something like Q1235 or P123.
-- It returns the strings "true" or "false".
-- Change false to nil to return "true" or "" (easier to test with #if:).
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
function p.checkValidity(frame)
local id = mw.text.trim(frame.args[1] or "")
if mw.wikibase.isValidEntityId(id) then
return true
else
return false
end
end
-------------------------------------------------------------------------------
-- getEntityFromTitle returns the Entity-ID (Q-number) for a given title.
-- Modification of Module:ResolveEntityId
-- The title is the first unnamed parameter.
-- The site parameter determines the site/language for the title. Defaults to current wiki.
-- The showdab parameter determines whether dab pages should return the Q-number or nil. Defaults to true.
-- Returns the Q-number or nil if it does not exist.
-------------------------------------------------------------------------------
-- Dependencies: parseParam
-------------------------------------------------------------------------------
function p.getEntityFromTitle(frame)
local args=frame.args
if not args[1] then args=frame:getParent().args end
if not args[1] then return nil end
local title = mw.text.trim(args[1])
local site = args.site or ""
local showdab = parseParam(args.showdab, true)
local qid = mw.wikibase.getEntityIdForTitle(title, site)
if qid then
local prop31 = mw.wikibase.getBestStatements(qid, "P31")[1]
if not showdab and prop31 and prop31.mainsnak.datavalue.value.id == "Q4167410" then
return nil
else
return qid
end
end
end
-------------------------------------------------------------------------------
-- getDatePrecision returns the number representing the precision of the first best date value
-- for the given property.
-- It takes the qid and property ID
-- The meanings are given at https://www.mediawiki.org/wiki/Wikibase/DataModel#Dates_and_times
-- 0 = 1 billion years .. 6 = millennium, 7 = century, 8 = decade, 9 = year, 10 = month, 11 = day
-- Returns 0 (or the second unnamed parameter) if the Wikidata does not exist.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; sourced;
-------------------------------------------------------------------------------
function p.getDatePrecision(frame)
local args=frame.args
if not args[1] then args=frame:getParent().args end
local default = tonumber(args[2] or args.default) or 0
local prop = mw.text.trim(args[1] or "")
if prop == "" then return default end
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return default end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local stat = mw.wikibase.getBestStatements(qid, prop)
for i, v in ipairs(stat) do
local prec = (onlysrc == false or sourced(v))
and v.mainsnak.datavalue
and v.mainsnak.datavalue.value
and v.mainsnak.datavalue.value.precision
if prec then return prec end
end
return default
end
return p
-------------------------------------------------------------------------------
-- List of exported functions
-------------------------------------------------------------------------------
--[[
_getValue
getValue
getPreferredValue
getCoords
getQualifierValue
getSumOfParts
getValueByQual
getValueByLang
getValueByRefSource
getPropertyIDs
getQualifierIDs
getPropOfProp
getAwardCat
getIntersectCat
getGlobe
getCommonsLink
getSiteLink
getLink
getLabel
label
getAT
getDescription
getAliases
pageId
formatDate
location
checkBlacklist
emptyor
labelorid
getLang
getItemLangCode
findLanguage
getQID
followQid
globalSiteID
siteID
projID
formatNumber
examine
checkvalue
url2
getWebsite
getAllLabels
getAllDescriptions
getAllAliases
showNoLinks
checkValidity
getEntityFromTitle
getDatePrecision
--]]
-------------------------------------------------------------------------------
ql7i3j6aywa93pfslfr0svyicj7ctkn
74895
74894
2026-08-24T00:42:43Z
Robertsky
10424
1 versaun husi [[:en:Module:WikidataIB/sandbox]]
74894
Scribunto
text/plain
-- Version: 2023-07-10
-- Module to implement use of a blacklist and whitelist for infobox fields
-- Can take a named parameter |qid which is the Wikidata ID for the article
-- if not supplied, it will use the Wikidata ID associated with the current page.
-- Fields in blacklist are never to be displayed, i.e. module must return nil in all circumstances
-- Fields in whitelist return local value if it exists or the Wikidata value otherwise
-- The name of the field that this function is called from is passed in named parameter |name
-- The name is compulsory when blacklist or whitelist is used,
-- so the module returns nil if it is not supplied.
-- blacklist is passed in named parameter |suppressfields (or |spf)
-- whitelist is passed in named parameter |fetchwikidata (or |fwd)
require("strict")
local p = {}
local cdate -- initialise as nil and only load _complex_date function if needed
-- Module:Complex date is loaded lazily and has the following dependencies:
-- Module:Calendar
-- Module:ISOdate
-- Module:DateI18n
-- Module:I18n/complex date
-- Module:Ordinal
-- Module:I18n/ordinal
-- Module:Yesno
-- Module:Formatnum
-- Module:Linguistic
--
-- The following, taken from https://www.mediawiki.org/wiki/Wikibase/DataModel#Dates_and_times,
-- is needed to use Module:Complex date which seemingly requires date precision as a string.
-- It would work better if only the authors of the mediawiki page could spell 'millennium'.
local dp = {
[6] = "millennium",
[7] = "century",
[8] = "decade",
[9] = "year",
[10] = "month",
[11] = "day",
}
local i18n =
{
["errors"] =
{
["property-not-found"] = "Property not found.",
["No property supplied"] = "No property supplied",
["entity-not-found"] = "Wikidata entity not found.",
["unknown-claim-type"] = "Unknown claim type.",
["unknown-entity-type"] = "Unknown entity type.",
["qualifier-not-found"] = "Qualifier not found.",
["site-not-found"] = "Wikimedia project not found.",
["labels-not-found"] = "No labels found.",
["descriptions-not-found"] = "No descriptions found.",
["aliases-not-found"] = "No aliases found.",
["unknown-datetime-format"] = "Unknown datetime format.",
["local-article-not-found"] = "Article is available on Wikidata, but not on Wikipedia",
["dab-page"] = " (dab)",
},
["months"] =
{
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
},
["century"] = "century",
["BC"] = "BC",
["BCE"] = "BCE",
["ordinal"] =
{
[1] = "st",
[2] = "nd",
[3] = "rd",
["default"] = "th"
},
["filespace"] = "File",
["Unknown"] = "Unknown",
["NaN"] = "Not a number",
-- set the following to the name of a tracking category,
-- e.g. "[[Category:Articles with missing Wikidata information]]", or "" to disable:
["missinginfocat"] = "[[Category:Articles with missing Wikidata information]]",
["editonwikidata"] = "Edit this on Wikidata",
["latestdatequalifier"] = function (date) return "before " .. date end,
-- some languages, e.g. Bosnian use a period as a suffix after each number in a date
["datenumbersuffix"] = "",
["list separator"] = ", ",
["multipliers"] = {
[0] = "",
[3] = " thousand",
[6] = " million",
[9] = " billion",
[12] = " trillion",
}
}
-- This allows an internationisation module to override the above table
if 'en' ~= mw.getContentLanguage():getCode() then
require("Module:i18n").loadI18n("Module:WikidataIB/i18n", i18n)
end
-- This piece of html implements a collapsible container. Check the classes exist on your wiki.
local collapsediv = '<div class="mw-collapsible mw-collapsed" style="width:100%; overflow:auto;" data-expandtext="{{int:show}}" data-collapsetext="{{int:hide}}">'
-- Some items should not be linked.
-- Each wiki can create a list of those in Module:WikidataIB/nolinks
-- It should return a table called itemsindex, containing true for each item not to be linked
local donotlink = {}
local nolinks_exists, nolinks = pcall(mw.loadData, "Module:WikidataIB/nolinks")
if nolinks_exists then
donotlink = nolinks.itemsindex
end
-- To satisfy Wikipedia:Manual of Style/Titles, certain types of items are italicised, and others are quoted.
-- The submodule [[Module:WikidataIB/titleformats]] lists the entity-ids used in 'instance of' (P31),
-- which allows this module to identify the values that should be formatted.
-- WikidataIB/titleformats exports a table p.formats, which is indexed by entity-id, and contains the value " or ''
local formats = {}
local titleformats_exists, titleformats = pcall(mw.loadData, "Module:WikidataIB/titleformats")
if titleformats_exists then
formats = titleformats.formats
end
-------------------------------------------------------------------------------
-- Private functions
-------------------------------------------------------------------------------
--
-------------------------------------------------------------------------------
-- makeOrdinal needs to be internationalised along with the above:
-- takes cardinal number as a numeric and returns the ordinal as a string
-- we need three exceptions in English for 1st, 2nd, 3rd, 21st, .. 31st, etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local makeOrdinal = function(cardinal)
local ordsuffix = i18n.ordinal.default
if cardinal % 10 == 1 then
ordsuffix = i18n.ordinal[1]
elseif cardinal % 10 == 2 then
ordsuffix = i18n.ordinal[2]
elseif cardinal % 10 == 3 then
ordsuffix = i18n.ordinal[3]
end
-- In English, 1, 21, 31, etc. use 'st', but 11, 111, etc. use 'th'
-- similarly for 12 and 13, etc.
if (cardinal % 100 == 11) or (cardinal % 100 == 12) or (cardinal % 100 == 13) then
ordsuffix = i18n.ordinal.default
end
return tostring(cardinal) .. ordsuffix
end
-------------------------------------------------------------------------------
-- findLang takes a "langcode" parameter if supplied and valid
-- otherwise it tries to create it from the user's set language ({{int:lang}})
-- failing that it uses the wiki's content language.
-- It returns a language object
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local findLang = function(langcode)
local langobj
langcode = mw.text.trim(langcode or "")
if mw.language.isKnownLanguageTag(langcode) then
langobj = mw.language.new( langcode )
else
langcode = mw.getCurrentFrame():callParserFunction('int', {'lang'})
if mw.language.isKnownLanguageTag(langcode) then
langobj = mw.language.new( langcode )
else
langobj = mw.language.getContentLanguage()
end
end
return langobj
end
-------------------------------------------------------------------------------
-- _getItemLangCode takes a qid parameter (using the current page's qid if blank)
-- If the item for that qid has property country (P17) it looks at the first preferred value
-- If the country has an official language (P37), it looks at the first preferred value
-- If that official language has a language code (P424), it returns the first preferred value
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local _getItemLangCode = function(qid)
qid = mw.text.trim(qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return end
local prop17 = mw.wikibase.getBestStatements(qid, "P17")[1]
if not prop17 or prop17.mainsnak.snaktype ~= "value" then return end
local qid17 = prop17.mainsnak.datavalue.value.id
local prop37 = mw.wikibase.getBestStatements(qid17, "P37")[1]
if not prop37 or prop37.mainsnak.snaktype ~= "value" then return end
local qid37 = prop37.mainsnak.datavalue.value.id
local prop424 = mw.wikibase.getBestStatements(qid37, "P424")[1]
if not prop424 or prop424.mainsnak.snaktype ~= "value" then return end
return prop424.mainsnak.datavalue.value
end
-------------------------------------------------------------------------------
-- roundto takes a number (x)
-- and returns it rounded to (sf) significant figures
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local roundto = function(x, sf)
if x == 0 then return 0 end
local s = 1
if x < 0 then
x = -x
s = -1
end
if sf < 1 then sf = 1 end
local p = 10 ^ (math.floor(math.log10(x)) - sf + 1)
x = math.floor(x / p + 0.5) * p * s
-- if it's integral, cast to an integer:
if x == math.floor(x) then x = math.floor(x) end
return x
end
-------------------------------------------------------------------------------
-- decimalToDMS takes a decimal degrees (x) with precision (p)
-- and returns degrees/minutes/seconds according to the precision
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local decimalToDMS = function(x, p)
-- if p is not supplied, use a precision around 0.1 seconds
if not tonumber(p) then p = 1e-4 end
local d = math.floor(x)
local ms = (x - d) * 60
if p > 0.5 then -- precision is > 1/2 a degree
if ms > 30 then d = d + 1 end
ms = 0
end
local m = math.floor(ms)
local s = (ms - m) * 60
if p > 0.008 then -- precision is > 1/2 a minute
if s > 30 then m = m +1 end
s = 0
elseif p > 0.00014 then -- precision is > 1/2 a second
s = math.floor(s + 0.5)
elseif p > 0.000014 then -- precision is > 1/20 second
s = math.floor(10 * s + 0.5) / 10
elseif p > 0.0000014 then -- precision is > 1/200 second
s = math.floor(100 * s + 0.5) / 100
else -- cap it at 3 dec places for now
s = math.floor(1000 * s + 0.5) / 1000
end
return d, m, s
end
-------------------------------------------------------------------------------
-- decimalPrecision takes a decimal (x) with precision (p)
-- and returns x rounded approximately to the given precision
-- precision should be between 1 and 1e-6, preferably a power of 10.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local decimalPrecision = function(x, p)
local s = 1
if x < 0 then
x = -x
s = -1
end
-- if p is not supplied, pick an arbitrary precision
if not tonumber(p) then p = 1e-4
elseif p > 1 then p = 1
elseif p < 1e-6 then p = 1e-6
else p = 10 ^ math.floor(math.log10(p))
end
x = math.floor(x / p + 0.5) * p * s
-- if it's integral, cast to an integer:
if x == math.floor(x) then x = math.floor(x) end
-- if it's less than 1e-4, it will be in exponent form, so return a string with 6dp
-- 9e-5 becomes 0.000090
if math.abs(x) < 1e-4 then x = string.format("%f", x) end
return x
end
-------------------------------------------------------------------------------
-- formatDate takes a datetime of the usual format from mw.wikibase.entity:formatPropertyValues
-- like "1 August 30 BCE" as parameter 1
-- and formats it according to the df (date format) and bc parameters
-- df = ["dmy" / "mdy" / "y"] default will be "dmy"
-- bc = ["BC" / "BCE"] default will be "BCE"
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local format_Date = function(datetime, dateformat, bc)
local datetime = datetime or "1 August 30 BCE" -- in case of nil value
-- chop off multiple vales and/or any hours, mins, etc.
-- keep anything before punctuation - we just want a single date:
local dateval = string.match( datetime, "[%w ]+")
local dateformat = string.lower(dateformat or "dmy") -- default to dmy
local bc = string.upper(bc or "") -- can't use nil for bc
-- we only want to accept two possibilities: BC or default to BCE
if bc == "BC" then
bc = " " .. i18n["BC"] -- prepend a non-breaking space.
else
bc = " " .. i18n["BCE"]
end
local postchrist = true -- start by assuming no BCE
local dateparts = {}
for word in string.gmatch(dateval, "%w+") do
if word == "BCE" or word == "BC" then -- *** internationalise later ***
postchrist = false
else
-- we'll keep the parts that are not 'BCE' in a table
dateparts[#dateparts + 1] = word
end
end
if postchrist then bc = "" end -- set AD dates to no suffix *** internationalise later ***
local sep = " " -- separator is nbsp
local fdate = table.concat(dateparts, sep) -- set formatted date to same order as input
-- if we have day month year, check dateformat
if #dateparts == 3 then
if dateformat == "y" then
fdate = dateparts[3]
elseif dateformat == "mdy" then
fdate = dateparts[2] .. sep .. dateparts[1] .. "," .. sep .. dateparts[3]
end
elseif #dateparts == 2 and dateformat == "y" then
fdate = dateparts[2]
end
return fdate .. bc
end
-------------------------------------------------------------------------------
-- dateFormat is the handler for properties that are of type "time"
-- It takes timestamp, precision (6 to 11 per mediawiki), dateformat (y/dmy/mdy), BC format (BC/BCE),
-- a plaindate switch (yes/no/adj) to en/disable "sourcing circumstances"/use adjectival form,
-- any qualifiers for the property, the language, and any adjective to use like 'before'.
-- It passes the date through the "complex date" function
-- and returns a string with the internatonalised date formatted according to preferences.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); cdate(); dp[]
-------------------------------------------------------------------------------
local dateFormat = function(timestamp, dprec, df, bcf, pd, qualifiers, lang, adj, model)
-- output formatting according to preferences (y/dmy/mdy/ymd)
df = (df or ""):lower()
-- if ymd is required, return the part of the timestamp in YYYY-MM-DD form
-- but apply Year zero#Astronomers fix: 1 BC = 0000; 2 BC = -0001; etc.
if df == "ymd" then
if timestamp:sub(1,1) == "+" then
return timestamp:sub(2,11)
else
local yr = tonumber(timestamp:sub(2,5)) - 1
yr = ("000" .. yr):sub(-4)
if yr ~= "0000" then yr = "-" .. yr end
return yr .. timestamp:sub(6,11)
end
end
-- A year can be stored like this: "+1872-00-00T00:00:00Z",
-- which is processed here as if it were the day before "+1872-01-01T00:00:00Z",
-- and that's the last day of 1871, so the year is wrong.
-- So fix the month 0, day 0 timestamp to become 1 January instead:
timestamp = timestamp:gsub("%-00%-00T", "-01-01T")
-- just in case date precision is missing
dprec = dprec or 11
-- override more precise dates if required dateformat is year alone:
if df == "y" and dprec > 9 then dprec = 9 end
-- complex date only deals with precisions from 6 to 11, so clip range
dprec = dprec>11 and 11 or dprec
dprec = dprec<6 and 6 or dprec
-- BC format is "BC" or "BCE"
bcf = (bcf or ""):upper()
-- plaindate only needs the first letter (y/n/a)
pd = (pd or ""):sub(1,1):lower()
if pd == "" or pd == "n" or pd == "f" or pd == "0" then pd = false end
-- in case language isn't passed
lang = lang or findLang().code
-- set adj as empty if nil
adj = adj or ""
-- extract the day, month, year from the timestamp
local bc = timestamp:sub(1, 1)=="-" and "BC" or ""
local year, month, day = timestamp:match("[+-](%d*)-(%d*)-(%d*)T")
local iso = tonumber(year) -- if year is missing, let it throw an error
-- this will adjust the date format to be compatible with cdate
-- possible formats are Y, YY, YYY0, YYYY, YYYY-MM, YYYY-MM-DD
if dprec == 6 then iso = math.floor( (iso - 1) / 1000 ) + 1 end
if dprec == 7 then iso = math.floor( (iso - 1) / 100 ) + 1 end
if dprec == 8 then iso = math.floor( iso / 10 ) .. "0" end
if dprec == 10 then iso = year .. "-" .. month end
if dprec == 11 then iso = year .. "-" .. month .. "-" .. day end
-- add "circa" (Q5727902) from "sourcing circumstances" (P1480)
local sc = not pd and qualifiers and qualifiers.P1480
if sc then
for k1, v1 in pairs(sc) do
if v1.datavalue and v1.datavalue.value.id == "Q5727902" then
adj = "circa"
break
end
end
end
-- deal with Julian dates:
-- no point in saying that dates before 1582 are Julian - they are by default
-- doesn't make sense for dates less precise than year
-- we can suppress it by setting |plaindate, e.g. for use in constructing categories.
local calendarmodel = ""
if tonumber(year) > 1582
and dprec > 8
and not pd
and model == "http://www.wikidata.org/entity/Q1985786" then
calendarmodel = "julian"
end
if not cdate then
cdate = require("Module:Complex date")._complex_date
end
local fdate = cdate(calendarmodel, adj, tostring(iso), dp[dprec], bc, "", "", "", "", lang, 1)
-- this may have QuickStatements info appended to it in a div, so remove that
fdate = fdate:gsub(' <div style="display: none;">[^<]*</div>', '')
-- it may also be returned wrapped in a microformat, so remove that
fdate = fdate:gsub("<[^>]*>", "")
-- there may be leading zeros that we should remove
fdate = fdate:gsub("^0*", "")
-- if a plain date is required, then remove any links (like BC linked)
if pd then
fdate = fdate:gsub("%[%[.*|", ""):gsub("]]", "")
end
-- if 'circa', use the abbreviated form *** internationalise later ***
fdate = fdate:gsub('circa ', '<abbr title="circa">c.</abbr> ')
-- deal with BC/BCE
if bcf == "BCE" then
fdate = fdate:gsub('BC', 'BCE')
end
-- deal with mdy format
if df == "mdy" then
fdate = fdate:gsub("(%d+) (%w+) (%d+)", "%2 %1, %3")
end
-- deal with adjectival form *** internationalise later ***
if pd == "a" then
fdate = fdate:gsub(' century', '-century')
end
return fdate
end
-------------------------------------------------------------------------------
-- parseParam takes a (string) parameter, e.g. from the list of frame arguments,
-- and makes "false", "no", and "0" into the (boolean) false
-- it makes the empty string and nil into the (boolean) value passed as default
-- allowing the parameter to be true or false by default.
-- It returns a boolean.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local parseParam = function(param, default)
if type(param) == "boolean" then param = tostring(param) end
if param and param ~= "" then
param = param:lower()
if (param == "false") or (param:sub(1,1) == "n") or (param == "0") then
return false
else
return true
end
else
return default
end
end
-------------------------------------------------------------------------------
-- _getSitelink takes the qid of a Wikidata entity passed as |qid=
-- It takes an optional parameter |wiki= to determine which wiki is to be checked for a sitelink
-- If the parameter is blank, then it uses the local wiki.
-- If there is a sitelink to an article available, it returns the plain text link to the article
-- If there is no sitelink, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local _getSitelink = function(qid, wiki)
qid = (qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
wiki = wiki or ""
local sitelink
if wiki == "" then
sitelink = mw.wikibase.getSitelink(qid)
else
sitelink = mw.wikibase.getSitelink(qid, wiki)
end
return sitelink
end
-------------------------------------------------------------------------------
-- _getCommonslink takes an optional qid of a Wikidata entity passed as |qid=
-- It returns one of the following in order of preference:
-- the Commons sitelink of the Wikidata entity - but not if onlycat=true and it's not a category;
-- the Commons sitelink of the topic's main category of the Wikidata entity;
-- the Commons category of the Wikidata entity - unless fallback=false.
-------------------------------------------------------------------------------
-- Dependencies: _getSitelink(); parseParam()
-------------------------------------------------------------------------------
local _getCommonslink = function(qid, onlycat, fallback)
qid = (qid or ""):upper()
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
onlycat = parseParam(onlycat, false)
if fallback == "" then fallback = nil end
local sitelink = _getSitelink(qid, "commonswiki")
if onlycat and sitelink and sitelink:sub(1,9) ~= "Category:" then sitelink = nil end
if not sitelink then
-- check for topic's main category
local prop910 = mw.wikibase.getBestStatements(qid, "P910")[1]
if prop910 then
local tmcid = prop910.mainsnak.datavalue and prop910.mainsnak.datavalue.value.id
sitelink = _getSitelink(tmcid, "commonswiki")
end
if not sitelink then
-- check for list's main category
local prop1754 = mw.wikibase.getBestStatements(qid, "P1754")[1]
if prop1754 then
local tmcid = prop1754.mainsnak.datavalue and prop1754.mainsnak.datavalue.value.id
sitelink = _getSitelink(tmcid, "commonswiki")
end
end
end
if not sitelink and fallback then
-- check for Commons category (string value)
local prop373 = mw.wikibase.getBestStatements(qid, "P373")[1]
if prop373 then
sitelink = prop373.mainsnak.datavalue and prop373.mainsnak.datavalue.value
if sitelink then sitelink = "Category:" .. sitelink end
end
end
return sitelink
end
-------------------------------------------------------------------------------
-- The label in a Wikidata item is subject to vulnerabilities
-- that an attacker might try to exploit.
-- It needs to be 'sanitised' by removing any wikitext before use.
-- If it doesn't exist, return the id for the item
-- a second (boolean) value is also returned, value is true when the label exists
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local labelOrId = function(id, lang)
if lang == "default" then lang = findLang().code end
local label
if lang then
label = mw.wikibase.getLabelByLang(id, lang)
else
label = mw.wikibase.getLabel(id)
end
if label then
return mw.text.nowiki(label), true
else
return id, false
end
end
-------------------------------------------------------------------------------
-- linkedItem takes an entity-id and returns a string, linked if possible.
-- This is the handler for "wikibase-item". Preferences:
-- 1. Display linked disambiguated sitelink if it exists
-- 2. Display linked label if it is a redirect
-- 3. TBA: Display an inter-language link for the label if it exists other than in default language
-- 4. Display unlinked label if it exists
-- 5. Display entity-id for now to indicate a label could be provided
-- dtxt is text to be used instead of label, or nil.
-- shortname is boolean switch to use P1813 (short name) instead of label if true.
-- lang is the current language code.
-- uselbl is boolean switch to force display of the label instead of the sitelink (default: false)
-- linkredir is boolean switch to allow linking to a redirect (default: false)
-- formatvalue is boolean switch to allow formatting as italics or quoted (default: false)
-------------------------------------------------------------------------------
-- Dependencies: labelOrId(); donotlink[]
-------------------------------------------------------------------------------
local linkedItem = function(id, args)
local lprefix = (args.lp or args.lprefix or args.linkprefix or ""):gsub('"', '') -- toughen against nil values passed
local lpostfix = (args.lpostfix or ""):gsub('"', '')
local prefix = (args.prefix or ""):gsub('"', '')
local postfix = (args.postfix or ""):gsub('"', '')
local dtxt = args.dtxt
local shortname = args.shortname or args.sn
local lang = args.lang or "en" -- fallback to default if missing
local uselbl = args.uselabel or args.uselbl
uselbl = parseParam(uselbl, false)
local linkredir = args.linkredir
linkredir = parseParam(linkredir, false)
local formatvalue = args.formatvalue or args.fv
formatvalue = parseParam(formatvalue, false)
-- see if item might need italics or quotes
local fmt = ""
if next(formats) and formatvalue then
for k, v in ipairs( mw.wikibase.getBestStatements(id, "P31") ) do
if v.mainsnak.datavalue and formats[v.mainsnak.datavalue.value.id] then
fmt = formats[v.mainsnak.datavalue.value.id]
break -- pick the first match
end
end
end
local disp
local sitelink = mw.wikibase.getSitelink(id)
local label, islabel
if dtxt then
label, islabel = dtxt, true
elseif shortname then
-- see if there is a shortname in our language, and set label to it
for k, v in ipairs( mw.wikibase.getBestStatements(id, "P1813") ) do
if v.mainsnak.datavalue.value.language == lang then
label, islabel = v.mainsnak.datavalue.value.text, true
break
end -- test for language match
end -- loop through values of short name
-- if we have no label set, then there was no shortname available
if not islabel then
label, islabel = labelOrId(id)
shortname = false
end
else
label, islabel = labelOrId(id)
end
if mw.site.siteName ~= "Wikimedia Commons" then
if sitelink then
if not (dtxt or shortname) then
-- if sitelink and label are the same except for case, no need to process further
if sitelink:lower() ~= label:lower() then
-- strip any namespace or dab from the sitelink
local pos = sitelink:find(":") or 0
local slink = sitelink
if pos > 0 then
local pfx = sitelink:sub(1,pos-1)
if mw.site.namespaces[pfx] then -- that prefix is a valid namespace, so remove it
slink = sitelink:sub(pos+1)
end
end
-- remove stuff after commas or inside parentheses - ie. dabs
slink = slink:gsub("%s%(.+%)$", ""):gsub(",.+$", "")
-- if uselbl is false, use sitelink instead of label
if not uselbl then
-- use slink as display, preserving label case - find("^%u") is true for 1st char uppercase
if label:find("^%u") then
label = slink:gsub("^(%l)", string.upper)
else
label = slink:gsub("^(%u)", string.lower)
end
end
end
end
if donotlink[label] then
disp = prefix .. fmt .. label .. fmt .. postfix
else
disp = "[[" .. lprefix .. sitelink .. lpostfix .. "|" .. prefix .. fmt .. label .. fmt .. postfix .. "]]"
end
elseif islabel then
-- no sitelink, label exists, so check if a redirect with that title exists, if linkredir is true
-- display plain label by default
disp = prefix .. fmt .. label .. fmt .. postfix
if linkredir then
local artitle = mw.title.new(label, 0) -- only nil if label has invalid chars
if not donotlink[label] and artitle and artitle.redirectTarget then
-- there's a redirect with the same title as the label, so let's link to that
disp = "[[".. lprefix .. label .. lpostfix .. "|" .. prefix .. fmt .. label .. fmt .. postfix .. "]]"
end
end -- test if article title exists as redirect on current Wiki
else
-- no sitelink and no label, so return whatever was returned from labelOrId for now
-- add tracking category [[Category:Articles with missing Wikidata information]]
-- for enwiki, just return the tracking category
if mw.wikibase.getGlobalSiteId() == "enwiki" then
disp = i18n.missinginfocat
else
disp = prefix .. label .. postfix .. i18n.missinginfocat
end
end
else
local ccat = mw.wikibase.getBestStatements(id, "P373")[1]
if ccat and ccat.mainsnak.datavalue then
ccat = ccat.mainsnak.datavalue.value
disp = "[[" .. lprefix .. "Category:" .. ccat .. lpostfix .. "|" .. prefix .. label .. postfix .. "]]"
elseif sitelink then
-- this asumes that if a sitelink exists, then a label also exists
disp = "[[" .. lprefix .. sitelink .. lpostfix .. "|" .. prefix .. label .. postfix .. "]]"
else
-- no sitelink and no Commons cat, so return label from labelOrId for now
disp = prefix .. label .. postfix
end
end
return disp
end
-------------------------------------------------------------------------------
-- sourced takes a table representing a statement that may or may not have references
-- it looks for a reference sourced to something not containing the word "wikipedia"
-- it returns a boolean = true if it finds a sourced reference.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local sourced = function(claim)
if claim.references then
for kr, vr in pairs(claim.references) do
local ref = mw.wikibase.renderSnaks(vr.snaks)
if not ref:find("Wiki") then
return true
end
end
end
end
-------------------------------------------------------------------------------
-- setRanks takes a flag (parameter passed) that requests the values to return
-- "b[est]" returns preferred if available, otherwise normal
-- "p[referred]" returns preferred
-- "n[ormal]" returns normal
-- "d[eprecated]" returns deprecated
-- multiple values are allowed, e.g. "preferred normal" (which is the default)
-- "best" will override the other flags, and set p and n
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local setRanks = function(rank)
rank = (rank or ""):lower()
-- if nothing passed, return preferred and normal
-- if rank == "" then rank = "p n" end
local ranks = {}
for w in string.gmatch(rank, "%a+") do
w = w:sub(1,1)
if w == "b" or w == "p" or w == "n" or w == "d" then
ranks[w] = true
end
end
-- check if "best" is requested or no ranks requested; and if so, set preferred and normal
if ranks.b or not next(ranks) then
ranks.p = true
ranks.n = true
end
return ranks
end
-------------------------------------------------------------------------------
-- parseInput processes the Q-id , the blacklist and the whitelist
-- if an input parameter is supplied, it returns that and ends the call.
-- it returns (1) either the qid or nil indicating whether or not the call should continue
-- and (2) a table containing all of the statements for the propertyID and relevant Qid
-- if "best" ranks are requested, it returns those instead of all non-deprecated ranks
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
local parseInput = function(frame, input_parm, property_id)
-- There may be a local parameter supplied, if it's blank, set it to nil
input_parm = mw.text.trim(input_parm or "")
if input_parm == "" then input_parm = nil end
-- return nil if Wikidata is not available
if not mw.wikibase then return false, input_parm end
local args = frame.args
-- can take a named parameter |qid which is the Wikidata ID for the article.
-- if it's not supplied, use the id for the current page
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
-- if there's no Wikidata item for the current page return nil
if not qid then return false, input_parm end
-- The blacklist is passed in named parameter |suppressfields
local blacklist = args.suppressfields or args.spf or ""
-- The whitelist is passed in named parameter |fetchwikidata
local whitelist = args.fetchwikidata or args.fwd or ""
if whitelist == "" then whitelist = "NONE" end
-- The name of the field that this function is called from is passed in named parameter |name
local fieldname = args.name or ""
if blacklist ~= "" then
-- The name is compulsory when blacklist is used, so return nil if it is not supplied
if fieldname == "" then return false, nil end
-- If this field is on the blacklist, then return nil
if blacklist:find(fieldname) then return false, nil end
end
-- If we got this far then we're not on the blacklist
-- The blacklist overrides any locally supplied parameter as well
-- If a non-blank input parameter was supplied return it
if input_parm then return false, input_parm end
-- We can filter out non-valid properties
if property_id:sub(1,1):upper() ~="P" or property_id == "P0" then return false, nil end
-- Otherwise see if this field is on the whitelist:
-- needs a bit more logic because find will return its second value = 0 if fieldname is ""
-- but nil if fieldname not found on whitelist
local _, found = whitelist:find(fieldname)
found = ((found or 0) > 0)
if whitelist ~= 'ALL' and (whitelist:upper() == "NONE" or not found) then
return false, nil
end
-- See what's on Wikidata (the call always returns a table, but it may be empty):
local props = {}
if args.reqranks.b then
props = mw.wikibase.getBestStatements(qid, property_id)
else
props = mw.wikibase.getAllStatements(qid, property_id)
end
if props[1] then
return qid, props
end
-- no property on Wikidata
return false, nil
end
-------------------------------------------------------------------------------
-- createicon assembles the "Edit at Wikidata" pen icon.
-- It returns a wikitext string inside a span class="penicon"
-- if entityID is nil or empty, the ID associated with current page is used
-- langcode and propertyID may be nil or empty
-------------------------------------------------------------------------------
-- Dependencies: i18n[];
-------------------------------------------------------------------------------
local createicon = function(langcode, entityID, propertyID)
langcode = langcode or ""
if not entityID or entityID == "" then entityID= mw.wikibase.getEntityIdForCurrentPage() end
propertyID = propertyID or ""
local icon = " <span class='penicon autoconfirmed-show'>[["
-- " <span data-bridge-edit-flow='overwrite' class='penicon'>[[" -> enable Wikidata Bridge
.. i18n["filespace"]
.. ":OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt="
.. i18n["editonwikidata"]
.. "|link=https://www.wikidata.org/wiki/" .. entityID
if langcode ~= "" then icon = icon .. "?uselang=" .. langcode end
if propertyID ~= "" then icon = icon .. "#" .. propertyID end
icon = icon .. "|" .. i18n["editonwikidata"] .. "]]</span>"
return icon
end
-------------------------------------------------------------------------------
-- assembleoutput takes the sequence table containing the property values
-- and formats it according to switches given. It returns a string or nil.
-- It uses the entityID (and optionally propertyID) to create a link in the pen icon.
-------------------------------------------------------------------------------
-- Dependencies: parseParam();
-------------------------------------------------------------------------------
local assembleoutput = function(out, args, entityID, propertyID)
-- sorted is a boolean passed to enable sorting of the values returned
-- if nothing or an empty string is passed set it false
-- if "false" or "no" or "0" is passed set it false
local sorted = parseParam(args.sorted, false)
-- noicon is a boolean passed to suppress the trailing "edit at Wikidata" icon
-- for use when the value is processed further by the infobox
-- if nothing or an empty string is passed set it false
-- if "false" or "no" or "0" is passed set it false
local noic = parseParam(args.noicon, false)
-- list is the name of a template that a list of multiple values is passed through
-- examples include "hlist" and "ubl"
-- setting it to "prose" produces something like "1, 2, 3, and 4"
local list = args.list or ""
-- sep is a string that is used to separate multiple returned values
-- if nothing or an empty string is passed set it to the default
-- any double-quotes " are stripped out, so that spaces may be passed
-- e.g. |sep=" - "
local sepdefault = i18n["list separator"]
local separator = args.sep or ""
separator = string.gsub(separator, '"', '')
if separator == "" then
separator = sepdefault
end
-- collapse is a number that determines the maximum number of returned values
-- before the output is collapsed.
-- Zero or not a number result in no collapsing (default becomes 0).
local collapse = tonumber(args.collapse) or 0
-- replacetext (rt) is a string that is returned instead of any non-empty Wikidata value
-- this is useful for tracking and debugging
local replacetext = mw.text.trim(args.rt or args.replacetext or "")
-- if there's anything to return, then return a list
-- comma-separated by default, but may be specified by the sep parameter
-- optionally specify a hlist or ubl or a prose list, etc.
local strout
if #out > 0 then
if sorted then table.sort(out) end
-- if there's something to display and a pen icon is wanted, add it the end of the last value
local hasdisplay = false
for i, v in ipairs(out) do
if v ~= i18n.missinginfocat then
hasdisplay = true
break
end
end
if not noic and hasdisplay then
out[#out] = out[#out] .. createicon(args.langobj.code, entityID, propertyID)
end
if list == "" then
strout = table.concat(out, separator)
elseif list:lower() == "prose" then
strout = mw.text.listToText( out )
else
strout = mw.getCurrentFrame():expandTemplate{title = list, args = out}
end
if collapse >0 and #out > collapse then
strout = collapsediv .. strout .. "</div>"
end
else
strout = nil -- no items had valid reference
end
if replacetext ~= "" and strout then strout = replacetext end
return strout
end
-------------------------------------------------------------------------------
-- rendersnak takes a table (propval) containing the information stored on one property value
-- and returns the value as a string and its language if monolingual text.
-- It handles data of type:
-- wikibase-item
-- time
-- string, url, commonsMedia, external-id
-- quantity
-- globe-coordinate
-- monolingualtext
-- It also requires linked, the link/pre/postfixes, uabbr, and the arguments passed from frame.
-- The optional filter parameter allows quantities to be be filtered by unit Qid.
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); labelOrId(); i18n[]; dateFormat();
-- roundto(); decimalPrecision(); decimalToDMS(); linkedItem();
-------------------------------------------------------------------------------
local rendersnak = function(propval, args, linked, lpre, lpost, pre, post, uabbr, filter)
lpre = lpre or ""
lpost = lpost or ""
pre = pre or ""
post = post or ""
args.lang = args.lang or findLang().code
-- allow values to display a fixed text instead of label
local dtxt = args.displaytext or args.dt
if dtxt == "" then dtxt = nil end
-- switch to use display of short name (P1813) instead of label
local shortname = args.shortname or args.sn
shortname = parseParam(shortname, false)
local snak = propval.mainsnak or propval
local dtype = snak.datatype
local dv = snak.datavalue
dv = dv and dv.value
-- value and monolingual text language code returned
local val, mlt
if propval.rank and not args.reqranks[propval.rank:sub(1, 1)] then
-- val is nil: value has a rank that isn't requested
------------------------------------
elseif snak.snaktype == "somevalue" then -- value is unknown
val = i18n["Unknown"]
------------------------------------
elseif snak.snaktype == "novalue" then -- value is none
-- val = "No value" -- don't return anything
------------------------------------
elseif dtype == "wikibase-item" then -- data type is a wikibase item:
-- it's wiki-linked value, so output as link if enabled and possible
local qnumber = dv.id
if linked then
val = linkedItem(qnumber, args)
else -- no link wanted so check for display-text, otherwise test for lang code
local label, islabel
if dtxt then
label = dtxt
else
label, islabel = labelOrId(qnumber)
local langlabel = mw.wikibase.getLabelByLang(qnumber, args.lang)
if langlabel then
label = mw.text.nowiki( langlabel )
end
end
val = pre .. label .. post
end -- test for link required
------------------------------------
elseif dtype == "time" then -- data type is time:
-- time is in timestamp format
-- date precision is integer per mediawiki
-- output formatting according to preferences (y/dmy/mdy)
-- BC format as BC or BCE
-- plaindate is passed to disable looking for "sourcing cirumstances"
-- or to set the adjectival form
-- qualifiers (if any) is a nested table or nil
-- lang is given, or user language, or site language
--
-- Here we can check whether args.df has a value
-- If not, use code from Module:Sandbox/RexxS/Getdateformat to set it from templates like {{Use mdy dates}}
val = dateFormat(dv.time, dv.precision, args.df, args.bc, args.pd, propval.qualifiers, args.lang, "", dv.calendarmodel)
------------------------------------
-- data types which are strings:
elseif dtype == "commonsMedia" or dtype == "external-id" or dtype == "string" or dtype == "url" then
-- commonsMedia or external-id or string or url
-- all have mainsnak.datavalue.value as string
if (lpre == "" or lpre == ":") and lpost == "" then
-- don't link if no linkpre/postfix or linkprefix is just ":"
val = pre .. dv .. post
elseif dtype == "external-id" then
val = "[" .. lpre .. dv .. lpost .. " " .. pre .. dv .. post .. "]"
else
val = "[[" .. lpre .. dv .. lpost .. "|" .. pre .. dv .. post .. "]]"
end -- check for link requested (i.e. either linkprefix or linkpostfix exists)
------------------------------------
-- data types which are quantities:
elseif dtype == "quantity" then
-- quantities have mainsnak.datavalue.value.amount and mainsnak.datavalue.value.unit
-- the unit is of the form http://www.wikidata.org/entity/Q829073
--
-- implement a switch to turn on/off numerical formatting later
local fnum = true
--
-- a switch to turn on/off conversions - only for en-wiki
local conv = parseParam(args.conv or args.convert, false)
-- if we have conversions, we won't have formatted numbers or scales
if conv then
uabbr = true
fnum = false
args.scale = "0"
end
--
-- a switch to turn on/off showing units, default is true
local showunits = parseParam(args.su or args.showunits, true)
--
-- convert amount to a number
local amount = tonumber(dv.amount) or i18n["NaN"]
--
-- scale factor for millions, billions, etc.
local sc = tostring(args.scale or ""):sub(1,1):lower()
local scale
if sc == "a" then
-- automatic scaling
if amount > 1e15 then
scale = 12
elseif amount > 1e12 then
scale = 9
elseif amount > 1e9 then
scale = 6
elseif amount > 1e6 then
scale = 3
else
scale = 0
end
else
scale = tonumber(args.scale) or 0
if scale < 0 or scale > 12 then scale = 0 end
scale = math.floor(scale/3) * 3
end
local factor = 10^scale
amount = amount / factor
-- ranges:
local range = ""
-- check if upper and/or lower bounds are given and significant
local upb = tonumber(dv.upperBound)
local lowb = tonumber(dv.lowerBound)
if upb and lowb then
-- differences rounded to 2 sig fig:
local posdif = roundto(upb - amount, 2) / factor
local negdif = roundto(amount - lowb, 2) / factor
upb, lowb = amount + posdif, amount - negdif
-- round scaled numbers to integers or 4 sig fig
if (scale > 0 or sc == "a") then
if amount < 1e4 then
amount = roundto(amount, 4)
else
amount = math.floor(amount + 0.5)
end
end
if fnum then amount = args.langobj:formatNum( amount ) end
if posdif ~= negdif then
-- non-symmetrical
range = " +" .. posdif .. " -" .. negdif
elseif posdif ~= 0 then
-- symmetrical and non-zero
range = " ±" .. posdif
else
-- otherwise range is zero, so leave it as ""
end
else
-- round scaled numbers to integers or 4 sig fig
if (scale > 0 or sc == "a") then
if amount < 1e4 then
amount = roundto(amount, 4)
else
amount = math.floor(amount + 0.5)
end
end
if fnum then amount = args.langobj:formatNum( amount ) end
end
-- unit names and symbols:
-- extract the qid in the form 'Qnnn' from the value.unit url
-- and then fetch the label from that - or symbol if unitabbr is true
local unit = ""
local usep = ""
local usym = ""
local unitqid = string.match( dv.unit, "(Q%d+)" )
if filter and unitqid ~= filter then return nil end
if unitqid and showunits then
local uname = mw.wikibase.getLabelByLang(unitqid, args.lang) or ""
if uname ~= "" then usep, unit = " ", uname end
if uabbr then
-- see if there's a unit symbol (P5061)
local unitsymbols = mw.wikibase.getBestStatements(unitqid, "P5061")
-- construct fallback table, add local lang and multiple languages
local fbtbl = mw.language.getFallbacksFor( args.lang, mw.language.FALLBACK_STRICT )
table.insert( fbtbl, 1, args.lang )
table.insert( fbtbl, "mul" )
table.insert( fbtbl, "en" )
local found = false
for idx1, us in ipairs(unitsymbols) do
for idx2, fblang in ipairs(fbtbl) do
if us.mainsnak.datavalue.value.language == fblang then
usym = us.mainsnak.datavalue.value.text
found = true
break
end
end -- loop through fallback table
if found then break end
end -- loop through values of P5061
if found then usep, unit = " ", usym end
end
end
-- format display:
if conv then
if range == "" then
val = mw.getCurrentFrame():expandTemplate{title = "cvt", args = {amount, unit}}
else
val = mw.getCurrentFrame():expandTemplate{title = "cvt", args = {lowb, "to", upb, unit}}
end
elseif unit == "$" or unit == "£" then
val = unit .. amount .. range .. i18n.multipliers[scale]
else
val = amount .. range .. i18n.multipliers[scale] .. usep .. unit
end
------------------------------------
-- datatypes which are global coordinates:
elseif dtype == "globe-coordinate" then
-- 'display' parameter defaults to "inline, title" *** unused for now ***
-- local disp = args.display or ""
-- if disp == "" then disp = "inline, title" end
--
-- format parameter switches from deg/min/sec to decimal degrees
-- default is deg/min/sec -- decimal degrees needs |format = dec
local form = (args.format or ""):lower():sub(1,3)
if form ~= "dec" then form = "dms" end -- not needed for now
--
-- show parameter allows just the latitude, or just the longitude, or both
-- to be returned as a signed decimal, ignoring the format parameter.
local show = (args.show or ""):lower()
if show ~= "longlat" then show = show:sub(1,3) end
--
local lat, long, prec = dv.latitude, dv.longitude, dv.precision
if show == "lat" then
val = decimalPrecision(lat, prec)
elseif show == "lon" then
val = decimalPrecision(long, prec)
elseif show == "longlat" then
val = decimalPrecision(long, prec) .. ", " .. decimalPrecision(lat, prec)
else
local ns = "N"
local ew = "E"
if lat < 0 then
ns = "S"
lat = - lat
end
if long < 0 then
ew = "W"
long = - long
end
if form == "dec" then
lat = decimalPrecision(lat, prec)
long = decimalPrecision(long, prec)
val = lat .. "°" .. ns .. " " .. long .. "°" .. ew
else
local latdeg, latmin, latsec = decimalToDMS(lat, prec)
local longdeg, longmin, longsec = decimalToDMS(long, prec)
if latsec == 0 and longsec == 0 then
if latmin == 0 and longmin == 0 then
val = latdeg .. "°" .. ns .. " " .. longdeg .. "°" .. ew
else
val = latdeg .. "°" .. latmin .. "′" .. ns .. " "
val = val .. longdeg .. "°".. longmin .. "′" .. ew
end
else
val = latdeg .. "°" .. latmin .. "′" .. latsec .. "″" .. ns .. " "
val = val .. longdeg .. "°" .. longmin .. "′" .. longsec .. "″" .. ew
end
end
end
------------------------------------
elseif dtype == "monolingualtext" then -- data type is Monolingual text:
-- has mainsnak.datavalue.value as a table containing language/text pairs
-- collect all the values in 'out' and languages in 'mlt' and process them later
val = pre .. dv.text .. post
mlt = dv.language
------------------------------------
else
-- some other data type so write a specific handler
val = "unknown data type: " .. dtype
end -- of datatype/unknown value/sourced check
return val, mlt
end
-------------------------------------------------------------------------------
-- propertyvalueandquals takes a property object, the arguments passed from frame,
-- and a qualifier propertyID.
-- It returns a sequence (table) of values representing the values of that property
-- and qualifiers that match the qualifierID if supplied.
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); sourced(); labelOrId(); i18n.latestdatequalifier(); format_Date();
-- makeOrdinal(); roundto(); decimalPrecision(); decimalToDMS(); assembleoutput();
-------------------------------------------------------------------------------
local function propertyvalueandquals(objproperty, args, qualID)
-- needs this style of declaration because it's re-entrant
-- onlysourced is a boolean passed to return only values sourced to other than Wikipedia
-- if nothing or an empty string is passed set it true
local onlysrc = parseParam(args.onlysourced or args.osd, true)
-- linked is a a boolean that enables the link to a local page via sitelink
-- if nothing or an empty string is passed set it true
local linked = parseParam(args.linked, true)
-- prefix is a string that may be nil, empty (""), or a string of characters
-- this is prefixed to each value
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local prefix = (args.prefix or ""):gsub('"', '')
-- postfix is a string that may be nil, empty (""), or a string of characters
-- this is postfixed to each value
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local postfix = (args.postfix or ""):gsub('"', '')
-- linkprefix is a string that may be nil, empty (""), or a string of characters
-- this creates a link and is then prefixed to each value
-- useful when when multiple values are returned and indirect links are needed
-- any double-quotes " are stripped out, so that spaces may be passed
local lprefix = (args.linkprefix or args.lp or ""):gsub('"', '')
-- linkpostfix is a string that may be nil, empty (""), or a string of characters
-- this is postfixed to each value when linking is enabled with lprefix
-- useful when when multiple values are returned
-- any double-quotes " are stripped out, so that spaces may be passed
local lpostfix = (args.linkpostfix or ""):gsub('"', '')
-- wdlinks is a boolean passed to enable links to Wikidata when no article exists
-- if nothing or an empty string is passed set it false
local wdl = parseParam(args.wdlinks or args.wdl, false)
-- unitabbr is a boolean passed to enable unit abbreviations for common units
-- if nothing or an empty string is passed set it false
local uabbr = parseParam(args.unitabbr or args.uabbr, false)
-- qualsonly is a boolean passed to return just the qualifiers
-- if nothing or an empty string is passed set it false
local qualsonly = parseParam(args.qualsonly or args.qo, false)
-- maxvals is a string that may be nil, empty (""), or a number
-- this determines how many items may be returned when multiple values are available
-- setting it = 1 is useful where the returned string is used within another call, e.g. image
local maxvals = tonumber(args.maxvals) or 0
-- pd (plain date) is a string: yes/true/1 | no/false/0 | adj
-- to disable/enable "sourcing cirumstances" or use adjectival form for the plain date
local pd = args.plaindate or args.pd or "no"
args.pd = pd
-- allow qualifiers to have a different date format; default to year unless qualsonly is set
args.qdf = args.qdf or args.qualifierdateformat or args.df or (not qualsonly and "y")
local lang = args.lang or findLang().code
-- qualID is a string list of wanted qualifiers or "ALL"
qualID = qualID or ""
-- capitalise list of wanted qualifiers and substitute "DATES"
qualID = qualID:upper():gsub("DATES", "P580, P582")
local allflag = (qualID == "ALL")
-- create table of wanted qualifiers as key
local qwanted = {}
-- create sequence of wanted qualifiers
local qorder = {}
for q in mw.text.gsplit(qualID, "%p") do -- split at punctuation and iterate
local qtrim = mw.text.trim(q)
if qtrim ~= "" then
qwanted[mw.text.trim(q)] = true
qorder[#qorder+1] = qtrim
end
end
-- qsep is the output separator for rendering qualifier list
local qsep = (args.qsep or ""):gsub('"', '')
-- qargs are the arguments to supply to assembleoutput()
local qargs = {
["osd"] = "false",
["linked"] = tostring(linked),
["prefix"] = args.qprefix,
["postfix"] = args.qpostfix,
["linkprefix"] = args.qlinkprefix or args.qlp,
["linkpostfix"] = args.qlinkpostfix,
["wdl"] = "false",
["unitabbr"] = tostring(uabbr),
["maxvals"] = 0,
["sorted"] = tostring(args.qsorted),
["noicon"] = "true",
["list"] = args.qlist,
["sep"] = qsep,
["langobj"] = args.langobj,
["lang"] = args.langobj.code,
["df"] = args.qdf,
["sn"] = parseParam(args.qsn or args.qshortname, false),
}
-- all proper values of a Wikidata property will be the same type as the first
-- qualifiers don't have a mainsnak, properties do
local datatype = objproperty[1].datatype or objproperty[1].mainsnak.datatype
-- out[] holds the a list of returned values for this property
-- mlt[] holds the language code if the datatype is monolingual text
local out = {}
local mlt = {}
for k, v in ipairs(objproperty) do
local hasvalue = true
if (onlysrc and not sourced(v)) then
-- no value: it isn't sourced when onlysourced=true
hasvalue = false
else
local val, lcode = rendersnak(v, args, linked, lprefix, lpostfix, prefix, postfix, uabbr)
if not val then
hasvalue = false -- rank doesn't match
elseif qualsonly and qualID then
-- suppress value returned: only qualifiers are requested
else
out[#out+1], mlt[#out+1] = val, lcode
end
end
-- See if qualifiers are to be returned:
local snak = v.mainsnak or v
if hasvalue and v.qualifiers and qualID ~= "" and snak.snaktype~="novalue" then
-- collect all wanted qualifier values returned in qlist, indexed by propertyID
local qlist = {}
local timestart, timeend = "", ""
-- loop through qualifiers
for k1, v1 in pairs(v.qualifiers) do
if allflag or qwanted[k1] then
if k1 == "P1326" then
local ts = v1[1].datavalue.value.time
local dp = v1[1].datavalue.value.precision
qlist[k1] = dateFormat(ts, dp, args.qdf, args.bc, pd, "", lang, "before")
elseif k1 == "P1319" then
local ts = v1[1].datavalue.value.time
local dp = v1[1].datavalue.value.precision
qlist[k1] = dateFormat(ts, dp, args.qdf, args.bc, pd, "", lang, "after")
elseif k1 == "P580" then
timestart = propertyvalueandquals(v1, qargs)[1] or "" -- treat only one start time as valid
elseif k1 == "P582" then
timeend = propertyvalueandquals(v1, qargs)[1] or "" -- treat only one end time as valid
else
local q = assembleoutput(propertyvalueandquals(v1, qargs), qargs)
-- we already deal with circa via 'sourcing circumstances' if the datatype was time
-- circa may be either linked or unlinked *** internationalise later ***
if datatype ~= "time" or q ~= "circa" and not (type(q) == "string" and q:find("circa]]")) then
qlist[k1] = q
end
end
end -- of test for wanted
end -- of loop through qualifiers
-- set date separator
local t = timestart .. timeend
-- *** internationalise date separators later ***
local dsep = "–"
if t:find("%s") or t:find(" ") then dsep = " – " end
-- set the order for the list of qualifiers returned; start time and end time go last
if next(qlist) then
local qlistout = {}
if allflag then
for k2, v2 in pairs(qlist) do
qlistout[#qlistout+1] = v2
end
else
for i2, v2 in ipairs(qorder) do
qlistout[#qlistout+1] = qlist[v2]
end
end
if t ~= "" then
qlistout[#qlistout+1] = timestart .. dsep .. timeend
end
local qstr = assembleoutput(qlistout, qargs)
if qualsonly then
out[#out+1] = qstr
else
out[#out] = out[#out] .. " (" .. qstr .. ")"
end
elseif t ~= "" then
if qualsonly then
if timestart == "" then
out[#out+1] = timeend
elseif timeend == "" then
out[#out+1] = timestart
else
out[#out+1] = timestart .. dsep .. timeend
end
else
out[#out] = out[#out] .. " (" .. timestart .. dsep .. timeend .. ")"
end
end
end -- of test for qualifiers wanted
if maxvals > 0 and #out >= maxvals then break end
end -- of for each value loop
-- we need to pick one value to return if the datatype was "monolingualtext"
-- if there's only one value, use that
-- otherwise look through the fallback languages for a match
if datatype == "monolingualtext" and #out >1 then
lang = mw.text.split( lang, '-', true )[1]
local fbtbl = mw.language.getFallbacksFor( lang )
table.insert( fbtbl, 1, lang )
local bestval = ""
local found = false
for idx1, lang1 in ipairs(fbtbl) do
for idx2, lang2 in ipairs(mlt) do
if (lang1 == lang2) and not found then
bestval = out[idx2]
found = true
break
end
end -- loop through values of property
end -- loop through fallback languages
if found then
-- replace output table with a table containing the best value
out = { bestval }
else
-- more than one value and none of them on the list of fallback languages
-- sod it, just give them the first one
out = { out[1] }
end
end
return out
end
-------------------------------------------------------------------------------
-- Common code for p.getValueByQual and p.getValueByLang
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
local _getvaluebyqual = function(frame, qualID, checkvalue)
-- The property ID that will have a qualifier is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or "")
if propertyID == "" then return "no property supplied" end
if qualID == "" then return "no qualifier supplied" end
-- onlysourced is a boolean passed to return property values
-- only when property values are sourced to something other than Wikipedia
-- if nothing or an empty string is passed set it true
-- if "false" or "no" or 0 is passed set it false
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- set a language object and code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
-- check for locally supplied parameter in second unnamed parameter
-- success means no local parameter and the property exists
local qid, props = parseInput(frame, args[2], propertyID)
local linked = parseParam(args.linked, true)
local lpre = (args.linkprefix or args.lp or ""):gsub('"', '')
local lpost = (args.linkpostfix or ""):gsub('"', '')
local pre = (args.prefix or ""):gsub('"', '')
local post = (args.postfix or ""):gsub('"', '')
local uabbr = parseParam(args.unitabbr or args.uabbr, false)
local filter = (args.unit or ""):upper()
local maxvals = tonumber(args.maxvals) or 0
if filter == "" then filter = nil end
if qid then
local out = {}
-- Scan through the values of the property
-- we want something like property is "pronunciation audio (P443)" in propertyID
-- with a qualifier like "language of work or name (P407)" in qualID
-- whose value has the required ID, like "British English (Q7979)", in qval
for k1, v1 in ipairs(props) do
if v1.mainsnak.snaktype == "value" then
-- check if it has the right qualifier
local v1q = v1.qualifiers
if v1q and v1q[qualID] then
if onlysrc == false or sourced(v1) then
-- if we've got this far, we have a (sourced) claim with qualifiers
-- so see if matches the required value
-- We'll only deal with wikibase-items and strings for now
if v1q[qualID][1].datatype == "wikibase-item" then
if checkvalue(v1q[qualID][1].datavalue.value.id) then
out[#out + 1] = rendersnak(v1, args, linked, lpre, lpost, pre, post, uabbr, filter)
end
elseif v1q[qualID][1].datatype == "string" then
if checkvalue(v1q[qualID][1].datavalue.value) then
out[#out + 1] = rendersnak(v1, args, linked, lpre, lpost, pre, post, uabbr, filter)
end
end
end -- of check for sourced
end -- of check for matching required value and has qualifiers
else
return nil
end -- of check for string
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of propertyID
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- either local parameter or nothing
end -- of test for success
return nil
end
-------------------------------------------------------------------------------
-- _location takes Q-id and follows P276 (location)
-- or P131 (located in the administrative territorial entity) or P706 (located on terrain feature)
-- from the initial item to higher level territories/locations until it reaches the highest.
-- An optional boolean, 'first', determines whether the first item is returned (default: false).
-- An optional boolean 'skip' toggles the display to skip to the last item (default: false).
-- It returns a table containing the locations - linked where possible, except for the highest.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); labelOrId(); linkedItem
-------------------------------------------------------------------------------
local _location = function(qid, first, skip)
first = parseParam(first, false)
skip = parseParam(skip, false)
local locs = {"P276", "P131", "P706"}
local out = {}
local langcode = findLang():getCode()
local finished = false
local count = 0
local prevqid = "Q0"
repeat
local prop
for i1, v1 in ipairs(locs) do
local proptbl = mw.wikibase.getBestStatements(qid, v1)
if #proptbl > 1 then
-- there is more than one higher location
local prevP131, prevP131id
if prevqid ~= "Q0" then
prevP131 = mw.wikibase.getBestStatements(prevqid, "P131")[1]
prevP131id = prevP131
and prevP131.mainsnak.datavalue
and prevP131.mainsnak.datavalue.value.id
end
for i2, v2 in ipairs(proptbl) do
local parttbl = v2.qualifiers and v2.qualifiers.P518
if parttbl then
-- this higher location has qualifier 'applies to part' (P518)
for i3, v3 in ipairs(parttbl) do
if v3.snaktype == "value" and v3.datavalue.value.id == prevqid then
-- it has a value equal to the previous location
prop = proptbl[i2]
break
end -- of test for matching last location
end -- of loop through values of 'applies to part'
else
-- there's no qualifier 'applies to part' (P518)
-- so check if the previous location had a P131 that matches this alternate
if qid == prevP131id then
prop = proptbl[i2]
break
end -- of test for matching previous P131
end
end -- of loop through parent locations
-- fallback to second value if match not found
prop = prop or proptbl[2]
elseif #proptbl > 0 then
prop = proptbl[1]
end
if prop then break end
end
-- check if it's an instance of (P31) a country (Q6256) or sovereign state (Q3624078)
-- and terminate the chain if it is
local inst = mw.wikibase.getAllStatements(qid, "P31")
if #inst > 0 then
for k, v in ipairs(inst) do
local instid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
-- stop if it's a country (or a country within the United Kingdom if skip is true)
if instid == "Q6256" or instid == "Q3624078" or (skip and instid == "Q3336843") then
prop = nil -- this will ensure this is treated as top-level location
break
end
end
end
-- get the name of this location and update qid to point to the parent location
if prop and prop.mainsnak.datavalue then
if not skip or count == 0 then
local args = { lprefix = ":" }
out[#out+1] = linkedItem(qid, args) -- get a linked value if we can
end
qid, prevqid = prop.mainsnak.datavalue.value.id, qid
else
-- This is top-level location, so get short name except when this is the first item
-- Use full label if there's no short name or this is the first item
local prop1813 = mw.wikibase.getAllStatements(qid, "P1813")
-- if there's a short name and this isn't the only item
if prop1813[1] and (#out > 0)then
local shortname
-- short name is monolingual text, so look for match to the local language
-- choose the shortest 'short name' in that language
for k, v in pairs(prop1813) do
if v.mainsnak.datavalue.value.language == langcode then
local name = v.mainsnak.datavalue.value.text
if (not shortname) or (#name < #shortname) then
shortname = name
end
end
end
-- add the shortname if one is found, fallback to the label
-- but skip it if it's "USA"
if shortname ~= "USA" then
out[#out+1] = shortname or labelOrId(qid)
else
if skip then out[#out+1] = "US" end
end
else
-- no shortname, so just add the label
local loc = labelOrId(qid)
-- exceptions go here:
if loc == "United States of America" then
out[#out+1] = "United States"
else
out[#out+1] = loc
end
end
finished = true
end
count = count + 1
until finished or count >= 10 -- limit to 10 levels to avoid infinite loops
-- remove the first location if not required
if not first then table.remove(out, 1) end
-- we might have duplicate text for consecutive locations, so remove them
if #out > 2 then
local plain = {}
for i, v in ipairs(out) do
-- strip any links
plain[i] = v:gsub("^%[%[[^|]*|", ""):gsub("]]$", "")
end
local idx = 2
repeat
if plain[idx] == plain[idx-1] then
-- duplicate found
local removeidx = 0
if (plain[idx] ~= out[idx]) and (plain[idx-1] == out[idx-1]) then
-- only second one is linked, so drop the first
removeidx = idx - 1
elseif (plain[idx] == out[idx]) and (plain[idx-1] ~= out[idx-1]) then
-- only first one is linked, so drop the second
removeidx = idx
else
-- pick one
removeidx = idx - (os.time()%2)
end
table.remove(out, removeidx)
table.remove(plain, removeidx)
else
idx = idx +1
end
until idx >= #out
end
return out
end
-------------------------------------------------------------------------------
-- _getsumofparts scans the property 'has part' (P527) for values matching a list.
-- The list (args.vlist) consists of a string of Qids separated by spaces or any usual punctuation.
-- If the matched values have a qualifer 'quantity' (P1114), those quantites are summed.
-- The sum is returned as a number (i.e. 0 if none)
-- a table of arguments is supplied implementing the usual parameters.
-------------------------------------------------------------------------------
-- Dependencies: setRanks; parseParam; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
local _getsumofparts = function(args)
local vallist = (args.vlist or ""):upper()
if vallist == "" then return end
args.reqranks = setRanks(args.rank)
local f = {}
f.args = args
local qid, props = parseInput(f, "", "P527")
if not qid then return 0 end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local sum = 0
for k1, v1 in ipairs(props) do
if (onlysrc == false or sourced(v1))
and v1.mainsnak.snaktype == "value"
and v1.mainsnak.datavalue.type == "wikibase-entityid"
and vallist:match( v1.mainsnak.datavalue.value.id )
and v1.qualifiers
then
local quals = v1.qualifiers["P1114"]
if quals then
for k2, v2 in ipairs(quals) do
sum = sum + v2.datavalue.value.amount
end
end
end
end
return sum
end
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Public functions
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- _getValue makes the functionality of getValue available to other modules
-------------------------------------------------------------------------------
-- Dependencies: setRanks; parseInput; propertyvalueandquals; assembleoutput; parseParam; sourced;
-- labelOrId; i18n.latestdatequalifier; format_Date; makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p._getValue = function(args)
-- parameter sets for commonly used groups of parameters
local paraset = tonumber(args.ps or args.parameterset or 0)
if paraset == 1 then
-- a common setting, not usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
elseif paraset == 2 then
-- equivalent to raw, not usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
args.linked = "no"
args.pd = "true"
elseif paraset == 3 then
-- parameterset 1, but usable in infoboxes because the 2018 RFC requires sources
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "yes"
args.noicon = "true"
end
-- implement eid parameter
local eid = args.eid
if eid == "" then
return nil
elseif eid then
args.qid = eid
end
local propertyID = mw.text.trim(args[1] or "")
args.reqranks = setRanks(args.rank)
-- replacetext (rt) is a string that is returned instead of any non-empty Wikidata value
-- this is useful for tracking and debugging, so we set fetchwikidata=ALL to fill the whitelist
local replacetext = mw.text.trim(args.rt or args.replacetext or "")
if replacetext ~= "" then
args.fetchwikidata = "ALL"
end
local f = {}
f.args = args
local entityid, props = parseInput(f, f.args[2], propertyID)
if not entityid then
return props -- either the input parameter or nothing
end
-- qual is a string containing the property ID of the qualifier(s) to be returned
-- if qual == "ALL" then all qualifiers returned
-- if qual == "DATES" then qualifiers P580 (start time) and P582 (end time) returned
-- if nothing or an empty string is passed set it nil -> no qualifiers returned
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
-- set a language object and code in the args table
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- table 'out' stores the return value(s):
local out = propertyvalueandquals(props, args, qualID)
-- format the table of values and return it as a string:
return assembleoutput(out, args, entityid, propertyID)
end
-------------------------------------------------------------------------------
-- getValue is used to get the value(s) of a property
-- The property ID is passed as the first unnamed parameter and is required.
-- A locally supplied parameter may optionaly be supplied as the second unnamed parameter.
-- The function will now also return qualifiers if parameter qual is supplied
-------------------------------------------------------------------------------
-- Dependencies: _getValue; setRanks; parseInput; propertyvalueandquals; assembleoutput; parseParam; sourced;
-- labelOrId; i18n.latestdatequalifier; format_Date; makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p.getValue = function(frame)
local args= frame.args
if not args[1] then
args = frame:getParent().args
if not args[1] then return i18n.errors["No property supplied"] end
end
return p._getValue(args)
end
-------------------------------------------------------------------------------
-- getPreferredValue is used to get a value,
-- (or a comma separated list of them if multiple values exist).
-- If preferred ranks are set, it will return those values, otherwise values with normal ranks
-- now redundant to getValue with |rank=best
-------------------------------------------------------------------------------
-- Dependencies: p.getValue; setRanks; parseInput; propertyvalueandquals; assembleoutput;
-- parseParam; sourced; labelOrId; i18n.latestdatequalifier; format_Date;
-- makeOrdinal; roundto; decimalPrecision; decimalToDMS;
-------------------------------------------------------------------------------
p.getPreferredValue = function(frame)
frame.args.rank = "best"
return p.getValue(frame)
end
-------------------------------------------------------------------------------
-- getCoords is used to get coordinates for display in an infobox
-- whitelist and blacklist are implemented
-- optional 'display' parameter is allowed, defaults to nil - was "inline, title"
-------------------------------------------------------------------------------
-- Dependencies: setRanks(); parseInput(); decimalPrecision();
-------------------------------------------------------------------------------
p.getCoords = function(frame)
local propertyID = "P625"
-- if there is a 'display' parameter supplied, use it
-- otherwise default to nothing
local disp = frame.args.display or ""
if disp == "" then
disp = nil -- default to not supplying display parameter, was "inline, title"
end
-- there may be a format parameter to switch from deg/min/sec to decimal degrees
-- default is deg/min/sec
-- decimal degrees needs |format = dec
local form = (frame.args.format or ""):lower():sub(1,3)
if form ~= "dec" then
form = "dms"
end
-- just deal with best values
frame.args.reqranks = setRanks("best")
local qid, props = parseInput(frame, frame.args[1], propertyID)
if not qid then
return props -- either local parameter or nothing
else
local dv = props[1].mainsnak.datavalue.value
local lat, long, prec = dv.latitude, dv.longitude, dv.precision
lat = decimalPrecision(lat, prec)
long = decimalPrecision(long, prec)
local lat_long = { lat, long }
lat_long["display"] = disp
lat_long["format"] = form
-- invoke template Coord with the values stored in the table
return frame:expandTemplate{title = 'coord', args = lat_long}
end
end
-------------------------------------------------------------------------------
-- getQualifierValue is used to get a formatted value of a qualifier
--
-- The call needs: a property (the unnamed parameter or 1=)
-- a target value for that property (pval=)
-- a qualifier for that target value (qual=)
-- The usual whitelisting and blacklisting of the property is implemented
-- The boolean onlysourced= parameter can be set to return nothing
-- when the property is unsourced (or only sourced to Wikipedia)
-------------------------------------------------------------------------------
-- Dependencies: parseParam(); setRanks(); parseInput(); sourced();
-- propertyvalueandquals(); assembleoutput();
-- labelOrId(); i18n.latestdatequalifier(); format_Date();
-- findLang(); makeOrdinal(); roundto(); decimalPrecision(); decimalToDMS();
-------------------------------------------------------------------------------
p.getQualifierValue = function(frame)
-- The property ID that will have a qualifier is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or "")
-- The value of the property we want to match whose qualifier value is to be returned
-- is passed in named parameter |pval=
local propvalue = frame.args.pval
-- The property ID of the qualifier
-- whose value is to be returned is passed in named parameter |qual=
local qualifierID = frame.args.qual
-- A filter can be set like this: filter=P642==Q22674854
local filter, fprop, fval
local ftable = mw.text.split(frame.args.filter or "", "==")
if ftable[2] then
fprop = mw.text.trim(ftable[1])
fval = mw.text.trim(ftable[2])
filter = true
end
-- onlysourced is a boolean passed to return qualifiers
-- only when property values are sourced to something other than Wikipedia
-- if nothing or an empty string is passed set it true
-- if "false" or "no" or 0 is passed set it false
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set a language object and language code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- check for locally supplied parameter in second unnamed parameter
-- success means no local parameter and the property exists
local qid, props = parseInput(frame, frame.args[2], propertyID)
if qid then
local out = {}
-- Scan through the values of the property
-- we want something like property is P793, significant event (in propertyID)
-- whose value is something like Q385378, construction (in propvalue)
-- then we can return the value(s) of a qualifier such as P580, start time (in qualifierID)
for k1, v1 in pairs(props) do
if v1.mainsnak.snaktype == "value" and v1.mainsnak.datavalue.type == "wikibase-entityid" then
-- It's a wiki-linked value, so check if it's the target (in propvalue) and if it has qualifiers
if v1.mainsnak.datavalue.value.id == propvalue and v1.qualifiers then
if onlysrc == false or sourced(v1) then
-- if we've got this far, we have a (sourced) claim with qualifiers
-- which matches the target, so apply the filter and find the value(s) of the qualifier we want
if not filter or (v1.qualifiers[fprop] and v1.qualifiers[fprop][1].datavalue.value.id == fval) then
local quals = v1.qualifiers[qualifierID]
if quals then
-- can't reference qualifer, so set onlysourced = "no" (args are strings, not boolean)
local qargs = frame.args
qargs.onlysourced = "no"
local vals = propertyvalueandquals(quals, qargs, qid)
for k, v in ipairs(vals) do
out[#out + 1] = v
end
end
end
end -- of check for sourced
end -- of check for matching required value and has qualifiers
end -- of check for wikibase entity
end -- of loop through values of propertyID
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- either local parameter or nothing
end -- of test for success
return nil
end
-------------------------------------------------------------------------------
-- getSumOfParts scans the property 'has part' (P527) for values matching a list.
-- The list is passed in parameter vlist.
-- It consists of a string of Qids separated by spaces or any usual punctuation.
-- If the matched values have a qualifier 'quantity' (P1114), those quantities are summed.
-- The sum is returned as a number or nothing if zero.
-------------------------------------------------------------------------------
-- Dependencies: _getsumofparts;
-------------------------------------------------------------------------------
p.getSumOfParts = function(frame)
local sum = _getsumofparts(frame.args)
if sum == 0 then return end
return sum
end
-------------------------------------------------------------------------------
-- getValueByQual gets the value of a property which has a qualifier with a given entity value
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the ID of a qualifier for that property (qualID=Pyyy)
-- either the Wikibase-entity ID of a value for that qualifier (qvalue=Qzzz)
-- or a string value for that qualifier (qvalue=abc123)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: _getvaluebyqual; parseParam; setRanks; parseInput; sourced;
-- assembleoutput;
-------------------------------------------------------------------------------
p.getValueByQual = function(frame)
local qualID = frame.args.qualID
-- The Q-id of the value for the qualifier we want to match is in named parameter |qvalue=
local qval = frame.args.qvalue or ""
if qval == "" then return "no qualifier value supplied" end
local function checkQID(id)
return id == qval
end
return _getvaluebyqual(frame, qualID, checkQID)
end
-------------------------------------------------------------------------------
-- getValueByLang gets the value of a property which has a qualifier P407
-- ("language of work or name") whose value has the given language code
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the MediaWiki language code to match the language (lang=xx[-yy])
-- (if no code is supplied, it uses the default language)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: _getvaluebyqual; parseParam; setRanks; parseInput; sourced; assembleoutput;
-------------------------------------------------------------------------------
p.getValueByLang = function(frame)
-- The language code for the qualifier we want to match is in named parameter |lang=
local langcode = findLang(frame.args.lang).code
local function checkLanguage(id)
-- id should represent a language like "British English (Q7979)"
-- it should have string property "Wikimedia language code (P424)"
-- qlcode will be a table:
local qlcode = mw.wikibase.getBestStatements(id, "P424")
if (#qlcode > 0) and (qlcode[1].mainsnak.datavalue.value == langcode) then
return true
end
end
return _getvaluebyqual(frame, "P407", checkLanguage)
end
-------------------------------------------------------------------------------
-- getValueByRefSource gets the value of a property which has a reference "stated in" (P248)
-- whose value has the given entity-ID.
-- The call needs:
-- a property ID (the unnamed parameter or 1=Pxxx)
-- the entity ID of a value to match where the reference is stated in (match=Qzzz)
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getValueByRefSource = function(frame)
-- The property ID that we want to check is the first unnamed parameter
local propertyID = mw.text.trim(frame.args[1] or ""):upper()
if propertyID == "" then return "no property supplied" end
-- The Q-id of the value we want to match is in named parameter |qvalue=
local qval = (frame.args.match or ""):upper()
if qval == "" then qval = "Q21540096" end
local unit = (frame.args.unit or ""):upper()
if unit == "" then unit = "Q4917" end
local onlysrc = parseParam(frame.args.onlysourced or frame.args.osd, true)
-- set the requested ranks flags
frame.args.reqranks = setRanks(frame.args.rank)
-- set a language object and code in the frame.args table
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local linked = parseParam(frame.args.linked, true)
local uabbr = parseParam(frame.args.uabbr or frame.args.unitabbr, false)
-- qid not nil means no local parameter and the property exists
local qid, props = parseInput(frame, frame.args[2], propertyID)
if qid then
local out = {}
local mlt= {}
for k1, v1 in ipairs(props) do
if onlysrc == false or sourced(v1) then
if v1.references then
for k2, v2 in ipairs(v1.references) do
if v2.snaks.P248 then
for k3, v3 in ipairs(v2.snaks.P248) do
if v3.datavalue.value.id == qval then
out[#out+1], mlt[#out+1] = rendersnak(v1, frame.args, linked, "", "", "", "", uabbr, unit)
if not mlt[#out] then
-- we only need one match per property value
-- unless datatype was monolingual text
break
end
end -- of test for match
end -- of loop through values "stated in"
end -- of test that "stated in" exists
end -- of loop through references
end -- of test that references exist
end -- of test for sourced
end -- of loop through values of propertyID
if #mlt > 0 then
local langcode = frame.args.lang
langcode = mw.text.split( langcode, '-', true )[1]
local fbtbl = mw.language.getFallbacksFor( langcode )
table.insert( fbtbl, 1, langcode )
local bestval = ""
local found = false
for idx1, lang1 in ipairs(fbtbl) do
for idx2, lang2 in ipairs(mlt) do
if (lang1 == lang2) and not found then
bestval = out[idx2]
found = true
break
end
end -- loop through values of property
end -- loop through fallback languages
if found then
-- replace output table with a table containing the best value
out = { bestval }
else
-- more than one value and none of them on the list of fallback languages
-- sod it, just give them the first one
out = { out[1] }
end
end
return assembleoutput(out, frame.args, qid, propertyID)
else
return props -- no property or local parameter supplied
end -- of test for success
end
-------------------------------------------------------------------------------
-- getPropertyIDs takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- It returns the Entity-IDs (Qids) of the values of a property if it is a Wikibase-Entity.
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p._getPropertyIDs = function(args)
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- change default for noicon to true
args.noicon = tostring(parseParam(args.noicon or "", true))
local f = {}
f.args = args
local pid = mw.text.trim(args[1] or ""):upper()
-- get the qid and table of claims for the property, or nothing and the local value passed
local qid, props = parseInput(f, args[2], pid)
if not qid then return props end
if not props[1] then return nil end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local out = {}
for i, v in ipairs(props) do
local snak = v.mainsnak
if ( snak.datatype == "wikibase-item" )
and ( v.rank and args.reqranks[v.rank:sub(1, 1)] )
and ( snak.snaktype == "value" )
and ( sourced(v) or not onlysrc )
then
out[#out+1] = snak.datavalue.value.id
end
if maxvals > 0 and #out >= maxvals then break end
end
return assembleoutput(out, args, qid, pid)
end
p.getPropertyIDs = function(frame)
local args = frame.args
return p._getPropertyIDs(args)
end
-------------------------------------------------------------------------------
-- getQualifierIDs takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- It takes a property-id as the first unnamed parameter, and an optional parameter qlist
-- which is a list of qualifier property-ids to search for (default is "ALL")
-- It returns the Entity-IDs (Qids) of the values of a property if it is a Wikibase-Entity.
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getQualifierIDs = function(frame)
local args = frame.args
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
-- change default for noicon to true
args.noicon = tostring(parseParam(args.noicon or "", true))
local f = {}
f.args = args
local pid = mw.text.trim(args[1] or ""):upper()
-- get the qid and table of claims for the property, or nothing and the local value passed
local qid, props = parseInput(f, args[2], pid)
if not qid then return props end
if not props[1] then return nil end
-- get the other parameters
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qlist = args.qlist or ""
if qlist == "" then qlist = "ALL" end
qlist = qlist:gsub("[%p%s]+", " ") .. " "
local out = {}
for i, v in ipairs(props) do
local snak = v.mainsnak
if ( v.rank and args.reqranks[v.rank:sub(1, 1)] )
and ( snak.snaktype == "value" )
and ( sourced(v) or not onlysrc )
then
if v.qualifiers then
for k1, v1 in pairs(v.qualifiers) do
if qlist == "ALL " or qlist:match(k1 .. " ") then
for i2, v2 in ipairs(v1) do
if v2.datatype == "wikibase-item" and v2.snaktype == "value" then
out[#out+1] = v2.datavalue.value.id
end -- of test that id exists
end -- of loop through qualifier values
end -- of test for kq in qlist
end -- of loop through qualifiers
end -- of test for qualifiers
end -- of test for rank value, sourced, and value exists
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through property values
return assembleoutput(out, args, qid, pid)
end
-------------------------------------------------------------------------------
-- getPropOfProp takes two propertyIDs: prop1 and prop2 (as well as the usual parameters)
-- If the value(s) of prop1 are of type "wikibase-item" then it returns the value(s) of prop2
-- of each of those wikibase-items.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p._getPropOfProp = function(args)
-- parameter sets for commonly used groups of parameters
local paraset = tonumber(args.ps or args.parameterset or 0)
if paraset == 1 then
-- a common setting
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
elseif paraset == 2 then
-- equivalent to raw
args.rank = "best"
args.fetchwikidata = "ALL"
args.onlysourced = "no"
args.noicon = "true"
args.linked = "no"
args.pd = "true"
elseif paraset == 3 then
-- third set goes here
end
args.reqranks = setRanks(args.rank)
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
local pid1 = args.prop1 or args.pid1 or ""
local pid2 = args.prop2 or args.pid2 or ""
if pid1 == "" or pid2 == "" then return nil end
local f = {}
f.args = args
local qid1, statements1 = parseInput(f, args[1], pid1)
-- parseInput nulls empty args[1] and returns args[1] if nothing on Wikidata
if not qid1 then return statements1 end
-- otherwise it returns the qid and a table for the statement
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
local out = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
local snak = v.mainsnak
if snak.datatype == "wikibase-item" and snak.snaktype == "value" then
local qid2 = snak.datavalue.value.id
local statements2 = {}
if args.reqranks.b then
statements2 = mw.wikibase.getBestStatements(qid2, pid2)
else
statements2 = mw.wikibase.getAllStatements(qid2, pid2)
end
if statements2[1] then
local out2 = propertyvalueandquals(statements2, args, qualID)
out[#out+1] = assembleoutput(out2, args, qid2, pid2)
end
end -- of test for valid property1 value
end -- of test for sourced
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of property1
return assembleoutput(out, args, qid1, pid1)
end
p.getPropOfProp = function(frame)
local args= frame.args
if not args.prop1 and not args.pid1 then
args = frame:getParent().args
if not args.prop1 and not args.pid1 then return i18n.errors["No property supplied"] end
end
return p._getPropOfProp(args)
end
-------------------------------------------------------------------------------
-- getAwardCat takes most of the usual parameters. If the item has values of P166 (award received),
-- then it examines each of those awards for P2517 (category for recipients of this award).
-- If it exists, it returns the corresponding category,
-- with the item's P734 (family name) as sort key, or no sort key if there is no family name.
-- The sort key may be overridden by the parameter |sortkey (alias |sk).
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getAwardCat = function(frame)
frame.args.reqranks = setRanks(frame.args.rank)
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
args.sep = " "
local pid1 = args.prop1 or "P166"
local pid2 = args.prop2 or "P2517"
if pid1 == "" or pid2 == "" then return nil end
-- locally supplied value:
local localval = mw.text.trim(args[1] or "")
local qid1, statements1 = parseInput(frame, localval, pid1)
if not qid1 then return localval end
-- linkprefix (strip quotes)
local lp = (args.linkprefix or args.lp or ""):gsub('"', '')
-- sort key (strip quotes, hyphens and periods):
local sk = (args.sortkey or args.sk or ""):gsub('["-.]', '')
-- family name:
local famname = ""
if sk == "" then
local p734 = mw.wikibase.getBestStatements(qid1, "P734")[1]
local p734id = p734 and p734.mainsnak.snaktype == "value" and p734.mainsnak.datavalue.value.id or ""
famname = mw.wikibase.getSitelink(p734id) or ""
-- strip namespace and disambigation
local pos = famname:find(":") or 0
famname = famname:sub(pos+1):gsub("%s%(.+%)$", "")
if famname == "" then
local lbl = mw.wikibase.getLabel(p734id)
famname = lbl and mw.text.nowiki(lbl) or ""
end
end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
local qualID = mw.text.trim(args.qual or ""):upper()
if qualID == "" then qualID = nil end
local out = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
local snak = v.mainsnak
if snak.datatype == "wikibase-item" and snak.snaktype == "value" then
local qid2 = snak.datavalue.value.id
local statements2 = {}
if args.reqranks.b then
statements2 = mw.wikibase.getBestStatements(qid2, pid2)
else
statements2 = mw.wikibase.getAllStatements(qid2, pid2)
end
if statements2[1] and statements2[1].mainsnak.snaktype == "value" then
local qid3 = statements2[1].mainsnak.datavalue.value.id
local sitelink = mw.wikibase.getSitelink(qid3)
-- if there's no local sitelink, create the sitelink from English label
if not sitelink then
local lbl = mw.wikibase.getLabelByLang(qid3, "en")
if lbl then
if lbl:sub(1,9) == "Category:" then
sitelink = mw.text.nowiki(lbl)
else
sitelink = "Category:" .. mw.text.nowiki(lbl)
end
end
end
if sitelink then
if sk ~= "" then
out[#out+1] = "[[" .. lp .. sitelink .. "|" .. sk .. "]]"
elseif famname ~= "" then
out[#out+1] = "[[" .. lp .. sitelink .. "|" .. famname .. "]]"
else
out[#out+1] = "[[" .. lp .. sitelink .. "]]"
end -- of check for sort keys
end -- of test for sitelink
end -- of test for category
end -- of test for wikibase item has a value
end -- of test for sourced
if maxvals > 0 and #out >= maxvals then break end
end -- of loop through values of property1
return assembleoutput(out, args, qid1, pid1)
end
-------------------------------------------------------------------------------
-- getIntersectCat takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented
-- It takes two properties, |prop1 and |prop2 (e.g. occupation and country of citizenship)
-- Each property's value is a wiki-base entity
-- For each value of the first parameter (ranks implemented) it fetches the value's main category
-- and then each value of the second parameter (possibly substituting a simpler description)
-- then it returns all of the categories representing the intersection of those properties,
-- (e.g. Category:Actors from Canada). A joining term may be supplied (e.g. |join=from).
-- The item's P734 (family name) is the sort key, or no sort key if there is no family name.
-- The sort key may be overridden by the parameter |sortkey (alias |sk).
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced; propertyvalueandquals assembleoutput;
-------------------------------------------------------------------------------
p.getIntersectCat = function(frame)
frame.args.reqranks = setRanks(frame.args.rank)
frame.args.langobj = findLang(frame.args.lang)
frame.args.lang = frame.args.langobj.code
local args = frame.args
args.sep = " "
args.linked = "no"
local pid1 = args.prop1 or "P106"
local pid2 = args.prop2 or "P27"
if pid1 == "" or pid2 == "" then return nil end
local qid, statements1 = parseInput(frame, "", pid1)
if not qid then return nil end
local qid, statements2 = parseInput(frame, "", pid2)
if not qid then return nil end
-- topics like countries may have different names in categories from their label in Wikidata
local subs_exists, subs = pcall(mw.loadData, "Module:WikidataIB/subs")
local join = args.join or ""
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local maxvals = tonumber(args.maxvals) or 0
-- linkprefix (strip quotes)
local lp = (args.linkprefix or args.lp or ""):gsub('"', '')
-- sort key (strip quotes, hyphens and periods):
local sk = (args.sortkey or args.sk or ""):gsub('["-.]', '')
-- family name:
local famname = ""
if sk == "" then
local p734 = mw.wikibase.getBestStatements(qid, "P734")[1]
local p734id = p734 and p734.mainsnak.snaktype == "value" and p734.mainsnak.datavalue.value.id or ""
famname = mw.wikibase.getSitelink(p734id) or ""
-- strip namespace and disambigation
local pos = famname:find(":") or 0
famname = famname:sub(pos+1):gsub("%s%(.+%)$", "")
if famname == "" then
local lbl = mw.wikibase.getLabel(p734id)
famname = lbl and mw.text.nowiki(lbl) or ""
end
end
local cat1 = {}
for k, v in ipairs(statements1) do
if not onlysrc or sourced(v) then
-- get the ID representing the value of the property
local pvalID = (v.mainsnak.snaktype == "value") and v.mainsnak.datavalue.value.id
if pvalID then
-- get the topic's main category (P910) for that entity
local p910 = mw.wikibase.getBestStatements(pvalID, "P910")[1]
if p910 and p910.mainsnak.snaktype == "value" then
local tmcID = p910.mainsnak.datavalue.value.id
-- use sitelink or the English label for the cat
local cat = mw.wikibase.getSitelink(tmcID)
if not cat then
local lbl = mw.wikibase.getLabelByLang(tmcID, "en")
if lbl then
if lbl:sub(1,9) == "Category:" then
cat = mw.text.nowiki(lbl)
else
cat = "Category:" .. mw.text.nowiki(lbl)
end
end
end
cat1[#cat1+1] = cat
end -- of test for topic's main category exists
end -- of test for property has vaild value
end -- of test for sourced
if maxvals > 0 and #cat1 >= maxvals then break end
end
local cat2 = {}
for k, v in ipairs(statements2) do
if not onlysrc or sourced(v) then
local cat = rendersnak(v, args)
if subs[cat] then cat = subs[cat] end
cat2[#cat2+1] = cat
end
if maxvals > 0 and #cat2 >= maxvals then break end
end
local out = {}
for k1, v1 in ipairs(cat1) do
for k2, v2 in ipairs(cat2) do
if sk ~= "" then
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "|" .. sk .. "]]"
elseif famname ~= "" then
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "|" .. famname .. "]]"
else
out[#out+1] = "[[" .. lp .. v1 .. " " .. join .. " " .. v2 .. "]]"
end -- of check for sort keys
end
end
args.noicon = "true"
return assembleoutput(out, args, qid, pid1)
end
-------------------------------------------------------------------------------
-- qualsToTable takes most of the usual parameters.
-- The usual whitelisting, blacklisting, onlysourced, etc. are implemented.
-- A qid may be given, and the first unnamed parameter is the property ID, which is of type wikibase item.
-- It takes a list of qualifier property IDs as |quals=
-- For a given qid and property, it creates the rows of an html table,
-- each row being a value of the property (optionally only if the property matches the value in |pval= )
-- each cell being the first value of the qualifier corresponding to the list in |quals
-------------------------------------------------------------------------------
-- Dependencies: parseParam; setRanks; parseInput; sourced;
-------------------------------------------------------------------------------
p.qualsToTable = function(frame)
local args = frame.args
local quals = args.quals or ""
if quals == "" then return "" end
args.reqranks = setRanks(args.rank)
local propertyID = mw.text.trim(args[1] or "")
local f = {}
f.args = args
local entityid, props = parseInput(f, "", propertyID)
if not entityid then return "" end
args.langobj = findLang(args.lang)
args.lang = args.langobj.code
local pval = args.pval or ""
local qplist = mw.text.split(quals, "%p") -- split at punctuation and make a sequential table
for i, v in ipairs(qplist) do
qplist[i] = mw.text.trim(v):upper() -- remove whitespace and capitalise
end
local col1 = args.firstcol or ""
if col1 ~= "" then
col1 = col1 .. "</td><td>"
end
local emptycell = args.emptycell or " "
-- construct a 2-D array of qualifier values in qvals
local qvals = {}
for i, v in ipairs(props) do
local skip = false
if pval ~= "" then
local pid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
if pid ~= pval then skip = true end
end
if not skip then
local qval = {}
local vqualifiers = v.qualifiers or {}
-- go through list of wanted qualifier properties
for i1, v1 in ipairs(qplist) do
-- check for that property ID in the statement's qualifiers
local qv, qtype
if vqualifiers[v1] then
qtype = vqualifiers[v1][1].datatype
if qtype == "time" then
if vqualifiers[v1][1].snaktype == "value" then
qv = mw.wikibase.renderSnak(vqualifiers[v1][1])
qv = frame:expandTemplate{title="dts", args={qv}}
else
qv = "?"
end
elseif qtype == "url" then
if vqualifiers[v1][1].snaktype == "value" then
qv = mw.wikibase.renderSnak(vqualifiers[v1][1])
local display = mw.ustring.match( mw.uri.decode(qv, "WIKI"), "([%w ]+)$" )
if display then
qv = "[" .. qv .. " " .. display .. "]"
end
end
else
qv = mw.wikibase.formatValue(vqualifiers[v1][1])
end
end
-- record either the value or a placeholder
qval[i1] = qv or emptycell
end -- of loop through list of qualifiers
-- add the list of qualifier values as a "row" in the main list
qvals[#qvals+1] = qval
end
end -- of for each value loop
local out = {}
for i, v in ipairs(qvals) do
out[i] = "<tr><td>" .. col1 .. table.concat(qvals[i], "</td><td>") .. "</td></tr>"
end
return table.concat(out, "\n")
end
-------------------------------------------------------------------------------
-- getGlobe takes an optional qid of a Wikidata entity passed as |qid=
-- otherwise it uses the linked item for the current page.
-- If returns the Qid of the globe used in P625 (coordinate location),
-- or nil if there isn't one.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getGlobe = function(frame)
local qid = frame.args.qid or frame.args[1] or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
local coords = mw.wikibase.getBestStatements(qid, "P625")[1]
local globeid
if coords and coords.mainsnak.snaktype == "value" then
globeid = coords.mainsnak.datavalue.value.globe:match("(Q%d+)")
end
return globeid
end
-------------------------------------------------------------------------------
-- getCommonsLink takes an optional qid of a Wikidata entity passed as |qid=
-- It returns one of the following in order of preference:
-- the Commons sitelink of the linked Wikidata item;
-- the Commons sitelink of the topic's main category of the linked Wikidata item;
-------------------------------------------------------------------------------
-- Dependencies: _getCommonslink(); _getSitelink(); parseParam()
-------------------------------------------------------------------------------
p.getCommonsLink = function(frame)
local oc = frame.args.onlycat or frame.args.onlycategories
local fb = parseParam(frame.args.fallback or frame.args.fb, true)
return _getCommonslink(frame.args.qid, oc, fb)
end
-------------------------------------------------------------------------------
-- getSitelink takes the qid of a Wikidata entity passed as |qid=
-- It takes an optional parameter |wiki= to determine which wiki is to be checked for a sitelink
-- If the parameter is blank, then it uses the local wiki.
-- If there is a sitelink to an article available, it returns the plain text link to the article
-- If there is no sitelink, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getSiteLink = function(frame)
return _getSitelink(frame.args.qid, frame.args.wiki or mw.text.trim(frame.args[1] or ""))
end
-------------------------------------------------------------------------------
-- getLink has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- If there is a sitelink to an article on the local Wiki, it returns a link to the article
-- with the Wikidata label as the displayed text.
-- If there is no sitelink, it returns the label as plain text.
-- If there is no label in the local language, it displays the qid instead.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLink = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
local sitelink = mw.wikibase.getSitelink(itemID)
local label = labelOrId(itemID)
if sitelink then
return "[[:" .. sitelink .. "|" .. label .. "]]"
else
return label
end
end
-------------------------------------------------------------------------------
-- getLabel has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- It returns the Wikidata label for the local language as plain text.
-- If there is no label in the local language, it displays the qid instead.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLabel = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
local lang = frame.args.lang or ""
if lang == "" then lang = nil end
local label = labelOrId(itemID, lang)
return label
end
-------------------------------------------------------------------------------
-- label has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- if no qid is supplied, it uses the qid associated with the current page.
-- It returns the Wikidata label for the local language as plain text.
-- If there is no label in the local language, it returns nil.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.label = function(frame)
local qid = mw.text.trim(frame.args[1] or frame.args.qid or "")
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return end
local lang = frame.args.lang or ""
if lang == "" then lang = nil end
local label, success = labelOrId(qid, lang)
if success then return label end
end
-------------------------------------------------------------------------------
-- getAT (Article Title)
-- has the qid of a Wikidata entity passed as the first unnamed parameter or as |qid=
-- If there is a sitelink to an article on the local Wiki, it returns the sitelink as plain text.
-- If there is no sitelink or qid supplied, it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAT = function(frame)
local itemID = mw.text.trim(frame.args[1] or frame.args.qid or "")
if itemID == "" then return end
return mw.wikibase.getSitelink(itemID)
end
-------------------------------------------------------------------------------
-- getDescription has the qid of a Wikidata entity passed as |qid=
-- (it defaults to the associated qid of the current article if omitted)
-- and a local parameter passed as the first unnamed parameter.
-- Any local parameter passed (other than "Wikidata" or "none") becomes the return value.
-- It returns the article description for the Wikidata entity if the local parameter is "Wikidata".
-- Nothing is returned if the description doesn't exist or "none" is passed as the local parameter.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getDescription = function(frame)
local desc = mw.text.trim(frame.args[1] or "")
local itemID = mw.text.trim(frame.args.qid or "")
if itemID == "" then itemID = nil end
if desc:lower() == 'wikidata' then
return mw.wikibase.getDescription(itemID)
elseif desc:lower() == 'none' then
return nil
else
return desc
end
end
-------------------------------------------------------------------------------
-- getAliases has the qid of a Wikidata entity passed as |qid=
-- (it defaults to the associated qid of the current article if omitted)
-- and a local parameter passed as the first unnamed parameter.
-- It implements blacklisting and whitelisting with a field name of "alias" by default.
-- Any local parameter passed becomes the return value.
-- Otherwise it returns the aliases for the Wikidata entity with the usual list options.
-- Nothing is returned if the aliases do not exist.
-------------------------------------------------------------------------------
-- Dependencies: findLang(); assembleoutput()
-------------------------------------------------------------------------------
p.getAliases = function(frame)
local args = frame.args
local fieldname = args.name or ""
if fieldname == "" then fieldname = "alias" end
local blacklist = args.suppressfields or args.spf or ""
if blacklist:find(fieldname) then return nil end
local localval = mw.text.trim(args[1] or "")
if localval ~= "" then return localval end
local whitelist = args.fetchwikidata or args.fwd or ""
if whitelist == "" then whitelist = "NONE" end
if not (whitelist == 'ALL' or whitelist:find(fieldname)) then return nil end
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return nil end
local aliases = mw.wikibase.getEntity(qid).aliases
if not aliases then return nil end
args.langobj = findLang(args.lang)
local langcode = args.langobj.code
args.lang = langcode
local out = {}
for k1, v1 in pairs(aliases) do
if v1[1].language == langcode then
for k1, v2 in ipairs(v1) do
out[#out+1] = v2.value
end
break
end
end
return assembleoutput(out, args, qid)
end
-------------------------------------------------------------------------------
-- pageId returns the page id (entity ID, Qnnn) of the current page
-- returns nothing if the page is not connected to Wikidata
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.pageId = function(frame)
return mw.wikibase.getEntityIdForCurrentPage()
end
-------------------------------------------------------------------------------
-- formatDate is a wrapper to export the private function format_Date
-------------------------------------------------------------------------------
-- Dependencies: format_Date();
-------------------------------------------------------------------------------
p.formatDate = function(frame)
return format_Date(frame.args[1], frame.args.df, frame.args.bc)
end
-------------------------------------------------------------------------------
-- location is a wrapper to export the private function _location
-- it takes the entity-id as qid or the first unnamed parameter
-- optional boolean parameter first toggles the display of the first item
-- optional boolean parameter skip toggles the display to skip to the last item
-- parameter debug=<y/n> (default 'n') adds error msg if not a location
-------------------------------------------------------------------------------
-- Dependencies: _location();
-------------------------------------------------------------------------------
p.location = function(frame)
local debug = (frame.args.debug or ""):sub(1, 1):lower()
if debug == "" then debug = "n" end
local qid = mw.text.trim(frame.args.qid or frame.args[1] or ""):upper()
if qid == "" then qid=mw.wikibase.getEntityIdForCurrentPage() end
if not qid then
if debug ~= "n" then
return i18n.errors["entity-not-found"]
else
return nil
end
end
local first = mw.text.trim(frame.args.first or "")
local skip = mw.text.trim(frame.args.skip or "")
return table.concat( _location(qid, first, skip), ", " )
end
-------------------------------------------------------------------------------
-- checkBlacklist implements a test to check whether a named field is allowed
-- returns true if the field is not blacklisted (i.e. allowed)
-- returns false if the field is blacklisted (i.e. disallowed)
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Joe |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}
-- displays "blacklisted"
-- {{#if:{{#invoke:WikidataIB |checkBlacklist |name=Jim |suppressfields=Dave; Joe; Fred}} | not blacklisted | blacklisted}}
-- displays "not blacklisted"
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.checkBlacklist = function(frame)
local blacklist = frame.args.suppressfields or frame.args.spf or ""
local fieldname = frame.args.name or ""
if blacklist ~= "" and fieldname ~= "" then
if blacklist:find(fieldname) then
return false
else
return true
end
else
-- one of the fields is missing: let's call that "not on the list"
return true
end
end
-------------------------------------------------------------------------------
-- emptyor returns nil if its first unnamed argument is just punctuation, whitespace or html tags
-- otherwise it returns the argument unchanged (including leading/trailing space).
-- If the argument may contain "=", then it must be called explicitly:
-- |1=arg
-- (In that case, leading and trailing spaces are trimmed)
-- It finds use in infoboxes where it can replace tests like:
-- {{#if: {{#invoke:WikidatIB |getvalue |P99 |fwd=ALL}} | <span class="xxx">{{#invoke:WikidatIB |getvalue |P99 |fwd=ALL}}</span> | }}
-- with a form that uses just a single call to Wikidata:
-- {{#invoke |WikidataIB |emptyor |1= <span class="xxx">{{#invoke:WikidataIB |getvalue |P99 |fwd=ALL}}</span> }}
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.emptyor = function(frame)
local s = frame.args[1] or ""
if s == "" then return nil end
local sx = s:gsub("%s", ""):gsub("<[^>]*>", ""):gsub("%p", "")
if sx == "" then
return nil
else
return s
end
end
-------------------------------------------------------------------------------
-- labelorid is a public function to expose the output of labelOrId()
-- Pass the Q-number as |qid= or as an unnamed parameter.
-- It returns the Wikidata label for that entity or the qid if no label exists.
-------------------------------------------------------------------------------
-- Dependencies: labelOrId
-------------------------------------------------------------------------------
p.labelorid = function(frame)
return (labelOrId(frame.args.qid or frame.args[1]))
end
-------------------------------------------------------------------------------
-- getLang returns the MediaWiki language code of the current content.
-- If optional parameter |style=full, it returns the language name.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getLang = function(frame)
local style = (frame.args.style or ""):lower()
local langcode = mw.language.getContentLanguage().code
if style == "full" then
return mw.language.fetchLanguageName( langcode )
end
return langcode
end
-------------------------------------------------------------------------------
-- getItemLangCode takes a qid parameter (using the current page's qid if blank)
-- If the item for that qid has property country (P17) it looks at the first preferred value
-- If the country has an official language (P37), it looks at the first preferred value
-- If that official language has a language code (P424), it returns the first preferred value
-- Otherwise it returns nothing.
-------------------------------------------------------------------------------
-- Dependencies: _getItemLangCode()
-------------------------------------------------------------------------------
p.getItemLangCode = function(frame)
return _getItemLangCode(frame.args.qid or frame.args[1])
end
-------------------------------------------------------------------------------
-- findLanguage exports the local findLang() function
-- It takes an optional language code and returns, in order of preference:
-- the code if a known language;
-- the user's language, if set;
-- the server's content language.
-------------------------------------------------------------------------------
-- Dependencies: findLang
-------------------------------------------------------------------------------
p.findLanguage = function(frame)
return findLang(frame.args.lang or frame.args[1]).code
end
-------------------------------------------------------------------------------
-- getQid returns the qid, if supplied
-- failing that, the Wikidata entity ID of the "category's main topic (P301)", if it exists
-- failing that, the Wikidata entity ID associated with the current page, if it exists
-- otherwise, nothing
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getQid = function(frame)
local qid = (frame.args.qid or ""):upper()
-- check if a qid was passed; if so, return it:
if qid ~= "" then return qid end
-- check if there's a "category's main topic (P301)":
qid = mw.wikibase.getEntityIdForCurrentPage()
if qid then
local prop301 = mw.wikibase.getBestStatements(qid, "P301")
if prop301[1] then
local mctid = prop301[1].mainsnak.datavalue.value.id
if mctid then return mctid end
end
end
-- otherwise return the page qid (if any)
return qid
end
-------------------------------------------------------------------------------
-- followQid takes four optional parameters: qid, props, list and all.
-- If qid is not given, it uses the qid for the connected page
-- or returns nil if there isn't one.
-- props is a list of properties, separated by punctuation.
-- If props is given, the Wikidata item for the qid is examined for each property in turn.
-- If that property contains a value that is another Wikibase-item, that item's qid is returned,
-- and the search terminates, unless |all=y when all of the qids are returned, separated by spaces.
-- If |list= is set to a template, the qids are passed as arguments to the template.
-- If props is not given, the qid is returned.
-------------------------------------------------------------------------------
-- Dependencies: parseParam()
-------------------------------------------------------------------------------
p._followQid = function(args)
local qid = (args.qid or ""):upper()
local all = parseParam(args.all, false)
local list = args.list or ""
if list == "" then list = nil end
if qid == "" then
qid = mw.wikibase.getEntityIdForCurrentPage()
end
if not qid then return nil end
local out = {}
local props = (args.props or ""):upper()
if props ~= "" then
for p in mw.text.gsplit(props, "%p") do -- split at punctuation and iterate
p = mw.text.trim(p)
for i, v in ipairs( mw.wikibase.getBestStatements(qid, p) ) do
local linkedid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id
if linkedid then
if all then
out[#out+1] = linkedid
else
return linkedid
end -- test for all or just the first one found
end -- test for value exists for that property
end -- loop through values of property to follow
end -- loop through list of properties to follow
end
if #out > 0 then
local ret = ""
if list then
ret = mw.getCurrentFrame():expandTemplate{title = list, args = out}
else
ret = table.concat(out, " ")
end
return ret
else
return qid
end
end
p.followQid = function(frame)
return p._followQid(frame.args)
end
-------------------------------------------------------------------------------
-- globalSiteID returns the globalSiteID for the current wiki
-- e.g. returns "enwiki" for the English Wikipedia, "enwikisource" for English Wikisource, etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.globalSiteID = function(frame)
return mw.wikibase.getGlobalSiteId()
end
-------------------------------------------------------------------------------
-- siteID returns the root of the globalSiteID
-- e.g. "en" for "enwiki", "enwikisource", etc.
-- treats "en-gb" as "en", etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.siteID = function(frame)
local txtlang = frame:callParserFunction('int', {'lang'}) or ""
-- This deals with specific exceptions: be-tarask -> be-x-old
if txtlang == "be-tarask" then
return "be_x_old"
end
local pos = txtlang:find("-")
local ret = ""
if pos then
ret = txtlang:sub(1, pos-1)
else
ret = txtlang
end
return ret
end
-------------------------------------------------------------------------------
-- projID returns the code used to link to the reader's language's project
-- e.g "en" for [[:en:WikidataIB]]
-- treats "en-gb" as "en", etc.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.projID = function(frame)
local txtlang = frame:callParserFunction('int', {'lang'}) or ""
-- This deals with specific exceptions: be-tarask -> be-x-old
if txtlang == "be-tarask" then
return "be-x-old"
end
local pos = txtlang:find("-")
local ret = ""
if pos then
ret = txtlang:sub(1, pos-1)
else
ret = txtlang
end
return ret
end
-------------------------------------------------------------------------------
-- formatNumber formats a number according to the the supplied language code ("|lang=")
-- or the default language if not supplied.
-- The number is the first unnamed parameter or "|num="
-------------------------------------------------------------------------------
-- Dependencies: findLang()
-------------------------------------------------------------------------------
p.formatNumber = function(frame)
local lang
local num = tonumber(frame.args[1] or frame.args.num) or 0
lang = findLang(frame.args.lang)
return lang:formatNum( num )
end
-------------------------------------------------------------------------------
-- examine dumps the property (the unnamed parameter or pid)
-- from the item given by the parameter 'qid' (or the other unnamed parameter)
-- or from the item corresponding to the current page if qid is not supplied.
-- e.g. {{#invoke:WikidataIB |examine |pid=P26 |qid=Q42}}
-- or {{#invoke:WikidataIB |examine |P26 |Q42}} or any combination of these
-- or {{#invoke:WikidataIB |examine |P26}} for the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.examine = function( frame )
local args
if frame.args[1] or frame.args.pid or frame.args.qid then
args = frame.args
else
args = frame:getParent().args
end
local par = {}
local pid = (args.pid or ""):upper()
local qid = (args.qid or ""):upper()
par[1] = mw.text.trim( args[1] or "" ):upper()
par[2] = mw.text.trim( args[2] or "" ):upper()
table.sort(par)
if par[2]:sub(1,1) == "P" then par[1], par[2] = par[2], par[1] end
if pid == "" then pid = par[1] end
if qid == "" then qid = par[2] end
local q1 = qid:sub(1,1)
if pid:sub(1,1) ~= "P" then return "No property supplied" end
if q1 ~= "Q" and q1 ~= "M" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return "No item for this page" end
return "<pre>" .. mw.dumpObject( mw.wikibase.getAllStatements( qid, pid ) ) .. "</pre>"
end
-------------------------------------------------------------------------------
-- checkvalue looks for 'val' as a wikibase-item value of a property (the unnamed parameter or pid)
-- from the item given by the parameter 'qid'
-- or from the Wikidata item associated with the current page if qid is not supplied.
-- It only checks ranks that are requested (preferred and normal by default)
-- If property is not supplied, then P31 (instance of) is assumed.
-- It returns val if found or nothing if not found.
-- e.g. {{#invoke:WikidataIB |checkvalue |val=Q5 |pid=P31 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |P31 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |qid=Q42}}
-- or {{#invoke:WikidataIB |checkvalue |val=Q5 |P31}} for the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.checkvalue = function( frame )
local args
if frame.args.val then
args = frame.args
else
args = frame:getParent().args
end
local val = args.val
if not val then return nil end
local pid = mw.text.trim(args.pid or args[1] or "P31"):upper()
local qid = (args.qid or ""):upper()
if pid:sub(1,1) ~= "P" then return nil end
if qid:sub(1,1) ~= "Q" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
local ranks = setRanks(args.rank)
local stats = {}
if ranks.b then
stats = mw.wikibase.getBestStatements(qid, pid)
else
stats = mw.wikibase.getAllStatements( qid, pid )
end
if not stats[1] then return nil end
if stats[1].mainsnak.datatype == "wikibase-item" then
for k, v in pairs( stats ) do
local ms = v.mainsnak
if ranks[v.rank:sub(1,1)] and ms.snaktype == "value" and ms.datavalue.value.id == val then
return val
end
end
end
return nil
end
-------------------------------------------------------------------------------
-- url2 takes a parameter url= that is a proper url and formats it for use in an infobox.
-- If no parameter is supplied, it returns nothing.
-- This is the equivalent of Template:URL
-- but it keeps the "edit at Wikidata" pen icon out of the microformat.
-- Usually it will take its url parameter directly from a Wikidata call:
-- e.g. {{#invoke:WikidataIB |url2 |url={{wdib |P856 |qid=Q23317 |fwd=ALL |osd=no}} }}
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.url2 = function(frame)
local txt = frame.args.url or ""
if txt == "" then return nil end
-- extract any icon
local url, icon = txt:match("(.+) (.+)")
-- make sure there's at least a space at the end
url = (url or txt) .. " "
icon = icon or ""
-- extract any protocol like https://
local prot = url:match("(https*://).+[ \"\']")
-- extract address
local addr = ""
if prot then
addr = url:match("https*://(.+)[ \"\']") or " "
else
prot = "//"
addr = url:match("[^%p%s]+%.(.+)[ \"\']") or " "
end
-- strip trailing / from end of domain-only url and add <wbr/> before . and /
local disp, n = addr:gsub( "^([^/]+)/$", "%1" ):gsub("%/", "<wbr/>/"):gsub("%.", "<wbr/>.")
return '<span class="url">[' .. prot .. addr .. " " .. disp .. "]</span> " .. icon
end
-------------------------------------------------------------------------------
-- getWebsite fetches the Official website (P856) and formats it for use in an infobox.
-- This is similar to Template:Official website but with a url displayed,
-- and it adds the "edit at Wikidata" pen icon beyond the microformat if enabled.
-- A local value will override the Wikidata value. "NONE" returns nothing.
-- e.g. {{#invoke:WikidataIB |getWebsite |qid= |noicon= |lang= |url= }}
-------------------------------------------------------------------------------
-- Dependencies: findLang(); parseParam();
-------------------------------------------------------------------------------
p.getWebsite = function(frame)
local url = frame.args.url or ""
if url:upper() == "NONE" then return nil end
local urls = {}
local quals = {}
local qid = frame.args.qid or ""
if url and url ~= "" then
urls[1] = url
else
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return nil end
local prop856 = mw.wikibase.getBestStatements(qid, "P856")
for k, v in pairs(prop856) do
if v.mainsnak.snaktype == "value" then
urls[#urls+1] = v.mainsnak.datavalue.value
if v.qualifiers and v.qualifiers["P1065"] then
-- just take the first archive url (P1065)
local au = v.qualifiers["P1065"][1]
if au.snaktype == "value" then
quals[#urls] = au.datavalue.value
end -- test for archive url having a value
end -- test for qualifers
end -- test for website having a value
end -- loop through website(s)
end
if #urls == 0 then return nil end
local out = {}
for i, u in ipairs(urls) do
local link = quals[i] or u
local prot, addr = u:match("(http[s]*://)(.+)")
addr = addr or u
local disp, n = addr:gsub("%.", "<wbr/>%.")
out[#out+1] = '<span class="url">[' .. link .. " " .. disp .. "]</span>"
end
local langcode = findLang(frame.args.lang).code
local noicon = parseParam(frame.args.noicon, false)
if url == "" and not noicon then
out[#out] = out[#out] .. createicon(langcode, qid, "P856")
end
local ret = ""
if #out > 1 then
ret = mw.getCurrentFrame():expandTemplate{title = "ubl", args = out}
else
ret = out[1]
end
return ret
end
-------------------------------------------------------------------------------
-- getAllLabels fetches the set of labels and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllLabels = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local labels = mw.wikibase.getEntity(qid).labels
if not labels then return i18n["labels-not-found"] end
local out = {}
for k, v in pairs(labels) do
out[#out+1] = v.value .. " (" .. v.language .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- getAllDescriptions fetches the set of descriptions and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllDescriptions = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local descriptions = mw.wikibase.getEntity(qid).descriptions
if not descriptions then return i18n["descriptions-not-found"] end
local out = {}
for k, v in pairs(descriptions) do
out[#out+1] = v.value .. " (" .. v.language .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- getAllAliases fetches the set of aliases and formats it for display as wikitext.
-- It takes a parameter 'qid' for arbitrary access, otherwise it uses the current page.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.getAllAliases = function(frame)
local args = frame.args or frame:getParent().args or {}
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid or not mw.wikibase.entityExists(qid) then return i18n["entity-not-found"] end
local aliases = mw.wikibase.getEntity(qid).aliases
if not aliases then return i18n["aliases-not-found"] end
local out = {}
for k1, v1 in pairs(aliases) do
local lang = v1[1].language
local val = {}
for k1, v2 in ipairs(v1) do
val[#val+1] = v2.value
end
out[#out+1] = table.concat(val, ", ") .. " (" .. lang .. ")"
end
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- showNoLinks displays the article titles that should not be linked.
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
p.showNoLinks = function(frame)
local out = {}
for k, v in pairs(donotlink) do
out[#out+1] = k
end
table.sort( out )
return table.concat(out, "; ")
end
-------------------------------------------------------------------------------
-- checkValidity checks whether the first unnamed parameter represents a valid entity-id,
-- that is, something like Q1235 or P123.
-- It returns the strings "true" or "false".
-- Change false to nil to return "true" or "" (easier to test with #if:).
-------------------------------------------------------------------------------
-- Dependencies: none
-------------------------------------------------------------------------------
function p.checkValidity(frame)
local id = mw.text.trim(frame.args[1] or "")
if mw.wikibase.isValidEntityId(id) then
return true
else
return false
end
end
-------------------------------------------------------------------------------
-- getEntityFromTitle returns the Entity-ID (Q-number) for a given title.
-- Modification of Module:ResolveEntityId
-- The title is the first unnamed parameter.
-- The site parameter determines the site/language for the title. Defaults to current wiki.
-- The showdab parameter determines whether dab pages should return the Q-number or nil. Defaults to true.
-- Returns the Q-number or nil if it does not exist.
-------------------------------------------------------------------------------
-- Dependencies: parseParam
-------------------------------------------------------------------------------
function p.getEntityFromTitle(frame)
local args=frame.args
if not args[1] then args=frame:getParent().args end
if not args[1] then return nil end
local title = mw.text.trim(args[1])
local site = args.site or ""
local showdab = parseParam(args.showdab, true)
local qid = mw.wikibase.getEntityIdForTitle(title, site)
if qid then
local prop31 = mw.wikibase.getBestStatements(qid, "P31")[1]
if not showdab and prop31 and prop31.mainsnak.datavalue.value.id == "Q4167410" then
return nil
else
return qid
end
end
end
-------------------------------------------------------------------------------
-- getDatePrecision returns the number representing the precision of the first best date value
-- for the given property.
-- It takes the qid and property ID
-- The meanings are given at https://www.mediawiki.org/wiki/Wikibase/DataModel#Dates_and_times
-- 0 = 1 billion years .. 6 = millennium, 7 = century, 8 = decade, 9 = year, 10 = month, 11 = day
-- Returns 0 (or the second unnamed parameter) if the Wikidata does not exist.
-------------------------------------------------------------------------------
-- Dependencies: parseParam; sourced;
-------------------------------------------------------------------------------
function p.getDatePrecision(frame)
local args=frame.args
if not args[1] then args=frame:getParent().args end
local default = tonumber(args[2] or args.default) or 0
local prop = mw.text.trim(args[1] or "")
if prop == "" then return default end
local qid = args.qid or ""
if qid == "" then qid = mw.wikibase.getEntityIdForCurrentPage() end
if not qid then return default end
local onlysrc = parseParam(args.onlysourced or args.osd, true)
local stat = mw.wikibase.getBestStatements(qid, prop)
for i, v in ipairs(stat) do
local prec = (onlysrc == false or sourced(v))
and v.mainsnak.datavalue
and v.mainsnak.datavalue.value
and v.mainsnak.datavalue.value.precision
if prec then return prec end
end
return default
end
return p
-------------------------------------------------------------------------------
-- List of exported functions
-------------------------------------------------------------------------------
--[[
_getValue
getValue
getPreferredValue
getCoords
getQualifierValue
getSumOfParts
getValueByQual
getValueByLang
getValueByRefSource
getPropertyIDs
getQualifierIDs
getPropOfProp
getAwardCat
getIntersectCat
getGlobe
getCommonsLink
getSiteLink
getLink
getLabel
label
getAT
getDescription
getAliases
pageId
formatDate
location
checkBlacklist
emptyor
labelorid
getLang
getItemLangCode
findLanguage
getQID
followQid
globalSiteID
siteID
projID
formatNumber
examine
checkvalue
url2
getWebsite
getAllLabels
getAllDescriptions
getAllAliases
showNoLinks
checkValidity
getEntityFromTitle
getDatePrecision
--]]
-------------------------------------------------------------------------------
ql7i3j6aywa93pfslfr0svyicj7ctkn
Template:Nowiki template demo
10
8984
74896
2016-07-15T04:28:07Z
en>Mr. Stradivarius
0
create wrapper template for [[Module:Template test case]]
74896
wikitext
text/x-wiki
<includeonly>{{#invoke:Template test case|main}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
tqcbtoi20hh04qz7tcyj9c81ibksvas
74897
74896
2026-08-24T00:42:44Z
Robertsky
10424
1 versaun husi [[:en:Template:Nowiki_template_demo]]
74896
wikitext
text/x-wiki
<includeonly>{{#invoke:Template test case|main}}</includeonly><noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
tqcbtoi20hh04qz7tcyj9c81ibksvas
Template:Examine
10
8985
74900
2020-12-05T18:35:17Z
en>Buidhe
0
Buidhe moved page [[Template:Examine]] to [[Template:Examine Wikidata item]]: RM closed as move
74900
wikitext
text/x-wiki
#REDIRECT [[Template:Examine Wikidata item]]
{{Redirect category shell|
{{R from move}}
}}
jo0g59umzp822n0om72owhkjf90dite
74901
74900
2026-08-24T00:42:44Z
Robertsky
10424
1 versaun husi [[:en:Template:Examine]]
74900
wikitext
text/x-wiki
#REDIRECT [[Template:Examine Wikidata item]]
{{Redirect category shell|
{{R from move}}
}}
jo0g59umzp822n0om72owhkjf90dite
Template:Examine Wikidata item
10
8986
74902
2025-01-15T18:13:34Z
en>Gonnym
0
Undid revision [[Special:Diff/1269549993|1269549993]] by [[Special:Contributions/Doomhope|Doomhope]] ([[User talk:Doomhope|talk]]) no templates should be placed in that category
74902
wikitext
text/x-wiki
{{#invoke:WikidataIB|examine}}<noinclude>
{{documentation}}
</noinclude>
45qeepxooko2qse5vc47bs0428jmf09
74903
74902
2026-08-24T00:42:44Z
Robertsky
10424
1 versaun husi [[:en:Template:Examine_Wikidata_item]]
74902
wikitext
text/x-wiki
{{#invoke:WikidataIB|examine}}<noinclude>
{{documentation}}
</noinclude>
45qeepxooko2qse5vc47bs0428jmf09
Template:If then show
10
8987
74904
2022-03-20T01:04:52Z
en>Pppery
0
Per edit request
74904
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{{3|}}}{{{1|}}}{{{4|}}}|{{{2|}}}}}<noinclude>
{{Documentation}}
</noinclude>
7d83cpur6ml0umb4qqvcpyge8uuck90
74905
74904
2026-08-24T00:43:13Z
Robertsky
10424
1 versaun husi [[:en:Template:If_then_show]]
74904
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{{3|}}}{{{1|}}}{{{4|}}}|{{{2|}}}}}<noinclude>
{{Documentation}}
</noinclude>
7d83cpur6ml0umb4qqvcpyge8uuck90
Template:If then show/doc
10
8988
74906
2025-12-03T15:16:44Z
en>Gonnym
0
-deleted
74906
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use}}
This template tests whether the first unnamed parameter is not an empty string and returns it if it is not empty. Otherwise it returns the second unnamed parameter.
This is useful when the first parameter is a <nowiki>{{#invoke: }}</nowiki> of a Lua module that may return a value or nothing. Because it uses the <nowiki>{{#invoke: }}</nowiki> just once, it simplifies the coding of infoboxes, for example.
The optional third and fourth unnamed parameters provide a prefix and a suffix for the first parameter when returned. This enables the designer to construct more complex templates that still only use one invoke of a Lua module.
== Usage ==
; {{q|P26}} for {{q|Q151973}}
: <syntaxhighlight lang="wikitext" inline>{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}|unmarried}}</syntaxhighlight> → {{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}|unmarried}}
; {{q|P26}} for {{q|Q905}}
: <syntaxhighlight lang="wikitext" inline>{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}|unmarried}}</syntaxhighlight> → {{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}|unmarried}}
=== Prefix and suffix ===
==== Infobox field with microformat ====
A value in an infobox can be designed to be wrapped in a microformat if the wikidata call is not empty:
: <syntaxhighlight lang="wikitext" inline>{{if then show | {{#invoke:WikidataIB | getValue | rank=best |P19 |name=birth_place |qid={{{qid|}}} |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}} |noicon={{{noicon|}}} | {{{birth_place|}}} }} || <span class="birthplace"> | </span>}}</syntaxhighlight>
: If there is a local parameter supplied in the article (e.g. {{para|birth_place|London}}), the code will return <code><nowiki><span class="birthplace">London</span></nowiki></code>.
: If there is no local parameter it will attempt to fetch a value for {{q|P19}} from Wikidata.
: If that has a value, such as "New York", the code will return <code><nowiki><span class="birthplace">New York</span></nowiki></code>.
: If there is no value returned from Wikidata, the code returns nothing.
==== Table ====
A table can be designed to display a row only when a particular property of the article exists on Wikidata.
; {{q|P26}} for {{q|Q151973}}
: <syntaxhighlight lang="wikitext">
{| class="wikitable"
|-
! scope="col" style="width:15em;" | Label
! scope="col" style="width:36em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q151973}}</th><td>|</td></tr>}}
|}
</syntaxhighlight>
: →
{| class="wikitable"
|-
! scope="col" style="width:15em;" | Label
! scope="col" style="width:36em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q151973}}</th><td>|</td></tr>}}
|}
; {{q|P26}} for {{q|Q905}}
: <syntaxhighlight lang="wikitext">
{| class="wikitable"
|-
! scope="col" style="width:15em;" | Label
! scope="col" style="width:36em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q905}}</th><td>|</td></tr>}}
|}
</syntaxhighlight>
: →
{| class="wikitable"
|-
! scope="col" style="width:15em;" | Label
! scope="col" style="width:36em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q905}}</th><td>|</td></tr>}}
|}
== See also ==
; [[Template:Ifnoteq then show]] : tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter. This is useful when the first parameter is a <code><nowiki>{{#invoke:</nowiki></code> of a Lua module that returns a value for which a specific exception is required.
; [[Template:If then wikilink]] : tests whether the first unnamed parameter is not an empty string and if it isn't, it returns the parameter formatted as piped wiki-link using an optional namespace prefix.
; [[Template:Formatter link]] : takes an external identifier code as {{para|code}} and uses a formatter url as {{para|url}} to construct a link to the external resource, which uses the code as display.
; [[Template:Empty or|Template:Emptyor]] : tests a piece of text to ascertain whether it's effectively empty or contains some text. If the unnamed parameter consists only of html tags, punctuation (e.g. Wiki-markup) and whitespace, then Emptyor returns nothing; otherwise it returns the parameter unchanged. Wrapper for p.emptyor function.
== Further readings ==
* {{mfl|params|value_of}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:If-then-else templates]]
}}</includeonly>
f6vusondh4ipsnmt76dxbo0pteo7x17
74907
74906
2026-08-24T00:43:13Z
Robertsky
10424
1 versaun husi [[:en:Template:If_then_show/doc]]
74906
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use}}
This template tests whether the first unnamed parameter is not an empty string and returns it if it is not empty. Otherwise it returns the second unnamed parameter.
This is useful when the first parameter is a <nowiki>{{#invoke: }}</nowiki> of a Lua module that may return a value or nothing. Because it uses the <nowiki>{{#invoke: }}</nowiki> just once, it simplifies the coding of infoboxes, for example.
The optional third and fourth unnamed parameters provide a prefix and a suffix for the first parameter when returned. This enables the designer to construct more complex templates that still only use one invoke of a Lua module.
== Usage ==
; {{q|P26}} for {{q|Q151973}}
: <syntaxhighlight lang="wikitext" inline>{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}|unmarried}}</syntaxhighlight> → {{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}|unmarried}}
; {{q|P26}} for {{q|Q905}}
: <syntaxhighlight lang="wikitext" inline>{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}|unmarried}}</syntaxhighlight> → {{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}|unmarried}}
=== Prefix and suffix ===
==== Infobox field with microformat ====
A value in an infobox can be designed to be wrapped in a microformat if the wikidata call is not empty:
: <syntaxhighlight lang="wikitext" inline>{{if then show | {{#invoke:WikidataIB | getValue | rank=best |P19 |name=birth_place |qid={{{qid|}}} |suppressfields={{{suppressfields|}}} |fetchwikidata={{{fetchwikidata|}}} |noicon={{{noicon|}}} | {{{birth_place|}}} }} || <span class="birthplace"> | </span>}}</syntaxhighlight>
: If there is a local parameter supplied in the article (e.g. {{para|birth_place|London}}), the code will return <code><nowiki><span class="birthplace">London</span></nowiki></code>.
: If there is no local parameter it will attempt to fetch a value for {{q|P19}} from Wikidata.
: If that has a value, such as "New York", the code will return <code><nowiki><span class="birthplace">New York</span></nowiki></code>.
: If there is no value returned from Wikidata, the code returns nothing.
==== Table ====
A table can be designed to display a row only when a particular property of the article exists on Wikidata.
; {{q|P26}} for {{q|Q151973}}
: <syntaxhighlight lang="wikitext">
{| class="wikitable"
|-
! scope="col" style="width:15em;" | Label
! scope="col" style="width:36em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q151973}}</th><td>|</td></tr>}}
|}
</syntaxhighlight>
: →
{| class="wikitable"
|-
! scope="col" style="width:15em;" | Label
! scope="col" style="width:36em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q151973|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q151973}}</th><td>|</td></tr>}}
|}
; {{q|P26}} for {{q|Q905}}
: <syntaxhighlight lang="wikitext">
{| class="wikitable"
|-
! scope="col" style="width:15em;" | Label
! scope="col" style="width:36em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q905}}</th><td>|</td></tr>}}
|}
</syntaxhighlight>
: →
{| class="wikitable"
|-
! scope="col" style="width:15em;" | Label
! scope="col" style="width:36em;" | Value
{{If then show|{{#invoke:WikidataIB|getValue|P26|qid=Q905|fwd=ALL|osd=no}}||<tr><th>{{#invoke:WikidataIB|getLabel|P26|qid=Q905}}</th><td>|</td></tr>}}
|}
== See also ==
; [[Template:Ifnoteq then show]] : tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter. This is useful when the first parameter is a <code><nowiki>{{#invoke:</nowiki></code> of a Lua module that returns a value for which a specific exception is required.
; [[Template:If then wikilink]] : tests whether the first unnamed parameter is not an empty string and if it isn't, it returns the parameter formatted as piped wiki-link using an optional namespace prefix.
; [[Template:Formatter link]] : takes an external identifier code as {{para|code}} and uses a formatter url as {{para|url}} to construct a link to the external resource, which uses the code as display.
; [[Template:Empty or|Template:Emptyor]] : tests a piece of text to ascertain whether it's effectively empty or contains some text. If the unnamed parameter consists only of html tags, punctuation (e.g. Wiki-markup) and whitespace, then Emptyor returns nothing; otherwise it returns the parameter unchanged. Wrapper for p.emptyor function.
== Further readings ==
* {{mfl|params|value_of}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:If-then-else templates]]
}}</includeonly>
f6vusondh4ipsnmt76dxbo0pteo7x17
Template:Mfl
10
8989
74908
2025-12-21T21:06:09Z
en>EurekaLott
0
cleaning up
74908
wikitext
text/x-wiki
#REDIRECT [[Template:Module function link]]
{{Redirect category shell|
{{R from move}}
{{R from shortcut}}
}}
8hbq7o0xabkhdhs1vjvc80mk33qqye1
74909
74908
2026-08-24T00:43:13Z
Robertsky
10424
1 versaun husi [[:en:Template:Mfl]]
74908
wikitext
text/x-wiki
#REDIRECT [[Template:Module function link]]
{{Redirect category shell|
{{R from move}}
{{R from shortcut}}
}}
8hbq7o0xabkhdhs1vjvc80mk33qqye1
Template:Module function link
10
8990
74910
2025-12-10T23:05:36Z
en>Plastikspork
0
[[Wikipedia:Templates for discussion/Log/2025 December 2#Template:Module function link]] closed as no consensus ([[WP:XFDC#4.0.16|XFDcloser]])
74910
wikitext
text/x-wiki
<includeonly>{{safesubst:<noinclude />#if:{{{1|}}}
|{{{{safesubst:<noinclude />#invoke:separated entries|main|[[Module:{{{1}}}|#invoke:{{{1}}}]]|{{safesubst:<noinclude />#if:{{{2|/}}}
|{{safesubst:<noinclude />#if:{{{2|}}}|[[Module:{{{1}}}#{{{2}}}|{{{2}}}]]}}
|''function''
}}|separator=|}}}}
|{{#invoke:Error|error|Error: Missing module name.}}
}}</includeonly><noinclude>{{documentation}}</noinclude>
74grvjmt67cetqv33fvzidrl66ojqf8
74911
74910
2026-08-24T00:43:13Z
Robertsky
10424
1 versaun husi [[:en:Template:Module_function_link]]
74910
wikitext
text/x-wiki
<includeonly>{{safesubst:<noinclude />#if:{{{1|}}}
|{{{{safesubst:<noinclude />#invoke:separated entries|main|[[Module:{{{1}}}|#invoke:{{{1}}}]]|{{safesubst:<noinclude />#if:{{{2|/}}}
|{{safesubst:<noinclude />#if:{{{2|}}}|[[Module:{{{1}}}#{{{2}}}|{{{2}}}]]}}
|''function''
}}|separator=|}}}}
|{{#invoke:Error|error|Error: Missing module name.}}
}}</includeonly><noinclude>{{documentation}}</noinclude>
74grvjmt67cetqv33fvzidrl66ojqf8
Template:Ifnoteq then show
10
8991
74912
2025-08-05T05:20:23Z
en>Theknightwho
0
Make substable.
74912
wikitext
text/x-wiki
<onlyinclude>{{safesubst:<noinclude/>#ifeq:{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{1|}}}}}</onlyinclude><!--
-->{{Documentation}}
t6x0hmopznwk5de63v0zad8wiq9v1o0
74913
74912
2026-08-24T00:43:21Z
Robertsky
10424
1 versaun husi [[:en:Template:Ifnoteq_then_show]]
74912
wikitext
text/x-wiki
<onlyinclude>{{safesubst:<noinclude/>#ifeq:{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{1|}}}}}</onlyinclude><!--
-->{{Documentation}}
t6x0hmopznwk5de63v0zad8wiq9v1o0
Template:Ifnoteq then show/doc
10
8992
74914
2021-11-25T16:41:54Z
en>Dinoguy1000
0
missed one
74914
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
This template tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter.
This is useful when the first parameter is a <nowiki>{{#invoke: }}</nowiki> of a Lua module that returns a value for which a specific exception is required. Because it uses the <nowiki>{{#invoke: }}</nowiki> just once, it simplifies the coding of infoboxes, for example.
== Usage ==
An infobox field may return the {{q|P17}} for an article about a city. We may wish to use the abbreviation "USA" in place of "[[United States]]".
; {{q|P17}} for {{q|Q42462}}
: <code><nowiki>{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}
: <code><nowiki>{{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}|United Kingdom|UK}}</nowiki></code> → {{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}|United Kingdom|UK}}
; {{q|P17}} for {{q|Q60}}
: <code><nowiki>{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}
: <code><nowiki>{{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}|United States|USA}}</nowiki></code> → {{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}|United States|USA}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:If-then-else templates]]
}}</includeonly>
270ofv069t181lr0zx8ga8heda55urf
74915
74914
2026-08-24T00:43:21Z
Robertsky
10424
1 versaun husi [[:en:Template:Ifnoteq_then_show/doc]]
74914
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
This template tests whether the first unnamed parameter is equal to the second unnamed parameter and returns the third unnamed parameter if it does. Otherwise it returns the first unnamed parameter.
This is useful when the first parameter is a <nowiki>{{#invoke: }}</nowiki> of a Lua module that returns a value for which a specific exception is required. Because it uses the <nowiki>{{#invoke: }}</nowiki> just once, it simplifies the coding of infoboxes, for example.
== Usage ==
An infobox field may return the {{q|P17}} for an article about a city. We may wish to use the abbreviation "USA" in place of "[[United States]]".
; {{q|P17}} for {{q|Q42462}}
: <code><nowiki>{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}
: <code><nowiki>{{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}|United Kingdom|UK}}</nowiki></code> → {{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q42462 |fwd=ALL |osd=no |rank=best |noicon=true}}|United Kingdom|UK}}
; {{q|P17}} for {{q|Q60}}
: <code><nowiki>{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}
: <code><nowiki>{{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}|United States|USA}}</nowiki></code> → {{Ifnoteq then show|{{#invoke:WikidataIB |getValue |P17 |qid=Q60 |fwd=ALL |osd=no |rank=best |noicon=true}}|United States|USA}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:If-then-else templates]]
}}</includeonly>
270ofv069t181lr0zx8ga8heda55urf
Template:If then wikilink
10
8993
74916
2020-01-05T20:47:48Z
en>Hike395
0
allow linktext override
74916
wikitext
text/x-wiki
{{#if:{{{1|}}}|[[{{{prefix|}}}{{{1}}}|{{#if:{{{linktext|}}}|{{{linktext}}}|{{{1}}}}}]]{{{after|}}}|{{{2|}}}}}<noinclude>
{{Documentation}}
</noinclude>
njp6y1gubi1roqq7lbgc0o79lftu54u
74917
74916
2026-08-24T00:43:28Z
Robertsky
10424
1 versaun husi [[:en:Template:If_then_wikilink]]
74916
wikitext
text/x-wiki
{{#if:{{{1|}}}|[[{{{prefix|}}}{{{1}}}|{{#if:{{{linktext|}}}|{{{linktext}}}|{{{1}}}}}]]{{{after|}}}|{{{2|}}}}}<noinclude>
{{Documentation}}
</noinclude>
njp6y1gubi1roqq7lbgc0o79lftu54u
Template:If then wikilink/doc
10
8994
74918
2024-11-16T05:13:12Z
en>Visviva
0
[[Category:Interwiki link templates]]
74918
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
If the first unnamed parameter is not an empty string, the template returns it as a piped wiki-link using the {{para|prefix}} as a namespace or interwiki prefix. Otherwise it returns the second unnamed parameter.
This is only useful when the first parameter is a <nowiki>{{#invoke: }}</nowiki> of a Lua module that may return a value or nothing. Because it uses the <nowiki>{{#invoke: }}</nowiki> just once, it simplifies the coding of infoboxes and reduces the calls to a module.
The {{para|after}} parameter is emitted immediately after the wikilink. This is useful, e.g., for tracking categories.
The {{para|linktext}} parameter allows the link text of the wikilink to be overridden. Otherwise, it will be the same as the first positional argument.
== Examples ==
* <code><nowiki>{{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en:|after=!}}</nowiki></code> → {{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en: | after=!}}
* <code><nowiki>{{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en:|linktext=Wikisource}}</nowiki></code> → {{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en: | linktext=Wikisource}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Interwiki link templates]]
}}</includeonly>
jgf5iubl65zo2yh82egn6wy10gi3tah
74919
74918
2026-08-24T00:43:29Z
Robertsky
10424
1 versaun husi [[:en:Template:If_then_wikilink/doc]]
74918
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
If the first unnamed parameter is not an empty string, the template returns it as a piped wiki-link using the {{para|prefix}} as a namespace or interwiki prefix. Otherwise it returns the second unnamed parameter.
This is only useful when the first parameter is a <nowiki>{{#invoke: }}</nowiki> of a Lua module that may return a value or nothing. Because it uses the <nowiki>{{#invoke: }}</nowiki> just once, it simplifies the coding of infoboxes and reduces the calls to a module.
The {{para|after}} parameter is emitted immediately after the wikilink. This is useful, e.g., for tracking categories.
The {{para|linktext}} parameter allows the link text of the wikilink to be overridden. Otherwise, it will be the same as the first positional argument.
== Examples ==
* <code><nowiki>{{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en:|after=!}}</nowiki></code> → {{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en: | after=!}}
* <code><nowiki>{{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en:|linktext=Wikisource}}</nowiki></code> → {{If then wikilink |{{#invoke:WikidataIB |getSiteLink |wiki=enwikisource |qid=Q56862211}} | prefix=s:en: | linktext=Wikisource}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Interwiki link templates]]
}}</includeonly>
jgf5iubl65zo2yh82egn6wy10gi3tah
Template:Formatter link
10
8995
74920
2021-10-26T17:21:28Z
en>MusikBot II
0
Changed protection settings for "[[Template:Formatter link]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 2624 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
74920
wikitext
text/x-wiki
{{#if:{{{code|}}}|[{{#invoke:String|replace|source={{{url|}}}|pattern=$1|replace={{{code|}}}}} {{{label|{{{code|}}}}}}]}}<noinclude>
{{documentation}}
</noinclude>
3wubjvll86jx78v6hga4ex3nshch5hm
74921
74920
2026-08-24T00:43:35Z
Robertsky
10424
1 versaun husi [[:en:Template:Formatter_link]]
74920
wikitext
text/x-wiki
{{#if:{{{code|}}}|[{{#invoke:String|replace|source={{{url|}}}|pattern=$1|replace={{{code|}}}}} {{{label|{{{code|}}}}}}]}}<noinclude>
{{documentation}}
</noinclude>
3wubjvll86jx78v6hga4ex3nshch5hm
Template:Formatter link/doc
10
8996
74922
2021-03-05T20:29:39Z
en>MSGJ
0
+templatedata
74922
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
Wikidata contains many examples of "External identifiers" such as {{q|P267}} – see [[Anatomical Therapeutic Chemical Classification System]].
These codes are used with {{q|P1630}} such as http://www.whocc.no/atc_ddd_index/?code=$1 where the $1 is to be substituted by the ATC code.
This template takes an external identifier code as {{para|code}} and uses a formatter url as {{para|url}} to construct a link to the external resource; an optional {{para|label}} parameter sets the text of the link, defaulting to the value of {{para|code}} otherwise.
Supplying the code as a parameter to this template allows one call to be made to Wikidata to fetch the code.
== Example ==
For {{q|Q26979}}, {{q|P267}}:
* <code><nowiki>{{Formatter link |url=http://www.whocc.no/atc_ddd_index/?code=$1 |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}</nowiki></code> → {{Formatter link |url=http://www.whocc.no/atc_ddd_index/?code=$1 |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}
The formatter url to use for {{q|P267}} can be found from:
* <code><nowiki>{{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}}</nowiki></code> → {{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}}
In infoboxes, it will generally be hard-coded because it is specific to the infobox field. Otherwise the following can be used if Wikidata changes of the formatter url should be tracked:
*<code><nowiki>{{Formatter link |url={{wdib |P1630 |qid=P267 |fwd=ALL |osd=n |noicon=y}} |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}</nowiki></code>
== See also ==
* {{tl|Wikidata ID}} and {{tl|Wikidata ID line}}
* {{tl|format link}}, a similarly-named but completely unrelated template
==Template data==
<templatedata>
{
"params": {
"code": {
"description": "the unique ID value of the target page",
"required": true
},
"url": {
"description": "the Wikidata “formatter URL (P1630)”",
"required": true
},
"label": {
"description": "the text of the link (defaults to the value of “code”)"
}
},
"description": "Combines a Wikidata “formatter URL (P1630)” with an id code to produce a URL",
"format": "inline"
}
</templatedata>
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wikidata templates]]
}}</includeonly>
m3wsymaon370w9y4jkfrmtdkvrdyy00
74923
74922
2026-08-24T00:43:35Z
Robertsky
10424
1 versaun husi [[:en:Template:Formatter_link/doc]]
74922
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
Wikidata contains many examples of "External identifiers" such as {{q|P267}} – see [[Anatomical Therapeutic Chemical Classification System]].
These codes are used with {{q|P1630}} such as http://www.whocc.no/atc_ddd_index/?code=$1 where the $1 is to be substituted by the ATC code.
This template takes an external identifier code as {{para|code}} and uses a formatter url as {{para|url}} to construct a link to the external resource; an optional {{para|label}} parameter sets the text of the link, defaulting to the value of {{para|code}} otherwise.
Supplying the code as a parameter to this template allows one call to be made to Wikidata to fetch the code.
== Example ==
For {{q|Q26979}}, {{q|P267}}:
* <code><nowiki>{{Formatter link |url=http://www.whocc.no/atc_ddd_index/?code=$1 |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}</nowiki></code> → {{Formatter link |url=http://www.whocc.no/atc_ddd_index/?code=$1 |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}
The formatter url to use for {{q|P267}} can be found from:
* <code><nowiki>{{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}}</nowiki></code> → {{wdib |P1630 |qid=P267 |fwd=ALL |osd=n}}
In infoboxes, it will generally be hard-coded because it is specific to the infobox field. Otherwise the following can be used if Wikidata changes of the formatter url should be tracked:
*<code><nowiki>{{Formatter link |url={{wdib |P1630 |qid=P267 |fwd=ALL |osd=n |noicon=y}} |code={{wdib |P267 |qid=Q26979 |fwd=ALL |osd=n |noicon=y |maxvals=1}} }}</nowiki></code>
== See also ==
* {{tl|Wikidata ID}} and {{tl|Wikidata ID line}}
* {{tl|format link}}, a similarly-named but completely unrelated template
==Template data==
<templatedata>
{
"params": {
"code": {
"description": "the unique ID value of the target page",
"required": true
},
"url": {
"description": "the Wikidata “formatter URL (P1630)”",
"required": true
},
"label": {
"description": "the text of the link (defaults to the value of “code”)"
}
},
"description": "Combines a Wikidata “formatter URL (P1630)” with an id code to produce a URL",
"format": "inline"
}
</templatedata>
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wikidata templates]]
}}</includeonly>
m3wsymaon370w9y4jkfrmtdkvrdyy00
Template:Emptyor
10
8997
74924
2025-03-10T04:05:47Z
en>Rusty Cat
0
Rusty Cat moved page [[Template:Emptyor]] to [[Template:Empty or]]: [[WP:BOLD]]ly moving template to a title that is easier to read using [[User:BilledMammal/Move+|Move+]]
74924
wikitext
text/x-wiki
#REDIRECT [[Template:Empty or]]
{{Redirect category shell|
{{R from move}}
}}
nyjoyhfiexhoe5ioqohw4xszho7dhgn
74925
74924
2026-08-24T00:43:41Z
Robertsky
10424
1 versaun husi [[:en:Template:Emptyor]]
74924
wikitext
text/x-wiki
#REDIRECT [[Template:Empty or]]
{{Redirect category shell|
{{R from move}}
}}
nyjoyhfiexhoe5ioqohw4xszho7dhgn
Módulo:I18n/ordinal
828
8998
74928
2025-02-18T17:59:14Z
en>YoaR
0
74928
Scribunto
text/plain
local p = {}
--[[ Different languages use different schemes for ordinals, and some of these schemes are shared between languages.
"SchemeFromLang" picks an ordinal scheme based on a specified language.
All unlisted languages default to the "period-scheme", i.e. "104." is the ordinal for the value "104".
Languages will follow the regular language fallback chain. For example, "de-formal" would fallback to scheme for "de",
and only if that does not exist would the "period-scheme" be used.
]]
p.SchemeFromLang = {
['ast'] = 'ast-scheme', -- Asturian
['bn'] = 'bn-scheme', -- Bengali
['br'] = 'br-scheme', -- Breton
['cs'] = 'period-scheme', -- Czech
['da'] = 'period-scheme', -- Danish
['de'] = 'period-scheme', -- German
['el'] = 'el-scheme', -- Greek
['en'] = 'en-scheme', -- English
['eo'] = 'eo-scheme', -- Esperanto
['es'] = 'es-scheme', -- Spanish
['et'] = 'period-scheme', -- Estonian
['fa'] = 'fa-scheme', -- Persian
['fi'] = 'period-scheme', -- Finnish
['fr'] = 'fr-scheme', -- French
['hr'] = 'period-scheme', -- Croatian
['hu'] = 'period-scheme', -- Hungarian
['hy'] = 'hy-scheme', -- Armenian
['ia'] = 'ia-scheme', -- Interlingua
['it'] = 'romance-scheme', -- Italian
['ja'] = 'ja-scheme', -- Japanese
['km'] = 'km-scheme', -- Khmer
['ko'] = 'ko-scheme', -- Korean
['la'] = 'la-scheme', -- Latin
['lo'] = 'lo-scheme', -- Laothian
['mk'] = 'mk-scheme', -- Macedonian
['ml'] = 'ml-scheme', -- Malayalam
['ms'] = 'ms-scheme', -- Malay
['nds'] = 'period-scheme', -- Low German
['nl'] = 'nl-scheme', -- Dutch
['no'] = 'no-scheme', -- Norwegian
['pl'] = 'pl-scheme', -- Polish
['pt'] = 'romance-scheme', -- Portuguese
['ru'] = 'ru-scheme', -- Russian
['sk'] = 'period-scheme', -- Slovak
['sl'] = 'period-scheme', -- Slovene
['sv'] = 'sv-scheme', -- Swedish
['th'] = 'th-scheme', -- Thai
['zh'] = 'zh-scheme', -- Chinese
}
--[[ Text used to internationalize the various schemes.
Styles are supported by suffixing "/style" to key.
Styles that are superscripted set "superscript" to true.
Scheme set was developed to match the output of the pre-Lua {{Ordinal}} template, preserved as {{Ordinal/old}}
]]
p.Scheme = {
-- the null scheme, i.e. just the number
['null-scheme'] = {
},
-- the period scheme, i.e. "<value>." used for at least: cs, de, fi, hu
['period-scheme'] = {
rules = 'suffix',
suffix = '.'
},
-- the English scheme, i.e. "1st", "2nd", "3rd", "4th".
['en-scheme'] = {
rules = 'skip-tens',
superscript = true,
suffix = 'th',
suffix_1 = 'st',
suffix_2 = 'nd',
suffix_3 = 'rd',
},
-- the English scheme using the "d" style, i.e. "23d".
['en-scheme/d'] = {
rules = 'suffix',
suffix = 'd'
},
-- Asturian
['ast-scheme'] = {
rules = 'gendered-suffix',
superscript = true,
period = false,
suffix = 'u',
suffix_m = 'u',
suffix_f = 'a',
suffix_n = 'o',
},
-- Bengali
['bn-scheme'] = {
rules = 'mod10-suffix',
superscript = true,
suffix_0 = 'ম',
suffix_1 = 'ম',
suffix_2 = 'য়',
suffix_3 = 'য়',
suffix_4 = 'র্থ়',
suffix_5 = 'ম',
suffix_6 = 'ষ্ঠ',
suffix_7 = 'ম',
suffix_8 = 'ম',
suffix_9 = 'ম',
},
-- Breton
['br-scheme'] = {
rules = 'suffix',
suffix = '-vet',
formatlang = 'eo' -- pre-Lua {{Ordinal}} template used "eo" number formatting for "br" ordinals
},
-- Greek
-- not exact. see distinct declentions in: wiktionary:Category:Greek ordinal numbers
['el-scheme'] = {
rules = 'gendered-suffix',
suffix = 'ος',
suffix_m = 'ος',
suffix_f = 'η',
suffix_n = 'ο',
},
-- Esperanto
['eo-scheme'] = {
rules = 'suffix',
suffix = '-a',
},
-- Romance (Italian, Portuguese)
['romance-scheme'] = {
rules = 'gendered-suffix',
superscript = true,
period = false,
suffix = 'o',
suffix_m = 'o',
suffix_f = 'a',
suffix_n = 'o',
},
-- Spanish
['es-scheme'] = {
rules = 'gendered-suffix',
superscript = true,
period = true,
suffix = 'o',
suffix_m = 'o',
suffix_f = 'a',
suffix_n = 'o',
},
-- Persian
['fa-scheme'] = {
rules = 'suffix',
suffix = 'م',
},
-- French
['fr-scheme'] = {
rules = 'gendered-suffix-one',
superscript = true,
suffix = 'e',
suffix_1 = 'e',
suffix_1_m = 'er',
suffix_1_f = 're',
suffix_1_n = 'e',
},
-- the French scheme using the "roman" style ("roman year" is a supported alias for "roman")
['fr-scheme/roman'] = {
rules = 'gendered-suffix-one',
superscript = true,
suffix = 'e',
suffix_1 = 'e',
suffix_1_m = 'er',
suffix_1_f = 're',
suffix_1_n = 'е',
formatlang = 'roman'
},
-- Armenian
['hy-scheme'] = {
rules = 'suffix-one',
suffix = '-րդ',
suffix_1 = '-ին',
},
-- Interlingua
['ia-scheme'] = {
rules = 'mod10-suffix',
superscript = true,
suffix_0 = 'te',
suffix_1 = 'me',
suffix_2 = 'nde',
suffix_3 = 'tie',
suffix_4 = 'te',
suffix_5 = 'te',
suffix_6 = 'te',
suffix_7 = 'me',
suffix_8 = 've',
suffix_9 = 'ne',
},
-- Khmer
['km-scheme'] = {
rules = 'prefix',
prefix = 'ទ',
},
-- Japanese
-- this is for the adjective in undetermined order before noun; otherwise Japanese use: <cardinal number><noun>目
['ja-scheme'] = {
rules = 'prefix',
prefix = '第',
},
-- Latin
['la-scheme'] = {
rules = 'suffix',
superscript = true,
suffix = 'o',
formatlang = 'roman'
},
-- Laothian
['lo-scheme'] = {
rules = 'prefix',
prefix = 'ທີ່',
},
-- Korean
['ko-scheme'] = {
rules = 'suffix',
suffix = '째',
},
-- Macedonian
['mk-scheme'] = {
rules = 'mod10-suffix',
suffix_0 = '-тиот',
suffix_1 = '-виот',
suffix_2 = '-риот',
suffix_3 = '-иот',
suffix_4 = '-иот',
suffix_5 = '-тиот',
suffix_6 = '-иот',
suffix_7 = '-миот',
suffix_8 = '-миот',
suffix_9 = '-тиот',
},
-- Malayalam
['ml-scheme'] = {
rules = 'suffix',
suffix = '-മത്തെ',
},
-- Malay
['ms-scheme'] = {
rules = 'prefix',
prefix = 'ke-',
},
-- Dutch
['nl-scheme'] = {
rules = 'suffix',
suffix = 'e',
},
--Norwegian
['no-scheme'] = {
rules = 'skip-tens',
superscript = true,
suffix = 'de',
suffix_1 = 'ste',
suffix_2 = 'dre',
suffix_3 = 'dje',
suffix_5 = 'te',
suffix_6 = 'te',
},
-- Polish
['pl-scheme'] = {
rules = 'mod10-gendered-suffix-skip-tens',
suffix = '-ty',
suffix_f = '-ta',
suffix_n = '-te',
suffix_1 = '-szy',
suffix_1_f = '-sza',
suffix_1_n = '-sze',
suffix_2 = '-gi',
suffix_2_f = '-ga',
suffix_2_n = '-gie',
suffix_3 = '-ci',
suffix_3_f = '-cia',
suffix_3_n = '-cie',
suffix_7 = '-my',
suffix_7_f = '-ma',
suffix_7_n = '-me',
suffix_8 = '-my',
suffix_8_f = '-ma',
suffix_8_n = '-me',
},
-- Russian
['ru-scheme'] = {
rules = 'gendered-suffix',
suffix = '-й',
suffix_m = '-й',
suffix_f = '-я',
suffix_n = '-е',
},
-- Swedish
['sv-scheme'] = {
rules = 'skip-tens',
suffix = ':e',
suffix_1 = ':a',
suffix_2 = ':a',
},
['th-scheme'] = {
rules = 'prefix',
prefix = 'ที่',
},
['zh-scheme'] = {
rules = 'prefix',
prefix = '第',
},
}
return p
sxt20lf44aj0tliggsmgmexdttgulyn
74929
74928
2026-08-24T00:44:08Z
Robertsky
10424
1 versaun husi [[:en:Module:I18n/ordinal]]
74928
Scribunto
text/plain
local p = {}
--[[ Different languages use different schemes for ordinals, and some of these schemes are shared between languages.
"SchemeFromLang" picks an ordinal scheme based on a specified language.
All unlisted languages default to the "period-scheme", i.e. "104." is the ordinal for the value "104".
Languages will follow the regular language fallback chain. For example, "de-formal" would fallback to scheme for "de",
and only if that does not exist would the "period-scheme" be used.
]]
p.SchemeFromLang = {
['ast'] = 'ast-scheme', -- Asturian
['bn'] = 'bn-scheme', -- Bengali
['br'] = 'br-scheme', -- Breton
['cs'] = 'period-scheme', -- Czech
['da'] = 'period-scheme', -- Danish
['de'] = 'period-scheme', -- German
['el'] = 'el-scheme', -- Greek
['en'] = 'en-scheme', -- English
['eo'] = 'eo-scheme', -- Esperanto
['es'] = 'es-scheme', -- Spanish
['et'] = 'period-scheme', -- Estonian
['fa'] = 'fa-scheme', -- Persian
['fi'] = 'period-scheme', -- Finnish
['fr'] = 'fr-scheme', -- French
['hr'] = 'period-scheme', -- Croatian
['hu'] = 'period-scheme', -- Hungarian
['hy'] = 'hy-scheme', -- Armenian
['ia'] = 'ia-scheme', -- Interlingua
['it'] = 'romance-scheme', -- Italian
['ja'] = 'ja-scheme', -- Japanese
['km'] = 'km-scheme', -- Khmer
['ko'] = 'ko-scheme', -- Korean
['la'] = 'la-scheme', -- Latin
['lo'] = 'lo-scheme', -- Laothian
['mk'] = 'mk-scheme', -- Macedonian
['ml'] = 'ml-scheme', -- Malayalam
['ms'] = 'ms-scheme', -- Malay
['nds'] = 'period-scheme', -- Low German
['nl'] = 'nl-scheme', -- Dutch
['no'] = 'no-scheme', -- Norwegian
['pl'] = 'pl-scheme', -- Polish
['pt'] = 'romance-scheme', -- Portuguese
['ru'] = 'ru-scheme', -- Russian
['sk'] = 'period-scheme', -- Slovak
['sl'] = 'period-scheme', -- Slovene
['sv'] = 'sv-scheme', -- Swedish
['th'] = 'th-scheme', -- Thai
['zh'] = 'zh-scheme', -- Chinese
}
--[[ Text used to internationalize the various schemes.
Styles are supported by suffixing "/style" to key.
Styles that are superscripted set "superscript" to true.
Scheme set was developed to match the output of the pre-Lua {{Ordinal}} template, preserved as {{Ordinal/old}}
]]
p.Scheme = {
-- the null scheme, i.e. just the number
['null-scheme'] = {
},
-- the period scheme, i.e. "<value>." used for at least: cs, de, fi, hu
['period-scheme'] = {
rules = 'suffix',
suffix = '.'
},
-- the English scheme, i.e. "1st", "2nd", "3rd", "4th".
['en-scheme'] = {
rules = 'skip-tens',
superscript = true,
suffix = 'th',
suffix_1 = 'st',
suffix_2 = 'nd',
suffix_3 = 'rd',
},
-- the English scheme using the "d" style, i.e. "23d".
['en-scheme/d'] = {
rules = 'suffix',
suffix = 'd'
},
-- Asturian
['ast-scheme'] = {
rules = 'gendered-suffix',
superscript = true,
period = false,
suffix = 'u',
suffix_m = 'u',
suffix_f = 'a',
suffix_n = 'o',
},
-- Bengali
['bn-scheme'] = {
rules = 'mod10-suffix',
superscript = true,
suffix_0 = 'ম',
suffix_1 = 'ম',
suffix_2 = 'য়',
suffix_3 = 'য়',
suffix_4 = 'র্থ়',
suffix_5 = 'ম',
suffix_6 = 'ষ্ঠ',
suffix_7 = 'ম',
suffix_8 = 'ম',
suffix_9 = 'ম',
},
-- Breton
['br-scheme'] = {
rules = 'suffix',
suffix = '-vet',
formatlang = 'eo' -- pre-Lua {{Ordinal}} template used "eo" number formatting for "br" ordinals
},
-- Greek
-- not exact. see distinct declentions in: wiktionary:Category:Greek ordinal numbers
['el-scheme'] = {
rules = 'gendered-suffix',
suffix = 'ος',
suffix_m = 'ος',
suffix_f = 'η',
suffix_n = 'ο',
},
-- Esperanto
['eo-scheme'] = {
rules = 'suffix',
suffix = '-a',
},
-- Romance (Italian, Portuguese)
['romance-scheme'] = {
rules = 'gendered-suffix',
superscript = true,
period = false,
suffix = 'o',
suffix_m = 'o',
suffix_f = 'a',
suffix_n = 'o',
},
-- Spanish
['es-scheme'] = {
rules = 'gendered-suffix',
superscript = true,
period = true,
suffix = 'o',
suffix_m = 'o',
suffix_f = 'a',
suffix_n = 'o',
},
-- Persian
['fa-scheme'] = {
rules = 'suffix',
suffix = 'م',
},
-- French
['fr-scheme'] = {
rules = 'gendered-suffix-one',
superscript = true,
suffix = 'e',
suffix_1 = 'e',
suffix_1_m = 'er',
suffix_1_f = 're',
suffix_1_n = 'e',
},
-- the French scheme using the "roman" style ("roman year" is a supported alias for "roman")
['fr-scheme/roman'] = {
rules = 'gendered-suffix-one',
superscript = true,
suffix = 'e',
suffix_1 = 'e',
suffix_1_m = 'er',
suffix_1_f = 're',
suffix_1_n = 'е',
formatlang = 'roman'
},
-- Armenian
['hy-scheme'] = {
rules = 'suffix-one',
suffix = '-րդ',
suffix_1 = '-ին',
},
-- Interlingua
['ia-scheme'] = {
rules = 'mod10-suffix',
superscript = true,
suffix_0 = 'te',
suffix_1 = 'me',
suffix_2 = 'nde',
suffix_3 = 'tie',
suffix_4 = 'te',
suffix_5 = 'te',
suffix_6 = 'te',
suffix_7 = 'me',
suffix_8 = 've',
suffix_9 = 'ne',
},
-- Khmer
['km-scheme'] = {
rules = 'prefix',
prefix = 'ទ',
},
-- Japanese
-- this is for the adjective in undetermined order before noun; otherwise Japanese use: <cardinal number><noun>目
['ja-scheme'] = {
rules = 'prefix',
prefix = '第',
},
-- Latin
['la-scheme'] = {
rules = 'suffix',
superscript = true,
suffix = 'o',
formatlang = 'roman'
},
-- Laothian
['lo-scheme'] = {
rules = 'prefix',
prefix = 'ທີ່',
},
-- Korean
['ko-scheme'] = {
rules = 'suffix',
suffix = '째',
},
-- Macedonian
['mk-scheme'] = {
rules = 'mod10-suffix',
suffix_0 = '-тиот',
suffix_1 = '-виот',
suffix_2 = '-риот',
suffix_3 = '-иот',
suffix_4 = '-иот',
suffix_5 = '-тиот',
suffix_6 = '-иот',
suffix_7 = '-миот',
suffix_8 = '-миот',
suffix_9 = '-тиот',
},
-- Malayalam
['ml-scheme'] = {
rules = 'suffix',
suffix = '-മത്തെ',
},
-- Malay
['ms-scheme'] = {
rules = 'prefix',
prefix = 'ke-',
},
-- Dutch
['nl-scheme'] = {
rules = 'suffix',
suffix = 'e',
},
--Norwegian
['no-scheme'] = {
rules = 'skip-tens',
superscript = true,
suffix = 'de',
suffix_1 = 'ste',
suffix_2 = 'dre',
suffix_3 = 'dje',
suffix_5 = 'te',
suffix_6 = 'te',
},
-- Polish
['pl-scheme'] = {
rules = 'mod10-gendered-suffix-skip-tens',
suffix = '-ty',
suffix_f = '-ta',
suffix_n = '-te',
suffix_1 = '-szy',
suffix_1_f = '-sza',
suffix_1_n = '-sze',
suffix_2 = '-gi',
suffix_2_f = '-ga',
suffix_2_n = '-gie',
suffix_3 = '-ci',
suffix_3_f = '-cia',
suffix_3_n = '-cie',
suffix_7 = '-my',
suffix_7_f = '-ma',
suffix_7_n = '-me',
suffix_8 = '-my',
suffix_8_f = '-ma',
suffix_8_n = '-me',
},
-- Russian
['ru-scheme'] = {
rules = 'gendered-suffix',
suffix = '-й',
suffix_m = '-й',
suffix_f = '-я',
suffix_n = '-е',
},
-- Swedish
['sv-scheme'] = {
rules = 'skip-tens',
suffix = ':e',
suffix_1 = ':a',
suffix_2 = ':a',
},
['th-scheme'] = {
rules = 'prefix',
prefix = 'ที่',
},
['zh-scheme'] = {
rules = 'prefix',
prefix = '第',
},
}
return p
sxt20lf44aj0tliggsmgmexdttgulyn
Módulo:I18n/ordinal/doc
828
8999
74930
2024-08-29T21:40:53Z
en>Warudo
0
Added the page to [[:Category:Module documentation pages]]
74930
wikitext
text/x-wiki
This module is indirectly used by [[Module:I18n/complex date]] which in turn is indirectly used by [[Module:WikidataIB]] see [[Special:Permalink/918862640|this discussion]] for more information.
<includeonly>{{Sandbox other||
<!-- Categories below this line, please -->
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
</noinclude>
0qegn12z42q14xvpcik659klqvm3m9f
74931
74930
2026-08-24T00:44:08Z
Robertsky
10424
1 versaun husi [[:en:Module:I18n/ordinal/doc]]
74930
wikitext
text/x-wiki
This module is indirectly used by [[Module:I18n/complex date]] which in turn is indirectly used by [[Module:WikidataIB]] see [[Special:Permalink/918862640|this discussion]] for more information.
<includeonly>{{Sandbox other||
<!-- Categories below this line, please -->
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
</noinclude>
0qegn12z42q14xvpcik659klqvm3m9f
Módulo:Formatnum
828
9000
74932
2021-02-20T15:49:21Z
en>RexxS
0
Changed protection level for "[[Module:Formatnum]]": [[WP:High-risk templates|High-risk Lua module]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74932
Scribunto
text/plain
-- This module is intended to replace the functionality of Template:Formatnum and related templates.
local p = {}
function p.main(frame)
local args = frame:getParent().args
local prec = args.prec or ''
local sep = args.sep or ''
local number = args[1] or args.number or ''
local lang = args[2] or args.lang or ''
-- validate the language parameter within MediaWiki's caller frame
if lang == "arabic-indic" then -- only for back-compatibility ("arabic-indic" is not a SupportedLanguage)
lang = "fa" -- better support than "ks"
elseif lang == '' or not mw.language.isSupportedLanguage(lang) then
-- Note that 'SupportedLanguages' are not necessarily 'BuiltinValidCodes', and so they are not necessarily
-- 'KnownLanguages' (with a language name defined at least in the default localisation of the local wiki).
-- But they all are ValidLanguageCodes (suitable as Wiki subpages or identifiers: no slash, colon, HTML tags, or entities)
-- In addition, they do not contain any capital letter in order to be unique in page titles (restriction inexistant in BCP47),
-- but they may violate the standard format of BCP47 language tags for specific needs in MediaWiki.
-- Empty/unspecified and unsupported languages are treated here in Commons using the user's language,
-- instead of the local 'ContentLanguage' of the Wiki.
lang = frame:callParserFunction( "int", "lang" ) -- get user's chosen language
end
return p.formatNum(number, lang, prec, sep ~= '')
end
local digit = { -- substitution of decimal digits for languages not supported by mw.language:formatNum() in core Lua libraries for MediaWiki
["ml-old"] = { '൦', '൧', '൨', '൩', '൪', '൫', '൬', '൭', '൮', '൯' },
["mn"] = { '᠐', '᠑', '᠒', '᠓', '᠔', '᠕', '᠖', '᠗', '᠘', '᠙'},
["ta"] = { '௦', '௧', '௨', '௩', '௪', '௫', '௬', '௭', '௮', '௯'},
["te"] = { '౦', '౧', '౨', '౩', '౪', '౫', '౬', '౭', '౮', '౯'},
["th"] = { '๐', '๑', '๒', '๓', '๔', '๕', '๖', '๗', '๘', '๙'}
}
function p.formatNum(number, lang, prec, compact)
-- Do not alter the specified value when it is not a valid number, return it as is
local value = tonumber(number)
if value == nil then
return number
end
-- Basic ASCII-only formatting (without paddings)
number = tostring(value)
-- Check the presence of an exponent (incorrectly managed in mw.language:FormatNum() and even forgotten due to an internal bug, e.g. in Hindi)
local exponent
local pos = string.find(number, '[Ee]')
if pos ~= nil then
exponent = string.sub(number, pos + 1, string.len(number))
number = string.sub(number, 1, pos - 1)
else
exponent = ''
end
-- Check the minimum precision requested
prec = tonumber(prec) -- nil if not specified as a true number
if prec ~= nil then
prec = math.floor(prec)
if prec < 0 then
prec = nil -- discard an incorrect precision (not a positive integer)
elseif prec > 14 then
prec = 14 -- maximum precision supported by tostring(number)
end
end
-- Preprocess the minimum precision in the ASCII string
local dot
if (prec or 0) > 0 then
pos = string.find(number, '.', 1, true) -- plain search, no regexp
if pos ~= nil then
prec = pos + prec - string.len(number) -- effective number of trailing decimals to add or remove
dot = '' -- already present
else
dot = '.' -- must be added
end
else
dot = '' -- don't add dot
prec = 0 -- don't alter the precision
end
if lang ~= nil and mw.language.isKnownLanguageTag(lang) == true then
-- Convert number to localized digits, decimal separator, and group separators
local language = mw.getLanguage(lang)
if compact then
number = language:formatNum(tonumber(number), { noCommafy = 'y' }) -- caveat: can load localized resources for up to 20 languages
else
number = language:formatNum(tonumber(number)) -- caveat: can load localized resources for up to 20 languages
end
-- Postprocessing the precision
if prec > 0 then
local zero = language:formatNum(0)
number = number .. dot .. mw.ustring.rep(zero, prec)
elseif prec < 0 then
-- TODO: rounding of last decimal; here only truncate decimals in excess
number = mw.ustring.sub(number, 1, mw.ustring.len(number) + prec)
end
-- Append the localized base-10 exponent without grouping separators (there's no reliable way to detect a localized leading symbol 'E')
if exponent ~= '' then
number = number .. 'E' .. language:formatNum(tonumber(exponent),{noCommafy=true})
end
else -- not localized, ASCII only
-- Postprocessing the precision
if prec > 0 then
number = number .. dot .. mw.string.rep('0', prec)
elseif prec < 0 then
-- TODO: rounding of last decimal; here only truncate decimals in excess
number = mw.string.sub(number, 1, mw.string.len(number) + prec)
end
-- Append the base-10 exponent
if exponent ~= '' then
number = number .. 'E' .. exponent
end
end
-- Special cases for substitution of ASCII digits (missing support in Lua core libraries for some languages)
if digit[lang] then
for i, v in ipairs(digit[lang]) do
number = mw.ustring.gsub(number, tostring(i - 1), v)
end
end
return number
end
return p
ea5lmau3n3g443z268nz79espe8b4sj
74933
74932
2026-08-24T00:44:18Z
Robertsky
10424
1 versaun husi [[:en:Module:Formatnum]]
74932
Scribunto
text/plain
-- This module is intended to replace the functionality of Template:Formatnum and related templates.
local p = {}
function p.main(frame)
local args = frame:getParent().args
local prec = args.prec or ''
local sep = args.sep or ''
local number = args[1] or args.number or ''
local lang = args[2] or args.lang or ''
-- validate the language parameter within MediaWiki's caller frame
if lang == "arabic-indic" then -- only for back-compatibility ("arabic-indic" is not a SupportedLanguage)
lang = "fa" -- better support than "ks"
elseif lang == '' or not mw.language.isSupportedLanguage(lang) then
-- Note that 'SupportedLanguages' are not necessarily 'BuiltinValidCodes', and so they are not necessarily
-- 'KnownLanguages' (with a language name defined at least in the default localisation of the local wiki).
-- But they all are ValidLanguageCodes (suitable as Wiki subpages or identifiers: no slash, colon, HTML tags, or entities)
-- In addition, they do not contain any capital letter in order to be unique in page titles (restriction inexistant in BCP47),
-- but they may violate the standard format of BCP47 language tags for specific needs in MediaWiki.
-- Empty/unspecified and unsupported languages are treated here in Commons using the user's language,
-- instead of the local 'ContentLanguage' of the Wiki.
lang = frame:callParserFunction( "int", "lang" ) -- get user's chosen language
end
return p.formatNum(number, lang, prec, sep ~= '')
end
local digit = { -- substitution of decimal digits for languages not supported by mw.language:formatNum() in core Lua libraries for MediaWiki
["ml-old"] = { '൦', '൧', '൨', '൩', '൪', '൫', '൬', '൭', '൮', '൯' },
["mn"] = { '᠐', '᠑', '᠒', '᠓', '᠔', '᠕', '᠖', '᠗', '᠘', '᠙'},
["ta"] = { '௦', '௧', '௨', '௩', '௪', '௫', '௬', '௭', '௮', '௯'},
["te"] = { '౦', '౧', '౨', '౩', '౪', '౫', '౬', '౭', '౮', '౯'},
["th"] = { '๐', '๑', '๒', '๓', '๔', '๕', '๖', '๗', '๘', '๙'}
}
function p.formatNum(number, lang, prec, compact)
-- Do not alter the specified value when it is not a valid number, return it as is
local value = tonumber(number)
if value == nil then
return number
end
-- Basic ASCII-only formatting (without paddings)
number = tostring(value)
-- Check the presence of an exponent (incorrectly managed in mw.language:FormatNum() and even forgotten due to an internal bug, e.g. in Hindi)
local exponent
local pos = string.find(number, '[Ee]')
if pos ~= nil then
exponent = string.sub(number, pos + 1, string.len(number))
number = string.sub(number, 1, pos - 1)
else
exponent = ''
end
-- Check the minimum precision requested
prec = tonumber(prec) -- nil if not specified as a true number
if prec ~= nil then
prec = math.floor(prec)
if prec < 0 then
prec = nil -- discard an incorrect precision (not a positive integer)
elseif prec > 14 then
prec = 14 -- maximum precision supported by tostring(number)
end
end
-- Preprocess the minimum precision in the ASCII string
local dot
if (prec or 0) > 0 then
pos = string.find(number, '.', 1, true) -- plain search, no regexp
if pos ~= nil then
prec = pos + prec - string.len(number) -- effective number of trailing decimals to add or remove
dot = '' -- already present
else
dot = '.' -- must be added
end
else
dot = '' -- don't add dot
prec = 0 -- don't alter the precision
end
if lang ~= nil and mw.language.isKnownLanguageTag(lang) == true then
-- Convert number to localized digits, decimal separator, and group separators
local language = mw.getLanguage(lang)
if compact then
number = language:formatNum(tonumber(number), { noCommafy = 'y' }) -- caveat: can load localized resources for up to 20 languages
else
number = language:formatNum(tonumber(number)) -- caveat: can load localized resources for up to 20 languages
end
-- Postprocessing the precision
if prec > 0 then
local zero = language:formatNum(0)
number = number .. dot .. mw.ustring.rep(zero, prec)
elseif prec < 0 then
-- TODO: rounding of last decimal; here only truncate decimals in excess
number = mw.ustring.sub(number, 1, mw.ustring.len(number) + prec)
end
-- Append the localized base-10 exponent without grouping separators (there's no reliable way to detect a localized leading symbol 'E')
if exponent ~= '' then
number = number .. 'E' .. language:formatNum(tonumber(exponent),{noCommafy=true})
end
else -- not localized, ASCII only
-- Postprocessing the precision
if prec > 0 then
number = number .. dot .. mw.string.rep('0', prec)
elseif prec < 0 then
-- TODO: rounding of last decimal; here only truncate decimals in excess
number = mw.string.sub(number, 1, mw.string.len(number) + prec)
end
-- Append the base-10 exponent
if exponent ~= '' then
number = number .. 'E' .. exponent
end
end
-- Special cases for substitution of ASCII digits (missing support in Lua core libraries for some languages)
if digit[lang] then
for i, v in ipairs(digit[lang]) do
number = mw.ustring.gsub(number, tostring(i - 1), v)
end
end
return number
end
return p
ea5lmau3n3g443z268nz79espe8b4sj
Template:Str endswith
10
9001
74934
2019-05-30T14:16:29Z
en>MSGJ
0
use [[Module:String]] per [[Wikipedia:Templates_for_discussion/Log/2019_February_18#Module:Str_endswith|TfD]] discussion
74934
wikitext
text/x-wiki
{{#ifeq:{{{1|a}}}{{{2|a}}}|{{{1|b}}}{{{2|b}}}|{{#invoke:String|endswith|source={{{1}}}|pattern={{{2}}} }}|yes<!--backward compatibility -->}}<noinclude>
{{documentation}}
</noinclude>
2bkmp0jw2nhdh2d3fc7ha9e1kbsdc1b
74935
74934
2026-08-24T00:44:18Z
Robertsky
10424
1 versaun husi [[:en:Template:Str_endswith]]
74934
wikitext
text/x-wiki
{{#ifeq:{{{1|a}}}{{{2|a}}}|{{{1|b}}}{{{2|b}}}|{{#invoke:String|endswith|source={{{1}}}|pattern={{{2}}} }}|yes<!--backward compatibility -->}}<noinclude>
{{documentation}}
</noinclude>
2bkmp0jw2nhdh2d3fc7ha9e1kbsdc1b
Template:Navbox with collapsible groups
10
9002
74936
2025-01-24T14:38:01Z
en>Ahecht
0
Consolidate to [[Module:Navbox]]
74936
wikitext
text/x-wiki
{{#invoke:Navbox|with collapsible groups}}<noinclude>
{{documentation}}
</noinclude>
0et0dat8y10f19rcple250dan4w781r
74937
74936
2026-08-24T00:44:18Z
Robertsky
10424
1 versaun husi [[:en:Template:Navbox_with_collapsible_groups]]
74936
wikitext
text/x-wiki
{{#invoke:Navbox|with collapsible groups}}<noinclude>
{{documentation}}
</noinclude>
0et0dat8y10f19rcple250dan4w781r
Template:Sfrac
10
9003
74938
2026-04-18T04:08:17Z
en>Pppery
0
Changed protection settings for "[[Template:Sfrac]]" ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
74938
wikitext
text/x-wiki
{{ {{{|safesubst:}}}#invoke:Unsubst||$B=<templatestyles src="Sfrac/styles.css" /><span class="sfrac">⁠{{#if:{{{3|}}}|{{{1}}}<span class="sr-only">+</span>}}<!--
--><span class="tion" {{#if:{{{font-size|}}}|style="font-size:{{{font-size}}}"}}><!--
--><span class="num">{{#if:{{{3|}}}|{{{2}}}|{{#if:{{{2|}}}|{{{1}}}|1}}}}</span><!--
--><span class="sr-only">/</span><!--
--><span class="den">{{{3|{{{2|{{{1|1}}}}}}}}}</span><!--
--></span><!--
-->⁠</span>}}<noinclude>
{{documentation}}
<!-- Add categories to /doc subpage, not here. -->
</noinclude>
32mv70cbd4f0m43l2vz2f7pex1ig26i
74939
74938
2026-08-24T00:44:18Z
Robertsky
10424
1 versaun husi [[:en:Template:Sfrac]]
74938
wikitext
text/x-wiki
{{ {{{|safesubst:}}}#invoke:Unsubst||$B=<templatestyles src="Sfrac/styles.css" /><span class="sfrac">⁠{{#if:{{{3|}}}|{{{1}}}<span class="sr-only">+</span>}}<!--
--><span class="tion" {{#if:{{{font-size|}}}|style="font-size:{{{font-size}}}"}}><!--
--><span class="num">{{#if:{{{3|}}}|{{{2}}}|{{#if:{{{2|}}}|{{{1}}}|1}}}}</span><!--
--><span class="sr-only">/</span><!--
--><span class="den">{{{3|{{{2|{{{1|1}}}}}}}}}</span><!--
--></span><!--
-->⁠</span>}}<noinclude>
{{documentation}}
<!-- Add categories to /doc subpage, not here. -->
</noinclude>
32mv70cbd4f0m43l2vz2f7pex1ig26i
Template:Sfrac/styles.css
10
9004
74940
2026-05-15T23:02:51Z
en>Beland
0
fix problems with numerals colliding with horizontal bar
74940
sanitized-css
text/css
/* {{pp|small=y}} */
.sfrac {
white-space: nowrap;
}
.sfrac.tion,
.sfrac .tion {
display: inline-block;
vertical-align: -0.5em;
font-size: 85%;
text-align: center;
margin-left: .1em;
margin-right: .1em;
}
.sfrac .num {
display: block;
border-bottom: 1px solid;
}
.sfrac .den {
display: block;
line-height: 1.5em;
}
/* [[Template:Screen reader-only]] is canonical implementation onwiki */
.sr-only {
border: 0;
clip: rect(0, 0, 0, 0); /* removed from CSS */
clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
/* white-space: nowrap; /* already have nowrap above */
}
9np07cmr35dbpmlh7lal8fpfm5p5hs6
74941
74940
2026-08-24T00:44:19Z
Robertsky
10424
1 versaun husi [[:en:Template:Sfrac/styles.css]]
74940
sanitized-css
text/css
/* {{pp|small=y}} */
.sfrac {
white-space: nowrap;
}
.sfrac.tion,
.sfrac .tion {
display: inline-block;
vertical-align: -0.5em;
font-size: 85%;
text-align: center;
margin-left: .1em;
margin-right: .1em;
}
.sfrac .num {
display: block;
border-bottom: 1px solid;
}
.sfrac .den {
display: block;
line-height: 1.5em;
}
/* [[Template:Screen reader-only]] is canonical implementation onwiki */
.sr-only {
border: 0;
clip: rect(0, 0, 0, 0); /* removed from CSS */
clip-path: polygon(0px 0px, 0px 0px, 0px 0px);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
/* white-space: nowrap; /* already have nowrap above */
}
9np07cmr35dbpmlh7lal8fpfm5p5hs6
Template:Navbox with columns
10
9005
74942
2025-01-24T01:48:13Z
en>Ahecht
0
Use consolidated [[Module:Navbox]]
74942
wikitext
text/x-wiki
{{#invoke:Navbox|with columns}}<noinclude>
{{documentation}}
<!---Please add metadata to the <includeonly> section at the bottom of the /doc subpage--->
</noinclude>
anzhsxs1564jffpwk18im0qyq9l0icw
74943
74942
2026-08-24T00:44:19Z
Robertsky
10424
1 versaun husi [[:en:Template:Navbox_with_columns]]
74942
wikitext
text/x-wiki
{{#invoke:Navbox|with columns}}<noinclude>
{{documentation}}
<!---Please add metadata to the <includeonly> section at the bottom of the /doc subpage--->
</noinclude>
anzhsxs1564jffpwk18im0qyq9l0icw
Template:Math
10
9006
74944
2026-08-11T06:32:20Z
en>Izno
0
Undid revision [[Special:Diff/1368533783|1368533783]] by [[Special:Contributions/Izno|Izno]] ([[User talk:Izno|talk]]) [[WT:CS1#Stripmarkers_in_titles_with_template_mathematics]] for temporary
74944
wikitext
text/x-wiki
<span class="texhtml {{#if:{{{big|}}}{{{size|}}}|texhtml-big}}" {{#if:{{{big|}}}{{{size|}}}|style="font-size:{{{size|165%}}};"}}>{{{1}}}</span><!--
-->{{#invoke:Check for unknown parameters|check
| unknown = {{main other|[[Category:Pages using Math with unknown parameters|_VALUE_]]}}
| showblankpositional=1
| preview = unknown parameter "_VALUE_" (consider using <code>{{!}}1=</code>, <code><nowiki>{{!}}</nowiki></code>, <code><nowiki>{{=}}</nowiki></code>)
| 1 | big | size
}}<noinclude>
{{Documentation}}
</noinclude>
loxcc5wdrayadh9axqvyklr3t29jdgm
74945
74944
2026-08-24T00:44:19Z
Robertsky
10424
1 versaun husi [[:en:Template:Math]]
74944
wikitext
text/x-wiki
<span class="texhtml {{#if:{{{big|}}}{{{size|}}}|texhtml-big}}" {{#if:{{{big|}}}{{{size|}}}|style="font-size:{{{size|165%}}};"}}>{{{1}}}</span><!--
-->{{#invoke:Check for unknown parameters|check
| unknown = {{main other|[[Category:Pages using Math with unknown parameters|_VALUE_]]}}
| showblankpositional=1
| preview = unknown parameter "_VALUE_" (consider using <code>{{!}}1=</code>, <code><nowiki>{{!}}</nowiki></code>, <code><nowiki>{{=}}</nowiki></code>)
| 1 | big | size
}}<noinclude>
{{Documentation}}
</noinclude>
loxcc5wdrayadh9axqvyklr3t29jdgm
Template:Frac
10
9007
74946
2024-01-15T01:45:41Z
en>Paine Ellsworth
0
add [[WP:RCAT|rcat template]]s
74946
wikitext
text/x-wiki
#REDIRECT [[Template:Fraction]]
{{Rcat shell|
{{R from move}}
{{R from modification}}
{{R from template shortcut}}
}}
dt0sj3lzplqm9ilcdyd6ek3677nyuaz
74947
74946
2026-08-24T00:44:19Z
Robertsky
10424
1 versaun husi [[:en:Template:Frac]]
74946
wikitext
text/x-wiki
#REDIRECT [[Template:Fraction]]
{{Rcat shell|
{{R from move}}
{{R from modification}}
{{R from template shortcut}}
}}
dt0sj3lzplqm9ilcdyd6ek3677nyuaz
Template:Font
10
9008
74950
2024-07-26T02:04:31Z
en>Izno
0
remove 'defaults' entirely as totally unnecessary with the use of the conditionals; remove a parameter that is totally useless
74950
wikitext
text/x-wiki
<includeonly><span style="{{ {{{|safesubst:}}}#if: {{{font|}}} |font-family:{{{font}}};}}{{ {{{|safesubst:}}}#if: {{{size|}}} |font-size:{{{size}}};}}{{ {{{|safesubst:}}}#if: {{{color|}}} |color:{{{color}}};}}{{ {{{|safesubst:}}}#if: {{{bgcolor|}}} |background-color:{{{bgcolor}}};}}{{ {{{|safesubst:}}}#if: {{{css|}}} |{{{css}}}}}">{{ {{{|safesubst:}}}#if: {{{1|}}} |{{{1}}}|{{{text}}}}}</span></includeonly><noinclude>
{{documentation}}
</noinclude>
pzwfv05e52tkgmzlwpvr2tqf09u7whp
74951
74950
2026-08-24T00:44:19Z
Robertsky
10424
1 versaun husi [[:en:Template:Font]]
74950
wikitext
text/x-wiki
<includeonly><span style="{{ {{{|safesubst:}}}#if: {{{font|}}} |font-family:{{{font}}};}}{{ {{{|safesubst:}}}#if: {{{size|}}} |font-size:{{{size}}};}}{{ {{{|safesubst:}}}#if: {{{color|}}} |color:{{{color}}};}}{{ {{{|safesubst:}}}#if: {{{bgcolor|}}} |background-color:{{{bgcolor}}};}}{{ {{{|safesubst:}}}#if: {{{css|}}} |{{{css}}}}}">{{ {{{|safesubst:}}}#if: {{{1|}}} |{{{1}}}|{{{text}}}}}</span></includeonly><noinclude>
{{documentation}}
</noinclude>
pzwfv05e52tkgmzlwpvr2tqf09u7whp
Template:Floor
10
9009
74952
2022-12-25T15:11:57Z
en>GKFX
0
Move documentation to subpage
74952
wikitext
text/x-wiki
<span style="font-size:{{{2|1em}}}">⌊</span>{{{1}}}<span style="font-size:{{{2|1em}}}">⌋</span><noinclude>{{Documentation}}</noinclude>
he3co36h4z66bmegojt76h8hdvwwt0f
74953
74952
2026-08-24T00:44:19Z
Robertsky
10424
1 versaun husi [[:en:Template:Floor]]
74952
wikitext
text/x-wiki
<span style="font-size:{{{2|1em}}}">⌊</span>{{{1}}}<span style="font-size:{{{2|1em}}}">⌋</span><noinclude>{{Documentation}}</noinclude>
he3co36h4z66bmegojt76h8hdvwwt0f
Template:Pars
10
9010
74954
2020-08-14T20:06:37Z
en>Mgkrupa
0
Fix
74954
wikitext
text/x-wiki
<includeonly>{{
#if: {{{2|}}}
|{{font | size={{{2}}} | text=(}}<span class="nowrap" style="padding-left:0.1em; padding-right:0.1em;">{{{1| }}}</span>{{font | size={{{2}}} | text=)}}|{{#if: {{{s|}}}
|{{font | size={{{s}}} | text=(}}|(}}{{
#if: {{{1|}}}
|<span class="nowrap" style="padding-left:0.1em; padding-right:0.1em;">{{{1}}}</span>| }}{{
#if: {{{s|}}}
|{{font | size={{{s}}} | text=)}}|)}}}}</includeonly><noinclude>
<!-------
Below, we add spacing to the above code to make it more readable:
------->
{{#if: {{{2|}}} | <!--- Start case where 2 is defined --->
{{font | {{{2}}} | text=(}}<span class="nowrap" style="padding-left:0.1em; padding-right:0.1em;">{{{1| }}}</span>{{font | {{{2}}} | text=)}} <!--- End case where 2 is defined -->
| <!-- Start case where 2 is NOT defined -->
{{#if: {{{s|}}} |{{font | size={{{s}}} | text=(}}|(}} <!--- If s is defined then font ( otherwise, print a normal ( --->
{{#if: {{{1|}}} | <!--- Start case where 1 is defined --->
<span class="nowrap" style="padding-left:0.1em; padding-right:0.1em;">{{{1}}}</span>
| <!--- Start case where 1 is NOT defined --->
}}
{{#if: {{{s|}}} |{{font | size={{{s}}} | text=)}}|)}} <!--- If s is defined then font ) otherwise, else print a normal ) --->
}}<!--- End the if statement: {{#if: {{{2|}}} | ... --->
{{documentation}}
</noinclude>
19h0c7b4dpkcav3e4lemoyjti3s6qvk
74955
74954
2026-08-24T00:44:19Z
Robertsky
10424
1 versaun husi [[:en:Template:Pars]]
74954
wikitext
text/x-wiki
<includeonly>{{
#if: {{{2|}}}
|{{font | size={{{2}}} | text=(}}<span class="nowrap" style="padding-left:0.1em; padding-right:0.1em;">{{{1| }}}</span>{{font | size={{{2}}} | text=)}}|{{#if: {{{s|}}}
|{{font | size={{{s}}} | text=(}}|(}}{{
#if: {{{1|}}}
|<span class="nowrap" style="padding-left:0.1em; padding-right:0.1em;">{{{1}}}</span>| }}{{
#if: {{{s|}}}
|{{font | size={{{s}}} | text=)}}|)}}}}</includeonly><noinclude>
<!-------
Below, we add spacing to the above code to make it more readable:
------->
{{#if: {{{2|}}} | <!--- Start case where 2 is defined --->
{{font | {{{2}}} | text=(}}<span class="nowrap" style="padding-left:0.1em; padding-right:0.1em;">{{{1| }}}</span>{{font | {{{2}}} | text=)}} <!--- End case where 2 is defined -->
| <!-- Start case where 2 is NOT defined -->
{{#if: {{{s|}}} |{{font | size={{{s}}} | text=(}}|(}} <!--- If s is defined then font ( otherwise, print a normal ( --->
{{#if: {{{1|}}} | <!--- Start case where 1 is defined --->
<span class="nowrap" style="padding-left:0.1em; padding-right:0.1em;">{{{1}}}</span>
| <!--- Start case where 1 is NOT defined --->
}}
{{#if: {{{s|}}} |{{font | size={{{s}}} | text=)}}|)}} <!--- If s is defined then font ) otherwise, else print a normal ) --->
}}<!--- End the if statement: {{#if: {{{2|}}} | ... --->
{{documentation}}
</noinclude>
19h0c7b4dpkcav3e4lemoyjti3s6qvk
Template:Ceil
10
9011
74956
2025-04-17T15:40:48Z
208.114.63.4
74956
wikitext
text/x-wiki
<onlyinclude><span style="font-size: {{{2|1em}}}">⌈</span>{{{1}}}<span style="font-size: {{{2|1em}}}">⌉</span></onlyinclude>
{{Documentation}}
n8jb91k1nquapaeretguyfq7flz7w79
74957
74956
2026-08-24T00:44:20Z
Robertsky
10424
1 versaun husi [[:en:Template:Ceil]]
74956
wikitext
text/x-wiki
<onlyinclude><span style="font-size: {{{2|1em}}}">⌈</span>{{{1}}}<span style="font-size: {{{2|1em}}}">⌉</span></onlyinclude>
{{Documentation}}
n8jb91k1nquapaeretguyfq7flz7w79
Template:Math templates
10
9012
74958
2026-03-12T15:51:41Z
en>EinesteinNobel
0
Added my new template
74958
wikitext
text/x-wiki
<!-- This template uses British English. -->
{{Navbox with collapsible groups
| name = Math templates
| state = {{{state|expanded}}}
| bodyclass = hlist
| title = Math templates
| liststyle = font-size:110%;<!--(as some templates' descriptions include links)-->
| selected = {{{selected|{{{expanded|{{{1|}}}}}}}}}
<!-------------- Functions / Numeral systems -------------->
| abbr1 = FN
| group1 =
*Functions
*Numeral systems
| state1 = <noinclude>expanded</noinclude>
| list1 =
{{Navbox |child
| group1 = Functions
| list1 =
*{{tlbare|elementary arithmetic}}
*{{tlbare|precision}}
*{{tlbare|val}} (value formatting)
*{{tlbare|percentage}}
| group2 = Numeral systems
| list2 =
*{{ml|BaseConvert|''X''to''Y''}}
*{{tlbare|binary}}
*{{tlbare|decimal2Base}}
*{{tlbare|hex2dec}}
*{{tlbare|hexadecimal}}
*{{tlbare|octal}}
*{{tlbare|quaternary}}
*{{tlbare|rn}}
*{{tlbare|roman}}
*{{tlbare|ternary}}
*{{tlbare|vigesimal}}
}}
<!---------------------- Conversions ---------------------->
| abbr2 = conversions
| group2 = Conversions
| state2 = <noinclude>expanded</noinclude>
| list2 =
{{Aligned table
|style=margin:0 auto 0;text-align:left;
| {{Aligned table
|style=padding-right:2.5em;
|col1style=text-align:right;white-space:nowrap;padding-right:1.0em;
|col2style=font-size:90%;<!--(see liststyle above)--> vertical-align:middle;line-height:1.3em;font-style:italic;
| {{tlbare|convert}} | many units (see: [[Template:Convert/list_of_units |list]])
| {{tlbare|cvt}} | abbreviated {{tl|convert}}
| {{tlbare|convinfobox}} | {{tl|convert}} for infoboxes
| {{tlbare|bbl to t}} | barrels of oil to tonnes
| {{tlbare|long ton}} | long hundredweights, quarters and pounds to kilograms;<br/>long tons and hundredweights to pounds and metric tons
| {{tlbare|miles-chains}} | miles and chains to kilometres linking "chains"
}}
| {{Aligned table
|col1style=text-align:right;white-space:nowrap;padding-right:1.0em;
|col2style=font-size:90%;<!--(as above)--> vertical-align:middle;line-height:1.3em;font-style:italic;
| {{tlbare|decdeg}} | degrees, minutes, and seconds to [[decimal degrees]]
| {{tlbare|deg2DMS|deg2dms}} | decimal degrees to degrees, minutes, and seconds
| {{tlbare|deg2HMS|deg2hms}} | decimal degrees to [[hour angle]] (in hours, minutes, and seconds)
| {{tlbare|HMS2Deg|hms2deg}} | [[hour angle]] (in hours, minutes, and seconds) to decimal degrees
| {{tlbare|inflation}} | calculate inflation of Consumer Price Index-related prices
| {{tlbare|pop density}} | population density in an area
| {{tlbare|track gauge}} | railway track gauges
}}
}}
<!----------------------- Notation & formatting ------------------------>
| group3 = Notation and {{Category link|Mathematical formatting templates|formatting}}
| abbr3 = notation
| state3 = <noinclude>expanded</noinclude>
| list3 =
{{Aligned table
|style=margin:0 auto 0;text-align:left;
|cols=4
|col1style=text-align:right;white-space:nowrap;padding-right:1.0em;
|col2style=font-size:90%;<!--(as above)--> vertical-align:top;line-height:1.3em;font-style:italic;padding-right:2.5em;
|col3style=text-align:right;white-space:nowrap;padding-right:1.0em;
|col4style=font-size:90%;<!--(as above)--> vertical-align:top;line-height:1.3em;font-style:italic;
|row1style=border-bottom:1px solid #777;
|row4style=border-bottom:1px solid #777;
|row7style=border-bottom:1px solid #777;
|row10style=border-bottom:1px solid #777;
<!-- This is a bit awkward to sort. Basically within a group of size 8 we go in the order of 1|1|5|5|2|2|6|6|3|3|7|7|4|4|8|8 -->
<!-- Group 1. The essential texhtml -->
| {{tlbare|bigmath}} | bigger font to match {{noitalic|[[TeX]]}} {{noitalic|<samp><nowiki>\</nowiki>displaystyle</samp>}} (standalone formulas only)
| {{tlbare|math}} | short text-based formulas
<!-- Group 2. Other inline typographical -->
| {{tlbare|mathcal}} | [mathematical] calligraphic font; alternative to {{noitalic|[[LaTeX]]}} {{noitalic|<samp><nowiki>\</nowiki>mathcal{...}</samp>}}
| {{tlbare|tombstone}} | symbol indicating the [[Tombstone (typography)|end of a proof]]
<!-- Row -->
| {{tlbare|mvar}} | individual italicized maths variables in normal text
| {{tlbare|val}} | measurement values, uncertainties and units
<!-- Row -->
|
*{{tlbare|overline}}
*{{tlbare|underline}}
*{{tlbare|overunderline}}| a line set above/below a sequence of characters
| {{tlbare|vec}} | various overarrows, underarrows, etc.<!--pointing left, right or both ways-->
<!-- Row --
| {{tlbare|overarc}} | an arc set above a sequence of characters
| |
|row5style=border-bottom:1px solid #333;
<!-- Group 3. The deliminators -->
| {{tlbare|abs}} | absolute values (paired vertical lines)
|
*{{tlbare|langle}}
*{{tlbare|rangle}}
*{{tlbare|Angle bracket|angbr}} | [[Bracket#Angular brackets|angular bracket]]s
<!-- Row -->
|
*{{tlbare|bra-ket}}
*{{tlbare|braket}}
*{{tlbare|bra}}
*{{tlbare|ket}} | [[bra–ket notation]]
|
*{{tlbare|ldelim}}
*{{tlbare|rdelim}} | multiline delimiters (2–5 lines inclusive)
<!-- Row -->
| {{tlbare|ceil}}, {{tlbare|floor}} | calculations [[:mw:Help:Extension:ParserFunctions##expr|:mw:Help:#expr]]; formatting indicators {{noitalic|1={{ceil|3.14}}<!-- -->}}, {{noitalic|1={{floor|3.14}}<!-- -->}} (no calculation performed)
| {{tlbare|pars}} | parentheses that can be resized {{noitalic|1={{math|{{pars|s=150|{{large|∑}}<!-- -->}}<!-- -->}}<!-- -->}}
<!-- Group 4. The taller-than-one-line (composites, etc) -->
<!-- Row -->
| {{tlbare|fraction}} | slant fractions {{frac|3|5}} (not for maths/science articles; use ''standing'' or upright fractions {{noitalic|{{tlx|sfrac}}<!-- -->}} instead)
| {{tlbare|sfrac}} | "standing" or upright fractions {{sfrac|3|5}} (use in maths/science articles instead of{{noitalic|{{tlx|fraction}}<!-- -->}})
<!-- Row -->
| {{tlbare|intmath}} | [[integral symbol]]s
|{{tlbare|sum-int}} | an integral superimposed over a capital sigma
|
*{{tlbare|sub}}
*{{tlbare|sup}}
*{{tlbare|su}} | subscripts and superscripts
<!-- Row -->
|
*{{tlbare|overset}}
*{{tlbare|underset}} | arbitrary characters/diacritics set above/below one another
| |
|row13style=border-bottom:1px solid #333;
<!-- Group 5. For interfacing with <math>, not the texhtml stuff -->
| {{tlbare|tmath}}
| Wrap {{noitalic|[[TeX]]}} in {{noitalic|<nowiki><math></nowiki>}} tags
}}
<!---------------- Boxes / Tags / Notices ----------------->
| abbr4 = BTN
| group4 =
*Boxes
*Tags
*Notices
| state4 = <noinclude>expanded</noinclude>
| list4 =
{{Navbox with columns |child
|colstyle=text-align:center;
| col1header = Boxes
| col1 =
*{{tlbare|arithmetic operations}}
*{{tlbare|calculus}}
*{{tlbare|Infobox mathematical function}}
*{{tlbare|functions}}
| col2header = Tags
| col2 =
*{{tlbare|metricate}}
*{{tlbare|undue precision}}
*{{tlbare|units attention}}
}}
| below =
*{{icon|Category}} {{c|Mathematics templates|Category}}
*[[:Module:Math]]
}}<noinclude>
{{Documentation}}
</noinclude>
bvzugyng60byww5whpuiwk2eq3tfxzu
74959
74958
2026-08-24T00:44:20Z
Robertsky
10424
1 versaun husi [[:en:Template:Math_templates]]
74958
wikitext
text/x-wiki
<!-- This template uses British English. -->
{{Navbox with collapsible groups
| name = Math templates
| state = {{{state|expanded}}}
| bodyclass = hlist
| title = Math templates
| liststyle = font-size:110%;<!--(as some templates' descriptions include links)-->
| selected = {{{selected|{{{expanded|{{{1|}}}}}}}}}
<!-------------- Functions / Numeral systems -------------->
| abbr1 = FN
| group1 =
*Functions
*Numeral systems
| state1 = <noinclude>expanded</noinclude>
| list1 =
{{Navbox |child
| group1 = Functions
| list1 =
*{{tlbare|elementary arithmetic}}
*{{tlbare|precision}}
*{{tlbare|val}} (value formatting)
*{{tlbare|percentage}}
| group2 = Numeral systems
| list2 =
*{{ml|BaseConvert|''X''to''Y''}}
*{{tlbare|binary}}
*{{tlbare|decimal2Base}}
*{{tlbare|hex2dec}}
*{{tlbare|hexadecimal}}
*{{tlbare|octal}}
*{{tlbare|quaternary}}
*{{tlbare|rn}}
*{{tlbare|roman}}
*{{tlbare|ternary}}
*{{tlbare|vigesimal}}
}}
<!---------------------- Conversions ---------------------->
| abbr2 = conversions
| group2 = Conversions
| state2 = <noinclude>expanded</noinclude>
| list2 =
{{Aligned table
|style=margin:0 auto 0;text-align:left;
| {{Aligned table
|style=padding-right:2.5em;
|col1style=text-align:right;white-space:nowrap;padding-right:1.0em;
|col2style=font-size:90%;<!--(see liststyle above)--> vertical-align:middle;line-height:1.3em;font-style:italic;
| {{tlbare|convert}} | many units (see: [[Template:Convert/list_of_units |list]])
| {{tlbare|cvt}} | abbreviated {{tl|convert}}
| {{tlbare|convinfobox}} | {{tl|convert}} for infoboxes
| {{tlbare|bbl to t}} | barrels of oil to tonnes
| {{tlbare|long ton}} | long hundredweights, quarters and pounds to kilograms;<br/>long tons and hundredweights to pounds and metric tons
| {{tlbare|miles-chains}} | miles and chains to kilometres linking "chains"
}}
| {{Aligned table
|col1style=text-align:right;white-space:nowrap;padding-right:1.0em;
|col2style=font-size:90%;<!--(as above)--> vertical-align:middle;line-height:1.3em;font-style:italic;
| {{tlbare|decdeg}} | degrees, minutes, and seconds to [[decimal degrees]]
| {{tlbare|deg2DMS|deg2dms}} | decimal degrees to degrees, minutes, and seconds
| {{tlbare|deg2HMS|deg2hms}} | decimal degrees to [[hour angle]] (in hours, minutes, and seconds)
| {{tlbare|HMS2Deg|hms2deg}} | [[hour angle]] (in hours, minutes, and seconds) to decimal degrees
| {{tlbare|inflation}} | calculate inflation of Consumer Price Index-related prices
| {{tlbare|pop density}} | population density in an area
| {{tlbare|track gauge}} | railway track gauges
}}
}}
<!----------------------- Notation & formatting ------------------------>
| group3 = Notation and {{Category link|Mathematical formatting templates|formatting}}
| abbr3 = notation
| state3 = <noinclude>expanded</noinclude>
| list3 =
{{Aligned table
|style=margin:0 auto 0;text-align:left;
|cols=4
|col1style=text-align:right;white-space:nowrap;padding-right:1.0em;
|col2style=font-size:90%;<!--(as above)--> vertical-align:top;line-height:1.3em;font-style:italic;padding-right:2.5em;
|col3style=text-align:right;white-space:nowrap;padding-right:1.0em;
|col4style=font-size:90%;<!--(as above)--> vertical-align:top;line-height:1.3em;font-style:italic;
|row1style=border-bottom:1px solid #777;
|row4style=border-bottom:1px solid #777;
|row7style=border-bottom:1px solid #777;
|row10style=border-bottom:1px solid #777;
<!-- This is a bit awkward to sort. Basically within a group of size 8 we go in the order of 1|1|5|5|2|2|6|6|3|3|7|7|4|4|8|8 -->
<!-- Group 1. The essential texhtml -->
| {{tlbare|bigmath}} | bigger font to match {{noitalic|[[TeX]]}} {{noitalic|<samp><nowiki>\</nowiki>displaystyle</samp>}} (standalone formulas only)
| {{tlbare|math}} | short text-based formulas
<!-- Group 2. Other inline typographical -->
| {{tlbare|mathcal}} | [mathematical] calligraphic font; alternative to {{noitalic|[[LaTeX]]}} {{noitalic|<samp><nowiki>\</nowiki>mathcal{...}</samp>}}
| {{tlbare|tombstone}} | symbol indicating the [[Tombstone (typography)|end of a proof]]
<!-- Row -->
| {{tlbare|mvar}} | individual italicized maths variables in normal text
| {{tlbare|val}} | measurement values, uncertainties and units
<!-- Row -->
|
*{{tlbare|overline}}
*{{tlbare|underline}}
*{{tlbare|overunderline}}| a line set above/below a sequence of characters
| {{tlbare|vec}} | various overarrows, underarrows, etc.<!--pointing left, right or both ways-->
<!-- Row --
| {{tlbare|overarc}} | an arc set above a sequence of characters
| |
|row5style=border-bottom:1px solid #333;
<!-- Group 3. The deliminators -->
| {{tlbare|abs}} | absolute values (paired vertical lines)
|
*{{tlbare|langle}}
*{{tlbare|rangle}}
*{{tlbare|Angle bracket|angbr}} | [[Bracket#Angular brackets|angular bracket]]s
<!-- Row -->
|
*{{tlbare|bra-ket}}
*{{tlbare|braket}}
*{{tlbare|bra}}
*{{tlbare|ket}} | [[bra–ket notation]]
|
*{{tlbare|ldelim}}
*{{tlbare|rdelim}} | multiline delimiters (2–5 lines inclusive)
<!-- Row -->
| {{tlbare|ceil}}, {{tlbare|floor}} | calculations [[:mw:Help:Extension:ParserFunctions##expr|:mw:Help:#expr]]; formatting indicators {{noitalic|1={{ceil|3.14}}<!-- -->}}, {{noitalic|1={{floor|3.14}}<!-- -->}} (no calculation performed)
| {{tlbare|pars}} | parentheses that can be resized {{noitalic|1={{math|{{pars|s=150|{{large|∑}}<!-- -->}}<!-- -->}}<!-- -->}}
<!-- Group 4. The taller-than-one-line (composites, etc) -->
<!-- Row -->
| {{tlbare|fraction}} | slant fractions {{frac|3|5}} (not for maths/science articles; use ''standing'' or upright fractions {{noitalic|{{tlx|sfrac}}<!-- -->}} instead)
| {{tlbare|sfrac}} | "standing" or upright fractions {{sfrac|3|5}} (use in maths/science articles instead of{{noitalic|{{tlx|fraction}}<!-- -->}})
<!-- Row -->
| {{tlbare|intmath}} | [[integral symbol]]s
|{{tlbare|sum-int}} | an integral superimposed over a capital sigma
|
*{{tlbare|sub}}
*{{tlbare|sup}}
*{{tlbare|su}} | subscripts and superscripts
<!-- Row -->
|
*{{tlbare|overset}}
*{{tlbare|underset}} | arbitrary characters/diacritics set above/below one another
| |
|row13style=border-bottom:1px solid #333;
<!-- Group 5. For interfacing with <math>, not the texhtml stuff -->
| {{tlbare|tmath}}
| Wrap {{noitalic|[[TeX]]}} in {{noitalic|<nowiki><math></nowiki>}} tags
}}
<!---------------- Boxes / Tags / Notices ----------------->
| abbr4 = BTN
| group4 =
*Boxes
*Tags
*Notices
| state4 = <noinclude>expanded</noinclude>
| list4 =
{{Navbox with columns |child
|colstyle=text-align:center;
| col1header = Boxes
| col1 =
*{{tlbare|arithmetic operations}}
*{{tlbare|calculus}}
*{{tlbare|Infobox mathematical function}}
*{{tlbare|functions}}
| col2header = Tags
| col2 =
*{{tlbare|metricate}}
*{{tlbare|undue precision}}
*{{tlbare|units attention}}
}}
| below =
*{{icon|Category}} {{c|Mathematics templates|Category}}
*[[:Module:Math]]
}}<noinclude>
{{Documentation}}
</noinclude>
bvzugyng60byww5whpuiwk2eq3tfxzu
Template:Tlbare
10
9013
74960
2023-03-26T20:27:49Z
en>HouseBlaster
0
HouseBlaster moved page [[Template:Tlbare]] to [[Template:Template link bare]]: expand name per [[WP:TG]]
74960
wikitext
text/x-wiki
#REDIRECT [[Template:Template link bare]]
{{Redirect category shell|
{{R from move}}
}}
l89xpoqitv1g23dahghl12q7xp9b5q1
74961
74960
2026-08-24T00:44:20Z
Robertsky
10424
1 versaun husi [[:en:Template:Tlbare]]
74960
wikitext
text/x-wiki
#REDIRECT [[Template:Template link bare]]
{{Redirect category shell|
{{R from move}}
}}
l89xpoqitv1g23dahghl12q7xp9b5q1
Módulo:Formatnum/doc
828
9014
74962
2024-08-29T21:29:57Z
en>Warudo
0
Added the page to [[:Category:Module documentation pages]]
74962
wikitext
text/x-wiki
This module provides a number formatting function. This function can be used from #invoke or from other Lua modules.
This module is used by [[Module:Complex date]]
== Use from other Lua modules ==
To use the module from normal wiki pages, no special preparation is needed. If you are using the module from another Lua module, first you need to load it, like this:
<syntaxhighlight lang="lua">
local mf = require('Module:Formatnum')
</syntaxhighlight>
(The <code>mf</code> variable stands for '''M'''odule '''F'''ormatnum; you can choose something more descriptive if you prefer.)
Most functions in the module have a version for Lua and a version for #invoke. It is possible to use the #invoke functions from other Lua modules, but using the Lua functions has the advantage that you do not need to access a Lua [[mw:Extension:Scribunto/Lua reference manual#Frame object|frame object]]. Lua functions are preceded by <code>_</code>, whereas #invoke functions are not.
== main ==
{{#invoke:Formatnum|main|''x''|''lang=''|''prec=''|''sep=''}}
<syntaxhighlight lang="lua">
mf.formatNum(x, lang, prec, sep)
</syntaxhighlight>
==See also==
{{Math templates}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
</noinclude>
0ml2eayajpjs3i3zouqtm30yjdtx2qs
74963
74962
2026-08-24T00:44:20Z
Robertsky
10424
1 versaun husi [[:en:Module:Formatnum/doc]]
74962
wikitext
text/x-wiki
This module provides a number formatting function. This function can be used from #invoke or from other Lua modules.
This module is used by [[Module:Complex date]]
== Use from other Lua modules ==
To use the module from normal wiki pages, no special preparation is needed. If you are using the module from another Lua module, first you need to load it, like this:
<syntaxhighlight lang="lua">
local mf = require('Module:Formatnum')
</syntaxhighlight>
(The <code>mf</code> variable stands for '''M'''odule '''F'''ormatnum; you can choose something more descriptive if you prefer.)
Most functions in the module have a version for Lua and a version for #invoke. It is possible to use the #invoke functions from other Lua modules, but using the Lua functions has the advantage that you do not need to access a Lua [[mw:Extension:Scribunto/Lua reference manual#Frame object|frame object]]. Lua functions are preceded by <code>_</code>, whereas #invoke functions are not.
== main ==
{{#invoke:Formatnum|main|''x''|''lang=''|''prec=''|''sep=''}}
<syntaxhighlight lang="lua">
mf.formatNum(x, lang, prec, sep)
</syntaxhighlight>
==See also==
{{Math templates}}
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
</noinclude>
0ml2eayajpjs3i3zouqtm30yjdtx2qs
Template:Template link bare
10
9015
74964
2023-03-26T20:27:49Z
en>HouseBlaster
0
HouseBlaster moved page [[Template:Tlbare]] to [[Template:Template link bare]]: expand name per [[WP:TG]]
74964
wikitext
text/x-wiki
{{#if:{{str endswith|{{{1}}}|%}} <!--(i.e. if {{{1}}} is a percentage)-->
| [[Template:{{{2}}}|<span style="font-size:{{{1}}};">{{{3|{{{2}}}}}}</span>]]
| [[Template:{{{1}}}|{{{2|{{{1}}}}}}]]
}}<noinclude>
{{Documentation}}
</noinclude>
atiz55vvk4gem0tvnnsrtowqye3jkoh
74965
74964
2026-08-24T00:44:20Z
Robertsky
10424
1 versaun husi [[:en:Template:Template_link_bare]]
74964
wikitext
text/x-wiki
{{#if:{{str endswith|{{{1}}}|%}} <!--(i.e. if {{{1}}} is a percentage)-->
| [[Template:{{{2}}}|<span style="font-size:{{{1}}};">{{{3|{{{2}}}}}}</span>]]
| [[Template:{{{1}}}|{{{2|{{{1}}}}}}]]
}}<noinclude>
{{Documentation}}
</noinclude>
atiz55vvk4gem0tvnnsrtowqye3jkoh
Módulo:Roman
828
9016
74966
2023-02-08T20:14:10Z
en>Uzume
0
strict
74966
Scribunto
text/plain
-- This module implements {{Roman}}.
require[[strict]]
local p = {}
-- This function implements the {{overline}} template.
local function overline(s)
return mw.ustring.format( '<span style="text-decoration:overline;">%s</span>', s )
end
-- Gets the Roman numerals for a given numeral table. Returns both the string of
-- numerals and the value of the number after it is finished being processed.
local function getLetters(num, t)
local ret = {}
for _, v in ipairs(t) do
local val, letter = unpack(v)
while num >= val do
num = num - val
table.insert(ret, letter)
end
end
return table.concat(ret), num
end
-- The main control flow of the module.
local function _main(args)
-- Get input and exit displaying nothing if the input is empty.
if args[1] == nil then return end
local num = tonumber(args[1])
if not num or num < 0 or num == math.huge then
error('Invalid number ' .. args[1], 2)
elseif num == 0 then
return 'N'
end
-- Return a message for numbers too big to be expressed in Roman numerals.
if num >= 5000000 then
return args[2] or 'N/A'
end
local ret = ''
-- Find the Roman numerals for the large part of numbers.
-- 23 April 2016 - tweaked to >= 4000 to accept big Roman 'IV'
-- The if statement is not strictly necessary, but makes the algorithm
-- more efficient for smaller numbers.
if num >= 4000 then
local bigRomans = {
{ 1000000, 'M' },
{ 900000, 'CM' }, { 500000, 'D' }, { 400000, 'CD' }, { 100000, 'C' },
{ 90000, 'XC' }, { 50000, 'L' }, { 40000, 'XL' }, { 10000, 'X' },
{ 9000, 'IX' }, { 5000, 'V' }, { 4000, 'IV' },
}
local bigLetters
bigLetters, num = getLetters(num, bigRomans)
ret = overline(bigLetters)
end
-- Find the Roman numerals for numbers less than the big Roman threshold.
local smallRomans = {
{ 1000, 'M' },
{ 900, 'CM' }, { 500, 'D' }, { 400, 'CD' }, { 100, 'C' },
{ 90, 'XC' }, { 50, 'L' }, { 40, 'XL' }, { 10, 'X' },
{ 9, 'IX' }, { 5, 'V' }, { 4, 'IV' }, { 1, 'I' }
}
local smallLetters = getLetters( num, smallRomans )
ret = ret .. smallLetters
if args.fraction == 'yes' then
-- Find the Roman numerals for the fractional parts of numbers.
-- If num is not a whole number, add half of 1/1728 (the smallest unit) to equate to rounding.
-- Ensure we're not less than the smallest unit or larger than 1 - smallest unit
-- to avoid getting two "half" symbols or no symbols at all
num = num - math.floor(num)
if num ~= 0 then
num = math.max(1.1/1728, math.min(1727.1/1728, num + 1/3456))
end
local fractionalRomans = {
{ 1/2, 'S' }, { 5/12, "''':'''•''':'''" }, { 1/3, "'''::'''" },
{ 1/4, "''':'''•" }, { 1/6, "''':'''" }, { 1/12, '•' },
{ 1/24, 'Є' }, { 1/36, 'ƧƧ' }, { 1/48, 'Ɔ' }, { 1/72, 'Ƨ' }, { 1/144, '<s>Ƨ</s>' },
{ 1/288, '℈' }, { 1/1728, '»' },
}
local fractionalLetters = getLetters(num, fractionalRomans)
ret = ret .. fractionalLetters
end
return ret
end
function p.main(frame)
-- If called via #invoke, use the args passed into the invoking
-- template, or the args passed to #invoke if any exist. Otherwise
-- assume args are being passed directly in from the debug console
-- or from another Lua module.
local origArgs
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
for k, v in pairs(frame.args) do
origArgs = frame.args
break
end
else
origArgs = frame
end
-- Trim whitespace and remove blank arguments.
local args = {}
for k, v in pairs(origArgs) do
if type( v ) == 'string' then
v = mw.text.trim(v)
end
if v ~= '' then
args[k] = v
end
end
-- exit if not given anything
if args == nil or args == {} then return end
-- Given mathematical expression, simplify to a number
if type(args[1]) == 'string' then
local success, result = pcall(mw.ext.ParserFunctions.expr, args[1])
if success then
args[1] = result
end -- else, pass to _main routine and try to let Lua's tonumber handle it
end
return _main(args)
end
return p
4wa0ln3ffmm2ip5y87j3mrl9kt1i95w
74967
74966
2026-08-24T00:44:27Z
Robertsky
10424
1 versaun husi [[:en:Module:Roman]]
74966
Scribunto
text/plain
-- This module implements {{Roman}}.
require[[strict]]
local p = {}
-- This function implements the {{overline}} template.
local function overline(s)
return mw.ustring.format( '<span style="text-decoration:overline;">%s</span>', s )
end
-- Gets the Roman numerals for a given numeral table. Returns both the string of
-- numerals and the value of the number after it is finished being processed.
local function getLetters(num, t)
local ret = {}
for _, v in ipairs(t) do
local val, letter = unpack(v)
while num >= val do
num = num - val
table.insert(ret, letter)
end
end
return table.concat(ret), num
end
-- The main control flow of the module.
local function _main(args)
-- Get input and exit displaying nothing if the input is empty.
if args[1] == nil then return end
local num = tonumber(args[1])
if not num or num < 0 or num == math.huge then
error('Invalid number ' .. args[1], 2)
elseif num == 0 then
return 'N'
end
-- Return a message for numbers too big to be expressed in Roman numerals.
if num >= 5000000 then
return args[2] or 'N/A'
end
local ret = ''
-- Find the Roman numerals for the large part of numbers.
-- 23 April 2016 - tweaked to >= 4000 to accept big Roman 'IV'
-- The if statement is not strictly necessary, but makes the algorithm
-- more efficient for smaller numbers.
if num >= 4000 then
local bigRomans = {
{ 1000000, 'M' },
{ 900000, 'CM' }, { 500000, 'D' }, { 400000, 'CD' }, { 100000, 'C' },
{ 90000, 'XC' }, { 50000, 'L' }, { 40000, 'XL' }, { 10000, 'X' },
{ 9000, 'IX' }, { 5000, 'V' }, { 4000, 'IV' },
}
local bigLetters
bigLetters, num = getLetters(num, bigRomans)
ret = overline(bigLetters)
end
-- Find the Roman numerals for numbers less than the big Roman threshold.
local smallRomans = {
{ 1000, 'M' },
{ 900, 'CM' }, { 500, 'D' }, { 400, 'CD' }, { 100, 'C' },
{ 90, 'XC' }, { 50, 'L' }, { 40, 'XL' }, { 10, 'X' },
{ 9, 'IX' }, { 5, 'V' }, { 4, 'IV' }, { 1, 'I' }
}
local smallLetters = getLetters( num, smallRomans )
ret = ret .. smallLetters
if args.fraction == 'yes' then
-- Find the Roman numerals for the fractional parts of numbers.
-- If num is not a whole number, add half of 1/1728 (the smallest unit) to equate to rounding.
-- Ensure we're not less than the smallest unit or larger than 1 - smallest unit
-- to avoid getting two "half" symbols or no symbols at all
num = num - math.floor(num)
if num ~= 0 then
num = math.max(1.1/1728, math.min(1727.1/1728, num + 1/3456))
end
local fractionalRomans = {
{ 1/2, 'S' }, { 5/12, "''':'''•''':'''" }, { 1/3, "'''::'''" },
{ 1/4, "''':'''•" }, { 1/6, "''':'''" }, { 1/12, '•' },
{ 1/24, 'Є' }, { 1/36, 'ƧƧ' }, { 1/48, 'Ɔ' }, { 1/72, 'Ƨ' }, { 1/144, '<s>Ƨ</s>' },
{ 1/288, '℈' }, { 1/1728, '»' },
}
local fractionalLetters = getLetters(num, fractionalRomans)
ret = ret .. fractionalLetters
end
return ret
end
function p.main(frame)
-- If called via #invoke, use the args passed into the invoking
-- template, or the args passed to #invoke if any exist. Otherwise
-- assume args are being passed directly in from the debug console
-- or from another Lua module.
local origArgs
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
for k, v in pairs(frame.args) do
origArgs = frame.args
break
end
else
origArgs = frame
end
-- Trim whitespace and remove blank arguments.
local args = {}
for k, v in pairs(origArgs) do
if type( v ) == 'string' then
v = mw.text.trim(v)
end
if v ~= '' then
args[k] = v
end
end
-- exit if not given anything
if args == nil or args == {} then return end
-- Given mathematical expression, simplify to a number
if type(args[1]) == 'string' then
local success, result = pcall(mw.ext.ParserFunctions.expr, args[1])
if success then
args[1] = result
end -- else, pass to _main routine and try to let Lua's tonumber handle it
end
return _main(args)
end
return p
4wa0ln3ffmm2ip5y87j3mrl9kt1i95w
Template:Green
10
9017
74970
2026-05-17T00:04:49Z
en>Amire80
0
remove unnecessary comment
74970
wikitext
text/x-wiki
<span style="color:green;">{{{1}}}</span><noinclude>
<!-- Add categories to the /doc subpage -->
{{Documentation}}</noinclude>
atp2m4axc4t1dca7xhuwiw8hxxu6fzl
74971
74970
2026-08-24T00:44:28Z
Robertsky
10424
1 versaun husi [[:en:Template:Green]]
74970
wikitext
text/x-wiki
<span style="color:green;">{{{1}}}</span><noinclude>
<!-- Add categories to the /doc subpage -->
{{Documentation}}</noinclude>
atp2m4axc4t1dca7xhuwiw8hxxu6fzl
Template:Lua sidebar
10
9018
74972
2026-08-10T15:05:55Z
en>FaviFake
0
Upgrade template visually, using the standard helpbox template. This also makes it more compact, since it's used at the top of doc pages, rendering usage of templatestyles= obsolete
74972
wikitext
text/x-wiki
{{helpbox
| class = lua-sidebar
| title = Related pages
| list1 = {{plainlist}}
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}|Template]] {{#if:{{#invoke:redirect|isRedirect|Template talk:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}}}||([[Template talk:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}|talk]])}}
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/sandbox|Template sandbox]]
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/testcases|Template testcases]]
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/doc|Template doc]]
* [[Special:PrefixIndex/Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/|Template subpages]]
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}|Module]] {{#if:{{#invoke:redirect|isRedirect|Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}}}||([[Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}|talk]])}}
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/sandbox|Module sandbox]]
* [[Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/testcases|Module testcases]]
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/doc|Module doc]]
* [[Special:PrefixIndex/Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/|Module subpages]]
{{endplainlist}}
| list2 = {{{1|}}}
}}{{Template other|{{Sandbox other|[[Category:Lua-based templates]]}}}}<noinclude>
{{Documentation}}
</noinclude>
ieuhxh4aw0908lk4sgo8e81k2q27k99
74973
74972
2026-08-24T00:44:28Z
Robertsky
10424
1 versaun husi [[:en:Template:Lua_sidebar]]
74972
wikitext
text/x-wiki
{{helpbox
| class = lua-sidebar
| title = Related pages
| list1 = {{plainlist}}
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}|Template]] {{#if:{{#invoke:redirect|isRedirect|Template talk:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}}}||([[Template talk:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}|talk]])}}
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/sandbox|Template sandbox]]
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/testcases|Template testcases]]
* [[Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/doc|Template doc]]
* [[Special:PrefixIndex/Template:{{{template|{{{title|{{BASEPAGENAME}}}}}}}}/|Template subpages]]
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}|Module]] {{#if:{{#invoke:redirect|isRedirect|Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}}}||([[Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}|talk]])}}
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/sandbox|Module sandbox]]
* [[Module talk:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/testcases|Module testcases]]
* [[Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/doc|Module doc]]
* [[Special:PrefixIndex/Module:{{{module|{{{title|{{BASEPAGENAME}}}}}}}}/|Module subpages]]
{{endplainlist}}
| list2 = {{{1|}}}
}}{{Template other|{{Sandbox other|[[Category:Lua-based templates]]}}}}<noinclude>
{{Documentation}}
</noinclude>
ieuhxh4aw0908lk4sgo8e81k2q27k99
Módulo:Roman/doc
828
9019
74976
2023-08-21T00:47:13Z
en>GKNishimoto
0
74976
wikitext
text/x-wiki
{{High-use|3700+}}
{{Module rating|protected}}
{{Lua sidebar}}
This module implements the {{Tl|Roman}} template. For behavioral documentation, please see the template page. For test cases, please see [[Template:Roman/testcases]].
* Module supports 0 as a Roman numeral, displays as 'N'.
* Prior to 25 April 2016, used to display 69105 as <span style="text-decoration:overline;">LXV</span>MMMMCV. With the addition of <span style="text-decoration:overline;">IX</span> and <span style="text-decoration:overline;">IV</span> being 9000 and 4000 respectively, we now display 69105 as <span style="text-decoration:overline;">LXIX</span>CV.
* Module handles decimal, fractional, and arithmetic expressions to a precision of 1/1728. {{Green|Uses <code>#expr:</code> at line 122.}}
== Handling tricky cases (like 0.00001 and 99.99999) ==
# Find the Roman numerals for the integer part of the number.
# If the number is not an integer:
#* Add half of the smallest unit (1/1728) to simulate rounding instead of truncation.
#* Ensure this new result is between 1/1728 and 1727/1728. (actually 1.1/1728 and 1727.1/1728 due to floating point rounding issues)
# Hence, 0.00001 is guaranteed to have at least the smallest unit symbol (instead of being blank or 0), and 99.99999 does not display as 100 or 99 and 2 halves.
== Validation ==
* [[Template:Roman/testcases]]
* [[Module:Roman/testcases]] - does not contain fractional/decimal tests
* The template supports <code>subst:</code> and <code>safesubst:</code>.
<noinclude>
[[pt:Módulo:Roman/doc]]
</noinclude>
7gym2jp3divgtp0g520vtpj9qb6ukfy
74977
74976
2026-08-24T00:44:28Z
Robertsky
10424
1 versaun husi [[:en:Module:Roman/doc]]
74976
wikitext
text/x-wiki
{{High-use|3700+}}
{{Module rating|protected}}
{{Lua sidebar}}
This module implements the {{Tl|Roman}} template. For behavioral documentation, please see the template page. For test cases, please see [[Template:Roman/testcases]].
* Module supports 0 as a Roman numeral, displays as 'N'.
* Prior to 25 April 2016, used to display 69105 as <span style="text-decoration:overline;">LXV</span>MMMMCV. With the addition of <span style="text-decoration:overline;">IX</span> and <span style="text-decoration:overline;">IV</span> being 9000 and 4000 respectively, we now display 69105 as <span style="text-decoration:overline;">LXIX</span>CV.
* Module handles decimal, fractional, and arithmetic expressions to a precision of 1/1728. {{Green|Uses <code>#expr:</code> at line 122.}}
== Handling tricky cases (like 0.00001 and 99.99999) ==
# Find the Roman numerals for the integer part of the number.
# If the number is not an integer:
#* Add half of the smallest unit (1/1728) to simulate rounding instead of truncation.
#* Ensure this new result is between 1/1728 and 1727/1728. (actually 1.1/1728 and 1727.1/1728 due to floating point rounding issues)
# Hence, 0.00001 is guaranteed to have at least the smallest unit symbol (instead of being blank or 0), and 99.99999 does not display as 100 or 99 and 2 halves.
== Validation ==
* [[Template:Roman/testcases]]
* [[Module:Roman/testcases]] - does not contain fractional/decimal tests
* The template supports <code>subst:</code> and <code>safesubst:</code>.
<noinclude>
[[pt:Módulo:Roman/doc]]
</noinclude>
7gym2jp3divgtp0g520vtpj9qb6ukfy
Diskusaun Template:Roman
11
9020
74978
2024-05-21T10:02:37Z
en>Primefac
0
/* Edit request on 18 December 2012 */update template call
74978
wikitext
text/x-wiki
==Documentation==
This template converts [[Arabic numeral]]s (that is, 1, 2, 3, etc) into [[Roman numeral]]s (I, II, III etc). It currently works for any whole number between 1 and 4999999. To use it, enter <nowiki>{{Roman|YOURNUMBER}}</nowiki>, replacing "YOURNUMBER" with a number.
{|class="wikitable" style="text-align:center"
|+ Examples of Roman numeral conversion
! Arabic Numerals !! Template Call !! Roman Numerals
|-
|1 || <nowiki>{{Roman|1}}</nowiki> || {{Roman|1}}
|-
|2 || <nowiki>{{Roman|2}}</nowiki> || {{Roman|2}}
|-
|49 || <nowiki>{{Roman|49}}</nowiki> || {{Roman|49}}
|-
|50 || <nowiki>{{Roman|50}}</nowiki> || {{Roman|50}}
|-
|51 || <nowiki>{{Roman|51}}</nowiki> || {{Roman|51}}
|-
|1024 || <nowiki>{{Roman|1024}}</nowiki> || {{Roman|1024}}
|-
|4999 || <nowiki>{{Roman|4999}}</nowiki> || {{Roman|4999}}
|-
|5000 || <nowiki>{{Roman|5000}}</nowiki> || {{Roman|5000}}
|-
|5001 || <nowiki>{{Roman|5001}}</nowiki> || {{Roman|5001}}
|-
|1048576 || <nowiki>{{Roman|1048576}}</nowiki> || {{Roman|1048576}}
|-
|7654321 || <nowiki>{{Roman|7654321}}</nowiki> || {{Roman|7654321}}
|-
|7654321 || <nowiki>{{Roman|7654321|No such Roman numerals}}</nowiki> || {{Roman|7654321|No such Roman numerals}}
|}
For example, <nowiki>{{Roman|2006}}</nowiki> returns MMVI. [[User:Warofdreams|Warofdreams]] ''[[User talk:Warofdreams|talk]]'' 22:51, 28 May 2006 (UTC)
With the addition of numbers over 5000 with the macron (here done with tpl:Overline), the current version keeps the macron characters separate from the non-macron characters, and thus uses MMMM rather than M{{overline|V}} for 4000. This may be a matter of taste, or it may be something that needs fixing. [[User:Dpv|Dpv]] 13:00, 11 June 2006 (UTC)
== Font-family ==
I've added a "font" param to the template to allow the serif font to be turned off. It still defaults to "serif", but passing "inherit" will cause it to appear in the same font as the containing text. [[User talk:Mike Dillon|Mike Dillon]] 15:24, 3 December 2006 (UTC)
:I really needed this to be the default font for what I'm doing. It does look good with serif though. Is there a way to default it to whatever the default is, but give the option of serif? (The opposite of now?) [[User:JP06035|<span style="color:black;">→</span> <span style="color:#0084C9;">J</span><small><span style="color:#FCA311;">A</span><span style="color:black;">R</span><span style="color:#009E49;">E</span><span style="color:#E5053A;">D</span></small>]] <sup>[[User_talk:JP06035|<span style="color:black;">(t)</span>]]</sup>  15:38, 3 December 2006 (UTC)
::I've just reverted the removal of the font span. Please discuss changes that affect the appearance of templates in widespread use. I may ask to have this template protected because it is in every "year" article (e.g. [[2006]]). [[User talk:Mike Dillon|Mike Dillon]] 15:41, 3 December 2006 (UTC)
::I don't think changing the default of something already in use in hundreds of articles is reasonable. You can use "font=inherit" for your specific purposes. [[User talk:Mike Dillon|Mike Dillon]] 15:42, 3 December 2006 (UTC)
The funny thing is that this was just changed to serif two weeks ago (without discussion). So your suggestion to change it back and have serif an override may be a good one. [[User talk:Mike Dillon|Mike Dillon]] 16:39, 3 December 2006 (UTC)
It looks like nearly all of the uses of this template are done through {{tl|Year in other calendars}}. It seems like this template should not have a font-family or a <nowiki><span></nowiki> and should be a purely functional conversion template. The {{tl|Year in other calendars}} template is the appropriate place to do font styling, it would seem. [[User talk:Mike Dillon|Mike Dillon]] 17:20, 3 December 2006 (UTC)
:I've removed the font styling from this template and moved it up to {{tl|Year in other calendars}} to keep this as a purely functional template. I'm going to contact [[User:AzaToth]] (the user who added it) to say that I've removed the font styling. [[User talk:Mike Dillon|Mike Dillon]] 17:27, 3 December 2006 (UTC)
::So I was right all along... haha. [[User:JP06035|<span style="color:black;">→</span> <span style="color:#0084C9;">J</span><small><span style="color:#FCA311;">A</span><span style="color:black;">R</span><span style="color:#009E49;">E</span><span style="color:#E5053A;">D</span></small>]] <sup>[[User_talk:JP06035|<span style="color:black;">(t)</span>]]</sup>  17:32, 3 December 2006 (UTC)
:::It would seem so. Let's hope everyone else agrees ;) [[User talk:Mike Dillon|Mike Dillon]] 17:38, 3 December 2006 (UTC)
== Protection ==
I've requested that this page be fully protected because it is esoteric and in widespread use. See [[Wikipedia:Requests for page protection]]. [[User talk:Mike Dillon|Mike Dillon]] 15:47, 3 December 2006 (UTC)
:I appologize if I've brought on this request. I didn't realize how widespread it was. [[User:JP06035|<span style="color:black;">→</span> <span style="color:#0084C9;">J</span><small><span style="color:#FCA311;">A</span><span style="color:black;">R</span><span style="color:#009E49;">E</span><span style="color:#E5053A;">D</span></small>]] <sup>[[User_talk:JP06035|<span style="color:black;">(t)</span>]]</sup>  16:24, 3 December 2006 (UTC)
::No need to apologize. Protection of widespread templates is not a bad thing. It just means we have to discuss changes before making them. [[User talk:Mike Dillon|Mike Dillon]] 16:31, 3 December 2006 (UTC)
The request was not accepted. The template is only used in about 2,000-2,500 articles at the moment, so there isn't much need anyways. [[User talk:Mike Dillon|Mike Dillon]] 23:40, 3 December 2006 (UTC)
== Edit request ==
{{tl|editprotected}} Please update <nowiki>{{/doc}}</nowiki> with <nowiki>{{documentation}}</nowiki>. Per [[Wikipedia:Template documentation/List]] Thankyou. -- [[user:Matthewedwards|<small style="background:#fff;border:#8b0000 1px solid;color:#000;padding:0px 3px 1px 4px;white-space:nowrap">'''ṃ<big style="color:#090">•</big>α<big style="color:#090">•</big>Ł<big style="color:#090">•</big>ṭ<big style="color:#090">•</big>ʰ<big style="color:#090">•</big>Ə<big style="color:#090">•</big>Щ<big style="color:#090">•</big>'''</small> ]] ''<small>@</small>'' 05:57, 28 April 2008 (UTC)
:Done. – <span style="font-family: Garamond">[[User:Luna Santin|<span style="color:#1E90FF;">'''Luna Santin'''</span>]] ([[User talk:Luna Santin|talk]])</span> 08:34, 28 April 2008 (UTC)
== Extended template ==
See [[User:Stelio/Roman]] for an extended version of this template. That alternative version has the following differences to the current version here (as at 13 March 2009):
* The alternative version includes handling for fractional values with a precision of 1/1728 (following the rules in [[Roman numerals]]).
* The alternative version avoids the use of 'div' and 'mod' in the mathematical expressions, since their algorithms currently differ from the standard algorithms (see [[Bugzilla:6068]]), and their calculation algorithm may therefore potentially be altered in the future.
* The alternative version renders 4000 as '{{Overline|IV}}' as per [[Roman numerals]], as opposed to 'MMMM' as this template currently does.
* The alternative version handles errors through more detailed messages, rather than returning 'N/A' (and the option to override the error message is still there). A negative argument is treated as an error.
* The current version produces erroneous results if the argument passed to it is a calculation. For example <NOWIKI>{{Roman:1+1}}</NOWIKI> currently returns 'MCXII' rather than 'II'. This can be fixed by wrapping all references to the argument in brackets (so using '<NOWIKI>({{{1}}})</NOWIKI>' rather than '<NOWIKI>{{{1}}}</NOWIKI>'); the alternative version includes this fix.
-[[User:Stelio|Stelio]] ([[User talk:Stelio|talk]]) 16:35, 13 March 2009 (UTC)
::{{Reply to|Stelio}} Make it official, this template deserves a jubilation.--[[User:Neurorebel|Neurorebel]] ([[User talk:Neurorebel|talk]]) 01:37, 12 June 2017 (UTC)
==Subst==
I made the template substable - but only the first tranch of numbers. Big numbers will require {{Tl|Roman/2}} sorting out. ''[[User:Rich Farmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'', <small>23:42, 18 May 2011 (UTC).</small><br />
== <nowiki>{{#time}}</nowiki> ==
According to [[mw:Help:Extension:ParserFunctions#.23time]] <nowiki>{{#time:xrY|...}}</nowiki> parser function can handle numbers between 1 and 3000. Using this might simplify the template. For example <nowiki>{{#time:xrY|2011}}</nowiki> gives {{#time:xrY|2011}} and <nowiki>{{#time:xrY|0011}}</nowiki> gives {{#time:xrY|0011}}. --[[User:Jarekt|Jarekt]] ([[User talk:Jarekt|talk]]) 16:05, 7 September 2011 (UTC)
== Edit request on 18 December 2012 ==
{{FPER|answered=yes}}
<!-- Begin request -->
please update using the current version in the sandbox. a recent change to the "mod" function in the backend software has made this template generate incorrect results. you can clearly see the problem in the [[Template:Roman/testcases|testcases]]. [[User:Frietjes|Frietjes]] ([[User talk:Frietjes|talk]]) 19:57, 18 December 2012 (UTC)
<!-- End request -->
:[[File:Yes check.svg|20px|link=|alt=]] '''Done'''<!-- Template:EP --> --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 20:14, 18 December 2012 (UTC)
== Template-protected edit request on 23 April 2016 ==
{{edit template-protected|Template:Roman|answered=y}}
<!-- Be sure to state UNAMBIGUOUSLY your suggested changes; editors who can edit the protected page need to know what to add or remove. Blank edit requests WILL be declined. -->
<!-- Begin request -->
{{replyto|Mr. Stradivarius|Stelio|Rich Farmbrough}} FYI, I am able to complete these edits myself ([[Module:Roman]] is not template-protected). But I wanted to alert template/module folks to take a look at [[Module:Roman/sandbox|the code]] and sign-off before I port it.
'''Changes needed to be made'''<br/>
#(Nothing at [[Template:Roman]])
#Copy [[Module:Roman/sandbox]] code to [[Module:Roman]].
#Update the [[Template:Roman/doc|documentation for Roman]]. Basically, add {{para|fraction|yes}} support, mention symbols listed at [[User:Stelio/Roman]].
#Update the [[Module:Roman/doc|documentation for the Lua]] if necessary to include some implementation details.
{{collapse top|Details on diffs, implementation, and validation}}
Differences between the live version and the sandbox version (observe [[Template:Roman/testcases]])
*Sandbox supports 0. Displays as 'N'.
*Live/sandbox differ on large Romans. (see 4999, 49999, etc) 69105 is <span style="text-decoration:overline;">LXIX</span>CV in the sandbox version, which mirrors Stelio's version. Live version displays <span style="text-decoration:overline;">LXV</span>MMMMCV instead.
::Different due to new tokens <span style="text-decoration:overline;">IX</span> and <span style="text-decoration:overline;">IV</span> being 9000 and 4000 respectively.
*Sandbox handles decimal, fractional, and arithmetic expressions to a precision of 1/1728 (like Stelio's version). {{green|Sandbox uses <code>#expr:</code> at [[Module:Roman/sandbox]] line 118.}}
*Stelio's version seems incorrect on 0.3333, 0.00347222, 0.9999, 0.41666, 9999/1000, 4999999+1727/1728, etc. In all of these cases, sandbox is either closer to the value, or a simple error/failure to numeralize by Stelio's version. 0.9999 should output like the sandbox does. I don't know why Stelio's version leaves out the little 1/1728 ticks.
How sandbox ensures correct fractional output on tricky cases (0.00001 and 99.99999)
#Find the Roman numerals for the integer part of the number.
#If the number is not an integer:
#* Add half of the smallest unit (1/1728) to simulate rounding instead of truncation.
#* Ensure this new result is between 1/1728 and 1727/1728. (actually 1.1/1728 and 1727.1/1728 due to floating point rounding issues)
#Hence, 0.00001 is guaranteed to have at least the smallest unit symbol (instead of being blank or 0), and 99.99999 does not display as 100 or 99 and 2 halves.
Validation
*[[Template:Roman/testcases]] ([[Special:Permalink/716697260|permalink]]). Updated with decimal/fraction/arithmetic cases
*[[Module:Roman/testcases]] - can't figure out fractional/decimal tests
*[[Module talk:Roman/testcases]] - all passing
*Non-numerical input to Roman/sandbox leaves blank (like the live version)
*The sandbox template supports subst: and safesubst:.
{{collapse bottom}}
Please let me know if you have any questions. Thanks.
<!-- End request -->
— '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 19:51, 23 April 2016 (UTC)
:"The negative number -3299 cannot be converted to Roman numerals" - might it be clearer to say "Negative numbers (such as -3299) cannot be converted to Roman numerals". I.E. make it clear that the negative numbers are out, not just this one or some of them.
:All the best: ''[[User:Rich Farmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'',<small> 20:07, 23 April 2016 (UTC).</small><br />
::{{replyto|Rich Farmbrough}} Were you referring to Stelio's template (which I'm not editing) or the changes I made? Currently, the sandbox version I refer to has no negative message. I could add it if deemed appropriate. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 20:10, 23 April 2016 (UTC)
:::Ah, I see. Well I think it appropriate... what do you think? All the best: ''[[User:Rich Farmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'',<small> 20:27, 23 April 2016 (UTC).</small><br />
::::Thanks, this would be something like "if negative then" <samp>error("cannot convert negative")</samp> or something. {{replyto|Mr. Stradivarius}} or anyone else, is an error message appropriate for how the template is currently being used? Interested in a second opinion. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 20:47, 23 April 2016 (UTC)
{{od}}
As of now, I'm feeling very confident about simply porting the changes myself, including updating documentation. I'm expecting to make the changes around the end of the month if I hear no reply. If anyone has any comments before the end of this week, let me know. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 03:18, 25 April 2016 (UTC)
:Disabled request as you are not actually requesting a change. It seems to me that you are careful and conscientious enough just to make the change and follow-up with any issues. Regards — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 08:21, 25 April 2016 (UTC)
::Thanks, it's done. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 08:45, 25 April 2016 (UTC)
:Thanks for the heads up. (Oh also: good point on the wording of the error message, Rich; I've made that change to my own version even though it won't now be used.) -[[User:Stelio|Stelio]] ([[User talk:Stelio|talk]]) 12:18, 25 April 2016 (UTC)
*I reverted {{diff|Module:Roman|prev|717026907|this edit}} by {{user|Andy M. Wang}}. It was causing a big red error message at e.g. [[2016]]: <strong class="error"><span class="scribunto-error" id="mw-scribunto-error-0">Lua error in Module:Roman at line 119: attempt to call method 'callParserFunction' (a nil value).</span></strong> Clicking that message gives a box headed "Script error" containing: <syntaxhighlight lang=text>Lua error in Module:Roman at line 119: attempt to call method 'callParserFunction' (a nil value).
Backtrace:
1. Module:Roman:119: in function "numToRoman"
2. Module:Year_in_other_calendars:373: ?
3. (tail call): ?
4. mw.lua:511: ?</syntaxhighlight> and I have no idea how to fix it. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 20:27, 25 April 2016 (UTC)
:: Addressing this issue now... Thanks for the notice... on first glance, this might have something to do with the parser function <code><nowiki>{{#time:xrY</nowiki></code>. I have no idea how to fix this myself at the moment. I've restored much of the code but commented out the line that calls the parser function. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 20:56, 25 April 2016 (UTC)
::: {{replyto|Redrose64}} Issue is fixed. [[Special:Diff/717026907/717124504]]. We're using a safer <code><nowiki>pcall</nowiki></code> (similar to the [[Special:Diff/603693243/613636272|edit request made to Module math here]]) and everything seems to be okay now. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 21:33, 25 April 2016 (UTC)
::::{{ty}} --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 22:41, 25 April 2016 (UTC)
Good work! All the best: ''[[User:Rich Farmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'',<small> 23:57, 4 May 2016 (UTC).</small><br />
==Negative Numbers==
::Handle negative with an "m" example: -1521=mMDXXI
::before the - sign existed an m was used. <!-- Template:Unsigned --><small class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Neurorebel|Neurorebel]] ([[User talk:Neurorebel#top|talk]] • [[Special:Contributions/Neurorebel|contribs]]) 01:47, 12 June 2017 (UTC)</small> <!--Autosigned by SineBot-->
'''For discussion:''' Neurorebel is suggesting that the template should be extended to allow for negative numbers. And that the way to do this is by using an "m" prefix. Some more commentary [[User talk:Stelio/Roman|here]]. -[[User:Stelio|Stelio]] ([[User talk:Stelio|talk]]) 12:30, 16 June 2017 (UTC)
:I would support this. All the best: ''[[User:RichToFarmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'',<small> 11:07, 28 July 2017 (UTC).</small><br />
:This could affect things if my [[Template talk:Roman#Template-protected edit request on 20 February 2018|edit]] is picked up—things would potentially be unclear if 'mdccc' is taken as input—would need to check case of input if all lowercase then must ignore and not take 'm' as negative sign? Trivial to work around but should likely specify behavior in [[Module:Roman/doc|doc]] –[[User:ASiplas|ASiplas]] ([[User talk:ASiplas|talk]]) 09:38, 20 February 2018 (UTC)
==Roman → Arabic==
See [[Module:ConvertNumeric]]'s '''roman_to_numeral'''
{{Collapse begin|Was Duplicate of [[Module:Convert]]—Withdrawn}}
{{edit template-protected|Module:Roman|answered=yes}}
:[[File:Pictogram voting question.svg|20px|link=|alt=]] '''Question:'''<!-- Template:ETp --> would it not be more intuitive to create a different template to do the conversion the other way round? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 20:51, 20 February 2018 (UTC).
::First intuition was {{tl|Arabic}} as template for new module but that was taken… Ideas on something just as apt? Seemed logical second choice to add to {{tl|Roman}} at that point. Would be happy to rewrite some more efficient code under a new name; main focus is driving use to help minimize transcription errors and best name is part of that whether that's '''Roman''' or not. –[[User:ASiplas|ASiplas]] ([[User talk:ASiplas|talk]]) 21:30, 20 February 2018 (UTC)
::{{re|MSGJ}} this I see is duplicate of [[Module:ConvertNumeric]] going to [[wp:Revert|Revert]] [[Module:Roman/sandbox]] and [[Module:Roman/doc]] –[[User:ASiplas|ASiplas]] ([[User talk:ASiplas|talk]]) 21:57, 20 February 2018 (UTC)
{{Collapse end}}
== Feature request: hovertext with arabic numerals ==
I think the title is pretty self-explanatory, and this could be implemented as a flag, e.g. <nowiki>{{roman|784|hover=on}}</nowiki> would display as <abbr title="784">{{roman|784}}</abbr>, which would be functionally equivalent to <nowiki><abbr title="784">{{roman|784}}</abbr></nowiki>.-<b style="background:#00ffff">''[[User:Ich|Ich]]''</b> <span style="font-size: 87%">([[User talk:Ich|talk]])</span> 07:54, 13 August 2018 (UTC)
==Edit request==
{{edit templateprotected|Module:Roman|answered=yes}}
The ƻ is wrong in the fractions, albeit for a decent reason: There's a system of reversing characters in place, but the most correct character, 𐆔 has basically no support. But we can do far, far better in a very simple way: We should replace ƻ with <s>Ƨ</s>
a.k.a. <s>Ƨ</s> by simple search-replace substitution. I'll admit, I'm not good with modern lua-y templates, so can't say where the thing is. <span style="text-shadow:grey 0.118em 0.118em 0.118em; class=texhtml">'''[[User:Adam Cuerden|Adam Cuerden]]''' <sup>([[User talk:Adam Cuerden|talk]])</sup></span> 23:23, 2 November 2018 (UTC)
:This is on line 80 of [[Module:Roman]]. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 16:00, 3 November 2018 (UTC)
*1/144 --> {{Roman|1/144|fraction=yes}} <-- updated value. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 16:05, 3 November 2018 (UTC)
*{{done}} {{ping|Adam Cuerden}} see above, should this cause any issues anyone should feel free to revert and reopen this. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 16:06, 3 November 2018 (UTC)
**Thank you! <span style="text-shadow:grey 0.118em 0.118em 0.118em; class=texhtml">'''[[User:Adam Cuerden|Adam Cuerden]]''' <sup>([[User talk:Adam Cuerden|talk]])</sup></span> 17:42, 10 November 2018 (UTC)
== Edit request ==
{{Moved from|Module talk:Roman}}
According to the article [[Roman numerals]], ancient Romans used Є· for 1/8. Can this particular numeral be added?
—Yours sincerely, [[User:Soumya-8974|Soumyabrata]] 17:55, 12 July 2019 (UTC)
o1i3jjbux1ltn8tehec417fhym4bfa6
74979
74978
2026-08-24T00:44:28Z
Robertsky
10424
1 versaun husi [[:en:Template_talk:Roman]]
74978
wikitext
text/x-wiki
==Documentation==
This template converts [[Arabic numeral]]s (that is, 1, 2, 3, etc) into [[Roman numeral]]s (I, II, III etc). It currently works for any whole number between 1 and 4999999. To use it, enter <nowiki>{{Roman|YOURNUMBER}}</nowiki>, replacing "YOURNUMBER" with a number.
{|class="wikitable" style="text-align:center"
|+ Examples of Roman numeral conversion
! Arabic Numerals !! Template Call !! Roman Numerals
|-
|1 || <nowiki>{{Roman|1}}</nowiki> || {{Roman|1}}
|-
|2 || <nowiki>{{Roman|2}}</nowiki> || {{Roman|2}}
|-
|49 || <nowiki>{{Roman|49}}</nowiki> || {{Roman|49}}
|-
|50 || <nowiki>{{Roman|50}}</nowiki> || {{Roman|50}}
|-
|51 || <nowiki>{{Roman|51}}</nowiki> || {{Roman|51}}
|-
|1024 || <nowiki>{{Roman|1024}}</nowiki> || {{Roman|1024}}
|-
|4999 || <nowiki>{{Roman|4999}}</nowiki> || {{Roman|4999}}
|-
|5000 || <nowiki>{{Roman|5000}}</nowiki> || {{Roman|5000}}
|-
|5001 || <nowiki>{{Roman|5001}}</nowiki> || {{Roman|5001}}
|-
|1048576 || <nowiki>{{Roman|1048576}}</nowiki> || {{Roman|1048576}}
|-
|7654321 || <nowiki>{{Roman|7654321}}</nowiki> || {{Roman|7654321}}
|-
|7654321 || <nowiki>{{Roman|7654321|No such Roman numerals}}</nowiki> || {{Roman|7654321|No such Roman numerals}}
|}
For example, <nowiki>{{Roman|2006}}</nowiki> returns MMVI. [[User:Warofdreams|Warofdreams]] ''[[User talk:Warofdreams|talk]]'' 22:51, 28 May 2006 (UTC)
With the addition of numbers over 5000 with the macron (here done with tpl:Overline), the current version keeps the macron characters separate from the non-macron characters, and thus uses MMMM rather than M{{overline|V}} for 4000. This may be a matter of taste, or it may be something that needs fixing. [[User:Dpv|Dpv]] 13:00, 11 June 2006 (UTC)
== Font-family ==
I've added a "font" param to the template to allow the serif font to be turned off. It still defaults to "serif", but passing "inherit" will cause it to appear in the same font as the containing text. [[User talk:Mike Dillon|Mike Dillon]] 15:24, 3 December 2006 (UTC)
:I really needed this to be the default font for what I'm doing. It does look good with serif though. Is there a way to default it to whatever the default is, but give the option of serif? (The opposite of now?) [[User:JP06035|<span style="color:black;">→</span> <span style="color:#0084C9;">J</span><small><span style="color:#FCA311;">A</span><span style="color:black;">R</span><span style="color:#009E49;">E</span><span style="color:#E5053A;">D</span></small>]] <sup>[[User_talk:JP06035|<span style="color:black;">(t)</span>]]</sup>  15:38, 3 December 2006 (UTC)
::I've just reverted the removal of the font span. Please discuss changes that affect the appearance of templates in widespread use. I may ask to have this template protected because it is in every "year" article (e.g. [[2006]]). [[User talk:Mike Dillon|Mike Dillon]] 15:41, 3 December 2006 (UTC)
::I don't think changing the default of something already in use in hundreds of articles is reasonable. You can use "font=inherit" for your specific purposes. [[User talk:Mike Dillon|Mike Dillon]] 15:42, 3 December 2006 (UTC)
The funny thing is that this was just changed to serif two weeks ago (without discussion). So your suggestion to change it back and have serif an override may be a good one. [[User talk:Mike Dillon|Mike Dillon]] 16:39, 3 December 2006 (UTC)
It looks like nearly all of the uses of this template are done through {{tl|Year in other calendars}}. It seems like this template should not have a font-family or a <nowiki><span></nowiki> and should be a purely functional conversion template. The {{tl|Year in other calendars}} template is the appropriate place to do font styling, it would seem. [[User talk:Mike Dillon|Mike Dillon]] 17:20, 3 December 2006 (UTC)
:I've removed the font styling from this template and moved it up to {{tl|Year in other calendars}} to keep this as a purely functional template. I'm going to contact [[User:AzaToth]] (the user who added it) to say that I've removed the font styling. [[User talk:Mike Dillon|Mike Dillon]] 17:27, 3 December 2006 (UTC)
::So I was right all along... haha. [[User:JP06035|<span style="color:black;">→</span> <span style="color:#0084C9;">J</span><small><span style="color:#FCA311;">A</span><span style="color:black;">R</span><span style="color:#009E49;">E</span><span style="color:#E5053A;">D</span></small>]] <sup>[[User_talk:JP06035|<span style="color:black;">(t)</span>]]</sup>  17:32, 3 December 2006 (UTC)
:::It would seem so. Let's hope everyone else agrees ;) [[User talk:Mike Dillon|Mike Dillon]] 17:38, 3 December 2006 (UTC)
== Protection ==
I've requested that this page be fully protected because it is esoteric and in widespread use. See [[Wikipedia:Requests for page protection]]. [[User talk:Mike Dillon|Mike Dillon]] 15:47, 3 December 2006 (UTC)
:I appologize if I've brought on this request. I didn't realize how widespread it was. [[User:JP06035|<span style="color:black;">→</span> <span style="color:#0084C9;">J</span><small><span style="color:#FCA311;">A</span><span style="color:black;">R</span><span style="color:#009E49;">E</span><span style="color:#E5053A;">D</span></small>]] <sup>[[User_talk:JP06035|<span style="color:black;">(t)</span>]]</sup>  16:24, 3 December 2006 (UTC)
::No need to apologize. Protection of widespread templates is not a bad thing. It just means we have to discuss changes before making them. [[User talk:Mike Dillon|Mike Dillon]] 16:31, 3 December 2006 (UTC)
The request was not accepted. The template is only used in about 2,000-2,500 articles at the moment, so there isn't much need anyways. [[User talk:Mike Dillon|Mike Dillon]] 23:40, 3 December 2006 (UTC)
== Edit request ==
{{tl|editprotected}} Please update <nowiki>{{/doc}}</nowiki> with <nowiki>{{documentation}}</nowiki>. Per [[Wikipedia:Template documentation/List]] Thankyou. -- [[user:Matthewedwards|<small style="background:#fff;border:#8b0000 1px solid;color:#000;padding:0px 3px 1px 4px;white-space:nowrap">'''ṃ<big style="color:#090">•</big>α<big style="color:#090">•</big>Ł<big style="color:#090">•</big>ṭ<big style="color:#090">•</big>ʰ<big style="color:#090">•</big>Ə<big style="color:#090">•</big>Щ<big style="color:#090">•</big>'''</small> ]] ''<small>@</small>'' 05:57, 28 April 2008 (UTC)
:Done. – <span style="font-family: Garamond">[[User:Luna Santin|<span style="color:#1E90FF;">'''Luna Santin'''</span>]] ([[User talk:Luna Santin|talk]])</span> 08:34, 28 April 2008 (UTC)
== Extended template ==
See [[User:Stelio/Roman]] for an extended version of this template. That alternative version has the following differences to the current version here (as at 13 March 2009):
* The alternative version includes handling for fractional values with a precision of 1/1728 (following the rules in [[Roman numerals]]).
* The alternative version avoids the use of 'div' and 'mod' in the mathematical expressions, since their algorithms currently differ from the standard algorithms (see [[Bugzilla:6068]]), and their calculation algorithm may therefore potentially be altered in the future.
* The alternative version renders 4000 as '{{Overline|IV}}' as per [[Roman numerals]], as opposed to 'MMMM' as this template currently does.
* The alternative version handles errors through more detailed messages, rather than returning 'N/A' (and the option to override the error message is still there). A negative argument is treated as an error.
* The current version produces erroneous results if the argument passed to it is a calculation. For example <NOWIKI>{{Roman:1+1}}</NOWIKI> currently returns 'MCXII' rather than 'II'. This can be fixed by wrapping all references to the argument in brackets (so using '<NOWIKI>({{{1}}})</NOWIKI>' rather than '<NOWIKI>{{{1}}}</NOWIKI>'); the alternative version includes this fix.
-[[User:Stelio|Stelio]] ([[User talk:Stelio|talk]]) 16:35, 13 March 2009 (UTC)
::{{Reply to|Stelio}} Make it official, this template deserves a jubilation.--[[User:Neurorebel|Neurorebel]] ([[User talk:Neurorebel|talk]]) 01:37, 12 June 2017 (UTC)
==Subst==
I made the template substable - but only the first tranch of numbers. Big numbers will require {{Tl|Roman/2}} sorting out. ''[[User:Rich Farmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'', <small>23:42, 18 May 2011 (UTC).</small><br />
== <nowiki>{{#time}}</nowiki> ==
According to [[mw:Help:Extension:ParserFunctions#.23time]] <nowiki>{{#time:xrY|...}}</nowiki> parser function can handle numbers between 1 and 3000. Using this might simplify the template. For example <nowiki>{{#time:xrY|2011}}</nowiki> gives {{#time:xrY|2011}} and <nowiki>{{#time:xrY|0011}}</nowiki> gives {{#time:xrY|0011}}. --[[User:Jarekt|Jarekt]] ([[User talk:Jarekt|talk]]) 16:05, 7 September 2011 (UTC)
== Edit request on 18 December 2012 ==
{{FPER|answered=yes}}
<!-- Begin request -->
please update using the current version in the sandbox. a recent change to the "mod" function in the backend software has made this template generate incorrect results. you can clearly see the problem in the [[Template:Roman/testcases|testcases]]. [[User:Frietjes|Frietjes]] ([[User talk:Frietjes|talk]]) 19:57, 18 December 2012 (UTC)
<!-- End request -->
:[[File:Yes check.svg|20px|link=|alt=]] '''Done'''<!-- Template:EP --> --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 20:14, 18 December 2012 (UTC)
== Template-protected edit request on 23 April 2016 ==
{{edit template-protected|Template:Roman|answered=y}}
<!-- Be sure to state UNAMBIGUOUSLY your suggested changes; editors who can edit the protected page need to know what to add or remove. Blank edit requests WILL be declined. -->
<!-- Begin request -->
{{replyto|Mr. Stradivarius|Stelio|Rich Farmbrough}} FYI, I am able to complete these edits myself ([[Module:Roman]] is not template-protected). But I wanted to alert template/module folks to take a look at [[Module:Roman/sandbox|the code]] and sign-off before I port it.
'''Changes needed to be made'''<br/>
#(Nothing at [[Template:Roman]])
#Copy [[Module:Roman/sandbox]] code to [[Module:Roman]].
#Update the [[Template:Roman/doc|documentation for Roman]]. Basically, add {{para|fraction|yes}} support, mention symbols listed at [[User:Stelio/Roman]].
#Update the [[Module:Roman/doc|documentation for the Lua]] if necessary to include some implementation details.
{{collapse top|Details on diffs, implementation, and validation}}
Differences between the live version and the sandbox version (observe [[Template:Roman/testcases]])
*Sandbox supports 0. Displays as 'N'.
*Live/sandbox differ on large Romans. (see 4999, 49999, etc) 69105 is <span style="text-decoration:overline;">LXIX</span>CV in the sandbox version, which mirrors Stelio's version. Live version displays <span style="text-decoration:overline;">LXV</span>MMMMCV instead.
::Different due to new tokens <span style="text-decoration:overline;">IX</span> and <span style="text-decoration:overline;">IV</span> being 9000 and 4000 respectively.
*Sandbox handles decimal, fractional, and arithmetic expressions to a precision of 1/1728 (like Stelio's version). {{green|Sandbox uses <code>#expr:</code> at [[Module:Roman/sandbox]] line 118.}}
*Stelio's version seems incorrect on 0.3333, 0.00347222, 0.9999, 0.41666, 9999/1000, 4999999+1727/1728, etc. In all of these cases, sandbox is either closer to the value, or a simple error/failure to numeralize by Stelio's version. 0.9999 should output like the sandbox does. I don't know why Stelio's version leaves out the little 1/1728 ticks.
How sandbox ensures correct fractional output on tricky cases (0.00001 and 99.99999)
#Find the Roman numerals for the integer part of the number.
#If the number is not an integer:
#* Add half of the smallest unit (1/1728) to simulate rounding instead of truncation.
#* Ensure this new result is between 1/1728 and 1727/1728. (actually 1.1/1728 and 1727.1/1728 due to floating point rounding issues)
#Hence, 0.00001 is guaranteed to have at least the smallest unit symbol (instead of being blank or 0), and 99.99999 does not display as 100 or 99 and 2 halves.
Validation
*[[Template:Roman/testcases]] ([[Special:Permalink/716697260|permalink]]). Updated with decimal/fraction/arithmetic cases
*[[Module:Roman/testcases]] - can't figure out fractional/decimal tests
*[[Module talk:Roman/testcases]] - all passing
*Non-numerical input to Roman/sandbox leaves blank (like the live version)
*The sandbox template supports subst: and safesubst:.
{{collapse bottom}}
Please let me know if you have any questions. Thanks.
<!-- End request -->
— '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 19:51, 23 April 2016 (UTC)
:"The negative number -3299 cannot be converted to Roman numerals" - might it be clearer to say "Negative numbers (such as -3299) cannot be converted to Roman numerals". I.E. make it clear that the negative numbers are out, not just this one or some of them.
:All the best: ''[[User:Rich Farmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'',<small> 20:07, 23 April 2016 (UTC).</small><br />
::{{replyto|Rich Farmbrough}} Were you referring to Stelio's template (which I'm not editing) or the changes I made? Currently, the sandbox version I refer to has no negative message. I could add it if deemed appropriate. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 20:10, 23 April 2016 (UTC)
:::Ah, I see. Well I think it appropriate... what do you think? All the best: ''[[User:Rich Farmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'',<small> 20:27, 23 April 2016 (UTC).</small><br />
::::Thanks, this would be something like "if negative then" <samp>error("cannot convert negative")</samp> or something. {{replyto|Mr. Stradivarius}} or anyone else, is an error message appropriate for how the template is currently being used? Interested in a second opinion. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 20:47, 23 April 2016 (UTC)
{{od}}
As of now, I'm feeling very confident about simply porting the changes myself, including updating documentation. I'm expecting to make the changes around the end of the month if I hear no reply. If anyone has any comments before the end of this week, let me know. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 03:18, 25 April 2016 (UTC)
:Disabled request as you are not actually requesting a change. It seems to me that you are careful and conscientious enough just to make the change and follow-up with any issues. Regards — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 08:21, 25 April 2016 (UTC)
::Thanks, it's done. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 08:45, 25 April 2016 (UTC)
:Thanks for the heads up. (Oh also: good point on the wording of the error message, Rich; I've made that change to my own version even though it won't now be used.) -[[User:Stelio|Stelio]] ([[User talk:Stelio|talk]]) 12:18, 25 April 2016 (UTC)
*I reverted {{diff|Module:Roman|prev|717026907|this edit}} by {{user|Andy M. Wang}}. It was causing a big red error message at e.g. [[2016]]: <strong class="error"><span class="scribunto-error" id="mw-scribunto-error-0">Lua error in Module:Roman at line 119: attempt to call method 'callParserFunction' (a nil value).</span></strong> Clicking that message gives a box headed "Script error" containing: <syntaxhighlight lang=text>Lua error in Module:Roman at line 119: attempt to call method 'callParserFunction' (a nil value).
Backtrace:
1. Module:Roman:119: in function "numToRoman"
2. Module:Year_in_other_calendars:373: ?
3. (tail call): ?
4. mw.lua:511: ?</syntaxhighlight> and I have no idea how to fix it. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 20:27, 25 April 2016 (UTC)
:: Addressing this issue now... Thanks for the notice... on first glance, this might have something to do with the parser function <code><nowiki>{{#time:xrY</nowiki></code>. I have no idea how to fix this myself at the moment. I've restored much of the code but commented out the line that calls the parser function. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 20:56, 25 April 2016 (UTC)
::: {{replyto|Redrose64}} Issue is fixed. [[Special:Diff/717026907/717124504]]. We're using a safer <code><nowiki>pcall</nowiki></code> (similar to the [[Special:Diff/603693243/613636272|edit request made to Module math here]]) and everything seems to be okay now. — '''''[[User:Andy M. Wang|Andy W.]]'' <small>([[User talk:Andy M. Wang|talk]] · [[Special:Contributions/Andy M. Wang|contrib]])</small>''' 21:33, 25 April 2016 (UTC)
::::{{ty}} --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] ([[User talk:Redrose64|talk]]) 22:41, 25 April 2016 (UTC)
Good work! All the best: ''[[User:Rich Farmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'',<small> 23:57, 4 May 2016 (UTC).</small><br />
==Negative Numbers==
::Handle negative with an "m" example: -1521=mMDXXI
::before the - sign existed an m was used. <!-- Template:Unsigned --><small class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Neurorebel|Neurorebel]] ([[User talk:Neurorebel#top|talk]] • [[Special:Contributions/Neurorebel|contribs]]) 01:47, 12 June 2017 (UTC)</small> <!--Autosigned by SineBot-->
'''For discussion:''' Neurorebel is suggesting that the template should be extended to allow for negative numbers. And that the way to do this is by using an "m" prefix. Some more commentary [[User talk:Stelio/Roman|here]]. -[[User:Stelio|Stelio]] ([[User talk:Stelio|talk]]) 12:30, 16 June 2017 (UTC)
:I would support this. All the best: ''[[User:RichToFarmbrough|Rich]] [[User talk:Rich Farmbrough|Farmbrough]]'',<small> 11:07, 28 July 2017 (UTC).</small><br />
:This could affect things if my [[Template talk:Roman#Template-protected edit request on 20 February 2018|edit]] is picked up—things would potentially be unclear if 'mdccc' is taken as input—would need to check case of input if all lowercase then must ignore and not take 'm' as negative sign? Trivial to work around but should likely specify behavior in [[Module:Roman/doc|doc]] –[[User:ASiplas|ASiplas]] ([[User talk:ASiplas|talk]]) 09:38, 20 February 2018 (UTC)
==Roman → Arabic==
See [[Module:ConvertNumeric]]'s '''roman_to_numeral'''
{{Collapse begin|Was Duplicate of [[Module:Convert]]—Withdrawn}}
{{edit template-protected|Module:Roman|answered=yes}}
:[[File:Pictogram voting question.svg|20px|link=|alt=]] '''Question:'''<!-- Template:ETp --> would it not be more intuitive to create a different template to do the conversion the other way round? — Martin <small>([[User:MSGJ|MSGJ]] · [[User talk:MSGJ|talk]])</small> 20:51, 20 February 2018 (UTC).
::First intuition was {{tl|Arabic}} as template for new module but that was taken… Ideas on something just as apt? Seemed logical second choice to add to {{tl|Roman}} at that point. Would be happy to rewrite some more efficient code under a new name; main focus is driving use to help minimize transcription errors and best name is part of that whether that's '''Roman''' or not. –[[User:ASiplas|ASiplas]] ([[User talk:ASiplas|talk]]) 21:30, 20 February 2018 (UTC)
::{{re|MSGJ}} this I see is duplicate of [[Module:ConvertNumeric]] going to [[wp:Revert|Revert]] [[Module:Roman/sandbox]] and [[Module:Roman/doc]] –[[User:ASiplas|ASiplas]] ([[User talk:ASiplas|talk]]) 21:57, 20 February 2018 (UTC)
{{Collapse end}}
== Feature request: hovertext with arabic numerals ==
I think the title is pretty self-explanatory, and this could be implemented as a flag, e.g. <nowiki>{{roman|784|hover=on}}</nowiki> would display as <abbr title="784">{{roman|784}}</abbr>, which would be functionally equivalent to <nowiki><abbr title="784">{{roman|784}}</abbr></nowiki>.-<b style="background:#00ffff">''[[User:Ich|Ich]]''</b> <span style="font-size: 87%">([[User talk:Ich|talk]])</span> 07:54, 13 August 2018 (UTC)
==Edit request==
{{edit templateprotected|Module:Roman|answered=yes}}
The ƻ is wrong in the fractions, albeit for a decent reason: There's a system of reversing characters in place, but the most correct character, 𐆔 has basically no support. But we can do far, far better in a very simple way: We should replace ƻ with <s>Ƨ</s>
a.k.a. <s>Ƨ</s> by simple search-replace substitution. I'll admit, I'm not good with modern lua-y templates, so can't say where the thing is. <span style="text-shadow:grey 0.118em 0.118em 0.118em; class=texhtml">'''[[User:Adam Cuerden|Adam Cuerden]]''' <sup>([[User talk:Adam Cuerden|talk]])</sup></span> 23:23, 2 November 2018 (UTC)
:This is on line 80 of [[Module:Roman]]. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 16:00, 3 November 2018 (UTC)
*1/144 --> {{Roman|1/144|fraction=yes}} <-- updated value. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 16:05, 3 November 2018 (UTC)
*{{done}} {{ping|Adam Cuerden}} see above, should this cause any issues anyone should feel free to revert and reopen this. — [[User:Xaosflux|<span style="color:#FF9933; font-weight:bold; font-family:monotype;">xaosflux</span>]] <sup>[[User talk:Xaosflux|<span style="color:#009933;">Talk</span>]]</sup> 16:06, 3 November 2018 (UTC)
**Thank you! <span style="text-shadow:grey 0.118em 0.118em 0.118em; class=texhtml">'''[[User:Adam Cuerden|Adam Cuerden]]''' <sup>([[User talk:Adam Cuerden|talk]])</sup></span> 17:42, 10 November 2018 (UTC)
== Edit request ==
{{Moved from|Module talk:Roman}}
According to the article [[Roman numerals]], ancient Romans used Є· for 1/8. Can this particular numeral be added?
—Yours sincerely, [[User:Soumya-8974|Soumyabrata]] 17:55, 12 July 2019 (UTC)
o1i3jjbux1ltn8tehec417fhym4bfa6
Módulo Discussão:Roman
829
9021
74980
2019-07-12T19:03:41Z
en>Tom.Reding
0
Undid revision 905967486 by [[Special:Contributions/Soumya-8974|Soumya-8974]] ([[User talk:Soumya-8974|talk]]) Edit request moved to [[Template talk:Roman]]
74980
wikitext
text/x-wiki
#REDIRECT [[Template talk:Roman]]
0kz8de2ja39i6e2hrzy4x7px9d7fit3
74981
74980
2026-08-24T00:44:29Z
Robertsky
10424
1 versaun husi [[:en:Module_talk:Roman]]
74980
wikitext
text/x-wiki
#REDIRECT [[Template talk:Roman]]
0kz8de2ja39i6e2hrzy4x7px9d7fit3
Template:WikidataOI
10
9022
74984
2018-03-05T12:34:35Z
en>Primefac
0
Changed protection level for "[[Template:WikidataOI]]": to match module ([Edit=Require extended confirmed access] (indefinite) [Move=Require extended confirmed access] (indefinite))
74984
wikitext
text/x-wiki
<includeonly>{{safesubst:#if:{{{ifeq|}}}|{{safesubst:#ifeq:{{{fetch|}}}|{{{ifeq}}}|{{safesubst:#invoke:Wd|main}}}}|{{safesubst:#if:{{{fetch|}}}|{{safesubst:#invoke:Wd|main}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
gsa8ls1ose31mmuesud6h881anp0lum
74985
74984
2026-08-24T00:44:38Z
Robertsky
10424
1 versaun husi [[:en:Template:WikidataOI]]
74984
wikitext
text/x-wiki
<includeonly>{{safesubst:#if:{{{ifeq|}}}|{{safesubst:#ifeq:{{{fetch|}}}|{{{ifeq}}}|{{safesubst:#invoke:Wd|main}}}}|{{safesubst:#if:{{{fetch|}}}|{{safesubst:#invoke:Wd|main}}}}}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
gsa8ls1ose31mmuesud6h881anp0lum
Template:0
10
9023
75000
2024-12-25T18:28:38Z
en>Pppery
0
Per request on talk
75000
wikitext
text/x-wiki
<includeonly><span aria-hidden="true" style="visibility:hidden;color:transparent;">{{{1|0}}}</span></includeonly><noinclude>
{{documentation}}
</noinclude>
i4mo3weu20rgaw3qv8dfcm9ljmjmicn
75001
75000
2026-08-24T00:44:40Z
Robertsky
10424
1 versaun husi [[:en:Template:0]]
75000
wikitext
text/x-wiki
<includeonly><span aria-hidden="true" style="visibility:hidden;color:transparent;">{{{1|0}}}</span></includeonly><noinclude>
{{documentation}}
</noinclude>
i4mo3weu20rgaw3qv8dfcm9ljmjmicn
Template:;
10
9024
75006
2024-09-03T14:40:29Z
en>Paine Ellsworth
0
m
75006
wikitext
text/x-wiki
;<noinclude>
{{Documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES TO THE /doc SUBPAGE; INTERWIKIS GO TO WIKIDATA, THANK YOU! -->
</noinclude>
56krc2nl4adk2du4isfrd7ydd55f8ht
75007
75006
2026-08-24T00:44:40Z
Robertsky
10424
1 versaun husi [[:en:Template:;]]
75006
wikitext
text/x-wiki
;<noinclude>
{{Documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES TO THE /doc SUBPAGE; INTERWIKIS GO TO WIKIDATA, THANK YOU! -->
</noinclude>
56krc2nl4adk2du4isfrd7ydd55f8ht
Template:!((
10
9025
75008
2020-11-08T16:32:29Z
en>Pppery
0
Undid revision 987674468 by [[Special:Contributions/Primefac|Primefac]] ([[User talk:Primefac|talk]]) [[Wikipedia:Village_pump_(technical)#Template:!((_broken?]]
75008
wikitext
text/x-wiki
[[<noinclude>{{documentation}}</noinclude>
kx6wfr2em4x51ldy401n0q58z3lvxb8
75009
75008
2026-08-24T00:44:41Z
Robertsky
10424
1 versaun husi [[:en:Template:!((]]
75008
wikitext
text/x-wiki
[[<noinclude>{{documentation}}</noinclude>
kx6wfr2em4x51ldy401n0q58z3lvxb8
Template:Ensure AAA contrast ratio
10
9026
75010
2015-12-14T07:41:30Z
en>The Earwig
0
moving documentation to unprotected subpage
75010
wikitext
text/x-wiki
<includeonly>{{#if:{{{base|}}}|{{#ifexpr:{{#invoke:Color contrast|ratio|{{{base}}}|{{{other|}}}|error=21}} < 7 OR {{#invoke:Color contrast|ratio|{{{base}}}|black|error=0}} < 7 AND {{#invoke:Color contrast|ratio|{{{base}}}|white|error=0}} < 7|{{{category|}}}}}}}</includeonly><noinclude>
{{Documentation}}</noinclude>
thvg1zc4vzn6yvyb0zfry8s1v9a3kbj
75011
75010
2026-08-24T00:44:41Z
Robertsky
10424
1 versaun husi [[:en:Template:Ensure_AAA_contrast_ratio]]
75010
wikitext
text/x-wiki
<includeonly>{{#if:{{{base|}}}|{{#ifexpr:{{#invoke:Color contrast|ratio|{{{base}}}|{{{other|}}}|error=21}} < 7 OR {{#invoke:Color contrast|ratio|{{{base}}}|black|error=0}} < 7 AND {{#invoke:Color contrast|ratio|{{{base}}}|white|error=0}} < 7|{{{category|}}}}}}}</includeonly><noinclude>
{{Documentation}}</noinclude>
thvg1zc4vzn6yvyb0zfry8s1v9a3kbj
Template:Background color
10
9027
75012
2024-06-18T03:28:27Z
en>Jonesey95
0
fix text color in dark mode; color:black is assumed
75012
wikitext
text/x-wiki
<span style="background-color: {{{c|{{{1|}}}}}};color:black;">{{{t|{{{2|}}}}}}</span>{{Main other|{{Ensure AAA contrast ratio|base={{{c|{{{1|}}}}}}|other={{{t|{{{2|}}}}}}|category=[[Category:Pages using Template:Background color with invalid color combination]]}}}}{{Template other|{{Ensure AAA contrast ratio|base={{{c|{{{1|}}}}}}|other={{{t|{{{2|}}}}}}|category=[[Category:Pages using Template:Background color with invalid color combination]]}}}}<noinclude>
{{Documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES TO THE /doc SUBPAGE, THANKS -->
</noinclude>
6o18y3rxkphbai1bb0wwqd29gruxybv
75013
75012
2026-08-24T00:44:41Z
Robertsky
10424
1 versaun husi [[:en:Template:Background_color]]
75012
wikitext
text/x-wiki
<span style="background-color: {{{c|{{{1|}}}}}};color:black;">{{{t|{{{2|}}}}}}</span>{{Main other|{{Ensure AAA contrast ratio|base={{{c|{{{1|}}}}}}|other={{{t|{{{2|}}}}}}|category=[[Category:Pages using Template:Background color with invalid color combination]]}}}}{{Template other|{{Ensure AAA contrast ratio|base={{{c|{{{1|}}}}}}|other={{{t|{{{2|}}}}}}|category=[[Category:Pages using Template:Background color with invalid color combination]]}}}}<noinclude>
{{Documentation}}
<!-- PLEASE ADD THIS TEMPLATE'S CATEGORIES TO THE /doc SUBPAGE, THANKS -->
</noinclude>
6o18y3rxkphbai1bb0wwqd29gruxybv
Template:Property
10
9028
75014
2021-01-18T17:59:51Z
en>MusikBot II
0
Protected "[[Template:Property]]": [[Wikipedia:High-risk templates|High-risk template or module]] ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
75014
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata property link]]
hnd6qym6gp623hmrowx5b3lbsghmzbj
75015
75014
2026-08-24T00:44:41Z
Robertsky
10424
1 versaun husi [[:en:Template:Property]]
75014
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata property link]]
hnd6qym6gp623hmrowx5b3lbsghmzbj
Template:Wpl
10
9029
75016
2017-04-22T08:18:15Z
en>Zyxw
0
[[WP:AES|←]]Redirected page to [[Template:Wikidata property link]]
75016
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata property link]]
hnd6qym6gp623hmrowx5b3lbsghmzbj
75017
75016
2026-08-24T00:44:42Z
Robertsky
10424
1 versaun husi [[:en:Template:Wpl]]
75016
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata property link]]
hnd6qym6gp623hmrowx5b3lbsghmzbj
Template:Wikidata/doc
10
9030
75018
2026-08-03T15:43:57Z
en>Janhrach
0
/* References */ unnecessary detail
75018
wikitext
text/x-wiki
{{Hatnote|For the module that [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion|must be used]] in {{para|datax}} parameters of infobox templates instead of this {{lcfirst:{{NAMESPACE}}}}, see [[:Module:WikidataIB]].}}
{{Hatnote|For a version of this template with an opt-in toggle, see {{tl|WikidataOI}}.}}
<noinclude>{{Documentation subpage}}</noinclude>
{{#ifeq:{{ROOTPAGENAME}}|Wikidata|{{Template shortcut|wd}}
{{Lua sidebar|template={{{template|Wikidata}}}|module=Wd}}
{{#ifeq:{{NAMESPACE}}:{{ROOTPAGENAME}}|Template:Wikidata|{{Template rating|protected}}
{{High-use|risk}}}}
{{#ifeq:{{NAMESPACENUMBER}}|10|{{Lua|Module:Wd}}}}}}
<!-- Original documentation located at [[:en:Template:Wikidata/doc]]. -->
This {{lcfirst:{{NAMESPACE}}}} is intended to fetch data from '''[[w:Wikidata|Wikidata]]''' with or without a link to the connected Wikipedia article and with many other features. {{{intro|}}}
== Usage ==
Note: Do not use this template or [[Module:Wd]] in infobox templates, per [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion|the 2018 RFC]]. Instead, use [[:Module:WikidataIB]].
The general structure of a call to this {{lcfirst:{{NAMESPACE}}}} is as follows. Note that the basic structure consists of positional commands, flags and arguments, which all have a fixed position.
:{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}{{0| }}{{Background color|#cddae3|<nowiki>|command1|flag1a|flag1b|flag1c</nowiki>}}{{0| }}{{Background color|#dce5ec|<nowiki>|command2|flag2a|flag2b|flag2c</nowiki>}}{{0| }}{{Background color|#c1debf|<nowiki>|flag0a|flag0b|flag0c</nowiki>}}{{0| }}{{Background color|#ffdfc4|<nowiki>|arg1|arg2|arg3</nowiki>}}}}
Use different [[#Commands|{{Background color|#cddae3|commands}}]] to get different kinds of values from Wikidata. At least one command must be given and multiple commands can be combined into one call as shown above (in any order, more than two is also possible), but this only applies to commands from the [[#Claim class|claim class]]; calls containing a command from the [[#General class|general class]] cannot contain any other command. Each command can be followed by any number of [[#Command flags|{{Background color|#cddae3|command flags}}]], which are optional and can be used to tweak the output generated by that command.
The commands and their flags may be followed by any number of [[#Configuration flags|{{Background color|#c1debf|configuration flags}}]], which are also optional and affect the selection of data and the {{lcfirst:{{NAMESPACE}}}}'s behaviour in general. The call is closed with the [[#Positional arguments|{{Background color|#ffdfc4|positional arguments}}]], which may be required depending on the given command(s). Some [[#Named arguments|named arguments]] (i.e. name-value pairs) also exist, as well as a set of named flags for [[#Advanced usage|advanced usage]] that can be used to change the way the fetched values are merged together into the output.
This {{lcfirst:{{NAMESPACE}}}} was designed to provide the basic needs for fetching data from Wikidata, but a lot can be achieved through different combinations of calls. For convenience, such combinations could be wrapped into new templates that serve a specific need. See also the section on [[#Common use cases|common use cases]] below for some examples of useful "building blocks". Likewise, the functionality of this {{lcfirst:{{NAMESPACE}}}} can be extended by creating wrapper templates that use the [[Module:Wd#Main class|<code>main</code> command]] provided by {{module other|this module|[[Module:Wd]] which is being used by this template}} (just like {{tl|WikidataOI}} does).
=== Common use cases ===
Below follows a list of common use cases. In the future, shortcut commands may be implemented that are equivalent to these calls for convenience.
{| class="wikitable"
|-
! Call
! Use case
|-
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|label|raw|{{{extraparams|}}}}}}}
| Returns the Q-identifier of the Wikidata item connected to the current page (e.g. "Q55").
|-
| {{nowrap|<code><nowiki>{{#if:</nowiki>{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|label|raw|{{{extraparams|}}}}}<nowiki>|...}}</nowiki></code>}}
| Performs a check to determine if the current page has a Wikidata item.
Note that this statement relies on a returned value that is either empty or non-empty and that the <code>raw</code> flag is important to include. Without this flag, an existing item's regular label would be returned which could be empty, giving an undesired result. If the flag is given on the other hand, then a non-empty Q-identifier is always returned if an item exists and an empty value if an item does not exist.
|}
== Commands ==
The commands (<code>{{Background color|#cddae3|command1}}</code>, <code>{{Background color|#dce5ec|command2}}</code>, ...) determine what kind of values are returned. One call can only contain commands from a single class.
=== Claim class ===
The claim class commands can be combined, meaning that multiple commands of different types from this class can be given at one time ([[#Usage|see above for usage]]).
Combine multiple commands into one call to this {{lcfirst:{{NAMESPACE}}}}, instead of making multiple calls to this {{lcfirst:{{NAMESPACE}}}} with one command each, to be sure that all the returned pieces of information belong to each other ([[#Examples|see also the examples below]]).
{| class="wikitable"
|-
! Type
! Command
! Returns
! Basic usage
! Description
|-
| rowspan="2" style="text-align:right;" | I
! style="text-align:left;" | <code>property</code>
| {{smaller|first match{{efn|Returns only a single value instead of multiple (if multiple claims or statements match). The returned value is '''the first match found from the best-ranked''' claims.}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|property|P1|{{{extraparams|}}}}}}}
| rowspan="2" | Returns the requested property – or list of properties – from the current item-entity or from a given entity.
This command can be given only once in one call.
|-
! style="text-align:left;" | <code>properties</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|properties|P1|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| rowspan="2" style="text-align:right;" | II
! style="text-align:left;" | <code>qualifier</code>
| {{smaller|first match{{efn|Returns only a single value instead of multiple for each matching claim. To get at most one value in total in case the <code>property</code> command is not also used, additionally use the [[#Configuration flags|<code>single</code> configuration flag]].|name=fm}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|qualifier|P1|P2|{{{extraparams|}}}}}}}
| rowspan="2" | Returns the requested qualifier – or list of qualifiers – from the given property of the current item-entity or of a given entity.
Unlike the other claim class commands, this command can be given multiple times to retrieve different qualifiers in one call.
|-
! style="text-align:left;" | <code>qualifiers</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|qualifiers|P1|P2|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| rowspan="2" style="text-align:right;" | III
! style="text-align:left;" | <code>reference</code>
| {{smaller|first match{{efn|name=fm}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|reference|P1|{{{extraparams|}}}}}}}
| rowspan="2" | Returns a reference – or list of references – from the given property of the current item-entity or of a given entity.{{efn|See [[#References|the section on references]] for details.}}
Unless the <code>raw</code> flag is given, each reference is wrapped in <code><nowiki><ref></nowiki></code> tags.
This command can be given only once in one call.
|-
! style="text-align:left;" | <code>references</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|references|P1|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| colspan="5" style="text-align:left;" | {{notelist}}
|}
=== General class ===
The general class commands cannot be combined.
{| class="wikitable"
|-
! Type
! Command
! Returns
! Basic usage
! Description
|-
| style="text-align:right;" | I
! style="text-align:left;" | <code>label</code>
|
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|label|{{{extraparams|}}}}}}}
| Returns the label of the current item-entity or of a given entity if present.
|-
| colspan="5" |
|-
| style="text-align:right;" | II
! style="text-align:left;" | <code>title</code>
|
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|title|{{{extraparams|}}}}}}}
| Returns the title of the page connected to the current item-entity or to a given item-entity if such page exists.
|-
| colspan="5" |
|-
| style="text-align:right;" | III
! style="text-align:left;" | <code>description</code>
|
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|description|{{{extraparams|}}}}}}}
| Returns the description of the current item-entity or of a given entity if present.
|-
|-
| colspan="5" |
|-
| rowspan="2" style="text-align:right;" | IV
! style="text-align:left;" | <code>alias</code>
| {{smaller|first match{{efn|Returns only a single value instead of multiple (if multiple values are present).|name=fmg}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|alias|{{{extraparams|}}}}}}}
| rowspan="2" | Returns an alias – or list of aliases – of the current item-entity or of a given entity if present.
|-
! style="text-align:left;" | <code>aliases</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|aliases|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| rowspan="2" style="text-align:right;" | V
! style="text-align:left;" | <code>badge</code>
| {{smaller|first match{{efn|name=fmg}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|badge|{{{extraparams|}}}}}}}
| rowspan="2" | Returns a badge – or list of badges – for the page connected to the current item-entity or to a given item-entity if such page exists.
|-
! style="text-align:left;" | <code>badges</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|badges|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| colspan="5" style="text-align:left;" | {{notelist}}
|}
== Flags ==
The following (optional) flags are available which can be used to alter this {{lcfirst:{{NAMESPACE}}}}'s behaviour. They must be given after the (first) {{Background color|#cddae3|command}} and before the {{Background color|#ffdfc4|positional arguments}}. For convenience, empty flags (i.e. <code>||</code>) are allowed and will simply be ignored.
=== Command flags ===
These flags (<code>{{Background color|#cddae3|flag1*}}</code>, <code>{{Background color|#dce5ec|flag2*}}</code>, ...) apply to the command that precedes them directly.
{| class="wikitable"
|-
! Flag
! Description
|-
! style="text-align:left;" | <code>raw</code>
| Returns the raw value if applicable.
If this flag is used with item or property datatypes, then this will return the Q-identifier or P-identifier instead of the regular label.
For quantity datatypes, this flag will strip off any units of measurement, unless the <code>unit</code> flag is also given in which case the raw unit of measurement (its Q-identifier) will be returned.
If this flag is used with time datatypes, then the returned date will be in the format of <code>yyyy-mm-dd</code> (e.g. <code>1731-02-11</code>), or <code>yyyy-mm</code>, or <code>yyyy</code> depending on the date's precision. Dates in the Julian calendar stored with a precision of days through millenniums will have <code>/Julian</code> attached to the output (e.g. <code>1731-02-11/Julian</code>, which may be split off using the [[mw:Help:Extension:ParserFunctions#.23titleparts|<nowiki>{{#titleparts}}</nowiki> parser function]]).
If it is used with globe coordinate datatypes, then it replaces the various symbols with forward slashes in the returned value (e.g. <code>52/5/3/N/4/19/3/E</code>, which may be split into parts using the [[mw:Help:Extension:ParserFunctions#.23titleparts|<nowiki>{{#titleparts}}</nowiki> parser function]]).
|-
! style="text-align:left;" | <code>linked</code>
| Creates a link to the Wikipedia article that is connected to the property or qualifier if it exists. Also links units of measurement that may be appended to values.
If this parameter is omitted, then the plain property or qualifier value will be returned.
|-
! style="text-align:left;" | <code>short</code>
| '''<code>{{color|red|[EXPENSIVE]}}</code>''' Returns the {{wpl|P1813}} of any entity returned if they have one attached. If that is not the case, then the default behaviour of returning the entity's label will occur.
|-
! style="text-align:left;" | <code>multilanguage</code>
| Returns monolingual text values in any available language, not just the current wiki's language.
|-
! style="text-align:left;" | <code>unit</code>
| Returns only the unit of measurement for quantity datatypes.
|}
=== Configuration flags ===
These flags (<code>{{Background color|#c1debf|flag0*}}</code>) are general configuration flags and can be given anywhere after the first {{Background color|#cddae3|command}} (but before the {{Background color|#ffdfc4|positional arguments}}).
{| class="wikitable"
|-
!
! Flag
! Description
! Command class
|-
| rowspan="4" style="text-align:right;" | {{nowrap|Combination of:}}
! style="text-align:left;" | <code>preferred</code>
| rowspan="4" | Sets a rank constraint for the selected claim(s).
The first three set the ranks for which claim(s) will be selected. They can optionally be followed by a <code>+</code> or a <code>-</code>, e.g. <code>normal+</code> or <code>preferred-</code>, where the first selects claims with a 'normal' rank ''or higher'' and the second selects claims with a 'preferred' rank ''or lower''. To get claims of all ranks, use <code>preferred-</code> or <code>deprecated+</code>.
If the <code>best</code> flag is given additionally, then only the claims that have the highest rank amongst the selected claims will be returned.
The default is <code>normal+|best</code> (so by default claims with a 'deprecated' rank are never returned).
Output is always sorted from highest rank to lowest (regardless of any of these flags being set).
| rowspan="4" | [[#Claim class|claim]]
|-
! style="text-align:left;" | <code>normal</code>
|-
! style="text-align:left;" | <code>deprecated</code>
|-
! style="text-align:left;" | <code>best</code>
|-
| rowspan="3" style="text-align:right;" | {{nowrap|Combination of:}}
! style="text-align:left;" | <code>future</code>
| rowspan="3" | Sets a time constraint for the selected claim(s). Uses the claims' qualifiers of {{wpl|P580}} and {{wpl|P582}} to determine if the claim is valid for the selected time period(s).
The default is <code>future|current|former</code> (so by default claims that are valid for any time period are returned), except when <code>date=</code> is given ([[#Named arguments|see below]]) in which case the default is <code>current</code>.
| rowspan="3" | claim
|-
! style="text-align:left;" | <code>current</code>
|-
! style="text-align:left;" | <code>former</code>
|-
|
! style="text-align:left;" | <code>mdy</code>
| Returns date values in month-day-year order instead of day-month-year order.
| claim
|-
|
! style="text-align:left;" | <code>single</code>
| Returns only a single claim instead of multiple (if multiple claims match). Has no effect if the <code>property</code>/<code>properties</code> command is given, in which case this flag would be redundant.
| claim
|-
|
! style="text-align:left;" | <code>sourced</code>
| Only returns claims that have at least one non-empty reference. (References having only [[#Ignored parameters|ignored parameters]] are considered empty.)
| claim
|-
| rowspan="2" style="text-align:right;" | {{nowrap|One of:}}
! style="text-align:left;" | <code>edit</code>
| rowspan="2" | Adds a clickable icon after the output that may be used by readers to edit the returned claim on Wikidata.
If <code>edit@end</code> is used, then the icon will be placed at the end of the line for neat alignment.
| rowspan="2" | claim, [[#General class|general]]
|-
! style="text-align:left;" | <code>edit@end</code>
|- style="display:none;"
| colspan="4" | <!-- non-displayed row to avoid breaking table with sticky headers gadget -->
|}
== Arguments ==
The arguments determine the sources from which all the returned values are fetched.
=== Positional arguments ===
The following table shows the available positional arguments (<code>{{Background color|#ffdfc4|arg*}}</code>) in their fixed order. For each command, the applicable set of arguments is marked. If multiple commands are given, then the applicable set is the union of the individual sets. For instance, if the commands <code>properties</code> and <code>qualifiers</code> have been given, then at least both the arguments <code>property_id</code> and <code>qualifier_id</code> should be given as well.
More than one <code>qualifier</code>/<code>qualifiers</code> command can be given. The order in which these commands with their flags are given matches the order in which the respective <code>qualifier_id</code> arguments are given.
{| class="wikitable" style="background:none;border:none;"
|- style="text-align:center;"
| rowspan="2" style="background:none;border:none;" |
| colspan="2" | {{smaller|''(required)''}}
| {{smaller|{{color|#777|''(optional)''}}}}
| {{smaller|{{color|#777|(optional)}}}}
| {{smaller|(required)}}
| {{smaller|{{color|#777|(optional)}}}}
| {{smaller|(required)}}
| {{smaller|(required)}}
| rowspan="2" style="background:none;border:none;" |
|-
| colspan="2" |
|
|
|
|
|
|
|-
| style="border-right:2px solid #000;" | ''<code><nowiki>{{</nowiki>{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}</code>''
| colspan="2" style="border-right:2px solid #000;" | ''<code>commands</code>''
| style="border-right:2px solid #000;" | ''<code style="color:#777;">flags</code>''
! style="border-right:2px solid #000;background-color:#ffdfc4;" | <code style="color:#777;">entity_id</code>
! style="border-right:2px solid #000;background-color:#ffdfc4;" | <code>property_id</code>
! style="border-right:2px solid #000;background-color:#ffdfc4;" | <code style="color:#777;">raw_value</code>
! style="border-right:2px solid #000;background-color:#ffdfc4;" | <code>qualifier_id</code>
! style="background-color:#ffdfc4;" | <code>qualifier_id</code>
| ''<code><nowiki>}}</nowiki></code>''
|-
| rowspan="12" colspan="2" style="background:none;border:none;" |
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|
|
|
|
|
| rowspan="12" style="background:none;border:none;" |
|- style="text-align:center;"
| rowspan="2" | <code>label</code>, <code>title</code>,<br /><code>description</code>,<br /><code>alias</code>/<code>aliases</code>,<br /><code>badge</code>/<code>badges</code>
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
|-
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|- style="text-align:center;"
| rowspan="2" colspan="2" style="border-top:none;" | <code>property</code>/<code>properties</code>
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
|-
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|- style="text-align:center;"
| rowspan="2" colspan="3" style="border-top:none;" | <code>reference</code>/<code>references</code>
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
|-
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|- style="text-align:center;"
| rowspan="2" colspan="4" style="border-top:none;" | <code>qualifier</code>/<code>qualifiers</code>
| rowspan="2" style="border-top:none;border-bottom:none;" |
|-
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|- style="text-align:center;"
| rowspan="2" colspan="5" style="border-top:none;" | <code>qualifier</code>/<code>qualifiers</code> ''(optional 2<sup>nd</sup>, 3<sup>rd</sup>, etc.)''
|-
| rowspan="2" colspan="2" style="border:none;" |
|-
| colspan="5" style="border:none;" |
|}
Below follows a description of all positional arguments.
{| class="wikitable"
|-
! Argument
! Description
|-
! style="text-align:left;" | <code style="color:#777;">entity_id</code>
{{smaller|{{nobold|(optional)}}}}
| '''<code>{{color|red|[EXPENSIVE]}}</code>''' '''Q-identifier''' of the item-entity to be accessed (e.g. <code>Q55</code>), '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') of the property-entity to be accessed preceded by the <code>Property:</code> prefix (e.g. <code>Property:P38</code>), or '''page title''' of the Wikipedia article whose connected item-entity is to be accessed preceded by <code>:</code>, a prefixed colon (e.g. <code>:Netherlands</code>).
In case of the [[#General class|general class commands]], the <code>Property:</code> prefix may be omitted for P-identifiers (e.g. <code>P38</code>).
If this parameter is omitted, then the item-entity connected to the current page will be used (except when <code>eid=</code> or <code>page=</code> is given, [[#Named arguments|see below]]). If this parameter is given, but empty (i.e. <code>||</code>), then due to its position it will be interpreted as an [[#Flags|empty flag]] and thus be ignored, giving the same result as if it were omitted. See also the [[#Named arguments|named arguments <code>eid=</code> and <code>page=</code>]] below that can be used to give an entity-ID or page title too, but without the item-entity connected to the current page being used as a default.
|-
! style="text-align:left;" | <code>property_id</code>
| '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') of the property within the entity to be accessed, without the <code>Property:</code> prefix (e.g. <code>P35</code>).
|-
! style="text-align:left;" | <code style="color:#777;">raw_value</code>
{{smaller|{{nobold|(optional)}}}}
| Either the '''Q-identifier''' equal to the property value (e.g. <code>Q29574</code>) or a '''literal value''' (i.e. string or quantity etc., ''no entity label'') equal to the raw property value of the particular claim to be accessed.
Dates as literal values must be formatted <code>yyyy-mm-dd</code> (e.g. <code>1731-02-11</code>) for dates with a precision of days, <code>yyyy-mm</code> (e.g. <code>1731-02</code>) for dates with a precision of months, and <code>yyyy</code> (e.g. <code>1731</code>) for dates of lesser precision. Dates BCE require a minus sign in front of the year (e.g. <code>-2950-01-31</code>). Dates stored in the Julian calendar must have <code>/Julian</code> attached to the end (e.g. <code>1731-02-11/Julian</code>). Decades like the 2010s must be given as <code>2010</code> (but the 2010s BCE as <code>-2019</code>), centuries like the 20th century as <code>1901</code> (but the 20th century BCE as <code>-2000</code>), and millenniums like the 3rd millennium as <code>2001</code> (but the 3rd millennium BCE as <code>-3000</code>).
Globe coordinates as literal values must be formatted with forward slashes (i.e. <code>/</code>) between the parts and no symbols (e.g. <code>52/5/3/N/4/19/3/E</code>) ''without any spaces or leading zeros''.
The special type ''''no value'''' can be given by entering the empty string (i.e. <code>||</code>) and the special type ''''unknown value'''' can be given by entering a single underscore (i.e. <code>|_|</code>). To get a literal underscore, escape it by placing a backslash <code>\</code> directly in front of it (i.e. <code>\_</code>); the same holds for a literal backslash (i.e. <code>\\</code>).
To get a literal vertical bar <code>|</code>, use <code>{{tl|!}}</code> or <code>&#124;</code>.
If this parameter is omitted, then all claims (matching any other constraints) within the property will be accessed.
|-
! style="text-align:left;" | <code>qualifier_id</code>
| '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') of the qualifier within the entity to be accessed, without the <code>Property:</code> prefix (e.g. <code>P580</code>).
|}
=== Named arguments ===
Below follows a description of all named arguments, which are name-value pairs (i.e. <code>|name=value</code>). These are all optional and can be given anywhere {{module other|after the first command|inside the call}}.
{| class="wikitable"
|-
! Argument
! Description
! Command class
|-
! style="text-align:right;" | <code>eid=</code>
| '''<code>{{color|red|[EXPENSIVE]}}</code>''' This argument can be used to give the '''Q-identifier''' (e.g. <code>|eid=Q55</code>) or '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') of the entity to be accessed. It offers the same functionality as the [[#Positional arguments|positional argument <code>entity_id</code>]], with one difference: if the argument is given but its value is left empty (i.e. <code>|eid=</code>), then no entity is accessed at all instead of the item-entity connected to the current page. This is useful in some cases where a variable entity-ID is expected, but where the item-entity connected to the current page should not be accessed as the default.
Also, the <code>Property:</code> prefix may be omitted for P-identifiers (e.g. <code>|eid=P38</code>) for all commands.
This argument only has effect if the positional argument <code>entity_id</code> is omitted.
| [[#Claim class|claim]], [[#General class|general]]
|-
! style="text-align:right;" | <code>page=</code>
| '''<code>{{color|red|[EXPENSIVE]}}</code>''' This argument can be used to give the '''page title''' (e.g. <code>|page=Netherlands</code>) of the Wikipedia article whose connected item-entity is to be accessed. It behaves similar to the named argument <code>eid=</code> and can be used instead of the [[#Positional arguments|positional argument <code>entity_id</code>]] (note that no prefixed colon, <code>:</code>, is required). If the argument is given but its value is left empty (i.e. <code>|page=</code>), then no entity is accessed at all instead of the item-entity connected to the current page.
This argument only has effect if the positional argument <code>entity_id</code> and the named argument <code>eid=</code> are omitted.
| claim, general
|-
! style="text-align:right;" | <code>date=</code>
| This argument can be used to set a particular date (e.g. <code>|date=1731-02-11</code>) relative to which claim matching using the [[#Configuration flags|<code>future</code>, <code>current</code> and <code>former</code> flags]] is done, instead of relative to today. It overrides the default of these flags to <code>current</code> so that by default only claims that were valid at the given date are returned (based on the claims' qualifiers of {{wpl|P580}} and {{wpl|P582}}).
The date value must be formatted <code>yyyy-mm-dd</code> (e.g. <code>1731-02-11</code>), <code>yyyy-mm</code> (e.g. <code>1731-02</code>) or <code>yyyy</code> (e.g. <code>1731</code>).
| claim
|-
! style="text-align:right;" | <code>''<qualifier>''=</code>
| The <code>''<qualifier>''</code> is a placeholder for a set of arguments that determine which claims should be accessed based on qualifier value, analogous to the pair of [[#Positional arguments|positional arguments <code>property_id</code> and <code>raw_value</code>]] (that determine access based on property value).
As such, <code>''<qualifier>''</code> is any qualifier's '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') without the <code>Property:</code> prefix (e.g. <code>P518</code>). Its value is either the '''Q-identifier''' equal to one of the qualifier values (e.g. <code>Q27561</code>) or a '''literal value''' (i.e. string or quantity etc., ''no entity label'') equal to one of the raw qualifier values of the particular claim to be accessed. The value format is the same as for the positional argument <code>raw_value</code>. The special type ''''no value'''' given by the empty string also matches the total absence within the claim of the particular qualifier.
Example: <code>|P518=Q27561</code>
Multiple arguments of this type can be given to match multiple qualifier values simultaneously for each claim.
| claim
|}
=== Property aliases ===
Property aliases are other names for P-identifiers that can be used instead. The following property aliases (which are [[Case sensitivity|case-sensitive]]) are currently available:
{| class="wikitable"
|-
! Alias
! <sub>translates<br /></sub><sup>to</sup>
! P-identifier
|- <!-- property aliases purely for convenience -->
| coord ||style="text-align: center;"| → || [[d:Property:P625|P625]]
|-
!colspan="3"|
|- <!-- property aliases used by the module itself -->
| image ||style="text-align: center;"| → || [[d:Property:P18|P18]]
|-
| author ||style="text-align: center;"| → || [[d:Property:P50|P50]]
|-
| authorNameString ||style="text-align: center;"| → || [[d:Property:P2093|P2093]]
|-
| publisher ||style="text-align: center;"| → || [[d:Property:P123|P123]]
|-
| importedFrom ||style="text-align: center;"| → || [[d:Property:P143|P143]]
|-
| wikimediaImportURL ||style="text-align: center;"| → || [[d:Property:P4656|P4656]]
|-
| statedIn ||style="text-align: center;"| → || [[d:Property:P248|P248]]
|-
| pages ||style="text-align: center;"| → || [[d:Property:P304|P304]]
|-
| language ||style="text-align: center;"| → || [[d:Property:P407|P407]]
|-
| hasPart ||style="text-align: center;"| → || [[d:Property:P527|P527]]
|-
| publicationDate ||style="text-align: center;"| → || [[d:Property:P577|P577]]
|-
| startTime ||style="text-align: center;"| → || [[d:Property:P580|P580]]
|-
| endTime ||style="text-align: center;"| → || [[d:Property:P582|P582]]
|-
| chapter ||style="text-align: center;"| → || [[d:Property:P792|P792]]
|-
| retrieved ||style="text-align: center;"| → || [[d:Property:P813|P813]]
|-
| referenceURL ||style="text-align: center;"| → || [[d:Property:P854|P854]]
|-
| sectionVerseOrParagraph ||style="text-align: center;"| → || [[d:Property:P958|P958]]
|-
| archiveURL ||style="text-align: center;"| → || [[d:Property:P1065|P1065]]
|-
| title ||style="text-align: center;"| → || [[d:Property:P1476|P1476]]
|-
| formatterURL ||style="text-align: center;"| → || [[d:Property:P1630|P1630]]
|-
| quote ||style="text-align: center;"| → || [[d:Property:P1683|P1683]]
|-
| shortName ||style="text-align: center;"| → || [[d:Property:P1813|P1813]]
|-
| definingFormula ||style="text-align: center;"| → || [[d:Property:P2534|P2534]]
|-
| archiveDate ||style="text-align: center;"| → || [[d:Property:P2960|P2960]]
|-
| inferredFrom ||style="text-align: center;"| → || [[d:Property:P3452|P3452]]
|-
| typeOfReference ||style="text-align: center;"| → || [[d:Property:P3865|P3865]]
|-
| column ||style="text-align: center;"| → || [[d:Property:P3903|P3903]]
|-
| subjectNamedAs ||style="text-align: center;"| → || [[d:Property:P1810|P1810]]
|-
| wikidataProperty ||style="text-align: center;"| → || [[d:Property:P1687|P1687]]
|}
== References ==
When either the <code>reference</code> or the <code>references</code> command is used and a reference is encountered (in Wikidata), the module checks if the reference contains an {{property|P143}}, {{property|P3452}} or {{property|P4656}} property. In the case one of these properties is present, the whole reference is ignored (i.e. it is treated as if it wasn't present).
Else, the module attempts to display the reference using the {{Tl|Cite web}} template. The reference has to have a {{property|P854}} property. The below table shows the mapping of Wikidata properties to parameters of Cite web.
<!-- The information in the table is from Module:wd/i18n. -->
{| class="wikitable"
|+
!Wikidata property
!Parameter of Cite web
!Notes
|-
|{{property|P2960}}
|archive-date
|
|-
|{{property|P1065}}
|archive-url
|
|-
|{{property|P50}}
| rowspan="2" |author/authorN
| rowspan="2" |N can be 1, 2, 3...
|-
|{{property|P2093}}
|-
|{{property|P407}}
|language
|Ignored when the same as the local language.
|-
|{{property|P304}}
|pages
|
|-
|{{property|P577}}
|date
|
|-
|{{property|P123}}
|publisher
|
|-
|{{property|P1683}}
|quote
|
|-
|{{property|P854}}
|url
|
|-
|{{property|P813}}
|access-date
|
|-
|{{property|P958}}
|at
|
|-
|{{property|P248}}
|website
|
|-
|{{property|P1810}}
|title
|Used only when {{property|P1476}} is not present.
|-
|{{property|P1476}}
|title
|
|}
{{Anchor|Ignored parameters}}The following properties are ignored: {{property|P18}}, {{property|P3865}}.
If there is no {{property|P854}} property present in the reference, but a property of the "External identifier" [[d:Help:Data type|data type]] is present both in the reference and in the {{property|1687}} of the item in {{property|P248}}, a URL is generated from its content and is used in the same manner as a URL given in {{property|P854}}.
If there is no {{property|P854}} property, or the reference has unknown properties, the module attempts to display it using the {{Tl|Cite Q}} template. The {{property|P248}} property is mandatory. The below table shows the mapping of properties to Cite Q parameters.
{| class="wikitable"
|+
!Wikidata property
!Parameter of Cite Q
!Notes
|-
|{{property|P248}}
|1
|Value supplied to the parameter is ''raw'', i.e. it is just the plain QID.
|-
|{{property|P792}}
|chapter
|
|-
|{{property|P3903}}
|at
|
|-
|{{property|P304}}
|pages
|
|-
|{{property|P577}}
|date
|
|-
|{{property|P813}}
|access-date
|
|-
|{{property|P958}}
|section
|
|-
|{{property|P1476}}
|title
|
|-
|any property of the "External identifier" data type
|id
|The label ("name") of the property is prepended before its content.
|}
The properties listed ''under'' the first table (in this section) are also ignored when using Cite Q.
A reference could be displayed using Cite Q only if the reference has a {{property|P248}} property and has only properties listed in the table above. If neither Cite web nor Cite Q could be used to display a reference, an error message with an explanation is returned.
To fix this error, check if the reference has the required properties and doesn't have any unknown properties, as described above. The [[d:Help:Sources|Wikidata help page on references]] can also be helpful when sourcing statements.
== Advanced usage ==
The layout of the output from (a combination of) commands that have both a singular and a plural form (e.g. <code>property</code>/<code>properties</code>) can be customized by using a number of named flags, which are name-value pairs (i.e. <code>|flag=value</code>), that can be given anywhere {{module other|after the first command|inside the call}}. The table below shows the available named flags.
To insert a space at the beginning or end of a <code>value</code>, use an underscore <code>_</code>. To get a literal underscore, escape it by placing a backslash <code>\</code> directly in front of it (i.e. <code>\_</code>); the same holds for a literal backslash (i.e. <code>\\</code>). To get a literal vertical bar <code>|</code>, use <code>{{tl|!}}</code> or <code>&#124;</code>.
{| class="wikitable"
|-
! Named flag
! Default value
! Default condition
! Description
|-
! rowspan="6" style="text-align:right;" | <code>format=</code>
| <code>%p[%s][%r]</code>
| if the <code>property</code>/<code>properties</code> command '''was''' given and the <code>qualifier</code>/<code>qualifiers</code> command '''was not''' given
| rowspan="6" | The format of a single claim. The available parameters are as follows.
{| class="wikitable"
|-
! Parameter
! Description
|-
| <code>%p</code>
| The claim's property value applied by the <code>property</code>/<code>properties</code> command.
|-
| <code>%q1</code>, <code>%q2</code>, <code>%q3</code>, ...
| The claim's qualifier value or list of qualifier values applied by the corresponding <code>qualifier</code>/<code>qualifiers</code> command.
|-
| <code>%q</code>
| The collection of the qualifier values applied by each <code>qualifier</code>/<code>qualifiers</code> command (i.e. <code>%q1</code> + <code>%q2</code> + <code>%q3</code> + ...). If only one <code>qualifier</code>/<code>qualifiers</code> command was given, then this parameter is equivalent to <code>%q1</code>.
|-
| <code>%r</code>
| The claim's reference value or list of reference values applied by the <code>reference</code>/<code>references</code> command.
|-
| <code>%a</code>
| The entity's alias applied by the <code>alias</code>/<code>aliases</code> command.
|-
| <code>%b</code>
| The entity's page badge applied by the <code>badge</code>/<code>badges</code> command.
|-
| <code>%s</code>
| The movable separator placeholder. This is a special parameter that is not applied by a command, but instead is filled automatically between each pair of claims, aliases or badges (if a list of claims, aliases or badges is returned). This is particularly handy in case a claim's reference is returned as well, since it allows the reference to be placed after the punctuation mark as prescribed by [[Wikipedia:Manual of Style#Punctuation and footnotes|Wikipedia's manual of style]]. The default value is a comma (<code>,</code>) and can be overridden with the <code>sep%s</code> flag (see below).
|}
Optional parameters can be given by encapsulating them between square brackets: <code>[...]</code>. All content between the square brackets is only displayed if a value for each optional parameter that has been defined between the same brackets has been found. Optional content can also be nested.
To use two opening square brackets that directly follow each other (i.e. <code>{{!((}}</code>), use <code>{{tl|!((}}</code>.
At least one parameter must be given that is not optional, while the <code>%s</code> parameter must always be defined as optional.
To get a literal <code>[</code>, <code>]</code>, <code>%</code> or <code>\</code>, escape the character by placing a backslash <code>\</code> directly in front of it (e.g. <code>\%</code>). See also the description directly above this table for more.
|-
| <code>%q[%s][%r]</code>
| if the <code>property</code>/<code>properties</code> command '''was not''' given and the <code>qualifier</code>/<code>qualifiers</code> command '''was''' given
|-
| <code>%r</code>
| if '''only''' the <code>reference</code>/<code>references</code> command was given
|-
| <syntaxhighlight lang="wikitext">%p[ <span style="font-size:85\%">(%q)</span>][%s][%r]</syntaxhighlight>
| if the <code>property</code>/<code>properties</code> command '''was''' given and the <code>qualifier</code>/<code>qualifiers</code> command '''was''' given
|-
| <code>%a[%s]</code>
| if the <code>alias</code>/<code>aliases</code> command was given
|-
| <code>%b[%s]</code>
| if the <code>badge</code>/<code>badges</code> command was given
|-
| colspan="4" |
|-
! rowspan="2" style="text-align:right;" | <code>sep=</code>
| <code>{{dfn|_|title=space}}</code>
| <span style="color:#777;">''default''</span>
| rowspan="2" | The fixed separator between each pair of claims, aliases or badges.
|-
| {{dfn|<code>{{0| }}</code>|title=empty}}
| if '''only''' the <code>reference</code>/<code>references</code> command was given '''without''' the <code>raw</code> flag
|-
| colspan="4" |
|-
! rowspan="2" style="text-align:right;" | <code>sep%s=</code>
| <code>,</code>
| <span style="color:#777;">''default''</span>
| rowspan="2" | The movable separator between each pair of claims, aliases or badges. This will be the value of the <code>%s</code> parameter applied to all claims, aliases or badges, except for the last in the list (which can be set with the <code>punc</code> flag).
|-
| <code>;</code>
| if the <code>property</code>/<code>properties</code> command '''was not''' given and the <code>qualifier</code>/<code>qualifiers</code> command '''was''' given
|-
| colspan="4" |
|-
! style="text-align:right;" | <code>sep%q1=</code>, <code>sep%q2=</code>, <code>sep%q3=</code>, ...
| <code>{{dfn|,_|title=comma space}}</code>
| <span style="color:#777;">''default''</span>
| The separator between each pair of qualifiers of a single claim. These are the value separators for the <code>%q1</code>, <code>%q2</code>, <code>%q3</code>, ... parameters.
If only one <code>qualifier</code>/<code>qualifiers</code> command was given, then the <code>sep%q1</code> flag is equivalent to <code>sep%q</code>.
|-
| colspan="4" |
|-
! rowspan="2" style="text-align:right;" | <code>sep%q=</code>
| <code>{{dfn|,_|title=comma space}}</code>
| if '''exactly one''' <code>qualifier</code>/<code>qualifiers</code> command was given
| rowspan="2" | The separator between each set of qualifiers of a single claim. This is the value separator for the <code>%q</code> parameter.
If only one <code>qualifier</code>/<code>qualifiers</code> command was given, then this flag is equivalent to <code>sep%q1</code>.
|-
| <code>{{dfn|{{;}}_|title=semicolon space}}</code>
| if '''more than one''' <code>qualifier</code>/<code>qualifiers</code> command was given
|-
| colspan="4" |
|-
! rowspan="2" style="text-align:right;" | <code>sep%r=</code>
| {{dfn|<code>{{0| }}</code>|title=empty}}
| <span style="color:#777;">''default''</span>
| rowspan="2" | The separator between each pair of references of a single claim. This is the value separator for the <code>%r</code> parameter.
|-
| <code>{{dfn|_|title=space}}</code>
| if the <code>raw</code> flag '''was''' given for the <code>reference</code>/<code>references</code> command
|-
| colspan="4" |
|-
! style="text-align:right;" | <code>punc=</code>
| {{dfn|<code>{{0| }}</code>|title=empty}}
| <span style="color:#777;">''default''</span>
| A punctuation mark placed at the end of the output. This will be placed on the <code>%s</code> parameter applied to the last claim (or alias or badge) in the list.
This allows the last claim's references to be placed after the punctuation mark when the output is used as part of a sentence.
|}
== Examples ==
<!--
TO UPDATE EXAMPLE RESULTS at [[Template:Wikidata/doc]], replace all the contents of the 'Examples' section with: {{subst:Template:Wikidata/doc/examples}}
(This makes the example results static for performance reasons.)
Changes to examples and additions of new examples should be made at [[Template:Wikidata/doc/examples]] after which the contents of the 'Examples' section at [[Template:Wikidata/doc]] should be substituted as described above.
The examples section is a bit bloated, though... For a bit of convenience, the following table row can be used as a basic template for any new example (note the 'xxx' that need to be replaced):
|-
| style="color:#777;font-size:small;" | Pxxx = "{{{{{|safesubst:}}}#invoke:wd|label|Pxxx}}"<br />
:↓<br />
[{{smallcaps|xxx}}]
| {{tnull|{{{{{|safesubst:}}}(((}}prename|{{{{{|safesubst:}}})))}}{{lcfirst:{{BASEPAGENAME}}}}|property|Pxxx|{{{{{|safesubst:}}}(((}}extraparams|{{{{{|safesubst:}}})))}}}}<br />
:↓<br />
:{{{{{|safesubst:}}}#invoke:wd|property|Pxxx}}
| Description...
-->
{| class="wikitable"
|-
! Parameters and output types
! Example
! style="width:20%"|Description
|-
| style="color:#777;font-size:small;" | [[d:Q55|Q55]] = "Netherlands", [[d:Property:P395|P395]] = "licence plate code"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL
| Gets a literal string value.
|-
| style="color:#777;font-size:small;" | P395 = "licence plate code"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Netherlands]] page (which is linked to Q55), then the <code>Q55</code> can be omitted.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P395 = "NL"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''eid{{=}}Q55'''|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL
| An entity-ID can also be given using the <code>eid=</code> argument.
|-
| style="color:#777;font-size:small;" | P395 = "NL"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''page{{=}}Netherlands'''|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL
| A page title can be given instead of an entity-ID using the <code>page=</code> argument.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P395 = "licence plate code"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''edit'''|Q55|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL [[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/Q55?uselang=en#P395|Edit this on Wikidata]]
| Adds a clickable icon that may be used to edit the returned value on Wikidata.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P395 = "licence plate code"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''edit@end'''|Q55|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL<span style="float:right">[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/Q55?uselang=en#P395|Edit this on Wikidata]]</span>
| Places the edit icon at the end of the line.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P1082|P1082]] = "population"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''property'''|'''normal+'''|Q55|P1082|{{{extraparams|}}}}}<br />
:↓<br />
:17,590,672
| Gets a single property value from claims with a 'normal' rank or higher.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''properties'''|normal+|Q55|P1082|{{{extraparams|}}}}}<br />
:↓<br />
:17,590,672, 10,026,773, 16,779,575, 16,829,289, 17,000,000, 17,081,507, 17,181,084, 17,282,163, 17,407,585
| Gets multiple property values from claims with a 'normal' rank or higher.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", [[d:Property:P585|P585]] = "point in time"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''qualifier'''|normal+|Q55|P1082|'''P585'''|{{{extraparams|}}}}}<br />
:↓<br />
:17,590,672 <span style="font-size:85%">(1 January 2022)</span>, 10,026,773 <span style="font-size:85%">(1950)</span>, 16,779,575 <span style="font-size:85%">(2013)</span>, 16,829,289 <span style="font-size:85%">(26 August 2014)</span>, 17,000,000 <span style="font-size:85%">(21 March 2016)</span>, 17,081,507 <span style="font-size:85%">(1 January 2017)</span>, 17,181,084 <span style="font-size:85%">(1 January 2018)</span>, 17,282,163 <span style="font-size:85%">(1 January 2019)</span>, 17,407,585 <span style="font-size:85%">(1 January 2020)</span>
| Gets a single qualifier value for each claim, additional to the property value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|time}}], [{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|'''references'''|normal+|Q55|P1082|P585|{{{extraparams|}}}}}<br />
:↓<br />
:17,590,672 <span style="font-size:85%">(1 January 2022)</span>,<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5">{{Cite web|title=Bevolking; kerncijfers, 1950-2022|url=https://opendata.cbs.nl/statline/#/CBS/nl/dataset/37296ned/table?ts=1560596956049}}</ref> 10,026,773 <span style="font-size:85%">(1950)</span>,<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5">{{Cite web|publisher=Statistics Netherlands|title=CBS StatLine - Bevolking; kerncijfers|access-date=22 August 2015|url=http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&D1=a&D2=0,10,20,30,40,50,60,(l-1),l&HD=130605-0924&HDR=G1&STB=T|archive-date=27 August 2015|archive-url=https://web.archive.org/web/20150827042738/http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&D1=a&D2=0,10,20,30,40,50,60,(l-1),l&HD=130605-0924&HDR=G1&STB=T}}</ref> 16,779,575 <span style="font-size:85%">(2013)</span>,<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5"/> 16,829,289 <span style="font-size:85%">(26 August 2014)</span>,<ref name="wikidata-475c2999c451e2e418b275ef9b087583a2db7228-v5">{{Cite web|title=CBS StatLine - Bevolking; kerncijfers|access-date=26 August 2014|url=http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&LA=NL|archive-url=https://web.archive.org/web/20140903082344/http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&LA=NL|archive-date=3 September 2014}}</ref> 17,000,000 <span style="font-size:85%">(21 March 2016)</span>,<ref name="wikidata-08fbc9797078849d8dc7b4754ad2109020d16f96-v5">{{Cite web|date=21 March 2016|url=http://www.cbs.nl/nl-NL/menu/themas/bevolking/publicaties/artikelen/archief/2016/nederland-telt-17-miljoen-inwoners.htm|title=Nederland telt 17 miljoen inwoners}}</ref> 17,081,507 <span style="font-size:85%">(1 January 2017)</span>,<ref name="wikidata-4f58fc69480f96aaec74e771792854a11428895e-v5">{{Cite web|url=https://opendata.cbs.nl/statline/#/CBS/nl/dataset/37296ned/table?ts=1560596956049|title=Bevolking; kerncijfers, 1950-2022|access-date=18 March 2023}}</ref> 17,181,084 <span style="font-size:85%">(1 January 2018)</span>,<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/> 17,282,163 <span style="font-size:85%">(1 January 2019)</span>,<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/> 17,407,585 <span style="font-size:85%">(1 January 2020)</span><ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/>
| Gets references for each claim.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|reference}}]
| <code>A total of {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|references|Q55|P1082|{{{extraparams|}}}}} people live in the Netherlands.</code><br />
:↓<br />
:A total of 17,590,672<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/> people live in the Netherlands.
| Gets a property with its references.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|reference}}]
| <code>The Netherlands has a population of {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|references|Q55|P1082|'''punc{{=}}.'''|{{{extraparams|}}}}}</code>
:↓<br />
:The Netherlands has a population of 17,590,672.<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/>
| Adds a punctuation mark at the end of the output, in front of the references.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|time}}], [{{smallcaps|reference}}]
| <code>'''<nowiki><ul></nowiki>'''{{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|references|normal+|Q55|P1082|P585|'''<nowiki>format=<li>%p[%r][<ul><li>%q</li></ul>]</li></nowiki>'''|{{{extraparams|}}}}}'''<nowiki></ul></nowiki>'''</code><br />
:↓<br />
<ul><li>17,590,672<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/><ul><li>1 January 2022</li></ul></li> <li>10,026,773<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5"/><ul><li>1950</li></ul></li> <li>16,779,575<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5"/><ul><li>2013</li></ul></li> <li>16,829,289<ref name="wikidata-475c2999c451e2e418b275ef9b087583a2db7228-v5"/><ul><li>26 August 2014</li></ul></li> <li>17,000,000<ref name="wikidata-08fbc9797078849d8dc7b4754ad2109020d16f96-v5"/><ul><li>21 March 2016</li></ul></li> <li>17,081,507<ref name="wikidata-4f58fc69480f96aaec74e771792854a11428895e-v5"/><ul><li>1 January 2017</li></ul></li> <li>17,181,084<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/><ul><li>1 January 2018</li></ul></li> <li>17,282,163<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/><ul><li>1 January 2019</li></ul></li> <li>17,407,585<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/><ul><li>1 January 2020</li></ul></li></ul>
| Returns the output in a custom format.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''qualifier'''|normal+|Q55|P1082|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1 January 2022; 1950; 2013; 26 August 2014; 21 March 2016; 1 January 2017; 1 January 2018; 1 January 2019; 1 January 2020
| Gets a single qualifier per claim, by default for multiple matching claims.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifier|normal+|'''single'''|Q55|P1082|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1 January 2022
| To get a single qualifier for only a single claim, give the <code>single</code> flag too so that only a single claim will be accessed.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifier|Q55|P1082|'''10026773'''|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1950
| Gets a qualifier from claims for which the (raw) property value matches a given literal value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifier|'''mdy'''|Q55|P1082|10026773|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1950
| Gets dates in month-day-year order.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifier|'''raw'''|Q55|P1082|10026773|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1950
| Gets a raw date value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''references'''|Q55|P1082|'''10026773'''|{{{extraparams|}}}}}<br />
:↓<br />
:<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5"/>
| Gets the references from a particular claim.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''references'''|'''raw'''|Q55|P1082|'''10026773'''|{{{extraparams|}}}}}<br />
:↓<br />
:{{Cite web|publisher=Statistics Netherlands|title=CBS StatLine - Bevolking; kerncijfers|access-date=22 August 2015|url=http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&D1=a&D2=0,10,20,30,40,50,60,(l-1),l&HD=130605-0924&HDR=G1&STB=T|archive-date=27 August 2015|archive-url=https://web.archive.org/web/20150827042738/http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&D1=a&D2=0,10,20,30,40,50,60,(l-1),l&HD=130605-0924&HDR=G1&STB=T}}
| Gets references from a particular claim in their raw form.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P1081|P1081]] = "Human Development Index"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''references'''|normal+|Q55|P1081|{{{extraparams|}}}}}<br />
:↓<br />
:0.931,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5">{{Cite web|title=Human Development Data (1990-2017)|website=[[Human Development Report]]|url=http://hdr.undp.org/en/data|archive-date=30 December 2018|archive-url=https://web.archive.org/web/20181230181123/http://hdr.undp.org/en/data}}</ref> 0.787, 0.799, 0.829,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5">{{Cite web|archive-url=https://web.archive.org/web/20170202193023/http://hdr.undp.org/en/countries/profiles/NLD|url=http://hdr.undp.org/en/countries/profiles/NLD|archive-date=2 February 2017|title=Netherlands}}</ref><ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.861,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.877,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.891,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.909,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.919,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.920,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.920,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.922,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.834,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.835,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.839,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.864,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.866,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.865,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.867,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.870,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.876,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.879,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.878,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.883,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.886,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.897,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.904,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.906,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.906,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.910,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.921,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.921,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.923,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.924,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.926,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.928<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/>
| Gets properties from each claim with any references they have.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1081 = "Human Development Index"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|references|normal+|'''sourced'''|Q55|P1081|{{{extraparams|}}}}}<br />
:↓<br />
:0.931,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.829,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/><ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.861,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.877,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.891,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.909,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.919,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.920,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.920,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.922,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.834,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.835,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.839,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.864,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.866,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.865,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.867,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.870,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.876,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.879,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.878,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.883,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.886,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.897,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.904,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.906,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.906,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.910,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.921,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.921,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.923,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.924,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.926,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.928<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/>
| Only gets properties from claims that have at least one reference.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P2855|P2855]] = "VAT rate", [[d:Property:P518|P518]] = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''qualifier'''|Q55|P2855|P518|{{{extraparams|}}}}}<br />
:↓<br />
:food
| Gets a single qualifier value (for each matching claim).
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2855 = "VAT rate", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''qualifiers'''|Q55|P2855|P518|{{{extraparams|}}}}}<br />
:↓<br />
:food, medication, assistive technology, magazine, book, art, antique, hairdresser, hotel, campsite, recreation, sport, water
| Gets multiple qualifier values (for each matching claim).
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2855 = "VAT rate", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''properties'''|qualifiers|Q55|P2855|P518|{{{extraparams|}}}}}<br />
:↓<br />
:21%, 6% <span style="font-size:85%">(food, medication, assistive technology, magazine, book, art, antique, hairdresser, hotel, campsite, recreation, sport, water)</span>
| Gets multiple property values along with multiple qualifier values.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2855 = "VAT rate", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifiers|Q55|P2855|P518|'''sep{{=}}_+_'''|'''sep%s{{=}}'''|'''sep%q{{=}}_/_'''|{{{extraparams|}}}}}<br />
:↓<br />
:21% + 6% <span style="font-size:85%">(food / medication / assistive technology / magazine / book / art / antique / hairdresser / hotel / campsite / recreation / sport / water)</span>
| Returns the output with custom separators.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P35|P35]] = "head of state", [[d:Property:P580|P580]] = "start time", [[d:Property:P582|P582]] = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''qualifier'''|'''qualifier'''|normal+|Q55|P35|'''P580'''|'''P582'''|{{{extraparams|}}}}}<br />
:↓<br />
:Willem-Alexander of the Netherlands <span style="font-size:85%">(30 April 2013)</span>, Beatrix of the Netherlands <span style="font-size:85%">(30 April 1980; 30 April 2013)</span>, Juliana of the Netherlands <span style="font-size:85%">(4 September 1948; 30 April 1980)</span>, Wilhelmina of the Netherlands <span style="font-size:85%">(23 November 1890; 4 September 1948)</span>, Willem III of the Netherlands <span style="font-size:85%">(17 March 1849; 23 November 1890)</span>, Willem II of the Netherlands <span style="font-size:85%">(7 October 1840; 17 March 1849)</span>, William I of the Netherlands <span style="font-size:85%">(16 March 1815; 7 October 1840)</span>
| Gets two different qualifier values for each claim.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P35 = "head of state", P580 = "start time", P582 = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|'''sep%q{{=}}_–_'''|{{{extraparams|}}}}}<br />
:↓<br />
:Willem-Alexander of the Netherlands <span style="font-size:85%">(30 April 2013)</span>, Beatrix of the Netherlands <span style="font-size:85%">(30 April 1980 – 30 April 2013)</span>, Juliana of the Netherlands <span style="font-size:85%">(4 September 1948 – 30 April 1980)</span>, Wilhelmina of the Netherlands <span style="font-size:85%">(23 November 1890 – 4 September 1948)</span>, Willem III of the Netherlands <span style="font-size:85%">(17 March 1849 – 23 November 1890)</span>, Willem II of the Netherlands <span style="font-size:85%">(7 October 1840 – 17 March 1849)</span>, William I of the Netherlands <span style="font-size:85%">(16 March 1815 – 7 October 1840)</span>
| Returns the output with a custom separator.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P35 = "head of state", P580 = "start time", P582 = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|'''<nowiki>format=%p[ <span style="font-size:85\%">(%q1[ – %q2])</span>][%s][%r]</nowiki>'''|{{{extraparams|}}}}}<br />
:↓<br />
:Willem-Alexander of the Netherlands <span style="font-size:85%">(30 April 2013)</span>, Beatrix of the Netherlands <span style="font-size:85%">(30 April 1980 – 30 April 2013)</span>, Juliana of the Netherlands <span style="font-size:85%">(4 September 1948 – 30 April 1980)</span>, Wilhelmina of the Netherlands <span style="font-size:85%">(23 November 1890 – 4 September 1948)</span>, Willem III of the Netherlands <span style="font-size:85%">(17 March 1849 – 23 November 1890)</span>, Willem II of the Netherlands <span style="font-size:85%">(7 October 1840 – 17 March 1849)</span>, William I of the Netherlands <span style="font-size:85%">(16 March 1815 – 7 October 1840)</span>
| Returns the output in a custom format instead of with a custom separator.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P35 = "head of state", P580 = "start time", P582 = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|<nowiki>format=%p[ <span style="font-size:85\%">(</nowiki>'''<nowiki>[<![]--%q2]since [%q2--[]>]</nowiki>'''<nowiki>%q1[ – %q2])</span>][%s][%r]</nowiki>|{{{extraparams|}}}}}<br />
:↓<br />
:Willem-Alexander of the Netherlands <span style="font-size:85%">(since 30 April 2013)</span>, Beatrix of the Netherlands <span style="font-size:85%">(<!--30 April 2013since 30 April 2013-->30 April 1980 – 30 April 2013)</span>, Juliana of the Netherlands <span style="font-size:85%">(<!--30 April 1980since 30 April 1980-->4 September 1948 – 30 April 1980)</span>, Wilhelmina of the Netherlands <span style="font-size:85%">(<!--4 September 1948since 4 September 1948-->23 November 1890 – 4 September 1948)</span>, Willem III of the Netherlands <span style="font-size:85%">(<!--23 November 1890since 23 November 1890-->17 March 1849 – 23 November 1890)</span>, Willem II of the Netherlands <span style="font-size:85%">(<!--17 March 1849since 17 March 1849-->7 October 1840 – 17 March 1849)</span>, William I of the Netherlands <span style="font-size:85%">(<!--7 October 1840since 7 October 1840-->16 March 1815 – 7 October 1840)</span>
| To add text only when a certain value is not present, like adding the word ''since'' if there is no end time, wrap it in between two optional blocks containing HTML comment tags and the relevant parameter (this also prevents the text from being added to the page source).
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P35 = "head of state", [[d:Q29574|Q29574]] = "Beatrix of the Netherlands", P580 = "start time", P582 = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|'''raw'''|qualifier|normal+|Q55|P35|'''Q29574'''|P580|P582|<nowiki>format=%p[ <span style="font-size:85\%">(%q1[ – %q2])</span>][%s][%r]</nowiki>|{{{extraparams|}}}}}<br />
:↓<br />
:Beatrix of the Netherlands <span style="font-size:85%">(1980-04-30 – 30 April 2013)</span>
| Gets a property with qualifiers from claims for which the property matches a given Q-identifier, with one of the qualifier values in its raw form.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P38|P38]] = "currency", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifiers|normal+|'''current'''|Q55|P38|P518|{{{extraparams|}}}}}<br />
:↓<br />
:euro <span style="font-size:85%">(European Netherlands)</span>, United States dollar <span style="font-size:85%">(Caribbean Netherlands)</span>
| Gets claims that are currently valid.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''linked'''|qualifiers|normal+|current|Q55|P38|P518|{{{extraparams|}}}}}<br />
:↓<br />
:[[Euro|euro]] <span style="font-size:85%">(European Netherlands)</span>, [[United States dollar]] <span style="font-size:85%">(Caribbean Netherlands)</span>
| Gets claims with linked property values.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifiers|'''linked'''|normal+|current|Q55|P38|P518|{{{extraparams|}}}}}<br />
:↓<br />
:euro <span style="font-size:85%">(European Netherlands)</span>, United States dollar <span style="font-size:85%">([[Caribbean Netherlands]])</span>
| Gets claims with linked qualifier values.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''linked'''|'''short'''|qualifiers|'''linked'''|normal+|current|Q55|P38|P518|{{{extraparams|}}}}}<br />
:↓<br />
:[[Euro|euro]] <span style="font-size:85%">(European Netherlands)</span>, [[United States dollar|US dollar]] <span style="font-size:85%">([[Caribbean Netherlands]])</span>
| Gets claims with linked property and qualifier values, with short property values wherever available.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", [[d:Q4917|Q4917]] = "United States dollar", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifiers|normal+|current|Q55|P38|'''Q4917'''|P518|{{{extraparams|}}}}}<br />
:↓<br />
:Caribbean Netherlands
| Gets qualifiers from claims for which the (raw) property value matches a given Q-identifier.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", P518 = "applies to part", [[d:Q27561|Q27561]] = "Caribbean Netherlands"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|normal+|current|Q55|P38|'''P518{{=}}Q27561'''|{{{extraparams|}}}}}<br />
:↓<br />
:United States dollar
| Gets properties from claims for which a (raw) qualifier value matches a given Q-identifier.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|normal+|'''former'''|Q55|P38|{{{extraparams|}}}}}<br />
:↓<br />
:Dutch guilder
| Gets claims that were valid in the past.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''raw'''|normal+|former|Q55|P38|{{{extraparams|}}}}}<br />
:↓<br />
:Q788472
| Gets raw property values.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|raw|'''linked'''|normal+|former|Q55|P38|{{{extraparams|}}}}}<br />
:↓<br />
:[[d:Special:EntityPage/Q788472|Q788472]]
| Gets raw property values that are linked to Wikidata.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P1549|P1549]] = "demonym"<br />
:↓<br />
[{{smallcaps|monolingual text}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|P1549|{{{extraparams|}}}}}<br />
:↓<br />
:Dutch
| Gets a monolingual text value in the current wiki's language.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1549 = "demonym", [[d:Property:P407|P407]] = "language of work or name", [[d:Q36846|Q36846]] = "Toki Pona"<br />
:↓<br />
[{{smallcaps|monolingual text}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''multilanguage'''|Q55|P1549|P407{{=}}Q36846|{{{extraparams|}}}}}<br />
:↓<br />
:
| Gets a monolingual text value in any available language.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P2884|P2884]] = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:230 volt
| Gets a quantity value with its associated unit of measurement.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2884 = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''linked'''|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:230 [[Volt|volt]]
| Gets a quantity value with a linked unit of measurement.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2884 = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''raw'''|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:230
| Gets a raw quantity value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2884 = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''unit'''|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:volt
| Gets only the unit of measurement.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2884 = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|unit|'''raw'''|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:Q25250
| Gets the raw unit of measurement.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P625|P625]] = "coordinate location"<br />
:↓<br />
[{{smallcaps|globe coordinate}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|P625|{{{extraparams|}}}}}<br />
:↓<br />
:52°19'N, 5°33'E
| Gets a globe coordinate value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P625 = "coordinate location"<br />
:↓<br />
[{{smallcaps|globe coordinate}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''linked'''|Q55|P625|{{{extraparams|}}}}}<br />
:↓<br />
:[https://tools.wmflabs.org/geohack/geohack.php?language=en¶ms=52_19_N_5_33_E_globe:earth 52°19'N, 5°33'E]
| Gets a linked globe coordinate value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P625 = "coordinate location"<br />
:↓<br />
[{{smallcaps|globe coordinate}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''raw'''|Q55|P625|{{{extraparams|}}}}}<br />
:↓<br />
:52/19/N/5/33/E
| Gets a raw globe coordinate value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P625 = "coordinate location"<br />
:↓<br />
[{{smallcaps|globe coordinate}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|'''coord'''|{{{extraparams|}}}}}<br />
:↓<br />
:52°19'N, 5°33'E
| A property alias can be used instead of the P-identifier.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P41|P41]] = "flag image"<br />
:↓<br />
[{{smallcaps|commons media}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''linked'''|Q55|P41|{{{extraparams|}}}}}<br />
:↓<br />
:[[c:File:Flag of the Netherlands.svg|Flag of the Netherlands.svg]]
| Gets a media file name and links to it on Commons.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P41 = "flag image"<br />
:↓<br />
[{{smallcaps|commons media}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''raw'''|Q55|P41|'''<nowiki>format=\[\[File:%p {{!}} thumb {{!}} left\]\]</nowiki>'''|{{{extraparams|}}}}}<br />
:↓<br />
:[[File:Flag of the Netherlands.svg{{!}} thumb {{!}} left]]
| A Commons media file can be included on the page as-is by omitting the <code>linked</code> and <code>raw</code> flags, but by using the <code>raw</code> flag it can be freely formatted.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P41 = "flag image"<br />
:↓<br />
[{{smallcaps|commons media}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|raw|'''date{{=}}1700-05-06'''|Q55|P41|<nowiki>format=\[\[File:%p {{!}} thumb {{!}} left\]\]</nowiki>|{{{extraparams|}}}}}<br />
:↓<br />
:[[File:Statenvlag.svg{{!}} thumb {{!}} left]]
| To get the value of a property that was valid at a given time, the <code>date=</code> argument can be used.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P41 = "flag image"<br />
:↓<br />
[{{smallcaps|commons media}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|raw|date{{=}}1700-05-06|'''former'''|Q55|P41|<nowiki>format=\[\[File:%p {{!}} thumb {{!}} left\]\]</nowiki>|{{{extraparams|}}}}}<br />
:↓<br />
:[[File:Prinsenvlag.svg{{!}} thumb {{!}} left]]
| The time constraint flags work relatively to the date value given for the <code>date=</code> argument.
|-
| style="color:#777;font-size:small;" | [[d:Q915684|Q915684]] = "Lorentz–Lorenz equation", [[d:Property:P2534|P2534]] = "defining formula"<br />
:↓<br />
[{{smallcaps|math}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q915684|P2534|{{{extraparams|}}}}}<br />
:↓<br />
:<math qid="Q915684">\frac{n^2 - 1}{n^2 + 2} = \frac{4 \pi}{3} N \alpha</math>
| Gets a mathematical expression.
|-
| style="color:#777;font-size:small;" | Q915684 = "Lorentz–Lorenz equation", [[d:Property:P7235|P7235]] = "in defining formula", [[d:Property:P9758|P9758]] = "symbol represents"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|math}}]
| <code><nowiki><ul></nowiki>{{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|linked|Q915684|P7235|P9758|<nowiki>format=<li>%q[ (%p)]</li></nowiki>|{{{extraparams|}}}}}<nowiki></ul></nowiki></code><br />
:↓<br />
:<ul><li>[[Refractive index|refractive index]] (<math>n</math>)</li> <li>[[Polarizability|polarizability]] (<math>\alpha</math>)</li> <li>[[Number density|volumetric number density]] (<math>N</math>)</li> <li>[[Pi|pi]] (<math>\pi</math>)</li></ul>
| Mathematical expressions can be combined with regular text as usual.
|-
| style="color:#777;font-size:small;" | [[d:Q6256|Q6256]] = "country", [[d:Property:P3896|P3896]] = "geoshape"<br />
:↓<br />
[{{smallcaps|geographic shape}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''linked'''|Q6256|P3896|{{{extraparams|}}}}}<br />
:↓<br />
:[[c:Data:Naturalearthdata.com/admin-0-countries-no-antarctica.map|Data:Naturalearthdata.com/admin-0-countries-no-antarctica.map]]
| Gets a geographic shape data file name and links to it on Commons.
|-
| style="color:#777;font-size:small;" | Q4917 = "United States dollar"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''label'''|Q4917|{{{extraparams|}}}}}<br />
:↓<br />
:United States dollar
| Gets an item's label.
|-
| style="color:#777;font-size:small;" | Q4917 = "United States dollar"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|'''short'''|'''linked'''|Q4917|{{{extraparams|}}}}}<br />
:↓<br />
:[[United States dollar|US dollar]]
| Gets an item's short and linked label.
|-
| style="color:#777;font-size:small;" | P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|P38|{{{extraparams|}}}}}<br />
:↓<br />
:currency
| Gets a property's label.
|-
| style="color:#777;font-size:small;" | P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|'''linked'''|P38|{{{extraparams|}}}}}<br />
:↓<br />
:[[d:Special:EntityPage/P38|currency]]
| Gets a property's label that is linked to Wikidata.
|-
| style="color:#777;font-size:small;" | [[d:Q776|Q776]] = "Utrecht"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|Q776|{{{extraparams|}}}}}<br />
:↓<br />
:Utrecht
| Gets an item's label.
|-
| style="color:#777;font-size:small;" | Q776 = "Utrecht"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|'''linked'''|Q776|{{{extraparams|}}}}}<br />
:↓<br />
:[[Utrecht (province)|Utrecht]]
| Gets an item's linked label.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|{{{extraparams|}}}}}<br />
:↓<br />
:Utrecht
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Utrecht (province)]] page (which is linked to Q776), then the <code>Q776</code> can be omitted.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|'''raw'''|{{{extraparams|}}}}}<br />
:↓<br />
:Q776
| If just the <code>label</code> command with the <code>raw</code> flag is given, then the Q-identifier of the item connected to the current page is returned.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|raw|'''linked'''|{{{extraparams|}}}}}<br />
:↓<br />
:[[d:Special:EntityPage/Q776|Q776]]
| If additionally the <code>linked</code> flag is given, then the Q-identifier of the item connected to the current page is linked to Wikidata.
|-
| style="color:#777;font-size:small;" | Q776 = "Utrecht"<br />
:↓<br />
[{{smallcaps|page title}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''title'''|Q776|{{{extraparams|}}}}}<br />
:↓<br />
:Utrecht (province)
| Gets the title of the page on the current wiki that is linked to the given item.
|-
| style="color:#777;font-size:small;" | Q776 = "Utrecht"<br />
:↓<br />
[{{smallcaps|page title}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|title|'''linked'''|Q776|{{{extraparams|}}}}}<br />
:↓<br />
:[[Utrecht (province)]]
| Gets the linked title of the page on the current wiki that is linked to the given item.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|page title}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|title|{{{extraparams|}}}}}<br />
:↓<br />
:Utrecht (province)
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Utrecht (province)]] page (which is linked to Q776), then the <code>Q776</code> can be omitted.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands"<br />
:↓<br />
[{{smallcaps|entity description}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''description'''|Q55|{{{extraparams|}}}}}<br />
:↓<br />
:country in Northwestern Europe with territories in the Caribbean
| Gets an item's description.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity description}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|description|{{{extraparams|}}}}}<br />
:↓<br />
:country in Northwestern Europe with territories in the Caribbean
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Netherlands]] page (which is linked to Q55), then the <code>Q55</code> can be omitted.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands"<br />
:↓<br />
[{{smallcaps|entity alias}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''alias'''|Q55|{{{extraparams|}}}}}<br />
:↓<br />
:Holland
| Gets one of an item's aliases.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands"<br />
:↓<br />
[{{smallcaps|entity alias}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''aliases'''|Q55|{{{extraparams|}}}}}<br />
:↓<br />
:Holland, the Netherlands, NL, NED, Nederland, nl, 🇳🇱, Netherlands (after 1945)
| Gets all of an item's aliases.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands"<br />
:↓<br />
[{{smallcaps|entity alias}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|alias|'''linked'''|Q55|{{{extraparams|}}}}}<br />
:↓<br />
:[[Netherlands|Holland]]
| Gets a linked alias from an item.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity alias}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|alias|{{{extraparams|}}}}}<br />
:↓<br />
:Holland
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Netherlands]] page (which is linked to Q55), then the <code>Q55</code> can be omitted.
|-
| style="color:#777;font-size:small;" | [[d:Q2|Q2]] = "Earth"<br />
:↓<br />
[{{smallcaps|page badge}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''badges'''|Q2|{{{extraparams|}}}}}<br />
:↓<br />
:featured article badge
| Gets the badges for the page on the current wiki that is linked to the given item.
|-
| style="color:#777;font-size:small;" | Q2 = "Earth"<br />
:↓<br />
[{{smallcaps|page badge}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|badges|'''raw'''|Q2|{{{extraparams|}}}}}<br />
:↓<br />
:Q17437796
| Gets the raw badges for the page on the current wiki that is linked to the given item.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|page badge}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|badges|{{{extraparams|}}}}}<br />
:↓<br />
:featured article badge
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Earth]] page (which is linked to Q2), then the <code>Q2</code> can be omitted.
|-
| style="color:#777;font-size:small;" | [[d:Q28865|Q28865]] = "Python", [[d:P548|P548]] = "version type", [[d:P348|P348]] = "software version identifier",<br />
:↓<br />
[{{smallcaps|version}}], [{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|reference|edit|Q28865|'''P548{{=}}Q2804309'''|P348|{{{extraparams|}}}}}<br />
:↓<br />
:3.11.3<ref name="wikidata-47b0d8952e763dae8105c1e70220fc5d387af155-v5">{{Cite web|date=5 April 2023|url=https://blog.python.org/2023/04/its-time-for-another-set-of-python.html|title=It's time for another set of Python releases! Python 3.11.3, 3.10.11 and 3.12 alpha 7 are now available.|access-date=6 April 2023}}</ref> [[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/Q28865?uselang=en#P348|Edit this on Wikidata]]
| Get [[Python (programming language)|Python]]'s latest stable release version with its references. You may want to use '''P548{{=}}Q2122918''' to get the latest preview release version.
|}
=== Example references ===
{{Reflist}}
== TemplateData ==
<templatedata>
{
"params": {},
"description": "This template fetches data from the centralized knowledge base Wikidata. To edit the data, click on \"Wikidata item\" in the left sidebar."
}
</templatedata>
== See also ==
{{module other|*{{tl|Wikidata}}, a user-friendly wrapper template for this module.
*{{tl|WikidataOI}}, a wrapper template for this module that adds an opt-in toggle.|{{{seealso|}}}
*{{tl|Sitelink}}, a template that can access other Wikipedia page titles
*[[Module:Wd]], the source module that is called by this template
*{{tl|Wdib}}, a wrapper template for the getValue call in [[Module:WikidataIB]]
*{{tl|Wikidata entity link}} or redirect {{tl|Q}}), to add a Wikidata entity link to a Wikipedia page
*{{tl|Wikidata property link}} or redirect {{tl|Property}}, to add a Wikidata property link to a Wikipedia page
*{{tl|Wikidata property}}, to add a Wikidata property {{tl|side box}} to a Wikipedia page or template documentation
*{{tl|Uses Wikidata}}, to add a Wikidata property box to the documentation of a template or module
*{{tl|Tracks Wikidata}}, to add a Wikidata property box to the documentation of a template, module, or category
*{{tl|Wikidata editnotice}}, an editnotice for articles that make extensive use of this template
}}
*{{tl|Pageid to title}}, to get a page title using its local page id, rather than Wikidata
<includeonly><!-- /doc page is transcluded on these two root pages: -->{{#switch:{{NAMESPACE}}:{{PAGENAME}}
|Module:Wd = [[Category:Wikidata modules]][[Category:Modules using data from Wikidata]]
|Template:WikidataOI |Template:Wikidata = [[Category:Wikidata templates]]
}}</includeonly>
kfcc3mosziieubqatwuz3rugcttkd5r
75019
75018
2026-08-24T00:44:42Z
Robertsky
10424
1 versaun husi [[:en:Template:Wikidata/doc]]
75018
wikitext
text/x-wiki
{{Hatnote|For the module that [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion|must be used]] in {{para|datax}} parameters of infobox templates instead of this {{lcfirst:{{NAMESPACE}}}}, see [[:Module:WikidataIB]].}}
{{Hatnote|For a version of this template with an opt-in toggle, see {{tl|WikidataOI}}.}}
<noinclude>{{Documentation subpage}}</noinclude>
{{#ifeq:{{ROOTPAGENAME}}|Wikidata|{{Template shortcut|wd}}
{{Lua sidebar|template={{{template|Wikidata}}}|module=Wd}}
{{#ifeq:{{NAMESPACE}}:{{ROOTPAGENAME}}|Template:Wikidata|{{Template rating|protected}}
{{High-use|risk}}}}
{{#ifeq:{{NAMESPACENUMBER}}|10|{{Lua|Module:Wd}}}}}}
<!-- Original documentation located at [[:en:Template:Wikidata/doc]]. -->
This {{lcfirst:{{NAMESPACE}}}} is intended to fetch data from '''[[w:Wikidata|Wikidata]]''' with or without a link to the connected Wikipedia article and with many other features. {{{intro|}}}
== Usage ==
Note: Do not use this template or [[Module:Wd]] in infobox templates, per [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion|the 2018 RFC]]. Instead, use [[:Module:WikidataIB]].
The general structure of a call to this {{lcfirst:{{NAMESPACE}}}} is as follows. Note that the basic structure consists of positional commands, flags and arguments, which all have a fixed position.
:{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}{{0| }}{{Background color|#cddae3|<nowiki>|command1|flag1a|flag1b|flag1c</nowiki>}}{{0| }}{{Background color|#dce5ec|<nowiki>|command2|flag2a|flag2b|flag2c</nowiki>}}{{0| }}{{Background color|#c1debf|<nowiki>|flag0a|flag0b|flag0c</nowiki>}}{{0| }}{{Background color|#ffdfc4|<nowiki>|arg1|arg2|arg3</nowiki>}}}}
Use different [[#Commands|{{Background color|#cddae3|commands}}]] to get different kinds of values from Wikidata. At least one command must be given and multiple commands can be combined into one call as shown above (in any order, more than two is also possible), but this only applies to commands from the [[#Claim class|claim class]]; calls containing a command from the [[#General class|general class]] cannot contain any other command. Each command can be followed by any number of [[#Command flags|{{Background color|#cddae3|command flags}}]], which are optional and can be used to tweak the output generated by that command.
The commands and their flags may be followed by any number of [[#Configuration flags|{{Background color|#c1debf|configuration flags}}]], which are also optional and affect the selection of data and the {{lcfirst:{{NAMESPACE}}}}'s behaviour in general. The call is closed with the [[#Positional arguments|{{Background color|#ffdfc4|positional arguments}}]], which may be required depending on the given command(s). Some [[#Named arguments|named arguments]] (i.e. name-value pairs) also exist, as well as a set of named flags for [[#Advanced usage|advanced usage]] that can be used to change the way the fetched values are merged together into the output.
This {{lcfirst:{{NAMESPACE}}}} was designed to provide the basic needs for fetching data from Wikidata, but a lot can be achieved through different combinations of calls. For convenience, such combinations could be wrapped into new templates that serve a specific need. See also the section on [[#Common use cases|common use cases]] below for some examples of useful "building blocks". Likewise, the functionality of this {{lcfirst:{{NAMESPACE}}}} can be extended by creating wrapper templates that use the [[Module:Wd#Main class|<code>main</code> command]] provided by {{module other|this module|[[Module:Wd]] which is being used by this template}} (just like {{tl|WikidataOI}} does).
=== Common use cases ===
Below follows a list of common use cases. In the future, shortcut commands may be implemented that are equivalent to these calls for convenience.
{| class="wikitable"
|-
! Call
! Use case
|-
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|label|raw|{{{extraparams|}}}}}}}
| Returns the Q-identifier of the Wikidata item connected to the current page (e.g. "Q55").
|-
| {{nowrap|<code><nowiki>{{#if:</nowiki>{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|label|raw|{{{extraparams|}}}}}<nowiki>|...}}</nowiki></code>}}
| Performs a check to determine if the current page has a Wikidata item.
Note that this statement relies on a returned value that is either empty or non-empty and that the <code>raw</code> flag is important to include. Without this flag, an existing item's regular label would be returned which could be empty, giving an undesired result. If the flag is given on the other hand, then a non-empty Q-identifier is always returned if an item exists and an empty value if an item does not exist.
|}
== Commands ==
The commands (<code>{{Background color|#cddae3|command1}}</code>, <code>{{Background color|#dce5ec|command2}}</code>, ...) determine what kind of values are returned. One call can only contain commands from a single class.
=== Claim class ===
The claim class commands can be combined, meaning that multiple commands of different types from this class can be given at one time ([[#Usage|see above for usage]]).
Combine multiple commands into one call to this {{lcfirst:{{NAMESPACE}}}}, instead of making multiple calls to this {{lcfirst:{{NAMESPACE}}}} with one command each, to be sure that all the returned pieces of information belong to each other ([[#Examples|see also the examples below]]).
{| class="wikitable"
|-
! Type
! Command
! Returns
! Basic usage
! Description
|-
| rowspan="2" style="text-align:right;" | I
! style="text-align:left;" | <code>property</code>
| {{smaller|first match{{efn|Returns only a single value instead of multiple (if multiple claims or statements match). The returned value is '''the first match found from the best-ranked''' claims.}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|property|P1|{{{extraparams|}}}}}}}
| rowspan="2" | Returns the requested property – or list of properties – from the current item-entity or from a given entity.
This command can be given only once in one call.
|-
! style="text-align:left;" | <code>properties</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|properties|P1|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| rowspan="2" style="text-align:right;" | II
! style="text-align:left;" | <code>qualifier</code>
| {{smaller|first match{{efn|Returns only a single value instead of multiple for each matching claim. To get at most one value in total in case the <code>property</code> command is not also used, additionally use the [[#Configuration flags|<code>single</code> configuration flag]].|name=fm}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|qualifier|P1|P2|{{{extraparams|}}}}}}}
| rowspan="2" | Returns the requested qualifier – or list of qualifiers – from the given property of the current item-entity or of a given entity.
Unlike the other claim class commands, this command can be given multiple times to retrieve different qualifiers in one call.
|-
! style="text-align:left;" | <code>qualifiers</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|qualifiers|P1|P2|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| rowspan="2" style="text-align:right;" | III
! style="text-align:left;" | <code>reference</code>
| {{smaller|first match{{efn|name=fm}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|reference|P1|{{{extraparams|}}}}}}}
| rowspan="2" | Returns a reference – or list of references – from the given property of the current item-entity or of a given entity.{{efn|See [[#References|the section on references]] for details.}}
Unless the <code>raw</code> flag is given, each reference is wrapped in <code><nowiki><ref></nowiki></code> tags.
This command can be given only once in one call.
|-
! style="text-align:left;" | <code>references</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|references|P1|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| colspan="5" style="text-align:left;" | {{notelist}}
|}
=== General class ===
The general class commands cannot be combined.
{| class="wikitable"
|-
! Type
! Command
! Returns
! Basic usage
! Description
|-
| style="text-align:right;" | I
! style="text-align:left;" | <code>label</code>
|
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|label|{{{extraparams|}}}}}}}
| Returns the label of the current item-entity or of a given entity if present.
|-
| colspan="5" |
|-
| style="text-align:right;" | II
! style="text-align:left;" | <code>title</code>
|
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|title|{{{extraparams|}}}}}}}
| Returns the title of the page connected to the current item-entity or to a given item-entity if such page exists.
|-
| colspan="5" |
|-
| style="text-align:right;" | III
! style="text-align:left;" | <code>description</code>
|
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|description|{{{extraparams|}}}}}}}
| Returns the description of the current item-entity or of a given entity if present.
|-
|-
| colspan="5" |
|-
| rowspan="2" style="text-align:right;" | IV
! style="text-align:left;" | <code>alias</code>
| {{smaller|first match{{efn|Returns only a single value instead of multiple (if multiple values are present).|name=fmg}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|alias|{{{extraparams|}}}}}}}
| rowspan="2" | Returns an alias – or list of aliases – of the current item-entity or of a given entity if present.
|-
! style="text-align:left;" | <code>aliases</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|aliases|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| rowspan="2" style="text-align:right;" | V
! style="text-align:left;" | <code>badge</code>
| {{smaller|first match{{efn|name=fmg}}}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|badge|{{{extraparams|}}}}}}}
| rowspan="2" | Returns a badge – or list of badges – for the page connected to the current item-entity or to a given item-entity if such page exists.
|-
! style="text-align:left;" | <code>badges</code>
| {{smaller|all matches}}
| {{nowrap|{{tnull|{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}|badges|{{{extraparams|}}}}}}}
|-
| colspan="5" |
|-
| colspan="5" style="text-align:left;" | {{notelist}}
|}
== Flags ==
The following (optional) flags are available which can be used to alter this {{lcfirst:{{NAMESPACE}}}}'s behaviour. They must be given after the (first) {{Background color|#cddae3|command}} and before the {{Background color|#ffdfc4|positional arguments}}. For convenience, empty flags (i.e. <code>||</code>) are allowed and will simply be ignored.
=== Command flags ===
These flags (<code>{{Background color|#cddae3|flag1*}}</code>, <code>{{Background color|#dce5ec|flag2*}}</code>, ...) apply to the command that precedes them directly.
{| class="wikitable"
|-
! Flag
! Description
|-
! style="text-align:left;" | <code>raw</code>
| Returns the raw value if applicable.
If this flag is used with item or property datatypes, then this will return the Q-identifier or P-identifier instead of the regular label.
For quantity datatypes, this flag will strip off any units of measurement, unless the <code>unit</code> flag is also given in which case the raw unit of measurement (its Q-identifier) will be returned.
If this flag is used with time datatypes, then the returned date will be in the format of <code>yyyy-mm-dd</code> (e.g. <code>1731-02-11</code>), or <code>yyyy-mm</code>, or <code>yyyy</code> depending on the date's precision. Dates in the Julian calendar stored with a precision of days through millenniums will have <code>/Julian</code> attached to the output (e.g. <code>1731-02-11/Julian</code>, which may be split off using the [[mw:Help:Extension:ParserFunctions#.23titleparts|<nowiki>{{#titleparts}}</nowiki> parser function]]).
If it is used with globe coordinate datatypes, then it replaces the various symbols with forward slashes in the returned value (e.g. <code>52/5/3/N/4/19/3/E</code>, which may be split into parts using the [[mw:Help:Extension:ParserFunctions#.23titleparts|<nowiki>{{#titleparts}}</nowiki> parser function]]).
|-
! style="text-align:left;" | <code>linked</code>
| Creates a link to the Wikipedia article that is connected to the property or qualifier if it exists. Also links units of measurement that may be appended to values.
If this parameter is omitted, then the plain property or qualifier value will be returned.
|-
! style="text-align:left;" | <code>short</code>
| '''<code>{{color|red|[EXPENSIVE]}}</code>''' Returns the {{wpl|P1813}} of any entity returned if they have one attached. If that is not the case, then the default behaviour of returning the entity's label will occur.
|-
! style="text-align:left;" | <code>multilanguage</code>
| Returns monolingual text values in any available language, not just the current wiki's language.
|-
! style="text-align:left;" | <code>unit</code>
| Returns only the unit of measurement for quantity datatypes.
|}
=== Configuration flags ===
These flags (<code>{{Background color|#c1debf|flag0*}}</code>) are general configuration flags and can be given anywhere after the first {{Background color|#cddae3|command}} (but before the {{Background color|#ffdfc4|positional arguments}}).
{| class="wikitable"
|-
!
! Flag
! Description
! Command class
|-
| rowspan="4" style="text-align:right;" | {{nowrap|Combination of:}}
! style="text-align:left;" | <code>preferred</code>
| rowspan="4" | Sets a rank constraint for the selected claim(s).
The first three set the ranks for which claim(s) will be selected. They can optionally be followed by a <code>+</code> or a <code>-</code>, e.g. <code>normal+</code> or <code>preferred-</code>, where the first selects claims with a 'normal' rank ''or higher'' and the second selects claims with a 'preferred' rank ''or lower''. To get claims of all ranks, use <code>preferred-</code> or <code>deprecated+</code>.
If the <code>best</code> flag is given additionally, then only the claims that have the highest rank amongst the selected claims will be returned.
The default is <code>normal+|best</code> (so by default claims with a 'deprecated' rank are never returned).
Output is always sorted from highest rank to lowest (regardless of any of these flags being set).
| rowspan="4" | [[#Claim class|claim]]
|-
! style="text-align:left;" | <code>normal</code>
|-
! style="text-align:left;" | <code>deprecated</code>
|-
! style="text-align:left;" | <code>best</code>
|-
| rowspan="3" style="text-align:right;" | {{nowrap|Combination of:}}
! style="text-align:left;" | <code>future</code>
| rowspan="3" | Sets a time constraint for the selected claim(s). Uses the claims' qualifiers of {{wpl|P580}} and {{wpl|P582}} to determine if the claim is valid for the selected time period(s).
The default is <code>future|current|former</code> (so by default claims that are valid for any time period are returned), except when <code>date=</code> is given ([[#Named arguments|see below]]) in which case the default is <code>current</code>.
| rowspan="3" | claim
|-
! style="text-align:left;" | <code>current</code>
|-
! style="text-align:left;" | <code>former</code>
|-
|
! style="text-align:left;" | <code>mdy</code>
| Returns date values in month-day-year order instead of day-month-year order.
| claim
|-
|
! style="text-align:left;" | <code>single</code>
| Returns only a single claim instead of multiple (if multiple claims match). Has no effect if the <code>property</code>/<code>properties</code> command is given, in which case this flag would be redundant.
| claim
|-
|
! style="text-align:left;" | <code>sourced</code>
| Only returns claims that have at least one non-empty reference. (References having only [[#Ignored parameters|ignored parameters]] are considered empty.)
| claim
|-
| rowspan="2" style="text-align:right;" | {{nowrap|One of:}}
! style="text-align:left;" | <code>edit</code>
| rowspan="2" | Adds a clickable icon after the output that may be used by readers to edit the returned claim on Wikidata.
If <code>edit@end</code> is used, then the icon will be placed at the end of the line for neat alignment.
| rowspan="2" | claim, [[#General class|general]]
|-
! style="text-align:left;" | <code>edit@end</code>
|- style="display:none;"
| colspan="4" | <!-- non-displayed row to avoid breaking table with sticky headers gadget -->
|}
== Arguments ==
The arguments determine the sources from which all the returned values are fetched.
=== Positional arguments ===
The following table shows the available positional arguments (<code>{{Background color|#ffdfc4|arg*}}</code>) in their fixed order. For each command, the applicable set of arguments is marked. If multiple commands are given, then the applicable set is the union of the individual sets. For instance, if the commands <code>properties</code> and <code>qualifiers</code> have been given, then at least both the arguments <code>property_id</code> and <code>qualifier_id</code> should be given as well.
More than one <code>qualifier</code>/<code>qualifiers</code> command can be given. The order in which these commands with their flags are given matches the order in which the respective <code>qualifier_id</code> arguments are given.
{| class="wikitable" style="background:none;border:none;"
|- style="text-align:center;"
| rowspan="2" style="background:none;border:none;" |
| colspan="2" | {{smaller|''(required)''}}
| {{smaller|{{color|#777|''(optional)''}}}}
| {{smaller|{{color|#777|(optional)}}}}
| {{smaller|(required)}}
| {{smaller|{{color|#777|(optional)}}}}
| {{smaller|(required)}}
| {{smaller|(required)}}
| rowspan="2" style="background:none;border:none;" |
|-
| colspan="2" |
|
|
|
|
|
|
|-
| style="border-right:2px solid #000;" | ''<code><nowiki>{{</nowiki>{{{prename|}}}{{lcfirst:{{ROOTPAGENAME}}}}</code>''
| colspan="2" style="border-right:2px solid #000;" | ''<code>commands</code>''
| style="border-right:2px solid #000;" | ''<code style="color:#777;">flags</code>''
! style="border-right:2px solid #000;background-color:#ffdfc4;" | <code style="color:#777;">entity_id</code>
! style="border-right:2px solid #000;background-color:#ffdfc4;" | <code>property_id</code>
! style="border-right:2px solid #000;background-color:#ffdfc4;" | <code style="color:#777;">raw_value</code>
! style="border-right:2px solid #000;background-color:#ffdfc4;" | <code>qualifier_id</code>
! style="background-color:#ffdfc4;" | <code>qualifier_id</code>
| ''<code><nowiki>}}</nowiki></code>''
|-
| rowspan="12" colspan="2" style="background:none;border:none;" |
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|
|
|
|
|
| rowspan="12" style="background:none;border:none;" |
|- style="text-align:center;"
| rowspan="2" | <code>label</code>, <code>title</code>,<br /><code>description</code>,<br /><code>alias</code>/<code>aliases</code>,<br /><code>badge</code>/<code>badges</code>
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
|-
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|- style="text-align:center;"
| rowspan="2" colspan="2" style="border-top:none;" | <code>property</code>/<code>properties</code>
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
|-
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|- style="text-align:center;"
| rowspan="2" colspan="3" style="border-top:none;" | <code>reference</code>/<code>references</code>
| rowspan="2" style="border-top:none;border-bottom:none;" |
| rowspan="2" style="border-top:none;border-bottom:none;" |
|-
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|- style="text-align:center;"
| rowspan="2" colspan="4" style="border-top:none;" | <code>qualifier</code>/<code>qualifiers</code>
| rowspan="2" style="border-top:none;border-bottom:none;" |
|-
| rowspan="2" colspan="2" style="border-style:dashed;border-left-color:blue;border-bottom-color:blue;" |
|- style="text-align:center;"
| rowspan="2" colspan="5" style="border-top:none;" | <code>qualifier</code>/<code>qualifiers</code> ''(optional 2<sup>nd</sup>, 3<sup>rd</sup>, etc.)''
|-
| rowspan="2" colspan="2" style="border:none;" |
|-
| colspan="5" style="border:none;" |
|}
Below follows a description of all positional arguments.
{| class="wikitable"
|-
! Argument
! Description
|-
! style="text-align:left;" | <code style="color:#777;">entity_id</code>
{{smaller|{{nobold|(optional)}}}}
| '''<code>{{color|red|[EXPENSIVE]}}</code>''' '''Q-identifier''' of the item-entity to be accessed (e.g. <code>Q55</code>), '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') of the property-entity to be accessed preceded by the <code>Property:</code> prefix (e.g. <code>Property:P38</code>), or '''page title''' of the Wikipedia article whose connected item-entity is to be accessed preceded by <code>:</code>, a prefixed colon (e.g. <code>:Netherlands</code>).
In case of the [[#General class|general class commands]], the <code>Property:</code> prefix may be omitted for P-identifiers (e.g. <code>P38</code>).
If this parameter is omitted, then the item-entity connected to the current page will be used (except when <code>eid=</code> or <code>page=</code> is given, [[#Named arguments|see below]]). If this parameter is given, but empty (i.e. <code>||</code>), then due to its position it will be interpreted as an [[#Flags|empty flag]] and thus be ignored, giving the same result as if it were omitted. See also the [[#Named arguments|named arguments <code>eid=</code> and <code>page=</code>]] below that can be used to give an entity-ID or page title too, but without the item-entity connected to the current page being used as a default.
|-
! style="text-align:left;" | <code>property_id</code>
| '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') of the property within the entity to be accessed, without the <code>Property:</code> prefix (e.g. <code>P35</code>).
|-
! style="text-align:left;" | <code style="color:#777;">raw_value</code>
{{smaller|{{nobold|(optional)}}}}
| Either the '''Q-identifier''' equal to the property value (e.g. <code>Q29574</code>) or a '''literal value''' (i.e. string or quantity etc., ''no entity label'') equal to the raw property value of the particular claim to be accessed.
Dates as literal values must be formatted <code>yyyy-mm-dd</code> (e.g. <code>1731-02-11</code>) for dates with a precision of days, <code>yyyy-mm</code> (e.g. <code>1731-02</code>) for dates with a precision of months, and <code>yyyy</code> (e.g. <code>1731</code>) for dates of lesser precision. Dates BCE require a minus sign in front of the year (e.g. <code>-2950-01-31</code>). Dates stored in the Julian calendar must have <code>/Julian</code> attached to the end (e.g. <code>1731-02-11/Julian</code>). Decades like the 2010s must be given as <code>2010</code> (but the 2010s BCE as <code>-2019</code>), centuries like the 20th century as <code>1901</code> (but the 20th century BCE as <code>-2000</code>), and millenniums like the 3rd millennium as <code>2001</code> (but the 3rd millennium BCE as <code>-3000</code>).
Globe coordinates as literal values must be formatted with forward slashes (i.e. <code>/</code>) between the parts and no symbols (e.g. <code>52/5/3/N/4/19/3/E</code>) ''without any spaces or leading zeros''.
The special type ''''no value'''' can be given by entering the empty string (i.e. <code>||</code>) and the special type ''''unknown value'''' can be given by entering a single underscore (i.e. <code>|_|</code>). To get a literal underscore, escape it by placing a backslash <code>\</code> directly in front of it (i.e. <code>\_</code>); the same holds for a literal backslash (i.e. <code>\\</code>).
To get a literal vertical bar <code>|</code>, use <code>{{tl|!}}</code> or <code>&#124;</code>.
If this parameter is omitted, then all claims (matching any other constraints) within the property will be accessed.
|-
! style="text-align:left;" | <code>qualifier_id</code>
| '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') of the qualifier within the entity to be accessed, without the <code>Property:</code> prefix (e.g. <code>P580</code>).
|}
=== Named arguments ===
Below follows a description of all named arguments, which are name-value pairs (i.e. <code>|name=value</code>). These are all optional and can be given anywhere {{module other|after the first command|inside the call}}.
{| class="wikitable"
|-
! Argument
! Description
! Command class
|-
! style="text-align:right;" | <code>eid=</code>
| '''<code>{{color|red|[EXPENSIVE]}}</code>''' This argument can be used to give the '''Q-identifier''' (e.g. <code>|eid=Q55</code>) or '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') of the entity to be accessed. It offers the same functionality as the [[#Positional arguments|positional argument <code>entity_id</code>]], with one difference: if the argument is given but its value is left empty (i.e. <code>|eid=</code>), then no entity is accessed at all instead of the item-entity connected to the current page. This is useful in some cases where a variable entity-ID is expected, but where the item-entity connected to the current page should not be accessed as the default.
Also, the <code>Property:</code> prefix may be omitted for P-identifiers (e.g. <code>|eid=P38</code>) for all commands.
This argument only has effect if the positional argument <code>entity_id</code> is omitted.
| [[#Claim class|claim]], [[#General class|general]]
|-
! style="text-align:right;" | <code>page=</code>
| '''<code>{{color|red|[EXPENSIVE]}}</code>''' This argument can be used to give the '''page title''' (e.g. <code>|page=Netherlands</code>) of the Wikipedia article whose connected item-entity is to be accessed. It behaves similar to the named argument <code>eid=</code> and can be used instead of the [[#Positional arguments|positional argument <code>entity_id</code>]] (note that no prefixed colon, <code>:</code>, is required). If the argument is given but its value is left empty (i.e. <code>|page=</code>), then no entity is accessed at all instead of the item-entity connected to the current page.
This argument only has effect if the positional argument <code>entity_id</code> and the named argument <code>eid=</code> are omitted.
| claim, general
|-
! style="text-align:right;" | <code>date=</code>
| This argument can be used to set a particular date (e.g. <code>|date=1731-02-11</code>) relative to which claim matching using the [[#Configuration flags|<code>future</code>, <code>current</code> and <code>former</code> flags]] is done, instead of relative to today. It overrides the default of these flags to <code>current</code> so that by default only claims that were valid at the given date are returned (based on the claims' qualifiers of {{wpl|P580}} and {{wpl|P582}}).
The date value must be formatted <code>yyyy-mm-dd</code> (e.g. <code>1731-02-11</code>), <code>yyyy-mm</code> (e.g. <code>1731-02</code>) or <code>yyyy</code> (e.g. <code>1731</code>).
| claim
|-
! style="text-align:right;" | <code>''<qualifier>''=</code>
| The <code>''<qualifier>''</code> is a placeholder for a set of arguments that determine which claims should be accessed based on qualifier value, analogous to the pair of [[#Positional arguments|positional arguments <code>property_id</code> and <code>raw_value</code>]] (that determine access based on property value).
As such, <code>''<qualifier>''</code> is any qualifier's '''P-identifier''' (or an available '''[[#Property aliases|alias]]''') without the <code>Property:</code> prefix (e.g. <code>P518</code>). Its value is either the '''Q-identifier''' equal to one of the qualifier values (e.g. <code>Q27561</code>) or a '''literal value''' (i.e. string or quantity etc., ''no entity label'') equal to one of the raw qualifier values of the particular claim to be accessed. The value format is the same as for the positional argument <code>raw_value</code>. The special type ''''no value'''' given by the empty string also matches the total absence within the claim of the particular qualifier.
Example: <code>|P518=Q27561</code>
Multiple arguments of this type can be given to match multiple qualifier values simultaneously for each claim.
| claim
|}
=== Property aliases ===
Property aliases are other names for P-identifiers that can be used instead. The following property aliases (which are [[Case sensitivity|case-sensitive]]) are currently available:
{| class="wikitable"
|-
! Alias
! <sub>translates<br /></sub><sup>to</sup>
! P-identifier
|- <!-- property aliases purely for convenience -->
| coord ||style="text-align: center;"| → || [[d:Property:P625|P625]]
|-
!colspan="3"|
|- <!-- property aliases used by the module itself -->
| image ||style="text-align: center;"| → || [[d:Property:P18|P18]]
|-
| author ||style="text-align: center;"| → || [[d:Property:P50|P50]]
|-
| authorNameString ||style="text-align: center;"| → || [[d:Property:P2093|P2093]]
|-
| publisher ||style="text-align: center;"| → || [[d:Property:P123|P123]]
|-
| importedFrom ||style="text-align: center;"| → || [[d:Property:P143|P143]]
|-
| wikimediaImportURL ||style="text-align: center;"| → || [[d:Property:P4656|P4656]]
|-
| statedIn ||style="text-align: center;"| → || [[d:Property:P248|P248]]
|-
| pages ||style="text-align: center;"| → || [[d:Property:P304|P304]]
|-
| language ||style="text-align: center;"| → || [[d:Property:P407|P407]]
|-
| hasPart ||style="text-align: center;"| → || [[d:Property:P527|P527]]
|-
| publicationDate ||style="text-align: center;"| → || [[d:Property:P577|P577]]
|-
| startTime ||style="text-align: center;"| → || [[d:Property:P580|P580]]
|-
| endTime ||style="text-align: center;"| → || [[d:Property:P582|P582]]
|-
| chapter ||style="text-align: center;"| → || [[d:Property:P792|P792]]
|-
| retrieved ||style="text-align: center;"| → || [[d:Property:P813|P813]]
|-
| referenceURL ||style="text-align: center;"| → || [[d:Property:P854|P854]]
|-
| sectionVerseOrParagraph ||style="text-align: center;"| → || [[d:Property:P958|P958]]
|-
| archiveURL ||style="text-align: center;"| → || [[d:Property:P1065|P1065]]
|-
| title ||style="text-align: center;"| → || [[d:Property:P1476|P1476]]
|-
| formatterURL ||style="text-align: center;"| → || [[d:Property:P1630|P1630]]
|-
| quote ||style="text-align: center;"| → || [[d:Property:P1683|P1683]]
|-
| shortName ||style="text-align: center;"| → || [[d:Property:P1813|P1813]]
|-
| definingFormula ||style="text-align: center;"| → || [[d:Property:P2534|P2534]]
|-
| archiveDate ||style="text-align: center;"| → || [[d:Property:P2960|P2960]]
|-
| inferredFrom ||style="text-align: center;"| → || [[d:Property:P3452|P3452]]
|-
| typeOfReference ||style="text-align: center;"| → || [[d:Property:P3865|P3865]]
|-
| column ||style="text-align: center;"| → || [[d:Property:P3903|P3903]]
|-
| subjectNamedAs ||style="text-align: center;"| → || [[d:Property:P1810|P1810]]
|-
| wikidataProperty ||style="text-align: center;"| → || [[d:Property:P1687|P1687]]
|}
== References ==
When either the <code>reference</code> or the <code>references</code> command is used and a reference is encountered (in Wikidata), the module checks if the reference contains an {{property|P143}}, {{property|P3452}} or {{property|P4656}} property. In the case one of these properties is present, the whole reference is ignored (i.e. it is treated as if it wasn't present).
Else, the module attempts to display the reference using the {{Tl|Cite web}} template. The reference has to have a {{property|P854}} property. The below table shows the mapping of Wikidata properties to parameters of Cite web.
<!-- The information in the table is from Module:wd/i18n. -->
{| class="wikitable"
|+
!Wikidata property
!Parameter of Cite web
!Notes
|-
|{{property|P2960}}
|archive-date
|
|-
|{{property|P1065}}
|archive-url
|
|-
|{{property|P50}}
| rowspan="2" |author/authorN
| rowspan="2" |N can be 1, 2, 3...
|-
|{{property|P2093}}
|-
|{{property|P407}}
|language
|Ignored when the same as the local language.
|-
|{{property|P304}}
|pages
|
|-
|{{property|P577}}
|date
|
|-
|{{property|P123}}
|publisher
|
|-
|{{property|P1683}}
|quote
|
|-
|{{property|P854}}
|url
|
|-
|{{property|P813}}
|access-date
|
|-
|{{property|P958}}
|at
|
|-
|{{property|P248}}
|website
|
|-
|{{property|P1810}}
|title
|Used only when {{property|P1476}} is not present.
|-
|{{property|P1476}}
|title
|
|}
{{Anchor|Ignored parameters}}The following properties are ignored: {{property|P18}}, {{property|P3865}}.
If there is no {{property|P854}} property present in the reference, but a property of the "External identifier" [[d:Help:Data type|data type]] is present both in the reference and in the {{property|1687}} of the item in {{property|P248}}, a URL is generated from its content and is used in the same manner as a URL given in {{property|P854}}.
If there is no {{property|P854}} property, or the reference has unknown properties, the module attempts to display it using the {{Tl|Cite Q}} template. The {{property|P248}} property is mandatory. The below table shows the mapping of properties to Cite Q parameters.
{| class="wikitable"
|+
!Wikidata property
!Parameter of Cite Q
!Notes
|-
|{{property|P248}}
|1
|Value supplied to the parameter is ''raw'', i.e. it is just the plain QID.
|-
|{{property|P792}}
|chapter
|
|-
|{{property|P3903}}
|at
|
|-
|{{property|P304}}
|pages
|
|-
|{{property|P577}}
|date
|
|-
|{{property|P813}}
|access-date
|
|-
|{{property|P958}}
|section
|
|-
|{{property|P1476}}
|title
|
|-
|any property of the "External identifier" data type
|id
|The label ("name") of the property is prepended before its content.
|}
The properties listed ''under'' the first table (in this section) are also ignored when using Cite Q.
A reference could be displayed using Cite Q only if the reference has a {{property|P248}} property and has only properties listed in the table above. If neither Cite web nor Cite Q could be used to display a reference, an error message with an explanation is returned.
To fix this error, check if the reference has the required properties and doesn't have any unknown properties, as described above. The [[d:Help:Sources|Wikidata help page on references]] can also be helpful when sourcing statements.
== Advanced usage ==
The layout of the output from (a combination of) commands that have both a singular and a plural form (e.g. <code>property</code>/<code>properties</code>) can be customized by using a number of named flags, which are name-value pairs (i.e. <code>|flag=value</code>), that can be given anywhere {{module other|after the first command|inside the call}}. The table below shows the available named flags.
To insert a space at the beginning or end of a <code>value</code>, use an underscore <code>_</code>. To get a literal underscore, escape it by placing a backslash <code>\</code> directly in front of it (i.e. <code>\_</code>); the same holds for a literal backslash (i.e. <code>\\</code>). To get a literal vertical bar <code>|</code>, use <code>{{tl|!}}</code> or <code>&#124;</code>.
{| class="wikitable"
|-
! Named flag
! Default value
! Default condition
! Description
|-
! rowspan="6" style="text-align:right;" | <code>format=</code>
| <code>%p[%s][%r]</code>
| if the <code>property</code>/<code>properties</code> command '''was''' given and the <code>qualifier</code>/<code>qualifiers</code> command '''was not''' given
| rowspan="6" | The format of a single claim. The available parameters are as follows.
{| class="wikitable"
|-
! Parameter
! Description
|-
| <code>%p</code>
| The claim's property value applied by the <code>property</code>/<code>properties</code> command.
|-
| <code>%q1</code>, <code>%q2</code>, <code>%q3</code>, ...
| The claim's qualifier value or list of qualifier values applied by the corresponding <code>qualifier</code>/<code>qualifiers</code> command.
|-
| <code>%q</code>
| The collection of the qualifier values applied by each <code>qualifier</code>/<code>qualifiers</code> command (i.e. <code>%q1</code> + <code>%q2</code> + <code>%q3</code> + ...). If only one <code>qualifier</code>/<code>qualifiers</code> command was given, then this parameter is equivalent to <code>%q1</code>.
|-
| <code>%r</code>
| The claim's reference value or list of reference values applied by the <code>reference</code>/<code>references</code> command.
|-
| <code>%a</code>
| The entity's alias applied by the <code>alias</code>/<code>aliases</code> command.
|-
| <code>%b</code>
| The entity's page badge applied by the <code>badge</code>/<code>badges</code> command.
|-
| <code>%s</code>
| The movable separator placeholder. This is a special parameter that is not applied by a command, but instead is filled automatically between each pair of claims, aliases or badges (if a list of claims, aliases or badges is returned). This is particularly handy in case a claim's reference is returned as well, since it allows the reference to be placed after the punctuation mark as prescribed by [[Wikipedia:Manual of Style#Punctuation and footnotes|Wikipedia's manual of style]]. The default value is a comma (<code>,</code>) and can be overridden with the <code>sep%s</code> flag (see below).
|}
Optional parameters can be given by encapsulating them between square brackets: <code>[...]</code>. All content between the square brackets is only displayed if a value for each optional parameter that has been defined between the same brackets has been found. Optional content can also be nested.
To use two opening square brackets that directly follow each other (i.e. <code>{{!((}}</code>), use <code>{{tl|!((}}</code>.
At least one parameter must be given that is not optional, while the <code>%s</code> parameter must always be defined as optional.
To get a literal <code>[</code>, <code>]</code>, <code>%</code> or <code>\</code>, escape the character by placing a backslash <code>\</code> directly in front of it (e.g. <code>\%</code>). See also the description directly above this table for more.
|-
| <code>%q[%s][%r]</code>
| if the <code>property</code>/<code>properties</code> command '''was not''' given and the <code>qualifier</code>/<code>qualifiers</code> command '''was''' given
|-
| <code>%r</code>
| if '''only''' the <code>reference</code>/<code>references</code> command was given
|-
| <syntaxhighlight lang="wikitext">%p[ <span style="font-size:85\%">(%q)</span>][%s][%r]</syntaxhighlight>
| if the <code>property</code>/<code>properties</code> command '''was''' given and the <code>qualifier</code>/<code>qualifiers</code> command '''was''' given
|-
| <code>%a[%s]</code>
| if the <code>alias</code>/<code>aliases</code> command was given
|-
| <code>%b[%s]</code>
| if the <code>badge</code>/<code>badges</code> command was given
|-
| colspan="4" |
|-
! rowspan="2" style="text-align:right;" | <code>sep=</code>
| <code>{{dfn|_|title=space}}</code>
| <span style="color:#777;">''default''</span>
| rowspan="2" | The fixed separator between each pair of claims, aliases or badges.
|-
| {{dfn|<code>{{0| }}</code>|title=empty}}
| if '''only''' the <code>reference</code>/<code>references</code> command was given '''without''' the <code>raw</code> flag
|-
| colspan="4" |
|-
! rowspan="2" style="text-align:right;" | <code>sep%s=</code>
| <code>,</code>
| <span style="color:#777;">''default''</span>
| rowspan="2" | The movable separator between each pair of claims, aliases or badges. This will be the value of the <code>%s</code> parameter applied to all claims, aliases or badges, except for the last in the list (which can be set with the <code>punc</code> flag).
|-
| <code>;</code>
| if the <code>property</code>/<code>properties</code> command '''was not''' given and the <code>qualifier</code>/<code>qualifiers</code> command '''was''' given
|-
| colspan="4" |
|-
! style="text-align:right;" | <code>sep%q1=</code>, <code>sep%q2=</code>, <code>sep%q3=</code>, ...
| <code>{{dfn|,_|title=comma space}}</code>
| <span style="color:#777;">''default''</span>
| The separator between each pair of qualifiers of a single claim. These are the value separators for the <code>%q1</code>, <code>%q2</code>, <code>%q3</code>, ... parameters.
If only one <code>qualifier</code>/<code>qualifiers</code> command was given, then the <code>sep%q1</code> flag is equivalent to <code>sep%q</code>.
|-
| colspan="4" |
|-
! rowspan="2" style="text-align:right;" | <code>sep%q=</code>
| <code>{{dfn|,_|title=comma space}}</code>
| if '''exactly one''' <code>qualifier</code>/<code>qualifiers</code> command was given
| rowspan="2" | The separator between each set of qualifiers of a single claim. This is the value separator for the <code>%q</code> parameter.
If only one <code>qualifier</code>/<code>qualifiers</code> command was given, then this flag is equivalent to <code>sep%q1</code>.
|-
| <code>{{dfn|{{;}}_|title=semicolon space}}</code>
| if '''more than one''' <code>qualifier</code>/<code>qualifiers</code> command was given
|-
| colspan="4" |
|-
! rowspan="2" style="text-align:right;" | <code>sep%r=</code>
| {{dfn|<code>{{0| }}</code>|title=empty}}
| <span style="color:#777;">''default''</span>
| rowspan="2" | The separator between each pair of references of a single claim. This is the value separator for the <code>%r</code> parameter.
|-
| <code>{{dfn|_|title=space}}</code>
| if the <code>raw</code> flag '''was''' given for the <code>reference</code>/<code>references</code> command
|-
| colspan="4" |
|-
! style="text-align:right;" | <code>punc=</code>
| {{dfn|<code>{{0| }}</code>|title=empty}}
| <span style="color:#777;">''default''</span>
| A punctuation mark placed at the end of the output. This will be placed on the <code>%s</code> parameter applied to the last claim (or alias or badge) in the list.
This allows the last claim's references to be placed after the punctuation mark when the output is used as part of a sentence.
|}
== Examples ==
<!--
TO UPDATE EXAMPLE RESULTS at [[Template:Wikidata/doc]], replace all the contents of the 'Examples' section with: {{subst:Template:Wikidata/doc/examples}}
(This makes the example results static for performance reasons.)
Changes to examples and additions of new examples should be made at [[Template:Wikidata/doc/examples]] after which the contents of the 'Examples' section at [[Template:Wikidata/doc]] should be substituted as described above.
The examples section is a bit bloated, though... For a bit of convenience, the following table row can be used as a basic template for any new example (note the 'xxx' that need to be replaced):
|-
| style="color:#777;font-size:small;" | Pxxx = "{{{{{|safesubst:}}}#invoke:wd|label|Pxxx}}"<br />
:↓<br />
[{{smallcaps|xxx}}]
| {{tnull|{{{{{|safesubst:}}}(((}}prename|{{{{{|safesubst:}}})))}}{{lcfirst:{{BASEPAGENAME}}}}|property|Pxxx|{{{{{|safesubst:}}}(((}}extraparams|{{{{{|safesubst:}}})))}}}}<br />
:↓<br />
:{{{{{|safesubst:}}}#invoke:wd|property|Pxxx}}
| Description...
-->
{| class="wikitable"
|-
! Parameters and output types
! Example
! style="width:20%"|Description
|-
| style="color:#777;font-size:small;" | [[d:Q55|Q55]] = "Netherlands", [[d:Property:P395|P395]] = "licence plate code"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL
| Gets a literal string value.
|-
| style="color:#777;font-size:small;" | P395 = "licence plate code"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Netherlands]] page (which is linked to Q55), then the <code>Q55</code> can be omitted.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P395 = "NL"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''eid{{=}}Q55'''|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL
| An entity-ID can also be given using the <code>eid=</code> argument.
|-
| style="color:#777;font-size:small;" | P395 = "NL"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''page{{=}}Netherlands'''|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL
| A page title can be given instead of an entity-ID using the <code>page=</code> argument.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P395 = "licence plate code"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''edit'''|Q55|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL [[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/Q55?uselang=en#P395|Edit this on Wikidata]]
| Adds a clickable icon that may be used to edit the returned value on Wikidata.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P395 = "licence plate code"<br />
:↓<br />
[{{smallcaps|string}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''edit@end'''|Q55|P395|{{{extraparams|}}}}}<br />
:↓<br />
:NL<span style="float:right">[[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/Q55?uselang=en#P395|Edit this on Wikidata]]</span>
| Places the edit icon at the end of the line.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P1082|P1082]] = "population"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''property'''|'''normal+'''|Q55|P1082|{{{extraparams|}}}}}<br />
:↓<br />
:17,590,672
| Gets a single property value from claims with a 'normal' rank or higher.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''properties'''|normal+|Q55|P1082|{{{extraparams|}}}}}<br />
:↓<br />
:17,590,672, 10,026,773, 16,779,575, 16,829,289, 17,000,000, 17,081,507, 17,181,084, 17,282,163, 17,407,585
| Gets multiple property values from claims with a 'normal' rank or higher.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", [[d:Property:P585|P585]] = "point in time"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''qualifier'''|normal+|Q55|P1082|'''P585'''|{{{extraparams|}}}}}<br />
:↓<br />
:17,590,672 <span style="font-size:85%">(1 January 2022)</span>, 10,026,773 <span style="font-size:85%">(1950)</span>, 16,779,575 <span style="font-size:85%">(2013)</span>, 16,829,289 <span style="font-size:85%">(26 August 2014)</span>, 17,000,000 <span style="font-size:85%">(21 March 2016)</span>, 17,081,507 <span style="font-size:85%">(1 January 2017)</span>, 17,181,084 <span style="font-size:85%">(1 January 2018)</span>, 17,282,163 <span style="font-size:85%">(1 January 2019)</span>, 17,407,585 <span style="font-size:85%">(1 January 2020)</span>
| Gets a single qualifier value for each claim, additional to the property value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|time}}], [{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|'''references'''|normal+|Q55|P1082|P585|{{{extraparams|}}}}}<br />
:↓<br />
:17,590,672 <span style="font-size:85%">(1 January 2022)</span>,<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5">{{Cite web|title=Bevolking; kerncijfers, 1950-2022|url=https://opendata.cbs.nl/statline/#/CBS/nl/dataset/37296ned/table?ts=1560596956049}}</ref> 10,026,773 <span style="font-size:85%">(1950)</span>,<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5">{{Cite web|publisher=Statistics Netherlands|title=CBS StatLine - Bevolking; kerncijfers|access-date=22 August 2015|url=http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&D1=a&D2=0,10,20,30,40,50,60,(l-1),l&HD=130605-0924&HDR=G1&STB=T|archive-date=27 August 2015|archive-url=https://web.archive.org/web/20150827042738/http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&D1=a&D2=0,10,20,30,40,50,60,(l-1),l&HD=130605-0924&HDR=G1&STB=T}}</ref> 16,779,575 <span style="font-size:85%">(2013)</span>,<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5"/> 16,829,289 <span style="font-size:85%">(26 August 2014)</span>,<ref name="wikidata-475c2999c451e2e418b275ef9b087583a2db7228-v5">{{Cite web|title=CBS StatLine - Bevolking; kerncijfers|access-date=26 August 2014|url=http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&LA=NL|archive-url=https://web.archive.org/web/20140903082344/http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&LA=NL|archive-date=3 September 2014}}</ref> 17,000,000 <span style="font-size:85%">(21 March 2016)</span>,<ref name="wikidata-08fbc9797078849d8dc7b4754ad2109020d16f96-v5">{{Cite web|date=21 March 2016|url=http://www.cbs.nl/nl-NL/menu/themas/bevolking/publicaties/artikelen/archief/2016/nederland-telt-17-miljoen-inwoners.htm|title=Nederland telt 17 miljoen inwoners}}</ref> 17,081,507 <span style="font-size:85%">(1 January 2017)</span>,<ref name="wikidata-4f58fc69480f96aaec74e771792854a11428895e-v5">{{Cite web|url=https://opendata.cbs.nl/statline/#/CBS/nl/dataset/37296ned/table?ts=1560596956049|title=Bevolking; kerncijfers, 1950-2022|access-date=18 March 2023}}</ref> 17,181,084 <span style="font-size:85%">(1 January 2018)</span>,<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/> 17,282,163 <span style="font-size:85%">(1 January 2019)</span>,<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/> 17,407,585 <span style="font-size:85%">(1 January 2020)</span><ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/>
| Gets references for each claim.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|reference}}]
| <code>A total of {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|references|Q55|P1082|{{{extraparams|}}}}} people live in the Netherlands.</code><br />
:↓<br />
:A total of 17,590,672<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/> people live in the Netherlands.
| Gets a property with its references.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|reference}}]
| <code>The Netherlands has a population of {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|references|Q55|P1082|'''punc{{=}}.'''|{{{extraparams|}}}}}</code>
:↓<br />
:The Netherlands has a population of 17,590,672.<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/>
| Adds a punctuation mark at the end of the output, in front of the references.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|time}}], [{{smallcaps|reference}}]
| <code>'''<nowiki><ul></nowiki>'''{{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|references|normal+|Q55|P1082|P585|'''<nowiki>format=<li>%p[%r][<ul><li>%q</li></ul>]</li></nowiki>'''|{{{extraparams|}}}}}'''<nowiki></ul></nowiki>'''</code><br />
:↓<br />
<ul><li>17,590,672<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/><ul><li>1 January 2022</li></ul></li> <li>10,026,773<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5"/><ul><li>1950</li></ul></li> <li>16,779,575<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5"/><ul><li>2013</li></ul></li> <li>16,829,289<ref name="wikidata-475c2999c451e2e418b275ef9b087583a2db7228-v5"/><ul><li>26 August 2014</li></ul></li> <li>17,000,000<ref name="wikidata-08fbc9797078849d8dc7b4754ad2109020d16f96-v5"/><ul><li>21 March 2016</li></ul></li> <li>17,081,507<ref name="wikidata-4f58fc69480f96aaec74e771792854a11428895e-v5"/><ul><li>1 January 2017</li></ul></li> <li>17,181,084<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/><ul><li>1 January 2018</li></ul></li> <li>17,282,163<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/><ul><li>1 January 2019</li></ul></li> <li>17,407,585<ref name="wikidata-3abcb661cd2d0629bbc49088fa86f8b016fa3525-v5"/><ul><li>1 January 2020</li></ul></li></ul>
| Returns the output in a custom format.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''qualifier'''|normal+|Q55|P1082|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1 January 2022; 1950; 2013; 26 August 2014; 21 March 2016; 1 January 2017; 1 January 2018; 1 January 2019; 1 January 2020
| Gets a single qualifier per claim, by default for multiple matching claims.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifier|normal+|'''single'''|Q55|P1082|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1 January 2022
| To get a single qualifier for only a single claim, give the <code>single</code> flag too so that only a single claim will be accessed.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifier|Q55|P1082|'''10026773'''|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1950
| Gets a qualifier from claims for which the (raw) property value matches a given literal value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifier|'''mdy'''|Q55|P1082|10026773|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1950
| Gets dates in month-day-year order.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population", P585 = "point in time"<br />
:↓<br />
[{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifier|'''raw'''|Q55|P1082|10026773|P585|{{{extraparams|}}}}}<br />
:↓<br />
:1950
| Gets a raw date value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''references'''|Q55|P1082|'''10026773'''|{{{extraparams|}}}}}<br />
:↓<br />
:<ref name="wikidata-cb4c9d92a7876cfdfafdaf4b92634cba9063dac1-v5"/>
| Gets the references from a particular claim.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1082 = "population"<br />
:↓<br />
[{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''references'''|'''raw'''|Q55|P1082|'''10026773'''|{{{extraparams|}}}}}<br />
:↓<br />
:{{Cite web|publisher=Statistics Netherlands|title=CBS StatLine - Bevolking; kerncijfers|access-date=22 August 2015|url=http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&D1=a&D2=0,10,20,30,40,50,60,(l-1),l&HD=130605-0924&HDR=G1&STB=T|archive-date=27 August 2015|archive-url=https://web.archive.org/web/20150827042738/http://statline.cbs.nl/StatWeb/publication/?VW=T&DM=SLNL&PA=37296ned&D1=a&D2=0,10,20,30,40,50,60,(l-1),l&HD=130605-0924&HDR=G1&STB=T}}
| Gets references from a particular claim in their raw form.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P1081|P1081]] = "Human Development Index"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''references'''|normal+|Q55|P1081|{{{extraparams|}}}}}<br />
:↓<br />
:0.931,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5">{{Cite web|title=Human Development Data (1990-2017)|website=[[Human Development Report]]|url=http://hdr.undp.org/en/data|archive-date=30 December 2018|archive-url=https://web.archive.org/web/20181230181123/http://hdr.undp.org/en/data}}</ref> 0.787, 0.799, 0.829,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5">{{Cite web|archive-url=https://web.archive.org/web/20170202193023/http://hdr.undp.org/en/countries/profiles/NLD|url=http://hdr.undp.org/en/countries/profiles/NLD|archive-date=2 February 2017|title=Netherlands}}</ref><ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.861,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.877,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.891,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.909,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.919,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.920,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.920,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.922,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.834,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.835,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.839,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.864,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.866,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.865,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.867,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.870,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.876,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.879,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.878,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.883,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.886,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.897,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.904,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.906,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.906,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.910,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.921,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.921,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.923,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.924,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.926,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.928<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/>
| Gets properties from each claim with any references they have.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1081 = "Human Development Index"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|references|normal+|'''sourced'''|Q55|P1081|{{{extraparams|}}}}}<br />
:↓<br />
:0.931,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.829,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/><ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.861,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.877,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.891,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.909,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.919,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.920,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.920,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.922,<ref name="wikidata-9775e828e0f16e6a1b32ff4b6293321469548907-v5"/> 0.834,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.835,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.839,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.864,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.866,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.865,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.867,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.870,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.876,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.879,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.878,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.883,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.886,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.897,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.904,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.906,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.906,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.910,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.921,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.921,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.923,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.924,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.926,<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/> 0.928<ref name="wikidata-f5c4249c74a1deaf99aa1ce9def008283983d0a1-v5"/>
| Only gets properties from claims that have at least one reference.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P2855|P2855]] = "VAT rate", [[d:Property:P518|P518]] = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''qualifier'''|Q55|P2855|P518|{{{extraparams|}}}}}<br />
:↓<br />
:food
| Gets a single qualifier value (for each matching claim).
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2855 = "VAT rate", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''qualifiers'''|Q55|P2855|P518|{{{extraparams|}}}}}<br />
:↓<br />
:food, medication, assistive technology, magazine, book, art, antique, hairdresser, hotel, campsite, recreation, sport, water
| Gets multiple qualifier values (for each matching claim).
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2855 = "VAT rate", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''properties'''|qualifiers|Q55|P2855|P518|{{{extraparams|}}}}}<br />
:↓<br />
:21%, 6% <span style="font-size:85%">(food, medication, assistive technology, magazine, book, art, antique, hairdresser, hotel, campsite, recreation, sport, water)</span>
| Gets multiple property values along with multiple qualifier values.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2855 = "VAT rate", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|quantity}}], [{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifiers|Q55|P2855|P518|'''sep{{=}}_+_'''|'''sep%s{{=}}'''|'''sep%q{{=}}_/_'''|{{{extraparams|}}}}}<br />
:↓<br />
:21% + 6% <span style="font-size:85%">(food / medication / assistive technology / magazine / book / art / antique / hairdresser / hotel / campsite / recreation / sport / water)</span>
| Returns the output with custom separators.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P35|P35]] = "head of state", [[d:Property:P580|P580]] = "start time", [[d:Property:P582|P582]] = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''qualifier'''|'''qualifier'''|normal+|Q55|P35|'''P580'''|'''P582'''|{{{extraparams|}}}}}<br />
:↓<br />
:Willem-Alexander of the Netherlands <span style="font-size:85%">(30 April 2013)</span>, Beatrix of the Netherlands <span style="font-size:85%">(30 April 1980; 30 April 2013)</span>, Juliana of the Netherlands <span style="font-size:85%">(4 September 1948; 30 April 1980)</span>, Wilhelmina of the Netherlands <span style="font-size:85%">(23 November 1890; 4 September 1948)</span>, Willem III of the Netherlands <span style="font-size:85%">(17 March 1849; 23 November 1890)</span>, Willem II of the Netherlands <span style="font-size:85%">(7 October 1840; 17 March 1849)</span>, William I of the Netherlands <span style="font-size:85%">(16 March 1815; 7 October 1840)</span>
| Gets two different qualifier values for each claim.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P35 = "head of state", P580 = "start time", P582 = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|'''sep%q{{=}}_–_'''|{{{extraparams|}}}}}<br />
:↓<br />
:Willem-Alexander of the Netherlands <span style="font-size:85%">(30 April 2013)</span>, Beatrix of the Netherlands <span style="font-size:85%">(30 April 1980 – 30 April 2013)</span>, Juliana of the Netherlands <span style="font-size:85%">(4 September 1948 – 30 April 1980)</span>, Wilhelmina of the Netherlands <span style="font-size:85%">(23 November 1890 – 4 September 1948)</span>, Willem III of the Netherlands <span style="font-size:85%">(17 March 1849 – 23 November 1890)</span>, Willem II of the Netherlands <span style="font-size:85%">(7 October 1840 – 17 March 1849)</span>, William I of the Netherlands <span style="font-size:85%">(16 March 1815 – 7 October 1840)</span>
| Returns the output with a custom separator.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P35 = "head of state", P580 = "start time", P582 = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|'''<nowiki>format=%p[ <span style="font-size:85\%">(%q1[ – %q2])</span>][%s][%r]</nowiki>'''|{{{extraparams|}}}}}<br />
:↓<br />
:Willem-Alexander of the Netherlands <span style="font-size:85%">(30 April 2013)</span>, Beatrix of the Netherlands <span style="font-size:85%">(30 April 1980 – 30 April 2013)</span>, Juliana of the Netherlands <span style="font-size:85%">(4 September 1948 – 30 April 1980)</span>, Wilhelmina of the Netherlands <span style="font-size:85%">(23 November 1890 – 4 September 1948)</span>, Willem III of the Netherlands <span style="font-size:85%">(17 March 1849 – 23 November 1890)</span>, Willem II of the Netherlands <span style="font-size:85%">(7 October 1840 – 17 March 1849)</span>, William I of the Netherlands <span style="font-size:85%">(16 March 1815 – 7 October 1840)</span>
| Returns the output in a custom format instead of with a custom separator.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P35 = "head of state", P580 = "start time", P582 = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|qualifier|normal+|Q55|P35|P580|P582|<nowiki>format=%p[ <span style="font-size:85\%">(</nowiki>'''<nowiki>[<![]--%q2]since [%q2--[]>]</nowiki>'''<nowiki>%q1[ – %q2])</span>][%s][%r]</nowiki>|{{{extraparams|}}}}}<br />
:↓<br />
:Willem-Alexander of the Netherlands <span style="font-size:85%">(since 30 April 2013)</span>, Beatrix of the Netherlands <span style="font-size:85%">(<!--30 April 2013since 30 April 2013-->30 April 1980 – 30 April 2013)</span>, Juliana of the Netherlands <span style="font-size:85%">(<!--30 April 1980since 30 April 1980-->4 September 1948 – 30 April 1980)</span>, Wilhelmina of the Netherlands <span style="font-size:85%">(<!--4 September 1948since 4 September 1948-->23 November 1890 – 4 September 1948)</span>, Willem III of the Netherlands <span style="font-size:85%">(<!--23 November 1890since 23 November 1890-->17 March 1849 – 23 November 1890)</span>, Willem II of the Netherlands <span style="font-size:85%">(<!--17 March 1849since 17 March 1849-->7 October 1840 – 17 March 1849)</span>, William I of the Netherlands <span style="font-size:85%">(<!--7 October 1840since 7 October 1840-->16 March 1815 – 7 October 1840)</span>
| To add text only when a certain value is not present, like adding the word ''since'' if there is no end time, wrap it in between two optional blocks containing HTML comment tags and the relevant parameter (this also prevents the text from being added to the page source).
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P35 = "head of state", [[d:Q29574|Q29574]] = "Beatrix of the Netherlands", P580 = "start time", P582 = "end time"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|time}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|'''raw'''|qualifier|normal+|Q55|P35|'''Q29574'''|P580|P582|<nowiki>format=%p[ <span style="font-size:85\%">(%q1[ – %q2])</span>][%s][%r]</nowiki>|{{{extraparams|}}}}}<br />
:↓<br />
:Beatrix of the Netherlands <span style="font-size:85%">(1980-04-30 – 30 April 2013)</span>
| Gets a property with qualifiers from claims for which the property matches a given Q-identifier, with one of the qualifier values in its raw form.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P38|P38]] = "currency", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifiers|normal+|'''current'''|Q55|P38|P518|{{{extraparams|}}}}}<br />
:↓<br />
:euro <span style="font-size:85%">(European Netherlands)</span>, United States dollar <span style="font-size:85%">(Caribbean Netherlands)</span>
| Gets claims that are currently valid.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''linked'''|qualifiers|normal+|current|Q55|P38|P518|{{{extraparams|}}}}}<br />
:↓<br />
:[[Euro|euro]] <span style="font-size:85%">(European Netherlands)</span>, [[United States dollar]] <span style="font-size:85%">(Caribbean Netherlands)</span>
| Gets claims with linked property values.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifiers|'''linked'''|normal+|current|Q55|P38|P518|{{{extraparams|}}}}}<br />
:↓<br />
:euro <span style="font-size:85%">(European Netherlands)</span>, United States dollar <span style="font-size:85%">([[Caribbean Netherlands]])</span>
| Gets claims with linked qualifier values.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''linked'''|'''short'''|qualifiers|'''linked'''|normal+|current|Q55|P38|P518|{{{extraparams|}}}}}<br />
:↓<br />
:[[Euro|euro]] <span style="font-size:85%">(European Netherlands)</span>, [[United States dollar|US dollar]] <span style="font-size:85%">([[Caribbean Netherlands]])</span>
| Gets claims with linked property and qualifier values, with short property values wherever available.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", [[d:Q4917|Q4917]] = "United States dollar", P518 = "applies to part"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|qualifiers|normal+|current|Q55|P38|'''Q4917'''|P518|{{{extraparams|}}}}}<br />
:↓<br />
:Caribbean Netherlands
| Gets qualifiers from claims for which the (raw) property value matches a given Q-identifier.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency", P518 = "applies to part", [[d:Q27561|Q27561]] = "Caribbean Netherlands"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|normal+|current|Q55|P38|'''P518{{=}}Q27561'''|{{{extraparams|}}}}}<br />
:↓<br />
:United States dollar
| Gets properties from claims for which a (raw) qualifier value matches a given Q-identifier.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|normal+|'''former'''|Q55|P38|{{{extraparams|}}}}}<br />
:↓<br />
:Dutch guilder
| Gets claims that were valid in the past.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|'''raw'''|normal+|former|Q55|P38|{{{extraparams|}}}}}<br />
:↓<br />
:Q788472
| Gets raw property values.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|raw|'''linked'''|normal+|former|Q55|P38|{{{extraparams|}}}}}<br />
:↓<br />
:[[d:Special:EntityPage/Q788472|Q788472]]
| Gets raw property values that are linked to Wikidata.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P1549|P1549]] = "demonym"<br />
:↓<br />
[{{smallcaps|monolingual text}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|P1549|{{{extraparams|}}}}}<br />
:↓<br />
:Dutch
| Gets a monolingual text value in the current wiki's language.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P1549 = "demonym", [[d:Property:P407|P407]] = "language of work or name", [[d:Q36846|Q36846]] = "Toki Pona"<br />
:↓<br />
[{{smallcaps|monolingual text}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''multilanguage'''|Q55|P1549|P407{{=}}Q36846|{{{extraparams|}}}}}<br />
:↓<br />
:
| Gets a monolingual text value in any available language.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P2884|P2884]] = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:230 volt
| Gets a quantity value with its associated unit of measurement.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2884 = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''linked'''|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:230 [[Volt|volt]]
| Gets a quantity value with a linked unit of measurement.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2884 = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''raw'''|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:230
| Gets a raw quantity value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2884 = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''unit'''|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:volt
| Gets only the unit of measurement.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P2884 = "mains voltage"<br />
:↓<br />
[{{smallcaps|quantity}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|unit|'''raw'''|Q55|P2884|{{{extraparams|}}}}}<br />
:↓<br />
:Q25250
| Gets the raw unit of measurement.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P625|P625]] = "coordinate location"<br />
:↓<br />
[{{smallcaps|globe coordinate}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|P625|{{{extraparams|}}}}}<br />
:↓<br />
:52°19'N, 5°33'E
| Gets a globe coordinate value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P625 = "coordinate location"<br />
:↓<br />
[{{smallcaps|globe coordinate}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''linked'''|Q55|P625|{{{extraparams|}}}}}<br />
:↓<br />
:[https://tools.wmflabs.org/geohack/geohack.php?language=en¶ms=52_19_N_5_33_E_globe:earth 52°19'N, 5°33'E]
| Gets a linked globe coordinate value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P625 = "coordinate location"<br />
:↓<br />
[{{smallcaps|globe coordinate}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''raw'''|Q55|P625|{{{extraparams|}}}}}<br />
:↓<br />
:52/19/N/5/33/E
| Gets a raw globe coordinate value.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P625 = "coordinate location"<br />
:↓<br />
[{{smallcaps|globe coordinate}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q55|'''coord'''|{{{extraparams|}}}}}<br />
:↓<br />
:52°19'N, 5°33'E
| A property alias can be used instead of the P-identifier.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", [[d:Property:P41|P41]] = "flag image"<br />
:↓<br />
[{{smallcaps|commons media}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''linked'''|Q55|P41|{{{extraparams|}}}}}<br />
:↓<br />
:[[c:File:Flag of the Netherlands.svg|Flag of the Netherlands.svg]]
| Gets a media file name and links to it on Commons.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P41 = "flag image"<br />
:↓<br />
[{{smallcaps|commons media}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''raw'''|Q55|P41|'''<nowiki>format=\[\[File:%p {{!}} thumb {{!}} left\]\]</nowiki>'''|{{{extraparams|}}}}}<br />
:↓<br />
:[[File:Flag of the Netherlands.svg{{!}} thumb {{!}} left]]
| A Commons media file can be included on the page as-is by omitting the <code>linked</code> and <code>raw</code> flags, but by using the <code>raw</code> flag it can be freely formatted.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P41 = "flag image"<br />
:↓<br />
[{{smallcaps|commons media}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|raw|'''date{{=}}1700-05-06'''|Q55|P41|<nowiki>format=\[\[File:%p {{!}} thumb {{!}} left\]\]</nowiki>|{{{extraparams|}}}}}<br />
:↓<br />
:[[File:Statenvlag.svg{{!}} thumb {{!}} left]]
| To get the value of a property that was valid at a given time, the <code>date=</code> argument can be used.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands", P41 = "flag image"<br />
:↓<br />
[{{smallcaps|commons media}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|raw|date{{=}}1700-05-06|'''former'''|Q55|P41|<nowiki>format=\[\[File:%p {{!}} thumb {{!}} left\]\]</nowiki>|{{{extraparams|}}}}}<br />
:↓<br />
:[[File:Prinsenvlag.svg{{!}} thumb {{!}} left]]
| The time constraint flags work relatively to the date value given for the <code>date=</code> argument.
|-
| style="color:#777;font-size:small;" | [[d:Q915684|Q915684]] = "Lorentz–Lorenz equation", [[d:Property:P2534|P2534]] = "defining formula"<br />
:↓<br />
[{{smallcaps|math}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|Q915684|P2534|{{{extraparams|}}}}}<br />
:↓<br />
:<math qid="Q915684">\frac{n^2 - 1}{n^2 + 2} = \frac{4 \pi}{3} N \alpha</math>
| Gets a mathematical expression.
|-
| style="color:#777;font-size:small;" | Q915684 = "Lorentz–Lorenz equation", [[d:Property:P7235|P7235]] = "in defining formula", [[d:Property:P9758|P9758]] = "symbol represents"<br />
:↓<br />
[{{smallcaps|entity label}}], [{{smallcaps|math}}]
| <code><nowiki><ul></nowiki>{{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|properties|qualifier|linked|Q915684|P7235|P9758|<nowiki>format=<li>%q[ (%p)]</li></nowiki>|{{{extraparams|}}}}}<nowiki></ul></nowiki></code><br />
:↓<br />
:<ul><li>[[Refractive index|refractive index]] (<math>n</math>)</li> <li>[[Polarizability|polarizability]] (<math>\alpha</math>)</li> <li>[[Number density|volumetric number density]] (<math>N</math>)</li> <li>[[Pi|pi]] (<math>\pi</math>)</li></ul>
| Mathematical expressions can be combined with regular text as usual.
|-
| style="color:#777;font-size:small;" | [[d:Q6256|Q6256]] = "country", [[d:Property:P3896|P3896]] = "geoshape"<br />
:↓<br />
[{{smallcaps|geographic shape}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|'''linked'''|Q6256|P3896|{{{extraparams|}}}}}<br />
:↓<br />
:[[c:Data:Naturalearthdata.com/admin-0-countries-no-antarctica.map|Data:Naturalearthdata.com/admin-0-countries-no-antarctica.map]]
| Gets a geographic shape data file name and links to it on Commons.
|-
| style="color:#777;font-size:small;" | Q4917 = "United States dollar"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''label'''|Q4917|{{{extraparams|}}}}}<br />
:↓<br />
:United States dollar
| Gets an item's label.
|-
| style="color:#777;font-size:small;" | Q4917 = "United States dollar"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|'''short'''|'''linked'''|Q4917|{{{extraparams|}}}}}<br />
:↓<br />
:[[United States dollar|US dollar]]
| Gets an item's short and linked label.
|-
| style="color:#777;font-size:small;" | P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|P38|{{{extraparams|}}}}}<br />
:↓<br />
:currency
| Gets a property's label.
|-
| style="color:#777;font-size:small;" | P38 = currency"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|'''linked'''|P38|{{{extraparams|}}}}}<br />
:↓<br />
:[[d:Special:EntityPage/P38|currency]]
| Gets a property's label that is linked to Wikidata.
|-
| style="color:#777;font-size:small;" | [[d:Q776|Q776]] = "Utrecht"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|Q776|{{{extraparams|}}}}}<br />
:↓<br />
:Utrecht
| Gets an item's label.
|-
| style="color:#777;font-size:small;" | Q776 = "Utrecht"<br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|'''linked'''|Q776|{{{extraparams|}}}}}<br />
:↓<br />
:[[Utrecht (province)|Utrecht]]
| Gets an item's linked label.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|{{{extraparams|}}}}}<br />
:↓<br />
:Utrecht
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Utrecht (province)]] page (which is linked to Q776), then the <code>Q776</code> can be omitted.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|'''raw'''|{{{extraparams|}}}}}<br />
:↓<br />
:Q776
| If just the <code>label</code> command with the <code>raw</code> flag is given, then the Q-identifier of the item connected to the current page is returned.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity label}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|label|raw|'''linked'''|{{{extraparams|}}}}}<br />
:↓<br />
:[[d:Special:EntityPage/Q776|Q776]]
| If additionally the <code>linked</code> flag is given, then the Q-identifier of the item connected to the current page is linked to Wikidata.
|-
| style="color:#777;font-size:small;" | Q776 = "Utrecht"<br />
:↓<br />
[{{smallcaps|page title}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''title'''|Q776|{{{extraparams|}}}}}<br />
:↓<br />
:Utrecht (province)
| Gets the title of the page on the current wiki that is linked to the given item.
|-
| style="color:#777;font-size:small;" | Q776 = "Utrecht"<br />
:↓<br />
[{{smallcaps|page title}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|title|'''linked'''|Q776|{{{extraparams|}}}}}<br />
:↓<br />
:[[Utrecht (province)]]
| Gets the linked title of the page on the current wiki that is linked to the given item.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|page title}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|title|{{{extraparams|}}}}}<br />
:↓<br />
:Utrecht (province)
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Utrecht (province)]] page (which is linked to Q776), then the <code>Q776</code> can be omitted.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands"<br />
:↓<br />
[{{smallcaps|entity description}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''description'''|Q55|{{{extraparams|}}}}}<br />
:↓<br />
:country in Northwestern Europe with territories in the Caribbean
| Gets an item's description.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity description}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|description|{{{extraparams|}}}}}<br />
:↓<br />
:country in Northwestern Europe with territories in the Caribbean
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Netherlands]] page (which is linked to Q55), then the <code>Q55</code> can be omitted.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands"<br />
:↓<br />
[{{smallcaps|entity alias}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''alias'''|Q55|{{{extraparams|}}}}}<br />
:↓<br />
:Holland
| Gets one of an item's aliases.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands"<br />
:↓<br />
[{{smallcaps|entity alias}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''aliases'''|Q55|{{{extraparams|}}}}}<br />
:↓<br />
:Holland, the Netherlands, NL, NED, Nederland, nl, 🇳🇱, Netherlands (after 1945)
| Gets all of an item's aliases.
|-
| style="color:#777;font-size:small;" | Q55 = "Netherlands"<br />
:↓<br />
[{{smallcaps|entity alias}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|alias|'''linked'''|Q55|{{{extraparams|}}}}}<br />
:↓<br />
:[[Netherlands|Holland]]
| Gets a linked alias from an item.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|entity alias}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|alias|{{{extraparams|}}}}}<br />
:↓<br />
:Holland
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Netherlands]] page (which is linked to Q55), then the <code>Q55</code> can be omitted.
|-
| style="color:#777;font-size:small;" | [[d:Q2|Q2]] = "Earth"<br />
:↓<br />
[{{smallcaps|page badge}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|'''badges'''|Q2|{{{extraparams|}}}}}<br />
:↓<br />
:featured article badge
| Gets the badges for the page on the current wiki that is linked to the given item.
|-
| style="color:#777;font-size:small;" | Q2 = "Earth"<br />
:↓<br />
[{{smallcaps|page badge}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|badges|'''raw'''|Q2|{{{extraparams|}}}}}<br />
:↓<br />
:Q17437796
| Gets the raw badges for the page on the current wiki that is linked to the given item.
|-
| style="color:#777;font-size:small;" | <br />
:↓<br />
[{{smallcaps|page badge}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|badges|{{{extraparams|}}}}}<br />
:↓<br />
:featured article badge
| If the {{lcfirst:{{NAMESPACE}}}} is transcluded on the [[Earth]] page (which is linked to Q2), then the <code>Q2</code> can be omitted.
|-
| style="color:#777;font-size:small;" | [[d:Q28865|Q28865]] = "Python", [[d:P548|P548]] = "version type", [[d:P348|P348]] = "software version identifier",<br />
:↓<br />
[{{smallcaps|version}}], [{{smallcaps|reference}}]
| {{tnull|{{{prename|}}}{{lcfirst:{{BASEPAGENAME}}}}|property|reference|edit|Q28865|'''P548{{=}}Q2804309'''|P348|{{{extraparams|}}}}}<br />
:↓<br />
:3.11.3<ref name="wikidata-47b0d8952e763dae8105c1e70220fc5d387af155-v5">{{Cite web|date=5 April 2023|url=https://blog.python.org/2023/04/its-time-for-another-set-of-python.html|title=It's time for another set of Python releases! Python 3.11.3, 3.10.11 and 3.12 alpha 7 are now available.|access-date=6 April 2023}}</ref> [[File:OOjs UI icon edit-ltr-progressive.svg|frameless|text-top|10px|alt=Edit this on Wikidata|link=https://www.wikidata.org/wiki/Q28865?uselang=en#P348|Edit this on Wikidata]]
| Get [[Python (programming language)|Python]]'s latest stable release version with its references. You may want to use '''P548{{=}}Q2122918''' to get the latest preview release version.
|}
=== Example references ===
{{Reflist}}
== TemplateData ==
<templatedata>
{
"params": {},
"description": "This template fetches data from the centralized knowledge base Wikidata. To edit the data, click on \"Wikidata item\" in the left sidebar."
}
</templatedata>
== See also ==
{{module other|*{{tl|Wikidata}}, a user-friendly wrapper template for this module.
*{{tl|WikidataOI}}, a wrapper template for this module that adds an opt-in toggle.|{{{seealso|}}}
*{{tl|Sitelink}}, a template that can access other Wikipedia page titles
*[[Module:Wd]], the source module that is called by this template
*{{tl|Wdib}}, a wrapper template for the getValue call in [[Module:WikidataIB]]
*{{tl|Wikidata entity link}} or redirect {{tl|Q}}), to add a Wikidata entity link to a Wikipedia page
*{{tl|Wikidata property link}} or redirect {{tl|Property}}, to add a Wikidata property link to a Wikipedia page
*{{tl|Wikidata property}}, to add a Wikidata property {{tl|side box}} to a Wikipedia page or template documentation
*{{tl|Uses Wikidata}}, to add a Wikidata property box to the documentation of a template or module
*{{tl|Tracks Wikidata}}, to add a Wikidata property box to the documentation of a template, module, or category
*{{tl|Wikidata editnotice}}, an editnotice for articles that make extensive use of this template
}}
*{{tl|Pageid to title}}, to get a page title using its local page id, rather than Wikidata
<includeonly><!-- /doc page is transcluded on these two root pages: -->{{#switch:{{NAMESPACE}}:{{PAGENAME}}
|Module:Wd = [[Category:Wikidata modules]][[Category:Modules using data from Wikidata]]
|Template:WikidataOI |Template:Wikidata = [[Category:Wikidata templates]]
}}</includeonly>
kfcc3mosziieubqatwuz3rugcttkd5r
Template:WikidataOI/doc
10
9031
75020
2021-11-07T10:16:13Z
en>Thayts
0
75020
wikitext
text/x-wiki
{{Documentation subpage}}
{{Wikidata/doc|template={{ROOTPAGENAME}}|intro=This version of {{t|Wikidata}} includes an [[#Opt-in toggle|'''O'''pt-'''I'''n toggle]] (i.e. {{para|fetch|true}}, hence the name Wikidata'''OI'''). The template doesn't fetch any data by default unless the said parameter is set.
|seealso=*{{t|Wikidata}}, the same template but without the opt-in toggle.|extraparams=fetch{{=}}true|section=
== Opt-in toggle ==
The opt-in toggle is a convenience feature to allow data from Wikidata only to be fetched when explicitly requested. It consists of two named flags, which are name-value pairs (i.e. <code>{{!}}flag=value</code>), that can be given anywhere inside the call. The default behaviour (i.e. if the flags are not given or left empty) is not to fetch data from Wikidata. Note that a value consisting merely out of whitespace is also considered empty. The following table describes their usage.
<table class="wikitable">
<tr>
<th>Named flag</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<th style="text-align:right;"><code>fetch=</code></th>
<td>{{dfn|<code>{{0| }}</code>|title=empty}}</td>
<td>Used to request data to be fetched from Wikidata.
<p>Any non-empty value assigned to this flag (e.g. <code>{{!}}fetch=true</code>, <code>{{!}}fetch=false</code>, <code>{{!}}fetch=arbitrary</code>) will trigger the template to fetch data from Wikidata, but only if the <code>ifeq</code> flag is not given or empty.</p>
<p>If the <code>ifeq</code> flag is given and not empty, then the value assigned to this flag must be equal to the value of the <code>ifeq</code> flag to trigger the template to fetch data from Wikidata.</p>
<p>The default behaviour is not to fetch data from Wikidata.</p>
</td>
</tr>
<tr>
<th style="text-align:right;"><code>ifeq=</code></th>
<td>{{dfn|<code>{{0| }}</code>|title=empty}}</td>
<td>Adds a constraint to the value that the <code>fetch</code> flag must have before it triggers the template to fetch data from Wikidata.
<p>If the value assigned to this flag is non-empty, then data from Wikidata is only fetched if the <code>fetch</code> flag has the same value (e.g. <code>{{!}}fetch=true{{!}}ifeq=true</code> will trigger the template to fetch data, whereas <code>{{!}}fetch=false{{!}}ifeq=true</code> will not).</p>
</td>
</tr>
</table>}}
hnbhrh5ey8iouy19277logd2g82lvg2
75021
75020
2026-08-24T00:44:43Z
Robertsky
10424
1 versaun husi [[:en:Template:WikidataOI/doc]]
75020
wikitext
text/x-wiki
{{Documentation subpage}}
{{Wikidata/doc|template={{ROOTPAGENAME}}|intro=This version of {{t|Wikidata}} includes an [[#Opt-in toggle|'''O'''pt-'''I'''n toggle]] (i.e. {{para|fetch|true}}, hence the name Wikidata'''OI'''). The template doesn't fetch any data by default unless the said parameter is set.
|seealso=*{{t|Wikidata}}, the same template but without the opt-in toggle.|extraparams=fetch{{=}}true|section=
== Opt-in toggle ==
The opt-in toggle is a convenience feature to allow data from Wikidata only to be fetched when explicitly requested. It consists of two named flags, which are name-value pairs (i.e. <code>{{!}}flag=value</code>), that can be given anywhere inside the call. The default behaviour (i.e. if the flags are not given or left empty) is not to fetch data from Wikidata. Note that a value consisting merely out of whitespace is also considered empty. The following table describes their usage.
<table class="wikitable">
<tr>
<th>Named flag</th>
<th>Default</th>
<th>Description</th>
</tr>
<tr>
<th style="text-align:right;"><code>fetch=</code></th>
<td>{{dfn|<code>{{0| }}</code>|title=empty}}</td>
<td>Used to request data to be fetched from Wikidata.
<p>Any non-empty value assigned to this flag (e.g. <code>{{!}}fetch=true</code>, <code>{{!}}fetch=false</code>, <code>{{!}}fetch=arbitrary</code>) will trigger the template to fetch data from Wikidata, but only if the <code>ifeq</code> flag is not given or empty.</p>
<p>If the <code>ifeq</code> flag is given and not empty, then the value assigned to this flag must be equal to the value of the <code>ifeq</code> flag to trigger the template to fetch data from Wikidata.</p>
<p>The default behaviour is not to fetch data from Wikidata.</p>
</td>
</tr>
<tr>
<th style="text-align:right;"><code>ifeq=</code></th>
<td>{{dfn|<code>{{0| }}</code>|title=empty}}</td>
<td>Adds a constraint to the value that the <code>fetch</code> flag must have before it triggers the template to fetch data from Wikidata.
<p>If the value assigned to this flag is non-empty, then data from Wikidata is only fetched if the <code>fetch</code> flag has the same value (e.g. <code>{{!}}fetch=true{{!}}ifeq=true</code> will trigger the template to fetch data, whereas <code>{{!}}fetch=false{{!}}ifeq=true</code> will not).</p>
</td>
</tr>
</table>}}
hnbhrh5ey8iouy19277logd2g82lvg2
Diskusaun Template:WikidataOI
11
9032
75022
2024-08-27T17:21:37Z
en>Cewbot
0
[[User:Cewbot/log/20200122/configuration|Maintain {{WPBS}}]]: 1 WikiProject template. Create {{WPBS}}.
75022
wikitext
text/x-wiki
{{WikiProject banner shell|
{{WikiProject Wikidata}}
}}
{{tmbox|text=Use '''[[Wikipedia talk:Wikidata]]''' for general Wikidata support discussions.}}
{{tmbox|text=Use '''[[Module talk:Wd]]''' for discussions about this template that are not specifically related to the opt-in toggle.}}
== Verbosity ==
Instead of <code><nowiki>{{wikidataOI|property|Q156538|P141|fetch=true}}</nowiki></code> we should be able to use <code><nowiki>{{WOI|P|Q156538|P141|fetch=true}}</nowiki></code> and perhaps replace {{para|fetch|true}} with something short, also.
I've created {{tl|WOI}} as a redirect; can [[User:Thayts]] or someone else please implement the rest? <span class="vcard"><span class="fn">[[User:Pigsonthewing|Andy Mabbett]]</span> (<span class="nickname">Pigsonthewing</span>); [[User talk:Pigsonthewing|Talk to Andy]]; [[Special:Contributions/Pigsonthewing|Andy's edits]]</span> 16:06, 19 November 2020 (UTC)
:Adding a shorter alternative for {{para|fetch|true}} is relatively easy as that's a small change to this template (note that <code>true</code> can actually be replaced by anything, like <code>1</code>). Having shorter command names requires a change to the module. I'll take that into consideration. [[User:Thayts|<span style="color:#466383;font-family:Georgia;font-style:italic;letter-spacing:1px">Thayts</span>]] [[User talk:Thayts|<span style="color:#7892A5">•••</span>]] 20:09, 31 December 2020 (UTC)
ndzupmq3ovo46czf8hsejlkuozfsj1c
75023
75022
2026-08-24T00:44:43Z
Robertsky
10424
1 versaun husi [[:en:Template_talk:WikidataOI]]
75022
wikitext
text/x-wiki
{{WikiProject banner shell|
{{WikiProject Wikidata}}
}}
{{tmbox|text=Use '''[[Wikipedia talk:Wikidata]]''' for general Wikidata support discussions.}}
{{tmbox|text=Use '''[[Module talk:Wd]]''' for discussions about this template that are not specifically related to the opt-in toggle.}}
== Verbosity ==
Instead of <code><nowiki>{{wikidataOI|property|Q156538|P141|fetch=true}}</nowiki></code> we should be able to use <code><nowiki>{{WOI|P|Q156538|P141|fetch=true}}</nowiki></code> and perhaps replace {{para|fetch|true}} with something short, also.
I've created {{tl|WOI}} as a redirect; can [[User:Thayts]] or someone else please implement the rest? <span class="vcard"><span class="fn">[[User:Pigsonthewing|Andy Mabbett]]</span> (<span class="nickname">Pigsonthewing</span>); [[User talk:Pigsonthewing|Talk to Andy]]; [[Special:Contributions/Pigsonthewing|Andy's edits]]</span> 16:06, 19 November 2020 (UTC)
:Adding a shorter alternative for {{para|fetch|true}} is relatively easy as that's a small change to this template (note that <code>true</code> can actually be replaced by anything, like <code>1</code>). Having shorter command names requires a change to the module. I'll take that into consideration. [[User:Thayts|<span style="color:#466383;font-family:Georgia;font-style:italic;letter-spacing:1px">Thayts</span>]] [[User talk:Thayts|<span style="color:#7892A5">•••</span>]] 20:09, 31 December 2020 (UTC)
ndzupmq3ovo46czf8hsejlkuozfsj1c
Template:Pluralize from text/doc
10
9033
75040
2026-05-16T13:01:09Z
en>Andrybak
0
/* Examples */ move the section above /* TemplateData */
75040
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
{{Lua|Module:Detect singular}}
{{Tlb|Pluralize from text}} is used to detect if a text value is a plural list or not. Its intended usage is for infobox parameters, where the label might need to change from a singular version to a plural version.
For example, if an infobox uses a {{para|nickname}} parameter, the label might change from <code>Nickname</code> to <code>Nicknames</code> if the text value has more than one nickname.
The output of the template can be forced by including {{tl|force singular}} or {{tl|force plural}} in the generic parameter.
== Usage ==
* {{tlx|Pluralize from text|{{Var|text}}|singular{{=}}{{Var|singular output}}|likely{{=}}{{Var|likely plural output}}|plural{{=}}{{Var|plural output}}|link{{=}}{{Var|wikilink}}}}
* {{tlx|Pluralize from text|{{Var|text}}|{{Var|plural argument}}|{{Var|singular output}}|{{Var|plural output}}|{{Var|wikilink}}}}
==Examples==
* {{tlx|_show_result=yes|Pluralize from text|Chicagoan|singular{{=}}singular|plural{{=}}plural|}}
* {{tlx|_show_result=yes|Pluralize from text|761 and 345|singular{{=}}singular|plural{{=}}plural}}
* {{tlx|_show_result=yes|Pluralize from text|1{{=}}|2{{=}}761/345|singular{{=}}singular|plural{{=}}plural}}
* {{tlx|_show_result=yes|Pluralize from text|Chicagoan|singular{{=}}Demonym|plural{{=}}Demonyms|link{{=}}Demonym}}
* {{tlx|_show_result=yes|Pluralize from text|761 and 345|singular{{=}}Area Code|plural{{=}}Area Codes|link{{=}}Area code}}
==Parameters==
There are five named parameters that control the pluralization:
* {{para|no_comma}} – By default, [[comma]]s (or [[semicolon]]s) will cause the text string to be considered plural. Setting {{para|no_comma|1}} turns this behavior off.
* {{para|any_comma}} – By default, commas (or semicolons) that are adjacent to digits are singular. Setting {{para|any_comma|1}} turns this behavior off.
* {{para|no_and}} – By default, "and" causes a string to be plural. Setting {{para|no_and|1}} turns this behavior off.
* {{para|parse_links}} – By default, Wikilinks are considered to be unparseable (singular) objects. Setting {{para|parse_links|1}} will allow the parser to read the contents of the Wikilinks and determine whether that makes the string plural.
* {{para|parse_number}} – Setting {{para|parse_number|1}} will cause the first integer in the string to determine plurality.
Additional parameters:
* {{para|likely}} – The template makes a decision whether a string is a "likely plural" or a full "plural". The {{para|likely}} argument will be the output if the template determines that the string is only "likely plural". If {{para|likely}} is not given, "likely plural" and "plural" are treated identically.
* {{para|link}} – If the Wikilink is provided, the returned value will use that as a link, and the output will be the link's display text.
==TemplateData==
{{Format TemplateData|1=<templatedata>
{
"params": {
"1": {
"label": "Generic parameter",
"description": "Value of the wikitext parameter with unknown plurality",
"type": "content",
"required": true,
"example": "{{{language|}}}"
},
"2": {
"label": "Plural argument",
"description": "value of the wikitext parameter known to be plural",
"type": "string",
"example": "{{{languages|}}}"
},
"3": {
"label": "Singular output",
"description": "Label for the parameter if the value is singular",
"type": "string",
"required": false,
"aliases": [
"singular"
],
"example": "Language"
},
"4": {
"label": "Plural output",
"description": "Label for the parameter if the value is plural",
"type": "string",
"required": false,
"aliases": [
"plural"
],
"example": "Languages"
},
"5": {
"label": "Wikilink",
"description": "Page to link to in the label",
"type": "wiki-page-name",
"aliases": [
"link"
],
"example": "Language"
},
"no_comma": {
"label": "Turn off comma processing",
"description": "By default, commas and semicolons indicate plurals. Setting to \"yes\" turns this off.",
"type": "boolean",
"required": false,
"default": "No"
},
"any_comma": {
"label": "Any comma is plural",
"description": "By default, commas and semicolons that are adjacent to digits are singular. Setting to \"yes\" turns this behavior off.",
"type": "boolean",
"required": false,
"default": "No"
},
"no_and": {
"label": "\"And\" is not plural",
"description": "By default, \"and\" causes a string to be plural. Setting to \"yes\" turns this behavior off.",
"type": "boolean",
"required": false,
"default": "No"
},
"parse_links": {
"label": "Parse wikilinks",
"description": "By default, Wikilinks are considered to be unparseable (singular) objects. Setting to \"yes\" will allow the parser to read the contents of the Wikilinks and determine whether that makes the string plural.",
"type": "boolean",
"required": false,
"default": "No"
},
"parse_number": {
"label": "Parse numbers",
"description": "Setting to \"yes\" will cause the first integer in the string to determine plurality.",
"type": "boolean",
"required": false,
"default": "No"
},
"likely": {
"label": "Likely output",
"description": "Output when input is likely, but not certain, to be plural",
"type": "string",
"required": false
}
},
"description": "Helper template to adjust infobox field labels based on whether value is plural or not",
"paramOrder": [
"1",
"2",
"3",
"likely",
"4",
"5",
"no_comma",
"any_comma",
"no_and",
"parse_links",
"parse_number"
]
}
</templatedata>
}}
<includeonly>{{Sandbox other||
<!-- Categories below this line -->
[[Category:Text-specific formatting and function templates]]
}}</includeonly>
me6bxu7l87kro4r1bej83mo2jjz1vcx
75041
75040
2026-08-24T01:00:13Z
Robertsky
10424
1 versaun husi [[:en:Template:Pluralize_from_text/doc]]
75040
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
{{Lua|Module:Detect singular}}
{{Tlb|Pluralize from text}} is used to detect if a text value is a plural list or not. Its intended usage is for infobox parameters, where the label might need to change from a singular version to a plural version.
For example, if an infobox uses a {{para|nickname}} parameter, the label might change from <code>Nickname</code> to <code>Nicknames</code> if the text value has more than one nickname.
The output of the template can be forced by including {{tl|force singular}} or {{tl|force plural}} in the generic parameter.
== Usage ==
* {{tlx|Pluralize from text|{{Var|text}}|singular{{=}}{{Var|singular output}}|likely{{=}}{{Var|likely plural output}}|plural{{=}}{{Var|plural output}}|link{{=}}{{Var|wikilink}}}}
* {{tlx|Pluralize from text|{{Var|text}}|{{Var|plural argument}}|{{Var|singular output}}|{{Var|plural output}}|{{Var|wikilink}}}}
==Examples==
* {{tlx|_show_result=yes|Pluralize from text|Chicagoan|singular{{=}}singular|plural{{=}}plural|}}
* {{tlx|_show_result=yes|Pluralize from text|761 and 345|singular{{=}}singular|plural{{=}}plural}}
* {{tlx|_show_result=yes|Pluralize from text|1{{=}}|2{{=}}761/345|singular{{=}}singular|plural{{=}}plural}}
* {{tlx|_show_result=yes|Pluralize from text|Chicagoan|singular{{=}}Demonym|plural{{=}}Demonyms|link{{=}}Demonym}}
* {{tlx|_show_result=yes|Pluralize from text|761 and 345|singular{{=}}Area Code|plural{{=}}Area Codes|link{{=}}Area code}}
==Parameters==
There are five named parameters that control the pluralization:
* {{para|no_comma}} – By default, [[comma]]s (or [[semicolon]]s) will cause the text string to be considered plural. Setting {{para|no_comma|1}} turns this behavior off.
* {{para|any_comma}} – By default, commas (or semicolons) that are adjacent to digits are singular. Setting {{para|any_comma|1}} turns this behavior off.
* {{para|no_and}} – By default, "and" causes a string to be plural. Setting {{para|no_and|1}} turns this behavior off.
* {{para|parse_links}} – By default, Wikilinks are considered to be unparseable (singular) objects. Setting {{para|parse_links|1}} will allow the parser to read the contents of the Wikilinks and determine whether that makes the string plural.
* {{para|parse_number}} – Setting {{para|parse_number|1}} will cause the first integer in the string to determine plurality.
Additional parameters:
* {{para|likely}} – The template makes a decision whether a string is a "likely plural" or a full "plural". The {{para|likely}} argument will be the output if the template determines that the string is only "likely plural". If {{para|likely}} is not given, "likely plural" and "plural" are treated identically.
* {{para|link}} – If the Wikilink is provided, the returned value will use that as a link, and the output will be the link's display text.
==TemplateData==
{{Format TemplateData|1=<templatedata>
{
"params": {
"1": {
"label": "Generic parameter",
"description": "Value of the wikitext parameter with unknown plurality",
"type": "content",
"required": true,
"example": "{{{language|}}}"
},
"2": {
"label": "Plural argument",
"description": "value of the wikitext parameter known to be plural",
"type": "string",
"example": "{{{languages|}}}"
},
"3": {
"label": "Singular output",
"description": "Label for the parameter if the value is singular",
"type": "string",
"required": false,
"aliases": [
"singular"
],
"example": "Language"
},
"4": {
"label": "Plural output",
"description": "Label for the parameter if the value is plural",
"type": "string",
"required": false,
"aliases": [
"plural"
],
"example": "Languages"
},
"5": {
"label": "Wikilink",
"description": "Page to link to in the label",
"type": "wiki-page-name",
"aliases": [
"link"
],
"example": "Language"
},
"no_comma": {
"label": "Turn off comma processing",
"description": "By default, commas and semicolons indicate plurals. Setting to \"yes\" turns this off.",
"type": "boolean",
"required": false,
"default": "No"
},
"any_comma": {
"label": "Any comma is plural",
"description": "By default, commas and semicolons that are adjacent to digits are singular. Setting to \"yes\" turns this behavior off.",
"type": "boolean",
"required": false,
"default": "No"
},
"no_and": {
"label": "\"And\" is not plural",
"description": "By default, \"and\" causes a string to be plural. Setting to \"yes\" turns this behavior off.",
"type": "boolean",
"required": false,
"default": "No"
},
"parse_links": {
"label": "Parse wikilinks",
"description": "By default, Wikilinks are considered to be unparseable (singular) objects. Setting to \"yes\" will allow the parser to read the contents of the Wikilinks and determine whether that makes the string plural.",
"type": "boolean",
"required": false,
"default": "No"
},
"parse_number": {
"label": "Parse numbers",
"description": "Setting to \"yes\" will cause the first integer in the string to determine plurality.",
"type": "boolean",
"required": false,
"default": "No"
},
"likely": {
"label": "Likely output",
"description": "Output when input is likely, but not certain, to be plural",
"type": "string",
"required": false
}
},
"description": "Helper template to adjust infobox field labels based on whether value is plural or not",
"paramOrder": [
"1",
"2",
"3",
"likely",
"4",
"5",
"no_comma",
"any_comma",
"no_and",
"parse_links",
"parse_number"
]
}
</templatedata>
}}
<includeonly>{{Sandbox other||
<!-- Categories below this line -->
[[Category:Text-specific formatting and function templates]]
}}</includeonly>
me6bxu7l87kro4r1bej83mo2jjz1vcx
Template:Native name checker/doc
10
9034
75044
2025-02-18T12:44:11Z
en>GhostInTheMachine
0
link to the list
75044
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
{{Lua|Module:Native name}}
{{tld|Native name checker}} inspects the value in the {{para|native_name|}} parameter in infoboxes that support that parameter, and returns that value and, when appropriate, an error message.
== Usage ==
Typical use is:
:<syntaxhighlight lang="wikitext" inline="1">|dataxx={{Native name checker|{{{native_name|}}}}}</syntaxhighlight>
==Error messages==
{{tld|Native name checker}} returns these error messages:
* <span style="color:#d33">Error <nowiki>{{native name checker}}</nowiki>: parameter value is malformed</span> – {{para|native_name}} is expected to hold {{tlx|Native name}} or {{tlx|Native name list}}. The detector is looking for a <code>lang=</code> html attribute with a properly formatted [[IETF language tag]]. If not found, {{tld|Native name checker}} emits this error message.
* <span style="color:#d33">Error <nowiki>{{native name checker}}</nowiki>: list markup expected for multiple names</span> – when {{tld|Native name checker}} detects more than one name in {{para|native_name}}, those names are expected to be listed using appropriate list markup. The detector is looking for {{tag|div|attribs=class="plainlist"}} html list markup. When that markup is not detected, {{tlx|Native name checker}} emits this error message. Data from multiple {{tld|Native name}} templates can be combined into a single {{tld|Native name list}} template or multiple {{tld|Native name}} templates can be listed using {{tlx|Plainlist}}.
* <span style="color:#d33">Error <nowiki>{{native name checker}}</nowiki>: <br /> lists not allowed</span> – Per [[MOS:NOBREAKS]], the use of {{tag|br|s}} to separate items of a list is proscribed. Usually {{tag|br|s}}-separated lists are caught by the <span style="color:#d33">list markup expected</span> detector but, occasionally, not. The detector looks for a variety of acceptable and unacceptable {{tag|br|s}} variants. Data from multiple {{tld|Native name}} templates can be combined into a single {{tld|Native name list}} template or multiple {{tld|Native name}} templates can be listed using {{tlx|Plainlist}}.
Mainspace articles with any of the above errors are listed in {{cl|Native name checker template errors}}. A help link at the end of each error message links to this page.
==Tracking category==
{{Category link with count|Native name checker template errors}}
==See also==
* [[IETF language tag]] list
<includeonly>{{Sandbox other||
<!-- Categories below this line -->
[[Category:Name templates]]
}}</includeonly>
bhmvzlg2n7keet9h20wlndjwhsg51yl
75045
75044
2026-08-24T01:08:55Z
Robertsky
10424
1 versaun husi [[:en:Template:Native_name_checker/doc]]
75044
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
{{Lua|Module:Native name}}
{{tld|Native name checker}} inspects the value in the {{para|native_name|}} parameter in infoboxes that support that parameter, and returns that value and, when appropriate, an error message.
== Usage ==
Typical use is:
:<syntaxhighlight lang="wikitext" inline="1">|dataxx={{Native name checker|{{{native_name|}}}}}</syntaxhighlight>
==Error messages==
{{tld|Native name checker}} returns these error messages:
* <span style="color:#d33">Error <nowiki>{{native name checker}}</nowiki>: parameter value is malformed</span> – {{para|native_name}} is expected to hold {{tlx|Native name}} or {{tlx|Native name list}}. The detector is looking for a <code>lang=</code> html attribute with a properly formatted [[IETF language tag]]. If not found, {{tld|Native name checker}} emits this error message.
* <span style="color:#d33">Error <nowiki>{{native name checker}}</nowiki>: list markup expected for multiple names</span> – when {{tld|Native name checker}} detects more than one name in {{para|native_name}}, those names are expected to be listed using appropriate list markup. The detector is looking for {{tag|div|attribs=class="plainlist"}} html list markup. When that markup is not detected, {{tlx|Native name checker}} emits this error message. Data from multiple {{tld|Native name}} templates can be combined into a single {{tld|Native name list}} template or multiple {{tld|Native name}} templates can be listed using {{tlx|Plainlist}}.
* <span style="color:#d33">Error <nowiki>{{native name checker}}</nowiki>: <br /> lists not allowed</span> – Per [[MOS:NOBREAKS]], the use of {{tag|br|s}} to separate items of a list is proscribed. Usually {{tag|br|s}}-separated lists are caught by the <span style="color:#d33">list markup expected</span> detector but, occasionally, not. The detector looks for a variety of acceptable and unacceptable {{tag|br|s}} variants. Data from multiple {{tld|Native name}} templates can be combined into a single {{tld|Native name list}} template or multiple {{tld|Native name}} templates can be listed using {{tlx|Plainlist}}.
Mainspace articles with any of the above errors are listed in {{cl|Native name checker template errors}}. A help link at the end of each error message links to this page.
==Tracking category==
{{Category link with count|Native name checker template errors}}
==See also==
* [[IETF language tag]] list
<includeonly>{{Sandbox other||
<!-- Categories below this line -->
[[Category:Name templates]]
}}</includeonly>
bhmvzlg2n7keet9h20wlndjwhsg51yl
Template:Longitem/doc
10
9035
75048
2026-05-26T22:34:17Z
en>W.andrea
0
/* Effect */ Wait, this might be wrong. Remove at least for now.
75048
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
An inline formatting template primarily meant to handle the linewrapping of groupnames in {{tl|Navbox}}es or relatively long entries in infoboxes and sidebars. It reduces the padding between the text and the edge of the cell, minimizing the height of the <code>group</code> parameter.
== Parameters ==
* {{para|1}} - The item, i.e. the text to display
* {{para|style}} - Additional [[CSS]] code for styling
== Tracking categories ==
* {{Category link with count|Pages using Template:Longitem with unnamed style parameter}}
== See also ==
* {{tl|longlink}}
<includeonly>{{Sandbox other||
<!-- Categories below this line, please: -->
[[Category:Inline templates]]
[[Category:Text-specific formatting and function templates]]
}}</includeonly>
5ou99ervk10qqfxvajzcflvuiigisdb
75049
75048
2026-08-24T01:09:15Z
Robertsky
10424
1 versaun husi [[:en:Template:Longitem/doc]]
75048
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
An inline formatting template primarily meant to handle the linewrapping of groupnames in {{tl|Navbox}}es or relatively long entries in infoboxes and sidebars. It reduces the padding between the text and the edge of the cell, minimizing the height of the <code>group</code> parameter.
== Parameters ==
* {{para|1}} - The item, i.e. the text to display
* {{para|style}} - Additional [[CSS]] code for styling
== Tracking categories ==
* {{Category link with count|Pages using Template:Longitem with unnamed style parameter}}
== See also ==
* {{tl|longlink}}
<includeonly>{{Sandbox other||
<!-- Categories below this line, please: -->
[[Category:Inline templates]]
[[Category:Text-specific formatting and function templates]]
}}</includeonly>
5ou99ervk10qqfxvajzcflvuiigisdb
Template:Höhe/doc
10
9036
75053
2024-07-07T07:39:52Z
en>WOSlinker
0
add cat
75053
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
=== Usage ===
This template mirrors the one on German Wikipedia called ''[[:de:Vorlage:Höhe]]'' for interpreting height data based on a range of systems. It is currently being used on English Wikipedia to assist translation of hundreds of articles, e.g. on railway lines, mountains, rivers and other geographical features that record the heights based on standard German, Austrian or Swiss reference points.
The template contains world-wide datum information and could be used for any topographical purpose, to show heights above and below a particular datum. However, at present it will only translate height information based on German, Austrian or Swiss height reference systems into English, the rest should work but would appear in German.
===Format===
An example of the basic format is: <code><nowiki>{{Höhe|611|DE-NHN|link=true}}</nowiki></code>, which results in the statement "{{Höhe|611|DE-NHN|link=true}}".
If the parameter {{Para|link}} is set to "true", it produces a link to the definition of the [[Geodetic system#Vertical datum|vertical datum]]. In this case [[Normalhöhennull]].
=== See also ===
*[[Normalnull]] (outdated)
*[[Normalhöhennull]]
*[[Metres above the Adriatic]]
*[[Metres above the Sea (Switzerland)]]
<includeonly>{{Sandbox other||
[[Category:Topography|τ]]
[[Category:Topography templates]]
[[Category:Article translation assistance templates]]
}}</includeonly>
rh83h9rb2c5glxhh7pe2y9qmfskn0g4
75054
75053
2026-08-24T02:17:12Z
Robertsky
10424
1 versaun husi [[:en:Template:Höhe/doc]]
75053
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
=== Usage ===
This template mirrors the one on German Wikipedia called ''[[:de:Vorlage:Höhe]]'' for interpreting height data based on a range of systems. It is currently being used on English Wikipedia to assist translation of hundreds of articles, e.g. on railway lines, mountains, rivers and other geographical features that record the heights based on standard German, Austrian or Swiss reference points.
The template contains world-wide datum information and could be used for any topographical purpose, to show heights above and below a particular datum. However, at present it will only translate height information based on German, Austrian or Swiss height reference systems into English, the rest should work but would appear in German.
===Format===
An example of the basic format is: <code><nowiki>{{Höhe|611|DE-NHN|link=true}}</nowiki></code>, which results in the statement "{{Höhe|611|DE-NHN|link=true}}".
If the parameter {{Para|link}} is set to "true", it produces a link to the definition of the [[Geodetic system#Vertical datum|vertical datum]]. In this case [[Normalhöhennull]].
=== See also ===
*[[Normalnull]] (outdated)
*[[Normalhöhennull]]
*[[Metres above the Adriatic]]
*[[Metres above the Sea (Switzerland)]]
<includeonly>{{Sandbox other||
[[Category:Topography|τ]]
[[Category:Topography templates]]
[[Category:Article translation assistance templates]]
}}</includeonly>
rh83h9rb2c5glxhh7pe2y9qmfskn0g4
Template:Doc
10
9037
75056
2020-02-27T12:46:09Z
en>MSGJ
0
remove two categories and add rcat shell
75056
wikitext
text/x-wiki
#REDIRECT [[Template:Documentation]]
{{rcat shell|
{{R from template shortcut}}
}}
9lwgzjtu24rn0rx33yf4xwq9el62159
75057
75056
2026-08-24T02:31:38Z
Robertsky
10424
1 versaun husi [[:en:Template:Doc]]
75056
wikitext
text/x-wiki
#REDIRECT [[Template:Documentation]]
{{rcat shell|
{{R from template shortcut}}
}}
9lwgzjtu24rn0rx33yf4xwq9el62159
Template:Wikidata image/doc
10
9038
75058
2026-02-21T05:03:39Z
en>Hike395
0
/* See also */ rm deleted template
75058
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use|439000+}}
{{Tracks Wikidata|P18|cat=No local image but image on Wikidata}}
[[Template:Wikidata image]] may be added to infobox templates to implement tracking of articles using the infobox which might be improved by adding an image. When an article uses the infobox without an image, but the article's [[Wikidata]] has an image name, the article is added to a hidden tracking category ([[:Category:No local image but image on Wikidata|No local image but image on Wikidata]]). Once an image is added to the infobox, the article is removed from the category. The template also allows excluding individual articles from the category without adding an image.
== Usage ==
Add the following to a template (if necessary, change "image" to whatever parameter name that template uses to display an image):
:<code><nowiki>
<includeonly>{{Wikidata image |1={{{image|}}} }}</includeonly>
</nowiki></code>
To allow individual articles using the template to be excluded from the tracking category, add the following instead:
:<code><nowiki>
<includeonly>{{Wikidata image |1={{{image|}}} |2={{{nocat_wdimage|}}} }}</includeonly>
</nowiki></code>
== Parameters ==
This template accepts two unnamed parameters:
# (required) If no value is assigned, adds the tracking category. This should be the parameter name used by the infobox to display an image, usually <code><nowiki>{{{image|}}}</nowiki></code>.
# (optional) If any value is assigned, does not add the tracking category. This should be a parameter name used by the infobox to exclude an individual article from the category, usually <code><nowiki>{{{nocat_wdimage|}}}</nowiki></code>.
The template also accepts {{para|cat}} which is the name of the tracking category. The default is "No local image but image on Wikidata". Note that "Category:" or square brackets should not be used.
== Tracking categories ==
* {{clc|No local image but image on Wikidata}}
== Infoboxes using this template ==
* {{tl|Infobox person}} and [[:Category:Templates calling Infobox person|templates calling Infobox person]]
* {{tl|Infobox sportsperson}} and [[:Category:Templates calling Infobox sportsperson|templates calling Infobox sportsperson]]
* {{tl|Infobox football biography}}
* {{tl|Infobox bandy biography}}
* {{tl|Infobox aircraft begin}}
* {{tl|Infobox book}}
== See also ==
* [[User:Taketa/Wikidata Images]]
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wikidata templates]]
[[Category:Graphics templates]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
j27k9q9sq0lmmbwws3e0ae2ty050ihw
75059
75058
2026-08-24T02:31:39Z
Robertsky
10424
1 versaun husi [[:en:Template:Wikidata_image/doc]]
75058
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use|439000+}}
{{Tracks Wikidata|P18|cat=No local image but image on Wikidata}}
[[Template:Wikidata image]] may be added to infobox templates to implement tracking of articles using the infobox which might be improved by adding an image. When an article uses the infobox without an image, but the article's [[Wikidata]] has an image name, the article is added to a hidden tracking category ([[:Category:No local image but image on Wikidata|No local image but image on Wikidata]]). Once an image is added to the infobox, the article is removed from the category. The template also allows excluding individual articles from the category without adding an image.
== Usage ==
Add the following to a template (if necessary, change "image" to whatever parameter name that template uses to display an image):
:<code><nowiki>
<includeonly>{{Wikidata image |1={{{image|}}} }}</includeonly>
</nowiki></code>
To allow individual articles using the template to be excluded from the tracking category, add the following instead:
:<code><nowiki>
<includeonly>{{Wikidata image |1={{{image|}}} |2={{{nocat_wdimage|}}} }}</includeonly>
</nowiki></code>
== Parameters ==
This template accepts two unnamed parameters:
# (required) If no value is assigned, adds the tracking category. This should be the parameter name used by the infobox to display an image, usually <code><nowiki>{{{image|}}}</nowiki></code>.
# (optional) If any value is assigned, does not add the tracking category. This should be a parameter name used by the infobox to exclude an individual article from the category, usually <code><nowiki>{{{nocat_wdimage|}}}</nowiki></code>.
The template also accepts {{para|cat}} which is the name of the tracking category. The default is "No local image but image on Wikidata". Note that "Category:" or square brackets should not be used.
== Tracking categories ==
* {{clc|No local image but image on Wikidata}}
== Infoboxes using this template ==
* {{tl|Infobox person}} and [[:Category:Templates calling Infobox person|templates calling Infobox person]]
* {{tl|Infobox sportsperson}} and [[:Category:Templates calling Infobox sportsperson|templates calling Infobox sportsperson]]
* {{tl|Infobox football biography}}
* {{tl|Infobox bandy biography}}
* {{tl|Infobox aircraft begin}}
* {{tl|Infobox book}}
== See also ==
* [[User:Taketa/Wikidata Images]]
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wikidata templates]]
[[Category:Graphics templates]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
j27k9q9sq0lmmbwws3e0ae2ty050ihw