Википедия
rskwiki
https://rsk.wikipedia.org/wiki/%D0%93%D0%BB%D0%B0%D0%B2%D0%BD%D0%B8_%D0%B1%D0%BE%D0%BA
MediaWiki 1.47.0-wmf.20
first-letter
Медий
Окреме
Розгварка
Хаснователь
Розгварка зоз хасновательом
Википедия
Розгварка о Википедиї
Файл
Розгварка о файлу
МедияВики
Розгварка о МедияВикию
Шаблон
Розгварка о шаблону
Помоц
Розгварка о помоци
Катеґория
Розгварка о катеґориї
TimedText
TimedText talk
Модул
Разговор о модулу
Event
Event talk
Вербас
0
69
22033
21656
2026-09-18T15:25:13Z
Keresturec
18
22033
wikitext
text/x-wiki
{| class="wikitable" width="300px" align="right"
|+
! colspan="2" |<big>Вербас</big>
|-
| colspan="2" |[[Файл:Vrbas-bolnica.JPG|270px|center]]
|-
|{{center|Застава}}
|{{center|Герб}}
|-
|[[Файл:Rs-vrbas.gif|alt=Застава вароша Вербас|center|120px|безоквира]]
|[[Файл:Vrbas-grb.png|alt=Герб вароша Вербас|center|118x118px|безоквира]]
|-
! colspan="2" |Административни податки
|-
|'''Держава'''
|Сербия
|-
|'''Автономна покраїна'''
|[[Войводина]]
|-
|'''Управни округ'''
|Южнобачки
|-
|'''Општина'''
|Вербас
|-
! colspan="2" |Жительство
|-
|2022
|20.892
|-
|густосц
|244/km<sup>2</sup>
|-
| colspan="2" |
[[File:Serbia Vrbas.png|Serbia_Vrbas|423x423п]]
Вербас на мапи Сербиї
|-
! colspan="2" |Ґеоґрафски характеристики
|-
|Координати
|45° 34′ 10″ С; 19° 38′ 20″ В
|-
|Часова зона
|UTC+1 (CET), влєце UTC+2 (CEST)
|-
|Надморска висина
|78 m
|-
|[[Поверхносц]]
|107/km<sup>2</sup>
|-
! colspan="2" |Инши податки
|-
|Поштове число
|21460
21463
21464
|-
|Поволанкове число
|021
|-
|Реґистерски знак
|VS / ВС
|}
{{Infobox settlement|name=Вербас|official_name=Врбас|settlement_type=варош|other_name=Vrbas|native_name=Vrbas|image=Vrbas-bolnica.JPG}}
'''Вербас''' (серб. ''Врбас'') варошске населєнє и шедзиско општини з исту назву у Южнобачким округу. Спрам попису зоз 2022. року мал 20.892 жительох.
== Назви ==
Вербас познати и по тих назвох на других язикох: мадь. Verbász, рсн. Вербас, нєм. Werbass.
У чаше од 25. мая 1983. по 12. авґуст 1992. року Вербас ношел назву Титов Вербас на чесц предсидателя СФРЮ Йосипа Броза Тита<ref>Опћа енциклопедија – допунски свезак, Југославенски лексикографски завод, Загреб, (1988). стр. 694. </ref>. З приношеньом Закона о територийним дзелєню Сербиї врацена му дакедишня назва.
== Ґеоґрафия ==
Ґеоґрафске положенє Вербаса характеризую велї природно-ґеоґрафски и дружтвено-економски компоненти. Варош забера часц простору хтори ше находзи у ґеометрийним стредку Бачки. У варошу ше крижаю, на гайзибанскей станїци Вербас, гайзибански драги [[Суботица]]-Вербас-Беоґрад и Зомбор-Вербас. През Вербас преходза важни транспортни драги шлїдуюцих напрямох: Зомбор-Вербас-Нови Сад, Вербас-Бачка Паланка, Вербас-Суботица. Значну улогу маю и водово цеки хтори представяю часц гидросистеми Дунай-Тиса-Дунай. Вербас ше гранїчи зоз општинами: [[Општина Кула|Кула]], Мали Идьош, Србобран, Темерин, Нови Сад, Бачка Паланка и Оджак.
Вербас ма барз вигодне положенє и у топоґрафским поглядзе. Вон єдно спомедзи дзешец населєньох розпрестартих у подножю Телечки, т.є. точно на стику найвекшей бачкей лесней високоровнїни и лесней тераси. Вельки бачки беґель, викопани воздлуж по дакедишнїм цеку Чарней бари, дзелї Вербас на два нєєднаки часци. Положенє на контакту лесней високоровнїни як висшого и лесней тераси як нїзшого терену, дава Вербасу вецейнїсти вигодносци. Понеже Телечка у цалосци нагнута спрам югу (особлїво зоз периферийну часцу), та висша часц вербаского хотара ма ґу слунку вигодну експозицию. Вигодне положенє терену спрам слунка особлїво виражене при профилу часци терену хтори ше спуща на лесну терасу. Прето ше у прешлосци жителє намагали же би праве на тей часци садзели винову лозу або [[овоц]], а велї штучно зменшовали нагнутосц терену и на нїм будовали хижи.
== История ==
Перши споминаня у писаних жридлох о Вербасу походза зоз 1387. року. Медзитим история Вербаса ше пресцера вельо далєй до прешлосци. Дзекуюци археолоґийним виглєдованьом на локалитетох Чарнок, Шуваков салаш и цегляра Полет, надосц того о прешлосци Вербаса яснєйше. На побрежйох Чарней бари констатовани неолитски населєня. На Шуваковим салашу пренайдзена хижа хтора потвердзує потерашнї сознаня о тим же населєня з часци укопани до лесу, же мури хижох зоз плєценого пруца и же домашнї животинї уж теди були каждодньово зявенє у валалє. Зоз периоду бронзового часу констатован населєнє зоз некрополу такой при Чарноку. Барз значне находзиско з младшого желєзного часу на локалитету Чарнок-Бачке Добре Польо ше удатно защицує и виглєдує.
Зоз приходом Келтох на тоти подруча у другей половки 4. вику п. н. е, Чарнок постал келтски опидум и першенствено представя тарґовецки центер а познєйше здобува и одбранєбну улогу. Од 1. вику новей ери тоти простори часц барбарикума хтори ше находзи наспрам Римского царства и доживює директни уплїви Римскей цивилизациї. Источасно приходзи до насельованя Сарматох, припаднїкох иранских народох, хтори приноша и греческо-геленистични културни уплїви. Од 4. веку нашей ери тоти предїли заплюскую габи [[Народ|народох]] хтори були пошлїдок велькей селїдби народох. Найдлужей ше ту затримали Авари, о чим шведочи некропола на локалитету цегляра Полет. Початок 9. вику означує конєц аварскей доминациї и контролу Франкох а потим Болгарох над тима просторами.
Як рок кед бул основани Вербас ше бере 1213. як шедзиско маєтку двох дворянох под назву ''Орбаспалотая''. Спрам писаних жридлох ту жило углавним славянске жительство, преважно Серби, хтори на вецей заводи пре вилїви, войни або хороти напущовали населєнє. Року 1720 починаю вельки етнїчни пременки, Серби ше селя до Русиї и до Банату а почина колонизация Нємцох, Руснацох и Мадярох на тоти простори.
У 19. вику, дзекуюци тому же викопани беґель и збудована гайзибанска драга Пешта-Суботица-Нови Сад, Вербас вироснул до индустрийно-ремеселского тарґовинского центру. Отвераю ше нови основни школи, ремеселнїцки школи и ґимназия.
Под час Кральовини СГС/Югославиї Вербас творели два населєня и два општини, Стари Вербас як преважно сербске, и Нови Вербас як преважно нємецке населєнє. Дзелєла их лєм єдна улїчка, (нєшкайша Бачка улїчка) и Беґель краля Петра. Року 1930. одпочата акция на администрацийним злучованю општинох Стари и Нови Вербас алє, пре одпор домашнїх Нємцох, таке зєдиньованє ше нє збуло.
Як пошлїдок окупациї Югославиї у Другей шветовей войни и факта же 95% югославянских Нємцох були учленєти до профашистичней орґанизациї Културбунд и же ше декларовали як державянє Трецого райху<ref>Јелена Попов, Војводина и Србија, Ветерник, 2001, стр. 72 </ref>, нови повойново югославянски власци векшини нємецкого жительства у тедишнєй Югославиї (уключуюци ту и Нємцох з Вербасу) вжали граждански права и конфисковали им маєток. Векша часц югославянских Нємцох (коло 200.000) напущела територию Югославиї вєдно зоз окупацийним нємецким войском хторе ше поцаговало, менша часц Нємцох хтори остали на югославянскей териториї позаверани до лаґрох<ref>Z. Janjetović, Logorisanje vojvođanskih Nemaca od novembra 1944. do juna 1945. godine, Tokovi istorije, br. 1-2, Beograd, 1997. </ref>. Нємци з Вербасу одведзени до лаґрох у Бачким Ярку, Ґакове и Крушевлю, дзе даєдни спомедзи нїх помарли од гладу, жими и хоротох. После утаргованя лаґрох векшина преостатих Нємцох ше виселєла зоз жеми.
== Присельованє Нємцох ==
Присельованє Нємцох до Вербасу почало 21. юлия 1785. року. Фридрих Лоц винєсол податки же спомнутого [[Дзень|дня]] сцигли 283 нємецки фамелиї зоз 1.132 особами. Вон наведол и зоз хторих ше часцох Нємецкей вони приселєли: Фалц, Алзас-Лорен, Луксембурґ, Райнхесен, Хесен-Штаркенбурґ, Оберхесен, Саксония, Трир, Кобленц, Висбаден, Олденбурґ-Биркенфелд, Виртемберґ, Баварска и Баден. Окрем нїх, Лоц споминал и приселєнцох зоз Швайцарскей, Румуниї и Мадярскей<ref>Lotz, Friedrich (1935). Neuwerbaß : aus der Vergangenheit eines Batschkaer deutschen Sprachinseldorfes : 1785-1935. Festausschuß der 150-jährigen Ansiedlungsfeier. стр. 91. </ref>.
Часц хотара на хторей основани Нови Вербас дакеди старовербаски Серби брали под аренду и хасновали го як оранїни, пасовиска и пажици. Слово о таблох жеми ''Кис Добра'' и ''Параштинац''. Обидва тоти табли, а особлїво тота друга, були порихтани за обрабянє штредком 18. воку кед стари Вербас бул густо населєни. Як ше з часом число селянских фамелийох зменшовало так поля оставали празни, запущени. Єдна часц жительох Старого Вербасу напущела часц свойого хотара пре вельки порциї. Праве на тей напущеней часци хотара Нємци основали Нови Вербас 1785. року. Старовербаски Серби мали надосц жеми у чаше присельованя Нємцох: од 1.2 до 2 сесийох<ref>[https://sr.m.wiktionary.org/sr-ec/%D1%81%D0%B5%D1%81%D0%B8%D1%98%D0%B0 „сесија”]. Wiktionary.</ref>, а малочислени и по 3 сесиї<ref>Iványi, Istvan (1909). Bács-Bodrog vármegye községei. Budapest: Bács-Bodrog vármegye 1. стр. 173. </ref>.
З нагоди премерйованя хотара концом 1784. и на початку 1785. року Старому Вербасу охабени 176.5 а будуцому Новому Вербасу були додзелєни 125.5 сесиї. Окрем того, колонизацийски орґани вжали часц хотара хтора припадала Фекетичу и прилучели го ґу хотару Нового Вербаса. Вибудов населєня Нови Вербас тирвала длужей як два роки. Понеже дзепоєдни Нємци сцигли до Зомбора, як до центру за орґанизацию приманя и розмесцованя приселєнцох, ище вєшенї 1784. року вони мушели досц длуго чекац на вибудов спомнутого населєня. Истей тей єшенї селянє зоз сушедних валалох мушели на основу кулука поорац и зашац жем а нємецким приселєнцом було охабене же би окончели жатву и тлачидбу жита.
И Фридрих Лоц, подобнє як и хронїчаре з других локацийох хтори насельовали Нємци у Бачкей, писал о вельких почежкосцох доселєнцох у прилагодзованю до нового штредку. Вон особлїво указовал на мочарни терени коло Чарней бари хтори у велькей мири одбивали населєнцох. Перша ґенерация Нємцох була подложна хоротом малариї, дизентериї и других. З податкох хтори Лоц нашол у церковних кїжкох мож дознац же на початку смертельносц приселєнцох була досц велька та вони свойо нове населєнє наволали "гроб Нємцох"<ref>Lotz, Friedrich (1935). Neuwerbaß : aus der Vergangenheit eines Batschkaer deutschen Sprachinseldorfes : 1785-1935. Festausschuß der 150-jährigen Ansiedlungsfeier. Neuwerbaß. стр. 101.</ref>. По 1848. рок Стари Вербас бул "коморски валал" хтори бул баржей под управу зомборскей "комори" а нє феудалних дворянох. Прето вон бул, кед слово о правох и порцийох, у вигоднєйшим положеню од валалох хтори були у рамикох Воєней гранїци. Алє, и у коморских валалох живот бул чежки пре високи аренди и галавосц чиновнїкох. Же порциї и други обовязки були часто вельки и нєподношуюци мож видзиц и по тим же Старовербащанє були у єдней хвильки примушени одрекнуц ше часци свойого хотара на хторей ше познєйше населєли Нємци.
== Култура и образованє ==
Вигодне ґеоґрафске положенє и миґрациї оможлївели же би ше на териториї Вербаса зявели вчасни форми просвитного живота. Так ше поступнє отверали:
1735. Сербска церковна основна школа
1765. Руска основна школа
1790. Народна основна школа
Нєодлуга потим були отворени Єврейска, мишана державна, Нємецка и други школи. У Вербаше роби и Ґимназия ''Жарко Зренянин''.
Народна бибилиотека ''Данило Киш'' основана 1962. року зоз седем филиялами, два у Вербаше и по єдно у околних местох. У фонду библиотеки єст 103.000 кнїжки, а библиотека бере учасц у векшини културних манифестацийох у општини. Дом култури Вербас основани 1968. року а у його рамикох робел и биоскоп ''Югославия''.
Од 1969. року у Вербаше ше отримує ''Фестивал поезиї младих'', найстарши поетски фестивал у реґиону.
== Демоґрафия ==
У населєню Вербас жию 20.355 полнолїтни жителє, просекова старосц жительства виношо 38.1 рок (36,6 при хлопох и 39,9 при женох). У населєню єст 8.379 обисца, а просекове число членох по обисцу 3,08.
Жительство у тим населєню досц нєгомоґене, а у остатнїм попису замерковани значни пад у чишлє жительох.
'''Демоґрафия'''
{| class="wikitable"
|+
!Рок
! colspan="2" |Жителє
|-
|'''1948.'''
|14.837
|
|-
|'''1953.'''
|15.470
|
|-
|'''1961.'''
|19.316
|
|-
|'''1971.'''
|22.496
|
|-
|'''1981.'''
|25.143
|
|-
|'''1991.'''
|25.858
|25.610
|-
|'''2002.'''
|25.907
|26.198
|-
|'''2011.'''
|24.112
|
|}
== Етнїчни состав спрам попису з 2022 ==
{| class="wikitable"
|+
|Серби
|22.739
|62,13%
|-
|Чарногорци
|4.264
|11,65%
|-
|Руснаци
|2.833
|7,74%
|-
|Мадяре
|1.949
|5,33%
|-
|Українци
|626
|1,71%
|-
|Горвати
|379
|1,04%
|-
|Роми
|336
|0,92%
|-
|Словаци
|256
|0,7%
|-
|Югославянє
|151
|0,41%
|-
|Македонци
|119
|0,33%
|-
|Нємци
|72
|0,2%
|-
|Муслиманє
|61
|0,17%
|-
|Албанци
|52
|0,14%
|-
|Руси
|46
|0,13%
|-
|Словенци
|23
|0,06%
|-
|Бошняки
|23
|0,06%
|-
|Бунєвци
|12
|0,03%
|-
|Болгаре
|11
|0,03%
|-
|Румунє
|4
|0,01%
|-
|други
|155
|0,42%
|-
|Реґионална припадносц
|168
|0,46%
|-
|нєвияшнєти
|1.151
|3,14%
|-
|нєпознате
|1.171
|3,20%
|}
== Познати Вербащанє ==
* Лазар Ристовски, ґлумец
* Деян Луткич, ґлумец
* Бела Пехан, маляр
* Вида Оґнєнович, писателька
* Иґор Мароєвич, писатель
* Владимир Коларич, рок музичар
* Весна Дринчич Дїлас, културни дїяч и педаґоґ
* Нандор Майор, писатель и политичар
* Душан Баятович, политичар
* Боґолюб Бєлица, политичар
* Йован Белянски, учаснїк НОБ и народни герой Югославиї
* [[Авґустин Горняк]], грекокатолїцки владика у Велькей Британиї
* Йовица Елезович, рукометаш, олимпийски и швтови шампион
* Любомир Фейса, фодбалер
* Милорад Мажич, фодбалски судия
* Бянка Буша, одбойкашка, шветова и европска шампионка
* Маґдолна Ружа, шпивачка
* Йожеф Пехан
* Илия Милованчев
* Иса Секицки
* Павле Коїч
* Фридрих Лоц,
* Михаел Линденшмит
* Милета Лесковац
* Адриана Вилаґош, атлетичарка
* Милош Керкез, фодбалер
== Ґалерия ==
<gallery class="center">
Muzej u Vrbasu, Srpska pravoslavna crkva.tif|Православна церква у Вербасу
Vrbas, Evangelical church.jpg|Єванґелистична церква у Вербасу
Vrbas, Calvinist church.jpg|Реформаторска церква у Вербасу
Vrbas, Catholic Church.jpg|Католїцка церква у Вербасу
Muzej u Vrbasu, Grkokatolička crkva.tif|Грекокатолїцка церква у Вербасу
Muzej u Vrbasu, Metodističko-evangelistička crkva.tif|Методистско-єванґелистична церква у Вербасу
Muzej u Vrbasu, Kapela Vodice.tif|Каплїца Водица у Вербасу
</gallery>
== Литература ==
* Васовић, др Милорад (1968): Врбас и његова комуна - географска монографија. стр. 30.
== Вонкашнї вязи ==
* [https://commons.wikimedia.org/wiki/Category:Vrbas?uselang=sr Вербас] на Викиодоги
* [http://www.vrbas.net/ Урядови сайт вароша]
== Референци ==
[[Катеґория:Вербас|*]]
[[Катеґория:Вароши у Войводини]]
azb13eai3j79wb9bmsr50co5ec1orpz
22034
22033
2026-09-18T16:15:13Z
Sveletanka
20
вики вязи
22034
wikitext
text/x-wiki
{| class="wikitable" width="300px" align="right"
|+
! colspan="2" |<big>Вербас</big>
|-
| colspan="2" |[[Файл:Vrbas-bolnica.JPG|270px|center]]
|-
|{{center|Застава}}
|{{center|Герб}}
|-
|[[Файл:Rs-vrbas.gif|alt=Застава вароша Вербас|center|120px|безоквира]]
|[[Файл:Vrbas-grb.png|alt=Герб вароша Вербас|center|118x118px|безоквира]]
|-
! colspan="2" |Административни податки
|-
|'''Держава'''
|Сербия
|-
|'''Автономна покраїна'''
|[[Войводина]]
|-
|'''Управни округ'''
|Южнобачки
|-
|'''Општина'''
|Вербас
|-
! colspan="2" |Жительство
|-
|2022
|20.892
|-
|густосц
|244/km<sup>2</sup>
|-
| colspan="2" |
[[File:Serbia Vrbas.png|Serbia_Vrbas|423x423п]]
Вербас на мапи Сербиї
|-
! colspan="2" |Ґеоґрафски характеристики
|-
|Координати
|45° 34′ 10″ С; 19° 38′ 20″ В
|-
|Часова зона
|UTC+1 (CET), влєце UTC+2 (CEST)
|-
|Надморска висина
|78 m
|-
|[[Поверхносц]]
|107/km<sup>2</sup>
|-
! colspan="2" |Инши податки
|-
|Поштове число
|21460
21463
21464
|-
|Поволанкове число
|021
|-
|Реґистерски знак
|VS / ВС
|}
{{Infobox settlement|name=Вербас|official_name=Врбас|settlement_type=варош|other_name=Vrbas|native_name=Vrbas|image=Vrbas-bolnica.JPG}}
'''Вербас''' (серб. ''Врбас'') варошске населєнє и шедзиско општини з исту назву у Южнобачким округу. Спрам попису зоз 2022. року мал 20.892 жительох.
== Назви ==
Вербас познати и по тих назвох на других язикох: мадь. Verbász, рсн. Вербас, нєм. Werbass.
У чаше од [[25. май|25. мая]] 1983. по 12. авґуст 1992. року Вербас ношел назву Титов Вербас на чесц предсидателя СФРЮ Йосипа Броза Тита<ref>Опћа енциклопедија – допунски свезак, Југославенски лексикографски завод, Загреб, (1988). стр. 694. </ref>. З приношеньом Закона о територийним дзелєню Сербиї врацена му дакедишня назва.
== Ґеоґрафия ==
Ґеоґрафске положенє Вербаса характеризую велї природно-ґеоґрафски и дружтвено-економски компоненти. Варош забера часц простору хтори ше находзи у ґеометрийним стредку [[Бачка|Бачки]]. У варошу ше крижаю, на гайзибанскей станїци Вербас, гайзибански драги [[Суботица]]-Вербас-Беоґрад и Зомбор-Вербас. През Вербас преходза важни транспортни драги шлїдуюцих напрямох: Зомбор-Вербас-Нови Сад, Вербас-Бачка Паланка, Вербас-Суботица. Значну улогу маю и водово цеки хтори представяю часц гидросистеми Дунай-Тиса-Дунай. Вербас ше гранїчи зоз општинами: [[Општина Кула|Кула]], Мали Идьош, Србобран, Темерин, Нови Сад, Бачка Паланка и Оджак.
Вербас ма барз вигодне положенє и у топоґрафским поглядзе. Вон єдно спомедзи дзешец населєньох розпрестартих у подножю Телечки, т.є. точно на стику найвекшей бачкей лесней високоровнїни и лесней тераси. Вельки бачки беґель, викопани воздлуж по дакедишнїм цеку Чарней бари, дзелї Вербас на два нєєднаки часци. Положенє на контакту лесней високоровнїни як висшого и лесней тераси як нїзшого терену, дава Вербасу вецейнїсти вигодносци. Понеже Телечка у цалосци нагнута спрам югу (особлїво зоз периферийну часцу), та висша часц вербаского хотара ма ґу слунку вигодну експозицию. Вигодне положенє терену спрам слунка особлїво виражене при профилу часци терену хтори ше спуща на лесну терасу. Прето ше у прешлосци жителє намагали же би праве на тей часци садзели винову лозу або [[овоц]], а велї штучно зменшовали нагнутосц терену и на нїм будовали хижи.
== История ==
Перши споминаня у писаних жридлох о Вербасу походза зоз 1387. року. Медзитим история Вербаса ше пресцера вельо далєй до прешлосци. Дзекуюци археолоґийним виглєдованьом на локалитетох Чарнок, Шуваков [[салаш]] и цегляра Полет, надосц того о прешлосци Вербаса яснєйше. На побрежйох Чарней бари констатовани неолитски населєня. На Шуваковим салашу пренайдзена хижа хтора потвердзує потерашнї сознаня о тим же населєня з часци укопани до лесу, же мури хижох зоз плєценого пруца и же домашнї животинї уж теди були каждодньово зявенє у валалє. Зоз периоду бронзового часу констатован населєнє зоз некрополу такой при Чарноку. Барз значне находзиско з младшого желєзного часу на локалитету Чарнок-Бачке Добре Польо ше удатно защицує и виглєдує.
Зоз приходом Келтох на тоти подруча у другей половки 4. вику п. н. е, Чарнок постал келтски опидум и першенствено представя тарґовецки центер а познєйше здобува и одбранєбну улогу. Од 1. вику новей ери тоти простори часц барбарикума хтори ше находзи наспрам Римского царства и доживює директни уплїви Римскей цивилизациї. Источасно приходзи до насельованя Сарматох, припаднїкох иранских народох, хтори приноша и греческо-геленистични културни уплїви. Од 4. веку нашей ери тоти предїли заплюскую габи [[Народ|народох]] хтори були пошлїдок велькей селїдби народох. Найдлужей ше ту затримали Авари, о чим шведочи некропола на локалитету цегляра Полет. Початок 9. вику означує конєц аварскей доминациї и контролу Франкох а потим Болгарох над тима просторами.
Як рок кед бул основани Вербас ше бере 1213. як шедзиско маєтку двох дворянох под назву ''Орбаспалотая''. Спрам писаних жридлох ту жило углавним славянске жительство, преважно Серби, хтори на вецей заводи пре вилїви, войни або хороти напущовали населєнє. Року 1720 починаю вельки етнїчни пременки, Серби ше селя до Русиї и до Банату а почина колонизация Нємцох, [[Руснаци у Сербиї|Руснацох]] и Мадярох на тоти простори.
У 19. вику, дзекуюци тому же викопани беґель и збудована гайзибанска драга Пешта-Суботица-Нови Сад, Вербас вироснул до индустрийно-ремеселского тарґовинского центру. Отвераю ше нови основни школи, ремеселнїцки школи и ґимназия.
Под час Кральовини СГС/Югославиї Вербас творели два населєня и два општини, Стари Вербас як преважно сербске, и Нови Вербас як преважно нємецке населєнє. Дзелєла их лєм єдна улїчка, (нєшкайша Бачка улїчка) и Беґель краля Петра. Року 1930. одпочата акция на администрацийним злучованю општинох Стари и Нови Вербас алє, пре одпор домашнїх Нємцох, таке зєдиньованє ше нє збуло.
Як пошлїдок окупациї Югославиї у Другей шветовей войни и факта же 95% югославянских Нємцох були учленєти до профашистичней орґанизациї Културбунд и же ше декларовали як державянє Трецого райху<ref>Јелена Попов, Војводина и Србија, Ветерник, 2001, стр. 72 </ref>, нови повойново югославянски власци векшини нємецкого жительства у тедишнєй Югославиї (уключуюци ту и Нємцох з Вербасу) вжали граждански права и конфисковали им маєток. Векша часц югославянских Нємцох (коло 200.000) напущела територию Югославиї вєдно зоз окупацийним нємецким войском хторе ше поцаговало, менша часц Нємцох хтори остали на югославянскей териториї позаверани до лаґрох<ref>Z. Janjetović, Logorisanje vojvođanskih Nemaca od novembra 1944. do juna 1945. godine, Tokovi istorije, br. 1-2, Beograd, 1997. </ref>. Нємци з Вербасу одведзени до лаґрох у Бачким Ярку, Ґакове и Крушевлю, дзе даєдни спомедзи нїх помарли од гладу, жими и хоротох. После утаргованя лаґрох векшина преостатих Нємцох ше виселєла зоз жеми.
== Присельованє Нємцох ==
Присельованє Нємцох до Вербасу почало 21. юлия 1785. року. Фридрих Лоц винєсол податки же спомнутого [[Дзень|дня]] сцигли 283 нємецки фамелиї зоз 1.132 особами. Вон наведол и зоз хторих ше часцох Нємецкей вони приселєли: Фалц, Алзас-Лорен, Луксембурґ, Райнхесен, Хесен-Штаркенбурґ, Оберхесен, Саксония, Трир, Кобленц, Висбаден, Олденбурґ-Биркенфелд, Виртемберґ, Баварска и Баден. Окрем нїх, Лоц споминал и приселєнцох зоз Швайцарскей, Румуниї и Мадярскей<ref>Lotz, Friedrich (1935). Neuwerbaß : aus der Vergangenheit eines Batschkaer deutschen Sprachinseldorfes : 1785-1935. Festausschuß der 150-jährigen Ansiedlungsfeier. стр. 91. </ref>.
Часц [[Хотар|хотара]] на хторей основани Нови Вербас дакеди старовербаски Серби брали под аренду и хасновали го як оранїни, пасовиска и пажици. Слово о таблох жеми ''Кис Добра'' и ''Параштинац''. Обидва тоти табли, а особлїво тота друга, були порихтани за обрабянє штредком 18. воку кед стари Вербас бул густо населєни. Як ше з часом число селянских фамелийох зменшовало так поля оставали празни, запущени. Єдна часц жительох Старого Вербасу напущела часц свойого хотара пре вельки порциї. Праве на тей напущеней часци хотара Нємци основали Нови Вербас 1785. року. Старовербаски Серби мали надосц жеми у чаше присельованя Нємцох: од 1.2 до 2 сесийох<ref>[https://sr.m.wiktionary.org/sr-ec/%D1%81%D0%B5%D1%81%D0%B8%D1%98%D0%B0 „сесија”]. Wiktionary.</ref>, а малочислени и по 3 сесиї<ref>Iványi, Istvan (1909). Bács-Bodrog vármegye községei. Budapest: Bács-Bodrog vármegye 1. стр. 173. </ref>.
З нагоди премерйованя хотара концом 1784. и на початку 1785. року Старому Вербасу охабени 176.5 а будуцому Новому Вербасу були додзелєни 125.5 сесиї. Окрем того, колонизацийски орґани вжали часц хотара хтора припадала Фекетичу и прилучели го ґу хотару Нового Вербаса. Вибудов населєня Нови Вербас тирвала длужей як два роки. Понеже дзепоєдни Нємци сцигли до Зомбора, як до центру за орґанизацию приманя и розмесцованя приселєнцох, ище вєшенї 1784. року вони мушели досц длуго чекац на вибудов спомнутого населєня. Истей тей єшенї селянє зоз сушедних валалох мушели на основу кулука поорац и зашац жем а нємецким приселєнцом було охабене же би окончели жатву и тлачидбу [[Жито|жита]].
И Фридрих Лоц, подобнє як и хронїчаре з других локацийох хтори насельовали Нємци у Бачкей, писал о вельких почежкосцох доселєнцох у прилагодзованю до нового штредку. Вон особлїво указовал на мочарни терени коло Чарней бари хтори у велькей мири одбивали населєнцох. Перша ґенерация Нємцох була подложна хоротом малариї, дизентериї и других. З податкох хтори Лоц нашол у [[Богослужебни кнїжки|церковних кїжкох]] мож дознац же на початку смертельносц приселєнцох була досц велька та вони свойо нове населєнє наволали "гроб Нємцох"<ref>Lotz, Friedrich (1935). Neuwerbaß : aus der Vergangenheit eines Batschkaer deutschen Sprachinseldorfes : 1785-1935. Festausschuß der 150-jährigen Ansiedlungsfeier. Neuwerbaß. стр. 101.</ref>. По 1848. рок Стари Вербас бул "коморски валал" хтори бул баржей под управу зомборскей "комори" а нє феудалних дворянох. Прето вон бул, кед слово о правох и порцийох, у вигоднєйшим положеню од валалох хтори були у рамикох Воєней гранїци. Алє, и у коморских валалох живот бул чежки пре високи аренди и галавосц чиновнїкох. Же порциї и други обовязки були часто вельки и нєподношуюци мож видзиц и по тим же Старовербащанє були у єдней хвильки примушени одрекнуц ше часци свойого хотара на хторей ше познєйше населєли Нємци.
== Култура и образованє ==
Вигодне ґеоґрафске положенє и миґрациї оможлївели же би ше на териториї Вербаса зявели вчасни форми просвитного живота. Так ше поступнє отверали:
1735. Сербска церковна основна школа
1765. Руска основна школа
1790. Народна основна школа
Нєодлуга потим були отворени Єврейска, мишана державна, Нємецка и други школи. У Вербаше роби и Ґимназия ''Жарко Зренянин''.
Народна бибилиотека ''Данило Киш'' основана 1962. року зоз седем филиялами, два у Вербаше и по єдно у околних местох. У фонду библиотеки єст 103.000 кнїжки, а библиотека бере учасц у векшини културних манифестацийох у општини. Дом култури Вербас основани 1968. року а у його рамикох робел и биоскоп ''Югославия''.
Од 1969. року у Вербаше ше отримує ''Фестивал поезиї младих'', найстарши поетски фестивал у реґиону.
== Демоґрафия ==
У населєню Вербас жию 20.355 полнолїтни жителє, просекова старосц жительства виношо 38.1 рок (36,6 при хлопох и 39,9 при женох). У населєню єст 8.379 обисца, а просекове число членох по обисцу 3,08.
Жительство у тим населєню досц нєгомоґене, а у остатнїм попису замерковани значни пад у чишлє жительох.
'''Демоґрафия'''
{| class="wikitable"
|+
!Рок
! colspan="2" |Жителє
|-
|'''1948.'''
|14.837
|
|-
|'''1953.'''
|15.470
|
|-
|'''1961.'''
|19.316
|
|-
|'''1971.'''
|22.496
|
|-
|'''1981.'''
|25.143
|
|-
|'''1991.'''
|25.858
|25.610
|-
|'''2002.'''
|25.907
|26.198
|-
|'''2011.'''
|24.112
|
|}
== Етнїчни состав спрам попису з 2022 ==
{| class="wikitable"
|+
|Серби
|22.739
|62,13%
|-
|Чарногорци
|4.264
|11,65%
|-
|Руснаци
|2.833
|7,74%
|-
|Мадяре
|1.949
|5,33%
|-
|Українци
|626
|1,71%
|-
|Горвати
|379
|1,04%
|-
|Роми
|336
|0,92%
|-
|Словаци
|256
|0,7%
|-
|Югославянє
|151
|0,41%
|-
|Македонци
|119
|0,33%
|-
|Нємци
|72
|0,2%
|-
|Муслиманє
|61
|0,17%
|-
|Албанци
|52
|0,14%
|-
|Руси
|46
|0,13%
|-
|Словенци
|23
|0,06%
|-
|Бошняки
|23
|0,06%
|-
|Бунєвци
|12
|0,03%
|-
|Болгаре
|11
|0,03%
|-
|Румунє
|4
|0,01%
|-
|други
|155
|0,42%
|-
|Реґионална припадносц
|168
|0,46%
|-
|нєвияшнєти
|1.151
|3,14%
|-
|нєпознате
|1.171
|3,20%
|}
== Познати Вербащанє ==
* Лазар Ристовски, ґлумец
* Деян Луткич, ґлумец
* Бела Пехан, маляр
* Вида Оґнєнович, писателька
* Иґор Мароєвич, [[писатель]]
* Владимир Коларич, рок музичар
* Весна Дринчич Дїлас, културни дїяч и педаґоґ
* Нандор Майор, писатель и политичар
* Душан Баятович, политичар
* Боґолюб Бєлица, политичар
* Йован Белянски, учаснїк НОБ и народни герой Югославиї
* [[Авґустин Горняк]], грекокатолїцки владика у Велькей Британиї
* Йовица Елезович, рукометаш, олимпийски и шветови шампион
* Любомир Фейса, фодбалер
* Милорад Мажич, фодбалски судия
* Бянка Буша, одбойкашка, шветова и европска шампионка
* Маґдолна Ружа, шпивачка
* Йожеф Пехан
* Илия Милованчев
* Иса Секицки
* Павле Коїч
* Фридрих Лоц,
* Михаел Линденшмит
* Милета Лесковац
* Адриана Вилаґош, атлетичарка
* Милош Керкез, фодбалер
== Ґалерия ==
<gallery class="center">
Muzej u Vrbasu, Srpska pravoslavna crkva.tif|Православна церква у Вербасу
Vrbas, Evangelical church.jpg|Єванґелистична церква у Вербасу
Vrbas, Calvinist church.jpg|Реформаторска церква у Вербасу
Vrbas, Catholic Church.jpg|Католїцка церква у Вербасу
Muzej u Vrbasu, Grkokatolička crkva.tif|Грекокатолїцка церква у Вербасу
Muzej u Vrbasu, Metodističko-evangelistička crkva.tif|Методистско-єванґелистична церква у Вербасу
Muzej u Vrbasu, Kapela Vodice.tif|Каплїца Водица у Вербасу
</gallery>
== Литература ==
* Васовић, др Милорад (1968): Врбас и његова комуна - географска монографија. стр. 30.
== Вонкашнї вязи ==
* [https://commons.wikimedia.org/wiki/Category:Vrbas?uselang=sr Вербас] на Викиодоги
* [http://www.vrbas.net/ Урядови сайт вароша]
== Референци ==
[[Катеґория:Вербас|*]]
[[Катеґория:Вароши у Войводини]]
i75ebc36hni5l2uojp4vw6zm9jiviv5
Шаблон:Cite web
10
534
21795
2016-12-05T05:36:52Z
Anthony Appleyard
2747
Protected "[[Template:Cite web]]": restore old protection ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
21795
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</includeonly><noinclude>
{{documentation}}
</noinclude>
rcgmbcxu7hvs583g1f3rzz4c4dkizda
21796
21705
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Template:Cite_web]]: Importing from the English wikipedia
21705
wikitext
text/x-wiki
<includeonly>{{Citation/core
|Citation class=web
|Surname1 = {{#if:{{{last|}}}
|{{{last}}}
|{{#if:{{{last1|}}}
|{{{last1}}}
|{{{author|}}}
}}
}}
|Surname2 = {{{last2|{{{surname2|{{{author2|}}}}}}}}}
|Surname3 = {{{last3|}}}
|Surname4 = {{{last4|}}}
|Surname5 = {{{last5|}}}
|Surname6 = {{{last6|}}}
|Surname7 = {{{last7|}}}
|Surname8 = {{{last8|}}}
|Surname9 = {{{last9|}}}
|Given1 = {{#if:{{{first|}}}|{{{first}}}|{{{first1|}}}}}
|Given2 = {{{first2|}}}
|Given3 = {{{first3|}}}
|Given4 = {{{first4|}}}
|Given5 = {{{first5|}}}
|Given6 = {{{first6|}}}
|Given7 = {{{first7|}}}
|Given8 = {{{first8|}}}
|Given9 = {{{first9|}}}
|Authorlink1 = {{#if:{{{authorlink|}}}|{{{authorlink}}}|{{{authorlink1|}}}}}
|Authorlink2 = {{{authorlink2|}}}
|Authorlink3 = {{{authorlink3|}}}
|Authorlink4 = {{{authorlink4|}}}
|Authorlink5 = {{{authorlink5|}}}
|Authorlink6 = {{{authorlink6|}}}
|Authorlink7 = {{{authorlink7|}}}
|Authorlink8 = {{{authorlink8|}}}
|Authorlink9 = {{{authorlink9|}}}
|Coauthors = {{{coauthor|{{{coauthors|}}}}}}
|EditorSurname1 = {{{editor-last|{{{editor-surname|{{{editor1-last|{{{editor1-surname|{{{editor1|{{{editor|{{{editors|}}}}}}}}}}}}}}}}}}}}}
|EditorSurname2 = {{{editor2-last|{{{editor2-surname|{{{editor2|}}}}}}}}}
|EditorSurname3 = {{{editor3-last|{{{editor3-surname|{{{editor3|}}}}}}}}}
|EditorSurname4 = {{{editor4-last|{{{editor4-surname|{{{editor4|}}}}}}}}}
|EditorGiven1 = {{{editor-first|{{{editor-given|{{{editor1-first|{{{editor1-given|}}}}}}}}}}}}
|EditorGiven2={{{editor2-first|{{{editor2-given|}}}}}}
|EditorGiven3={{{editor3-first|{{{editor3-given|}}}}}}
|EditorGiven4={{{editor4-first|{{{editor4-given|}}}}}}
|Editorlink1={{{editor-link|{{{editor1-link|}}}}}}
|Editorlink2={{{editor2-link|}}}
|Editorlink3={{{editor3-link|}}}
|Editorlink4={{{editor4-link|}}}
|Year={{#if:{{{year|}}}|{{{year}}} <!-- attempt to derive year from date, if possible -->
|{{#if: {{{date|}}}
|{{#iferror: {{#time:Y|{{{date|}}} }}
|{{#iferror:{{#time:Y|{{{publication-date|einval}}} }}||{{#time:Y|{{{publication-date|}}} }}}}
|{{#time:Y|{{{date|}}} }}
}}
|{{{publication-date|}}} <!-- last resort -->
}}
}}
|Date = {{#if:{{{date|}}}|{{{date}}}|{{{day|}}} {{{month|}}} {{#if:{{{year|}}}|{{{year}}}|{{{publication-date|}}}}}}}
|Title={{{work|}}}
|TransTitle={{{trans_title|}}}
|At = {{#if:{{{page|}}}|p. {{{page}}}|{{#if:{{{pages|}}}|pp. {{{pages|}}}|{{{at|}}} }} }}
|IncludedWorkTitle = {{
#if:{{{title|}}}
|{{{title}}}
|{{
#if:{{{trans_title|}}}
|
|{{Citation error|no <code>|title=</code> specified|Cite web}}
}}
}}
|IncludedWorkURL = {{#if:{{{archiveurl|}}}|{{{archiveurl|}}}|{{{url|}}}}}
|PublicationPlace = {{{location|}}}
|Publisher = {{{publisher|}}}
|language = {{{language|}}}
|format = {{{format|}}}
|DOI={{{doi|{{{DOI|}}}}}}
|AccessDate={{
#if:{{{access-date|{{{accessdate|}}} }}}
|{{#if: {{{accessyear|}}}
|{{{access-date|{{{accessdate}}} }}} {{{accessyear}}}
|{{{access-date|{{{accessdate}}} }}} }}
|{{{accessday|}}} {{{accessmonth|}}} {{{accessyear|}}}
}}
|DateFormat={{#if:{{{dateformat|}}}|{{{dateformat}}}|none}}
|quote = {{{quote|}}}
|Ref={{{ref|}}}
|Sep = {{#ifeq:{{{separator|{{{seperator}}} }}}|;|;|{{{separator|{{{seperator|.}}} }}} }}
|PS={{#if:{{{quote|}}}||{{{postscript|.}}}}}
|ArchiveURL = {{{archiveurl|}}}
|OriginalURL = {{{url|}}}
|ArchiveDate= {{{archivedate|}}}
}}{{#if:{{{accessdaymonth|}}}{{{accessmonthday|}}}{{{accessday|}}}{{{accessmonth|}}}{{{accessyear|}}}{{{day|}}}{{{dateformat|}}}
|<span class="test" style="display:none;">[[Template:Cite web]]: used deprecated params: {{{accessdaymonth}}}; {{{accessmonthday}}};{{{accessday}}}; {{{accessmonth}}}; {{{accessyear}}}; {{{day}}}; {{{dateformat}}};</span>
[[Category:Pages containing cite templates with deprecated parameters|{{NAMESPACE}} {{PAGENAME}}]]}}</includeonly><noinclude>
Шаблон на цитованє жридла зоз вебу. Язик (атрибут language) автоматично ше додава в конструкцию „в <nowiki>{{language}}</nowiki>м язику“, наприклад кед language=руски, в резултату будзе видно „в руским язику“.
0at9i09y5o0wxe9n14mxt91aaso5wub
Шаблон:Langx
10
550
21887
5859
2026-09-05T22:53:40Z
Plastikspork
2767
[[Wikipedia:Templates for discussion/Log/2026 August 23#Template:Lang-ro-Cyrl]] closed as keep ([[WP:XFDC#4.0.16|XFDcloser]])
21887
wikitext
text/x-wiki
<includeonly>{{#invoke:lang|langx}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
b2t9lzvo8lxg4ixz37k2ittlrezox1h
21888
21887
2026-09-18T15:05:31Z
Keresturec
18
1 измена увезена из [[:en:Template:Langx]]: Importing from the English wikipedia
21887
wikitext
text/x-wiki
<includeonly>{{#invoke:lang|langx}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
b2t9lzvo8lxg4ixz37k2ittlrezox1h
Мотиль
0
682
21744
20495
2026-09-18T13:54:46Z
Sveletanka
20
катеґория
21744
wikitext
text/x-wiki
{| class="wikitable" align=right width=300px
|+
! colspan="2" |Мотилї
|-
| colspan="2" |
[[File:Inachis io Lill-Jansskogen.JPG|300px|center]]
|-
! colspan="2" |[[Таксономия (биолоґия)|Наукова класификация]]
|-
|valign="top"|
'''Домен:'''
'''Царство:'''
'''Тип:'''
'''Класа:'''
'''(нєранґоване):'''
'''Ряд:'''
|valign="top"|
Eukaryota
Animalia
Arthropoda
Insecta
Amphiesmenoptera
Lepidoptera [[Карл фон Лине|Linnaeus]], 1758
|-
! colspan="2" |Надфамилиї
|-
| colspan="2" |
* Hesperioidea
* Hedyloidea
* Papilionoidea
* Micropterigoidea
* Heterobathmioidea
* Eriocranioidea
* Acanthopteroctetoidea
* Lophocoronoidea
* Neopseustoidea
* Mnesarchaeoidea
* Hepialoidea
* Nepticuloidea
* Incurvarioidea
* Palaephatoidea
* Tischeriodea
* Simaethistoidea
* Tineoidea
* Gracillarioidea
* Yponomeutoidea
* Gelechioidea
* Zygaenoidea
* Sesioidea
* Cossoidea
* Tortricoidea
* Choreutoida
* Urodoidea
* Galacticoidea
* Schreckensteinioidea
* Epermenioidea
* Pterophoroidea
* Aluctoidea
* Immoidea
* Axioidea
* Hyblaeoidea
* Thyridoidea
* Whalleyanoidea
* Pyraloidea
* Mimallonoidea
* Lasiocampoidea
* Geometroidea
* Drepanoidea
* Bombycoidea
* Calliduloidae
* Noctuoidea
|}
'''Мотилї''' (лат. ''Lepidoptera'', серб. ''лептири'', поль. ''motyle'', слц. ''motýle'') други по велькосци ряд инсектох, хторому припадаю [[Дзень|дньово]] мотилї, молї и ноцни мотилї. Одроснути єдинки маю два пари мембранасти кридла и устов апарат прилагодзени за хлїпанє.
Ряд ма коло 180.000 файти подзелєни до 127 фамилийох и 46 надфамилийох. Дньово мотилї (Rhopalocera) то вельки кладус зоз шора мотильох (Lepidoptera). Одроснути дньово мотилї маю вельки, часто кричацо офарбени кридла, хтори обачлїво трепеца док лєца.
Мотилї преходза през подполну метаморфозу, хтора облапя штири фази животного циклусу. Кридлати одроснути єдинки нєшу вайца на рошлїну зоз хтору ше їх лїчинки, познати як гушенїци, буду кармиц. Гушенїци рошню, дзекеди барз швидко, а кед ше зошицким розвию, заґалеткую ше до бабки. Кед ше метаморфоза закончи, скорка на бабки ше подре, одроснути инсект ше пендра и кед ше кридла преширя и осуша, вон одлєци. Даєдни мотилї, окреме у тропских крайох, маю даскельо ґенерациї у єдним року, док други маю єдну ґенерацию, а даєдним файтом хтори населюю жимнєйши бивальнїки, треба и даскельо роки же би прешли през цали животни циклус.
Мотилї часто полиморфни и велї файти хасную камуфлажу и мимикрую же би обкеровали своїх предаторох. Даєдни мотилї и молї жию у симбиози або коменсалилизме з другима орґанизмами (напр. з брамушками). На велї мотилї нападаю паразити и паразитоїди, хтори жию у целох других орґанизмох, уключуюци протозои, двокридлово инсекти, даєдни файти осох и других безпохребцинарох, або су плєн других орґанизмох. Даєдни файти мотильох чкодлївци (док су у фази лїчинки), бо можу очкодовац домашнї шаца або древа; други файти опращковаче даєдних рошлїнох, а гушенїци даєдних файтох мотильох єдза чкодлїви инсекти.
== Биолоґия ==
'''Основни прикмети''' – Одроснути мотилї маю два пари кридла рижних [[фарба|фарбох]] хтори пиґментовани з меланином, цо им дава чарну и кафову фарбу, як и з дериватами уринскей квашнїни и флавонами хтори им даваю жовту фарбу, а микроструктури лупкох и мохоткох правя структурну офарбеносц од хторей походза белава, желєна, червена фарба и ефект прелїваня у дугових фарбох.
Як и при шицких инсектох, '''цело мотильох''' подзелєне на три часци: главу (''caput)'', перша ''(thorax)'' и брух (''abdomen)''. Перша маю три сеґменти, кажди з єдну пару ногох. За розлику од векшини фамилийох дньових мотильох, моль може мац цверенкасти або пиркасти антени. Цицалка, кед ше нє хаснує, скруцена до спирали, а хаснує ше за цицанє нектару з квиткох.
'''Кридла''' дньових мотильох релативно блядих фарбох, за розлику од векшини мольох хтори лєца вноци и чийо кридла часто офарбени так же им оможлївюю добру камуфлажу. Дньово мотилї, кед мирую, тримаю кридла просто над целом, а молї тримаю свойо кридла водоровно (при чим кридла дорушую [[поверхносц]] на хторей моль стої) або их зукосом положа прейґ цела.
'''Лїчинки''' дньових мотильох, гушенїци, маю моцни глави на хторих змесцени кратки моцни устови прибор за кусанє [[Пожива|поживи]], найчастейше лїсца. Маю цилиндрични цела, брух ма дзешец сеґменти, звичайно зоз пейцома парами фалшивих ногох на сеґментох 3, 4, 5, 6 и 10; на першох ше находза три пари правих ногох хтори маю пейц сеґменти. Велї гушенїци добре камуфловани; други апостематики блядих фарбох хтори маю шерсцоки з токсичнима хемикалиями з рошнїнох хтори єдза. Бабки дньових мотильох, за розлику од мольох, нє закруцени до ґалеткох. Велї файти мотильох полно диморфни. Векшина файтох дньових мотильох ма ZW детерминацию полу, дзе женски пол гетероґаметни, а хлопски гомоґаметни.
== Миґрация ==
Велї дньово мотилї преходза вельки оддалєносци под час своїх миґрацийох. Тоти миґрациї ше можу одвивац у вецей ґенерацийох и анї єдна поєдинєчно нє закончи цалу драгу. Популация монархох у восточней Сиверней Америки, же би ше прежимовала, лєци на югозаход до Мексика, при чим преходзи на тисячи километри. На яр приходзи до миґрациї у процивним напряме.
Дньово мотилї ше ориєнтую припатраюци ше на нєбо. Вони видза поларизовану [[шветлосц]], та ше прето можу ориєнтовац аж и кед похмарене.
== Ваїчка ==
Ваїчка дньових мотильох защицени з тварду часцу вонкашнього пасма обмотку хтори ше вола хорион. Вон обложени з ценким пасмом воску хтори чува ваїчко од висушованя пред тим як цо лїчинка ма часу зошицким ше розвиц. Кажде ваїчко ма вельке число дробни отвори тевчирох на єдним концу. Циль тих дзиркох оможлївиц же би сперма вошла и оплодзела ваїчкову клїтинку. Ваїчка дньових мотильох варирую по велькосци и форми медзи файтами, алє су звичайно у вертикалним положеню и крашнє моделовани. Даєдни файти мотильох нєшу ваїчка поєдинєчно, а други у серийох. Велї самички знєшу медзи сто и двасто ваїчка.
[[File:Weiße Baumnymphe Idea leuconoe 3 Richard Bartz.jpg|right|thumb|303x303px|Мотиль]]
Ваїчка дньових мотильох притвердзени за лїсце з окремним лїпкачом хторе швидко постава тварде. Тото лїпкаче деформує ваїчка, а мож го лєгко видзиц бо окружує базу каждого ваїчка и формує менискус.
Ваїчка скоро вше на рошлїнох. Кажда файта дньового мотиля ма свою палету рошлїнох-домашнїх. Даєдни файти дньових мотильох огранїчени лєм на єдну файту рошлїни, а други хасную вецей рошлїнски файти, часто уключуюци и припаднїкох єдней фамилиї.
Фаза ваїчка тирва даскельо тижнї при векшини файтох дньових мотильох, алє ваїчка знєшени пред саму жиму, окреме у реґионох з умерену климу, прехода през фазу дияпаузи (мированя), а вилягню ше лєм на яр. Даєдни дньово мотилї з реґионох цо маю умерену климу, знєшу ваїчка на яр, а гушенїци ше вилягню на лєто.
== Гушенїци ==
Лїчинки дньових мотильох – гушенїци єдза лїсце рошлїнох и препровадзую практично цали свой час у єдзеню и глєданю єдзеня. Гоч гушенїци векшини файтох рошлїноєди, гушенїци даєдних файтох предатори: Spalgis epius є щитасти уши, а файти з фамилиї белавих мотильох, як цо Liphyra brassolis, єдза лїчинки брамушкох. Вони комуникую з брамушками так же хасную вибрациї хтори ше преноша през подлогу. Брамушки даваю одредзени ступень защити тим гушенїцом, а вони натомест вилучую медову росичку. Даєдни гушенїци наводза брамушки з роду ''Myrmica'' же бих однєсли до брамушкових колонийох, дзе єдза брамушково ваїчка и лїчинки.
'''Природни нєприятелє''' – Найчастейши природни нєприятелє дньових мотильох птици, а ноцних - пергаче. Мухи нєшу ваїчка на гушенїци, а навалентни оси - до гушенїци. Гушенїцово цело служи як покарма лїчинком паразитскей мухи або оси. Хватаци птици и паразити отримую природну ровновагу и онєможлївюю же би ше мотилї барз намножели и же би їх гушенїци нанєсли чкоди рошлїном кармительком.
== Литература ==
* Оксана Тимко Дїтко, ''Назви рошлїнох и животиньох у руским язику,'' Вуковар 2016, б. 14, 15, 6, 17.
== Вонкашнї вязи ==
* [https://sh.wikipedia.org/wiki/Leptir Лептир.] Википедија на српскохрватском језику, sh.wikipedia.org/wiki/
* [https://sr.wikipedia.org/sr-ec/%D0%9B%D0%B5%D0%BF%D1%82%D0%B8%D1%80%D0%B8 Лептири.] Википедија на српском језику, sr.wikipedia.org/sr-ec/
[[Катеґория:Инсекти]]
[[Катеґория:Безпохребцинаре]]
[[Катеґория:Мотилї]]
pzwxjjc4hvbutcuewmu91tsvtsbhms8
21747
21744
2026-09-18T13:56:18Z
Sveletanka
20
21747
wikitext
text/x-wiki
{| class="wikitable" align=right width=300px
|+
! colspan="2" |Мотилї
|-
| colspan="2" |
[[File:Inachis io Lill-Jansskogen.JPG|300px|center]]
|-
! colspan="2" |[[Таксономия (биолоґия)|Наукова класификация]]
|-
|valign="top"|
'''Домен:'''
'''Царство:'''
'''Тип:'''
'''Класа:'''
'''(нєранґоване):'''
'''Ряд:'''
|valign="top"|
Eukaryota
Animalia
Arthropoda
Insecta
Amphiesmenoptera
Lepidoptera [[Карл фон Лине|Linnaeus]], 1758
|-
! colspan="2" |Надфамилиї
|-
| colspan="2" |
* Hesperioidea
* Hedyloidea
* Papilionoidea
* Micropterigoidea
* Heterobathmioidea
* Eriocranioidea
* Acanthopteroctetoidea
* Lophocoronoidea
* Neopseustoidea
* Mnesarchaeoidea
* Hepialoidea
* Nepticuloidea
* Incurvarioidea
* Palaephatoidea
* Tischeriodea
* Simaethistoidea
* Tineoidea
* Gracillarioidea
* Yponomeutoidea
* Gelechioidea
* Zygaenoidea
* Sesioidea
* Cossoidea
* Tortricoidea
* Choreutoida
* Urodoidea
* Galacticoidea
* Schreckensteinioidea
* Epermenioidea
* Pterophoroidea
* Aluctoidea
* Immoidea
* Axioidea
* Hyblaeoidea
* Thyridoidea
* Whalleyanoidea
* Pyraloidea
* Mimallonoidea
* Lasiocampoidea
* Geometroidea
* Drepanoidea
* Bombycoidea
* Calliduloidae
* Noctuoidea
|}
'''Мотилї''' (лат. ''Lepidoptera'', серб. ''лептири'', поль. ''motyle'', слц. ''motýle'') други по велькосци ряд инсектох, хторому припадаю [[Дзень|дньово]] мотилї, молї и ноцни мотилї. Одроснути єдинки маю два пари мембранасти кридла и устов апарат прилагодзени за хлїпанє.
Ряд ма коло 180.000 файти подзелєни до 127 фамилийох и 46 надфамилийох. Дньово мотилї (Rhopalocera) то вельки кладус зоз шора мотильох (Lepidoptera). Одроснути дньово мотилї маю вельки, часто кричацо офарбени кридла, хтори обачлїво трепеца док лєца.
Мотилї преходза през подполну метаморфозу, хтора облапя штири фази животного циклусу. Кридлати одроснути єдинки нєшу вайца на рошлїну зоз хтору ше їх лїчинки, познати як гушенїци, буду кармиц. Гушенїци рошню, дзекеди барз швидко, а кед ше зошицким розвию, заґалеткую ше до бабки. Кед ше метаморфоза закончи, скорка на бабки ше подре, одроснути инсект ше пендра и кед ше кридла преширя и осуша, вон одлєци. Даєдни мотилї, окреме у тропских крайох, маю даскельо ґенерациї у єдним року, док други маю єдну ґенерацию, а даєдним файтом хтори населюю жимнєйши бивальнїки, треба и даскельо роки же би прешли през цали животни циклус.
Мотилї часто полиморфни и велї файти хасную камуфлажу и мимикрую же би обкеровали своїх предаторох. Даєдни мотилї и молї жию у симбиози або коменсалилизме з другима орґанизмами (напр. з брамушками). На велї мотилї нападаю паразити и паразитоїди, хтори жию у целох других орґанизмох, уключуюци протозои, двокридлово инсекти, даєдни файти осох и других безпохребцинарох, або су плєн других орґанизмох. Даєдни файти мотильох чкодлївци (док су у фази лїчинки), бо можу очкодовац домашнї шаца або древа; други файти опращковаче даєдних рошлїнох, а гушенїци даєдних файтох мотильох єдза чкодлїви инсекти.
== Биолоґия ==
'''Основни прикмети''' – Одроснути мотилї маю два пари кридла рижних [[фарба|фарбох]] хтори пиґментовани з меланином, цо им дава чарну и кафову фарбу, як и з дериватами уринскей квашнїни и флавонами хтори им даваю жовту фарбу, а микроструктури лупкох и мохоткох правя структурну офарбеносц од хторей походза белава, желєна, червена фарба и ефект прелїваня у дугових фарбох.
Як и при шицких инсектох, '''цело мотильох''' подзелєне на три часци: главу (''caput)'', перша ''(thorax)'' и брух (''abdomen)''. Перша маю три сеґменти, кажди з єдну пару ногох. За розлику од векшини фамилийох дньових мотильох, моль може мац цверенкасти або пиркасти антени. Цицалка, кед ше нє хаснує, скруцена до спирали, а хаснує ше за цицанє нектару з квиткох.
'''Кридла''' дньових мотильох релативно блядих фарбох, за розлику од векшини мольох хтори лєца вноци и чийо кридла часто офарбени так же им оможлївюю добру камуфлажу. Дньово мотилї, кед мирую, тримаю кридла просто над целом, а молї тримаю свойо кридла водоровно (при чим кридла дорушую [[поверхносц]] на хторей моль стої) або их зукосом положа прейґ цела.
'''Лїчинки''' дньових мотильох, гушенїци, маю моцни глави на хторих змесцени кратки моцни устови прибор за кусанє [[Пожива|поживи]], найчастейше лїсца. Маю цилиндрични цела, брух ма дзешец сеґменти, звичайно зоз пейцома парами фалшивих ногох на сеґментох 3, 4, 5, 6 и 10; на першох ше находза три пари правих ногох хтори маю пейц сеґменти. Велї гушенїци добре камуфловани; други апостематики блядих фарбох хтори маю шерсцоки з токсичнима хемикалиями з рошнїнох хтори єдза. Бабки дньових мотильох, за розлику од мольох, нє закруцени до ґалеткох. Велї файти мотильох полно диморфни. Векшина файтох дньових мотильох ма ZW детерминацию полу, дзе женски пол гетероґаметни, а хлопски гомоґаметни.
== Миґрация ==
Велї дньово мотилї преходза вельки оддалєносци под час своїх миґрацийох. Тоти миґрациї ше можу одвивац у вецей ґенерацийох и анї єдна поєдинєчно нє закончи цалу драгу. Популация монархох у восточней Сиверней Америки, же би ше прежимовала, лєци на югозаход до Мексика, при чим преходзи на тисячи километри. На яр приходзи до миґрациї у процивним напряме.
Дньово мотилї ше ориєнтую припатраюци ше на нєбо. Вони видза поларизовану [[шветлосц]], та ше прето можу ориєнтовац аж и кед похмарене.
== Ваїчка ==
Ваїчка дньових мотильох защицени з тварду часцу вонкашнього пасма обмотку хтори ше вола хорион. Вон обложени з ценким пасмом воску хтори чува ваїчко од висушованя пред тим як цо лїчинка ма часу зошицким ше розвиц. Кажде ваїчко ма вельке число дробни отвори тевчирох на єдним концу. Циль тих дзиркох оможлївиц же би сперма вошла и оплодзела ваїчкову клїтинку. Ваїчка дньових мотильох варирую по велькосци и форми медзи файтами, алє су звичайно у вертикалним положеню и крашнє моделовани. Даєдни файти мотильох нєшу ваїчка поєдинєчно, а други у серийох. Велї самички знєшу медзи сто и двасто ваїчка.
[[File:Weiße Baumnymphe Idea leuconoe 3 Richard Bartz.jpg|right|thumb|303x303px|Мотиль]]
Ваїчка дньових мотильох притвердзени за лїсце з окремним лїпкачом хторе швидко постава тварде. Тото лїпкаче деформує ваїчка, а мож го лєгко видзиц бо окружує базу каждого ваїчка и формує менискус.
Ваїчка скоро вше на рошлїнох. Кажда файта дньового мотиля ма свою палету рошлїнох-домашнїх. Даєдни файти дньових мотильох огранїчени лєм на єдну файту рошлїни, а други хасную вецей рошлїнски файти, часто уключуюци и припаднїкох єдней фамилиї.
Фаза ваїчка тирва даскельо тижнї при векшини файтох дньових мотильох, алє ваїчка знєшени пред саму жиму, окреме у реґионох з умерену климу, прехода през фазу дияпаузи (мированя), а вилягню ше лєм на яр. Даєдни дньово мотилї з реґионох цо маю умерену климу, знєшу ваїчка на яр, а гушенїци ше вилягню на лєто.
== Гушенїци ==
Лїчинки дньових мотильох – гушенїци єдза лїсце рошлїнох и препровадзую практично цали свой час у єдзеню и глєданю єдзеня. Гоч гушенїци векшини файтох рошлїноєди, гушенїци даєдних файтох предатори: Spalgis epius є щитасти уши, а файти з фамилиї белавих мотильох, як цо Liphyra brassolis, єдза лїчинки брамушкох. Вони комуникую з брамушками так же хасную вибрациї хтори ше преноша през подлогу. Брамушки даваю одредзени ступень защити тим гушенїцом, а вони натомест вилучую медову росичку. Даєдни гушенїци наводза брамушки з роду ''Myrmica'' же бих однєсли до брамушкових колонийох, дзе єдза брамушково ваїчка и лїчинки.
'''Природни нєприятелє''' – Найчастейши природни нєприятелє дньових мотильох птици, а ноцних - пергаче. Мухи нєшу ваїчка на гушенїци, а навалентни оси - до гушенїци. Гушенїцово цело служи як покарма лїчинком паразитскей мухи або оси. Хватаци птици и паразити отримую природну ровновагу и онєможлївюю же би ше мотилї барз намножели и же би їх гушенїци нанєсли чкоди рошлїном кармительком.
== Литература ==
* Оксана Тимко Дїтко, ''Назви рошлїнох и животиньох у руским язику,'' Вуковар 2016, б. 14, 15, 6, 17.
== Вонкашнї вязи ==
* [https://sh.wikipedia.org/wiki/Leptir Лептир.] Википедија на српскохрватском језику, sh.wikipedia.org/wiki/
* [https://sr.wikipedia.org/sr-ec/%D0%9B%D0%B5%D0%BF%D1%82%D0%B8%D1%80%D0%B8 Лептири.] Википедија на српском језику, sr.wikipedia.org/sr-ec/
[[Катеґория:Безпохребцинаре]]
[[Катеґория:Мотилї]]
iz349d3d7qkisngz4oicbqf6utkjrb5
Модул:Category handler
828
714
21783
2020-04-01T06:12:40Z
MusikAnimal
2746
1 revision imported
21783
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- CATEGORY HANDLER --
-- --
-- This module implements the {{category handler}} template in Lua, --
-- with a few improvements: all namespaces and all namespace aliases --
-- are supported, and namespace names are detected automatically for --
-- the local wiki. This module requires [[Module:Namespace detect]] --
-- and [[Module:Yesno]] to be available on the local wiki. It can be --
-- configured for different wikis by altering the values in --
-- [[Module:Category handler/config]], and pages can be blacklisted --
-- from categorisation by using [[Module:Category handler/blacklist]]. --
-- --
--------------------------------------------------------------------------------
-- Load required modules
local yesno = require('Module:Yesno')
-- Lazily load things we don't always need
local mShared, mappings
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function trimWhitespace(s, removeBlanks)
if type(s) ~= 'string' then
return s
end
s = s:match('^%s*(.-)%s*$')
if removeBlanks then
if s ~= '' then
return s
else
return nil
end
else
return s
end
end
--------------------------------------------------------------------------------
-- CategoryHandler class
--------------------------------------------------------------------------------
local CategoryHandler = {}
CategoryHandler.__index = CategoryHandler
function CategoryHandler.new(data, args)
local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)
-- Set the title object
do
local pagename = obj:parameter('demopage')
local success, titleObj
if pagename then
success, titleObj = pcall(mw.title.new, pagename)
end
if success and titleObj then
obj.title = titleObj
if titleObj == mw.title.getCurrentTitle() then
obj._usesCurrentTitle = true
end
else
obj.title = mw.title.getCurrentTitle()
obj._usesCurrentTitle = true
end
end
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value = obj:parameter(key)
value = trimWhitespace(value, true)
obj['_' .. key] = yesno(value)
end
do
local subpage = obj:parameter('subpage')
local category2 = obj:parameter('category2')
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
end
if type(category2) == 'string' then
subpage = mw.ustring.lower(category2)
end
obj._subpage = trimWhitespace(subpage, true)
obj._category2 = trimWhitespace(category2) -- don't remove blank values
end
return obj
end
function CategoryHandler:parameter(key)
local parameterNames = self._data.parameters[key]
local pntype = type(parameterNames)
if pntype == 'string' or pntype == 'number' then
return self._args[parameterNames]
elseif pntype == 'table' then
for _, name in ipairs(parameterNames) do
local value = self._args[name]
if value ~= nil then
return value
end
end
return nil
else
error(string.format(
'invalid config key "%s"',
tostring(key)
), 2)
end
end
function CategoryHandler:isSuppressedByArguments()
return
-- See if a category suppression argument has been set.
self._nocat == true
or self._categories == false
or (
self._category2
and self._category2 ~= self._data.category2Yes
and self._category2 ~= self._data.category2Negative
)
-- Check whether we are on a subpage, and see if categories are
-- suppressed based on our subpage status.
or self._subpage == self._data.subpageNo and self.title.isSubpage
or self._subpage == self._data.subpageOnly and not self.title.isSubpage
end
function CategoryHandler:shouldSkipBlacklistCheck()
-- Check whether the category suppression arguments indicate we
-- should skip the blacklist check.
return self._nocat == false
or self._categories == true
or self._category2 == self._data.category2Yes
end
function CategoryHandler:matchesBlacklist()
if self._usesCurrentTitle then
return self._data.currentTitleMatchesBlacklist
else
mShared = mShared or require('Module:Category handler/shared')
return mShared.matchesBlacklist(
self.title.prefixedText,
mw.loadData('Module:Category handler/blacklist')
)
end
end
function CategoryHandler:isSuppressed()
-- Find if categories are suppressed by either the arguments or by
-- matching the blacklist.
return self:isSuppressedByArguments()
or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist()
end
function CategoryHandler:getNamespaceParameters()
if self._usesCurrentTitle then
return self._data.currentTitleNamespaceParameters
else
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
return mShared.getNamespaceParameters(
self.title,
mappings
)
end
end
function CategoryHandler:namespaceParametersExist()
-- Find whether any namespace parameters have been specified.
-- We use the order "all" --> namespace params --> "other" as this is what
-- the old template did.
if self:parameter('all') then
return true
end
if not mappings then
mShared = mShared or require('Module:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
for ns, params in pairs(mappings) do
for i, param in ipairs(params) do
if self._args[param] then
return true
end
end
end
if self:parameter('other') then
return true
end
return false
end
function CategoryHandler:getCategories()
local params = self:getNamespaceParameters()
local nsCategory
for i, param in ipairs(params) do
local value = self._args[param]
if value ~= nil then
nsCategory = value
break
end
end
if nsCategory ~= nil or self:namespaceParametersExist() then
-- Namespace parameters exist - advanced usage.
if nsCategory == nil then
nsCategory = self:parameter('other')
end
local ret = {self:parameter('all')}
local numParam = tonumber(nsCategory)
if numParam and numParam >= 1 and math.floor(numParam) == numParam then
-- nsCategory is an integer
ret[#ret + 1] = self._args[numParam]
else
ret[#ret + 1] = nsCategory
end
if #ret < 1 then
return nil
else
return table.concat(ret)
end
elseif self._data.defaultNamespaces[self.title.namespace] then
-- Namespace parameters don't exist, simple usage.
return self._args[1]
end
return nil
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- Used for testing purposes.
return {
CategoryHandler = CategoryHandler
}
end
function p._main(args, data)
data = data or mw.loadData('Module:Category handler/data')
local handler = CategoryHandler.new(data, args)
if handler:isSuppressed() then
return nil
end
return handler:getCategories()
end
function p.main(frame, data)
data = data or mw.loadData('Module:Category handler/data')
local args = require('Module:Arguments').getArgs(frame, {
wrappers = data.wrappers,
valueFunc = function (k, v)
v = trimWhitespace(v)
if type(k) == 'number' then
if v ~= '' then
return v
else
return nil
end
else
return v
end
end
})
return p._main(args, data)
end
return p
letwavu3yvlayfzew66uuwixmwebq5b
21784
7323
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Category_handler]]: Importing from the English wikipedia
7323
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- CATEGORY HANDLER --
-- --
-- This module implements the {{category handler}} template in Lua, --
-- with a few improvements: all namespaces and all namespace aliases --
-- are supported, and namespace names are detected automatically for --
-- the local wiki. This module requires [[Модул:Namespace detect]] --
-- and [[Модул:Yesno]] to be available on the local wiki. It can be --
-- configured for different wikis by altering the values in --
-- [[Модул:Category handler/config]], and pages can be blacklisted --
-- from categorisation by using [[Модул:Category handler/blacklist]]. --
-- --
--------------------------------------------------------------------------------
-- Load required modules
local yesno = require('Модул:Yesno')
-- Lazily load things we don't always need
local mShared, mappings
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function trimWhitespace(s, removeBlanks)
if type(s) ~= 'string' then
return s
end
s = s:match('^%s*(.-)%s*$')
if removeBlanks then
if s ~= '' then
return s
else
return nil
end
else
return s
end
end
--------------------------------------------------------------------------------
-- CategoryHandler class
--------------------------------------------------------------------------------
local CategoryHandler = {}
CategoryHandler.__index = CategoryHandler
function CategoryHandler.new(data, args)
local obj = setmetatable({ _data = data, _args = args }, CategoryHandler)
-- Set the title object
do
local pagename = obj:parameter('demopage')
local success, titleObj
if pagename then
success, titleObj = pcall(mw.title.new, pagename)
end
if success and titleObj then
obj.title = titleObj
if titleObj == mw.title.getCurrentTitle() then
obj._usesCurrentTitle = true
end
else
obj.title = mw.title.getCurrentTitle()
obj._usesCurrentTitle = true
end
end
-- Set suppression parameter values
for _, key in ipairs{'nocat', 'categories'} do
local value = obj:parameter(key)
value = trimWhitespace(value, true)
obj['_' .. key] = yesno(value)
end
do
local subpage = obj:parameter('subpage')
local category2 = obj:parameter('category2')
if type(subpage) == 'string' then
subpage = mw.ustring.lower(subpage)
end
if type(category2) == 'string' then
subpage = mw.ustring.lower(category2)
end
obj._subpage = trimWhitespace(subpage, true)
obj._category2 = trimWhitespace(category2) -- don't remove blank values
end
return obj
end
function CategoryHandler:parameter(key)
local parameterNames = self._data.parameters[key]
local pntype = type(parameterNames)
if pntype == 'string' or pntype == 'number' then
return self._args[parameterNames]
elseif pntype == 'table' then
for _, name in ipairs(parameterNames) do
local value = self._args[name]
if value ~= nil then
return value
end
end
return nil
else
error(string.format(
'invalid config key "%s"',
tostring(key)
), 2)
end
end
function CategoryHandler:isSuppressedByArguments()
return
-- See if a category suppression argument has been set.
self._nocat == true
or self._categories == false
or (
self._category2
and self._category2 ~= self._data.category2Yes
and self._category2 ~= self._data.category2Negative
)
-- Check whether we are on a subpage, and see if categories are
-- suppressed based on our subpage status.
or self._subpage == self._data.subpageNo and self.title.isSubpage
or self._subpage == self._data.subpageOnly and not self.title.isSubpage
end
function CategoryHandler:shouldSkipBlacklistCheck()
-- Check whether the category suppression arguments indicate we
-- should skip the blacklist check.
return self._nocat == false
or self._categories == true
or self._category2 == self._data.category2Yes
end
function CategoryHandler:matchesBlacklist()
if self._usesCurrentTitle then
return self._data.currentTitleMatchesBlacklist
else
mShared = mShared or require('Модул:Category handler/shared')
return mShared.matchesBlacklist(
self.title.prefixedText,
mw.loadData('Модул:Category handler/blacklist')
)
end
end
function CategoryHandler:isSuppressed()
-- Find if categories are suppressed by either the arguments or by
-- matching the blacklist.
return self:isSuppressedByArguments()
or not self:shouldSkipBlacklistCheck() and self:matchesBlacklist()
end
function CategoryHandler:getNamespaceParameters()
if self._usesCurrentTitle then
return self._data.currentTitleNamespaceParameters
else
if not mappings then
mShared = mShared or require('Модул:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
return mShared.getNamespaceParameters(
self.title,
mappings
)
end
end
function CategoryHandler:namespaceParametersExist()
-- Find whether any namespace parameters have been specified.
-- We use the order "all" --> namespace params --> "other" as this is what
-- the old template did.
if self:parameter('all') then
return true
end
if not mappings then
mShared = mShared or require('Модул:Category handler/shared')
mappings = mShared.getParamMappings(true) -- gets mappings with mw.loadData
end
for ns, params in pairs(mappings) do
for i, param in ipairs(params) do
if self._args[param] then
return true
end
end
end
if self:parameter('other') then
return true
end
return false
end
function CategoryHandler:getCategories()
local params = self:getNamespaceParameters()
local nsCategory
for i, param in ipairs(params) do
local value = self._args[param]
if value ~= nil then
nsCategory = value
break
end
end
if nsCategory ~= nil or self:namespaceParametersExist() then
-- Namespace parameters exist - advanced usage.
if nsCategory == nil then
nsCategory = self:parameter('other')
end
local ret = {self:parameter('all')}
local numParam = tonumber(nsCategory)
if numParam and numParam >= 1 and math.floor(numParam) == numParam then
-- nsCategory is an integer
ret[#ret + 1] = self._args[numParam]
else
ret[#ret + 1] = nsCategory
end
if #ret < 1 then
return nil
else
return table.concat(ret)
end
elseif self._data.defaultNamespaces[self.title.namespace] then
-- Namespace parameters don't exist, simple usage.
return self._args[1]
end
return nil
end
--------------------------------------------------------------------------------
-- Exports
--------------------------------------------------------------------------------
local p = {}
function p._exportClasses()
-- Used for testing purposes.
return {
CategoryHandler = CategoryHandler
}
end
function p._main(args, data)
data = data or mw.loadData('Модул:Category handler/data')
local handler = CategoryHandler.new(data, args)
if handler:isSuppressed() then
return nil
end
return handler:getCategories()
end
function p.main(frame, data)
data = data or mw.loadData('Модул:Category handler/data')
local args = require('Модул:Arguments').getArgs(frame, {
wrappers = data.wrappers,
valueFunc = function (k, v)
v = trimWhitespace(v)
if type(k) == 'number' then
if v ~= '' then
return v
else
return nil
end
else
return v
end
end
})
return p._main(args, data)
end
return p
abp5r3esf61o2ixq075svnvsdl1b3sw
Модул:Category handler/data
828
715
21785
2020-04-01T06:12:41Z
MusikAnimal
2746
1 revision imported
21785
Scribunto
text/plain
-- This module assembles data to be passed to [[Module:Category handler]] using
-- mw.loadData. This includes the configuration data and whether the current
-- page matches the title blacklist.
local data = require('Module:Category handler/config')
local mShared = require('Module:Category handler/shared')
local blacklist = require('Module:Category handler/blacklist')
local title = mw.title.getCurrentTitle()
data.currentTitleMatchesBlacklist = mShared.matchesBlacklist(
title.prefixedText,
blacklist
)
data.currentTitleNamespaceParameters = mShared.getNamespaceParameters(
title,
mShared.getParamMappings()
)
return data
k26mwixuaeijisfddb0sxkg82iux8v4
21786
7324
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Category_handler/data]]: Importing from the English wikipedia
7324
Scribunto
text/plain
-- This module assembles data to be passed to [[Модул:Category handler]] using
-- mw.loadData. This includes the configuration data and whether the current
-- page matches the title blacklist.
local data = require('Модул:Category handler/config')
local mShared = require('Модул:Category handler/shared')
local blacklist = require('Модул:Category handler/blacklist')
local title = mw.title.getCurrentTitle()
data.currentTitleMatchesBlacklist = mShared.matchesBlacklist(
title.prefixedText,
blacklist
)
data.currentTitleNamespaceParameters = mShared.getNamespaceParameters(
title,
mShared.getParamMappings()
)
return data
dvv9es6r7k03gqiikcss78xwxj8m52m
Модул:Category handler/shared
828
716
21789
2020-04-01T06:12:41Z
MusikAnimal
2746
1 revision imported
21789
Scribunto
text/plain
-- This module contains shared functions used by [[Module:Category handler]]
-- and its submodules.
local p = {}
function p.matchesBlacklist(page, blacklist)
for i, pattern in ipairs(blacklist) do
local match = mw.ustring.match(page, pattern)
if match then
return true
end
end
return false
end
function p.getParamMappings(useLoadData)
local dataPage = 'Module:Namespace detect/data'
if useLoadData then
return mw.loadData(dataPage).mappings
else
return require(dataPage).mappings
end
end
function p.getNamespaceParameters(titleObj, mappings)
-- We don't use title.nsText for the namespace name because it adds
-- underscores.
local mappingsKey
if titleObj.isTalkPage then
mappingsKey = 'talk'
else
mappingsKey = mw.site.namespaces[titleObj.namespace].name
end
mappingsKey = mw.ustring.lower(mappingsKey)
return mappings[mappingsKey] or {}
end
return p
omlsnhudxz6juptvtxz7ns97jutbzc5
21790
7325
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Module:Category_handler/shared]]: Importing from the English wikipedia
7325
Scribunto
text/plain
-- This module contains shared functions used by [[Модул:Category handler]]
-- and its submodules.
local p = {}
function p.matchesBlacklist(page, blacklist)
for i, pattern in ipairs(blacklist) do
local match = mw.ustring.match(page, pattern)
if match then
return true
end
end
return false
end
function p.getParamMappings(useLoadData)
local dataPage = 'Модул:Namespace detect/data'
if useLoadData then
return mw.loadData(dataPage).mappings
else
return require(dataPage).mappings
end
end
function p.getNamespaceParameters(titleObj, mappings)
-- We don't use title.nsText for the namespace name because it adds
-- underscores.
local mappingsKey
if titleObj.isTalkPage then
mappingsKey = 'talk'
else
mappingsKey = mw.site.namespaces[titleObj.namespace].name
end
mappingsKey = mw.ustring.lower(mappingsKey)
return mappings[mappingsKey] or {}
end
return p
qmepl533xhzpuxdjrfdo9cd0njs9rg1
Модул:Category handler/blacklist
828
717
21791
2020-04-18T08:48:05Z
Jo-Jo Eumerus
2763
Per category talk page
21791
Scribunto
text/plain
-- This module contains the blacklist used by [[Module:Category handler]].
-- Pages that match Lua patterns in this list will not be categorised unless
-- categorisation is explicitly requested.
return {
'^Main Page$', -- don't categorise the main page.
-- Don't categorise the following pages or their subpages.
-- "%f[/\0]" matches if the next character is "/" or the end of the string.
'^Wikipedia:Cascade%-protected items%f[/\0]',
'^User:UBX%f[/\0]', -- The userbox "template" space.
'^User talk:UBX%f[/\0]',
-- Don't categorise subpages of these pages, but allow
-- categorisation of the base page.
'^Wikipedia:Template index/.*$',
-- Don't categorise archives.
'/[aA]rchive',
"^Wikipedia:Administrators' noticeboard/IncidentArchive%d+$",
}
fsv1drcay6t25e91hzhqxtyp7pckbpx
21792
7326
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Module:Category_handler/blacklist]]: Importing from the English wikipedia
7326
Scribunto
text/plain
-- This module contains the blacklist used by [[Модул:Category handler]].
-- Pages that match Lua patterns in this list will not be categorised unless
-- categorisation is explicitly requested.
return {
'^Main Page$', -- don't categorise the main page.
-- Don't categorise the following pages or their subpages.
-- "%f[/\0]" matches if the next character is "/" or the end of the string.
'^Wikipedia:Cascade%-protected items%f[/\0]',
'^User:UBX%f[/\0]', -- The userbox "template" space.
'^User talk:UBX%f[/\0]',
-- Don't categorise subpages of these pages, but allow
-- categorisation of the base page.
'^Wikipedia:Template index/.*$',
-- Don't categorise archives.
'/[aA]rchive',
"^Wikipedia:Administrators' noticeboard/IncidentArchive%d+$",
}
pux5ghlh4kvf76ivhwcv99b96ei3dxo
Модул:Category handler/config
828
718
21787
2020-04-01T06:12:40Z
MusikAnimal
2746
1 revision imported
21787
Scribunto
text/plain
--------------------------------------------------------------------------------
-- [[Module:Category handler]] configuration data --
-- Language-specific parameter names and values can be set here. --
-- For blacklist config, see [[Module:Category handler/blacklist]]. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- foo = 'parameter name', --
-- --
-- To add multiple names, you can use this format: --
-- --
-- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --
--------------------------------------------------------------------------------
cfg.parameters = {
-- The nocat and categories parameter suppress
-- categorisation. They are used with Module:Yesno, and work as follows:
--
-- cfg.nocat:
-- Result of yesno() Effect
-- true Categorisation is suppressed
-- false Categorisation is allowed, and
-- the blacklist check is skipped
-- nil Categorisation is allowed
--
-- cfg.categories:
-- Result of yesno() Effect
-- true Categorisation is allowed, and
-- the blacklist check is skipped
-- false Categorisation is suppressed
-- nil Categorisation is allowed
nocat = 'nocat',
categories = 'categories',
-- The parameter name for the legacy "category2" parameter. This skips the
-- blacklist if set to the cfg.category2Yes value, and suppresses
-- categorisation if present but equal to anything other than
-- cfg.category2Yes or cfg.category2Negative.
category2 = 'category2',
-- cfg.subpage is the parameter name to specify how to behave on subpages.
subpage = 'subpage',
-- The parameter for data to return in all namespaces.
all = 'all',
-- The parameter name for data to return if no data is specified for the
-- namespace that is detected.
other = 'other',
-- The parameter name used to specify a page other than the current page;
-- used for testing and demonstration.
demopage = 'page',
}
--------------------------------------------------------------------------------
-- Parameter values --
-- These are set values that can be used with certain parameters. Only one --
-- value can be specified, like this: --
-- --
-- cfg.foo = 'value name' -- --
--------------------------------------------------------------------------------
-- The following settings are used with the cfg.category2 parameter. Setting
-- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2
-- is present but equal to anything other than cfg.category2Yes or
-- cfg.category2Negative then it supresses cateogrisation.
cfg.category2Yes = 'yes'
cfg.category2Negative = '¬'
-- The following settings are used with the cfg.subpage parameter.
-- cfg.subpageNo is the value to specify to not categorise on subpages;
-- cfg.subpageOnly is the value to specify to only categorise on subpages.
cfg.subpageNo = 'no'
cfg.subpageOnly = 'only'
--------------------------------------------------------------------------------
-- Default namespaces --
-- This is a table of namespaces to categorise by default. The keys are the --
-- namespace numbers. --
--------------------------------------------------------------------------------
cfg.defaultNamespaces = {
[ 0] = true, -- main
[ 6] = true, -- file
[ 12] = true, -- help
[ 14] = true, -- category
[100] = true, -- portal
[108] = true, -- book
}
--------------------------------------------------------------------------------
-- Wrappers --
-- This is a wrapper template or a list of wrapper templates to be passed to --
-- [[Module:Arguments]]. --
--------------------------------------------------------------------------------
cfg.wrappers = 'Template:Category handler'
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
6ga9hbq2pdwalsvx68i53dmbr421rq5
21788
7327
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Module:Category_handler/config]]: Importing from the English wikipedia
7327
Scribunto
text/plain
--------------------------------------------------------------------------------
-- [[Модул:Category handler]] configuration data --
-- Language-specific parameter names and values can be set here. --
-- For blacklist config, see [[Модул:Category handler/blacklist]]. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- foo = 'parameter name', --
-- --
-- To add multiple names, you can use this format: --
-- --
-- foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'}, --
--------------------------------------------------------------------------------
cfg.parameters = {
-- The nocat and categories parameter suppress
-- categorisation. They are used with Модул:Yesno, and work as follows:
--
-- cfg.nocat:
-- Result of yesno() Effect
-- true Categorisation is suppressed
-- false Categorisation is allowed, and
-- the blacklist check is skipped
-- nil Categorisation is allowed
--
-- cfg.categories:
-- Result of yesno() Effect
-- true Categorisation is allowed, and
-- the blacklist check is skipped
-- false Categorisation is suppressed
-- nil Categorisation is allowed
nocat = 'nocat',
categories = 'categories',
-- The parameter name for the legacy "category2" parameter. This skips the
-- blacklist if set to the cfg.category2Yes value, and suppresses
-- categorisation if present but equal to anything other than
-- cfg.category2Yes or cfg.category2Negative.
category2 = 'category2',
-- cfg.subpage is the parameter name to specify how to behave on subpages.
subpage = 'subpage',
-- The parameter for data to return in all namespaces.
all = 'all',
-- The parameter name for data to return if no data is specified for the
-- namespace that is detected.
other = 'other',
-- The parameter name used to specify a page other than the current page;
-- used for testing and demonstration.
demopage = 'page',
}
--------------------------------------------------------------------------------
-- Parameter values --
-- These are set values that can be used with certain parameters. Only one --
-- value can be specified, like this: --
-- --
-- cfg.foo = 'value name' -- --
--------------------------------------------------------------------------------
-- The following settings are used with the cfg.category2 parameter. Setting
-- cfg.category2 to cfg.category2Yes skips the blacklist, and if cfg.category2
-- is present but equal to anything other than cfg.category2Yes or
-- cfg.category2Negative then it supresses cateogrisation.
cfg.category2Yes = 'yes'
cfg.category2Negative = '¬'
-- The following settings are used with the cfg.subpage parameter.
-- cfg.subpageNo is the value to specify to not categorise on subpages;
-- cfg.subpageOnly is the value to specify to only categorise on subpages.
cfg.subpageNo = 'no'
cfg.subpageOnly = 'only'
--------------------------------------------------------------------------------
-- Default namespaces --
-- This is a table of namespaces to categorise by default. The keys are the --
-- namespace numbers. --
--------------------------------------------------------------------------------
cfg.defaultNamespaces = {
[ 0] = true, -- main
[ 6] = true, -- file
[ 12] = true, -- help
[ 14] = true, -- category
[100] = true, -- portal
[108] = true, -- book
}
--------------------------------------------------------------------------------
-- Wrappers --
-- This is a wrapper template or a list of wrapper templates to be passed to --
-- [[Модул:Arguments]]. --
--------------------------------------------------------------------------------
cfg.wrappers = 'Template:Category handler'
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
czja1q66alqw4onglumr4pmhpwhq1sg
Модул:Namespace detect/data
828
719
21775
2020-04-01T06:12:45Z
MusikAnimal
2746
1 revision imported
21775
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect data --
-- This module holds data for [[Module:Namespace detect]] to be loaded per --
-- page, rather than per #invoke, for performance reasons. --
--------------------------------------------------------------------------------
local cfg = require('Module:Namespace detect/config')
local function addKey(t, key, defaultKey)
if key ~= defaultKey then
t[#t + 1] = key
end
end
-- Get a table of parameters to query for each default parameter name.
-- This allows wikis to customise parameter names in the cfg table while
-- ensuring that default parameter names will always work. The cfg table
-- values can be added as a string, or as an array of strings.
local defaultKeys = {
'main',
'talk',
'other',
'subjectns',
'demospace',
'demopage'
}
local argKeys = {}
for i, defaultKey in ipairs(defaultKeys) do
argKeys[defaultKey] = {defaultKey}
end
for defaultKey, t in pairs(argKeys) do
local cfgValue = cfg[defaultKey]
local cfgValueType = type(cfgValue)
if cfgValueType == 'string' then
addKey(t, cfgValue, defaultKey)
elseif cfgValueType == 'table' then
for i, key in ipairs(cfgValue) do
addKey(t, key, defaultKey)
end
end
cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more.
end
local function getParamMappings()
--[[
-- Returns a table of how parameter names map to namespace names. The keys
-- are the actual namespace names, in lower case, and the values are the
-- possible parameter names for that namespace, also in lower case. The
-- table entries are structured like this:
-- {
-- [''] = {'main'},
-- ['wikipedia'] = {'wikipedia', 'project', 'wp'},
-- ...
-- }
--]]
local mappings = {}
local mainNsName = mw.site.subjectNamespaces[0].name
mainNsName = mw.ustring.lower(mainNsName)
mappings[mainNsName] = mw.clone(argKeys.main)
mappings['talk'] = mw.clone(argKeys.talk)
for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
local nsname = mw.ustring.lower(ns.name)
local canonicalName = mw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
table.insert(mappings[nsname], canonicalName)
end
for _, alias in ipairs(ns.aliases) do
table.insert(mappings[nsname], mw.ustring.lower(alias))
end
end
end
return mappings
end
return {
argKeys = argKeys,
cfg = cfg,
mappings = getParamMappings()
}
ojp6d3pc8mql5nufaqdg576c9so3479
21776
7328
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Namespace_detect/data]]: Importing from the English wikipedia
7328
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect data --
-- This module holds data for [[Модул:Namespace detect]] to be loaded per --
-- page, rather than per #invoke, for performance reasons. --
--------------------------------------------------------------------------------
local cfg = require('Модул:Namespace detect/config')
local function addKey(t, key, defaultKey)
if key ~= defaultKey then
t[#t + 1] = key
end
end
-- Get a table of parameters to query for each default parameter name.
-- This allows wikis to customise parameter names in the cfg table while
-- ensuring that default parameter names will always work. The cfg table
-- values can be added as a string, or as an array of strings.
local defaultKeys = {
'main',
'talk',
'other',
'subjectns',
'demospace',
'demopage'
}
local argKeys = {}
for i, defaultKey in ipairs(defaultKeys) do
argKeys[defaultKey] = {defaultKey}
end
for defaultKey, t in pairs(argKeys) do
local cfgValue = cfg[defaultKey]
local cfgValueType = type(cfgValue)
if cfgValueType == 'string' then
addKey(t, cfgValue, defaultKey)
elseif cfgValueType == 'table' then
for i, key in ipairs(cfgValue) do
addKey(t, key, defaultKey)
end
end
cfg[defaultKey] = nil -- Free the cfg value as we don't need it any more.
end
local function getParamMappings()
--[[
-- Returns a table of how parameter names map to namespace names. The keys
-- are the actual namespace names, in lower case, and the values are the
-- possible parameter names for that namespace, also in lower case. The
-- table entries are structured like this:
-- {
-- [''] = {'main'},
-- ['wikipedia'] = {'wikipedia', 'project', 'wp'},
-- ...
-- }
--]]
local mappings = {}
local mainNsName = mw.site.subjectNamespaces[0].name
mainNsName = mw.ustring.lower(mainNsName)
mappings[mainNsName] = mw.clone(argKeys.main)
mappings['talk'] = mw.clone(argKeys.talk)
for nsid, ns in pairs(mw.site.subjectNamespaces) do
if nsid ~= 0 then -- Exclude main namespace.
local nsname = mw.ustring.lower(ns.name)
local canonicalName = mw.ustring.lower(ns.canonicalName)
mappings[nsname] = {nsname}
if canonicalName ~= nsname then
table.insert(mappings[nsname], canonicalName)
end
for _, alias in ipairs(ns.aliases) do
table.insert(mappings[nsname], mw.ustring.lower(alias))
end
end
end
return mappings
end
return {
argKeys = argKeys,
cfg = cfg,
mappings = getParamMappings()
}
bo0p5wnl3snj18b3028q72edaz2kb1a
Модул:Namespace detect/config
828
720
21777
2020-04-01T06:12:44Z
MusikAnimal
2746
1 revision imported
21777
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect configuration data --
-- --
-- This module stores configuration data for Module:Namespace detect. Here --
-- you can localise the module to your wiki's language. --
-- --
-- To activate a configuration item, you need to uncomment it. This means --
-- that you need to remove the text "-- " at the start of the line. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. Values added --
-- here will work in addition to the default English parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- cfg.foo = 'parameter name' --
-- --
-- To add multiple names, you can use this format: --
-- --
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --
--------------------------------------------------------------------------------
---- This parameter displays content for the main namespace:
-- cfg.main = 'main'
---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'
---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'
---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Module:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'
---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'
---- This parameter sets a specific page to compare:
cfg.demopage = 'page'
--------------------------------------------------------------------------------
-- Table configuration --
-- These configuration items allow customisation of the "table" function, --
-- used to generate a table of possible parameters in the module --
-- documentation. --
--------------------------------------------------------------------------------
---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'
---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'
--------------------------------------------------------------------------------
-- End of configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
1o6ozz56i8q0xgyl6xa41n2v7kelhli
21778
7329
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Namespace_detect/config]]: Importing from the English wikipedia
7329
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Namespace detect configuration data --
-- --
-- This module stores configuration data for Модул:Namespace detect. Here --
-- you can localise the module to your wiki's language. --
-- --
-- To activate a configuration item, you need to uncomment it. This means --
-- that you need to remove the text "-- " at the start of the line. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Parameter names --
-- These configuration items specify custom parameter names. Values added --
-- here will work in addition to the default English parameter names. --
-- To add one extra name, you can use this format: --
-- --
-- cfg.foo = 'parameter name' --
-- --
-- To add multiple names, you can use this format: --
-- --
-- cfg.foo = {'parameter name 1', 'parameter name 2', 'parameter name 3'} --
--------------------------------------------------------------------------------
---- This parameter displays content for the main namespace:
-- cfg.main = 'main'
---- This parameter displays in talk namespaces:
-- cfg.talk = 'talk'
---- This parameter displays content for "other" namespaces (namespaces for which
---- parameters have not been specified):
-- cfg.other = 'other'
---- This parameter makes talk pages behave as though they are the corresponding
---- subject namespace. Note that this parameter is used with [[Модул:Yesno]].
---- Edit that module to change the default values of "yes", "no", etc.
-- cfg.subjectns = 'subjectns'
---- This parameter sets a demonstration namespace:
-- cfg.demospace = 'demospace'
---- This parameter sets a specific page to compare:
cfg.demopage = 'page'
--------------------------------------------------------------------------------
-- Table configuration --
-- These configuration items allow customisation of the "table" function, --
-- used to generate a table of possible parameters in the module --
-- documentation. --
--------------------------------------------------------------------------------
---- The header for the namespace column in the wikitable containing the list of
---- possible subject-space parameters.
-- cfg.wikitableNamespaceHeader = 'Namespace'
---- The header for the wikitable containing the list of possible subject-space
---- parameters.
-- cfg.wikitableAliasesHeader = 'Aliases'
--------------------------------------------------------------------------------
-- End of configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line.
516u40x7e4ey6a2l2rixcitj1cziw9t
Модул:Uses TemplateStyles
828
722
21877
7354
2026-02-16T01:11:16Z
JPxG
2802
copy slopped edit from sandbox to provide a link to Special:EditPage for the linked pages; looks great to me on all the testcases, i dont think this will bust anything but yolo [[User:Pppery]] feel free to shoot me if i break anything
21877
Scribunto
text/plain
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local TNT = require('Module:TNT')
local p = {}
local function format(msg, ...)
return TNT.format('I18n/Uses TemplateStyles', msg, ...)
end
local function getConfig()
return mw.loadData('Module:Uses TemplateStyles/config')
end
local function makeEditSup(pageName)
return string.format('<sup>[[[Special:Edit/%s|e]]]</sup>', pageName)
end
-- Build just the "(sandbox)" suffix using the i18n message, without duplicating the main link.
local function makeSandboxSuffix(tsSandboxPrefixed)
-- i18n message is: "$1 ([[$2|sandbox]])"
-- Passing empty $1 yields " ([[:...|sandbox]])" -> trim leading whitespace to get "(sandbox)" portion.
local s = format('sandboxlink', '', ':' .. tsSandboxPrefixed)
return (s:gsub('^%s+', ''))
end
local function renderBox(tStyles)
local boxArgs = {
type = 'notice',
small = true,
image = string.format('[[File:Farm-Fresh css add.svg|32px|alt=%s]]', format('logo-alt'))
}
if #tStyles < 1 then
boxArgs.text = string.format('<strong class="error">%s</strong>', format('error-emptylist'))
else
local cfg = getConfig()
local tStylesLinks = {}
for i, ts in ipairs(tStyles) do
local viewLink = string.format('[[:%s]]', ts)
local editSup = makeEditSup(ts)
local out = viewLink .. editSup
-- Optional sandbox link + sandbox edit link
local tsTitle = mw.title.new(ts)
if tsTitle and cfg['sandbox_title'] then
local tsSandboxTitle = mw.title.new(string.format(
'%s:%s/%s/%s',
tsTitle.nsText,
tsTitle.baseText,
cfg['sandbox_title'],
tsTitle.subpageText
))
if tsSandboxTitle and tsSandboxTitle.exists then
local sandboxSuffix = makeSandboxSuffix(tsSandboxTitle.prefixedText)
local sandboxEditSup = makeEditSup(tsSandboxTitle.prefixedText)
out = out .. ' ' .. sandboxSuffix .. ' ' .. sandboxEditSup
end
end
tStylesLinks[i] = out
end
local tStylesList = mList.makeList('bulleted', tStylesLinks)
boxArgs.text = format(
mw.title.getCurrentTitle():inNamespaces(828, 829) and 'header-module' or 'header-template'
) .. '\n' .. tStylesList
end
return mMessageBox.main('mbox', boxArgs)
end
local function renderTrackingCategories(args, tStyles, titleObj)
if yesno(args.nocat) then
return ''
end
local cfg = getConfig()
local cats = {}
-- Error category
if #tStyles < 1 and cfg['error_category'] then
cats[#cats + 1] = cfg['error_category']
end
-- TemplateStyles category
titleObj = titleObj or mw.title.getCurrentTitle()
if (titleObj.namespace == 10 or titleObj.namespace == 828)
and not cfg['subpage_blacklist'][titleObj.subpageText]
then
local category = args.category or cfg['default_category']
if category then
cats[#cats + 1] = category
end
if not yesno(args.noprotcat) and (cfg['protection_conflict_category'] or cfg['padlock_pattern']) then
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil
local addedLevelCat = false
local addedPadlockCat = false
for _, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if cfg['padlock_pattern'] and tsProt and not addedPadlockCat then
local content = tsTitleObj:getContent()
if not content:find(cfg['padlock_pattern']) then
cats[#cats + 1] = cfg['missing_padlock_category']
addedPadlockCat = true
end
end
if cfg['protection_conflict_category'] and currentProt and tsProt ~= currentProt and not addedLevelCat then
currentProt = cfg['protection_hierarchy'][currentProt] or 0
tsProt = cfg['protection_hierarchy'][tsProt] or 0
if tsProt < currentProt then
addedLevelCat = true
cats[#cats + 1] = cfg['protection_conflict_category']
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
function p._main(args)
local cfg = getConfig()
if #args == 0 then
local prefixed = mw.title.getCurrentTitle().prefixedText
prefixed = prefixed:gsub("/doc", "")
args[1] = prefixed .. "/" .. cfg["default_subpage_name"]
end
local tStyles = mTableTools.compressSparseArray(args)
local box = renderBox(tStyles)
local trackingCategories = renderTrackingCategories(args, tStyles)
return box .. trackingCategories
end
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
return p
fzxzfes95mnfacwuhc6k9zeaixdtemr
21878
21877
2026-09-18T15:05:30Z
Keresturec
18
1 измена увезена из [[:en:Module:Uses_TemplateStyles]]: Importing from the English wikipedia
21877
Scribunto
text/plain
local yesno = require('Module:Yesno')
local mList = require('Module:List')
local mTableTools = require('Module:TableTools')
local mMessageBox = require('Module:Message box')
local TNT = require('Module:TNT')
local p = {}
local function format(msg, ...)
return TNT.format('I18n/Uses TemplateStyles', msg, ...)
end
local function getConfig()
return mw.loadData('Module:Uses TemplateStyles/config')
end
local function makeEditSup(pageName)
return string.format('<sup>[[[Special:Edit/%s|e]]]</sup>', pageName)
end
-- Build just the "(sandbox)" suffix using the i18n message, without duplicating the main link.
local function makeSandboxSuffix(tsSandboxPrefixed)
-- i18n message is: "$1 ([[$2|sandbox]])"
-- Passing empty $1 yields " ([[:...|sandbox]])" -> trim leading whitespace to get "(sandbox)" portion.
local s = format('sandboxlink', '', ':' .. tsSandboxPrefixed)
return (s:gsub('^%s+', ''))
end
local function renderBox(tStyles)
local boxArgs = {
type = 'notice',
small = true,
image = string.format('[[File:Farm-Fresh css add.svg|32px|alt=%s]]', format('logo-alt'))
}
if #tStyles < 1 then
boxArgs.text = string.format('<strong class="error">%s</strong>', format('error-emptylist'))
else
local cfg = getConfig()
local tStylesLinks = {}
for i, ts in ipairs(tStyles) do
local viewLink = string.format('[[:%s]]', ts)
local editSup = makeEditSup(ts)
local out = viewLink .. editSup
-- Optional sandbox link + sandbox edit link
local tsTitle = mw.title.new(ts)
if tsTitle and cfg['sandbox_title'] then
local tsSandboxTitle = mw.title.new(string.format(
'%s:%s/%s/%s',
tsTitle.nsText,
tsTitle.baseText,
cfg['sandbox_title'],
tsTitle.subpageText
))
if tsSandboxTitle and tsSandboxTitle.exists then
local sandboxSuffix = makeSandboxSuffix(tsSandboxTitle.prefixedText)
local sandboxEditSup = makeEditSup(tsSandboxTitle.prefixedText)
out = out .. ' ' .. sandboxSuffix .. ' ' .. sandboxEditSup
end
end
tStylesLinks[i] = out
end
local tStylesList = mList.makeList('bulleted', tStylesLinks)
boxArgs.text = format(
mw.title.getCurrentTitle():inNamespaces(828, 829) and 'header-module' or 'header-template'
) .. '\n' .. tStylesList
end
return mMessageBox.main('mbox', boxArgs)
end
local function renderTrackingCategories(args, tStyles, titleObj)
if yesno(args.nocat) then
return ''
end
local cfg = getConfig()
local cats = {}
-- Error category
if #tStyles < 1 and cfg['error_category'] then
cats[#cats + 1] = cfg['error_category']
end
-- TemplateStyles category
titleObj = titleObj or mw.title.getCurrentTitle()
if (titleObj.namespace == 10 or titleObj.namespace == 828)
and not cfg['subpage_blacklist'][titleObj.subpageText]
then
local category = args.category or cfg['default_category']
if category then
cats[#cats + 1] = category
end
if not yesno(args.noprotcat) and (cfg['protection_conflict_category'] or cfg['padlock_pattern']) then
local currentProt = titleObj.protectionLevels["edit"] and titleObj.protectionLevels["edit"][1] or nil
local addedLevelCat = false
local addedPadlockCat = false
for _, ts in ipairs(tStyles) do
local tsTitleObj = mw.title.new(ts)
local tsProt = tsTitleObj.protectionLevels["edit"] and tsTitleObj.protectionLevels["edit"][1] or nil
if cfg['padlock_pattern'] and tsProt and not addedPadlockCat then
local content = tsTitleObj:getContent()
if not content:find(cfg['padlock_pattern']) then
cats[#cats + 1] = cfg['missing_padlock_category']
addedPadlockCat = true
end
end
if cfg['protection_conflict_category'] and currentProt and tsProt ~= currentProt and not addedLevelCat then
currentProt = cfg['protection_hierarchy'][currentProt] or 0
tsProt = cfg['protection_hierarchy'][tsProt] or 0
if tsProt < currentProt then
addedLevelCat = true
cats[#cats + 1] = cfg['protection_conflict_category']
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
end
return table.concat(cats)
end
function p._main(args)
local cfg = getConfig()
if #args == 0 then
local prefixed = mw.title.getCurrentTitle().prefixedText
prefixed = prefixed:gsub("/doc", "")
args[1] = prefixed .. "/" .. cfg["default_subpage_name"]
end
local tStyles = mTableTools.compressSparseArray(args)
local box = renderBox(tStyles)
local trackingCategories = renderTrackingCategories(args, tStyles)
return box .. trackingCategories
end
function p.main(frame)
local origArgs = frame:getParent().args
local args = {}
for k, v in pairs(origArgs) do
v = v:match('^%s*(.-)%s*$')
if v ~= '' then
args[k] = v
end
end
return p._main(args)
end
return p
fzxzfes95mnfacwuhc6k9zeaixdtemr
Модул:Uses TemplateStyles/config
828
723
21879
2024-07-07T01:05:12Z
Pppery
88
21879
Scribunto
text/plain
local cfg = {} -- Don’t touch this line.
-- Subpage blacklist: these subpages will not be categorized (except for the
-- error category, which is always added if there is an error).
-- For example “Template:Foo/doc” matches the `doc = true` rule, so it will have
-- no categories. “Template:Foo” and “Template:Foo/documentation” match no rules,
-- so they *will* have categories. All rules should be in the
-- ['<subpage name>'] = true,
-- format.
cfg['subpage_blacklist'] = {
['doc'] = true,
['sandbox'] = true,
['sandbox2'] = true,
['testcases'] = true,
}
-- Sandbox title: if the stylesheet’s title is <template>/<stylesheet>.css, the
-- stylesheet’s sandbox is expected to be at <template>/<sandbox_title>/<stylesheet>.css
-- Set to nil to disable sandbox links.
cfg['sandbox_title'] = 'sandbox'
-- Error category: this category is added if the module call contains errors
-- (e.g. no stylesheet listed). A category name without namespace, or nil
-- to disable categorization (not recommended).
cfg['error_category'] = 'Uses TemplateStyles templates with errors'
-- Default category: this category is added if no custom category is specified
-- in module/template call. A category name without namespace, or nil
-- to disable categorization.
cfg['default_category'] = 'Templates using TemplateStyles'
-- Protection conflict category: this category is added if the protection level
-- of any stylesheet is lower than the protection level of the template. A category name
-- without namespace, or nil to disable categorization (not recommended).
cfg['protection_conflict_category'] = 'Templates using TemplateStyles with a different protection level'
-- Hierarchy of protection levels, used to determine whether one protection level is lower
-- than another and thus should populate protection_conflict_category. No protection is treated as zero
cfg['protection_hierarchy'] = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
-- Padlock pattern: Lua pattern to search on protected stylesheets for, or nil
-- to disable padlock check.
cfg['padlock_pattern'] = '{{pp-'
-- Missing padlock category: this category is added if a protected stylesheet
-- doesn’t contain any padlock template (specified by the above Lua pattern).
-- A category name without namespace (no nil allowed) if the pattern is not nil,
-- unused (and thus may be nil) otherwise.
cfg['missing_padlock_category'] = 'Templates using TemplateStyles without padlocks'
-- Default subpage for the stylesheet if none is given
cfg['default_subpage_name'] = 'styles.css'
return cfg -- Don’t touch this line.
jobuplor7csgdjcx4c6xrtnslslvft4
21880
7332
2026-09-18T15:05:30Z
Keresturec
18
1 измена увезена из [[:en:Module:Uses_TemplateStyles/config]]: Importing from the English wikipedia
7332
Scribunto
text/plain
local cfg = {} -- Don’t touch this line.
-- Subpage blacklist: these subpages will not be categorized (except for the
-- error category, which is always added if there is an error).
-- For example “Template:Foo/doc” matches the `doc = true` rule, so it will have
-- no categories. “Template:Foo” and “Template:Foo/documentation” match no rules,
-- so they *will* have categories. All rules should be in the
-- ['<subpage name>'] = true,
-- format.
cfg['subpage_blacklist'] = {
['doc'] = true,
['sandbox'] = true,
['sandbox2'] = true,
['testcases'] = true,
}
-- Sandbox title: if the stylesheet’s title is <template>/<stylesheet>.css, the
-- stylesheet’s sandbox is expected to be at <template>/<sandbox_title>/<stylesheet>.css
-- Set to nil to disable sandbox links.
cfg['sandbox_title'] = 'sandbox'
-- Error category: this category is added if the module call contains errors
-- (e.g. no stylesheet listed). A category name without namespace, or nil
-- to disable categorization (not recommended).
cfg['error_category'] = 'Uses TemplateStyles templates with errors'
-- Default category: this category is added if no custom category is specified
-- in module/template call. A category name without namespace, or nil
-- to disable categorization.
cfg['default_category'] = 'Templates using TemplateStyles'
-- Protection conflict category: this category is added if the protection level
-- of any stylesheet is lower than the protection level of the template. A category name
-- without namespace, or nil to disable categorization (not recommended).
cfg['protection_conflict_category'] = 'Templates using TemplateStyles with a different protection level'
-- Hierarchy of protection levels, used to determine whether one protection level is lower
-- than another and thus should populate protection_conflict_category. No protection is treated as zero
cfg['protection_hierarchy'] = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
sysop = 4
}
-- Padlock pattern: Lua pattern to search on protected stylesheets for, or nil
-- to disable padlock check.
cfg['padlock_pattern'] = '{{pp-'
-- Missing padlock category: this category is added if a protected stylesheet
-- doesn’t contain any padlock template (specified by the above Lua pattern).
-- A category name without namespace (no nil allowed) if the pattern is not nil,
-- unused (and thus may be nil) otherwise.
cfg['missing_padlock_category'] = 'Templates using TemplateStyles without padlocks'
-- Default subpage for the stylesheet if none is given
cfg['default_subpage_name'] = 'styles.css'
return cfg -- Don’t touch this line.
jobuplor7csgdjcx4c6xrtnslslvft4
Модул:TNT
828
725
21849
2020-08-30T07:28:25Z
Johnuniq
2793
Changed protection level for "[[Module:TNT]]": [[WP:High-risk templates|High-risk Lua module]]: per request at [[WP:RFPP]] to match [[Module:Excerpt]] ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
21849
Scribunto
text/plain
--
-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!)
-- This module allows any template or module to be copy/pasted between
-- wikis without any translation changes. All translation text is stored
-- in the global Data:*.tab pages on Commons, and used everywhere.
--
-- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules
--
-- ATTENTION:
-- Please do NOT rename this module - it has to be identical on all wikis.
-- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT
-- Please do not modify it anywhere else, as it may get copied and override your changes.
-- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT
--
-- DESCRIPTION:
-- The "msg" function uses a Commons dataset to translate a message
-- with a given key (e.g. source-table), plus optional arguments
-- to the wiki markup in the current content language.
-- Use lang=xx to set language. Example:
--
-- {{#invoke:TNT | msg
-- | I18n/Template:Graphs.tab <!-- https://commons.wikimedia.org/wiki/Data:I18n/Template:Graphs.tab -->
-- | source-table <!-- uses a translation message with id = "source-table" -->
-- | param1 }} <!-- optional parameter -->
--
--
-- The "doc" function will generate the <templatedata> parameter documentation for templates.
-- This way all template parameters can be stored and localized in a single Commons dataset.
-- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons.
--
-- {{#invoke:TNT | doc | Graph:Lines }}
-- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab
-- if the current page is Template:Graph:Lines/doc
--
local p = {}
local i18nDataset = 'I18n/Module:TNT.tab'
-- Forward declaration of the local functions
local sanitizeDataset, loadData, link, formatMessage
function p.msg(frame)
local dataset, id
local params = {}
local lang = nil
for k, v in pairs(frame.args) do
if k == 1 then
dataset = mw.text.trim(v)
elseif k == 2 then
id = mw.text.trim(v)
elseif type(k) == 'number' then
table.insert(params, mw.text.trim(v))
elseif k == 'lang' and v ~= '_' then
lang = mw.text.trim(v)
end
end
return formatMessage(dataset, id, params, lang)
end
-- Identical to p.msg() above, but used from other lua modules
-- Parameters: name of dataset, message key, optional arguments
-- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
function p.format(dataset, key, ...)
local checkType = require('libraryUtil').checkType
checkType('format', 1, dataset, 'string')
checkType('format', 2, key, 'string')
return formatMessage(dataset, key, {...})
end
-- Identical to p.msg() above, but used from other lua modules with the language param
-- Parameters: language code, name of dataset, message key, optional arguments
-- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
function p.formatInLanguage(lang, dataset, key, ...)
local checkType = require('libraryUtil').checkType
checkType('formatInLanguage', 1, lang, 'string')
checkType('formatInLanguage', 2, dataset, 'string')
checkType('formatInLanguage', 3, key, 'string')
return formatMessage(dataset, key, {...}, lang)
end
-- Obsolete function that adds a 'c:' prefix to the first param.
-- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab'
function p.link(frame)
return link(frame.args[1])
end
function p.doc(frame)
local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1])
return frame:extensionTag('templatedata', p.getTemplateData(dataset)) ..
formatMessage(i18nDataset, 'edit_doc', {link(dataset)})
end
function p.getTemplateData(dataset)
-- TODO: add '_' parameter once lua starts reindexing properly for "all" languages
local data = loadData(dataset)
local names = {}
for _, field in pairs(data.schema.fields) do
table.insert(names, field.name)
end
local params = {}
local paramOrder = {}
for _, row in pairs(data.data) do
local newVal = {}
local name = nil
for pos, val in pairs(row) do
local columnName = names[pos]
if columnName == 'name' then
name = val
else
newVal[columnName] = val
end
end
if name then
params[name] = newVal
table.insert(paramOrder, name)
end
end
-- Work around json encoding treating {"1":{...}} as an [{...}]
params['zzz123']=''
local json = mw.text.jsonEncode({
params=params,
paramOrder=paramOrder,
description=data.description
})
json = string.gsub(json,'"zzz123":"",?', "")
return json
end
-- Local functions
sanitizeDataset = function(dataset)
if not dataset then
return nil
end
dataset = mw.text.trim(dataset)
if dataset == '' then
return nil
elseif string.sub(dataset,-4) ~= '.tab' then
return dataset .. '.tab'
else
return dataset
end
end
loadData = function(dataset, lang)
dataset = sanitizeDataset(dataset)
if not dataset then
error(formatMessage(i18nDataset, 'error_no_dataset', {}))
end
-- Give helpful error to thirdparties who try and copy this module.
if not mw.ext or not mw.ext.data or not mw.ext.data.get then
error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset)
end
local data = mw.ext.data.get(dataset, lang)
if data == false then
if dataset == i18nDataset then
-- Prevent cyclical calls
error('Missing Commons dataset ' .. i18nDataset)
else
error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)}))
end
end
return data
end
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix
link = function(dataset)
return 'c:Data:' .. mw.text.trim(dataset or '')
end
formatMessage = function(dataset, key, params, lang)
for _, row in pairs(loadData(dataset, lang).data) do
local id, msg = unpack(row)
if id == key then
local result = mw.message.newRawMessage(msg, unpack(params or {}))
return result:plain()
end
end
if dataset == i18nDataset then
-- Prevent cyclical calls
error('Invalid message key "' .. key .. '"')
else
error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)}))
end
end
return p
icfixo3zxiew6gqg3s5h19xr03x3wkh
21850
13928
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Module:TNT]]: Importing from the English wikipedia
13928
Scribunto
text/plain
--
-- INTRO: (!!! DO NOT RENAME THIS PAGE !!!)
-- This module allows any template or module to be copy/pasted between
-- wikis without any translation changes. All translation text is stored
-- in the global Data:*.tab pages on Commons, and used everywhere.
--
-- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules
--
-- ATTENTION:
-- Please do NOT rename this module - it has to be identical on all wikis.
-- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT
-- Please do not modify it anywhere else, as it may get copied and override your changes.
-- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT
--
-- DESCRIPTION:
-- The "msg" function uses a Commons dataset to translate a message
-- with a given key (e.g. source-table), plus optional arguments
-- to the wiki markup in the current content language.
-- Use lang=xx to set language. Example:
--
-- {{#invoke:TNT | msg
-- | I18n/Template:Graphs.tab <!-- https://commons.wikimedia.org/wiki/Data:I18n/Template:Graphs.tab -->
-- | source-table <!-- uses a translation message with id = "source-table" -->
-- | param1 }} <!-- optional parameter -->
--
--
-- The "doc" function will generate the <templatedata> parameter documentation for templates.
-- This way all template parameters can be stored and localized in a single Commons dataset.
-- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons.
--
-- {{#invoke:TNT | doc | Graph:Lines }}
-- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab
-- if the current page is Template:Graph:Lines/doc
--
local config = (function()
local ok, res = pcall(mw.loadData, "Module:TNT/config");
return ok and res or {};
end)();
local p = {}
local i18nDataset = 'I18n/Module:TNT.tab'
-- Forward declaration of the local functions
local sanitizeDataset, loadData, link, formatMessage
function p.msg(frame)
local dataset, id
local params = {}
local lang = nil
for k, v in pairs(frame.args) do
if k == 1 then
dataset = mw.text.trim(v)
elseif k == 2 then
id = mw.text.trim(v)
elseif type(k) == 'number' then
params[k - 2] = mw.text.trim(v)
elseif k == 'lang' and v ~= '_' then
lang = mw.text.trim(v)
end
end
return formatMessage(dataset, id, params, lang)
end
-- Identical to p.msg() above, but used from other lua modules
-- Parameters: name of dataset, message key, optional arguments
-- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
function p.format(dataset, key, ...)
local checkType = require('libraryUtil').checkType
checkType('format', 1, dataset, 'string')
checkType('format', 2, key, 'string')
return formatMessage(dataset, key, {...})
end
-- Identical to p.msg() above, but used from other lua modules with the language param
-- Parameters: language code, name of dataset, message key, optional arguments
-- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
function p.formatInLanguage(lang, dataset, key, ...)
local checkType = require('libraryUtil').checkType
checkType('formatInLanguage', 1, lang, 'string')
checkType('formatInLanguage', 2, dataset, 'string')
checkType('formatInLanguage', 3, key, 'string')
return formatMessage(dataset, key, {...}, lang)
end
-- Obsolete function that adds a 'c:' prefix to the first param.
-- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab'
function p.link(frame)
return link(frame.args[1])
end
local implGetTemplateData;
function p.doc(frame)
local dataset = sanitizeDataset(frame.args[1])
local json, dataPage, categories = implGetTemplateData(nil, dataset, frame.args)
return frame:extensionTag('templatedata', json) ..
formatMessage(i18nDataset, 'edit_doc', {link(dataPage)}) ..
(categories or "");
end
function p.getTemplateData(dataset)
local data = implGetTemplateData(true, dataset);
return data;
end
function p.getTemplateDataNew(...)
return implGetTemplateData(nil, ...);
end
function implGetTemplateData(legacy, dataset, args)
-- TODO: add '_' parameter once lua starts reindexing properly for "all" languages
local data, dataPage, categories = loadData(
dataset, nil, not legacy and 'TemplateData' or nil);
local names = {}
for _, field in ipairs(data.schema.fields) do
table.insert(names, field.name)
end
local numOnly = true
local params = {}
local paramOrder = {}
for _, row in ipairs(data.data) do
local newVal = {}
local name = nil
for pos, columnName in ipairs(names) do
if columnName == 'name' then
name = row[pos]
else
newVal[columnName] = row[pos]
end
end
if name then
if (
(type(name) ~= "number")
and (
(type(name) ~= "string")
or not string.match(name, "^%d+$")
)
) then
numOnly = false
end
params[name] = newVal
table.insert(paramOrder, name)
end
end
-- Work around json encoding treating {"1":{...}} as an [{...}]
if numOnly then
params['zzz123']=''
end
local json = mw.text.jsonEncode({
params=params,
paramOrder=paramOrder,
description=data.description,
-- TODO: Store this in a dataset:
format = (args and args.format or nil),
})
if numOnly then
json = string.gsub(json,'"zzz123":"",?', "")
end
return json, dataPage, categories;
end
-- Local functions
sanitizeDataset = function(dataset)
if not dataset then
return nil
end
dataset = mw.text.trim(dataset)
if dataset == '' then
return nil
elseif string.sub(dataset,-4) ~= '.tab' then
return dataset .. '.tab'
else
return dataset
end
end
loadData = function(dataset, lang, dataType)
dataset = sanitizeDataset(dataset)
if not dataset then
error(formatMessage(i18nDataset, 'error_no_dataset', {}))
end
-- Give helpful error to thirdparties who try and copy this module.
if not mw.ext or not mw.ext.data or not mw.ext.data.get then
error(string.format([['''Missing JsonConfig extension, or not properly configured;
Cannot load https://commons.wikimedia.org/wiki/Data:%s.
See https://www.mediawiki.org/wiki/Extension:JsonConfig#Supporting_Wikimedia_templates''']], dataset))
end
local dataPage = dataset;
local data, categories;
if dataType == 'TemplateData' then
dataPage = 'TemplateData/' .. dataset;
data = mw.ext.data.get(dataPage, lang);
if data == false then
data = mw.ext.data.get('Templatedata/' .. dataset, lang);
if data ~= false then
local legacyTemplateDataCategoryName = config.legacyTemplateDataCategoryName;
if legacyTemplateDataCategoryName ~= false then
categories = string.format(
'[[Category:%s%s]]',
legacyTemplateDataCategoryName or "Templates using legacy global TemplateData table name",
config.translatableCategoryLink and mw.getCurrentFrame():callParserFunction("#translation:") or ""
);
end
dataPage = 'Templatedata/' .. dataset;
end
end
else
data = mw.ext.data.get(dataset, lang)
end
if data == false then
if dataset == i18nDataset then
-- Prevent cyclical calls
error('Missing Commons dataset ' .. i18nDataset)
else
error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataPage)}))
end
end
return data, dataPage, categories;
end
-- Given a dataset name, convert it to a title with the 'commons:data:' prefix
link = function(dataset)
return 'c:Data:' .. mw.text.trim(dataset or '')
end
formatMessage = function(dataset, key, params, lang)
for _, row in pairs(loadData(dataset, lang).data) do
local id, msg = unpack(row)
if id == key then
local result = mw.message.newRawMessage(msg, unpack(params or {}))
return result:plain()
end
end
if dataset == i18nDataset then
-- Prevent cyclical calls
error('Invalid message key "' .. key .. '"')
else
error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)}))
end
end
return p
2ii65lh3z6ssbx7s7r8h0vsbnbhbiyl
Шаблон:Clear
10
753
21801
2024-02-13T14:32:36Z
Redrose64
2796
pass class through
21801
wikitext
text/x-wiki
<div style="clear:{{{1|both}}};" class={{{class|}}}></div><noinclude>
{{documentation}}
</noinclude>
an9yinekx1cqo1nkoi5u8nuqub9qbvg
21802
7366
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Template:Clear]]: Importing from the English wikipedia
7366
wikitext
text/x-wiki
<div style="clear:{{{1|both}}};" class={{{class|}}}></div><noinclude>
{{Документация}}
</noinclude>
pj81z69kdle2l8utlyq3p3bpbfjk4hc
Модул:ParameterCount
828
772
21855
2017-02-11T14:32:57Z
Mr. Stradivarius
2798
Protected "[[Module:ParameterCount]]": [[WP:High-risk templates|High-risk Lua module]]: 20,000+ transclusions ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
21855
Scribunto
text/plain
-- This module produces a count of all the arguments passed to it.
local yesno = require('Module:Yesno')
-- Trim a string
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
-- Test whether a string is blank
local function isBlank(s)
return not s:find('%S')
end
-- Tests whether a string is a valid positional key, and if so, returns it. If
-- the key is invalid, this returns nil.
local function isPositionalKey(s)
s = trim(s)
if s:find('^[1-9][0-9]*$') then
return tonumber(s)
end
end
-- Return the count of all arguments for which testFunc returns a truthy value.
local function count(args, testFunc)
local ret = 0
for key, val in pairs(args) do
if testFunc(key, val) then
ret = ret + 1
end
end
return ret
end
-- Check shared arguments and get the parent argument count.
local function main(frame, testFunc)
local blankifiedTestFunc
if yesno(frame.args.checkblanks) ~= false then
-- Extend the test function to check for blanks as well.
blankifiedTestFunc = function (key, val)
if not isBlank(val) then
return testFunc(key, val)
end
end
else
blankifiedTestFunc = testFunc
end
return count(frame:getParent().args, blankifiedTestFunc)
end
return {
-- Called with {{#invoke:ParameterCount|all}}
-- All specified parameters are counted, even those not supported by the
-- template.
all = function (frame)
return main(frame, function () return true end)
end,
-- Called with {{#invoke:ParameterCount|main}}
-- Users can specify a list of parameters to check, and a list of Lua
-- Ustring patterns to check each parameter against.
main = function (frame)
local args = frame.args
local keys, patterns = {}, {}
-- Get key list
for i, key in ipairs(args) do
local positionalKey = isPositionalKey(key)
if positionalKey then
keys[positionalKey] = true
else
keys[trim(key)] = true
end
end
-- Get patterns
do
local function getPattern(i)
local pattern = args['pattern' .. tostring(i)]
if pattern and pattern ~= '' then
return pattern
end
end
local i = 1
local pattern = getPattern(i)
while pattern do
patterns[i] = pattern
i = i + 1
pattern = getPattern(i)
end
end
-- Construct the test function
local testFunc = function (key, val)
if keys[key] then
return true
end
for i, pattern in ipairs(patterns) do
if mw.ustring.find(tostring(key), pattern) then
return true
end
end
return false
end
return main(frame, testFunc)
end
}
bo1vhgb6r7zni8qgcvzfnnphlmq92ml
21856
7397
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Module:ParameterCount]]: Importing from the English wikipedia
7397
Scribunto
text/plain
-- This module produces a count of all the arguments passed to it.
local yesno = require('Модул:Yesno')
-- Trim a string
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
-- Test whether a string is blank
local function isBlank(s)
return not s:find('%S')
end
-- Tests whether a string is a valid positional key, and if so, returns it. If
-- the key is invalid, this returns nil.
local function isPositionalKey(s)
s = trim(s)
if s:find('^[1-9][0-9]*$') then
return tonumber(s)
end
end
-- Return the count of all arguments for which testFunc returns a truthy value.
local function count(args, testFunc)
local ret = 0
for key, val in pairs(args) do
if testFunc(key, val) then
ret = ret + 1
end
end
return ret
end
-- Check shared arguments and get the parent argument count.
local function main(frame, testFunc)
local blankifiedTestFunc
if yesno(frame.args.checkblanks) ~= false then
-- Extend the test function to check for blanks as well.
blankifiedTestFunc = function (key, val)
if not isBlank(val) then
return testFunc(key, val)
end
end
else
blankifiedTestFunc = testFunc
end
return count(frame:getParent().args, blankifiedTestFunc)
end
return {
-- Called with {{#invoke:ParameterCount|all}}
-- All specified parameters are counted, even those not supported by the
-- template.
all = function (frame)
return main(frame, function () return true end)
end,
-- Called with {{#invoke:ParameterCount|main}}
-- Users can specify a list of parameters to check, and a list of Lua
-- Ustring patterns to check each parameter against.
main = function (frame)
local args = frame.args
local keys, patterns = {}, {}
-- Get key list
for i, key in ipairs(args) do
local positionalKey = isPositionalKey(key)
if positionalKey then
keys[positionalKey] = true
else
keys[trim(key)] = true
end
end
-- Get patterns
do
local function getPattern(i)
local pattern = args['pattern' .. tostring(i)]
if pattern and pattern ~= '' then
return pattern
end
end
local i = 1
local pattern = getPattern(i)
while pattern do
patterns[i] = pattern
i = i + 1
pattern = getPattern(i)
end
end
-- Construct the test function
local testFunc = function (key, val)
if keys[key] then
return true
end
for i, pattern in ipairs(patterns) do
if mw.ustring.find(tostring(key), pattern) then
return true
end
end
return false
end
return main(frame, testFunc)
end
}
k4n5mpdq4yk546fi75c04x04ypfqw33
Модул:Template wrapper
828
789
21811
2022-10-21T21:11:46Z
Legoktm
1752
Replace [[Module:No globals]] with require( "strict" )
21811
Scribunto
text/plain
require('strict');
local error_msg = '<span style=\"font-size:100%\" class=\"error\"><code style=\"color:inherit; border:inherit; padding:inherit;\">|_template=</code> missing or empty</span>';
--[[--------------------------< I S _ I N _ T A B L E >--------------------------------------------------------
scan through tbl looking for value; return true if found, false else
]]
local function is_in_table (tbl, value)
for k, v in pairs (tbl) do
if v == value then return true end
end
return false;
end
--[[--------------------------< A D D _ P A R A M E T E R >----------------------------------------------------
adds parameter name and its value to args table according to the state of boolean list argument; kv pair for
template execution; k=v string for template listing.
]]
local function add_parameter (k, v, args, list)
if list then
table.insert( args, table.concat ({k, '=', v})); -- write parameter names and values to args table as string
else
args[k] = v; -- copy parameters to args table
end
end
--[[--------------------------< A L I A S _ M A P _ G E T >----------------------------------------------------
returns a table of local template (parent frame) parameter names and the target template names that match where
in [key]=<value> pairs where:
[key] is local template parameter name (an alias)
<value> is target template parameter name (the canonical parameter name used in the working template)
The parameter |_alias-map= has the form:
|_alias-map=<list>
where <list> is a comma-separated list of alias / canonical parameter name pairs in the form
<from> : <to>
where:
<from> is the local template's parameter name (alias)
<to> is the target template's parameter name (canonical)
for enumerated parameters place an octothorp (#) where the enumerator digits are placed in the parameter names:
<from#> : <to#>
]]
local function alias_map_get (_alias_map)
local T = mw.text.split (_alias_map, '%s*,%s*'); -- convert the comma-separated list into a table of alias pairs
local mapped_aliases = {}; -- mapped aliases will go here
local l_name, t_name; -- parameter names
for _, alias_pair in ipairs (T) do -- loop through the table of alias pairs
l_name, t_name = alias_pair:match ('(.-)%s*:%s*(.+)'); -- from each pair, get local and target parameter names
if l_name and t_name then -- if both are set
if tonumber (l_name) then
l_name = tonumber (l_name); -- convert number-as-text to a number
end
mapped_aliases[l_name] = t_name; -- add them to the map table
end
end
return mapped_aliases;
end
--[[--------------------------< F R A M E _ A R G S _ G E T >--------------------------------------------------
Fetch the wrapper template's 'default' and control parameters; adds default parameters to args
returns content of |_template= parameter (name of the working template); nil else
]]
local function frame_args_get (frame_args, args, list)
local template;
for k, v in pairs (frame_args) do -- here we get the wrapper template's 'default' parameters
if 'string' == type (k) and (v and ('' ~= v)) then -- do not pass along positional or empty parameters
if '_template' == k then
template = v; -- save the name of template that we are wrapping
elseif '_exclude' ~= k and '_reuse' ~= k and '_include-positional' ~= k and '_alias-map' ~= k then -- these already handled so ignore here;
add_parameter (k, v, args, list); -- add all other parameters to args in the style dictated by list
end
end
end
return template; -- return contents of |_template= parameter
end
--[=[--------------------------< P F R A M E _ A R G S _ G E T >------------------------------------------------
Fetches the wrapper template's 'live' parameters; adds live parameters that aren't members of the exclude table to
args table; positional parameters may not be excluded
no return value
]=]
local function pframe_args_get (pframe_args, args, exclude, _include_positional, list)
for k, v in pairs (pframe_args) do
if 'string' == type (k) and not is_in_table (exclude, k) then -- do not pass along excluded parameters
if v and ('' ~= v) then -- pass along only those parameters that have assigned values
if 'unset' == v:lower() then -- special keyword to unset 'default' parameters set in the wrapper template
v = ''; -- unset the value in the args table
end
add_parameter (k, v, args, list) -- add all other parameters to args in the style dictated by list; alias map only supported for local-template parameters
end
end
end
if _include_positional then
for i, v in ipairs (pframe_args) do -- pass along positional parameters
if 'unset' == v:lower() then -- special keyword to unset 'default' parameters set in the wrapper template
v = ''; -- unset the value in the args table
end
add_parameter (i, v, args, list);
end
end
end
--[[--------------------------< _ M A I N >--------------------------------------------------------------------
Collect the various default and live parameters into args styled according to boolean list.
returns name of the working or listed template or nil for an error message
]]
local function _main (frame, args, list)
local template;
local exclude = {}; -- table of parameter names for parameters that are not passed to the working template
local reuse_list = {}; -- table of pframe parameter names whose values are modified before they are passed to the working template as the same name
local alias_map = {}; -- table that maps parameter aliases to working template canonical parameter names
local _include_positional;
if frame.args._exclude and ('' ~= frame.args._exclude) then -- if there is |_exclude= and it's not empty
exclude = mw.text.split (frame.args._exclude, "%s*,%s*"); -- make a table from its contents
end
-- TODO: |_reuse= needs a better name (|_reuse=)
if frame.args._reuse and ('' ~= frame.args._reuse) then -- if there is |_reuse= and it's not empty
reuse_list = mw.text.split (frame.args._reuse, "%s*,%s*"); -- make a table from its contents
end
if frame.args['_alias-map'] and ('' ~= frame.args['_alias-map']) then -- if there is |_alias-map= and it's not empty
alias_map = alias_map_get (frame.args['_alias-map']); -- make a table from its contents
end
template = frame_args_get (frame.args, args, list); -- get parameters provided in the {{#invoke:template wrapper|...|...}}
if nil == template or '' == template then -- this is the one parameter that is required by this module
return nil; -- not present, tell calling function to emit an error message
end
_include_positional = 'yes' == frame.args['_include-positional']; -- when true pass all positional parameters along with non-excluded named parameters to ...
-- ... the working template; positional parameters are not excludable
local _pframe_args = frame:getParent().args; -- here we get the wrapper template's 'live' parameters from pframe.args
local pframe_args = {}; -- a local table that we can modify
for k, v in pairs (_pframe_args) do -- make a copy that we can modify
pframe_args[k] = v;
end
-- here we look for pframe parameters that are aliases of canonical parameter names; when found
-- we replace the alias with the canonical. We do this here because the reuse_list works on
-- canonical parameter names so first we convert alias parameter names to canonical names and then
-- we remove those canonical names from the pframe table that are reused (provided to the working
-- template through the frame args table)
for k, v in pairs (alias_map) do -- k is alias name, v is canonical name
if pframe_args[k] then -- if pframe_args has parameter with alias name
pframe_args[v] = _pframe_args[k]; -- create new canonical name with alias' value
pframe_args[k] = nil; -- unset the alias
end
end
for k, v in pairs (pframe_args) do -- do enumerated parameter alias -> canonical translation
if 'string' == type (k) then -- only named parameters can be enumerated
if alias_map[k..'#'] then -- non-enumerated alias matches enumerated parameter pattern? enumerator at end only
pframe_args[alias_map[k..'#']:gsub('#', '')] = v; -- remove '#' and copy parameter to pframe_args table
pframe_args[k] = nil; -- unset the alias
elseif k:match ('%d+') then -- if this parameter name contains digits
local temp = k:gsub ('%d+', '#'); -- make a copy; digits replaced with single '#'
local enum = k:match ('%d+'); -- get the enumerator
if alias_map[temp] then -- if this parameter is a recognized enumerated alias
pframe_args[alias_map[temp]:gsub('#', enum)] = v; -- use canonical name and replace '#' with enumerator and add to pframe_args
pframe_args[k] = nil; -- unset the alias
end
end
end
end
-- pframe parameters that are _reused are 'reused' have the form something like this:
-- |chapter=[[wikisource:{{{chapter}}}|{{{chapter}}}]]
-- where a parameter in the wrapping template is modified and then passed to the working template
-- using the same parameter name (in this example |chapter=)
-- remove parameters that will be reused
for k, v in ipairs (reuse_list) do -- k is numerical index, v is canonical parameter name to ignore
if pframe_args[v] then -- if pframe_args has parameter that should be ignored
pframe_args[v] = nil; -- unset the ignored parameter
end
end
pframe_args_get (pframe_args, args, exclude, _include_positional, list); -- add parameters and values to args that are not listed in the exclude table
return template; -- args now has all default and live parameters, return working template name
end
--[[--------------------------< W R A P >----------------------------------------------------------------------
Template entry point. Call this function to 'execute' the working template
]]
local function wrap (frame)
local args = {}; -- table of default and live parameters and their values to be passed to the wrapped template
local template; -- the name of the working template
template = _main (frame, args, false); -- get default and live parameters and the name of the working template
if not template then -- template name is required
return error_msg; -- emit error message and abandon if template name not present
end
return frame:expandTemplate {title=template, args=args}; -- render the working template
end
--[[--------------------------< L I S T >----------------------------------------------------------------------
Template entry point. Call this function to 'display' the source for the working template. This function added
as a result of a TfD here: Wikipedia:Templates_for_discussion/Log/2018_April_28#Module:PassArguments
This function replaces a similarly named function which was used in {{cite compare}} and {{cite compare2}}
Values in the args table are numerically indexed strings in the form 'name=value'
]]
local function list(frame, do_link)
local args = {}; -- table of default and live parameters and their values to be passed to the listed template
local template; -- the name of the listed template
template = _main (frame, args, true); -- get default and live parameters and the name of the listed template
if not template then -- template name is required
return error_msg; -- emit error message and abandon if template name not present
end
if do_link then
template = ('[[%s|%s]]'):format(frame:expandTemplate{ title='Transclude', args = {template} }, template)
end
table.sort(args)
for i = 1, #args do
local stripped = args[i]:match('^' .. i .. '=([^=]*)$')
if stripped then args[i] = stripped else break end
end
return frame:preprocess(table.concat({
'<code style="color:inherit; background:inherit; border:none;">{{',
template,
('<wbr><nowiki>|%s</nowiki>'):rep(#args):format(unpack(args)), '}}</code>'})); -- render the template
end
local function link (frame)
return list(frame, true)
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
link = link,
list = list,
wrap = wrap,
};
b0ambjffywwcjy4rlrl344s9i200kdz
21812
7421
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Module:Template_wrapper]]: Importing from the English wikipedia
7421
Scribunto
text/plain
require('strict');
local error_msg = '<span style=\"font-size:100%\" class=\"error\"><code style=\"color:inherit; border:inherit; padding:inherit;\">|_template=</code> missing or empty</span>';
--[[--------------------------< I S _ I N _ T A B L E >--------------------------------------------------------
scan through tbl looking for value; return true if found, false else
]]
local function is_in_table (tbl, value)
for k, v in pairs (tbl) do
if v == value then return true end
end
return false;
end
--[[--------------------------< A D D _ P A R A M E T E R >----------------------------------------------------
adds parameter name and its value to args table according to the state of boolean list argument; kv pair for
template execution; k=v string for template listing.
]]
local function add_parameter (k, v, args, list)
if list then
table.insert( args, table.concat ({k, '=', v})); -- write parameter names and values to args table as string
else
args[k] = v; -- copy parameters to args table
end
end
--[[--------------------------< A L I A S _ M A P _ G E T >----------------------------------------------------
returns a table of local template (parent frame) parameter names and the target template names that match where
in [key]=<value> pairs where:
[key] is local template parameter name (an alias)
<value> is target template parameter name (the canonical parameter name used in the working template)
The parameter |_alias-map= has the form:
|_alias-map=<list>
where <list> is a comma-separated list of alias / canonical parameter name pairs in the form
<from> : <to>
where:
<from> is the local template's parameter name (alias)
<to> is the target template's parameter name (canonical)
for enumerated parameters place an octothorp (#) where the enumerator digits are placed in the parameter names:
<from#> : <to#>
]]
local function alias_map_get (_alias_map)
local T = mw.text.split (_alias_map, '%s*,%s*'); -- convert the comma-separated list into a table of alias pairs
local mapped_aliases = {}; -- mapped aliases will go here
local l_name, t_name; -- parameter names
for _, alias_pair in ipairs (T) do -- loop through the table of alias pairs
l_name, t_name = alias_pair:match ('(.-)%s*:%s*(.+)'); -- from each pair, get local and target parameter names
if l_name and t_name then -- if both are set
if tonumber (l_name) then
l_name = tonumber (l_name); -- convert number-as-text to a number
end
mapped_aliases[l_name] = t_name; -- add them to the map table
end
end
return mapped_aliases;
end
--[[--------------------------< F R A M E _ A R G S _ G E T >--------------------------------------------------
Fetch the wrapper template's 'default' and control parameters; adds default parameters to args
returns content of |_template= parameter (name of the working template); nil else
]]
local function frame_args_get (frame_args, args, list)
local template;
for k, v in pairs (frame_args) do -- here we get the wrapper template's 'default' parameters
if 'string' == type (k) and (v and ('' ~= v)) then -- do not pass along positional or empty parameters
if '_template' == k then
template = v; -- save the name of template that we are wrapping
elseif '_exclude' ~= k and '_reuse' ~= k and '_include-positional' ~= k and '_alias-map' ~= k then -- these already handled so ignore here;
add_parameter (k, v, args, list); -- add all other parameters to args in the style dictated by list
end
end
end
return template; -- return contents of |_template= parameter
end
--[=[--------------------------< P F R A M E _ A R G S _ G E T >------------------------------------------------
Fetches the wrapper template's 'live' parameters; adds live parameters that aren't members of the exclude table to
args table; positional parameters may not be excluded
no return value
]=]
local function pframe_args_get (pframe_args, args, exclude, _include_positional, list)
for k, v in pairs (pframe_args) do
if 'string' == type (k) and not is_in_table (exclude, k) then -- do not pass along excluded parameters
if v and ('' ~= v) then -- pass along only those parameters that have assigned values
if 'unset' == v:lower() then -- special keyword to unset 'default' parameters set in the wrapper template
v = ''; -- unset the value in the args table
end
add_parameter (k, v, args, list) -- add all other parameters to args in the style dictated by list; alias map only supported for local-template parameters
end
end
end
if _include_positional then
for i, v in ipairs (pframe_args) do -- pass along positional parameters
if 'unset' == v:lower() then -- special keyword to unset 'default' parameters set in the wrapper template
v = ''; -- unset the value in the args table
end
add_parameter (i, v, args, list);
end
end
end
--[[--------------------------< _ M A I N >--------------------------------------------------------------------
Collect the various default and live parameters into args styled according to boolean list.
returns name of the working or listed template or nil for an error message
]]
local function _main (frame, args, list)
local template;
local exclude = {}; -- table of parameter names for parameters that are not passed to the working template
local reuse_list = {}; -- table of pframe parameter names whose values are modified before they are passed to the working template as the same name
local alias_map = {}; -- table that maps parameter aliases to working template canonical parameter names
local _include_positional;
if frame.args._exclude and ('' ~= frame.args._exclude) then -- if there is |_exclude= and it's not empty
exclude = mw.text.split (frame.args._exclude, "%s*,%s*"); -- make a table from its contents
end
-- TODO: |_reuse= needs a better name (|_reuse=)
if frame.args._reuse and ('' ~= frame.args._reuse) then -- if there is |_reuse= and it's not empty
reuse_list = mw.text.split (frame.args._reuse, "%s*,%s*"); -- make a table from its contents
end
if frame.args['_alias-map'] and ('' ~= frame.args['_alias-map']) then -- if there is |_alias-map= and it's not empty
alias_map = alias_map_get (frame.args['_alias-map']); -- make a table from its contents
end
template = frame_args_get (frame.args, args, list); -- get parameters provided in the {{#invoke:template wrapper|...|...}}
if nil == template or '' == template then -- this is the one parameter that is required by this module
return nil; -- not present, tell calling function to emit an error message
end
_include_positional = 'yes' == frame.args['_include-positional']; -- when true pass all positional parameters along with non-excluded named parameters to ...
-- ... the working template; positional parameters are not excludable
local _pframe_args = frame:getParent().args; -- here we get the wrapper template's 'live' parameters from pframe.args
local pframe_args = {}; -- a local table that we can modify
for k, v in pairs (_pframe_args) do -- make a copy that we can modify
pframe_args[k] = v;
end
-- here we look for pframe parameters that are aliases of canonical parameter names; when found
-- we replace the alias with the canonical. We do this here because the reuse_list works on
-- canonical parameter names so first we convert alias parameter names to canonical names and then
-- we remove those canonical names from the pframe table that are reused (provided to the working
-- template through the frame args table)
for k, v in pairs (alias_map) do -- k is alias name, v is canonical name
if pframe_args[k] then -- if pframe_args has parameter with alias name
pframe_args[v] = _pframe_args[k]; -- create new canonical name with alias' value
pframe_args[k] = nil; -- unset the alias
end
end
for k, v in pairs (pframe_args) do -- do enumerated parameter alias -> canonical translation
if 'string' == type (k) then -- only named parameters can be enumerated
if alias_map[k..'#'] then -- non-enumerated alias matches enumerated parameter pattern? enumerator at end only
pframe_args[alias_map[k..'#']:gsub('#', '')] = v; -- remove '#' and copy parameter to pframe_args table
pframe_args[k] = nil; -- unset the alias
elseif k:match ('%d+') then -- if this parameter name contains digits
local temp = k:gsub ('%d+', '#'); -- make a copy; digits replaced with single '#'
local enum = k:match ('%d+'); -- get the enumerator
if alias_map[temp] then -- if this parameter is a recognized enumerated alias
pframe_args[alias_map[temp]:gsub('#', enum)] = v; -- use canonical name and replace '#' with enumerator and add to pframe_args
pframe_args[k] = nil; -- unset the alias
end
end
end
end
-- pframe parameters that are _reused are 'reused' have the form something like this:
-- |chapter=[[wikisource:{{{chapter}}}|{{{chapter}}}]]
-- where a parameter in the wrapping template is modified and then passed to the working template
-- using the same parameter name (in this example |chapter=)
-- remove parameters that will be reused
for k, v in ipairs (reuse_list) do -- k is numerical index, v is canonical parameter name to ignore
if pframe_args[v] then -- if pframe_args has parameter that should be ignored
pframe_args[v] = nil; -- unset the ignored parameter
end
end
pframe_args_get (pframe_args, args, exclude, _include_positional, list); -- add parameters and values to args that are not listed in the exclude table
return template; -- args now has all default and live parameters, return working template name
end
--[[--------------------------< W R A P >----------------------------------------------------------------------
Template entry point. Call this function to 'execute' the working template
]]
local function wrap (frame)
local args = {}; -- table of default and live parameters and their values to be passed to the wrapped template
local template; -- the name of the working template
template = _main (frame, args, false); -- get default and live parameters and the name of the working template
if not template then -- template name is required
return error_msg; -- emit error message and abandon if template name not present
end
return frame:expandTemplate {title=template, args=args}; -- render the working template
end
--[[--------------------------< L I S T >----------------------------------------------------------------------
Template entry point. Call this function to 'display' the source for the working template. This function added
as a result of a TfD here: Wikipedia:Templates_for_discussion/Log/2018_April_28#Module:PassArguments
This function replaces a similarly named function which was used in {{cite compare}} and {{cite compare2}}
Values in the args table are numerically indexed strings in the form 'name=value'
]]
local function list(frame, do_link)
local args = {}; -- table of default and live parameters and their values to be passed to the listed template
local template; -- the name of the listed template
template = _main (frame, args, true); -- get default and live parameters and the name of the listed template
if not template then -- template name is required
return error_msg; -- emit error message and abandon if template name not present
end
if do_link then
template = ('[[%s|%s]]'):format(frame:expandTemplate{ title='Transclude', args = {template} }, template)
end
table.sort(args)
for i = 1, #args do
local stripped = args[i]:match('^' .. i .. '=([^=]*)$')
if stripped then args[i] = stripped else break end
end
return frame:preprocess(table.concat({
'<code style="color:inherit; background:inherit; border:none;">{{',
template,
('<wbr><nowiki>|%s</nowiki>'):rep(#args):format(unpack(args)), '}}</code>'})); -- render the template
end
local function link (frame)
return list(frame, true)
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
link = link,
list = list,
wrap = wrap,
};
b0ambjffywwcjy4rlrl344s9i200kdz
Шаблон:Convert
10
823
21803
2020-08-09T22:52:24Z
Bsherr
2770
adding comment
21803
wikitext
text/x-wiki
<includeonly>{{{{{♥|safesubst:}}}#invoke:convert|convert}}</includeonly><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
hf9zof3enslixmyfgs0toady52qiq06
21804
7753
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Template:Convert]]: Importing from the English wikipedia
7753
wikitext
text/x-wiki
<includeonly>{{{{{♥|safesubst:}}}#invoke:convert|convert|abbr=on default|numdot=,|numsep=.}}</includeonly><noinclude>
{{documentation}}
</noinclude>
axye096mde1kd997w3tqrd71n5k3vpu
Модул:Convert
828
824
21753
7754
2026-01-15T02:19:56Z
Johnuniq
2793
update from sandbox per [[Template talk:Convert#Module version 33]]
21753
Scribunto
text/plain
-- Convert a value from one unit of measurement to another.
-- Example: {{convert|123|lb|kg}} --> 123 pounds (56 kg)
-- See [[:en:Template:Convert/Transwiki guide]] if copying to another wiki.
local MINUS = '−' -- Unicode U+2212 MINUS SIGN (UTF-8: e2 88 92)
local abs = math.abs
local floor = math.floor
local format = string.format
local log10 = math.log10
local ustring = mw.ustring
local ulen = ustring.len
local usub = ustring.sub
-- Configuration options to keep magic values in one location.
-- Conversion data and message text are defined in separate modules.
local config, maxsigfig
local numdot -- must be '.' or ',' or a character which works in a regex
local numsep, numsep_remove, numsep_remove2
local data_code, all_units
local text_code
local varname -- can be a code to use variable names that depend on value
local from_en_table -- to translate an output string of en digits to local language
local to_en_table -- to translate an input string of digits in local language to en
-- Use translation_table in convert/text to change the following.
local en_default -- true uses lang=en unless convert has lang=local or local digits
local group_method = 3 -- code for how many digits are in a group
local per_word = 'per' -- for units like "liters per kilometer"
local plural_suffix = 's' -- only other useful value is probably '' to disable plural unit names
local omitsep -- true to omit separator before local symbol/name
-- All units should be defined in the data module. However, to cater for quick changes
-- and experiments, any unknown unit is looked up in an extra data module, if it exists.
-- That module would be transcluded in only a small number of pages, so there should be
-- little server overhead from making changes, and changes should propagate quickly.
local extra_module -- name of module with extra units
local extra_units -- nil or table of extra units from extra_module
-- Some options in the invoking template can set variables used later in the module.
local currency_text -- for a user-defined currency symbol: {{convert|12|$/ha|$=€}} (euro replaces dollar)
local function from_en(text)
-- Input is a string representing a number in en digits with '.' decimal mark,
-- without digit grouping (which is done just after calling this).
-- Return the translation of the string with numdot and digits in local language.
if numdot ~= '.' then
text = text:gsub('%.', numdot)
end
if from_en_table then
text = text:gsub('%d', from_en_table)
end
return text
end
local function to_en(text)
-- Input is a string representing a number in the local language with
-- an optional numdot decimal mark and numsep digit grouping.
-- Return the translation of the string with '.' mark and en digits,
-- and no separators (they have to be removed here to handle cases like
-- numsep = '.' and numdot = ',' with input "1.234.567,8").
if to_en_table then
text = ustring.gsub(text, '%d', to_en_table)
end
if numsep_remove then
text = text:gsub(numsep_remove, '')
end
if numsep_remove2 then
text = text:gsub(numsep_remove2, '')
end
if numdot ~= '.' then
text = text:gsub(numdot, '.')
end
return text
end
local function decimal_mark(text)
-- Return ',' if text probably is using comma for decimal mark, or has no decimal mark.
-- Return '.' if text probably is using dot for decimal mark.
-- Otherwise return nothing (decimal mark not known).
if not text:find('[.,]') then return ',' end
text = text:gsub('^%-', ''):gsub('%+%d+/%d+$', ''):gsub('[Ee]%-?%d+$', '')
local decimal =
text:match('^0?([.,])%d+$') or
text:match('%d([.,])%d?%d?$') or
text:match('%d([.,])%d%d%d%d+$')
if decimal then return decimal end
if text:match('%.%d+%.') then return ',' end
if text:match('%,%d+,') then return '.' end
end
local add_warning, with_separator -- forward declarations
local function to_en_with_check(text, parms)
-- Version of to_en() for a wiki using numdot = ',' and numsep = '.' to check
-- text (an input number as a string) which might have been copied from enwiki.
-- For example, in '1.234' the '.' could be a decimal mark or a group separator.
-- From viwiki.
if to_en_table then
text = ustring.gsub(text, '%d', to_en_table)
end
if decimal_mark(text) == '.' then
local original = text
text = text:gsub(',', '') -- for example, interpret "1,234.5" as an enwiki value
if parms then
add_warning(parms, 0, 'cvt_enwiki_num', original, with_separator({}, text))
end
else
if numsep_remove then
text = text:gsub(numsep_remove, '')
end
if numsep_remove2 then
text = text:gsub(numsep_remove2, '')
end
if numdot ~= '.' then
text = text:gsub(numdot, '.')
end
end
return text
end
local function omit_separator(id)
-- Return true if there should be no separator before id (a unit symbol or name).
-- For zhwiki, there should be no separator if id uses local characters.
-- The following kludge should be a sufficient test.
if omitsep then
if id:sub(1, 2) == '-{' then -- for "-{...}-" content language variant
return true
end
if id:byte() > 127 then
local first = usub(id, 1, 1)
if first ~= 'Å' and first ~= '°' and first ~= 'µ' then
return true
end
end
end
return id:sub(1, 1) == '/' -- no separator before units like "/ha"
end
local spell_module -- name of module that can spell numbers
local speller -- function from that module to handle spelling (set if needed)
local wikidata_module, wikidata_data_module -- names of Wikidata modules
local wikidata_code, wikidata_data -- exported tables from those modules (set if needed)
local function set_config(args)
-- Set configuration options from template #invoke or defaults.
config = args
maxsigfig = config.maxsigfig or 14 -- maximum number of significant figures
local data_module, text_module
local sandbox = config.sandbox and ('/' .. config.sandbox) or ''
data_module = "Module:Convert/data" .. sandbox
text_module = "Module:Convert/text" .. sandbox
extra_module = "Module:Convert/extra" .. sandbox
wikidata_module = "Module:Convert/wikidata" .. sandbox
wikidata_data_module = "Module:Convert/wikidata/data" .. sandbox
spell_module = "Module:ConvertNumeric"
data_code = mw.loadData(data_module)
text_code = mw.loadData(text_module)
all_units = data_code.all_units
local translation = text_code.translation_table
if translation then
numdot = translation.numdot
numsep = translation.numsep
if numdot == ',' and numsep == '.' then
if text_code.all_messages.cvt_enwiki_num then
to_en = to_en_with_check
end
end
if translation.group then
group_method = translation.group
end
if translation.per_word then
per_word = translation.per_word
end
if translation.plural_suffix then
plural_suffix = translation.plural_suffix
end
varname = translation.varname
from_en_table = translation.from_en
local use_workaround = true
if use_workaround then
-- 2013-07-05 workaround bug by making a copy of the required table.
-- mw.ustring.gsub fails with a table (to_en_table) as the replacement,
-- if the table is accessed via mw.loadData.
local source = translation.to_en
if source then
to_en_table = {}
for k, v in pairs(source) do
to_en_table[k] = v
end
end
else
to_en_table = translation.to_en
end
if translation.lang == 'en default' then
en_default = true -- for hiwiki
end
omitsep = translation.omitsep -- for zhwiki
end
numdot = config.numdot or numdot or '.' -- decimal mark before fractional digits
numsep = config.numsep or numsep or ',' -- group separator for numbers
-- numsep should be ',' or '.' or '' or ' ' or a Unicode character.
-- numsep_remove must work in a regex to identify separators to be removed.
if numsep ~= '' then
numsep_remove = (numsep == '.') and '%.' or numsep
end
if numsep ~= ',' and numdot ~= ',' then
numsep_remove2 = ',' -- so numbers copied from enwiki will work
end
end
local function collection()
-- Return a table to hold items.
return {
n = 0,
add = function (self, item)
self.n = self.n + 1
self[self.n] = item
end,
}
end
local function divide(numerator, denominator)
-- Return integers quotient, remainder resulting from dividing the two
-- given numbers, which should be unsigned integers.
local quotient, remainder = floor(numerator / denominator), numerator % denominator
if not (0 <= remainder and remainder < denominator) then
-- Floating point limits may need this, as in {{convert|160.02|Ym|ydftin}}.
remainder = 0
end
return quotient, remainder
end
local function split(text, delimiter)
-- Return a numbered table with fields from splitting text.
-- The delimiter is used in a regex without escaping (for example, '.' would fail).
-- Each field has any leading/trailing whitespace removed.
local t = {}
text = text .. delimiter -- to get last item
for item in text:gmatch('%s*(.-)%s*' .. delimiter) do
table.insert(t, item)
end
return t
end
local function strip(text)
-- If text is a string, return its content with no leading/trailing
-- whitespace. Otherwise return nil (a nil argument gives a nil result).
if type(text) == 'string' then
return text:match("^%s*(.-)%s*$")
end
end
local function table_len(t)
-- Return length (<100) of a numbered table to replace #t which is
-- documented to not work if t is accessed via mw.loadData().
for i = 1, 100 do
if t[i] == nil then
return i - 1
end
end
end
local function wanted_category(catkey, catsort, want_warning)
-- Return message category if it is wanted in current namespace,
-- otherwise return ''.
local cat
local title = mw.title.getCurrentTitle()
if title then
local nsdefault = '0' -- default namespace: '0' = article; '0,10' = article and template
local namespace = title.namespace
for _, v in ipairs(split(config.nscat or nsdefault, ',')) do
if namespace == tonumber(v) then
cat = text_code.all_categories[want_warning and 'warning' or catkey]
if catsort and catsort ~= '' and cat:sub(-2) == ']]' then
cat = cat:sub(1, -3) .. '|' .. mw.text.nowiki(usub(catsort, 1, 20)) .. ']]'
end
break
end
end
end
return cat or ''
end
local function message(parms, mcode, is_warning)
-- Return wikitext for an error message, including category if specified
-- for the message type.
-- mcode = numbered table specifying the message:
-- mcode[1] = 'cvt_xxx' (string used as a key to get message info)
-- mcode[2] = 'parm1' (string to replace '$1' if any in message)
-- mcode[3] = 'parm2' (string to replace '$2' if any in message)
-- mcode[4] = 'parm3' (string to replace '$3' if any in message)
local msg
if type(mcode) == 'table' then
if mcode[1] == 'cvt_no_output' then
-- Some errors should cause convert to output an empty string,
-- for example, for an optional field in an infobox.
return ''
end
msg = text_code.all_messages[mcode[1]]
end
parms.have_problem = true
local function subparm(fmt, ...)
local rep = {}
for i, v in ipairs({...}) do
rep['$' .. i] = v
end
return (fmt:gsub('$%d+', rep))
end
if msg then
local parts = {}
local regex, replace = msg.regex, msg.replace
for i = 1, 3 do
local limit = 40
local s = mcode[i + 1]
if s then
if regex and replace then
s = s:gsub(regex, replace)
limit = nil -- allow long "should be" messages
end
-- Escape user input so it does not break the message.
-- To avoid tags (like {{convert|1<math>23</math>|m}}) breaking
-- the mouseover title, any strip marker starting with char(127) is
-- replaced with '...' (text not needing i18n).
local append
local pos = s:find(string.char(127), 1, true)
if pos then
append = '...'
s = s:sub(1, pos - 1)
end
if limit and ulen(s) > limit then
s = usub(s, 1, limit)
append = '...'
end
s = mw.text.nowiki(s) .. (append or '')
else
s = '?'
end
parts['$' .. i] = s
end
local function ispreview()
-- Return true if a prominent message should be shown.
if parms.test == 'preview' or parms.test == 'nopreview' then
-- For testing, can preview a real message or simulate a preview
-- when running automated tests.
return parms.test == 'preview'
end
local success, revid = pcall(function ()
return (parms.frame):preprocess('{{REVISIONID}}') end)
return success and (revid == '')
end
local want_warning = is_warning and
not config.warnings and -- show unobtrusive warnings if config.warnings not configured
not msg.nowarn -- but use msg settings, not standard warning, if specified
local title = string.gsub(msg[1] or 'Missing message', '$%d+', parts)
local text = want_warning and '*' or msg[2] or 'Missing message'
local cat = wanted_category(msg[3], mcode[2], want_warning)
local anchor = msg[4] or ''
local fmtkey = ispreview() and 'cvt_format_preview' or
(want_warning and 'cvt_format2' or msg.format or 'cvt_format')
local fmt = text_code.all_messages[fmtkey] or 'convert: bug'
return subparm(fmt, title:gsub('"', '"'), text, cat, anchor)
end
return 'Convert internal error: unknown message'
end
function add_warning(parms, level, key, text1, text2) -- for forward declaration above
-- If enabled, add a warning that will be displayed after the convert result.
-- A higher level is more verbose: more kinds of warnings are displayed.
-- To reduce output noise, only the first warning is displayed.
if level <= (tonumber(config.warnings) or 1) then
if parms.warnings == nil then
parms.warnings = message(parms, { key, text1, text2 }, true)
end
end
end
local function spell_number(parms, inout, number, numerator, denominator)
-- Return result of spelling (number, numerator, denominator), or
-- return nil if spelling is not available or not supported for given text.
-- Examples (each value must be a string or nil):
-- number numerator denominator output
-- ------ --------- ----------- -------------------
-- "1.23" nil nil one point two three
-- "1" "2" "3" one and two thirds
-- nil "2" "3" two thirds
if not speller then
local function get_speller(module)
return require(module).spell_number
end
local success
success, speller = pcall(get_speller, spell_module)
if not success or type(speller) ~= 'function' then
add_warning(parms, 1, 'cvt_no_spell', 'spell')
return nil
end
end
local case
if parms.spell_upper == inout then
case = true
parms.spell_upper = nil -- only uppercase first word in a multiple unit
end
local sp = not parms.opt_sp_us
local adj = parms.opt_adjectival
return speller(number, numerator, denominator, case, sp, adj)
end
------------------------------------------------------------------------
-- BEGIN: Code required only for built-in units.
-- LATER: If need much more code, move to another module to simplify this module.
local function speed_of_sound(altitude)
-- This is for the Mach built-in unit of speed.
-- Return speed of sound in metres per second at given altitude in feet.
-- If no altitude given, use default (zero altitude = sea level).
-- Table gives speed of sound in miles per hour at various altitudes:
-- altitude = -17,499 to 402,499 feet
-- mach_table[a + 4] = s where
-- a = (altitude / 5000) rounded to nearest integer (-3 to 80)
-- s = speed of sound (mph) at that altitude
-- From: http://www.aerospaceweb.org/question/atmosphere/q0112.shtml
local mach_table = { -- a =
799.5, 787.0, 774.2, 761.207051, -- -3 to 0
748.0, 734.6, 721.0, 707.0, 692.8, 678.3, 663.5, 660.1, 660.1, 660.1, -- 1 to 10
660.1, 660.1, 660.1, 662.0, 664.3, 666.5, 668.9, 671.1, 673.4, 675.6, -- 11 to 20
677.9, 683.7, 689.9, 696.0, 702.1, 708.1, 714.0, 719.9, 725.8, 731.6, -- 21 to 30
737.3, 737.7, 737.7, 736.2, 730.5, 724.6, 718.8, 712.9, 707.0, 701.0, -- 31 to 40
695.0, 688.9, 682.8, 676.6, 670.4, 664.1, 657.8, 652.9, 648.3, 643.7, -- 41 to 50
639.1, 634.4, 629.6, 624.8, 620.0, 615.2, 613.2, 613.2, 613.2, 613.5, -- 51 to 60
614.4, 615.3, 616.7, 619.8, 623.4, 629.7, 635.0, 641.1, 650.6, 660.0, -- 61 to 70
672.5, 674.3, 676.1, 677.9, 679.7, 681.5, 683.3, 685.1, 686.8, 688.6, -- 71 to 80
}
local function lerp(t, v0, v1)
return t * v1 + (1 - t) * v0
end
altitude = (altitude or 0) / 5000
if altitude < -3 then
altitude = -3
elseif altitude > 80 then
altitude = 80
end
local mach_mph
local a = math.floor(altitude)
if a == altitude then
mach_mph = mach_table[a + 4]
else
mach_mph = lerp(altitude - a, mach_table[a + 4], mach_table[a + 5])
end
return mach_mph * 0.44704 -- mph converted to m/s
end
-- END: Code required only for built-in units.
------------------------------------------------------------------------
local function add_style(parms, class)
-- Add selected template style to parms if not already present.
parms.templatestyles = parms.templatestyles or {}
if not parms.templatestyles[class] then
parms.templatestyles[class] = parms.frame:extensionTag({
name = 'templatestyles', args = { src = text_code.titles[class] }
})
end
end
local function get_styles(parms)
-- Return string of required template styles, empty if none.
if parms.templatestyles then
local t = {}
for _, v in pairs(parms.templatestyles) do
table.insert(t, v)
end
return table.concat(t)
end
return ''
end
local function get_range(word)
-- Return a range (string or table) corresponding to word (like "to"),
-- or return nil if not a range word.
local ranges = text_code.ranges
return ranges.types[word] or ranges.types[ranges.aliases[word]]
end
local function check_mismatch(unit1, unit2)
-- If unit1 cannot be converted to unit2, return an error message table.
-- This allows conversion between units of the same type, and between
-- Nm (normally torque) and ftlb (energy), as in gun-related articles.
-- This works because Nm is the base unit (scale = 1) for both the
-- primary type (torque), and the alternate type (energy, where Nm = J).
-- A match occurs if the primary types are the same, or if unit1 matches
-- the alternate type of unit2, and vice versa. That provides a whitelist
-- of which conversions are permitted between normally incompatible types.
if unit1.utype == unit2.utype or
(unit1.utype == unit2.alttype and unit1.alttype == unit2.utype) then
return nil
end
return { 'cvt_mismatch', unit1.utype, unit2.utype }
end
local function override_from(out_table, in_table, fields)
-- Copy the specified fields from in_table to out_table, but do not
-- copy nil fields (keep any corresponding field in out_table).
for _, field in ipairs(fields) do
if in_table[field] then
out_table[field] = in_table[field]
end
end
end
local function shallow_copy(t)
-- Return a shallow copy of table t.
-- Do not need the features and overhead of the Scribunto mw.clone().
local result = {}
for k, v in pairs(t) do
result[k] = v
end
return result
end
local unit_mt = {
-- Metatable to get missing values for a unit that does not accept SI prefixes.
-- Warning: The boolean value 'false' is returned for any missing field
-- so __index is not called twice for the same field in a given unit.
__index = function (self, key)
local value
if key == 'name1' or key == 'sym_us' then
value = self.symbol
elseif key == 'name2' then
value = self.name1 .. plural_suffix
elseif key == 'name1_us' then
value = self.name1
if not rawget(self, 'name2_us') then
-- If name1_us is 'foot', do not make name2_us by appending plural_suffix.
self.name2_us = self.name2
end
elseif key == 'name2_us' then
local raw1_us = rawget(self, 'name1_us')
if raw1_us then
value = raw1_us .. plural_suffix
else
value = self.name2
end
elseif key == 'link' then
value = self.name1
else
value = false
end
rawset(self, key, value)
return value
end
}
local function prefixed_name(unit, name, index)
-- Return unit name with SI prefix inserted at correct position.
-- index = 1 (name1), 2 (name2), 3 (name1_us), 4 (name2_us).
-- The position is a byte (not character) index, so use Lua's sub().
local pos = rawget(unit, 'prefix_position')
if type(pos) == 'string' then
pos = tonumber(split(pos, ',')[index])
end
if pos then
return name:sub(1, pos - 1) .. unit.si_name .. name:sub(pos)
end
return unit.si_name .. name
end
local unit_prefixed_mt = {
-- Metatable to get missing values for a unit that accepts SI prefixes.
-- Before use, fields si_name, si_prefix must be defined.
-- The unit must define _symbol, _name1 and
-- may define _sym_us, _name1_us, _name2_us
-- (_sym_us, _name2_us may be defined for a language using sp=us
-- to refer to a variant unrelated to U.S. units).
__index = function (self, key)
local value
if key == 'symbol' then
value = self.si_prefix .. self._symbol
if value == 'l' then value = 'L' end
elseif key == 'sym_us' then
value = rawget(self, '_sym_us')
if value then
value = self.si_prefix .. value
else
value = self.symbol
end
elseif key == 'name1' then
value = prefixed_name(self, self._name1, 1)
elseif key == 'name2' then
value = rawget(self, '_name2')
if value then
value = prefixed_name(self, value, 2)
else
value = self.name1 .. plural_suffix
end
elseif key == 'name1_us' then
value = rawget(self, '_name1_us')
if value then
value = prefixed_name(self, value, 3)
else
value = self.name1
end
elseif key == 'name2_us' then
value = rawget(self, '_name2_us')
if value then
value = prefixed_name(self, value, 4)
elseif rawget(self, '_name1_us') then
value = self.name1_us .. plural_suffix
else
value = self.name2
end
elseif key == 'link' then
value = self.name1
else
value = false
end
rawset(self, key, value)
return value
end
}
local unit_per_mt = {
-- Metatable to get values for a per unit of form "x/y".
-- This is never called to determine a unit name or link because per units
-- are handled as a special case.
-- Similarly, the default output is handled elsewhere, and for a symbol
-- this is only called from get_default() for default_exceptions.
__index = function (self, key)
local value
if key == 'symbol' then
local per = self.per
local unit1, unit2 = per[1], per[2]
if unit1 then
value = unit1[key] .. '/' .. unit2[key]
else
value = '/' .. unit2[key]
end
elseif key == 'sym_us' then
value = self.symbol
elseif key == 'scale' then
local per = self.per
local unit1, unit2 = per[1], per[2]
value = (unit1 and unit1.scale or 1) * self.scalemultiplier / unit2.scale
else
value = false
end
rawset(self, key, value)
return value
end
}
local function make_per(unitcode, unit_table, ulookup)
-- Return true, t where t is a per unit with unit codes expanded to unit tables,
-- or return false, t where t is an error message table.
local result = {
unitcode = unitcode,
utype = unit_table.utype,
per = {}
}
override_from(result, unit_table, { 'invert', 'iscomplex', 'default', 'link', 'symbol', 'symlink' })
result.symbol_raw = (result.symbol or false) -- to distinguish between a defined exception and a metatable calculation
local prefix
for i, v in ipairs(unit_table.per) do
if i == 1 and v == '' then
-- First unit symbol can be empty; that gives a nil first unit table.
elseif i == 1 and text_code.currency[v] then
prefix = currency_text or v
else
local success, t = ulookup(v)
if not success then return false, t end
result.per[i] = t
end
end
local multiplier = unit_table.multiplier
if not result.utype then
-- Creating an automatic per unit.
local unit1 = result.per[1]
local utype = (unit1 and unit1.utype or prefix or '') .. '/' .. result.per[2].utype
local t = data_code.per_unit_fixups[utype]
if t then
if type(t) == 'table' then
utype = t.utype or utype
result.link = result.link or t.link
multiplier = multiplier or t.multiplier
else
utype = t
end
end
result.utype = utype
end
result.scalemultiplier = multiplier or 1
result.vprefix = prefix or false -- set to non-nil to avoid calling __index
return true, setmetatable(result, unit_per_mt)
end
local function lookup(parms, unitcode, what, utable, fails, depth)
-- Return true, t where t is a copy of the unit's converter table,
-- or return false, t where t is an error message table.
-- Parameter 'what' determines whether combination units are accepted:
-- 'no_combination' : single unit only
-- 'any_combination' : single unit or combination or output multiple
-- 'only_multiple' : single unit or output multiple only
-- Parameter unitcode is a symbol (like 'g'), with an optional SI prefix (like 'kg').
-- If, for example, 'kg' is in this table, that entry is used;
-- otherwise the prefix ('k') is applied to the base unit ('g').
-- If unitcode is a known combination code (and if allowed by what),
-- a table of output multiple unit tables is included in the result.
-- For compatibility with the old template, an underscore in a unitcode is
-- replaced with a space so usage like {{convert|350|board_feet}} works.
-- Wikignomes may also put two spaces or " " in combinations, so
-- replace underscore, " ", and multiple spaces with a single space.
utable = utable or parms.unittable or all_units
fails = fails or {}
depth = depth and depth + 1 or 1
if depth > 9 then
-- There are ways to mistakenly define units which result in infinite
-- recursion when lookup() is called. That gives a long delay and very
-- confusing error messages, so the depth parameter is used as a guard.
return false, { 'cvt_lookup', unitcode }
end
if unitcode == nil or unitcode == '' then
return false, { 'cvt_no_unit' }
end
unitcode = unitcode:gsub('_', ' '):gsub(' ', ' '):gsub(' +', ' ')
local function call_make_per(t)
return make_per(unitcode, t,
function (ucode) return lookup(parms, ucode, 'no_combination', utable, fails, depth) end
)
end
local t = utable[unitcode]
if t then
if t.shouldbe then
return false, { 'cvt_should_be', t.shouldbe }
end
if t.sp_us then
parms.opt_sp_us = true
end
local target = t.target -- nil, or unitcode is an alias for this target
if target then
local success, result = lookup(parms, target, what, utable, fails, depth)
if not success then return false, result end
override_from(result, t, { 'customary', 'default', 'link', 'symbol', 'symlink', 'usename' })
if t.default then
result.defkey = unitcode -- so default_exceptions uses the alias code, not the target symbol
end
local multiplier = t.multiplier
if multiplier then
result.multiplier = tostring(multiplier)
result.scale = result.scale * multiplier
end
return true, result
end
if t.per then
return call_make_per(t)
end
local combo = t.combination -- nil or a table of unitcodes
if combo then
local multiple = t.multiple
if what == 'no_combination' or (what == 'only_multiple' and not multiple) then
return false, { 'cvt_bad_unit', unitcode }
end
-- Recursively create a combination table containing the
-- converter table of each unitcode.
local result = { utype = t.utype, multiple = multiple, combination = {} }
local cvt = result.combination
for i, v in ipairs(combo) do
local success, t = lookup(parms, v, multiple and 'no_combination' or 'only_multiple', utable, fails, depth)
if not success then return false, t end
cvt[i] = t
end
return true, result
end
local result = shallow_copy(t)
result.unitcode = unitcode
if result.prefixes then
result.si_name = ''
result.si_prefix = ''
return true, setmetatable(result, unit_prefixed_mt)
end
return true, setmetatable(result, unit_mt)
end
local SIprefixes = text_code.SIprefixes
for plen = SIprefixes[1] or 2, 1, -1 do
-- Look for an SI prefix; should never occur with an alias.
-- Check for longer prefix first ('dam' is decametre).
-- SIprefixes[1] = prefix maximum #characters (as seen by mw.ustring.sub).
local prefix = usub(unitcode, 1, plen)
local si = SIprefixes[prefix]
if si then
local t = utable[usub(unitcode, plen+1)]
if t and t.prefixes then
local result = shallow_copy(t)
result.unitcode = unitcode
result.si_name = parms.opt_sp_us and si.name_us or si.name
result.si_prefix = si.prefix or prefix
result.scale = t.scale * 10 ^ (si.exponent * t.prefixes)
return true, setmetatable(result, unit_prefixed_mt)
end
end
end
-- Accept user-defined combinations like "acre+m2+ha" or "acre m2 ha" for output.
-- If '+' is used, each unit code can include a space, and any error is fatal.
-- If ' ' is used and if each space-separated word is a unit code, it is a combo,
-- but errors are not fatal so the unit code can be looked up as an extra unit.
local err_is_fatal
local combo = collection()
if unitcode:find('+', 1, true) then
err_is_fatal = true
for item in (unitcode .. '+'):gmatch('%s*(.-)%s*%+') do
if item ~= '' then
combo:add(item)
end
end
elseif unitcode:find('%s') then
for item in unitcode:gmatch('%S+') do
combo:add(item)
end
end
if combo.n > 1 then
local function lookup_combo()
if what == 'no_combination' or what == 'only_multiple' then
return false, { 'cvt_bad_unit', unitcode }
end
local result = { combination = {} }
local cvt = result.combination
for i, v in ipairs(combo) do
local success, t = lookup(parms, v, 'only_multiple', utable, fails, depth)
if not success then return false, t end
if i == 1 then
result.utype = t.utype
else
local mismatch = check_mismatch(result, t)
if mismatch then
return false, mismatch
end
end
cvt[i] = t
end
return true, result
end
local success, result = lookup_combo()
if success or err_is_fatal then
return success, result
end
end
-- Accept any unit with an engineering notation prefix like "e6cuft"
-- (million cubic feet), but not chained prefixes like "e3e6cuft",
-- and not if the unit is a combination or multiple,
-- and not if the unit has an offset or is a built-in.
-- Only en digits are accepted.
local e, exponent, baseunit = unitcode:match('^([Ee])(%d+)(.*)')
if exponent then
local engscale = text_code.eng_scales[exponent]
if engscale then
local success, result = lookup(parms, baseunit, 'no_combination', utable, fails, depth)
if success and not (result.offset or result.builtin or result.engscale) then
if e == 'E' then
result.this_number_word = true
unitcode = 'e' .. unitcode:sub(2)
end
result.unitcode = unitcode -- 'e6cuft' not 'cuft'
result.defkey = unitcode -- key to lookup default exception
result.engscale = engscale
result.scale = result.scale * 10 ^ tonumber(exponent)
return true, result
end
end
end
-- Look for x/y; split on right-most slash to get scale correct (x/y/z is x/y per z).
local top, bottom = unitcode:match('^(.-)/([^/]+)$')
if top and not unitcode:find('e%d') then
-- If valid, create an automatic per unit for an "x/y" unit code.
-- The unitcode must not include extraneous spaces.
-- Engineering notation (apart from at start and which has been stripped before here),
-- is not supported so do not make a per unit if find text like 'e3' in unitcode.
local success, result = call_make_per({ per = {top, bottom} })
if success then
return true, result
end
end
if not parms.opt_no_extra and not get_range(unitcode) then
-- Want the "what links here" list for the extra_module to show only cases
-- where an extra unit is used, so do not require it when not needed
-- or if looking up a range word which cannot be a unit.
if not extra_units then
local success, extra = pcall(function () return require(extra_module).extra_units end)
if success and type(extra) == 'table' then
extra_units = extra
end
end
if extra_units then
-- A unit in one data table might refer to a unit in the other table, so
-- switch between them, relying on fails or depth to terminate loops.
if not fails[unitcode] then
fails[unitcode] = true
local other = (utable == all_units) and extra_units or all_units
local success, result = lookup(parms, unitcode, what, other, fails, depth)
if success then
return true, result
end
end
end
end
if to_en_table then
-- At fawiki it is common to translate all digits so a unit like "km2" becomes "km۲".
local en_code = ustring.gsub(unitcode, '%d', to_en_table)
if en_code ~= unitcode then
return lookup(parms, en_code, what, utable, fails, depth)
end
end
return false, { 'cvt_unknown', unitcode }
end
local function valid_number(num)
-- Return true if num is a valid number.
-- In Scribunto (different from some standard Lua), when expressed as a string,
-- overflow or other problems are indicated with text like "inf" or "nan"
-- which are regarded as invalid here (each contains "n").
if type(num) == 'number' and tostring(num):find('n', 1, true) == nil then
return true
end
end
local function hyphenated(name, parts)
-- Return a hyphenated form of given name (for adjectival usage).
-- The name may be linked and the target of the link must not be changed.
-- Hypothetical examples:
-- [[long ton|ton]] → [[long ton|ton]] (no change)
-- [[tonne|long ton]] → [[tonne|long-ton]]
-- [[metric ton|long ton]] → [[metric ton|long-ton]]
-- [[long ton]] → [[long ton|long-ton]]
-- Input can also have multiple links in a single name like:
-- [[United States customary units|U.S.]] [[US gallon|gallon]]
-- [[mile]]s per [[United States customary units|U.S.]] [[quart]]
-- [[long ton]]s per [[short ton]]
-- Assume that links cannot be nested (never like "[[abc[[def]]ghi]]").
-- This uses a simple and efficient procedure that works for most cases.
-- Some units (if used) would require more, and can later think about
-- adding a method to handle exceptions.
-- The procedure is to replace each space with a hyphen, but
-- not a space after ')' [for "(pre-1954 US) nautical mile"], and
-- not spaces immediately before '(' or in '(...)' [for cases like
-- "British thermal unit (ISO)" and "Calorie (International Steam Table)"].
if name:find(' ', 1, true) then
if parts then
local pos
if name:sub(1, 1) == '(' then
pos = name:find(')', 1, true)
if pos then
return name:sub(1, pos+1) .. name:sub(pos+2):gsub(' ', '-')
end
elseif name:sub(-1) == ')' then
pos = name:find('(', 1, true)
if pos then
return name:sub(1, pos-2):gsub(' ', '-') .. name:sub(pos-1)
end
end
return name:gsub(' ', '-')
end
parts = collection()
for before, item, after in name:gmatch('([^[]*)(%[%[[^[]*%]%])([^[]*)') do
if item:find(' ', 1, true) then
local prefix
local plen = item:find('|', 1, true)
if plen then
prefix = item:sub(1, plen)
item = item:sub(plen + 1, -3)
else
prefix = item:sub(1, -3) .. '|'
item = item:sub(3, -3)
end
item = prefix .. hyphenated(item, parts) .. ']]'
end
parts:add(before:gsub(' ', '-') .. item .. after:gsub(' ', '-'))
end
if parts.n == 0 then
-- No link like "[[...]]" was found in the original name.
parts:add(hyphenated(name, parts))
end
return table.concat(parts)
end
return name
end
local function hyphenated_maybe(parms, want_name, sep, id, inout)
-- Return s, f where
-- s = id, possibly modified
-- f = true if hyphenated
-- Possible modifications: hyphenate; prepend '-'; append mid text.
if id == nil or id == '' then
return ''
end
local mid = (inout == (parms.opt_flip and 'out' or 'in')) and parms.mid or ''
if want_name then
if parms.opt_adjectival then
return '-' .. hyphenated(id) .. mid, true
end
if parms.opt_add_s and id:sub(-1) ~= 's' then
id = id .. 's' -- for nowiki
end
end
return sep .. id .. mid
end
local function use_minus(text)
-- Return text with Unicode minus instead of '-', if present.
if text:sub(1, 1) == '-' then
return MINUS .. text:sub(2)
end
return text
end
local function digit_groups(parms, text, method)
-- Return a numbered table of groups of digits (left-to-right, in local language).
-- Parameter method is a number or nil:
-- 3 for 3-digit grouping (default), or
-- 2 for 3-then-2 grouping (only for digits before decimal mark).
local len_right
local len_left = text:find('.', 1, true)
if len_left then
len_right = #text - len_left
len_left = len_left - 1
else
len_left = #text
end
local twos = method == 2 and len_left > 5
local groups = collection()
local run = len_left
local n
if run < 4 or (run == 4 and parms.opt_comma5) then
if parms.opt_gaps then
n = run
else
n = #text
end
elseif twos then
n = run % 2 == 0 and 1 or 2
else
n = run % 3 == 0 and 3 or run % 3
end
while run > 0 do
groups:add(n)
run = run - n
n = (twos and run > 3) and 2 or 3
end
if len_right then
if groups.n == 0 then
groups:add(0)
end
if parms.opt_gaps and len_right > 3 then
local want4 = not parms.opt_gaps3 -- true gives no gap before trailing single digit
local isfirst = true
run = len_right
while run > 0 do
n = (want4 and run == 4) and 4 or (run > 3 and 3 or run)
if isfirst then
isfirst = false
groups[groups.n] = groups[groups.n] + 1 + n
else
groups:add(n)
end
run = run - n
end
else
groups[groups.n] = groups[groups.n] + 1 + len_right
end
end
local pos = 1
for i, length in ipairs(groups) do
groups[i] = from_en(text:sub(pos, pos + length - 1))
pos = pos + length
end
return groups
end
function with_separator(parms, text) -- for forward declaration above
-- Input text is a number in en digits with optional '.' decimal mark.
-- Return an equivalent, formatted for display:
-- with a custom decimal mark instead of '.', if wanted
-- with thousand separators inserted, if wanted
-- digits in local language
-- The given text is like '123' or '123.' or '12345.6789'.
-- The text has no sign (caller inserts that later, if necessary).
-- When using gaps, they are inserted before and after the decimal mark.
-- Separators are inserted only before the decimal mark.
-- A trailing dot (as in '123.') is removed because their use appears to
-- be accidental, and such a number should be shown as '123' or '123.0'.
-- It is useful for convert to suppress the dot so, for example, '4000.'
-- is a simple way of indicating that all the digits are significant.
if text:sub(-1) == '.' then
text = text:sub(1, -2)
end
if #text < 4 or parms.opt_nocomma or numsep == '' then
return from_en(text)
end
local groups = digit_groups(parms, text, group_method)
if parms.opt_gaps then
if groups.n <= 1 then
return groups[1] or ''
end
local nowrap = '<span style="white-space: nowrap">'
local gap = '<span style="margin-left: 0.25em">'
local close = '</span>'
return nowrap .. groups[1] .. gap .. table.concat(groups, close .. gap, 2, groups.n) .. close .. close
end
return table.concat(groups, numsep)
end
-- An input value like 1.23e12 is displayed using scientific notation (1.23×10¹²).
-- That also makes the output use scientific notation, except for small values.
-- In addition, very small or very large output values use scientific notation.
-- Use format(fmtpower, significand, '10', exponent) where each argument is a string.
local fmtpower = '%s<span style="margin:0 .15em 0 .25em">×</span>%s<sup>%s</sup>'
local function with_exponent(parms, show, exponent)
-- Return wikitext to display the implied value in scientific notation.
-- Input uses en digits; output uses digits in local language.
return format(fmtpower, with_separator(parms, show), from_en('10'), use_minus(from_en(tostring(exponent))))
end
local function make_sigfig(value, sigfig)
-- Return show, exponent that are equivalent to the result of
-- converting the number 'value' (where value >= 0) to a string,
-- rounded to 'sigfig' significant figures.
-- The returned items are:
-- show: a string of digits; no sign and no dot;
-- there is an implied dot before show.
-- exponent: a number (an integer) to shift the implied dot.
-- Resulting value = tonumber('.' .. show) * 10^exponent.
-- Examples:
-- make_sigfig(23.456, 3) returns '235', 2 (.235 * 10^2).
-- make_sigfig(0.0023456, 3) returns '235', -2 (.235 * 10^-2).
-- make_sigfig(0, 3) returns '000', 1 (.000 * 10^1).
if sigfig <= 0 then
sigfig = 1
elseif sigfig > maxsigfig then
sigfig = maxsigfig
end
if value == 0 then
return string.rep('0', sigfig), 1
end
local exp, fracpart = math.modf(log10(value))
if fracpart >= 0 then
fracpart = fracpart - 1
exp = exp + 1
end
local digits = format('%.0f', 10^(fracpart + sigfig))
if #digits > sigfig then
-- Overflow (for sigfig=3: like 0.9999 rounding to "1000"; need "100").
digits = digits:sub(1, sigfig)
exp = exp + 1
end
assert(#digits == sigfig, 'Bug: rounded number has wrong length')
return digits, exp
end
-- Fraction output format.
local fracfmt = {
{ -- Like {{frac}} (fraction slash).
'<span class="frac">{SIGN}<span class="num">{NUM}</span>⁄<span class="den">{DEN}</span></span>', -- 1/2
'<span class="frac">{SIGN}{WHOLE}<span class="sr-only">+</span><span class="num">{NUM}</span>⁄<span class="den">{DEN}</span></span>', -- 1+2/3
style = 'frac',
},
{ -- Like {{sfrac}} (stacked fraction, that is, horizontal bar).
'<span class="sfrac tion">{SIGN}<span class="num">{NUM}</span><span class="sr-only">/</span><span class="den">{DEN}</span></span>', -- 1//2
'<span class="sfrac">{SIGN}{WHOLE}<span class="sr-only">+</span><span class="tion"><span class="num">{NUM}</span><span class="sr-only">/</span><span class="den">{DEN}</span></span></span>', -- 1+2//3
style = 'sfrac',
},
}
local function format_fraction(parms, inout, negative, wholestr, numstr, denstr, do_spell, style)
-- Return wikitext for a fraction, possibly spelled.
-- Inputs use en digits and have no sign; output uses digits in local language.
local wikitext
if not style then
style = parms.opt_fraction_horizontal and 2 or 1
end
if wholestr == '' then
wholestr = nil
end
local substitute = {
SIGN = negative and MINUS or '',
WHOLE = wholestr and with_separator(parms, wholestr),
NUM = from_en(numstr),
DEN = from_en(denstr),
}
wikitext = fracfmt[style][wholestr and 2 or 1]:gsub('{(%u+)}', substitute)
if do_spell then
if negative then
if wholestr then
wholestr = '-' .. wholestr
else
numstr = '-' .. numstr
end
end
local s = spell_number(parms, inout, wholestr, numstr, denstr)
if s then
return s
end
end
add_style(parms, fracfmt[style].style)
return wikitext
end
local function format_number(parms, show, exponent, isnegative)
-- Parameter show is a string or a table containing strings.
-- Each string is a formatted number in en digits and optional '.' decimal mark.
-- A table represents a fraction: integer, numerator, denominator;
-- if a table is given, exponent must be nil.
-- Return t where t is a table with fields:
-- show = wikitext formatted to display implied value
-- (digits in local language)
-- is_scientific = true if show uses scientific notation
-- clean = unformatted show (possibly adjusted and with inserted '.')
-- (en digits)
-- sign = '' or MINUS
-- exponent = exponent (possibly adjusted)
-- The clean and exponent fields can be used to calculate the
-- rounded absolute value, if needed.
--
-- The value implied by the arguments is found from:
-- exponent is nil; and
-- show is a string of digits (no sign), with an optional dot;
-- show = '123.4' is value 123.4, '1234' is value 1234.0;
-- or:
-- exponent is an integer indicating where dot should be;
-- show is a string of digits (no sign and no dot);
-- there is an implied dot before show;
-- show does not start with '0';
-- show = '1234', exponent = 3 is value 0.1234*10^3 = 123.4.
--
-- The formatted result:
-- * Is for an output value and is spelled if wanted and possible.
-- * Includes a Unicode minus if isnegative and not spelled.
-- * Uses a custom decimal mark, if wanted.
-- * Has digits grouped where necessary, if wanted.
-- * Uses scientific notation if requested, or for very small or large values
-- (which forces result to not be spelled).
-- * Has no more than maxsigfig significant digits
-- (same as old template and {{#expr}}).
local xhi, xlo -- these control when scientific notation (exponent) is used
if parms.opt_scientific then
xhi, xlo = 4, 2 -- default for output if input uses e-notation
elseif parms.opt_scientific_always then
xhi, xlo = 0, 0 -- always use scientific notation (experimental)
else
xhi, xlo = 10, 4 -- default
end
local sign = isnegative and MINUS or ''
local maxlen = maxsigfig
local tfrac
if type(show) == 'table' then
tfrac = show
show = tfrac.wholestr
assert(exponent == nil, 'Bug: exponent given with fraction')
end
if not tfrac and not exponent then
local integer, dot, decimals = show:match('^(%d*)(%.?)(.*)')
if integer == '0' or integer == '' then
local zeros, figs = decimals:match('^(0*)([^0]?.*)')
if #figs == 0 then
if #zeros > maxlen then
show = '0.' .. zeros:sub(1, maxlen)
end
elseif #zeros >= xlo then
show = figs
exponent = -#zeros
elseif #figs > maxlen then
show = '0.' .. zeros .. figs:sub(1, maxlen)
end
elseif #integer >= xhi then
show = integer .. decimals
exponent = #integer
else
maxlen = maxlen + #dot
if #show > maxlen then
show = show:sub(1, maxlen)
end
end
end
if exponent then
local function zeros(n)
return string.rep('0', n)
end
if #show > maxlen then
show = show:sub(1, maxlen)
end
if exponent > xhi or exponent <= -xlo or (exponent == xhi and show ~= '1' .. zeros(xhi - 1)) then
-- When xhi, xlo = 10, 4 (the default), scientific notation is used if the
-- rounded value satisfies: value >= 1e9 or value < 1e-4 (1e9 = 0.1e10),
-- except if show is '1000000000' (1e9), for example:
-- {{convert|1000000000|m|m|sigfig=10}} → 1,000,000,000 metres (1,000,000,000 m)
local significand
if #show > 1 then
significand = show:sub(1, 1) .. '.' .. show:sub(2)
else
significand = show
end
return {
clean = '.' .. show,
exponent = exponent,
sign = sign,
show = sign .. with_exponent(parms, significand, exponent-1),
is_scientific = true,
}
end
if exponent >= #show then
show = show .. zeros(exponent - #show) -- result has no dot
elseif exponent <= 0 then
show = '0.' .. zeros(-exponent) .. show
else
show = show:sub(1, exponent) .. '.' .. show:sub(exponent+1)
end
end
local formatted_show
if tfrac then
show = tostring(tfrac.value) -- to set clean in returned table
formatted_show = format_fraction(parms, 'out', isnegative, tfrac.wholestr, tfrac.numstr, tfrac.denstr, parms.opt_spell_out)
else
if isnegative and show:match('^0.?0*$') then
sign = '' -- don't show minus if result is negative but rounds to zero
end
formatted_show = sign .. with_separator(parms, show)
if parms.opt_spell_out then
formatted_show = spell_number(parms, 'out', sign .. show) or formatted_show
end
end
return {
clean = show,
sign = sign,
show = formatted_show,
is_scientific = false, -- to avoid calling __index
}
end
local function extract_fraction(parms, text, negative)
-- If text represents a fraction, return
-- value, altvalue, show, denominator
-- where
-- value is a number (value of the fraction in argument text)
-- altvalue is an alternate interpretation of any fraction for the hands
-- unit where "12.1+3/4" means 12 hands 1.75 inches
-- show is a string (formatted text for display of an input value,
-- and is spelled if wanted and possible)
-- denominator is value of the denominator in the fraction
-- Otherwise, return nil.
-- Input uses en digits and '.' decimal mark (input has been translated).
-- Output uses digits in local language and local decimal mark, if any.
------------------------------------------------------------------------
-- Originally this function accepted x+y/z where x, y, z were any valid
-- numbers, possibly with a sign. For example '1.23e+2+1.2/2.4' = 123.5,
-- and '2-3/8' = 1.625. However, such usages were found to be errors or
-- misunderstandings, so since August 2014 the following restrictions apply:
-- x (if present) is an integer or has a single digit after decimal mark
-- y and z are unsigned integers
-- e-notation is not accepted
-- The overall number can start with '+' or '-' (so '12+3/4' and '+12+3/4'
-- and '-12-3/4' are valid).
-- Any leading negative sign is removed by the caller, so only inputs
-- like the following are accepted here (may have whitespace):
-- negative = false false true (there was a leading '-')
-- text = '2/3' '+2/3' '2/3'
-- text = '1+2/3' '+1+2/3' '1-2/3'
-- text = '12.3+1/2' '+12.3+1/2' '12.3-1/2'
-- Values like '12.3+1/2' are accepted, but are intended only for use
-- with the hands unit (not worth adding code to enforce that).
------------------------------------------------------------------------
local leading_plus, prefix, numstr, slashes, denstr =
text:match('^%s*(%+?)%s*(.-)%s*(%d+)%s*(/+)%s*(%d+)%s*$')
if not leading_plus then
-- Accept a single U+2044 fraction slash because that may be pasted.
leading_plus, prefix, numstr, denstr =
text:match('^%s*(%+?)%s*(.-)%s*(%d+)%s*⁄%s*(%d+)%s*$')
slashes = '/'
end
local numerator = tonumber(numstr)
local denominator = tonumber(denstr)
if numerator == nil or denominator == nil or (negative and leading_plus ~= '') then
return nil
end
local whole, wholestr
if prefix == '' then
wholestr = ''
whole = 0
else
-- Any prefix must be like '12+' or '12-' (whole number and fraction sign);
-- '12.3+' and '12.3-' are also accepted (single digit after decimal point)
-- because '12.3+1/2 hands' is valid (12 hands 3½ inches).
local num1, num2, frac_sign = prefix:match('^(%d+)(%.?%d?)%s*([+%-])$')
if num1 == nil then return nil end
if num2 == '' then -- num2 must be '' or like '.1' but not '.' or '.12'
wholestr = num1
else
if #num2 ~= 2 then return nil end
wholestr = num1 .. num2
end
if frac_sign ~= (negative and '-' or '+') then return nil end
whole = tonumber(wholestr)
if whole == nil then return nil end
end
local value = whole + numerator / denominator
if not valid_number(value) then return nil end
local altvalue = whole + numerator / (denominator * 10)
local style = #slashes -- kludge: 1 or 2 slashes can be used to select style
if style > 2 then style = 2 end
local wikitext = format_fraction(parms, 'in', negative, leading_plus .. wholestr, numstr, denstr, parms.opt_spell_in, style)
return value, altvalue, wikitext, denominator
end
local function extract_number(parms, text, another, no_fraction)
-- Return true, info if can extract a number from text,
-- where info is a table with the result,
-- or return false, t where t is an error message table.
-- Input can use en digits or digits in local language and can
-- have references at the end. Accepting references is intended
-- for use in infoboxes with a field for a value passed to convert.
-- Parameter another = true if the expected value is not the first.
-- Before processing, the input text is cleaned:
-- * Any thousand separators (valid or not) are removed.
-- * Any sign is replaced with '-' (if negative) or '' (otherwise).
-- That replaces Unicode minus with '-'.
-- If successful, the returned info table contains named fields:
-- value = a valid number
-- altvalue = a valid number, usually same as value but different
-- if fraction used (for hands unit)
-- singular = true if value is 1 or -1 (to use singular form of units)
-- clean = cleaned text with any separators and sign removed
-- (en digits and '.' decimal mark)
-- show = text formatted for output, possibly with ref strip markers
-- (digits in local language and custom decimal mark)
-- The resulting show:
-- * Is for an input value and is spelled if wanted and possible.
-- * Has a rounded value, if wanted.
-- * Has digits grouped where necessary, if wanted.
-- * If negative, a Unicode minus is used; otherwise the sign is
-- '+' (if the input text used '+'), or is '' (if no sign in input).
text = strip(text or '')
local reference
local pos = text:find('\127', 1, true)
if pos then
local before = text:sub(1, pos - 1)
local remainder = text:sub(pos)
local refs = {}
while #remainder > 0 do
local ref, spaces
ref, spaces, remainder = remainder:match('^(\127[^\127]*UNIQ[^\127]*%-ref[^\127]*\127)(%s*)(.*)')
if ref then
table.insert(refs, ref)
else
refs = {}
break
end
end
if #refs > 0 then
text = strip(before)
reference = table.concat(refs)
end
end
local clean = to_en(text, parms)
if clean == '' then
return false, { another and 'cvt_no_num2' or 'cvt_no_num' }
end
local isnegative, propersign = false, '' -- most common case
local singular, show, denominator
local value = tonumber(clean)
local altvalue
if value then
local sign = clean:sub(1, 1)
if sign == '+' or sign == '-' then
propersign = (sign == '+') and '+' or MINUS
clean = clean:sub(2)
end
if value < 0 then
isnegative = true
value = -value
end
else
local valstr
for _, prefix in ipairs({ '-', MINUS, '−' }) do
-- Including '-' sets isnegative in case input is a fraction like '-2-3/4'.
local plen = #prefix
if clean:sub(1, plen) == prefix then
valstr = clean:sub(plen + 1)
if valstr:match('^%s') then -- "- 1" is invalid but "-1 - 1/2" is ok
return false, { 'cvt_bad_num', text }
end
break
end
end
if valstr then
isnegative = true
propersign = MINUS
clean = valstr
value = tonumber(clean)
end
if value == nil then
if not no_fraction then
value, altvalue, show, denominator = extract_fraction(parms, clean, isnegative)
end
if value == nil then
return false, { 'cvt_bad_num', text }
end
if value <= 1 then
singular = true -- for example, "½ mile" or "one half mile" (singular unit)
end
end
end
if not valid_number(value) then -- for example, "1e310" may overflow
return false, { 'cvt_invalid_num' }
end
if show == nil then
-- clean is a non-empty string with no spaces, and does not represent a fraction,
-- and value = tonumber(clean) is a number >= 0.
-- If the input uses e-notation, show will be displayed using a power of ten, but
-- we use the number as given so it might not be normalized scientific notation.
-- The input value is spelled if specified so any e-notation is ignored;
-- that allows input like 2e6 to be spelled as "two million" which works
-- because the spell module converts '2e6' to '2000000' before spelling.
local function rounded(value, default, exponent)
local precision = parms.opt_ri
if precision then
local fmt = '%.' .. format('%d', precision) .. 'f'
local result = fmt:format(tonumber(value) + 2e-14) -- fudge for some common cases of bad rounding
if not exponent then
singular = (tonumber(result) == 1)
end
return result
end
return default
end
singular = (value == 1)
local scientific
local significand, exponent = clean:match('^([%d.]+)[Ee]([+%-]?%d+)')
if significand then
show = with_exponent(parms, rounded(significand, significand, exponent), exponent)
scientific = true
else
show = with_separator(parms, rounded(value, clean))
end
show = propersign .. show
if parms.opt_spell_in then
show = spell_number(parms, 'in', propersign .. rounded(value, clean)) or show
scientific = false
end
if scientific then
parms.opt_scientific = true
end
end
if isnegative and (value ~= 0) then
value = -value
altvalue = -(altvalue or value)
end
return true, {
value = value,
altvalue = altvalue or value,
singular = singular,
clean = clean,
show = show .. (reference or ''),
denominator = denominator,
}
end
local function get_number(text)
-- Return v, f where:
-- v = nil (text is not a number)
-- or
-- v = value of text (text is a number)
-- f = true if value is an integer
-- Input can use en digits or digits in local language or separators,
-- but no Unicode minus, and no fraction.
if text then
local number = tonumber(to_en(text))
if number then
local _, fracpart = math.modf(number)
return number, (fracpart == 0)
end
end
end
local function gcd(a, b)
-- Return the greatest common denominator for the given values,
-- which are known to be positive integers.
if a > b then
a, b = b, a
end
if a <= 0 then
return b
end
local r = b % a
if r <= 0 then
return a
end
if r == 1 then
return 1
end
return gcd(r, a)
end
local function fraction_table(value, denominator)
-- Return value as a string or a table:
-- * If result is a string, there is no fraction, and the result
-- is value formatted as a string of en digits.
-- * If result is a table, it represents a fraction with named fields:
-- wholestr, numstr, denstr (strings of en digits for integer, numerator, denominator).
-- The result is rounded to the nearest multiple of (1/denominator).
-- If the multiple is zero, no fraction is included.
-- No fraction is included if value is very large as the fraction would
-- be unhelpful, particularly if scientific notation is required.
-- Input value is a non-negative number.
-- Input denominator is a positive integer for the desired fraction.
if value <= 0 then
return '0'
end
if denominator <= 0 or value > 1e8 then
return format('%.2f', value)
end
local integer, decimals = math.modf(value)
local numerator = floor((decimals * denominator) +
0.5 + 2e-14) -- add fudge for some common cases of bad rounding
if numerator >= denominator then
integer = integer + 1
numerator = 0
end
local wholestr = tostring(integer)
if numerator > 0 then
local div = gcd(numerator, denominator)
if div > 1 then
numerator = numerator / div
denominator = denominator / div
end
return {
wholestr = (integer > 0) and wholestr or '',
numstr = tostring(numerator),
denstr = tostring(denominator),
value = value,
}
end
return wholestr
end
local function preunits(count, preunit1, preunit2)
-- If count is 1:
-- ignore preunit2
-- return p1
-- else:
-- preunit1 is used for preunit2 if the latter is empty
-- return p1, p2
-- where:
-- p1 is text to insert before the input unit
-- p2 is text to insert before the output unit
-- p1 or p2 may be nil to mean "no preunit"
-- Using '+' gives output like "5+ feet" (no space before, but space after).
local function withspace(text, wantboth)
-- Return text with space before and, if wantboth, after.
-- However, no space is added if there is a space or ' ' or '-'
-- at that position ('-' is for adjectival text).
-- There is also no space if text starts with '&'
-- (e.g. '°' would display a degree symbol with no preceding space).
local char = text:sub(1, 1)
if char == '&' then
return text -- an html entity can be used to specify the exact display
end
if not (char == ' ' or char == '-' or char == '+') then
text = ' ' .. text
end
if wantboth then
char = text:sub(-1, -1)
if not (char == ' ' or char == '-' or text:sub(-6, -1) == ' ') then
text = text .. ' '
end
end
return text
end
local PLUS = '+ '
preunit1 = preunit1 or ''
local trim1 = strip(preunit1)
if count == 1 then
if trim1 == '' then
return nil
end
if trim1 == '+' then
return PLUS
end
return withspace(preunit1, true)
end
preunit1 = withspace(preunit1)
preunit2 = preunit2 or ''
local trim2 = strip(preunit2)
if trim1 == '+' then
if trim2 == '' or trim2 == '+' then
return PLUS, PLUS
end
preunit1 = PLUS
end
if trim2 == '' then
if trim1 == '' then
return nil, nil
end
preunit2 = preunit1
elseif trim2 == '+' then
preunit2 = PLUS
elseif trim2 == ' ' then -- trick to make preunit2 empty
preunit2 = nil
else
preunit2 = withspace(preunit2)
end
return preunit1, preunit2
end
local function range_text(range, want_name, parms, before, after, inout, options)
-- Return before .. rtext .. after
-- where rtext is the text that separates two values in a range.
local rtext, adj_text, exception
options = options or {}
if type(range) == 'table' then
-- Table must specify range text for ('off' and 'on') or ('input' and 'output'),
-- and may specify range text for 'adj=on',
-- and may specify exception = true.
rtext = range[want_name and 'off' or 'on'] or
range[((inout == 'in') == (parms.opt_flip == true)) and 'output' or 'input']
adj_text = range['adj']
exception = range['exception']
else
rtext = range
end
if parms.opt_adjectival then
if want_name or (exception and parms.abbr_org == 'on') then
rtext = adj_text or rtext:gsub(' ', '-'):gsub(' ', '-')
end
end
if rtext == '–' and (options.spaced or after:sub(1, #MINUS) == MINUS) then
rtext = ' – '
end
return before .. rtext .. after
end
local function get_composite(parms, iparm, in_unit_table)
-- Look for a composite input unit. For example, {{convert|1|yd|2|ft|3|in}}
-- would result in a call to this function with
-- iparm = 3 (parms[iparm] = "2", just after the first unit)
-- in_unit_table = (unit table for "yd"; contains value 1 for number of yards)
-- Return true, iparm, unit where
-- iparm = index just after the composite units (7 in above example)
-- unit = composite unit table holding all input units,
-- or return true if no composite unit is present in parms,
-- or return false, t where t is an error message table.
local default, subinfo
local composite_units, count = { in_unit_table }, 1
local fixups = {}
local total = in_unit_table.valinfo[1].value
local subunit = in_unit_table
while subunit.subdivs do -- subdivs is nil or a table of allowed subdivisions
local subcode = strip(parms[iparm+1])
local subdiv = subunit.subdivs[subcode] or subunit.subdivs[(all_units[subcode] or {}).target]
if not subdiv then
break
end
local success
success, subunit = lookup(parms, subcode, 'no_combination')
if not success then return false, subunit end -- should never occur
success, subinfo = extract_number(parms, parms[iparm])
if not success then return false, subinfo end
iparm = iparm + 2
subunit.inout = 'in'
subunit.valinfo = { subinfo }
-- Recalculate total as a number of subdivisions.
-- subdiv[1] = number of subdivisions per previous unit (integer > 1).
total = total * subdiv[1] + subinfo.value
if not default then -- set by the first subdiv with a default defined
default = subdiv.default
end
count = count + 1
composite_units[count] = subunit
if subdiv.unit or subdiv.name then
fixups[count] = { unit = subdiv.unit, name = subdiv.name, valinfo = subunit.valinfo }
end
end
if count == 1 then
return true -- no error and no composite unit
end
for i, fixup in pairs(fixups) do
local unit = fixup.unit
local name = fixup.name
if not unit or (count > 2 and name) then
composite_units[i].fixed_name = name
else
local success, alternate = lookup(parms, unit, 'no_combination')
if not success then return false, alternate end -- should never occur
alternate.inout = 'in'
alternate.valinfo = fixup.valinfo
composite_units[i] = alternate
end
end
return true, iparm, {
utype = in_unit_table.utype,
scale = subunit.scale, -- scale of last (least significant) unit
valinfo = { { value = total, clean = subinfo.clean, denominator = subinfo.denominator } },
composite = composite_units,
default = default or in_unit_table.default
}
end
local function translate_parms(parms, kv_pairs)
-- Update fields in parms by translating each key:value in kv_pairs to terms
-- used by this module (may involve translating from local language to English).
-- Also, checks are performed which may display warnings, if enabled.
-- Return true if successful or return false, t where t is an error message table.
currency_text = nil -- local testing can hold module in memory; must clear globals
if kv_pairs.adj and kv_pairs.sing then
-- For enwiki (before translation), warn if attempt to use adj and sing
-- as the latter is a deprecated alias for the former.
if kv_pairs.adj ~= kv_pairs.sing and kv_pairs.sing ~= '' then
add_warning(parms, 1, 'cvt_unknown_option', 'sing=' .. kv_pairs.sing)
end
kv_pairs.sing = nil
end
kv_pairs.comma = kv_pairs.comma or config.comma -- for plwiki who want default comma=5
for loc_name, loc_value in pairs(kv_pairs) do
local en_name = text_code.en_option_name[loc_name]
if en_name then
local en_value = text_code.en_option_value[en_name]
if en_value == 'INTEGER' then -- altitude_ft, altitude_m, frac, sigfig
en_value = nil
if loc_value == '' then
add_warning(parms, 2, 'cvt_empty_option', loc_name)
else
local minimum
local number, is_integer = get_number(loc_value)
if en_name == 'sigfig' then
minimum = 1
elseif en_name == 'frac' then
minimum = 2
if number and number < 0 then
parms.opt_fraction_horizontal = true
number = -number
end
else
minimum = -1e6
end
if number and is_integer and number >= minimum then
en_value = number
else
local m
if en_name == 'frac' then
m = 'cvt_bad_frac'
elseif en_name == 'sigfig' then
m = 'cvt_bad_sigfig'
else
m = 'cvt_bad_altitude'
end
add_warning(parms, 1, m, loc_name .. '=' .. loc_value)
end
end
elseif en_value == 'TEXT' then -- $, input, qid, qual, stylein, styleout, tracking
en_value = loc_value ~= '' and loc_value or nil -- accept non-empty user text with no validation
if not en_value and (en_name == '$' or en_name == 'qid' or en_name == 'qual') then
add_warning(parms, 2, 'cvt_empty_option', loc_name)
elseif en_name == '$' then
-- Value should be a single character like "€" for the euro currency symbol, but anything is accepted.
currency_text = (loc_value == 'euro') and '€' or loc_value
elseif en_name == 'error' then
-- May have something like {{convert|...|error=x}} which will return the
-- conversion result if successful, or x if not (no error return).
parms.error_text = loc_value -- keep value because parms.error is nil if loc_value == ''
parms.opt_no_extra = true
elseif en_name == 'input' then
-- May have something like {{convert|input=}} (empty input) if source is an infobox
-- with optional fields. In that case, want to output nothing rather than an error.
parms.input_text = loc_value -- keep value because parms.input is nil if loc_value == ''
end
else
en_value = en_value[loc_value]
if en_value and en_value:sub(-1) == '?' then
en_value = en_value:sub(1, -2)
add_warning(parms, -1, 'cvt_deprecated', loc_name .. '=' .. loc_value)
end
if en_value == nil then
if loc_value == '' then
add_warning(parms, 2, 'cvt_empty_option', loc_name)
else
add_warning(parms, 1, 'cvt_unknown_option', loc_name .. '=' .. loc_value)
end
elseif en_value == '' then
en_value = nil -- an ignored option like adj=off
elseif type(en_value) == 'string' and en_value:sub(1, 4) == 'opt_' then
for _, v in ipairs(split(en_value, ',')) do
local lhs, rhs = v:match('^(.-)=(.+)$')
if rhs then
parms[lhs] = tonumber(rhs) or rhs
else
parms[v] = true
end
end
en_value = nil
end
end
parms[en_name] = en_value
else
add_warning(parms, 1, 'cvt_unknown_option', loc_name .. '=' .. loc_value)
end
end
local abbr_entered = parms.abbr
local cfg_abbr = config.abbr
if cfg_abbr then
-- Don't warn if invalid because every convert would show that warning.
if cfg_abbr == 'on always' then
parms.abbr = 'on'
elseif cfg_abbr == 'off always' then
parms.abbr = 'off'
elseif parms.abbr == nil then
if cfg_abbr == 'on default' then
parms.abbr = 'on'
elseif cfg_abbr == 'off default' then
parms.abbr = 'off'
end
end
end
if parms.abbr then
if parms.abbr == 'unit' then
parms.abbr = 'on'
parms.number_word = true
end
parms.abbr_org = parms.abbr -- original abbr, before any flip
elseif parms.opt_hand_hh then
parms.abbr_org = 'on'
parms.abbr = 'on'
else
parms.abbr = 'out' -- default is to abbreviate output only (use symbol, not name)
end
if parms.opt_order_out then
-- Disable options that do not work in a useful way with order=out.
parms.opt_flip = nil -- override adj=flip
parms.opt_spell_in = nil
parms.opt_spell_out = nil
parms.opt_spell_upper = nil
end
if parms.opt_spell_out and not abbr_entered then
parms.abbr = 'off' -- should show unit name when spelling the output value
end
if parms.opt_flip then
local function swap_in_out(option)
local value = parms[option]
if value == 'in' then
parms[option] = 'out'
elseif value == 'out' then
parms[option] = 'in'
end
end
swap_in_out('abbr')
swap_in_out('lk')
if parms.opt_spell_in and not parms.opt_spell_out then
-- For simplicity, and because it does not appear to be needed,
-- user cannot set an option to spell the output only.
parms.opt_spell_in = nil
parms.opt_spell_out = true
end
end
if parms.opt_spell_upper then
parms.spell_upper = parms.opt_flip and 'out' or 'in'
end
if parms.opt_table or parms.opt_tablecen then
if abbr_entered == nil and parms.lk == nil then
parms.opt_values = true
end
parms.table_align = parms.opt_table and 'right' or 'center'
end
if parms.table_align or parms.opt_sortable_on then
parms.need_table_or_sort = true
end
local disp_joins = text_code.disp_joins
local default_joins = disp_joins['b']
parms.join_between = default_joins[3] or '; '
local disp = parms.disp
if disp == nil then -- special case for the most common setting
parms.joins = default_joins
elseif disp == 'x' then
-- Later, parms.joins is set from the input parameters.
else
-- Old template does this.
local abbr = parms.abbr
if disp == 'slash' then
if abbr_entered == nil then
disp = 'slash-nbsp'
elseif abbr == 'in' or abbr == 'out' then
disp = 'slash-sp'
else
disp = 'slash-nosp'
end
elseif disp == 'sqbr' then
if abbr == 'on' then
disp = 'sqbr-nbsp'
else
disp = 'sqbr-sp'
end
end
parms.joins = disp_joins[disp] or default_joins
parms.join_between = parms.joins[3] or parms.join_between
parms.wantname = parms.joins.wantname
end
if (en_default and not parms.opt_lang_local and (parms[1] or ''):find('%d')) or parms.opt_lang_en then
from_en_table = nil
end
if en_default and from_en_table then
-- For hiwiki: localized symbol/name is defined with the US symbol/name field,
-- and is used if output uses localized numbers.
parms.opt_sp_us = true
end
return true
end
local function get_values(parms)
-- If successful, update parms and return true, v, i where
-- v = table of input values
-- i = index to next entry in parms after those processed here
-- or return false, t where t is an error message table.
local valinfo = collection() -- numbered table of input values
local range = collection() -- numbered table of range items (having, for example, 2 range items requires 3 input values)
local had_nocomma -- true if removed "nocomma" kludge from second parameter (like "tonocomma")
local parm2 = strip(parms[2])
if parm2 and parm2:sub(-7, -1) == 'nocomma' then
parms[2] = strip(parm2:sub(1, -8))
parms.opt_nocomma = true
had_nocomma = true
end
local function extractor(i)
-- If the parameter is not a value, try unpacking it as a range ("1-23" for "1 to 23").
-- However, "-1-2/3" is a negative fraction (-1⅔), so it must be extracted first.
-- Do not unpack a parameter if it is like "3-1/2" which is sometimes incorrectly
-- used instead of "3+1/2" (and which should not be interpreted as "3 to ½").
-- Unpacked items are inserted into the parms table.
-- The tail recursion allows combinations like "1x2 to 3x4".
local valstr = strip(parms[i]) -- trim so any '-' as a negative sign will be at start
local success, result = extract_number(parms, valstr, i > 1)
if not success and valstr and i < 20 then -- check i to limit abuse
local lhs, sep, rhs = valstr:match('^(%S+)%s+(%S+)%s+(%S.*)')
if lhs and not (sep == '-' and rhs:match('/')) then
if sep:find('%d') then
return success, result -- to reject {{convert|1 234 567|m}} with a decent message (en only)
end
parms[i] = rhs
table.insert(parms, i, sep)
table.insert(parms, i, lhs)
return extractor(i)
end
if not valstr:match('%-.*/') then
for _, sep in ipairs(text_code.ranges.words) do
local start, stop = valstr:find(sep, 2, true) -- start at 2 to skip any negative sign for range '-'
if start then
parms[i] = valstr:sub(stop + 1)
table.insert(parms, i, sep)
table.insert(parms, i, valstr:sub(1, start - 1))
return extractor(i)
end
end
end
end
return success, result
end
local i = 1
local is_change
while true do
local success, info = extractor(i) -- need to set parms.opt_nocomma before calling this
if not success then return false, info end
i = i + 1
if is_change then
info.is_change = true -- value is after "±" and so is a change (significant for range like {{convert|5|±|5|°C}})
is_change = nil
end
valinfo:add(info)
local range_item = get_range(strip(parms[i]))
if not range_item then
break
end
i = i + 1
range:add(range_item)
if type(range_item) == 'table' then
-- For range "x", if append unit to some values, append it to all.
parms.in_range_x = parms.in_range_x or range_item.in_range_x
parms.out_range_x = parms.out_range_x or range_item.out_range_x
parms.abbr_range_x = parms.abbr_range_x or range_item.abbr_range_x
is_change = range_item.is_range_change
end
end
if range.n > 0 then
if range.n > 30 then -- limit abuse, although 4 is a more likely upper limit
return false, { 'cvt_invalid_num' } -- misleading message but it will do
end
parms.range = range
elseif had_nocomma then
return false, { 'cvt_unknown', parm2 }
end
return true, valinfo, i
end
local function simple_get_values(parms)
-- If input is like "{{convert|valid_value|valid_unit|...}}",
-- return true, i, in_unit, in_unit_table
-- i = index in parms of what follows valid_unit, if anything.
-- The valid_value is not negative and does not use a fraction, and
-- no options requiring further processing of the input are used.
-- Otherwise, return nothing or return false, parm1 for caller to interpret.
-- Testing shows this function is successful for 96% of converts in articles,
-- and that on average it speeds up converts by 8%.
local clean = to_en(strip(parms[1] or ''), parms)
if parms.opt_ri or parms.opt_spell_in or #clean > 10 or not clean:match('^[0-9.]+$') then
return false, clean
end
local value = tonumber(clean)
if not value then return end
local info = {
value = value,
altvalue = value,
singular = (value == 1),
clean = clean,
show = with_separator(parms, clean),
}
local in_unit = strip(parms[2])
local success, in_unit_table = lookup(parms, in_unit, 'no_combination')
if not success then return end
in_unit_table.valinfo = { info }
return true, 3, in_unit, in_unit_table
end
local function wikidata_call(parms, operation, ...)
-- Return true, s where s is the result of a Wikidata operation,
-- or return false, t where t is an error message table.
local function worker(...)
wikidata_code = wikidata_code or require(wikidata_module)
wikidata_data = wikidata_data or mw.loadData(wikidata_data_module)
return wikidata_code[operation](wikidata_data, ...)
end
local success, status, result = pcall(worker, ...)
if success then
return status, result
end
if parms.opt_sortable_debug then
-- Use debug=yes to crash if an error while accessing Wikidata.
error('Error accessing Wikidata: ' .. status, 0)
end
return false, { 'cvt_wd_fail' }
end
local function get_parms(parms, args)
-- If successful, update parms and return true, unit where
-- parms is a table of all arguments passed to the template
-- converted to named arguments, and
-- unit is the input unit table;
-- or return false, t where t is an error message table.
-- For special processing (not a convert), can also return
-- true, wikitext where wikitext is the final result.
-- The returned input unit table may be for a fake unit using the specified
-- unit code as the symbol and name, and with bad_mcode = message code table.
-- MediaWiki removes leading and trailing whitespace from the values of
-- named arguments. However, the values of numbered arguments include any
-- whitespace entered in the template, and whitespace is used by some
-- parameters (example: the numbered parameters associated with "disp=x").
local kv_pairs = {} -- table of input key:value pairs where key is a name; needed because cannot iterate parms and add new fields to it
for k, v in pairs(args) do
if type(k) == 'number' or k == 'test' then -- parameter "test" is reserved for testing and is not translated
parms[k] = v
else
kv_pairs[k] = v
end
end
if parms.test == 'wikidata' then
local ulookup = function (ucode)
-- Use empty table for parms so it does not accumulate results when used repeatedly.
return lookup({}, ucode, 'no_combination')
end
return wikidata_call(parms, '_listunits', ulookup)
end
local success, msg = translate_parms(parms, kv_pairs)
if not success then return false, msg end
if parms.input then
success, msg = wikidata_call(parms, '_adjustparameters', parms, 1)
if not success then return false, msg end
end
local success, i, in_unit, in_unit_table = simple_get_values(parms)
if not success then
if type(i) == 'string' and i:match('^NNN+$') then
-- Some infoboxes have examples like {{convert|NNN|m}} (3 or more "N").
-- Output an empty string for these.
return false, { 'cvt_no_output' }
end
local valinfo
success, valinfo, i = get_values(parms)
if not success then return false, valinfo end
in_unit = strip(parms[i])
i = i + 1
success, in_unit_table = lookup(parms, in_unit, 'no_combination')
if not success then
in_unit = in_unit or ''
if parms.opt_ignore_error then -- display given unit code with no error (for use with {{val}})
in_unit_table = '' -- suppress error message and prevent processing of output unit
end
in_unit_table = setmetatable({
symbol = in_unit, name2 = in_unit, utype = in_unit,
scale = 1, default = '', defkey = '', linkey = '',
bad_mcode = in_unit_table }, unit_mt)
end
in_unit_table.valinfo = valinfo
end
if parms.test == 'msg' then
-- Am testing the messages produced when no output unit is specified, and
-- the input unit has a missing or invalid default.
-- Set two units for testing that.
-- LATER: Remove this code.
if in_unit == 'chain' then
in_unit_table.default = nil -- no default
elseif in_unit == 'rd' then
in_unit_table.default = "ft!X!m" -- an invalid expression
end
end
in_unit_table.inout = 'in' -- this is an input unit
if not parms.range then
local success, inext, composite_unit = get_composite(parms, i, in_unit_table)
if not success then return false, inext end
if composite_unit then
in_unit_table = composite_unit
i = inext
end
end
if in_unit_table.builtin == 'mach' then
-- As with old template, a number following Mach as the input unit is the altitude.
-- That is deprecated: should use altitude_ft=NUMBER or altitude_m=NUMBER.
local success, info
success = tonumber(parms[i]) -- this will often work and will give correct result for values like 2e4 without forcing output scientific notation
if success then
info = { value = success }
else
success, info = extract_number(parms, parms[i], false, true)
end
if success then
i = i + 1
in_unit_table.altitude = info.value
end
end
local word = strip(parms[i])
i = i + 1
local precision, is_bad_precision
local function set_precision(text)
local number, is_integer = get_number(text)
if number then
if is_integer then
precision = number
else
precision = text
is_bad_precision = true
end
return true -- text was used for precision, good or bad
end
end
if word and not set_precision(word) then
parms.out_unit = parms.out_unit or word
if set_precision(strip(parms[i])) then
i = i + 1
end
end
if parms.opt_adj_mid then
word = parms[i]
i = i + 1
if word then -- mid-text words
if word:sub(1, 1) == '-' then
parms.mid = word
else
parms.mid = ' ' .. word
end
end
end
if parms.opt_one_preunit then
parms[parms.opt_flip and 'preunit2' or 'preunit1'] = preunits(1, parms[i])
i = i + 1
end
if parms.disp == 'x' then
-- Following is reasonably compatible with the old template.
local first = parms[i] or ''
local second = parms[i+1] or ''
i = i + 2
if strip(first) == '' then -- user can enter ' ' rather than ' ' to avoid the default
first = ' [ ' .. first
second = ' ]' .. second
end
parms.joins = { first, second }
elseif parms.opt_two_preunits then
local p1, p2 = preunits(2, parms[i], parms[i+1])
i = i + 2
if parms.preunit1 then
-- To simplify documentation, allow unlikely use of adj=pre with disp=preunit
-- (however, an output unit must be specified with adj=pre and with disp=preunit).
parms.preunit1 = parms.preunit1 .. p1
parms.preunit2 = p2
else
parms.preunit1, parms.preunit2 = p1, p2
end
end
if precision == nil then
if set_precision(strip(parms[i])) then
i = i + 1
end
end
if is_bad_precision then
add_warning(parms, 1, 'cvt_bad_prec', precision)
else
parms.precision = precision
end
for j = i, i + 3 do
local parm = parms[j] -- warn if find a non-empty extraneous parameter
if parm and parm:match('%S') then
add_warning(parms, 1, 'cvt_unknown_option', parm)
break
end
end
return true, in_unit_table
end
local function record_default_precision(parms, out_current, precision)
-- If necessary, adjust parameters and return a possibly adjusted precision.
-- When converting a range of values where a default precision is required,
-- that default is calculated for each value because the result sometimes
-- depends on the precise input and output values. This function may cause
-- the entire convert process to be repeated in order to ensure that the
-- same default precision is used for each individual convert.
-- If that were not done, a range like 1000 to 1000.4 may give poor results
-- because the first output could be heavily rounded, while the second is not.
-- For range 1000.4 to 1000, this function can give the second convert the
-- same default precision that was used for the first.
if not parms.opt_round_each then
local maxdef = out_current.max_default_precision
if maxdef then
if maxdef < precision then
parms.do_convert_again = true
out_current.max_default_precision = precision
else
precision = out_current.max_default_precision
end
else
out_current.max_default_precision = precision
end
end
return precision
end
local function default_precision(parms, invalue, inclean, denominator, outvalue, in_current, out_current, extra)
-- Return a default value for precision (an integer like 2, 0, -2).
-- If denominator is not nil, it is the value of the denominator in inclean.
-- Code follows procedures used in old template.
local fudge = 1e-14 -- {{Order of magnitude}} adds this, so we do too
local prec, minprec, adjust
local subunit_ignore_trailing_zero
local subunit_more_precision -- kludge for "in" used in input like "|2|ft|6|in"
local composite = in_current.composite
if composite then
subunit_ignore_trailing_zero = true -- input "|2|st|10|lb" has precision 0, not -1
if composite[#composite].exception == 'subunit_more_precision' then
subunit_more_precision = true -- do not use standard precision with input like "|2|ft|6|in"
end
end
if denominator and denominator > 0 then
prec = math.max(log10(denominator), 1)
else
-- Count digits after decimal mark, handling cases like '12.345e6'.
local exponent
local integer, dot, decimals, expstr = inclean:match('^(%d*)(%.?)(%d*)(.*)')
local e = expstr:sub(1, 1)
if e == 'e' or e == 'E' then
exponent = tonumber(expstr:sub(2))
end
if dot == '' then
prec = subunit_ignore_trailing_zero and 0 or -integer:match('0*$'):len()
else
prec = #decimals
end
if exponent then
-- So '1230' and '1.23e3' both give prec = -1, and '0.00123' and '1.23e-3' give 5.
prec = prec - exponent
end
end
if in_current.istemperature and out_current.istemperature then
-- Converting between common temperatures (°C, °F, °R, K); not keVT.
-- Kelvin value can be almost zero, or small but negative due to precision problems.
-- Also, an input value like -300 C (below absolute zero) gives negative kelvins.
-- Calculate minimum precision from absolute value.
adjust = 0
local kelvin = abs((invalue - in_current.offset) * in_current.scale)
if kelvin < 1e-8 then -- assume nonzero due to input or calculation precision problem
minprec = 2
else
minprec = 2 - floor(log10(kelvin) + fudge) -- 3 sigfigs in kelvin
end
else
if invalue == 0 or outvalue <= 0 then
-- We are never called with a negative outvalue, but it might be zero.
-- This is special-cased to avoid calculation exceptions.
return record_default_precision(parms, out_current, 0)
end
if out_current.exception == 'integer_more_precision' and floor(invalue) == invalue then
-- With certain output units that sometimes give poor results
-- with default rounding, use more precision when the input
-- value is equal to an integer. An example of a poor result
-- is when input 50 gives a smaller output than input 49.5.
-- Experiment shows this helps, but it does not eliminate all
-- surprises because it is not clear whether "50" should be
-- interpreted as "from 45 to 55" or "from 49.5 to 50.5".
adjust = -log10(in_current.scale)
elseif subunit_more_precision then
-- Conversion like "{{convert|6|ft|1|in|cm}}" (where subunit is "in")
-- has a non-standard adjust value, to give more output precision.
adjust = log10(out_current.scale) + 2
else
adjust = log10(abs(invalue / outvalue))
end
adjust = adjust + log10(2)
-- Ensure that the output has at least two significant figures.
minprec = 1 - floor(log10(outvalue) + fudge)
end
if extra then
adjust = extra.adjust or adjust
minprec = extra.minprec or minprec
end
return record_default_precision(parms, out_current, math.max(floor(prec + adjust), minprec))
end
local function convert(parms, invalue, info, in_current, out_current)
-- Convert given input value from one unit to another.
-- Return output_value (a number) if a simple convert, or
-- return f, t where
-- f = true, t = table of information with results, or
-- f = false, t = error message table.
local inscale = in_current.scale
local outscale = out_current.scale
if not in_current.iscomplex and not out_current.iscomplex then
return invalue * (inscale / outscale) -- minimize overhead for most common case
end
if in_current.invert or out_current.invert then
-- Inverted units, such as inverse length, inverse time, or
-- fuel efficiency. Built-in units do not have invert set.
if (in_current.invert or 1) * (out_current.invert or 1) < 0 then
return 1 / (invalue * inscale * outscale)
end
return invalue * (inscale / outscale)
elseif in_current.offset then
-- Temperature (there are no built-ins for this type of unit).
if info.is_change then
return invalue * (inscale / outscale)
end
return (invalue - in_current.offset) * (inscale / outscale) + out_current.offset
else
-- Built-in unit.
local in_builtin = in_current.builtin
local out_builtin = out_current.builtin
if in_builtin and out_builtin then
if in_builtin == out_builtin then
return invalue
end
-- There are no cases (yet) where need to convert from one
-- built-in unit to another, so this should never occur.
return false, { 'cvt_bug_convert' }
end
if in_builtin == 'mach' or out_builtin == 'mach' then
-- Should check that only one altitude is given but am planning to remove
-- in_current.altitude (which can only occur when Mach is the input unit),
-- and out_current.altitude cannot occur.
local alt = parms.altitude_ft or in_current.altitude
if not alt and parms.altitude_m then
alt = parms.altitude_m / 0.3048 -- 1 ft = 0.3048 m
end
local spd = speed_of_sound(alt)
if in_builtin == 'mach' then
inscale = spd
return invalue * (inscale / outscale)
end
outscale = spd
local adjust = 0.1 / inscale
return true, {
outvalue = invalue * (inscale / outscale),
adjust = log10(adjust) + log10(2),
}
elseif in_builtin == 'hand' then
-- 1 hand = 4 inches; 1.2 hands = 6 inches.
-- Decimals of a hand are only defined for the first digit, and
-- the first fractional digit should be a number of inches (1, 2 or 3).
-- However, this code interprets the entire fractional part as the number
-- of inches / 10 (so 1.75 inches would be 0.175 hands).
-- A value like 12.3 hands is exactly 12*4 + 3 inches; base default precision on that.
local integer, fracpart = math.modf(invalue)
local inch_value = 4 * integer + 10 * fracpart -- equivalent number of inches
local factor = inscale / outscale
if factor == 4 then
-- Am converting to inches: show exact result, and use "inches" not "in" by default.
if parms.abbr_org == nil then
out_current.usename = true
end
local show = format('%g', abs(inch_value)) -- show and clean are unsigned
if not show:find('e', 1, true) then
return true, {
invalue = inch_value,
outvalue = inch_value,
clean = show,
show = show,
}
end
end
local outvalue = (integer + 2.5 * fracpart) * factor
local fracstr = info.clean:match('%.(.*)') or ''
local fmt
if fracstr == '' then
fmt = '%.0f'
else
fmt = '%.' .. format('%d', #fracstr - 1) .. 'f'
end
return true, {
invalue = inch_value,
clean = format(fmt, inch_value),
outvalue = outvalue,
minprec = 0,
}
end
end
return false, { 'cvt_bug_convert' } -- should never occur
end
local function user_style(parms, i)
-- Return text for a user-specified style for a table cell, or '' if none,
-- given i = 1 (input style) or 2 (output style).
local style = parms[(i == 1) and 'stylein' or 'styleout']
if style then
style = style:gsub('"', '')
if style ~= '' then
if style:sub(-1) ~= ';' then
style = style .. ';'
end
return style
end
end
return ''
end
local function make_table_or_sort(parms, invalue, info, in_current, scaled_top)
-- Set options to handle output for a table or a sort key, or both.
-- The text sort key is based on the value resulting from converting
-- the input to a fake base unit with scale = 1, and other properties
-- required for a conversion derived from the input unit.
-- For other modules, return the sort key in a hidden span element, and
-- the scaled value used to generate the sort key.
-- If scaled_top is set, it is the scaled value of the numerator of a per unit
-- to be combined with this unit (the denominator) to make the sort key.
-- Scaling only works with units that convert with a factor (not temperature).
local sortkey, scaled_value
if parms.opt_sortable_on then
local base = { -- a fake unit with enough fields for a valid convert
scale = 1,
invert = in_current.invert and 1,
iscomplex = in_current.iscomplex,
offset = in_current.offset and 0,
}
local outvalue, extra = convert(parms, invalue, info, in_current, base)
if extra then
outvalue = extra.outvalue
end
if in_current.istemperature then
-- Have converted to kelvin; assume numbers close to zero have a
-- rounding error and should be zero.
if abs(outvalue) < 1e-12 then
outvalue = 0
end
end
if scaled_top and outvalue ~= 0 then
outvalue = scaled_top / outvalue
end
scaled_value = outvalue
if not valid_number(outvalue) then
if outvalue < 0 then
sortkey = '1000000000000000000'
else
sortkey = '9000000000000000000'
end
elseif outvalue == 0 then
sortkey = '5000000000000000000'
else
local mag = floor(log10(abs(outvalue)) + 1e-14)
local prefix
if outvalue > 0 then
prefix = 7000 + mag
else
prefix = 2999 - mag
outvalue = outvalue + 10^(mag+1)
end
sortkey = format('%d', prefix) .. format('%015.0f', floor(outvalue * 10^(14-mag)))
end
end
local sortspan
if sortkey and not parms.table_align then
sortspan = parms.opt_sortable_debug and
'<span data-sort-value="' .. sortkey .. '♠"><span style="border:1px solid">' .. sortkey .. '♠</span></span>' or
'<span data-sort-value="' .. sortkey .. '♠"></span>'
parms.join_before = sortspan
end
if parms.table_align then
local sort
if sortkey then
sort = ' data-sort-value="' .. sortkey .. '"'
if parms.opt_sortable_debug then
parms.join_before = '<span style="border:1px solid">' .. sortkey .. '</span>'
end
else
sort = ''
end
local style = 'style="text-align:' .. parms.table_align .. ';'
local joins = {}
for i = 1, 2 do
joins[i] = (i == 1 and '' or '\n|') .. style .. user_style(parms, i) .. '"' .. sort .. '|'
end
parms.table_joins = joins
end
return sortspan, scaled_value
end
local cvt_to_hand
local function cvtround(parms, info, in_current, out_current)
-- Return true, t where t is a table with the conversion results; fields:
-- show = rounded, formatted string with the result of converting value in info,
-- using the rounding specified in parms.
-- singular = true if result (after rounding and ignoring any negative sign)
-- is "1", or like "1.00", or is a fraction with value < 1;
-- (and more fields shown below, and a calculated 'absvalue' field).
-- or return false, t where t is an error message table.
-- Input info.clean uses en digits (it has been translated, if necessary).
-- Output show uses en or non-en digits as appropriate, or can be spelled.
if out_current.builtin == 'hand' then
return cvt_to_hand(parms, info, in_current, out_current)
end
local invalue = in_current.builtin == 'hand' and info.altvalue or info.value
local outvalue, extra = convert(parms, invalue, info, in_current, out_current)
if parms.need_table_or_sort then
parms.need_table_or_sort = nil -- process using first input value only
make_table_or_sort(parms, invalue, info, in_current)
end
if extra then
if not outvalue then return false, extra end
invalue = extra.invalue or invalue
outvalue = extra.outvalue
end
if not valid_number(outvalue) then
return false, { 'cvt_invalid_num' }
end
local isnegative
if outvalue < 0 then
isnegative = true
outvalue = -outvalue
end
local precision, show, exponent
local denominator = out_current.frac
if denominator then
show = fraction_table(outvalue, denominator)
else
precision = parms.precision
if not precision then
if parms.sigfig then
show, exponent = make_sigfig(outvalue, parms.sigfig)
elseif parms.opt_round then
local n = parms.opt_round
if n == 0.5 then
local integer, fracpart = math.modf(floor(2 * outvalue + 0.5) / 2)
if fracpart == 0 then
show = format('%.0f', integer)
else
show = format('%.1f', integer + fracpart)
end
else
show = format('%.0f', floor((outvalue / n) + 0.5) * n)
end
elseif in_current.builtin == 'mach' then
local sigfig = info.clean:gsub('^[0.]+', ''):gsub('%.', ''):len() + 1
show, exponent = make_sigfig(outvalue, sigfig)
else
local inclean = info.clean
if extra then
inclean = extra.clean or inclean
show = extra.show
end
if not show then
precision = default_precision(parms, invalue, inclean, info.denominator, outvalue, in_current, out_current, extra)
end
end
end
end
if precision then
if precision >= 0 then
local fudge
if precision <= 8 then
-- Add a fudge to handle common cases of bad rounding due to inability
-- to precisely represent some values. This makes the following work:
-- {{convert|-100.1|C|K}} and {{convert|5555000|um|m|2}}.
-- Old template uses #expr round, which invokes PHP round().
-- LATER: Investigate how PHP round() works.
fudge = 2e-14
else
fudge = 0
end
local fmt = '%.' .. format('%d', precision) .. 'f'
local success
success, show = pcall(format, fmt, outvalue + fudge)
if not success then
return false, { 'cvt_big_prec', tostring(precision) }
end
else
precision = -precision -- #digits to zero (in addition to any digits after dot)
local shift = 10 ^ precision
show = format('%.0f', outvalue/shift)
if show ~= '0' then
exponent = #show + precision
end
end
end
local t = format_number(parms, show, exponent, isnegative)
if type(show) == 'string' then
-- Set singular using match because on some systems 0.99999999999999999 is 1.0.
if exponent then
t.singular = (exponent == 1 and show:match('^10*$'))
else
t.singular = (show == '1' or show:match('^1%.0*$'))
end
else
t.fraction_table = show
t.singular = (outvalue <= 1) -- cannot have 'fraction == 1', but if it were possible it would be singular
end
t.raw_absvalue = outvalue -- absolute value before rounding
return true, setmetatable(t, {
__index = function (self, key)
if key == 'absvalue' then
-- Calculate absolute value after rounding, if needed.
local clean, exponent = rawget(self, 'clean'), rawget(self, 'exponent')
local value = tonumber(clean) -- absolute value (any negative sign has been ignored)
if exponent then
value = value * 10^exponent
end
rawset(self, key, value)
return value
end
end })
end
function cvt_to_hand(parms, info, in_current, out_current)
-- Convert input to hands, inches.
-- Return true, t where t is a table with the conversion results;
-- or return false, t where t is an error message table.
if parms.abbr_org == nil then
out_current.usename = true -- default is to show name not symbol
end
local precision = parms.precision
local frac = out_current.frac
if not frac and precision and precision > 1 then
frac = (precision == 2) and 2 or 4
end
local out_next = out_current.out_next
if out_next then
-- Use magic knowledge to determine whether the next unit is inches without requiring i18n.
-- The following ensures that when the output combination "hand in" is used, the inches
-- value is rounded to match the hands value. Also, displaying say "61½" instead of 61.5
-- is better as 61.5 implies the value is not 61.4.
if out_next.exception == 'subunit_more_precision' then
out_next.frac = frac
end
end
-- Convert to inches; calculate hands from that.
local dummy_unit_table = { scale = out_current.scale / 4, frac = frac }
local success, outinfo = cvtround(parms, info, in_current, dummy_unit_table)
if not success then return false, outinfo end
local tfrac = outinfo.fraction_table
local inches = outinfo.raw_absvalue
if tfrac then
inches = floor(inches) -- integer part only; fraction added later
else
inches = floor(inches + 0.5) -- a hands measurement never shows decimals of an inch
end
local hands, inches = divide(inches, 4)
outinfo.absvalue = hands + inches/4 -- supposed to be the absolute rounded value, but this is close enough
local inchstr = tostring(inches) -- '0', '1', '2' or '3'
if precision and precision <= 0 then -- using negative or 0 for precision rounds to nearest hand
hands = floor(outinfo.raw_absvalue/4 + 0.5)
inchstr = ''
elseif tfrac then
-- Always show an integer before fraction (like "15.0½") because "15½" means 15-and-a-half hands.
inchstr = numdot .. format_fraction(parms, 'out', false, inchstr, tfrac.numstr, tfrac.denstr)
else
inchstr = numdot .. from_en(inchstr)
end
outinfo.show = outinfo.sign .. with_separator(parms, format('%.0f', hands)) .. inchstr
return true, outinfo
end
local function evaluate_condition(value, condition)
-- Return true or false from applying a conditional expression to value,
-- or throw an error if invalid.
-- A very limited set of expressions is supported:
-- v < 9
-- v * 9 < 9
-- where
-- 'v' is replaced with value
-- 9 is any number (as defined by Lua tonumber)
-- only en digits are accepted
-- '<' can also be '<=' or '>' or '>='
-- In addition, the following form is supported:
-- LHS and RHS
-- where
-- LHS, RHS = any of above expressions.
local function compare(value, text)
local arithop, factor, compop, limit = text:match('^%s*v%s*([*]?)(.-)([<>]=?)(.*)$')
if arithop == nil then
error('Invalid default expression', 0)
elseif arithop == '*' then
factor = tonumber(factor)
if factor == nil then
error('Invalid default expression', 0)
end
value = value * factor
end
limit = tonumber(limit)
if limit == nil then
error('Invalid default expression', 0)
end
if compop == '<' then
return value < limit
elseif compop == '<=' then
return value <= limit
elseif compop == '>' then
return value > limit
elseif compop == '>=' then
return value >= limit
end
error('Invalid default expression', 0) -- should not occur
end
local lhs, rhs = condition:match('^(.-%W)and(%W.*)')
if lhs == nil then
return compare(value, condition)
end
return compare(value, lhs) and compare(value, rhs)
end
local function get_default(value, unit_table)
-- Return true, s where s = name of unit's default output unit,
-- or return false, t where t is an error message table.
-- Some units have a default that depends on the input value
-- (the first value if a range of values is used).
-- If '!' is in the default, the first bang-delimited field is an
-- expression that uses 'v' to represent the input value.
-- Example: 'v < 120 ! small ! big ! suffix' (suffix is optional)
-- evaluates 'v < 120' as a boolean with result
-- 'smallsuffix' if (value < 120), or 'bigsuffix' otherwise.
-- Input must use en digits and '.' decimal mark.
local default = data_code.default_exceptions[unit_table.defkey or unit_table.symbol] or unit_table.default
if not default then
local per = unit_table.per
if per then
local function a_default(v, u)
local success, ucode = get_default(v, u)
if not success then
return '?' -- an unlikely error has occurred; will cause lookup of default to fail
end
-- Attempt to use only the first unit if a combination or output multiple.
-- This is not bulletproof but should work for most cases.
-- Where it does not work, the convert will need to specify the wanted output unit.
local t = all_units[ucode]
if t then
local combo = t.combination
if combo then
-- For a multiple like ftin, the "first" unit (ft) is last in the combination.
local i = t.multiple and table_len(combo) or 1
ucode = combo[i]
end
else
-- Try for an automatically generated combination.
local item = ucode:match('^(.-)%+') or ucode:match('^(%S+)%s')
if all_units[item] then
return item
end
end
return ucode
end
local unit1, unit2 = per[1], per[2]
local def1 = (unit1 and a_default(value, unit1) or unit_table.vprefix or '')
local def2 = a_default(1, unit2) -- 1 because per unit of denominator
return true, def1 .. '/' .. def2
end
return false, { 'cvt_no_default', unit_table.symbol }
end
if default:find('!', 1, true) == nil then
return true, default
end
local t = split(default, '!')
if #t == 3 or #t == 4 then
local success, result = pcall(evaluate_condition, value, t[1])
if success then
default = result and t[2] or t[3]
if #t == 4 then
default = default .. t[4]
end
return true, default
end
end
return false, { 'cvt_bad_default', unit_table.symbol }
end
local linked_pages -- to record linked pages so will not link to the same page more than once
local function unlink(unit_table)
-- Forget that the given unit has previously been linked (if it has).
-- That is needed when processing a range of inputs or outputs when an id
-- for the first range value may have been evaluated, but only an id for
-- the last value is displayed, and that id may need to be linked.
linked_pages[unit_table.unitcode or unit_table] = nil
end
local function make_link(link, id, unit_table)
-- Return wikilink "[[link|id]]", possibly abbreviated as in examples:
-- [[Mile|mile]] --> [[mile]]
-- [[Mile|miles]] --> [[mile]]s
-- However, just id is returned if:
-- * no link given (so caller does not need to check if a link was defined); or
-- * link has previously been used during the current convert (to avoid overlinking).
local link_key
if unit_table then
link_key = unit_table.unitcode or unit_table
else
link_key = link
end
if not link or link == '' or linked_pages[link_key] then
return id
end
linked_pages[link_key] = true
-- Following only works for language en, but it should be safe on other wikis,
-- and overhead of doing it generally does not seem worthwhile.
local l = link:sub(1, 1):lower() .. link:sub(2)
if link == id or l == id then
return '[[' .. id .. ']]'
elseif link .. 's' == id or l .. 's' == id then
return '[[' .. id:sub(1, -2) .. ']]s'
else
return '[[' .. link .. '|' .. id .. ']]'
end
end
local function variable_name(clean, unit_table, exp_multiplier, key_id)
-- A unit name may depend on the value in some languages.
-- Parameter clean is the unsigned value in en digits, as a string.
-- It may represent a number ("1.0") or a fraction ("1+2/3").
-- In varname, fields are separated with "!" and are not empty.
-- A field for a unit using an SI prefix has the prefix name inserted,
-- replacing '#' if found, or before the field otherwise.
if clean:match('[./]') or clean:find('⁄', 1, true) then -- float or fraction
if exp_multiplier then
clean = exp_multiplier -- force selection of name for a large integer
else
clean = 34.5 -- force selection of name for a float value
end
else
clean = tonumber(clean) * (exp_multiplier or 1)
end
local name1, vname
if key_id == 'pername' and unit_table.pername then
vname = unit_table.pername
elseif unit_table.varname then
local splitvname = split(unit_table.varname, '!')
name1 = unit_table.name1
vname = mw.language.getContentLanguage():convertPlural(clean, name1, unpack(splitvname))
else
return clean == 1 and unit_table.name1 or unit_table.name2
end
if vname == name1 then
-- SI prefix (if any) has been inserted by unit_prefixed_mt.
else
local si_name = rawget(unit_table, 'si_name') or ''
local pos = vname:find('#', 1, true)
if pos then
vname = vname:sub(1, pos - 1) .. si_name .. vname:sub(pos + 1)
else
vname = si_name .. vname
end
end
return vname
end
local function linked_id(parms, unit_table, key_id, want_link, clean, exp_multiplier)
-- Return final unit id (symbol or name), optionally with a wikilink,
-- and update unit_table.sep if required.
-- key_id is one of: 'symbol', 'sym_us', 'name1', 'name1_us', 'name2', 'name2_us', 'pername'.
local abbr_on = (key_id == 'symbol' or key_id == 'sym_us')
if abbr_on and want_link then
local symlink = rawget(unit_table, 'symlink')
if symlink then
return symlink -- for exceptions that have the linked symbol built-in
end
end
local multiplier = rawget(unit_table, 'multiplier')
local per = unit_table.per
if per then
local paren1, paren2 = '', '' -- possible parentheses around bottom unit
local unit1 = per[1] -- top unit_table, or nil
local unit2 = per[2] -- bottom unit_table
if abbr_on then
if not unit1 then
unit_table.sep = '' -- no separator in "$2/acre"
end
if not want_link then
local symbol = unit_table.symbol_raw
if symbol then
return symbol -- for exceptions that have the symbol built-in
end
end
if (unit2.symbol):find('⋅', 1, true) then
paren1, paren2 = '(', ')'
end
end
local key_id2 -- unit2 is always singular
if key_id == 'name2' then
key_id2 = 'name1'
elseif key_id == 'name2_us' then
key_id2 = 'name1_us'
else
key_id2 = key_id
end
if key_id2 == 'name1' or key_id2 == 'name1_us' then
key_id2 = unit2.pername and 'pername' or key_id2 -- ukwiki has some units with a different name in "per unitname"
end
local result
if abbr_on then
result = '/'
elseif omitsep then
result = per_word
elseif unit1 then
result = ' ' .. per_word .. ' '
else
result = per_word .. ' '
end
if want_link and unit_table.link then
if varname and not abbr_on then
result = (unit1 and variable_name(clean, unit1, exp_multiplier) or '') .. result .. variable_name('1', unit2, exp_multiplier, key_id2)
else
result = (unit1 and linked_id(parms, unit1, key_id, false, clean) or '') .. result .. linked_id(parms, unit2, key_id2, false, '1')
end
if omit_separator(result) then
unit_table.sep = ''
end
return make_link(unit_table.link, result, unit_table)
end
if unit1 then
result = linked_id(parms, unit1, key_id, want_link, clean) .. result
if unit1.sep then
unit_table.sep = unit1.sep
end
elseif omitsep then
unit_table.sep = ''
end
return result .. paren1 .. linked_id(parms, unit2, key_id2, want_link, '1') .. paren2
end
if multiplier then
-- A multiplier (like "100" in "100km") forces the unit to be plural.
multiplier = from_en(multiplier)
if not omitsep then
multiplier = multiplier .. (abbr_on and ' ' or ' ')
end
if not abbr_on then
if key_id == 'name1' then
key_id = 'name2'
elseif key_id == 'name1_us' then
key_id = 'name2_us'
end
end
else
multiplier = ''
end
local id = unit_table.fixed_name or ((varname and not abbr_on) and variable_name(clean, unit_table, exp_multiplier, key_id) or unit_table[key_id])
if omit_separator(id) then
unit_table.sep = ''
end
if want_link then
local link = data_code.link_exceptions[unit_table.linkey or unit_table.symbol] or unit_table.link
if link then
local before = ''
local i = unit_table.customary
if i == 1 and parms.opt_sp_us then
i = 2 -- show "U.S." not "US"
end
if i == 3 and abbr_on then
i = 4 -- abbreviate "imperial" to "imp"
end
local customary = text_code.customary_units[i]
if customary then
-- LATER: This works for language en only, but it's esoteric so ignore for now.
local pertext
if id:sub(1, 1) == '/' then
-- Want unit "/USgal" to display as "/U.S. gal", not "U.S. /gal".
pertext = '/'
id = id:sub(2)
elseif id:sub(1, 4) == 'per ' then
-- Similarly want "per U.S. gallon", not "U.S. per gallon" (but in practice this is unlikely to be used).
pertext = 'per '
id = id:sub(5)
else
pertext = ''
end
-- Omit any "US"/"U.S."/"imp"/"imperial" from start of id since that will be inserted.
local removes = (i < 3) and { 'US ', 'US ', 'U.S. ', 'U.S. ' } or { 'imp ', 'imp ', 'imperial ' }
for _, prefix in ipairs(removes) do
local plen = #prefix
if id:sub(1, plen) == prefix then
id = id:sub(plen + 1)
break
end
end
before = pertext .. make_link(customary.link, customary[1]) .. ' '
end
id = before .. make_link(link, id, unit_table)
end
end
return multiplier .. id
end
local function make_id(parms, which, unit_table)
-- Return id, f where
-- id = unit name or symbol, possibly modified
-- f = true if id is a name, or false if id is a symbol
-- using the value for index 'which', and for 'in' or 'out' (unit_table.inout).
-- Result is '' if no symbol/name is to be used.
-- In addition, set unit_table.sep = ' ' or ' ' or ''
-- (the separator that caller will normally insert before the id).
if parms.opt_values then
unit_table.sep = ''
return ''
end
local inout = unit_table.inout
local info = unit_table.valinfo[which]
local lk = parms.lk
local want_link = (lk == 'on' or lk == inout)
local singular = info.singular
local want_name
local exp_multiplier
if unit_table.usename then
want_name = true
else
if parms.abbr_org == nil then
if parms.wantname then
want_name = true
end
if unit_table.usesymbol then
want_name = false
end
end
if want_name == nil then
local abbr = parms.abbr
if abbr == 'on' or abbr == inout or (abbr == 'mos' and inout == 'out') then
want_name = false
else
want_name = true
end
end
end
local key
if want_name then
if lk == nil and unit_table.builtin == 'hand' then
want_link = true
end
if parms.opt_use_nbsp then
unit_table.sep = ' '
else
unit_table.sep = ' '
end
if parms.opt_singular then
local value
if inout == 'in' then
value = info.value
else
value = info.absvalue
end
if value then -- some unusual units do not always set value field
value = abs(value)
singular = (0 < value and value < 1.0001)
end
end
if unit_table.engscale then
-- engscale: so "|1|e3kg" gives "1 thousand kilograms" (plural)
singular = false
exp_multiplier = 10^unit_table.engscale.exponent -- '1 gram' and '1 thousand grams', for example, may use different names for the unit in some languages
end
key = (parms.opt_adjectival or singular) and 'name1' or 'name2'
if parms.opt_sp_us then
key = key .. '_us'
end
else
if unit_table.builtin == 'hand' then
if parms.opt_hand_hh then
unit_table.symbol = 'hh' -- LATER: might want i18n applied to this
end
end
unit_table.sep = ' '
key = parms.opt_sp_us and 'sym_us' or 'symbol'
end
return linked_id(parms, unit_table, key, want_link, info.clean, exp_multiplier), want_name
end
local function decorate_value(parms, unit_table, which, enable_number_word)
-- If needed, update unit_table so values will be shown with extra information.
-- For consistency with the old template (but different from fmtpower),
-- the style to display powers of 10 includes "display:none" to allow some
-- browsers to copy, for example, "10³" as "10^3", rather than as "103".
-- The engscale table may have entries such as either of the following:
-- ["3"] = { "thousand", exponent = 3 },
-- ["3"] = { name1 = "A", varname = "B!C!D", exponent = 3 },
-- The first option always uses "thousand" as the exponent name.
-- The second option uses one of A, B, C, D as the exponent name, depending on the value.
local info
local engscale = unit_table.engscale
local prefix = unit_table.vprefix
if engscale or prefix then
info = unit_table.valinfo[which]
if info.decorated then
return -- do not redecorate if repeating convert
end
info.decorated = true
if engscale then
-- Range |10|-|20|e3km| gives '10×10³–20×10³' or '10–20 thousand'.
local inout = unit_table.inout
local abbr = parms.abbr
if (abbr == 'on' or abbr == inout) and not (unit_table.this_number_word or parms.number_word) then
info.show = info.show ..
'<span style="margin-left:0.2em">×<span style="margin-left:0.1em">' ..
from_en('10') ..
'</span></span><s style="display:none">^</s><sup>' ..
from_en(tostring(engscale.exponent)) .. '</sup>'
elseif enable_number_word then
local number_id
local name = engscale.varname and variable_name(info.clean, engscale) or engscale[1]
if parms.lk == 'on' or parms.lk == inout then
number_id = make_link(engscale.link, name)
else
number_id = name
end
-- WP:NUMERAL recommends " " in values like "12 million".
info.show = info.show .. (parms.opt_adjectival and '-' or ' ') .. number_id
end
end
if prefix then
info.show = prefix .. info.show
end
end
end
local function process_input(parms, in_current)
-- Processing required once per conversion.
-- Return block of text to represent input (value/unit).
if parms.opt_output_only or parms.opt_output_number_only or parms.opt_output_unit_only then
parms.joins = { '', '' }
return ''
end
local first_unit
local composite = in_current.composite -- nil or table of units
if composite then
first_unit = composite[1]
else
first_unit = in_current
end
local id1, want_name = make_id(parms, 1, first_unit)
local sep = first_unit.sep -- separator between value and unit, set by make_id
local preunit = parms.preunit1
if preunit then
sep = '' -- any separator is included in preunit
else
preunit = ''
end
if parms.opt_input_unit_only then
parms.joins = { '', '' }
if composite then
local parts = { id1 }
for i, unit in ipairs(composite) do
if i > 1 then
table.insert(parts, (make_id(parms, 1, unit)))
end
end
id1 = table.concat(parts, ' ')
end
if want_name and parms.opt_adjectival then
return preunit .. hyphenated(id1)
end
return preunit .. id1
end
if parms.opt_also_symbol and not composite and not parms.opt_flip then
local join1 = parms.joins[1]
if join1 == ' (' or join1 == ' [' then
parms.joins = { ' [' .. first_unit[parms.opt_sp_us and 'sym_us' or 'symbol'] .. ']' .. join1 , parms.joins[2] }
end
end
if in_current.builtin == 'mach' and first_unit.sep ~= '' then -- '' means omitsep with non-enwiki name
local prefix = id1 .. ' '
local range = parms.range
local valinfo = first_unit.valinfo
local result = prefix .. valinfo[1].show
if range then
-- For simplicity and because more not needed, handle one range item only.
local prefix2 = make_id(parms, 2, first_unit) .. ' '
result = range_text(range[1], want_name, parms, result, prefix2 .. valinfo[2].show, 'in', {spaced=true})
end
return preunit .. result
end
if composite then
-- Simplify: assume there is no range, and no decoration.
local mid = (not parms.opt_flip) and parms.mid or ''
local sep1 = ' '
local sep2 = ' '
if parms.opt_adjectival and want_name then
sep1 = '-'
sep2 = '-'
end
if omitsep and sep == '' then
-- Testing the id of the most significant unit should be sufficient.
sep1 = ''
sep2 = ''
end
local parts = { first_unit.valinfo[1].show .. sep1 .. id1 }
for i, unit in ipairs(composite) do
if i > 1 then
table.insert(parts, unit.valinfo[1].show .. sep1 .. (make_id(parms, 1, unit)))
end
end
return table.concat(parts, sep2) .. mid
end
local add_unit = (parms.abbr == 'mos') or
parms[parms.opt_flip and 'out_range_x' or 'in_range_x'] or
(not want_name and parms.abbr_range_x)
local range = parms.range
if range and not add_unit then
unlink(first_unit)
end
local id = range and make_id(parms, range.n + 1, first_unit) or id1
local extra, was_hyphenated = hyphenated_maybe(parms, want_name, sep, id, 'in')
if was_hyphenated then
add_unit = false
end
local result
local valinfo = first_unit.valinfo
if range then
for i = 0, range.n do
local enable_number_word
if i == range.n then
add_unit = false
enable_number_word = true
end
decorate_value(parms, first_unit, i+1, enable_number_word)
local show = valinfo[i+1].show
if add_unit then
show = show .. first_unit.sep .. (i == 0 and id1 or make_id(parms, i+1, first_unit))
end
if i == 0 then
result = show
else
result = range_text(range[i], want_name, parms, result, show, 'in')
end
end
else
decorate_value(parms, first_unit, 1, true)
result = valinfo[1].show
end
return result .. preunit .. extra
end
local function process_one_output(parms, out_current)
-- Processing required for each output unit.
-- Return block of text to represent output (value/unit).
local inout = out_current.inout -- normally 'out' but can be 'in' for order=out
local id1, want_name = make_id(parms, 1, out_current)
local sep = out_current.sep -- set by make_id
local preunit = parms.preunit2
if preunit then
sep = '' -- any separator is included in preunit
else
preunit = ''
end
if parms.opt_output_unit_only then
if want_name and parms.opt_adjectival then
return preunit .. hyphenated(id1)
end
return preunit .. id1
end
if out_current.builtin == 'mach' and out_current.sep ~= '' then -- '' means omitsep with non-enwiki name
local prefix = id1 .. ' '
local range = parms.range
local valinfo = out_current.valinfo
local result = prefix .. valinfo[1].show
if range then
-- For simplicity and because more not needed, handle one range item only.
result = range_text(range[1], want_name, parms, result, prefix .. valinfo[2].show, inout, {spaced=true})
end
return preunit .. result
end
local add_unit = (parms[parms.opt_flip and 'in_range_x' or 'out_range_x'] or
(not want_name and parms.abbr_range_x)) and
not parms.opt_output_number_only
local range = parms.range
if range and not add_unit then
unlink(out_current)
end
local id = range and make_id(parms, range.n + 1, out_current) or id1
local extra, was_hyphenated = hyphenated_maybe(parms, want_name, sep, id, inout)
if was_hyphenated then
add_unit = false
end
local result
local valinfo = out_current.valinfo
if range then
for i = 0, range.n do
local enable_number_word
if i == range.n then
add_unit = false
enable_number_word = true
end
decorate_value(parms, out_current, i+1, enable_number_word)
local show = valinfo[i+1].show
if add_unit then
show = show .. out_current.sep .. (i == 0 and id1 or make_id(parms, i+1, out_current))
end
if i == 0 then
result = show
else
result = range_text(range[i], want_name, parms, result, show, inout)
end
end
else
decorate_value(parms, out_current, 1, true)
result = valinfo[1].show
end
if parms.opt_output_number_only then
return result
end
return result .. preunit .. extra
end
local function make_output_single(parms, in_unit_table, out_unit_table)
-- Return true, item where item = wikitext of the conversion result
-- for a single output (which is not a combination or a multiple);
-- or return false, t where t is an error message table.
if parms.opt_order_out and in_unit_table.unitcode == out_unit_table.unitcode then
out_unit_table.valinfo = in_unit_table.valinfo
else
out_unit_table.valinfo = collection()
for _, v in ipairs(in_unit_table.valinfo) do
local success, info = cvtround(parms, v, in_unit_table, out_unit_table)
if not success then return false, info end
out_unit_table.valinfo:add(info)
end
end
return true, process_one_output(parms, out_unit_table)
end
local function make_output_multiple(parms, in_unit_table, out_unit_table)
-- Return true, item where item = wikitext of the conversion result
-- for an output which is a multiple (like 'ftin');
-- or return false, t where t is an error message table.
local inout = out_unit_table.inout -- normally 'out' but can be 'in' for order=out
local multiple = out_unit_table.multiple -- table of scaling factors (will not be nil)
local combos = out_unit_table.combination -- table of unit tables (will not be nil)
local abbr = parms.abbr
local abbr_org = parms.abbr_org
local disp = parms.disp
local want_name = (abbr_org == nil and (disp == 'or' or disp == 'slash')) or
not (abbr == 'on' or abbr == inout or abbr == 'mos')
local want_link = (parms.lk == 'on' or parms.lk == inout)
local mid = parms.opt_flip and parms.mid or ''
local sep1 = ' '
local sep2 = ' '
if parms.opt_adjectival and want_name then
sep1 = '-'
sep2 = '-'
end
local do_spell = parms.opt_spell_out
parms.opt_spell_out = nil -- so the call to cvtround does not spell the value
local function make_result(info, isfirst)
local fmt, outvalue, sign
local results = {}
for i = 1, #combos do
local tfrac, thisvalue, strforce
local out_current = combos[i]
out_current.inout = inout
local scale = multiple[i]
if i == 1 then -- least significant unit ('in' from 'ftin')
local decimals
out_current.frac = out_unit_table.frac
local success, outinfo = cvtround(parms, info, in_unit_table, out_current)
if not success then return false, outinfo end
if isfirst then
out_unit_table.valinfo = { outinfo } -- in case output value of first least significant unit is needed
end
sign = outinfo.sign
tfrac = outinfo.fraction_table
if outinfo.is_scientific then
strforce = outinfo.show
decimals = ''
elseif tfrac then
decimals = ''
else
local show = outinfo.show -- number as a string in local language
local p1, p2 = show:find(numdot, 1, true)
decimals = p1 and show:sub(p2 + 1) or '' -- text after numdot, if any
end
fmt = '%.' .. ulen(decimals) .. 'f' -- to reproduce precision
if decimals == '' then
if tfrac then
outvalue = floor(outinfo.raw_absvalue) -- integer part only; fraction added later
else
outvalue = floor(outinfo.raw_absvalue + 0.5) -- keep all integer digits of least significant unit
end
else
outvalue = outinfo.absvalue
end
end
if scale then
outvalue, thisvalue = divide(outvalue, scale)
else
thisvalue = outvalue
end
local id
if want_name then
if varname then
local clean
if strforce or tfrac then
clean = '.1' -- dummy value to force name for floating point
else
clean = format(fmt, thisvalue)
end
id = variable_name(clean, out_current)
else
local key = 'name2'
if parms.opt_adjectival then
key = 'name1'
elseif tfrac then
if thisvalue == 0 then
key = 'name1'
end
elseif parms.opt_singular then
if 0 < thisvalue and thisvalue < 1.0001 then
key = 'name1'
end
else
if thisvalue == 1 then
key = 'name1'
end
end
id = out_current[key]
end
else
id = out_current['symbol']
end
if i == 1 and omit_separator(id) then
-- Testing the id of the least significant unit should be sufficient.
sep1 = ''
sep2 = ''
end
if want_link then
local link = out_current.link
if link then
id = make_link(link, id, out_current)
end
end
local strval
local spell_inout = (i == #combos or outvalue == 0) and inout or '' -- trick so the last value processed (first displayed) has uppercase, if requested
if strforce and outvalue == 0 then
sign = '' -- any sign is in strforce
strval = strforce -- show small values in scientific notation; will only use least significant unit
elseif tfrac then
local wholestr = (thisvalue > 0) and tostring(thisvalue) or nil
strval = format_fraction(parms, spell_inout, false, wholestr, tfrac.numstr, tfrac.denstr, do_spell)
else
strval = (thisvalue == 0) and from_en('0') or with_separator(parms, format(fmt, thisvalue))
if do_spell then
strval = spell_number(parms, spell_inout, strval) or strval
end
end
table.insert(results, strval .. sep1 .. id)
if outvalue == 0 then
break
end
fmt = '%.0f' -- only least significant unit can have a non-integral value
end
local reversed, count = {}, #results
for i = 1, count do
reversed[i] = results[count + 1 - i]
end
return true, sign .. table.concat(reversed, sep2)
end
local valinfo = in_unit_table.valinfo
local success, result = make_result(valinfo[1], true)
if not success then return false, result end
local range = parms.range
if range then
for i = 1, range.n do
local success, result2 = make_result(valinfo[i+1])
if not success then return false, result2 end
result = range_text(range[i], want_name, parms, result, result2, inout, {spaced=true})
end
end
return true, result .. mid
end
local function process(parms, in_unit_table, out_unit_table)
-- Return true, s, outunit where s = final wikitext result,
-- or return false, t where t is an error message table.
linked_pages = {}
local success, bad_output
local bad_input_mcode = in_unit_table.bad_mcode -- nil if input unit is a valid convert unit
local out_unit = parms.out_unit
if out_unit == nil or out_unit == '' or type(out_unit) == 'function' then
-- out_unit can be set to a function by adjustparameters in Module:Convert/wikidata.
if bad_input_mcode or parms.opt_input_unit_only then
bad_output = ''
else
local getdef = type(out_unit) == 'function' and out_unit or get_default
success, out_unit = getdef(in_unit_table.valinfo[1].value, in_unit_table)
parms.out_unit = out_unit
if not success then
bad_output = out_unit
end
end
end
if not bad_output and not out_unit_table then
success, out_unit_table = lookup(parms, out_unit, 'any_combination')
if success then
local mismatch = check_mismatch(in_unit_table, out_unit_table)
if mismatch then
bad_output = mismatch
end
else
bad_output = out_unit_table
end
end
local lhs, rhs
local flipped = parms.opt_flip and not bad_input_mcode
if bad_output then
rhs = (bad_output == '') and '' or message(parms, bad_output)
elseif parms.opt_input_unit_only then
rhs = ''
else
local combos -- nil (for 'ft' or 'ftin'), or table of unit tables (for 'm ft')
if not out_unit_table.multiple then -- nil/false ('ft' or 'm ft'), or table of factors ('ftin')
combos = out_unit_table.combination
end
local frac = parms.frac -- nil or denominator of fraction for output values
if frac then
-- Apply fraction to the unit (if only one), or to non-SI units (if a combination),
-- except that if a precision is also specified, the fraction only applies to
-- the hand unit; that allows the following result:
-- {{convert|156|cm|in hand|1|frac=2}} → 156 centimetres (61.4 in; 15.1½ hands)
-- However, the following is handled elsewhere as a special case:
-- {{convert|156|cm|hand in|1|frac=2}} → 156 centimetres (15.1½ hands; 61½ in)
if combos then
local precision = parms.precision
for _, unit in ipairs(combos) do
if unit.builtin == 'hand' or (not precision and not unit.prefixes) then
unit.frac = frac
end
end
else
out_unit_table.frac = frac
end
end
local outputs = {}
local imax = combos and #combos or 1 -- 1 (single unit) or number of unit tables
if imax == 1 then
parms.opt_order_out = nil -- only useful with an output combination
end
if not flipped and not parms.opt_order_out then
-- Process left side first so any duplicate links (from lk=on) are suppressed
-- on right. Example: {{convert|28|e9pc|e9ly|abbr=off|lk=on}}
lhs = process_input(parms, in_unit_table)
end
for i = 1, imax do
local success, item
local out_current = combos and combos[i] or out_unit_table
out_current.inout = 'out'
if i == 1 then
if imax > 1 and out_current.builtin == 'hand' then
out_current.out_next = combos[2] -- built-in hand can influence next unit in a combination
end
if parms.opt_order_out then
out_current.inout = 'in'
end
end
if out_current.multiple then
success, item = make_output_multiple(parms, in_unit_table, out_current)
else
success, item = make_output_single(parms, in_unit_table, out_current)
end
if not success then return false, item end
outputs[i] = item
end
if parms.opt_order_out then
lhs = outputs[1]
table.remove(outputs, 1)
end
local sep = parms.table_joins and parms.table_joins[2] or parms.join_between
rhs = table.concat(outputs, sep)
end
if flipped or not lhs then
local input = process_input(parms, in_unit_table)
if flipped then
lhs = rhs
rhs = input
else
lhs = input
end
end
if parms.join_before then
lhs = parms.join_before .. lhs
end
local wikitext
if bad_input_mcode then
if bad_input_mcode == '' then
wikitext = lhs
else
wikitext = lhs .. message(parms, bad_input_mcode)
end
elseif parms.table_joins then
wikitext = parms.table_joins[1] .. lhs .. parms.table_joins[2] .. rhs
else
wikitext = lhs .. parms.joins[1] .. rhs .. parms.joins[2]
end
if parms.warnings and not bad_input_mcode then
wikitext = wikitext .. parms.warnings
end
return true, get_styles(parms) .. wikitext, out_unit_table
end
local function _main_convert(confArgs, parmsArgs, frame)
-- Do convert, and if needed, do it again with higher default precision.
local parms = { frame = frame or mw.getCurrentFrame() } -- will hold template arguments, after translation
set_config(confArgs)
local success, result = get_parms(parms, parmsArgs)
if success then
if type(result) ~= 'table' then
return tostring(result)
end
local in_unit_table = result
local out_unit_table
for _ = 1, 2 do -- use counter so cannot get stuck repeating convert
success, result, out_unit_table = process(parms, in_unit_table, out_unit_table)
if success and parms.do_convert_again then
parms.do_convert_again = false
else
break
end
end
end
-- If input=x gives a problem, the result should be just the user input
-- (if x is a property like P123 it has been replaced with '').
-- An unknown input unit would display the input and an error message
-- with success == true at this point.
-- Also, can have success == false with a message that outputs an empty string.
if parms.input_text then
if success and not parms.have_problem then
return result
end
local cat
if parms.tracking then
-- Add a tracking category using the given text as the category sort key.
-- There is currently only one type of tracking, but in principle multiple
-- items could be tracked, using different sort keys for convenience.
cat = wanted_category('tracking', parms.tracking)
end
return parms.input_text .. (cat or '')
end
if parms.error_text then
if success and not parms.have_problem then
return result
end
return parms.error_text
end
return success and result or message(parms, result)
end
local function main_convert(frame)
return _main_convert(frame.args, frame:getParent().args, frame)
end
local function _unit(unitcode, options)
-- Helper function for Module:Val to look up a unit.
-- Parameter unitcode must be a string to identify the wanted unit.
-- Parameter options must be nil or a table with optional fields:
-- value = number (for sort key; default value is 1)
-- scaled_top = nil for a normal unit, or a number for a unit which is
-- the denominator of a per unit (for sort key)
-- si = { 'symbol', 'link' }
-- (a table with two strings) to make an SI unit
-- that will be used for the look up
-- link = true if result should be [[linked]]
-- sort = 'on' or 'debug' if result should include a sort key in a
-- span element ('debug' makes the key visible)
-- name = true for the name of the unit instead of the symbol
-- us = true for the US spelling of the unit, if any
-- Return nil if unitcode is not a non-empty string.
-- Otherwise return a table with fields:
-- text = requested symbol or name of unit, optionally linked
-- scaled_value = input value adjusted by unit scale; used for sort key
-- sortspan = span element with sort key like that provided by {{ntsh}},
-- calculated from the result of converting value
-- to a base unit with scale 1.
-- unknown = true if the unitcode was not known
unitcode = strip(unitcode)
if unitcode == nil or unitcode == '' then
return nil
end
set_config({})
linked_pages = {}
options = options or {}
local parms = {
abbr = options.name and 'off' or 'on',
lk = options.link and 'on' or nil,
opt_sp_us = options.us and true or nil,
opt_ignore_error = true,
opt_no_extra = true, -- do not add pages using this function to 'what links here' for Module:Convert/extra
opt_sortable_on = options.sort == 'on' or options.sort == 'debug',
opt_sortable_debug = options.sort == 'debug',
}
if options.si then
-- Make a dummy table of units (just one unit) for lookup to use.
-- This makes lookup recognize any SI prefix in the unitcode.
local symbol = options.si[1] or '?'
parms.unittable = { [symbol] = {
_name1 = symbol,
_name2 = symbol,
_symbol = symbol,
utype = symbol,
scale = symbol == 'g' and 0.001 or 1,
prefixes = 1,
default = symbol,
link = options.si[2],
}}
end
local success, unit_table = lookup(parms, unitcode, 'no_combination')
if not success then
unit_table = setmetatable({
symbol = unitcode, name2 = unitcode, utype = unitcode,
scale = 1, default = '', defkey = '', linkey = '' }, unit_mt)
end
local value = tonumber(options.value) or 1
local clean = tostring(abs(value))
local info = {
value = value,
altvalue = value,
singular = (clean == '1'),
clean = clean,
show = clean,
}
unit_table.inout = 'in'
unit_table.valinfo = { info }
local sortspan, scaled_value
if options.sort then
sortspan, scaled_value = make_table_or_sort(parms, value, info, unit_table, options.scaled_top)
end
return {
text = make_id(parms, 1, unit_table),
sortspan = sortspan,
scaled_value = scaled_value,
unknown = not success and true or nil,
}
end
return { convert = main_convert, _convert = _main_convert, _unit = _unit }
r4djqnuzbxaut805hk89ncew56hajfu
21754
21753
2026-09-18T15:05:25Z
Keresturec
18
1 измена увезена из [[:en:Module:Convert]]: Importing from the English wikipedia
21753
Scribunto
text/plain
-- Convert a value from one unit of measurement to another.
-- Example: {{convert|123|lb|kg}} --> 123 pounds (56 kg)
-- See [[:en:Template:Convert/Transwiki guide]] if copying to another wiki.
local MINUS = '−' -- Unicode U+2212 MINUS SIGN (UTF-8: e2 88 92)
local abs = math.abs
local floor = math.floor
local format = string.format
local log10 = math.log10
local ustring = mw.ustring
local ulen = ustring.len
local usub = ustring.sub
-- Configuration options to keep magic values in one location.
-- Conversion data and message text are defined in separate modules.
local config, maxsigfig
local numdot -- must be '.' or ',' or a character which works in a regex
local numsep, numsep_remove, numsep_remove2
local data_code, all_units
local text_code
local varname -- can be a code to use variable names that depend on value
local from_en_table -- to translate an output string of en digits to local language
local to_en_table -- to translate an input string of digits in local language to en
-- Use translation_table in convert/text to change the following.
local en_default -- true uses lang=en unless convert has lang=local or local digits
local group_method = 3 -- code for how many digits are in a group
local per_word = 'per' -- for units like "liters per kilometer"
local plural_suffix = 's' -- only other useful value is probably '' to disable plural unit names
local omitsep -- true to omit separator before local symbol/name
-- All units should be defined in the data module. However, to cater for quick changes
-- and experiments, any unknown unit is looked up in an extra data module, if it exists.
-- That module would be transcluded in only a small number of pages, so there should be
-- little server overhead from making changes, and changes should propagate quickly.
local extra_module -- name of module with extra units
local extra_units -- nil or table of extra units from extra_module
-- Some options in the invoking template can set variables used later in the module.
local currency_text -- for a user-defined currency symbol: {{convert|12|$/ha|$=€}} (euro replaces dollar)
local function from_en(text)
-- Input is a string representing a number in en digits with '.' decimal mark,
-- without digit grouping (which is done just after calling this).
-- Return the translation of the string with numdot and digits in local language.
if numdot ~= '.' then
text = text:gsub('%.', numdot)
end
if from_en_table then
text = text:gsub('%d', from_en_table)
end
return text
end
local function to_en(text)
-- Input is a string representing a number in the local language with
-- an optional numdot decimal mark and numsep digit grouping.
-- Return the translation of the string with '.' mark and en digits,
-- and no separators (they have to be removed here to handle cases like
-- numsep = '.' and numdot = ',' with input "1.234.567,8").
if to_en_table then
text = ustring.gsub(text, '%d', to_en_table)
end
if numsep_remove then
text = text:gsub(numsep_remove, '')
end
if numsep_remove2 then
text = text:gsub(numsep_remove2, '')
end
if numdot ~= '.' then
text = text:gsub(numdot, '.')
end
return text
end
local function decimal_mark(text)
-- Return ',' if text probably is using comma for decimal mark, or has no decimal mark.
-- Return '.' if text probably is using dot for decimal mark.
-- Otherwise return nothing (decimal mark not known).
if not text:find('[.,]') then return ',' end
text = text:gsub('^%-', ''):gsub('%+%d+/%d+$', ''):gsub('[Ee]%-?%d+$', '')
local decimal =
text:match('^0?([.,])%d+$') or
text:match('%d([.,])%d?%d?$') or
text:match('%d([.,])%d%d%d%d+$')
if decimal then return decimal end
if text:match('%.%d+%.') then return ',' end
if text:match('%,%d+,') then return '.' end
end
local add_warning, with_separator -- forward declarations
local function to_en_with_check(text, parms)
-- Version of to_en() for a wiki using numdot = ',' and numsep = '.' to check
-- text (an input number as a string) which might have been copied from enwiki.
-- For example, in '1.234' the '.' could be a decimal mark or a group separator.
-- From viwiki.
if to_en_table then
text = ustring.gsub(text, '%d', to_en_table)
end
if decimal_mark(text) == '.' then
local original = text
text = text:gsub(',', '') -- for example, interpret "1,234.5" as an enwiki value
if parms then
add_warning(parms, 0, 'cvt_enwiki_num', original, with_separator({}, text))
end
else
if numsep_remove then
text = text:gsub(numsep_remove, '')
end
if numsep_remove2 then
text = text:gsub(numsep_remove2, '')
end
if numdot ~= '.' then
text = text:gsub(numdot, '.')
end
end
return text
end
local function omit_separator(id)
-- Return true if there should be no separator before id (a unit symbol or name).
-- For zhwiki, there should be no separator if id uses local characters.
-- The following kludge should be a sufficient test.
if omitsep then
if id:sub(1, 2) == '-{' then -- for "-{...}-" content language variant
return true
end
if id:byte() > 127 then
local first = usub(id, 1, 1)
if first ~= 'Å' and first ~= '°' and first ~= 'µ' then
return true
end
end
end
return id:sub(1, 1) == '/' -- no separator before units like "/ha"
end
local spell_module -- name of module that can spell numbers
local speller -- function from that module to handle spelling (set if needed)
local wikidata_module, wikidata_data_module -- names of Wikidata modules
local wikidata_code, wikidata_data -- exported tables from those modules (set if needed)
local function set_config(args)
-- Set configuration options from template #invoke or defaults.
config = args
maxsigfig = config.maxsigfig or 14 -- maximum number of significant figures
local data_module, text_module
local sandbox = config.sandbox and ('/' .. config.sandbox) or ''
data_module = "Module:Convert/data" .. sandbox
text_module = "Module:Convert/text" .. sandbox
extra_module = "Module:Convert/extra" .. sandbox
wikidata_module = "Module:Convert/wikidata" .. sandbox
wikidata_data_module = "Module:Convert/wikidata/data" .. sandbox
spell_module = "Module:ConvertNumeric"
data_code = mw.loadData(data_module)
text_code = mw.loadData(text_module)
all_units = data_code.all_units
local translation = text_code.translation_table
if translation then
numdot = translation.numdot
numsep = translation.numsep
if numdot == ',' and numsep == '.' then
if text_code.all_messages.cvt_enwiki_num then
to_en = to_en_with_check
end
end
if translation.group then
group_method = translation.group
end
if translation.per_word then
per_word = translation.per_word
end
if translation.plural_suffix then
plural_suffix = translation.plural_suffix
end
varname = translation.varname
from_en_table = translation.from_en
local use_workaround = true
if use_workaround then
-- 2013-07-05 workaround bug by making a copy of the required table.
-- mw.ustring.gsub fails with a table (to_en_table) as the replacement,
-- if the table is accessed via mw.loadData.
local source = translation.to_en
if source then
to_en_table = {}
for k, v in pairs(source) do
to_en_table[k] = v
end
end
else
to_en_table = translation.to_en
end
if translation.lang == 'en default' then
en_default = true -- for hiwiki
end
omitsep = translation.omitsep -- for zhwiki
end
numdot = config.numdot or numdot or '.' -- decimal mark before fractional digits
numsep = config.numsep or numsep or ',' -- group separator for numbers
-- numsep should be ',' or '.' or '' or ' ' or a Unicode character.
-- numsep_remove must work in a regex to identify separators to be removed.
if numsep ~= '' then
numsep_remove = (numsep == '.') and '%.' or numsep
end
if numsep ~= ',' and numdot ~= ',' then
numsep_remove2 = ',' -- so numbers copied from enwiki will work
end
end
local function collection()
-- Return a table to hold items.
return {
n = 0,
add = function (self, item)
self.n = self.n + 1
self[self.n] = item
end,
}
end
local function divide(numerator, denominator)
-- Return integers quotient, remainder resulting from dividing the two
-- given numbers, which should be unsigned integers.
local quotient, remainder = floor(numerator / denominator), numerator % denominator
if not (0 <= remainder and remainder < denominator) then
-- Floating point limits may need this, as in {{convert|160.02|Ym|ydftin}}.
remainder = 0
end
return quotient, remainder
end
local function split(text, delimiter)
-- Return a numbered table with fields from splitting text.
-- The delimiter is used in a regex without escaping (for example, '.' would fail).
-- Each field has any leading/trailing whitespace removed.
local t = {}
text = text .. delimiter -- to get last item
for item in text:gmatch('%s*(.-)%s*' .. delimiter) do
table.insert(t, item)
end
return t
end
local function strip(text)
-- If text is a string, return its content with no leading/trailing
-- whitespace. Otherwise return nil (a nil argument gives a nil result).
if type(text) == 'string' then
return text:match("^%s*(.-)%s*$")
end
end
local function table_len(t)
-- Return length (<100) of a numbered table to replace #t which is
-- documented to not work if t is accessed via mw.loadData().
for i = 1, 100 do
if t[i] == nil then
return i - 1
end
end
end
local function wanted_category(catkey, catsort, want_warning)
-- Return message category if it is wanted in current namespace,
-- otherwise return ''.
local cat
local title = mw.title.getCurrentTitle()
if title then
local nsdefault = '0' -- default namespace: '0' = article; '0,10' = article and template
local namespace = title.namespace
for _, v in ipairs(split(config.nscat or nsdefault, ',')) do
if namespace == tonumber(v) then
cat = text_code.all_categories[want_warning and 'warning' or catkey]
if catsort and catsort ~= '' and cat:sub(-2) == ']]' then
cat = cat:sub(1, -3) .. '|' .. mw.text.nowiki(usub(catsort, 1, 20)) .. ']]'
end
break
end
end
end
return cat or ''
end
local function message(parms, mcode, is_warning)
-- Return wikitext for an error message, including category if specified
-- for the message type.
-- mcode = numbered table specifying the message:
-- mcode[1] = 'cvt_xxx' (string used as a key to get message info)
-- mcode[2] = 'parm1' (string to replace '$1' if any in message)
-- mcode[3] = 'parm2' (string to replace '$2' if any in message)
-- mcode[4] = 'parm3' (string to replace '$3' if any in message)
local msg
if type(mcode) == 'table' then
if mcode[1] == 'cvt_no_output' then
-- Some errors should cause convert to output an empty string,
-- for example, for an optional field in an infobox.
return ''
end
msg = text_code.all_messages[mcode[1]]
end
parms.have_problem = true
local function subparm(fmt, ...)
local rep = {}
for i, v in ipairs({...}) do
rep['$' .. i] = v
end
return (fmt:gsub('$%d+', rep))
end
if msg then
local parts = {}
local regex, replace = msg.regex, msg.replace
for i = 1, 3 do
local limit = 40
local s = mcode[i + 1]
if s then
if regex and replace then
s = s:gsub(regex, replace)
limit = nil -- allow long "should be" messages
end
-- Escape user input so it does not break the message.
-- To avoid tags (like {{convert|1<math>23</math>|m}}) breaking
-- the mouseover title, any strip marker starting with char(127) is
-- replaced with '...' (text not needing i18n).
local append
local pos = s:find(string.char(127), 1, true)
if pos then
append = '...'
s = s:sub(1, pos - 1)
end
if limit and ulen(s) > limit then
s = usub(s, 1, limit)
append = '...'
end
s = mw.text.nowiki(s) .. (append or '')
else
s = '?'
end
parts['$' .. i] = s
end
local function ispreview()
-- Return true if a prominent message should be shown.
if parms.test == 'preview' or parms.test == 'nopreview' then
-- For testing, can preview a real message or simulate a preview
-- when running automated tests.
return parms.test == 'preview'
end
local success, revid = pcall(function ()
return (parms.frame):preprocess('{{REVISIONID}}') end)
return success and (revid == '')
end
local want_warning = is_warning and
not config.warnings and -- show unobtrusive warnings if config.warnings not configured
not msg.nowarn -- but use msg settings, not standard warning, if specified
local title = string.gsub(msg[1] or 'Missing message', '$%d+', parts)
local text = want_warning and '*' or msg[2] or 'Missing message'
local cat = wanted_category(msg[3], mcode[2], want_warning)
local anchor = msg[4] or ''
local fmtkey = ispreview() and 'cvt_format_preview' or
(want_warning and 'cvt_format2' or msg.format or 'cvt_format')
local fmt = text_code.all_messages[fmtkey] or 'convert: bug'
return subparm(fmt, title:gsub('"', '"'), text, cat, anchor)
end
return 'Convert internal error: unknown message'
end
function add_warning(parms, level, key, text1, text2) -- for forward declaration above
-- If enabled, add a warning that will be displayed after the convert result.
-- A higher level is more verbose: more kinds of warnings are displayed.
-- To reduce output noise, only the first warning is displayed.
if level <= (tonumber(config.warnings) or 1) then
if parms.warnings == nil then
parms.warnings = message(parms, { key, text1, text2 }, true)
end
end
end
local function spell_number(parms, inout, number, numerator, denominator)
-- Return result of spelling (number, numerator, denominator), or
-- return nil if spelling is not available or not supported for given text.
-- Examples (each value must be a string or nil):
-- number numerator denominator output
-- ------ --------- ----------- -------------------
-- "1.23" nil nil one point two three
-- "1" "2" "3" one and two thirds
-- nil "2" "3" two thirds
if not speller then
local function get_speller(module)
return require(module).spell_number
end
local success
success, speller = pcall(get_speller, spell_module)
if not success or type(speller) ~= 'function' then
add_warning(parms, 1, 'cvt_no_spell', 'spell')
return nil
end
end
local case
if parms.spell_upper == inout then
case = true
parms.spell_upper = nil -- only uppercase first word in a multiple unit
end
local sp = not parms.opt_sp_us
local adj = parms.opt_adjectival
return speller(number, numerator, denominator, case, sp, adj)
end
------------------------------------------------------------------------
-- BEGIN: Code required only for built-in units.
-- LATER: If need much more code, move to another module to simplify this module.
local function speed_of_sound(altitude)
-- This is for the Mach built-in unit of speed.
-- Return speed of sound in metres per second at given altitude in feet.
-- If no altitude given, use default (zero altitude = sea level).
-- Table gives speed of sound in miles per hour at various altitudes:
-- altitude = -17,499 to 402,499 feet
-- mach_table[a + 4] = s where
-- a = (altitude / 5000) rounded to nearest integer (-3 to 80)
-- s = speed of sound (mph) at that altitude
-- From: http://www.aerospaceweb.org/question/atmosphere/q0112.shtml
local mach_table = { -- a =
799.5, 787.0, 774.2, 761.207051, -- -3 to 0
748.0, 734.6, 721.0, 707.0, 692.8, 678.3, 663.5, 660.1, 660.1, 660.1, -- 1 to 10
660.1, 660.1, 660.1, 662.0, 664.3, 666.5, 668.9, 671.1, 673.4, 675.6, -- 11 to 20
677.9, 683.7, 689.9, 696.0, 702.1, 708.1, 714.0, 719.9, 725.8, 731.6, -- 21 to 30
737.3, 737.7, 737.7, 736.2, 730.5, 724.6, 718.8, 712.9, 707.0, 701.0, -- 31 to 40
695.0, 688.9, 682.8, 676.6, 670.4, 664.1, 657.8, 652.9, 648.3, 643.7, -- 41 to 50
639.1, 634.4, 629.6, 624.8, 620.0, 615.2, 613.2, 613.2, 613.2, 613.5, -- 51 to 60
614.4, 615.3, 616.7, 619.8, 623.4, 629.7, 635.0, 641.1, 650.6, 660.0, -- 61 to 70
672.5, 674.3, 676.1, 677.9, 679.7, 681.5, 683.3, 685.1, 686.8, 688.6, -- 71 to 80
}
local function lerp(t, v0, v1)
return t * v1 + (1 - t) * v0
end
altitude = (altitude or 0) / 5000
if altitude < -3 then
altitude = -3
elseif altitude > 80 then
altitude = 80
end
local mach_mph
local a = math.floor(altitude)
if a == altitude then
mach_mph = mach_table[a + 4]
else
mach_mph = lerp(altitude - a, mach_table[a + 4], mach_table[a + 5])
end
return mach_mph * 0.44704 -- mph converted to m/s
end
-- END: Code required only for built-in units.
------------------------------------------------------------------------
local function add_style(parms, class)
-- Add selected template style to parms if not already present.
parms.templatestyles = parms.templatestyles or {}
if not parms.templatestyles[class] then
parms.templatestyles[class] = parms.frame:extensionTag({
name = 'templatestyles', args = { src = text_code.titles[class] }
})
end
end
local function get_styles(parms)
-- Return string of required template styles, empty if none.
if parms.templatestyles then
local t = {}
for _, v in pairs(parms.templatestyles) do
table.insert(t, v)
end
return table.concat(t)
end
return ''
end
local function get_range(word)
-- Return a range (string or table) corresponding to word (like "to"),
-- or return nil if not a range word.
local ranges = text_code.ranges
return ranges.types[word] or ranges.types[ranges.aliases[word]]
end
local function check_mismatch(unit1, unit2)
-- If unit1 cannot be converted to unit2, return an error message table.
-- This allows conversion between units of the same type, and between
-- Nm (normally torque) and ftlb (energy), as in gun-related articles.
-- This works because Nm is the base unit (scale = 1) for both the
-- primary type (torque), and the alternate type (energy, where Nm = J).
-- A match occurs if the primary types are the same, or if unit1 matches
-- the alternate type of unit2, and vice versa. That provides a whitelist
-- of which conversions are permitted between normally incompatible types.
if unit1.utype == unit2.utype or
(unit1.utype == unit2.alttype and unit1.alttype == unit2.utype) then
return nil
end
return { 'cvt_mismatch', unit1.utype, unit2.utype }
end
local function override_from(out_table, in_table, fields)
-- Copy the specified fields from in_table to out_table, but do not
-- copy nil fields (keep any corresponding field in out_table).
for _, field in ipairs(fields) do
if in_table[field] then
out_table[field] = in_table[field]
end
end
end
local function shallow_copy(t)
-- Return a shallow copy of table t.
-- Do not need the features and overhead of the Scribunto mw.clone().
local result = {}
for k, v in pairs(t) do
result[k] = v
end
return result
end
local unit_mt = {
-- Metatable to get missing values for a unit that does not accept SI prefixes.
-- Warning: The boolean value 'false' is returned for any missing field
-- so __index is not called twice for the same field in a given unit.
__index = function (self, key)
local value
if key == 'name1' or key == 'sym_us' then
value = self.symbol
elseif key == 'name2' then
value = self.name1 .. plural_suffix
elseif key == 'name1_us' then
value = self.name1
if not rawget(self, 'name2_us') then
-- If name1_us is 'foot', do not make name2_us by appending plural_suffix.
self.name2_us = self.name2
end
elseif key == 'name2_us' then
local raw1_us = rawget(self, 'name1_us')
if raw1_us then
value = raw1_us .. plural_suffix
else
value = self.name2
end
elseif key == 'link' then
value = self.name1
else
value = false
end
rawset(self, key, value)
return value
end
}
local function prefixed_name(unit, name, index)
-- Return unit name with SI prefix inserted at correct position.
-- index = 1 (name1), 2 (name2), 3 (name1_us), 4 (name2_us).
-- The position is a byte (not character) index, so use Lua's sub().
local pos = rawget(unit, 'prefix_position')
if type(pos) == 'string' then
pos = tonumber(split(pos, ',')[index])
end
if pos then
return name:sub(1, pos - 1) .. unit.si_name .. name:sub(pos)
end
return unit.si_name .. name
end
local unit_prefixed_mt = {
-- Metatable to get missing values for a unit that accepts SI prefixes.
-- Before use, fields si_name, si_prefix must be defined.
-- The unit must define _symbol, _name1 and
-- may define _sym_us, _name1_us, _name2_us
-- (_sym_us, _name2_us may be defined for a language using sp=us
-- to refer to a variant unrelated to U.S. units).
__index = function (self, key)
local value
if key == 'symbol' then
value = self.si_prefix .. self._symbol
if value == 'l' then value = 'L' end
elseif key == 'sym_us' then
value = rawget(self, '_sym_us')
if value then
value = self.si_prefix .. value
else
value = self.symbol
end
elseif key == 'name1' then
value = prefixed_name(self, self._name1, 1)
elseif key == 'name2' then
value = rawget(self, '_name2')
if value then
value = prefixed_name(self, value, 2)
else
value = self.name1 .. plural_suffix
end
elseif key == 'name1_us' then
value = rawget(self, '_name1_us')
if value then
value = prefixed_name(self, value, 3)
else
value = self.name1
end
elseif key == 'name2_us' then
value = rawget(self, '_name2_us')
if value then
value = prefixed_name(self, value, 4)
elseif rawget(self, '_name1_us') then
value = self.name1_us .. plural_suffix
else
value = self.name2
end
elseif key == 'link' then
value = self.name1
else
value = false
end
rawset(self, key, value)
return value
end
}
local unit_per_mt = {
-- Metatable to get values for a per unit of form "x/y".
-- This is never called to determine a unit name or link because per units
-- are handled as a special case.
-- Similarly, the default output is handled elsewhere, and for a symbol
-- this is only called from get_default() for default_exceptions.
__index = function (self, key)
local value
if key == 'symbol' then
local per = self.per
local unit1, unit2 = per[1], per[2]
if unit1 then
value = unit1[key] .. '/' .. unit2[key]
else
value = '/' .. unit2[key]
end
elseif key == 'sym_us' then
value = self.symbol
elseif key == 'scale' then
local per = self.per
local unit1, unit2 = per[1], per[2]
value = (unit1 and unit1.scale or 1) * self.scalemultiplier / unit2.scale
else
value = false
end
rawset(self, key, value)
return value
end
}
local function make_per(unitcode, unit_table, ulookup)
-- Return true, t where t is a per unit with unit codes expanded to unit tables,
-- or return false, t where t is an error message table.
local result = {
unitcode = unitcode,
utype = unit_table.utype,
per = {}
}
override_from(result, unit_table, { 'invert', 'iscomplex', 'default', 'link', 'symbol', 'symlink' })
result.symbol_raw = (result.symbol or false) -- to distinguish between a defined exception and a metatable calculation
local prefix
for i, v in ipairs(unit_table.per) do
if i == 1 and v == '' then
-- First unit symbol can be empty; that gives a nil first unit table.
elseif i == 1 and text_code.currency[v] then
prefix = currency_text or v
else
local success, t = ulookup(v)
if not success then return false, t end
result.per[i] = t
end
end
local multiplier = unit_table.multiplier
if not result.utype then
-- Creating an automatic per unit.
local unit1 = result.per[1]
local utype = (unit1 and unit1.utype or prefix or '') .. '/' .. result.per[2].utype
local t = data_code.per_unit_fixups[utype]
if t then
if type(t) == 'table' then
utype = t.utype or utype
result.link = result.link or t.link
multiplier = multiplier or t.multiplier
else
utype = t
end
end
result.utype = utype
end
result.scalemultiplier = multiplier or 1
result.vprefix = prefix or false -- set to non-nil to avoid calling __index
return true, setmetatable(result, unit_per_mt)
end
local function lookup(parms, unitcode, what, utable, fails, depth)
-- Return true, t where t is a copy of the unit's converter table,
-- or return false, t where t is an error message table.
-- Parameter 'what' determines whether combination units are accepted:
-- 'no_combination' : single unit only
-- 'any_combination' : single unit or combination or output multiple
-- 'only_multiple' : single unit or output multiple only
-- Parameter unitcode is a symbol (like 'g'), with an optional SI prefix (like 'kg').
-- If, for example, 'kg' is in this table, that entry is used;
-- otherwise the prefix ('k') is applied to the base unit ('g').
-- If unitcode is a known combination code (and if allowed by what),
-- a table of output multiple unit tables is included in the result.
-- For compatibility with the old template, an underscore in a unitcode is
-- replaced with a space so usage like {{convert|350|board_feet}} works.
-- Wikignomes may also put two spaces or " " in combinations, so
-- replace underscore, " ", and multiple spaces with a single space.
utable = utable or parms.unittable or all_units
fails = fails or {}
depth = depth and depth + 1 or 1
if depth > 9 then
-- There are ways to mistakenly define units which result in infinite
-- recursion when lookup() is called. That gives a long delay and very
-- confusing error messages, so the depth parameter is used as a guard.
return false, { 'cvt_lookup', unitcode }
end
if unitcode == nil or unitcode == '' then
return false, { 'cvt_no_unit' }
end
unitcode = unitcode:gsub('_', ' '):gsub(' ', ' '):gsub(' +', ' ')
local function call_make_per(t)
return make_per(unitcode, t,
function (ucode) return lookup(parms, ucode, 'no_combination', utable, fails, depth) end
)
end
local t = utable[unitcode]
if t then
if t.shouldbe then
return false, { 'cvt_should_be', t.shouldbe }
end
if t.sp_us then
parms.opt_sp_us = true
end
local target = t.target -- nil, or unitcode is an alias for this target
if target then
local success, result = lookup(parms, target, what, utable, fails, depth)
if not success then return false, result end
override_from(result, t, { 'customary', 'default', 'link', 'symbol', 'symlink', 'usename' })
if t.default then
result.defkey = unitcode -- so default_exceptions uses the alias code, not the target symbol
end
local multiplier = t.multiplier
if multiplier then
result.multiplier = tostring(multiplier)
result.scale = result.scale * multiplier
end
return true, result
end
if t.per then
return call_make_per(t)
end
local combo = t.combination -- nil or a table of unitcodes
if combo then
local multiple = t.multiple
if what == 'no_combination' or (what == 'only_multiple' and not multiple) then
return false, { 'cvt_bad_unit', unitcode }
end
-- Recursively create a combination table containing the
-- converter table of each unitcode.
local result = { utype = t.utype, multiple = multiple, combination = {} }
local cvt = result.combination
for i, v in ipairs(combo) do
local success, t = lookup(parms, v, multiple and 'no_combination' or 'only_multiple', utable, fails, depth)
if not success then return false, t end
cvt[i] = t
end
return true, result
end
local result = shallow_copy(t)
result.unitcode = unitcode
if result.prefixes then
result.si_name = ''
result.si_prefix = ''
return true, setmetatable(result, unit_prefixed_mt)
end
return true, setmetatable(result, unit_mt)
end
local SIprefixes = text_code.SIprefixes
for plen = SIprefixes[1] or 2, 1, -1 do
-- Look for an SI prefix; should never occur with an alias.
-- Check for longer prefix first ('dam' is decametre).
-- SIprefixes[1] = prefix maximum #characters (as seen by mw.ustring.sub).
local prefix = usub(unitcode, 1, plen)
local si = SIprefixes[prefix]
if si then
local t = utable[usub(unitcode, plen+1)]
if t and t.prefixes then
local result = shallow_copy(t)
result.unitcode = unitcode
result.si_name = parms.opt_sp_us and si.name_us or si.name
result.si_prefix = si.prefix or prefix
result.scale = t.scale * 10 ^ (si.exponent * t.prefixes)
return true, setmetatable(result, unit_prefixed_mt)
end
end
end
-- Accept user-defined combinations like "acre+m2+ha" or "acre m2 ha" for output.
-- If '+' is used, each unit code can include a space, and any error is fatal.
-- If ' ' is used and if each space-separated word is a unit code, it is a combo,
-- but errors are not fatal so the unit code can be looked up as an extra unit.
local err_is_fatal
local combo = collection()
if unitcode:find('+', 1, true) then
err_is_fatal = true
for item in (unitcode .. '+'):gmatch('%s*(.-)%s*%+') do
if item ~= '' then
combo:add(item)
end
end
elseif unitcode:find('%s') then
for item in unitcode:gmatch('%S+') do
combo:add(item)
end
end
if combo.n > 1 then
local function lookup_combo()
if what == 'no_combination' or what == 'only_multiple' then
return false, { 'cvt_bad_unit', unitcode }
end
local result = { combination = {} }
local cvt = result.combination
for i, v in ipairs(combo) do
local success, t = lookup(parms, v, 'only_multiple', utable, fails, depth)
if not success then return false, t end
if i == 1 then
result.utype = t.utype
else
local mismatch = check_mismatch(result, t)
if mismatch then
return false, mismatch
end
end
cvt[i] = t
end
return true, result
end
local success, result = lookup_combo()
if success or err_is_fatal then
return success, result
end
end
-- Accept any unit with an engineering notation prefix like "e6cuft"
-- (million cubic feet), but not chained prefixes like "e3e6cuft",
-- and not if the unit is a combination or multiple,
-- and not if the unit has an offset or is a built-in.
-- Only en digits are accepted.
local e, exponent, baseunit = unitcode:match('^([Ee])(%d+)(.*)')
if exponent then
local engscale = text_code.eng_scales[exponent]
if engscale then
local success, result = lookup(parms, baseunit, 'no_combination', utable, fails, depth)
if success and not (result.offset or result.builtin or result.engscale) then
if e == 'E' then
result.this_number_word = true
unitcode = 'e' .. unitcode:sub(2)
end
result.unitcode = unitcode -- 'e6cuft' not 'cuft'
result.defkey = unitcode -- key to lookup default exception
result.engscale = engscale
result.scale = result.scale * 10 ^ tonumber(exponent)
return true, result
end
end
end
-- Look for x/y; split on right-most slash to get scale correct (x/y/z is x/y per z).
local top, bottom = unitcode:match('^(.-)/([^/]+)$')
if top and not unitcode:find('e%d') then
-- If valid, create an automatic per unit for an "x/y" unit code.
-- The unitcode must not include extraneous spaces.
-- Engineering notation (apart from at start and which has been stripped before here),
-- is not supported so do not make a per unit if find text like 'e3' in unitcode.
local success, result = call_make_per({ per = {top, bottom} })
if success then
return true, result
end
end
if not parms.opt_no_extra and not get_range(unitcode) then
-- Want the "what links here" list for the extra_module to show only cases
-- where an extra unit is used, so do not require it when not needed
-- or if looking up a range word which cannot be a unit.
if not extra_units then
local success, extra = pcall(function () return require(extra_module).extra_units end)
if success and type(extra) == 'table' then
extra_units = extra
end
end
if extra_units then
-- A unit in one data table might refer to a unit in the other table, so
-- switch between them, relying on fails or depth to terminate loops.
if not fails[unitcode] then
fails[unitcode] = true
local other = (utable == all_units) and extra_units or all_units
local success, result = lookup(parms, unitcode, what, other, fails, depth)
if success then
return true, result
end
end
end
end
if to_en_table then
-- At fawiki it is common to translate all digits so a unit like "km2" becomes "km۲".
local en_code = ustring.gsub(unitcode, '%d', to_en_table)
if en_code ~= unitcode then
return lookup(parms, en_code, what, utable, fails, depth)
end
end
return false, { 'cvt_unknown', unitcode }
end
local function valid_number(num)
-- Return true if num is a valid number.
-- In Scribunto (different from some standard Lua), when expressed as a string,
-- overflow or other problems are indicated with text like "inf" or "nan"
-- which are regarded as invalid here (each contains "n").
if type(num) == 'number' and tostring(num):find('n', 1, true) == nil then
return true
end
end
local function hyphenated(name, parts)
-- Return a hyphenated form of given name (for adjectival usage).
-- The name may be linked and the target of the link must not be changed.
-- Hypothetical examples:
-- [[long ton|ton]] → [[long ton|ton]] (no change)
-- [[tonne|long ton]] → [[tonne|long-ton]]
-- [[metric ton|long ton]] → [[metric ton|long-ton]]
-- [[long ton]] → [[long ton|long-ton]]
-- Input can also have multiple links in a single name like:
-- [[United States customary units|U.S.]] [[US gallon|gallon]]
-- [[mile]]s per [[United States customary units|U.S.]] [[quart]]
-- [[long ton]]s per [[short ton]]
-- Assume that links cannot be nested (never like "[[abc[[def]]ghi]]").
-- This uses a simple and efficient procedure that works for most cases.
-- Some units (if used) would require more, and can later think about
-- adding a method to handle exceptions.
-- The procedure is to replace each space with a hyphen, but
-- not a space after ')' [for "(pre-1954 US) nautical mile"], and
-- not spaces immediately before '(' or in '(...)' [for cases like
-- "British thermal unit (ISO)" and "Calorie (International Steam Table)"].
if name:find(' ', 1, true) then
if parts then
local pos
if name:sub(1, 1) == '(' then
pos = name:find(')', 1, true)
if pos then
return name:sub(1, pos+1) .. name:sub(pos+2):gsub(' ', '-')
end
elseif name:sub(-1) == ')' then
pos = name:find('(', 1, true)
if pos then
return name:sub(1, pos-2):gsub(' ', '-') .. name:sub(pos-1)
end
end
return name:gsub(' ', '-')
end
parts = collection()
for before, item, after in name:gmatch('([^[]*)(%[%[[^[]*%]%])([^[]*)') do
if item:find(' ', 1, true) then
local prefix
local plen = item:find('|', 1, true)
if plen then
prefix = item:sub(1, plen)
item = item:sub(plen + 1, -3)
else
prefix = item:sub(1, -3) .. '|'
item = item:sub(3, -3)
end
item = prefix .. hyphenated(item, parts) .. ']]'
end
parts:add(before:gsub(' ', '-') .. item .. after:gsub(' ', '-'))
end
if parts.n == 0 then
-- No link like "[[...]]" was found in the original name.
parts:add(hyphenated(name, parts))
end
return table.concat(parts)
end
return name
end
local function hyphenated_maybe(parms, want_name, sep, id, inout)
-- Return s, f where
-- s = id, possibly modified
-- f = true if hyphenated
-- Possible modifications: hyphenate; prepend '-'; append mid text.
if id == nil or id == '' then
return ''
end
local mid = (inout == (parms.opt_flip and 'out' or 'in')) and parms.mid or ''
if want_name then
if parms.opt_adjectival then
return '-' .. hyphenated(id) .. mid, true
end
if parms.opt_add_s and id:sub(-1) ~= 's' then
id = id .. 's' -- for nowiki
end
end
return sep .. id .. mid
end
local function use_minus(text)
-- Return text with Unicode minus instead of '-', if present.
if text:sub(1, 1) == '-' then
return MINUS .. text:sub(2)
end
return text
end
local function digit_groups(parms, text, method)
-- Return a numbered table of groups of digits (left-to-right, in local language).
-- Parameter method is a number or nil:
-- 3 for 3-digit grouping (default), or
-- 2 for 3-then-2 grouping (only for digits before decimal mark).
local len_right
local len_left = text:find('.', 1, true)
if len_left then
len_right = #text - len_left
len_left = len_left - 1
else
len_left = #text
end
local twos = method == 2 and len_left > 5
local groups = collection()
local run = len_left
local n
if run < 4 or (run == 4 and parms.opt_comma5) then
if parms.opt_gaps then
n = run
else
n = #text
end
elseif twos then
n = run % 2 == 0 and 1 or 2
else
n = run % 3 == 0 and 3 or run % 3
end
while run > 0 do
groups:add(n)
run = run - n
n = (twos and run > 3) and 2 or 3
end
if len_right then
if groups.n == 0 then
groups:add(0)
end
if parms.opt_gaps and len_right > 3 then
local want4 = not parms.opt_gaps3 -- true gives no gap before trailing single digit
local isfirst = true
run = len_right
while run > 0 do
n = (want4 and run == 4) and 4 or (run > 3 and 3 or run)
if isfirst then
isfirst = false
groups[groups.n] = groups[groups.n] + 1 + n
else
groups:add(n)
end
run = run - n
end
else
groups[groups.n] = groups[groups.n] + 1 + len_right
end
end
local pos = 1
for i, length in ipairs(groups) do
groups[i] = from_en(text:sub(pos, pos + length - 1))
pos = pos + length
end
return groups
end
function with_separator(parms, text) -- for forward declaration above
-- Input text is a number in en digits with optional '.' decimal mark.
-- Return an equivalent, formatted for display:
-- with a custom decimal mark instead of '.', if wanted
-- with thousand separators inserted, if wanted
-- digits in local language
-- The given text is like '123' or '123.' or '12345.6789'.
-- The text has no sign (caller inserts that later, if necessary).
-- When using gaps, they are inserted before and after the decimal mark.
-- Separators are inserted only before the decimal mark.
-- A trailing dot (as in '123.') is removed because their use appears to
-- be accidental, and such a number should be shown as '123' or '123.0'.
-- It is useful for convert to suppress the dot so, for example, '4000.'
-- is a simple way of indicating that all the digits are significant.
if text:sub(-1) == '.' then
text = text:sub(1, -2)
end
if #text < 4 or parms.opt_nocomma or numsep == '' then
return from_en(text)
end
local groups = digit_groups(parms, text, group_method)
if parms.opt_gaps then
if groups.n <= 1 then
return groups[1] or ''
end
local nowrap = '<span style="white-space: nowrap">'
local gap = '<span style="margin-left: 0.25em">'
local close = '</span>'
return nowrap .. groups[1] .. gap .. table.concat(groups, close .. gap, 2, groups.n) .. close .. close
end
return table.concat(groups, numsep)
end
-- An input value like 1.23e12 is displayed using scientific notation (1.23×10¹²).
-- That also makes the output use scientific notation, except for small values.
-- In addition, very small or very large output values use scientific notation.
-- Use format(fmtpower, significand, '10', exponent) where each argument is a string.
local fmtpower = '%s<span style="margin:0 .15em 0 .25em">×</span>%s<sup>%s</sup>'
local function with_exponent(parms, show, exponent)
-- Return wikitext to display the implied value in scientific notation.
-- Input uses en digits; output uses digits in local language.
return format(fmtpower, with_separator(parms, show), from_en('10'), use_minus(from_en(tostring(exponent))))
end
local function make_sigfig(value, sigfig)
-- Return show, exponent that are equivalent to the result of
-- converting the number 'value' (where value >= 0) to a string,
-- rounded to 'sigfig' significant figures.
-- The returned items are:
-- show: a string of digits; no sign and no dot;
-- there is an implied dot before show.
-- exponent: a number (an integer) to shift the implied dot.
-- Resulting value = tonumber('.' .. show) * 10^exponent.
-- Examples:
-- make_sigfig(23.456, 3) returns '235', 2 (.235 * 10^2).
-- make_sigfig(0.0023456, 3) returns '235', -2 (.235 * 10^-2).
-- make_sigfig(0, 3) returns '000', 1 (.000 * 10^1).
if sigfig <= 0 then
sigfig = 1
elseif sigfig > maxsigfig then
sigfig = maxsigfig
end
if value == 0 then
return string.rep('0', sigfig), 1
end
local exp, fracpart = math.modf(log10(value))
if fracpart >= 0 then
fracpart = fracpart - 1
exp = exp + 1
end
local digits = format('%.0f', 10^(fracpart + sigfig))
if #digits > sigfig then
-- Overflow (for sigfig=3: like 0.9999 rounding to "1000"; need "100").
digits = digits:sub(1, sigfig)
exp = exp + 1
end
assert(#digits == sigfig, 'Bug: rounded number has wrong length')
return digits, exp
end
-- Fraction output format.
local fracfmt = {
{ -- Like {{frac}} (fraction slash).
'<span class="frac">{SIGN}<span class="num">{NUM}</span>⁄<span class="den">{DEN}</span></span>', -- 1/2
'<span class="frac">{SIGN}{WHOLE}<span class="sr-only">+</span><span class="num">{NUM}</span>⁄<span class="den">{DEN}</span></span>', -- 1+2/3
style = 'frac',
},
{ -- Like {{sfrac}} (stacked fraction, that is, horizontal bar).
'<span class="sfrac tion">{SIGN}<span class="num">{NUM}</span><span class="sr-only">/</span><span class="den">{DEN}</span></span>', -- 1//2
'<span class="sfrac">{SIGN}{WHOLE}<span class="sr-only">+</span><span class="tion"><span class="num">{NUM}</span><span class="sr-only">/</span><span class="den">{DEN}</span></span></span>', -- 1+2//3
style = 'sfrac',
},
}
local function format_fraction(parms, inout, negative, wholestr, numstr, denstr, do_spell, style)
-- Return wikitext for a fraction, possibly spelled.
-- Inputs use en digits and have no sign; output uses digits in local language.
local wikitext
if not style then
style = parms.opt_fraction_horizontal and 2 or 1
end
if wholestr == '' then
wholestr = nil
end
local substitute = {
SIGN = negative and MINUS or '',
WHOLE = wholestr and with_separator(parms, wholestr),
NUM = from_en(numstr),
DEN = from_en(denstr),
}
wikitext = fracfmt[style][wholestr and 2 or 1]:gsub('{(%u+)}', substitute)
if do_spell then
if negative then
if wholestr then
wholestr = '-' .. wholestr
else
numstr = '-' .. numstr
end
end
local s = spell_number(parms, inout, wholestr, numstr, denstr)
if s then
return s
end
end
add_style(parms, fracfmt[style].style)
return wikitext
end
local function format_number(parms, show, exponent, isnegative)
-- Parameter show is a string or a table containing strings.
-- Each string is a formatted number in en digits and optional '.' decimal mark.
-- A table represents a fraction: integer, numerator, denominator;
-- if a table is given, exponent must be nil.
-- Return t where t is a table with fields:
-- show = wikitext formatted to display implied value
-- (digits in local language)
-- is_scientific = true if show uses scientific notation
-- clean = unformatted show (possibly adjusted and with inserted '.')
-- (en digits)
-- sign = '' or MINUS
-- exponent = exponent (possibly adjusted)
-- The clean and exponent fields can be used to calculate the
-- rounded absolute value, if needed.
--
-- The value implied by the arguments is found from:
-- exponent is nil; and
-- show is a string of digits (no sign), with an optional dot;
-- show = '123.4' is value 123.4, '1234' is value 1234.0;
-- or:
-- exponent is an integer indicating where dot should be;
-- show is a string of digits (no sign and no dot);
-- there is an implied dot before show;
-- show does not start with '0';
-- show = '1234', exponent = 3 is value 0.1234*10^3 = 123.4.
--
-- The formatted result:
-- * Is for an output value and is spelled if wanted and possible.
-- * Includes a Unicode minus if isnegative and not spelled.
-- * Uses a custom decimal mark, if wanted.
-- * Has digits grouped where necessary, if wanted.
-- * Uses scientific notation if requested, or for very small or large values
-- (which forces result to not be spelled).
-- * Has no more than maxsigfig significant digits
-- (same as old template and {{#expr}}).
local xhi, xlo -- these control when scientific notation (exponent) is used
if parms.opt_scientific then
xhi, xlo = 4, 2 -- default for output if input uses e-notation
elseif parms.opt_scientific_always then
xhi, xlo = 0, 0 -- always use scientific notation (experimental)
else
xhi, xlo = 10, 4 -- default
end
local sign = isnegative and MINUS or ''
local maxlen = maxsigfig
local tfrac
if type(show) == 'table' then
tfrac = show
show = tfrac.wholestr
assert(exponent == nil, 'Bug: exponent given with fraction')
end
if not tfrac and not exponent then
local integer, dot, decimals = show:match('^(%d*)(%.?)(.*)')
if integer == '0' or integer == '' then
local zeros, figs = decimals:match('^(0*)([^0]?.*)')
if #figs == 0 then
if #zeros > maxlen then
show = '0.' .. zeros:sub(1, maxlen)
end
elseif #zeros >= xlo then
show = figs
exponent = -#zeros
elseif #figs > maxlen then
show = '0.' .. zeros .. figs:sub(1, maxlen)
end
elseif #integer >= xhi then
show = integer .. decimals
exponent = #integer
else
maxlen = maxlen + #dot
if #show > maxlen then
show = show:sub(1, maxlen)
end
end
end
if exponent then
local function zeros(n)
return string.rep('0', n)
end
if #show > maxlen then
show = show:sub(1, maxlen)
end
if exponent > xhi or exponent <= -xlo or (exponent == xhi and show ~= '1' .. zeros(xhi - 1)) then
-- When xhi, xlo = 10, 4 (the default), scientific notation is used if the
-- rounded value satisfies: value >= 1e9 or value < 1e-4 (1e9 = 0.1e10),
-- except if show is '1000000000' (1e9), for example:
-- {{convert|1000000000|m|m|sigfig=10}} → 1,000,000,000 metres (1,000,000,000 m)
local significand
if #show > 1 then
significand = show:sub(1, 1) .. '.' .. show:sub(2)
else
significand = show
end
return {
clean = '.' .. show,
exponent = exponent,
sign = sign,
show = sign .. with_exponent(parms, significand, exponent-1),
is_scientific = true,
}
end
if exponent >= #show then
show = show .. zeros(exponent - #show) -- result has no dot
elseif exponent <= 0 then
show = '0.' .. zeros(-exponent) .. show
else
show = show:sub(1, exponent) .. '.' .. show:sub(exponent+1)
end
end
local formatted_show
if tfrac then
show = tostring(tfrac.value) -- to set clean in returned table
formatted_show = format_fraction(parms, 'out', isnegative, tfrac.wholestr, tfrac.numstr, tfrac.denstr, parms.opt_spell_out)
else
if isnegative and show:match('^0.?0*$') then
sign = '' -- don't show minus if result is negative but rounds to zero
end
formatted_show = sign .. with_separator(parms, show)
if parms.opt_spell_out then
formatted_show = spell_number(parms, 'out', sign .. show) or formatted_show
end
end
return {
clean = show,
sign = sign,
show = formatted_show,
is_scientific = false, -- to avoid calling __index
}
end
local function extract_fraction(parms, text, negative)
-- If text represents a fraction, return
-- value, altvalue, show, denominator
-- where
-- value is a number (value of the fraction in argument text)
-- altvalue is an alternate interpretation of any fraction for the hands
-- unit where "12.1+3/4" means 12 hands 1.75 inches
-- show is a string (formatted text for display of an input value,
-- and is spelled if wanted and possible)
-- denominator is value of the denominator in the fraction
-- Otherwise, return nil.
-- Input uses en digits and '.' decimal mark (input has been translated).
-- Output uses digits in local language and local decimal mark, if any.
------------------------------------------------------------------------
-- Originally this function accepted x+y/z where x, y, z were any valid
-- numbers, possibly with a sign. For example '1.23e+2+1.2/2.4' = 123.5,
-- and '2-3/8' = 1.625. However, such usages were found to be errors or
-- misunderstandings, so since August 2014 the following restrictions apply:
-- x (if present) is an integer or has a single digit after decimal mark
-- y and z are unsigned integers
-- e-notation is not accepted
-- The overall number can start with '+' or '-' (so '12+3/4' and '+12+3/4'
-- and '-12-3/4' are valid).
-- Any leading negative sign is removed by the caller, so only inputs
-- like the following are accepted here (may have whitespace):
-- negative = false false true (there was a leading '-')
-- text = '2/3' '+2/3' '2/3'
-- text = '1+2/3' '+1+2/3' '1-2/3'
-- text = '12.3+1/2' '+12.3+1/2' '12.3-1/2'
-- Values like '12.3+1/2' are accepted, but are intended only for use
-- with the hands unit (not worth adding code to enforce that).
------------------------------------------------------------------------
local leading_plus, prefix, numstr, slashes, denstr =
text:match('^%s*(%+?)%s*(.-)%s*(%d+)%s*(/+)%s*(%d+)%s*$')
if not leading_plus then
-- Accept a single U+2044 fraction slash because that may be pasted.
leading_plus, prefix, numstr, denstr =
text:match('^%s*(%+?)%s*(.-)%s*(%d+)%s*⁄%s*(%d+)%s*$')
slashes = '/'
end
local numerator = tonumber(numstr)
local denominator = tonumber(denstr)
if numerator == nil or denominator == nil or (negative and leading_plus ~= '') then
return nil
end
local whole, wholestr
if prefix == '' then
wholestr = ''
whole = 0
else
-- Any prefix must be like '12+' or '12-' (whole number and fraction sign);
-- '12.3+' and '12.3-' are also accepted (single digit after decimal point)
-- because '12.3+1/2 hands' is valid (12 hands 3½ inches).
local num1, num2, frac_sign = prefix:match('^(%d+)(%.?%d?)%s*([+%-])$')
if num1 == nil then return nil end
if num2 == '' then -- num2 must be '' or like '.1' but not '.' or '.12'
wholestr = num1
else
if #num2 ~= 2 then return nil end
wholestr = num1 .. num2
end
if frac_sign ~= (negative and '-' or '+') then return nil end
whole = tonumber(wholestr)
if whole == nil then return nil end
end
local value = whole + numerator / denominator
if not valid_number(value) then return nil end
local altvalue = whole + numerator / (denominator * 10)
local style = #slashes -- kludge: 1 or 2 slashes can be used to select style
if style > 2 then style = 2 end
local wikitext = format_fraction(parms, 'in', negative, leading_plus .. wholestr, numstr, denstr, parms.opt_spell_in, style)
return value, altvalue, wikitext, denominator
end
local function extract_number(parms, text, another, no_fraction)
-- Return true, info if can extract a number from text,
-- where info is a table with the result,
-- or return false, t where t is an error message table.
-- Input can use en digits or digits in local language and can
-- have references at the end. Accepting references is intended
-- for use in infoboxes with a field for a value passed to convert.
-- Parameter another = true if the expected value is not the first.
-- Before processing, the input text is cleaned:
-- * Any thousand separators (valid or not) are removed.
-- * Any sign is replaced with '-' (if negative) or '' (otherwise).
-- That replaces Unicode minus with '-'.
-- If successful, the returned info table contains named fields:
-- value = a valid number
-- altvalue = a valid number, usually same as value but different
-- if fraction used (for hands unit)
-- singular = true if value is 1 or -1 (to use singular form of units)
-- clean = cleaned text with any separators and sign removed
-- (en digits and '.' decimal mark)
-- show = text formatted for output, possibly with ref strip markers
-- (digits in local language and custom decimal mark)
-- The resulting show:
-- * Is for an input value and is spelled if wanted and possible.
-- * Has a rounded value, if wanted.
-- * Has digits grouped where necessary, if wanted.
-- * If negative, a Unicode minus is used; otherwise the sign is
-- '+' (if the input text used '+'), or is '' (if no sign in input).
text = strip(text or '')
local reference
local pos = text:find('\127', 1, true)
if pos then
local before = text:sub(1, pos - 1)
local remainder = text:sub(pos)
local refs = {}
while #remainder > 0 do
local ref, spaces
ref, spaces, remainder = remainder:match('^(\127[^\127]*UNIQ[^\127]*%-ref[^\127]*\127)(%s*)(.*)')
if ref then
table.insert(refs, ref)
else
refs = {}
break
end
end
if #refs > 0 then
text = strip(before)
reference = table.concat(refs)
end
end
local clean = to_en(text, parms)
if clean == '' then
return false, { another and 'cvt_no_num2' or 'cvt_no_num' }
end
local isnegative, propersign = false, '' -- most common case
local singular, show, denominator
local value = tonumber(clean)
local altvalue
if value then
local sign = clean:sub(1, 1)
if sign == '+' or sign == '-' then
propersign = (sign == '+') and '+' or MINUS
clean = clean:sub(2)
end
if value < 0 then
isnegative = true
value = -value
end
else
local valstr
for _, prefix in ipairs({ '-', MINUS, '−' }) do
-- Including '-' sets isnegative in case input is a fraction like '-2-3/4'.
local plen = #prefix
if clean:sub(1, plen) == prefix then
valstr = clean:sub(plen + 1)
if valstr:match('^%s') then -- "- 1" is invalid but "-1 - 1/2" is ok
return false, { 'cvt_bad_num', text }
end
break
end
end
if valstr then
isnegative = true
propersign = MINUS
clean = valstr
value = tonumber(clean)
end
if value == nil then
if not no_fraction then
value, altvalue, show, denominator = extract_fraction(parms, clean, isnegative)
end
if value == nil then
return false, { 'cvt_bad_num', text }
end
if value <= 1 then
singular = true -- for example, "½ mile" or "one half mile" (singular unit)
end
end
end
if not valid_number(value) then -- for example, "1e310" may overflow
return false, { 'cvt_invalid_num' }
end
if show == nil then
-- clean is a non-empty string with no spaces, and does not represent a fraction,
-- and value = tonumber(clean) is a number >= 0.
-- If the input uses e-notation, show will be displayed using a power of ten, but
-- we use the number as given so it might not be normalized scientific notation.
-- The input value is spelled if specified so any e-notation is ignored;
-- that allows input like 2e6 to be spelled as "two million" which works
-- because the spell module converts '2e6' to '2000000' before spelling.
local function rounded(value, default, exponent)
local precision = parms.opt_ri
if precision then
local fmt = '%.' .. format('%d', precision) .. 'f'
local result = fmt:format(tonumber(value) + 2e-14) -- fudge for some common cases of bad rounding
if not exponent then
singular = (tonumber(result) == 1)
end
return result
end
return default
end
singular = (value == 1)
local scientific
local significand, exponent = clean:match('^([%d.]+)[Ee]([+%-]?%d+)')
if significand then
show = with_exponent(parms, rounded(significand, significand, exponent), exponent)
scientific = true
else
show = with_separator(parms, rounded(value, clean))
end
show = propersign .. show
if parms.opt_spell_in then
show = spell_number(parms, 'in', propersign .. rounded(value, clean)) or show
scientific = false
end
if scientific then
parms.opt_scientific = true
end
end
if isnegative and (value ~= 0) then
value = -value
altvalue = -(altvalue or value)
end
return true, {
value = value,
altvalue = altvalue or value,
singular = singular,
clean = clean,
show = show .. (reference or ''),
denominator = denominator,
}
end
local function get_number(text)
-- Return v, f where:
-- v = nil (text is not a number)
-- or
-- v = value of text (text is a number)
-- f = true if value is an integer
-- Input can use en digits or digits in local language or separators,
-- but no Unicode minus, and no fraction.
if text then
local number = tonumber(to_en(text))
if number then
local _, fracpart = math.modf(number)
return number, (fracpart == 0)
end
end
end
local function gcd(a, b)
-- Return the greatest common denominator for the given values,
-- which are known to be positive integers.
if a > b then
a, b = b, a
end
if a <= 0 then
return b
end
local r = b % a
if r <= 0 then
return a
end
if r == 1 then
return 1
end
return gcd(r, a)
end
local function fraction_table(value, denominator)
-- Return value as a string or a table:
-- * If result is a string, there is no fraction, and the result
-- is value formatted as a string of en digits.
-- * If result is a table, it represents a fraction with named fields:
-- wholestr, numstr, denstr (strings of en digits for integer, numerator, denominator).
-- The result is rounded to the nearest multiple of (1/denominator).
-- If the multiple is zero, no fraction is included.
-- No fraction is included if value is very large as the fraction would
-- be unhelpful, particularly if scientific notation is required.
-- Input value is a non-negative number.
-- Input denominator is a positive integer for the desired fraction.
if value <= 0 then
return '0'
end
if denominator <= 0 or value > 1e8 then
return format('%.2f', value)
end
local integer, decimals = math.modf(value)
local numerator = floor((decimals * denominator) +
0.5 + 2e-14) -- add fudge for some common cases of bad rounding
if numerator >= denominator then
integer = integer + 1
numerator = 0
end
local wholestr = tostring(integer)
if numerator > 0 then
local div = gcd(numerator, denominator)
if div > 1 then
numerator = numerator / div
denominator = denominator / div
end
return {
wholestr = (integer > 0) and wholestr or '',
numstr = tostring(numerator),
denstr = tostring(denominator),
value = value,
}
end
return wholestr
end
local function preunits(count, preunit1, preunit2)
-- If count is 1:
-- ignore preunit2
-- return p1
-- else:
-- preunit1 is used for preunit2 if the latter is empty
-- return p1, p2
-- where:
-- p1 is text to insert before the input unit
-- p2 is text to insert before the output unit
-- p1 or p2 may be nil to mean "no preunit"
-- Using '+' gives output like "5+ feet" (no space before, but space after).
local function withspace(text, wantboth)
-- Return text with space before and, if wantboth, after.
-- However, no space is added if there is a space or ' ' or '-'
-- at that position ('-' is for adjectival text).
-- There is also no space if text starts with '&'
-- (e.g. '°' would display a degree symbol with no preceding space).
local char = text:sub(1, 1)
if char == '&' then
return text -- an html entity can be used to specify the exact display
end
if not (char == ' ' or char == '-' or char == '+') then
text = ' ' .. text
end
if wantboth then
char = text:sub(-1, -1)
if not (char == ' ' or char == '-' or text:sub(-6, -1) == ' ') then
text = text .. ' '
end
end
return text
end
local PLUS = '+ '
preunit1 = preunit1 or ''
local trim1 = strip(preunit1)
if count == 1 then
if trim1 == '' then
return nil
end
if trim1 == '+' then
return PLUS
end
return withspace(preunit1, true)
end
preunit1 = withspace(preunit1)
preunit2 = preunit2 or ''
local trim2 = strip(preunit2)
if trim1 == '+' then
if trim2 == '' or trim2 == '+' then
return PLUS, PLUS
end
preunit1 = PLUS
end
if trim2 == '' then
if trim1 == '' then
return nil, nil
end
preunit2 = preunit1
elseif trim2 == '+' then
preunit2 = PLUS
elseif trim2 == ' ' then -- trick to make preunit2 empty
preunit2 = nil
else
preunit2 = withspace(preunit2)
end
return preunit1, preunit2
end
local function range_text(range, want_name, parms, before, after, inout, options)
-- Return before .. rtext .. after
-- where rtext is the text that separates two values in a range.
local rtext, adj_text, exception
options = options or {}
if type(range) == 'table' then
-- Table must specify range text for ('off' and 'on') or ('input' and 'output'),
-- and may specify range text for 'adj=on',
-- and may specify exception = true.
rtext = range[want_name and 'off' or 'on'] or
range[((inout == 'in') == (parms.opt_flip == true)) and 'output' or 'input']
adj_text = range['adj']
exception = range['exception']
else
rtext = range
end
if parms.opt_adjectival then
if want_name or (exception and parms.abbr_org == 'on') then
rtext = adj_text or rtext:gsub(' ', '-'):gsub(' ', '-')
end
end
if rtext == '–' and (options.spaced or after:sub(1, #MINUS) == MINUS) then
rtext = ' – '
end
return before .. rtext .. after
end
local function get_composite(parms, iparm, in_unit_table)
-- Look for a composite input unit. For example, {{convert|1|yd|2|ft|3|in}}
-- would result in a call to this function with
-- iparm = 3 (parms[iparm] = "2", just after the first unit)
-- in_unit_table = (unit table for "yd"; contains value 1 for number of yards)
-- Return true, iparm, unit where
-- iparm = index just after the composite units (7 in above example)
-- unit = composite unit table holding all input units,
-- or return true if no composite unit is present in parms,
-- or return false, t where t is an error message table.
local default, subinfo
local composite_units, count = { in_unit_table }, 1
local fixups = {}
local total = in_unit_table.valinfo[1].value
local subunit = in_unit_table
while subunit.subdivs do -- subdivs is nil or a table of allowed subdivisions
local subcode = strip(parms[iparm+1])
local subdiv = subunit.subdivs[subcode] or subunit.subdivs[(all_units[subcode] or {}).target]
if not subdiv then
break
end
local success
success, subunit = lookup(parms, subcode, 'no_combination')
if not success then return false, subunit end -- should never occur
success, subinfo = extract_number(parms, parms[iparm])
if not success then return false, subinfo end
iparm = iparm + 2
subunit.inout = 'in'
subunit.valinfo = { subinfo }
-- Recalculate total as a number of subdivisions.
-- subdiv[1] = number of subdivisions per previous unit (integer > 1).
total = total * subdiv[1] + subinfo.value
if not default then -- set by the first subdiv with a default defined
default = subdiv.default
end
count = count + 1
composite_units[count] = subunit
if subdiv.unit or subdiv.name then
fixups[count] = { unit = subdiv.unit, name = subdiv.name, valinfo = subunit.valinfo }
end
end
if count == 1 then
return true -- no error and no composite unit
end
for i, fixup in pairs(fixups) do
local unit = fixup.unit
local name = fixup.name
if not unit or (count > 2 and name) then
composite_units[i].fixed_name = name
else
local success, alternate = lookup(parms, unit, 'no_combination')
if not success then return false, alternate end -- should never occur
alternate.inout = 'in'
alternate.valinfo = fixup.valinfo
composite_units[i] = alternate
end
end
return true, iparm, {
utype = in_unit_table.utype,
scale = subunit.scale, -- scale of last (least significant) unit
valinfo = { { value = total, clean = subinfo.clean, denominator = subinfo.denominator } },
composite = composite_units,
default = default or in_unit_table.default
}
end
local function translate_parms(parms, kv_pairs)
-- Update fields in parms by translating each key:value in kv_pairs to terms
-- used by this module (may involve translating from local language to English).
-- Also, checks are performed which may display warnings, if enabled.
-- Return true if successful or return false, t where t is an error message table.
currency_text = nil -- local testing can hold module in memory; must clear globals
if kv_pairs.adj and kv_pairs.sing then
-- For enwiki (before translation), warn if attempt to use adj and sing
-- as the latter is a deprecated alias for the former.
if kv_pairs.adj ~= kv_pairs.sing and kv_pairs.sing ~= '' then
add_warning(parms, 1, 'cvt_unknown_option', 'sing=' .. kv_pairs.sing)
end
kv_pairs.sing = nil
end
kv_pairs.comma = kv_pairs.comma or config.comma -- for plwiki who want default comma=5
for loc_name, loc_value in pairs(kv_pairs) do
local en_name = text_code.en_option_name[loc_name]
if en_name then
local en_value = text_code.en_option_value[en_name]
if en_value == 'INTEGER' then -- altitude_ft, altitude_m, frac, sigfig
en_value = nil
if loc_value == '' then
add_warning(parms, 2, 'cvt_empty_option', loc_name)
else
local minimum
local number, is_integer = get_number(loc_value)
if en_name == 'sigfig' then
minimum = 1
elseif en_name == 'frac' then
minimum = 2
if number and number < 0 then
parms.opt_fraction_horizontal = true
number = -number
end
else
minimum = -1e6
end
if number and is_integer and number >= minimum then
en_value = number
else
local m
if en_name == 'frac' then
m = 'cvt_bad_frac'
elseif en_name == 'sigfig' then
m = 'cvt_bad_sigfig'
else
m = 'cvt_bad_altitude'
end
add_warning(parms, 1, m, loc_name .. '=' .. loc_value)
end
end
elseif en_value == 'TEXT' then -- $, input, qid, qual, stylein, styleout, tracking
en_value = loc_value ~= '' and loc_value or nil -- accept non-empty user text with no validation
if not en_value and (en_name == '$' or en_name == 'qid' or en_name == 'qual') then
add_warning(parms, 2, 'cvt_empty_option', loc_name)
elseif en_name == '$' then
-- Value should be a single character like "€" for the euro currency symbol, but anything is accepted.
currency_text = (loc_value == 'euro') and '€' or loc_value
elseif en_name == 'error' then
-- May have something like {{convert|...|error=x}} which will return the
-- conversion result if successful, or x if not (no error return).
parms.error_text = loc_value -- keep value because parms.error is nil if loc_value == ''
parms.opt_no_extra = true
elseif en_name == 'input' then
-- May have something like {{convert|input=}} (empty input) if source is an infobox
-- with optional fields. In that case, want to output nothing rather than an error.
parms.input_text = loc_value -- keep value because parms.input is nil if loc_value == ''
end
else
en_value = en_value[loc_value]
if en_value and en_value:sub(-1) == '?' then
en_value = en_value:sub(1, -2)
add_warning(parms, -1, 'cvt_deprecated', loc_name .. '=' .. loc_value)
end
if en_value == nil then
if loc_value == '' then
add_warning(parms, 2, 'cvt_empty_option', loc_name)
else
add_warning(parms, 1, 'cvt_unknown_option', loc_name .. '=' .. loc_value)
end
elseif en_value == '' then
en_value = nil -- an ignored option like adj=off
elseif type(en_value) == 'string' and en_value:sub(1, 4) == 'opt_' then
for _, v in ipairs(split(en_value, ',')) do
local lhs, rhs = v:match('^(.-)=(.+)$')
if rhs then
parms[lhs] = tonumber(rhs) or rhs
else
parms[v] = true
end
end
en_value = nil
end
end
parms[en_name] = en_value
else
add_warning(parms, 1, 'cvt_unknown_option', loc_name .. '=' .. loc_value)
end
end
local abbr_entered = parms.abbr
local cfg_abbr = config.abbr
if cfg_abbr then
-- Don't warn if invalid because every convert would show that warning.
if cfg_abbr == 'on always' then
parms.abbr = 'on'
elseif cfg_abbr == 'off always' then
parms.abbr = 'off'
elseif parms.abbr == nil then
if cfg_abbr == 'on default' then
parms.abbr = 'on'
elseif cfg_abbr == 'off default' then
parms.abbr = 'off'
end
end
end
if parms.abbr then
if parms.abbr == 'unit' then
parms.abbr = 'on'
parms.number_word = true
end
parms.abbr_org = parms.abbr -- original abbr, before any flip
elseif parms.opt_hand_hh then
parms.abbr_org = 'on'
parms.abbr = 'on'
else
parms.abbr = 'out' -- default is to abbreviate output only (use symbol, not name)
end
if parms.opt_order_out then
-- Disable options that do not work in a useful way with order=out.
parms.opt_flip = nil -- override adj=flip
parms.opt_spell_in = nil
parms.opt_spell_out = nil
parms.opt_spell_upper = nil
end
if parms.opt_spell_out and not abbr_entered then
parms.abbr = 'off' -- should show unit name when spelling the output value
end
if parms.opt_flip then
local function swap_in_out(option)
local value = parms[option]
if value == 'in' then
parms[option] = 'out'
elseif value == 'out' then
parms[option] = 'in'
end
end
swap_in_out('abbr')
swap_in_out('lk')
if parms.opt_spell_in and not parms.opt_spell_out then
-- For simplicity, and because it does not appear to be needed,
-- user cannot set an option to spell the output only.
parms.opt_spell_in = nil
parms.opt_spell_out = true
end
end
if parms.opt_spell_upper then
parms.spell_upper = parms.opt_flip and 'out' or 'in'
end
if parms.opt_table or parms.opt_tablecen then
if abbr_entered == nil and parms.lk == nil then
parms.opt_values = true
end
parms.table_align = parms.opt_table and 'right' or 'center'
end
if parms.table_align or parms.opt_sortable_on then
parms.need_table_or_sort = true
end
local disp_joins = text_code.disp_joins
local default_joins = disp_joins['b']
parms.join_between = default_joins[3] or '; '
local disp = parms.disp
if disp == nil then -- special case for the most common setting
parms.joins = default_joins
elseif disp == 'x' then
-- Later, parms.joins is set from the input parameters.
else
-- Old template does this.
local abbr = parms.abbr
if disp == 'slash' then
if abbr_entered == nil then
disp = 'slash-nbsp'
elseif abbr == 'in' or abbr == 'out' then
disp = 'slash-sp'
else
disp = 'slash-nosp'
end
elseif disp == 'sqbr' then
if abbr == 'on' then
disp = 'sqbr-nbsp'
else
disp = 'sqbr-sp'
end
end
parms.joins = disp_joins[disp] or default_joins
parms.join_between = parms.joins[3] or parms.join_between
parms.wantname = parms.joins.wantname
end
if (en_default and not parms.opt_lang_local and (parms[1] or ''):find('%d')) or parms.opt_lang_en then
from_en_table = nil
end
if en_default and from_en_table then
-- For hiwiki: localized symbol/name is defined with the US symbol/name field,
-- and is used if output uses localized numbers.
parms.opt_sp_us = true
end
return true
end
local function get_values(parms)
-- If successful, update parms and return true, v, i where
-- v = table of input values
-- i = index to next entry in parms after those processed here
-- or return false, t where t is an error message table.
local valinfo = collection() -- numbered table of input values
local range = collection() -- numbered table of range items (having, for example, 2 range items requires 3 input values)
local had_nocomma -- true if removed "nocomma" kludge from second parameter (like "tonocomma")
local parm2 = strip(parms[2])
if parm2 and parm2:sub(-7, -1) == 'nocomma' then
parms[2] = strip(parm2:sub(1, -8))
parms.opt_nocomma = true
had_nocomma = true
end
local function extractor(i)
-- If the parameter is not a value, try unpacking it as a range ("1-23" for "1 to 23").
-- However, "-1-2/3" is a negative fraction (-1⅔), so it must be extracted first.
-- Do not unpack a parameter if it is like "3-1/2" which is sometimes incorrectly
-- used instead of "3+1/2" (and which should not be interpreted as "3 to ½").
-- Unpacked items are inserted into the parms table.
-- The tail recursion allows combinations like "1x2 to 3x4".
local valstr = strip(parms[i]) -- trim so any '-' as a negative sign will be at start
local success, result = extract_number(parms, valstr, i > 1)
if not success and valstr and i < 20 then -- check i to limit abuse
local lhs, sep, rhs = valstr:match('^(%S+)%s+(%S+)%s+(%S.*)')
if lhs and not (sep == '-' and rhs:match('/')) then
if sep:find('%d') then
return success, result -- to reject {{convert|1 234 567|m}} with a decent message (en only)
end
parms[i] = rhs
table.insert(parms, i, sep)
table.insert(parms, i, lhs)
return extractor(i)
end
if not valstr:match('%-.*/') then
for _, sep in ipairs(text_code.ranges.words) do
local start, stop = valstr:find(sep, 2, true) -- start at 2 to skip any negative sign for range '-'
if start then
parms[i] = valstr:sub(stop + 1)
table.insert(parms, i, sep)
table.insert(parms, i, valstr:sub(1, start - 1))
return extractor(i)
end
end
end
end
return success, result
end
local i = 1
local is_change
while true do
local success, info = extractor(i) -- need to set parms.opt_nocomma before calling this
if not success then return false, info end
i = i + 1
if is_change then
info.is_change = true -- value is after "±" and so is a change (significant for range like {{convert|5|±|5|°C}})
is_change = nil
end
valinfo:add(info)
local range_item = get_range(strip(parms[i]))
if not range_item then
break
end
i = i + 1
range:add(range_item)
if type(range_item) == 'table' then
-- For range "x", if append unit to some values, append it to all.
parms.in_range_x = parms.in_range_x or range_item.in_range_x
parms.out_range_x = parms.out_range_x or range_item.out_range_x
parms.abbr_range_x = parms.abbr_range_x or range_item.abbr_range_x
is_change = range_item.is_range_change
end
end
if range.n > 0 then
if range.n > 30 then -- limit abuse, although 4 is a more likely upper limit
return false, { 'cvt_invalid_num' } -- misleading message but it will do
end
parms.range = range
elseif had_nocomma then
return false, { 'cvt_unknown', parm2 }
end
return true, valinfo, i
end
local function simple_get_values(parms)
-- If input is like "{{convert|valid_value|valid_unit|...}}",
-- return true, i, in_unit, in_unit_table
-- i = index in parms of what follows valid_unit, if anything.
-- The valid_value is not negative and does not use a fraction, and
-- no options requiring further processing of the input are used.
-- Otherwise, return nothing or return false, parm1 for caller to interpret.
-- Testing shows this function is successful for 96% of converts in articles,
-- and that on average it speeds up converts by 8%.
local clean = to_en(strip(parms[1] or ''), parms)
if parms.opt_ri or parms.opt_spell_in or #clean > 10 or not clean:match('^[0-9.]+$') then
return false, clean
end
local value = tonumber(clean)
if not value then return end
local info = {
value = value,
altvalue = value,
singular = (value == 1),
clean = clean,
show = with_separator(parms, clean),
}
local in_unit = strip(parms[2])
local success, in_unit_table = lookup(parms, in_unit, 'no_combination')
if not success then return end
in_unit_table.valinfo = { info }
return true, 3, in_unit, in_unit_table
end
local function wikidata_call(parms, operation, ...)
-- Return true, s where s is the result of a Wikidata operation,
-- or return false, t where t is an error message table.
local function worker(...)
wikidata_code = wikidata_code or require(wikidata_module)
wikidata_data = wikidata_data or mw.loadData(wikidata_data_module)
return wikidata_code[operation](wikidata_data, ...)
end
local success, status, result = pcall(worker, ...)
if success then
return status, result
end
if parms.opt_sortable_debug then
-- Use debug=yes to crash if an error while accessing Wikidata.
error('Error accessing Wikidata: ' .. status, 0)
end
return false, { 'cvt_wd_fail' }
end
local function get_parms(parms, args)
-- If successful, update parms and return true, unit where
-- parms is a table of all arguments passed to the template
-- converted to named arguments, and
-- unit is the input unit table;
-- or return false, t where t is an error message table.
-- For special processing (not a convert), can also return
-- true, wikitext where wikitext is the final result.
-- The returned input unit table may be for a fake unit using the specified
-- unit code as the symbol and name, and with bad_mcode = message code table.
-- MediaWiki removes leading and trailing whitespace from the values of
-- named arguments. However, the values of numbered arguments include any
-- whitespace entered in the template, and whitespace is used by some
-- parameters (example: the numbered parameters associated with "disp=x").
local kv_pairs = {} -- table of input key:value pairs where key is a name; needed because cannot iterate parms and add new fields to it
for k, v in pairs(args) do
if type(k) == 'number' or k == 'test' then -- parameter "test" is reserved for testing and is not translated
parms[k] = v
else
kv_pairs[k] = v
end
end
if parms.test == 'wikidata' then
local ulookup = function (ucode)
-- Use empty table for parms so it does not accumulate results when used repeatedly.
return lookup({}, ucode, 'no_combination')
end
return wikidata_call(parms, '_listunits', ulookup)
end
local success, msg = translate_parms(parms, kv_pairs)
if not success then return false, msg end
if parms.input then
success, msg = wikidata_call(parms, '_adjustparameters', parms, 1)
if not success then return false, msg end
end
local success, i, in_unit, in_unit_table = simple_get_values(parms)
if not success then
if type(i) == 'string' and i:match('^NNN+$') then
-- Some infoboxes have examples like {{convert|NNN|m}} (3 or more "N").
-- Output an empty string for these.
return false, { 'cvt_no_output' }
end
local valinfo
success, valinfo, i = get_values(parms)
if not success then return false, valinfo end
in_unit = strip(parms[i])
i = i + 1
success, in_unit_table = lookup(parms, in_unit, 'no_combination')
if not success then
in_unit = in_unit or ''
if parms.opt_ignore_error then -- display given unit code with no error (for use with {{val}})
in_unit_table = '' -- suppress error message and prevent processing of output unit
end
in_unit_table = setmetatable({
symbol = in_unit, name2 = in_unit, utype = in_unit,
scale = 1, default = '', defkey = '', linkey = '',
bad_mcode = in_unit_table }, unit_mt)
end
in_unit_table.valinfo = valinfo
end
if parms.test == 'msg' then
-- Am testing the messages produced when no output unit is specified, and
-- the input unit has a missing or invalid default.
-- Set two units for testing that.
-- LATER: Remove this code.
if in_unit == 'chain' then
in_unit_table.default = nil -- no default
elseif in_unit == 'rd' then
in_unit_table.default = "ft!X!m" -- an invalid expression
end
end
in_unit_table.inout = 'in' -- this is an input unit
if not parms.range then
local success, inext, composite_unit = get_composite(parms, i, in_unit_table)
if not success then return false, inext end
if composite_unit then
in_unit_table = composite_unit
i = inext
end
end
if in_unit_table.builtin == 'mach' then
-- As with old template, a number following Mach as the input unit is the altitude.
-- That is deprecated: should use altitude_ft=NUMBER or altitude_m=NUMBER.
local success, info
success = tonumber(parms[i]) -- this will often work and will give correct result for values like 2e4 without forcing output scientific notation
if success then
info = { value = success }
else
success, info = extract_number(parms, parms[i], false, true)
end
if success then
i = i + 1
in_unit_table.altitude = info.value
end
end
local word = strip(parms[i])
i = i + 1
local precision, is_bad_precision
local function set_precision(text)
local number, is_integer = get_number(text)
if number then
if is_integer then
precision = number
else
precision = text
is_bad_precision = true
end
return true -- text was used for precision, good or bad
end
end
if word and not set_precision(word) then
parms.out_unit = parms.out_unit or word
if set_precision(strip(parms[i])) then
i = i + 1
end
end
if parms.opt_adj_mid then
word = parms[i]
i = i + 1
if word then -- mid-text words
if word:sub(1, 1) == '-' then
parms.mid = word
else
parms.mid = ' ' .. word
end
end
end
if parms.opt_one_preunit then
parms[parms.opt_flip and 'preunit2' or 'preunit1'] = preunits(1, parms[i])
i = i + 1
end
if parms.disp == 'x' then
-- Following is reasonably compatible with the old template.
local first = parms[i] or ''
local second = parms[i+1] or ''
i = i + 2
if strip(first) == '' then -- user can enter ' ' rather than ' ' to avoid the default
first = ' [ ' .. first
second = ' ]' .. second
end
parms.joins = { first, second }
elseif parms.opt_two_preunits then
local p1, p2 = preunits(2, parms[i], parms[i+1])
i = i + 2
if parms.preunit1 then
-- To simplify documentation, allow unlikely use of adj=pre with disp=preunit
-- (however, an output unit must be specified with adj=pre and with disp=preunit).
parms.preunit1 = parms.preunit1 .. p1
parms.preunit2 = p2
else
parms.preunit1, parms.preunit2 = p1, p2
end
end
if precision == nil then
if set_precision(strip(parms[i])) then
i = i + 1
end
end
if is_bad_precision then
add_warning(parms, 1, 'cvt_bad_prec', precision)
else
parms.precision = precision
end
for j = i, i + 3 do
local parm = parms[j] -- warn if find a non-empty extraneous parameter
if parm and parm:match('%S') then
add_warning(parms, 1, 'cvt_unknown_option', parm)
break
end
end
return true, in_unit_table
end
local function record_default_precision(parms, out_current, precision)
-- If necessary, adjust parameters and return a possibly adjusted precision.
-- When converting a range of values where a default precision is required,
-- that default is calculated for each value because the result sometimes
-- depends on the precise input and output values. This function may cause
-- the entire convert process to be repeated in order to ensure that the
-- same default precision is used for each individual convert.
-- If that were not done, a range like 1000 to 1000.4 may give poor results
-- because the first output could be heavily rounded, while the second is not.
-- For range 1000.4 to 1000, this function can give the second convert the
-- same default precision that was used for the first.
if not parms.opt_round_each then
local maxdef = out_current.max_default_precision
if maxdef then
if maxdef < precision then
parms.do_convert_again = true
out_current.max_default_precision = precision
else
precision = out_current.max_default_precision
end
else
out_current.max_default_precision = precision
end
end
return precision
end
local function default_precision(parms, invalue, inclean, denominator, outvalue, in_current, out_current, extra)
-- Return a default value for precision (an integer like 2, 0, -2).
-- If denominator is not nil, it is the value of the denominator in inclean.
-- Code follows procedures used in old template.
local fudge = 1e-14 -- {{Order of magnitude}} adds this, so we do too
local prec, minprec, adjust
local subunit_ignore_trailing_zero
local subunit_more_precision -- kludge for "in" used in input like "|2|ft|6|in"
local composite = in_current.composite
if composite then
subunit_ignore_trailing_zero = true -- input "|2|st|10|lb" has precision 0, not -1
if composite[#composite].exception == 'subunit_more_precision' then
subunit_more_precision = true -- do not use standard precision with input like "|2|ft|6|in"
end
end
if denominator and denominator > 0 then
prec = math.max(log10(denominator), 1)
else
-- Count digits after decimal mark, handling cases like '12.345e6'.
local exponent
local integer, dot, decimals, expstr = inclean:match('^(%d*)(%.?)(%d*)(.*)')
local e = expstr:sub(1, 1)
if e == 'e' or e == 'E' then
exponent = tonumber(expstr:sub(2))
end
if dot == '' then
prec = subunit_ignore_trailing_zero and 0 or -integer:match('0*$'):len()
else
prec = #decimals
end
if exponent then
-- So '1230' and '1.23e3' both give prec = -1, and '0.00123' and '1.23e-3' give 5.
prec = prec - exponent
end
end
if in_current.istemperature and out_current.istemperature then
-- Converting between common temperatures (°C, °F, °R, K); not keVT.
-- Kelvin value can be almost zero, or small but negative due to precision problems.
-- Also, an input value like -300 C (below absolute zero) gives negative kelvins.
-- Calculate minimum precision from absolute value.
adjust = 0
local kelvin = abs((invalue - in_current.offset) * in_current.scale)
if kelvin < 1e-8 then -- assume nonzero due to input or calculation precision problem
minprec = 2
else
minprec = 2 - floor(log10(kelvin) + fudge) -- 3 sigfigs in kelvin
end
else
if invalue == 0 or outvalue <= 0 then
-- We are never called with a negative outvalue, but it might be zero.
-- This is special-cased to avoid calculation exceptions.
return record_default_precision(parms, out_current, 0)
end
if out_current.exception == 'integer_more_precision' and floor(invalue) == invalue then
-- With certain output units that sometimes give poor results
-- with default rounding, use more precision when the input
-- value is equal to an integer. An example of a poor result
-- is when input 50 gives a smaller output than input 49.5.
-- Experiment shows this helps, but it does not eliminate all
-- surprises because it is not clear whether "50" should be
-- interpreted as "from 45 to 55" or "from 49.5 to 50.5".
adjust = -log10(in_current.scale)
elseif subunit_more_precision then
-- Conversion like "{{convert|6|ft|1|in|cm}}" (where subunit is "in")
-- has a non-standard adjust value, to give more output precision.
adjust = log10(out_current.scale) + 2
else
adjust = log10(abs(invalue / outvalue))
end
adjust = adjust + log10(2)
-- Ensure that the output has at least two significant figures.
minprec = 1 - floor(log10(outvalue) + fudge)
end
if extra then
adjust = extra.adjust or adjust
minprec = extra.minprec or minprec
end
return record_default_precision(parms, out_current, math.max(floor(prec + adjust), minprec))
end
local function convert(parms, invalue, info, in_current, out_current)
-- Convert given input value from one unit to another.
-- Return output_value (a number) if a simple convert, or
-- return f, t where
-- f = true, t = table of information with results, or
-- f = false, t = error message table.
local inscale = in_current.scale
local outscale = out_current.scale
if not in_current.iscomplex and not out_current.iscomplex then
return invalue * (inscale / outscale) -- minimize overhead for most common case
end
if in_current.invert or out_current.invert then
-- Inverted units, such as inverse length, inverse time, or
-- fuel efficiency. Built-in units do not have invert set.
if (in_current.invert or 1) * (out_current.invert or 1) < 0 then
return 1 / (invalue * inscale * outscale)
end
return invalue * (inscale / outscale)
elseif in_current.offset then
-- Temperature (there are no built-ins for this type of unit).
if info.is_change then
return invalue * (inscale / outscale)
end
return (invalue - in_current.offset) * (inscale / outscale) + out_current.offset
else
-- Built-in unit.
local in_builtin = in_current.builtin
local out_builtin = out_current.builtin
if in_builtin and out_builtin then
if in_builtin == out_builtin then
return invalue
end
-- There are no cases (yet) where need to convert from one
-- built-in unit to another, so this should never occur.
return false, { 'cvt_bug_convert' }
end
if in_builtin == 'mach' or out_builtin == 'mach' then
-- Should check that only one altitude is given but am planning to remove
-- in_current.altitude (which can only occur when Mach is the input unit),
-- and out_current.altitude cannot occur.
local alt = parms.altitude_ft or in_current.altitude
if not alt and parms.altitude_m then
alt = parms.altitude_m / 0.3048 -- 1 ft = 0.3048 m
end
local spd = speed_of_sound(alt)
if in_builtin == 'mach' then
inscale = spd
return invalue * (inscale / outscale)
end
outscale = spd
local adjust = 0.1 / inscale
return true, {
outvalue = invalue * (inscale / outscale),
adjust = log10(adjust) + log10(2),
}
elseif in_builtin == 'hand' then
-- 1 hand = 4 inches; 1.2 hands = 6 inches.
-- Decimals of a hand are only defined for the first digit, and
-- the first fractional digit should be a number of inches (1, 2 or 3).
-- However, this code interprets the entire fractional part as the number
-- of inches / 10 (so 1.75 inches would be 0.175 hands).
-- A value like 12.3 hands is exactly 12*4 + 3 inches; base default precision on that.
local integer, fracpart = math.modf(invalue)
local inch_value = 4 * integer + 10 * fracpart -- equivalent number of inches
local factor = inscale / outscale
if factor == 4 then
-- Am converting to inches: show exact result, and use "inches" not "in" by default.
if parms.abbr_org == nil then
out_current.usename = true
end
local show = format('%g', abs(inch_value)) -- show and clean are unsigned
if not show:find('e', 1, true) then
return true, {
invalue = inch_value,
outvalue = inch_value,
clean = show,
show = show,
}
end
end
local outvalue = (integer + 2.5 * fracpart) * factor
local fracstr = info.clean:match('%.(.*)') or ''
local fmt
if fracstr == '' then
fmt = '%.0f'
else
fmt = '%.' .. format('%d', #fracstr - 1) .. 'f'
end
return true, {
invalue = inch_value,
clean = format(fmt, inch_value),
outvalue = outvalue,
minprec = 0,
}
end
end
return false, { 'cvt_bug_convert' } -- should never occur
end
local function user_style(parms, i)
-- Return text for a user-specified style for a table cell, or '' if none,
-- given i = 1 (input style) or 2 (output style).
local style = parms[(i == 1) and 'stylein' or 'styleout']
if style then
style = style:gsub('"', '')
if style ~= '' then
if style:sub(-1) ~= ';' then
style = style .. ';'
end
return style
end
end
return ''
end
local function make_table_or_sort(parms, invalue, info, in_current, scaled_top)
-- Set options to handle output for a table or a sort key, or both.
-- The text sort key is based on the value resulting from converting
-- the input to a fake base unit with scale = 1, and other properties
-- required for a conversion derived from the input unit.
-- For other modules, return the sort key in a hidden span element, and
-- the scaled value used to generate the sort key.
-- If scaled_top is set, it is the scaled value of the numerator of a per unit
-- to be combined with this unit (the denominator) to make the sort key.
-- Scaling only works with units that convert with a factor (not temperature).
local sortkey, scaled_value
if parms.opt_sortable_on then
local base = { -- a fake unit with enough fields for a valid convert
scale = 1,
invert = in_current.invert and 1,
iscomplex = in_current.iscomplex,
offset = in_current.offset and 0,
}
local outvalue, extra = convert(parms, invalue, info, in_current, base)
if extra then
outvalue = extra.outvalue
end
if in_current.istemperature then
-- Have converted to kelvin; assume numbers close to zero have a
-- rounding error and should be zero.
if abs(outvalue) < 1e-12 then
outvalue = 0
end
end
if scaled_top and outvalue ~= 0 then
outvalue = scaled_top / outvalue
end
scaled_value = outvalue
if not valid_number(outvalue) then
if outvalue < 0 then
sortkey = '1000000000000000000'
else
sortkey = '9000000000000000000'
end
elseif outvalue == 0 then
sortkey = '5000000000000000000'
else
local mag = floor(log10(abs(outvalue)) + 1e-14)
local prefix
if outvalue > 0 then
prefix = 7000 + mag
else
prefix = 2999 - mag
outvalue = outvalue + 10^(mag+1)
end
sortkey = format('%d', prefix) .. format('%015.0f', floor(outvalue * 10^(14-mag)))
end
end
local sortspan
if sortkey and not parms.table_align then
sortspan = parms.opt_sortable_debug and
'<span data-sort-value="' .. sortkey .. '♠"><span style="border:1px solid">' .. sortkey .. '♠</span></span>' or
'<span data-sort-value="' .. sortkey .. '♠"></span>'
parms.join_before = sortspan
end
if parms.table_align then
local sort
if sortkey then
sort = ' data-sort-value="' .. sortkey .. '"'
if parms.opt_sortable_debug then
parms.join_before = '<span style="border:1px solid">' .. sortkey .. '</span>'
end
else
sort = ''
end
local style = 'style="text-align:' .. parms.table_align .. ';'
local joins = {}
for i = 1, 2 do
joins[i] = (i == 1 and '' or '\n|') .. style .. user_style(parms, i) .. '"' .. sort .. '|'
end
parms.table_joins = joins
end
return sortspan, scaled_value
end
local cvt_to_hand
local function cvtround(parms, info, in_current, out_current)
-- Return true, t where t is a table with the conversion results; fields:
-- show = rounded, formatted string with the result of converting value in info,
-- using the rounding specified in parms.
-- singular = true if result (after rounding and ignoring any negative sign)
-- is "1", or like "1.00", or is a fraction with value < 1;
-- (and more fields shown below, and a calculated 'absvalue' field).
-- or return false, t where t is an error message table.
-- Input info.clean uses en digits (it has been translated, if necessary).
-- Output show uses en or non-en digits as appropriate, or can be spelled.
if out_current.builtin == 'hand' then
return cvt_to_hand(parms, info, in_current, out_current)
end
local invalue = in_current.builtin == 'hand' and info.altvalue or info.value
local outvalue, extra = convert(parms, invalue, info, in_current, out_current)
if parms.need_table_or_sort then
parms.need_table_or_sort = nil -- process using first input value only
make_table_or_sort(parms, invalue, info, in_current)
end
if extra then
if not outvalue then return false, extra end
invalue = extra.invalue or invalue
outvalue = extra.outvalue
end
if not valid_number(outvalue) then
return false, { 'cvt_invalid_num' }
end
local isnegative
if outvalue < 0 then
isnegative = true
outvalue = -outvalue
end
local precision, show, exponent
local denominator = out_current.frac
if denominator then
show = fraction_table(outvalue, denominator)
else
precision = parms.precision
if not precision then
if parms.sigfig then
show, exponent = make_sigfig(outvalue, parms.sigfig)
elseif parms.opt_round then
local n = parms.opt_round
if n == 0.5 then
local integer, fracpart = math.modf(floor(2 * outvalue + 0.5) / 2)
if fracpart == 0 then
show = format('%.0f', integer)
else
show = format('%.1f', integer + fracpart)
end
else
show = format('%.0f', floor((outvalue / n) + 0.5) * n)
end
elseif in_current.builtin == 'mach' then
local sigfig = info.clean:gsub('^[0.]+', ''):gsub('%.', ''):len() + 1
show, exponent = make_sigfig(outvalue, sigfig)
else
local inclean = info.clean
if extra then
inclean = extra.clean or inclean
show = extra.show
end
if not show then
precision = default_precision(parms, invalue, inclean, info.denominator, outvalue, in_current, out_current, extra)
end
end
end
end
if precision then
if precision >= 0 then
local fudge
if precision <= 8 then
-- Add a fudge to handle common cases of bad rounding due to inability
-- to precisely represent some values. This makes the following work:
-- {{convert|-100.1|C|K}} and {{convert|5555000|um|m|2}}.
-- Old template uses #expr round, which invokes PHP round().
-- LATER: Investigate how PHP round() works.
fudge = 2e-14
else
fudge = 0
end
local fmt = '%.' .. format('%d', precision) .. 'f'
local success
success, show = pcall(format, fmt, outvalue + fudge)
if not success then
return false, { 'cvt_big_prec', tostring(precision) }
end
else
precision = -precision -- #digits to zero (in addition to any digits after dot)
local shift = 10 ^ precision
show = format('%.0f', outvalue/shift)
if show ~= '0' then
exponent = #show + precision
end
end
end
local t = format_number(parms, show, exponent, isnegative)
if type(show) == 'string' then
-- Set singular using match because on some systems 0.99999999999999999 is 1.0.
if exponent then
t.singular = (exponent == 1 and show:match('^10*$'))
else
t.singular = (show == '1' or show:match('^1%.0*$'))
end
else
t.fraction_table = show
t.singular = (outvalue <= 1) -- cannot have 'fraction == 1', but if it were possible it would be singular
end
t.raw_absvalue = outvalue -- absolute value before rounding
return true, setmetatable(t, {
__index = function (self, key)
if key == 'absvalue' then
-- Calculate absolute value after rounding, if needed.
local clean, exponent = rawget(self, 'clean'), rawget(self, 'exponent')
local value = tonumber(clean) -- absolute value (any negative sign has been ignored)
if exponent then
value = value * 10^exponent
end
rawset(self, key, value)
return value
end
end })
end
function cvt_to_hand(parms, info, in_current, out_current)
-- Convert input to hands, inches.
-- Return true, t where t is a table with the conversion results;
-- or return false, t where t is an error message table.
if parms.abbr_org == nil then
out_current.usename = true -- default is to show name not symbol
end
local precision = parms.precision
local frac = out_current.frac
if not frac and precision and precision > 1 then
frac = (precision == 2) and 2 or 4
end
local out_next = out_current.out_next
if out_next then
-- Use magic knowledge to determine whether the next unit is inches without requiring i18n.
-- The following ensures that when the output combination "hand in" is used, the inches
-- value is rounded to match the hands value. Also, displaying say "61½" instead of 61.5
-- is better as 61.5 implies the value is not 61.4.
if out_next.exception == 'subunit_more_precision' then
out_next.frac = frac
end
end
-- Convert to inches; calculate hands from that.
local dummy_unit_table = { scale = out_current.scale / 4, frac = frac }
local success, outinfo = cvtround(parms, info, in_current, dummy_unit_table)
if not success then return false, outinfo end
local tfrac = outinfo.fraction_table
local inches = outinfo.raw_absvalue
if tfrac then
inches = floor(inches) -- integer part only; fraction added later
else
inches = floor(inches + 0.5) -- a hands measurement never shows decimals of an inch
end
local hands, inches = divide(inches, 4)
outinfo.absvalue = hands + inches/4 -- supposed to be the absolute rounded value, but this is close enough
local inchstr = tostring(inches) -- '0', '1', '2' or '3'
if precision and precision <= 0 then -- using negative or 0 for precision rounds to nearest hand
hands = floor(outinfo.raw_absvalue/4 + 0.5)
inchstr = ''
elseif tfrac then
-- Always show an integer before fraction (like "15.0½") because "15½" means 15-and-a-half hands.
inchstr = numdot .. format_fraction(parms, 'out', false, inchstr, tfrac.numstr, tfrac.denstr)
else
inchstr = numdot .. from_en(inchstr)
end
outinfo.show = outinfo.sign .. with_separator(parms, format('%.0f', hands)) .. inchstr
return true, outinfo
end
local function evaluate_condition(value, condition)
-- Return true or false from applying a conditional expression to value,
-- or throw an error if invalid.
-- A very limited set of expressions is supported:
-- v < 9
-- v * 9 < 9
-- where
-- 'v' is replaced with value
-- 9 is any number (as defined by Lua tonumber)
-- only en digits are accepted
-- '<' can also be '<=' or '>' or '>='
-- In addition, the following form is supported:
-- LHS and RHS
-- where
-- LHS, RHS = any of above expressions.
local function compare(value, text)
local arithop, factor, compop, limit = text:match('^%s*v%s*([*]?)(.-)([<>]=?)(.*)$')
if arithop == nil then
error('Invalid default expression', 0)
elseif arithop == '*' then
factor = tonumber(factor)
if factor == nil then
error('Invalid default expression', 0)
end
value = value * factor
end
limit = tonumber(limit)
if limit == nil then
error('Invalid default expression', 0)
end
if compop == '<' then
return value < limit
elseif compop == '<=' then
return value <= limit
elseif compop == '>' then
return value > limit
elseif compop == '>=' then
return value >= limit
end
error('Invalid default expression', 0) -- should not occur
end
local lhs, rhs = condition:match('^(.-%W)and(%W.*)')
if lhs == nil then
return compare(value, condition)
end
return compare(value, lhs) and compare(value, rhs)
end
local function get_default(value, unit_table)
-- Return true, s where s = name of unit's default output unit,
-- or return false, t where t is an error message table.
-- Some units have a default that depends on the input value
-- (the first value if a range of values is used).
-- If '!' is in the default, the first bang-delimited field is an
-- expression that uses 'v' to represent the input value.
-- Example: 'v < 120 ! small ! big ! suffix' (suffix is optional)
-- evaluates 'v < 120' as a boolean with result
-- 'smallsuffix' if (value < 120), or 'bigsuffix' otherwise.
-- Input must use en digits and '.' decimal mark.
local default = data_code.default_exceptions[unit_table.defkey or unit_table.symbol] or unit_table.default
if not default then
local per = unit_table.per
if per then
local function a_default(v, u)
local success, ucode = get_default(v, u)
if not success then
return '?' -- an unlikely error has occurred; will cause lookup of default to fail
end
-- Attempt to use only the first unit if a combination or output multiple.
-- This is not bulletproof but should work for most cases.
-- Where it does not work, the convert will need to specify the wanted output unit.
local t = all_units[ucode]
if t then
local combo = t.combination
if combo then
-- For a multiple like ftin, the "first" unit (ft) is last in the combination.
local i = t.multiple and table_len(combo) or 1
ucode = combo[i]
end
else
-- Try for an automatically generated combination.
local item = ucode:match('^(.-)%+') or ucode:match('^(%S+)%s')
if all_units[item] then
return item
end
end
return ucode
end
local unit1, unit2 = per[1], per[2]
local def1 = (unit1 and a_default(value, unit1) or unit_table.vprefix or '')
local def2 = a_default(1, unit2) -- 1 because per unit of denominator
return true, def1 .. '/' .. def2
end
return false, { 'cvt_no_default', unit_table.symbol }
end
if default:find('!', 1, true) == nil then
return true, default
end
local t = split(default, '!')
if #t == 3 or #t == 4 then
local success, result = pcall(evaluate_condition, value, t[1])
if success then
default = result and t[2] or t[3]
if #t == 4 then
default = default .. t[4]
end
return true, default
end
end
return false, { 'cvt_bad_default', unit_table.symbol }
end
local linked_pages -- to record linked pages so will not link to the same page more than once
local function unlink(unit_table)
-- Forget that the given unit has previously been linked (if it has).
-- That is needed when processing a range of inputs or outputs when an id
-- for the first range value may have been evaluated, but only an id for
-- the last value is displayed, and that id may need to be linked.
linked_pages[unit_table.unitcode or unit_table] = nil
end
local function make_link(link, id, unit_table)
-- Return wikilink "[[link|id]]", possibly abbreviated as in examples:
-- [[Mile|mile]] --> [[mile]]
-- [[Mile|miles]] --> [[mile]]s
-- However, just id is returned if:
-- * no link given (so caller does not need to check if a link was defined); or
-- * link has previously been used during the current convert (to avoid overlinking).
local link_key
if unit_table then
link_key = unit_table.unitcode or unit_table
else
link_key = link
end
if not link or link == '' or linked_pages[link_key] then
return id
end
linked_pages[link_key] = true
-- Following only works for language en, but it should be safe on other wikis,
-- and overhead of doing it generally does not seem worthwhile.
local l = link:sub(1, 1):lower() .. link:sub(2)
if link == id or l == id then
return '[[' .. id .. ']]'
elseif link .. 's' == id or l .. 's' == id then
return '[[' .. id:sub(1, -2) .. ']]s'
else
return '[[' .. link .. '|' .. id .. ']]'
end
end
local function variable_name(clean, unit_table, exp_multiplier, key_id)
-- A unit name may depend on the value in some languages.
-- Parameter clean is the unsigned value in en digits, as a string.
-- It may represent a number ("1.0") or a fraction ("1+2/3").
-- In varname, fields are separated with "!" and are not empty.
-- A field for a unit using an SI prefix has the prefix name inserted,
-- replacing '#' if found, or before the field otherwise.
if clean:match('[./]') or clean:find('⁄', 1, true) then -- float or fraction
if exp_multiplier then
clean = exp_multiplier -- force selection of name for a large integer
else
clean = 34.5 -- force selection of name for a float value
end
else
clean = tonumber(clean) * (exp_multiplier or 1)
end
local name1, vname
if key_id == 'pername' and unit_table.pername then
vname = unit_table.pername
elseif unit_table.varname then
local splitvname = split(unit_table.varname, '!')
name1 = unit_table.name1
vname = mw.language.getContentLanguage():convertPlural(clean, name1, unpack(splitvname))
else
return clean == 1 and unit_table.name1 or unit_table.name2
end
if vname == name1 then
-- SI prefix (if any) has been inserted by unit_prefixed_mt.
else
local si_name = rawget(unit_table, 'si_name') or ''
local pos = vname:find('#', 1, true)
if pos then
vname = vname:sub(1, pos - 1) .. si_name .. vname:sub(pos + 1)
else
vname = si_name .. vname
end
end
return vname
end
local function linked_id(parms, unit_table, key_id, want_link, clean, exp_multiplier)
-- Return final unit id (symbol or name), optionally with a wikilink,
-- and update unit_table.sep if required.
-- key_id is one of: 'symbol', 'sym_us', 'name1', 'name1_us', 'name2', 'name2_us', 'pername'.
local abbr_on = (key_id == 'symbol' or key_id == 'sym_us')
if abbr_on and want_link then
local symlink = rawget(unit_table, 'symlink')
if symlink then
return symlink -- for exceptions that have the linked symbol built-in
end
end
local multiplier = rawget(unit_table, 'multiplier')
local per = unit_table.per
if per then
local paren1, paren2 = '', '' -- possible parentheses around bottom unit
local unit1 = per[1] -- top unit_table, or nil
local unit2 = per[2] -- bottom unit_table
if abbr_on then
if not unit1 then
unit_table.sep = '' -- no separator in "$2/acre"
end
if not want_link then
local symbol = unit_table.symbol_raw
if symbol then
return symbol -- for exceptions that have the symbol built-in
end
end
if (unit2.symbol):find('⋅', 1, true) then
paren1, paren2 = '(', ')'
end
end
local key_id2 -- unit2 is always singular
if key_id == 'name2' then
key_id2 = 'name1'
elseif key_id == 'name2_us' then
key_id2 = 'name1_us'
else
key_id2 = key_id
end
if key_id2 == 'name1' or key_id2 == 'name1_us' then
key_id2 = unit2.pername and 'pername' or key_id2 -- ukwiki has some units with a different name in "per unitname"
end
local result
if abbr_on then
result = '/'
elseif omitsep then
result = per_word
elseif unit1 then
result = ' ' .. per_word .. ' '
else
result = per_word .. ' '
end
if want_link and unit_table.link then
if varname and not abbr_on then
result = (unit1 and variable_name(clean, unit1, exp_multiplier) or '') .. result .. variable_name('1', unit2, exp_multiplier, key_id2)
else
result = (unit1 and linked_id(parms, unit1, key_id, false, clean) or '') .. result .. linked_id(parms, unit2, key_id2, false, '1')
end
if omit_separator(result) then
unit_table.sep = ''
end
return make_link(unit_table.link, result, unit_table)
end
if unit1 then
result = linked_id(parms, unit1, key_id, want_link, clean) .. result
if unit1.sep then
unit_table.sep = unit1.sep
end
elseif omitsep then
unit_table.sep = ''
end
return result .. paren1 .. linked_id(parms, unit2, key_id2, want_link, '1') .. paren2
end
if multiplier then
-- A multiplier (like "100" in "100km") forces the unit to be plural.
multiplier = from_en(multiplier)
if not omitsep then
multiplier = multiplier .. (abbr_on and ' ' or ' ')
end
if not abbr_on then
if key_id == 'name1' then
key_id = 'name2'
elseif key_id == 'name1_us' then
key_id = 'name2_us'
end
end
else
multiplier = ''
end
local id = unit_table.fixed_name or ((varname and not abbr_on) and variable_name(clean, unit_table, exp_multiplier, key_id) or unit_table[key_id])
if omit_separator(id) then
unit_table.sep = ''
end
if want_link then
local link = data_code.link_exceptions[unit_table.linkey or unit_table.symbol] or unit_table.link
if link then
local before = ''
local i = unit_table.customary
if i == 1 and parms.opt_sp_us then
i = 2 -- show "U.S." not "US"
end
if i == 3 and abbr_on then
i = 4 -- abbreviate "imperial" to "imp"
end
local customary = text_code.customary_units[i]
if customary then
-- LATER: This works for language en only, but it's esoteric so ignore for now.
local pertext
if id:sub(1, 1) == '/' then
-- Want unit "/USgal" to display as "/U.S. gal", not "U.S. /gal".
pertext = '/'
id = id:sub(2)
elseif id:sub(1, 4) == 'per ' then
-- Similarly want "per U.S. gallon", not "U.S. per gallon" (but in practice this is unlikely to be used).
pertext = 'per '
id = id:sub(5)
else
pertext = ''
end
-- Omit any "US"/"U.S."/"imp"/"imperial" from start of id since that will be inserted.
local removes = (i < 3) and { 'US ', 'US ', 'U.S. ', 'U.S. ' } or { 'imp ', 'imp ', 'imperial ' }
for _, prefix in ipairs(removes) do
local plen = #prefix
if id:sub(1, plen) == prefix then
id = id:sub(plen + 1)
break
end
end
before = pertext .. make_link(customary.link, customary[1]) .. ' '
end
id = before .. make_link(link, id, unit_table)
end
end
return multiplier .. id
end
local function make_id(parms, which, unit_table)
-- Return id, f where
-- id = unit name or symbol, possibly modified
-- f = true if id is a name, or false if id is a symbol
-- using the value for index 'which', and for 'in' or 'out' (unit_table.inout).
-- Result is '' if no symbol/name is to be used.
-- In addition, set unit_table.sep = ' ' or ' ' or ''
-- (the separator that caller will normally insert before the id).
if parms.opt_values then
unit_table.sep = ''
return ''
end
local inout = unit_table.inout
local info = unit_table.valinfo[which]
local lk = parms.lk
local want_link = (lk == 'on' or lk == inout)
local singular = info.singular
local want_name
local exp_multiplier
if unit_table.usename then
want_name = true
else
if parms.abbr_org == nil then
if parms.wantname then
want_name = true
end
if unit_table.usesymbol then
want_name = false
end
end
if want_name == nil then
local abbr = parms.abbr
if abbr == 'on' or abbr == inout or (abbr == 'mos' and inout == 'out') then
want_name = false
else
want_name = true
end
end
end
local key
if want_name then
if lk == nil and unit_table.builtin == 'hand' then
want_link = true
end
if parms.opt_use_nbsp then
unit_table.sep = ' '
else
unit_table.sep = ' '
end
if parms.opt_singular then
local value
if inout == 'in' then
value = info.value
else
value = info.absvalue
end
if value then -- some unusual units do not always set value field
value = abs(value)
singular = (0 < value and value < 1.0001)
end
end
if unit_table.engscale then
-- engscale: so "|1|e3kg" gives "1 thousand kilograms" (plural)
singular = false
exp_multiplier = 10^unit_table.engscale.exponent -- '1 gram' and '1 thousand grams', for example, may use different names for the unit in some languages
end
key = (parms.opt_adjectival or singular) and 'name1' or 'name2'
if parms.opt_sp_us then
key = key .. '_us'
end
else
if unit_table.builtin == 'hand' then
if parms.opt_hand_hh then
unit_table.symbol = 'hh' -- LATER: might want i18n applied to this
end
end
unit_table.sep = ' '
key = parms.opt_sp_us and 'sym_us' or 'symbol'
end
return linked_id(parms, unit_table, key, want_link, info.clean, exp_multiplier), want_name
end
local function decorate_value(parms, unit_table, which, enable_number_word)
-- If needed, update unit_table so values will be shown with extra information.
-- For consistency with the old template (but different from fmtpower),
-- the style to display powers of 10 includes "display:none" to allow some
-- browsers to copy, for example, "10³" as "10^3", rather than as "103".
-- The engscale table may have entries such as either of the following:
-- ["3"] = { "thousand", exponent = 3 },
-- ["3"] = { name1 = "A", varname = "B!C!D", exponent = 3 },
-- The first option always uses "thousand" as the exponent name.
-- The second option uses one of A, B, C, D as the exponent name, depending on the value.
local info
local engscale = unit_table.engscale
local prefix = unit_table.vprefix
if engscale or prefix then
info = unit_table.valinfo[which]
if info.decorated then
return -- do not redecorate if repeating convert
end
info.decorated = true
if engscale then
-- Range |10|-|20|e3km| gives '10×10³–20×10³' or '10–20 thousand'.
local inout = unit_table.inout
local abbr = parms.abbr
if (abbr == 'on' or abbr == inout) and not (unit_table.this_number_word or parms.number_word) then
info.show = info.show ..
'<span style="margin-left:0.2em">×<span style="margin-left:0.1em">' ..
from_en('10') ..
'</span></span><s style="display:none">^</s><sup>' ..
from_en(tostring(engscale.exponent)) .. '</sup>'
elseif enable_number_word then
local number_id
local name = engscale.varname and variable_name(info.clean, engscale) or engscale[1]
if parms.lk == 'on' or parms.lk == inout then
number_id = make_link(engscale.link, name)
else
number_id = name
end
-- WP:NUMERAL recommends " " in values like "12 million".
info.show = info.show .. (parms.opt_adjectival and '-' or ' ') .. number_id
end
end
if prefix then
info.show = prefix .. info.show
end
end
end
local function process_input(parms, in_current)
-- Processing required once per conversion.
-- Return block of text to represent input (value/unit).
if parms.opt_output_only or parms.opt_output_number_only or parms.opt_output_unit_only then
parms.joins = { '', '' }
return ''
end
local first_unit
local composite = in_current.composite -- nil or table of units
if composite then
first_unit = composite[1]
else
first_unit = in_current
end
local id1, want_name = make_id(parms, 1, first_unit)
local sep = first_unit.sep -- separator between value and unit, set by make_id
local preunit = parms.preunit1
if preunit then
sep = '' -- any separator is included in preunit
else
preunit = ''
end
if parms.opt_input_unit_only then
parms.joins = { '', '' }
if composite then
local parts = { id1 }
for i, unit in ipairs(composite) do
if i > 1 then
table.insert(parts, (make_id(parms, 1, unit)))
end
end
id1 = table.concat(parts, ' ')
end
if want_name and parms.opt_adjectival then
return preunit .. hyphenated(id1)
end
return preunit .. id1
end
if parms.opt_also_symbol and not composite and not parms.opt_flip then
local join1 = parms.joins[1]
if join1 == ' (' or join1 == ' [' then
parms.joins = { ' [' .. first_unit[parms.opt_sp_us and 'sym_us' or 'symbol'] .. ']' .. join1 , parms.joins[2] }
end
end
if in_current.builtin == 'mach' and first_unit.sep ~= '' then -- '' means omitsep with non-enwiki name
local prefix = id1 .. ' '
local range = parms.range
local valinfo = first_unit.valinfo
local result = prefix .. valinfo[1].show
if range then
-- For simplicity and because more not needed, handle one range item only.
local prefix2 = make_id(parms, 2, first_unit) .. ' '
result = range_text(range[1], want_name, parms, result, prefix2 .. valinfo[2].show, 'in', {spaced=true})
end
return preunit .. result
end
if composite then
-- Simplify: assume there is no range, and no decoration.
local mid = (not parms.opt_flip) and parms.mid or ''
local sep1 = ' '
local sep2 = ' '
if parms.opt_adjectival and want_name then
sep1 = '-'
sep2 = '-'
end
if omitsep and sep == '' then
-- Testing the id of the most significant unit should be sufficient.
sep1 = ''
sep2 = ''
end
local parts = { first_unit.valinfo[1].show .. sep1 .. id1 }
for i, unit in ipairs(composite) do
if i > 1 then
table.insert(parts, unit.valinfo[1].show .. sep1 .. (make_id(parms, 1, unit)))
end
end
return table.concat(parts, sep2) .. mid
end
local add_unit = (parms.abbr == 'mos') or
parms[parms.opt_flip and 'out_range_x' or 'in_range_x'] or
(not want_name and parms.abbr_range_x)
local range = parms.range
if range and not add_unit then
unlink(first_unit)
end
local id = range and make_id(parms, range.n + 1, first_unit) or id1
local extra, was_hyphenated = hyphenated_maybe(parms, want_name, sep, id, 'in')
if was_hyphenated then
add_unit = false
end
local result
local valinfo = first_unit.valinfo
if range then
for i = 0, range.n do
local enable_number_word
if i == range.n then
add_unit = false
enable_number_word = true
end
decorate_value(parms, first_unit, i+1, enable_number_word)
local show = valinfo[i+1].show
if add_unit then
show = show .. first_unit.sep .. (i == 0 and id1 or make_id(parms, i+1, first_unit))
end
if i == 0 then
result = show
else
result = range_text(range[i], want_name, parms, result, show, 'in')
end
end
else
decorate_value(parms, first_unit, 1, true)
result = valinfo[1].show
end
return result .. preunit .. extra
end
local function process_one_output(parms, out_current)
-- Processing required for each output unit.
-- Return block of text to represent output (value/unit).
local inout = out_current.inout -- normally 'out' but can be 'in' for order=out
local id1, want_name = make_id(parms, 1, out_current)
local sep = out_current.sep -- set by make_id
local preunit = parms.preunit2
if preunit then
sep = '' -- any separator is included in preunit
else
preunit = ''
end
if parms.opt_output_unit_only then
if want_name and parms.opt_adjectival then
return preunit .. hyphenated(id1)
end
return preunit .. id1
end
if out_current.builtin == 'mach' and out_current.sep ~= '' then -- '' means omitsep with non-enwiki name
local prefix = id1 .. ' '
local range = parms.range
local valinfo = out_current.valinfo
local result = prefix .. valinfo[1].show
if range then
-- For simplicity and because more not needed, handle one range item only.
result = range_text(range[1], want_name, parms, result, prefix .. valinfo[2].show, inout, {spaced=true})
end
return preunit .. result
end
local add_unit = (parms[parms.opt_flip and 'in_range_x' or 'out_range_x'] or
(not want_name and parms.abbr_range_x)) and
not parms.opt_output_number_only
local range = parms.range
if range and not add_unit then
unlink(out_current)
end
local id = range and make_id(parms, range.n + 1, out_current) or id1
local extra, was_hyphenated = hyphenated_maybe(parms, want_name, sep, id, inout)
if was_hyphenated then
add_unit = false
end
local result
local valinfo = out_current.valinfo
if range then
for i = 0, range.n do
local enable_number_word
if i == range.n then
add_unit = false
enable_number_word = true
end
decorate_value(parms, out_current, i+1, enable_number_word)
local show = valinfo[i+1].show
if add_unit then
show = show .. out_current.sep .. (i == 0 and id1 or make_id(parms, i+1, out_current))
end
if i == 0 then
result = show
else
result = range_text(range[i], want_name, parms, result, show, inout)
end
end
else
decorate_value(parms, out_current, 1, true)
result = valinfo[1].show
end
if parms.opt_output_number_only then
return result
end
return result .. preunit .. extra
end
local function make_output_single(parms, in_unit_table, out_unit_table)
-- Return true, item where item = wikitext of the conversion result
-- for a single output (which is not a combination or a multiple);
-- or return false, t where t is an error message table.
if parms.opt_order_out and in_unit_table.unitcode == out_unit_table.unitcode then
out_unit_table.valinfo = in_unit_table.valinfo
else
out_unit_table.valinfo = collection()
for _, v in ipairs(in_unit_table.valinfo) do
local success, info = cvtround(parms, v, in_unit_table, out_unit_table)
if not success then return false, info end
out_unit_table.valinfo:add(info)
end
end
return true, process_one_output(parms, out_unit_table)
end
local function make_output_multiple(parms, in_unit_table, out_unit_table)
-- Return true, item where item = wikitext of the conversion result
-- for an output which is a multiple (like 'ftin');
-- or return false, t where t is an error message table.
local inout = out_unit_table.inout -- normally 'out' but can be 'in' for order=out
local multiple = out_unit_table.multiple -- table of scaling factors (will not be nil)
local combos = out_unit_table.combination -- table of unit tables (will not be nil)
local abbr = parms.abbr
local abbr_org = parms.abbr_org
local disp = parms.disp
local want_name = (abbr_org == nil and (disp == 'or' or disp == 'slash')) or
not (abbr == 'on' or abbr == inout or abbr == 'mos')
local want_link = (parms.lk == 'on' or parms.lk == inout)
local mid = parms.opt_flip and parms.mid or ''
local sep1 = ' '
local sep2 = ' '
if parms.opt_adjectival and want_name then
sep1 = '-'
sep2 = '-'
end
local do_spell = parms.opt_spell_out
parms.opt_spell_out = nil -- so the call to cvtround does not spell the value
local function make_result(info, isfirst)
local fmt, outvalue, sign
local results = {}
for i = 1, #combos do
local tfrac, thisvalue, strforce
local out_current = combos[i]
out_current.inout = inout
local scale = multiple[i]
if i == 1 then -- least significant unit ('in' from 'ftin')
local decimals
out_current.frac = out_unit_table.frac
local success, outinfo = cvtround(parms, info, in_unit_table, out_current)
if not success then return false, outinfo end
if isfirst then
out_unit_table.valinfo = { outinfo } -- in case output value of first least significant unit is needed
end
sign = outinfo.sign
tfrac = outinfo.fraction_table
if outinfo.is_scientific then
strforce = outinfo.show
decimals = ''
elseif tfrac then
decimals = ''
else
local show = outinfo.show -- number as a string in local language
local p1, p2 = show:find(numdot, 1, true)
decimals = p1 and show:sub(p2 + 1) or '' -- text after numdot, if any
end
fmt = '%.' .. ulen(decimals) .. 'f' -- to reproduce precision
if decimals == '' then
if tfrac then
outvalue = floor(outinfo.raw_absvalue) -- integer part only; fraction added later
else
outvalue = floor(outinfo.raw_absvalue + 0.5) -- keep all integer digits of least significant unit
end
else
outvalue = outinfo.absvalue
end
end
if scale then
outvalue, thisvalue = divide(outvalue, scale)
else
thisvalue = outvalue
end
local id
if want_name then
if varname then
local clean
if strforce or tfrac then
clean = '.1' -- dummy value to force name for floating point
else
clean = format(fmt, thisvalue)
end
id = variable_name(clean, out_current)
else
local key = 'name2'
if parms.opt_adjectival then
key = 'name1'
elseif tfrac then
if thisvalue == 0 then
key = 'name1'
end
elseif parms.opt_singular then
if 0 < thisvalue and thisvalue < 1.0001 then
key = 'name1'
end
else
if thisvalue == 1 then
key = 'name1'
end
end
id = out_current[key]
end
else
id = out_current['symbol']
end
if i == 1 and omit_separator(id) then
-- Testing the id of the least significant unit should be sufficient.
sep1 = ''
sep2 = ''
end
if want_link then
local link = out_current.link
if link then
id = make_link(link, id, out_current)
end
end
local strval
local spell_inout = (i == #combos or outvalue == 0) and inout or '' -- trick so the last value processed (first displayed) has uppercase, if requested
if strforce and outvalue == 0 then
sign = '' -- any sign is in strforce
strval = strforce -- show small values in scientific notation; will only use least significant unit
elseif tfrac then
local wholestr = (thisvalue > 0) and tostring(thisvalue) or nil
strval = format_fraction(parms, spell_inout, false, wholestr, tfrac.numstr, tfrac.denstr, do_spell)
else
strval = (thisvalue == 0) and from_en('0') or with_separator(parms, format(fmt, thisvalue))
if do_spell then
strval = spell_number(parms, spell_inout, strval) or strval
end
end
table.insert(results, strval .. sep1 .. id)
if outvalue == 0 then
break
end
fmt = '%.0f' -- only least significant unit can have a non-integral value
end
local reversed, count = {}, #results
for i = 1, count do
reversed[i] = results[count + 1 - i]
end
return true, sign .. table.concat(reversed, sep2)
end
local valinfo = in_unit_table.valinfo
local success, result = make_result(valinfo[1], true)
if not success then return false, result end
local range = parms.range
if range then
for i = 1, range.n do
local success, result2 = make_result(valinfo[i+1])
if not success then return false, result2 end
result = range_text(range[i], want_name, parms, result, result2, inout, {spaced=true})
end
end
return true, result .. mid
end
local function process(parms, in_unit_table, out_unit_table)
-- Return true, s, outunit where s = final wikitext result,
-- or return false, t where t is an error message table.
linked_pages = {}
local success, bad_output
local bad_input_mcode = in_unit_table.bad_mcode -- nil if input unit is a valid convert unit
local out_unit = parms.out_unit
if out_unit == nil or out_unit == '' or type(out_unit) == 'function' then
-- out_unit can be set to a function by adjustparameters in Module:Convert/wikidata.
if bad_input_mcode or parms.opt_input_unit_only then
bad_output = ''
else
local getdef = type(out_unit) == 'function' and out_unit or get_default
success, out_unit = getdef(in_unit_table.valinfo[1].value, in_unit_table)
parms.out_unit = out_unit
if not success then
bad_output = out_unit
end
end
end
if not bad_output and not out_unit_table then
success, out_unit_table = lookup(parms, out_unit, 'any_combination')
if success then
local mismatch = check_mismatch(in_unit_table, out_unit_table)
if mismatch then
bad_output = mismatch
end
else
bad_output = out_unit_table
end
end
local lhs, rhs
local flipped = parms.opt_flip and not bad_input_mcode
if bad_output then
rhs = (bad_output == '') and '' or message(parms, bad_output)
elseif parms.opt_input_unit_only then
rhs = ''
else
local combos -- nil (for 'ft' or 'ftin'), or table of unit tables (for 'm ft')
if not out_unit_table.multiple then -- nil/false ('ft' or 'm ft'), or table of factors ('ftin')
combos = out_unit_table.combination
end
local frac = parms.frac -- nil or denominator of fraction for output values
if frac then
-- Apply fraction to the unit (if only one), or to non-SI units (if a combination),
-- except that if a precision is also specified, the fraction only applies to
-- the hand unit; that allows the following result:
-- {{convert|156|cm|in hand|1|frac=2}} → 156 centimetres (61.4 in; 15.1½ hands)
-- However, the following is handled elsewhere as a special case:
-- {{convert|156|cm|hand in|1|frac=2}} → 156 centimetres (15.1½ hands; 61½ in)
if combos then
local precision = parms.precision
for _, unit in ipairs(combos) do
if unit.builtin == 'hand' or (not precision and not unit.prefixes) then
unit.frac = frac
end
end
else
out_unit_table.frac = frac
end
end
local outputs = {}
local imax = combos and #combos or 1 -- 1 (single unit) or number of unit tables
if imax == 1 then
parms.opt_order_out = nil -- only useful with an output combination
end
if not flipped and not parms.opt_order_out then
-- Process left side first so any duplicate links (from lk=on) are suppressed
-- on right. Example: {{convert|28|e9pc|e9ly|abbr=off|lk=on}}
lhs = process_input(parms, in_unit_table)
end
for i = 1, imax do
local success, item
local out_current = combos and combos[i] or out_unit_table
out_current.inout = 'out'
if i == 1 then
if imax > 1 and out_current.builtin == 'hand' then
out_current.out_next = combos[2] -- built-in hand can influence next unit in a combination
end
if parms.opt_order_out then
out_current.inout = 'in'
end
end
if out_current.multiple then
success, item = make_output_multiple(parms, in_unit_table, out_current)
else
success, item = make_output_single(parms, in_unit_table, out_current)
end
if not success then return false, item end
outputs[i] = item
end
if parms.opt_order_out then
lhs = outputs[1]
table.remove(outputs, 1)
end
local sep = parms.table_joins and parms.table_joins[2] or parms.join_between
rhs = table.concat(outputs, sep)
end
if flipped or not lhs then
local input = process_input(parms, in_unit_table)
if flipped then
lhs = rhs
rhs = input
else
lhs = input
end
end
if parms.join_before then
lhs = parms.join_before .. lhs
end
local wikitext
if bad_input_mcode then
if bad_input_mcode == '' then
wikitext = lhs
else
wikitext = lhs .. message(parms, bad_input_mcode)
end
elseif parms.table_joins then
wikitext = parms.table_joins[1] .. lhs .. parms.table_joins[2] .. rhs
else
wikitext = lhs .. parms.joins[1] .. rhs .. parms.joins[2]
end
if parms.warnings and not bad_input_mcode then
wikitext = wikitext .. parms.warnings
end
return true, get_styles(parms) .. wikitext, out_unit_table
end
local function _main_convert(confArgs, parmsArgs, frame)
-- Do convert, and if needed, do it again with higher default precision.
local parms = { frame = frame or mw.getCurrentFrame() } -- will hold template arguments, after translation
set_config(confArgs)
local success, result = get_parms(parms, parmsArgs)
if success then
if type(result) ~= 'table' then
return tostring(result)
end
local in_unit_table = result
local out_unit_table
for _ = 1, 2 do -- use counter so cannot get stuck repeating convert
success, result, out_unit_table = process(parms, in_unit_table, out_unit_table)
if success and parms.do_convert_again then
parms.do_convert_again = false
else
break
end
end
end
-- If input=x gives a problem, the result should be just the user input
-- (if x is a property like P123 it has been replaced with '').
-- An unknown input unit would display the input and an error message
-- with success == true at this point.
-- Also, can have success == false with a message that outputs an empty string.
if parms.input_text then
if success and not parms.have_problem then
return result
end
local cat
if parms.tracking then
-- Add a tracking category using the given text as the category sort key.
-- There is currently only one type of tracking, but in principle multiple
-- items could be tracked, using different sort keys for convenience.
cat = wanted_category('tracking', parms.tracking)
end
return parms.input_text .. (cat or '')
end
if parms.error_text then
if success and not parms.have_problem then
return result
end
return parms.error_text
end
return success and result or message(parms, result)
end
local function main_convert(frame)
return _main_convert(frame.args, frame:getParent().args, frame)
end
local function _unit(unitcode, options)
-- Helper function for Module:Val to look up a unit.
-- Parameter unitcode must be a string to identify the wanted unit.
-- Parameter options must be nil or a table with optional fields:
-- value = number (for sort key; default value is 1)
-- scaled_top = nil for a normal unit, or a number for a unit which is
-- the denominator of a per unit (for sort key)
-- si = { 'symbol', 'link' }
-- (a table with two strings) to make an SI unit
-- that will be used for the look up
-- link = true if result should be [[linked]]
-- sort = 'on' or 'debug' if result should include a sort key in a
-- span element ('debug' makes the key visible)
-- name = true for the name of the unit instead of the symbol
-- us = true for the US spelling of the unit, if any
-- Return nil if unitcode is not a non-empty string.
-- Otherwise return a table with fields:
-- text = requested symbol or name of unit, optionally linked
-- scaled_value = input value adjusted by unit scale; used for sort key
-- sortspan = span element with sort key like that provided by {{ntsh}},
-- calculated from the result of converting value
-- to a base unit with scale 1.
-- unknown = true if the unitcode was not known
unitcode = strip(unitcode)
if unitcode == nil or unitcode == '' then
return nil
end
set_config({})
linked_pages = {}
options = options or {}
local parms = {
abbr = options.name and 'off' or 'on',
lk = options.link and 'on' or nil,
opt_sp_us = options.us and true or nil,
opt_ignore_error = true,
opt_no_extra = true, -- do not add pages using this function to 'what links here' for Module:Convert/extra
opt_sortable_on = options.sort == 'on' or options.sort == 'debug',
opt_sortable_debug = options.sort == 'debug',
}
if options.si then
-- Make a dummy table of units (just one unit) for lookup to use.
-- This makes lookup recognize any SI prefix in the unitcode.
local symbol = options.si[1] or '?'
parms.unittable = { [symbol] = {
_name1 = symbol,
_name2 = symbol,
_symbol = symbol,
utype = symbol,
scale = symbol == 'g' and 0.001 or 1,
prefixes = 1,
default = symbol,
link = options.si[2],
}}
end
local success, unit_table = lookup(parms, unitcode, 'no_combination')
if not success then
unit_table = setmetatable({
symbol = unitcode, name2 = unitcode, utype = unitcode,
scale = 1, default = '', defkey = '', linkey = '' }, unit_mt)
end
local value = tonumber(options.value) or 1
local clean = tostring(abs(value))
local info = {
value = value,
altvalue = value,
singular = (clean == '1'),
clean = clean,
show = clean,
}
unit_table.inout = 'in'
unit_table.valinfo = { info }
local sortspan, scaled_value
if options.sort then
sortspan, scaled_value = make_table_or_sort(parms, value, info, unit_table, options.scaled_top)
end
return {
text = make_id(parms, 1, unit_table),
sortspan = sortspan,
scaled_value = scaled_value,
unknown = not success and true or nil,
}
end
return { convert = main_convert, _convert = _main_convert, _unit = _unit }
r4djqnuzbxaut805hk89ncew56hajfu
Модул:Hatnote
828
1324
21919
2025-03-18T15:47:33Z
Ahecht
2748
Revert
21919
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote --
-- --
-- This module produces hatnote links and links to related articles. It --
-- implements the {{hatnote}} and {{format link}} meta-templates and includes --
-- helper functions for other Lua hatnote modules. --
--------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg
local mArguments -- lazily initialise [[Module:Arguments]]
local yesno -- lazily initialise [[Module:Yesno]]
local formatLink -- lazily initialise [[Module:Format link]] ._formatLink
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getArgs(frame)
-- Fetches the arguments from the parent frame. Whitespace is trimmed and
-- blanks are removed.
mArguments = require('Module:Arguments')
return mArguments.getArgs(frame, {parentOnly = true})
end
local function removeInitialColon(s)
-- Removes the initial colon from a string, if present.
return s:match('^:?(.*)')
end
function p.defaultClasses(inline)
-- Provides the default hatnote classes as a space-separated string; useful
-- for hatnote-manipulation modules like [[Module:Hatnote group]].
return
(inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' ..
'navigation-not-searchable'
end
function p.disambiguate(page, disambiguator)
-- Formats a page title with a disambiguation parenthetical,
-- i.e. "Example" → "Example (disambiguation)".
checkType('disambiguate', 1, page, 'string')
checkType('disambiguate', 2, disambiguator, 'string', true)
disambiguator = disambiguator or 'disambiguation'
return mw.ustring.format('%s (%s)', page, disambiguator)
end
function p.findNamespaceId(link, removeColon)
-- Finds the namespace id (namespace number) of a link or a pagename. This
-- function will not work if the link is enclosed in double brackets. Colons
-- are trimmed from the start of the link by default. To skip colon
-- trimming, set the removeColon parameter to false.
checkType('findNamespaceId', 1, link, 'string')
checkType('findNamespaceId', 2, removeColon, 'boolean', true)
if removeColon ~= false then
link = removeInitialColon(link)
end
local namespace = link:match('^(.-):')
if namespace then
local nsTable = mw.site.namespaces[namespace]
if nsTable then
return nsTable.id
end
end
return 0
end
function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)
-- Formats an error message to be returned to wikitext. If
-- addTrackingCategory is not false after being returned from
-- [[Module:Yesno]], and if we are not on a talk page, a tracking category
-- is added.
checkType('makeWikitextError', 1, msg, 'string')
checkType('makeWikitextError', 2, helpLink, 'string', true)
yesno = require('Module:Yesno')
title = title or mw.title.getCurrentTitle()
-- Make the help link text.
local helpText
if helpLink then
helpText = ' ([[' .. helpLink .. '|help]])'
else
helpText = ''
end
-- Make the category text.
local category
if not title.isTalkPage -- Don't categorise talk pages
and title.namespace ~= 2 -- Don't categorise userspace
and yesno(addTrackingCategory) ~= false -- Allow opting out
then
category = 'Hatnote templates with errors'
category = mw.ustring.format(
'[[%s:%s]]',
mw.site.namespaces[14].name,
category
)
else
category = ''
end
return mw.ustring.format(
'<strong class="error">Error: %s%s.</strong>%s',
msg,
helpText,
category
)
end
local curNs = mw.title.getCurrentTitle().namespace
p.missingTargetCat =
--Default missing target category, exported for use in related modules
((curNs == 0) or (curNs == 14)) and
'Articles with hatnote templates targeting a nonexistent page' or nil
function p.quote(title)
--Wraps titles in quotation marks. If the title starts/ends with a quotation
--mark, kerns that side as with {{-'}}
local quotationMarks = {
["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true
}
local quoteLeft, quoteRight = -- Test if start/end are quotation marks
quotationMarks[string.sub(title, 1, 1)],
quotationMarks[string.sub(title, -1, -1)]
if quoteLeft or quoteRight then
title = mw.html.create("span"):wikitext(title)
end
if quoteLeft then title:css("padding-left", "0.15em") end
if quoteRight then title:css("padding-right", "0.15em") end
return '"' .. tostring(title) .. '"'
end
--------------------------------------------------------------------------------
-- Hatnote
--
-- Produces standard hatnote text. Implements the {{hatnote}} template.
--------------------------------------------------------------------------------
p[''] = function (frame) return p.hatnote(frame:newChild{ title = "Template:Hatnote" }) end
function p.hatnote(frame)
local args = getArgs(frame)
local s = args[1]
if not s then
return p.makeWikitextError(
'no text specified',
'Template:Hatnote#Errors',
args.category
)
end
return p._hatnote(s, {
extraclasses = args.extraclasses,
selfref = args.selfref
})
end
function p._hatnote(s, options)
checkType('_hatnote', 1, s, 'string')
checkType('_hatnote', 2, options, 'table', true)
options = options or {}
local inline = options.inline
local hatnote = mw.html.create(inline == 1 and 'span' or 'div')
local extraclasses
if type(options.extraclasses) == 'string' then
extraclasses = options.extraclasses
end
hatnote
:attr('role', 'note')
:addClass(p.defaultClasses(inline))
:addClass(extraclasses)
:addClass(options.selfref and 'selfref' or nil)
:wikitext(s)
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }
} .. tostring(hatnote)
end
return p
qps4k9ys6ba1dq9msz6m6lq3kfc4w6t
21920
10315
2026-09-18T15:14:50Z
Amire80
9
1 измена увезена из [[:en:Module:Hatnote]]: importing from the English Wikipedia
10315
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote --
-- --
-- This module produces hatnote links and links to related articles. It --
-- implements the {{hatnote}} and {{format link}} meta-templates and includes --
-- helper functions for other Lua hatnote modules. --
--------------------------------------------------------------------------------
local libraryUtil = require('libraryUtil')
local checkType = libraryUtil.checkType
local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg
local mArguments -- lazily initialise [[Module:Arguments]]
local yesno -- lazily initialise [[Module:Yesno]]
local formatLink -- lazily initialise [[Module:Format link]] ._formatLink
local p = {}
--------------------------------------------------------------------------------
-- Helper functions
--------------------------------------------------------------------------------
local function getArgs(frame)
-- Fetches the arguments from the parent frame. Whitespace is trimmed and
-- blanks are removed.
mArguments = require('Module:Arguments')
return mArguments.getArgs(frame, {parentOnly = true})
end
local function removeInitialColon(s)
-- Removes the initial colon from a string, if present.
return s:match('^:?(.*)')
end
function p.defaultClasses(inline)
-- Provides the default hatnote classes as a space-separated string; useful
-- for hatnote-manipulation modules like [[Module:Hatnote group]].
return
(inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' ..
'navigation-not-searchable'
end
function p.disambiguate(page, disambiguator)
-- Formats a page title with a disambiguation parenthetical,
-- i.e. "Example" → "Example (disambiguation)".
checkType('disambiguate', 1, page, 'string')
checkType('disambiguate', 2, disambiguator, 'string', true)
disambiguator = disambiguator or 'вишезначна одредница'
return mw.ustring.format('%s (%s)', page, disambiguator)
end
function p.findNamespaceId(link, removeColon)
-- Finds the namespace id (namespace number) of a link or a pagename. This
-- function will not work if the link is enclosed in double brackets. Colons
-- are trimmed from the start of the link by default. To skip colon
-- trimming, set the removeColon parameter to false.
checkType('findNamespaceId', 1, link, 'string')
checkType('findNamespaceId', 2, removeColon, 'boolean', true)
if removeColon ~= false then
link = removeInitialColon(link)
end
local namespace = link:match('^(.-):')
if namespace then
local nsTable = mw.site.namespaces[namespace]
if nsTable then
return nsTable.id
end
end
return 0
end
function p.makeWikitextError(msg, helpLink, addTrackingCategory, title)
-- Formats an error message to be returned to wikitext. If
-- addTrackingCategory is not false after being returned from
-- [[Module:Yesno]], and if we are not on a talk page, a tracking category
-- is added.
checkType('makeWikitextError', 1, msg, 'string')
checkType('makeWikitextError', 2, helpLink, 'string', true)
yesno = require('Module:Yesno')
title = title or mw.title.getCurrentTitle()
-- Make the help link text.
local helpText
if helpLink then
helpText = ' ([[' .. helpLink .. '|помоћ]])'
else
helpText = ''
end
-- Make the category text.
local category
if not title.isTalkPage -- Don't categorise talk pages
and title.namespace ~= 2 -- Don't categorise userspace
and yesno(addTrackingCategory) ~= false -- Allow opting out
then
category = 'Шаблони за горње напомене с грешкама'
category = mw.ustring.format(
'[[%s:%s]]',
mw.site.namespaces[14].name,
category
)
else
category = ''
end
return mw.ustring.format(
'<strong class="error">Грешка: %s%s.</strong>%s',
msg,
helpText,
category
)
end
local curNs = mw.title.getCurrentTitle().namespace
p.missingTargetCat =
--Default missing target category, exported for use in related modules
((curNs == 0) or (curNs == 14)) and
'Чланци са шаблонима хутнота који циљају непостојећу страницу' or nil
function p.quote(title)
--Wraps titles in quotation marks. If the title starts/ends with a quotation
--mark, kerns that side as with {{-'}}
local quotationMarks = {
["’"]=true, ['’']=true, ['„']=true, ["’"]=true, ['”']=true, ["’"]=true
}
local quoteLeft, quoteRight = -- Test if start/end are quotation marks
quotationMarks[string.sub(title, 1, 1)],
quotationMarks[string.sub(title, -1, -1)]
if quoteLeft or quoteRight then
title = mw.html.create("span"):wikitext(title)
end
if quoteLeft then title:css("padding-left", "0.15em") end
if quoteRight then title:css("padding-right", "0.15em") end
return '"' .. tostring(title) .. '"'
end
--------------------------------------------------------------------------------
-- Hatnote
--
-- Produces standard hatnote text. Implements the {{hatnote}} template.
--------------------------------------------------------------------------------
function p.hatnote(frame)
local args = getArgs(frame)
local s = args[1]
if not s then
return p.makeWikitextError(
'Нисте навели текст',
'Шаблон:Хутнота#Грешке',
args.category
)
end
return p._hatnote(s, {
extraclasses = args.extraclasses,
selfref = args.selfref
})
end
function p._hatnote(s, options)
checkType('_hatnote', 1, s, 'string')
checkType('_hatnote', 2, options, 'table', true)
options = options or {}
local inline = options.inline
local hatnote = mw.html.create(inline == 1 and 'span' or 'div')
local extraclasses
if type(options.extraclasses) == 'string' then
extraclasses = options.extraclasses
end
hatnote
:attr('role', 'note')
:addClass(p.defaultClasses(inline))
:addClass(extraclasses)
:addClass(options.selfref and 'selfref' or nil)
:wikitext(s)
return mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' }
} .. tostring(hatnote)
end
return p
m0dw6cbaeuwqwt7bqnek7wvbdd0g9i4
Модул:Hatnote/styles.css
828
1328
21921
10320
2026-08-09T16:48:05Z
Izno
2749
Parsoid is now the one true parser
21921
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
21922
21921
2026-09-18T15:14:50Z
Amire80
9
1 измена увезена из [[:en:Module:Hatnote/styles.css]]: importing from the English Wikipedia
21921
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
Модул:Location map
828
1462
21835
10653
2026-08-06T02:42:13Z
Hike395
2761
let pushpin_* parameters to infoboxes override arguments specified in template code
21835
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local function round(n, decimals)
local pow = 10^(decimals or 0)
return math.floor(n * pow + 0.5) / pow
end
function p.getMapParams(map, frame)
if not map then
error('The name of the location map definition to use must be specified', 2)
end
local moduletitle = mw.title.new('Module:Location map/data/' .. map)
if not moduletitle then
error(string.format('%q is not a valid name for a location map definition', map), 2)
elseif moduletitle.exists then
local mapData = mw.loadData('Module:Location map/data/' .. map)
return function(name, params)
if name == nil then
return 'Module:Location map/data/' .. map
elseif mapData[name] == nil then
return ''
elseif params then
return mw.message.newRawMessage(tostring(mapData[name]), unpack(params)):plain()
else
return mapData[name]
end
end
else
error('Unable to find the specified location map definition: "Module:Location map/data/' .. map .. '" does not exist', 2)
end
end
function p.data(frame, args, map)
if not args then
args = getArgs(frame, {frameOnly = true})
end
if not map then
map = p.getMapParams(args[1], frame)
end
local params = {}
for k,v in ipairs(args) do
if k > 2 then
params[k-2] = v
end
end
return map(args[2], #params ~= 0 and params)
end
local hemisphereMultipliers = {
longitude = { W = -1, w = -1, E = 1, e = 1 },
latitude = { S = -1, s = -1, N = 1, n = 1 }
}
local function decdeg(degrees, minutes, seconds, hemisphere, decimal, direction)
if decimal then
if degrees then
error('Decimal and DMS degrees cannot both be provided for ' .. direction, 2)
elseif minutes then
error('Minutes can only be provided with DMS degrees for ' .. direction, 2)
elseif seconds then
error('Seconds can only be provided with DMS degrees for ' .. direction, 2)
elseif hemisphere then
error('A hemisphere can only be provided with DMS degrees for ' .. direction, 2)
end
local retval = tonumber(decimal)
if retval then
return retval
end
error('The value "' .. decimal .. '" provided for ' .. direction .. ' is not valid', 2)
elseif seconds and not minutes then
error('Seconds were provided for ' .. direction .. ' without minutes also being provided', 2)
elseif not degrees then
if minutes then
error('Minutes were provided for ' .. direction .. ' without degrees also being provided', 2)
elseif hemisphere then
error('A hemisphere was provided for ' .. direction .. ' without degrees also being provided', 2)
end
return nil
end
decimal = tonumber(degrees)
if not decimal then
error('The degree value "' .. degrees .. '" provided for ' .. direction .. ' is not valid', 2)
elseif minutes and not tonumber(minutes) then
error('The minute value "' .. minutes .. '" provided for ' .. direction .. ' is not valid', 2)
elseif seconds and not tonumber(seconds) then
error('The second value "' .. seconds .. '" provided for ' .. direction .. ' is not valid', 2)
end
decimal = decimal + (minutes or 0)/60 + (seconds or 0)/3600
if hemisphere then
local multiplier = hemisphereMultipliers[direction][hemisphere]
if not multiplier then
error('The hemisphere "' .. hemisphere .. '" provided for ' .. direction .. ' is not valid', 2)
end
decimal = decimal * multiplier
end
return decimal
end
-- Finds a parameter in a transclusion of {{Coord}}.
local function coord2text(para,coord) -- this should be changed for languages which do not use Arabic numerals or the degree sign
local lat, long = mw.ustring.match(coord,'<span class="p%-latitude latitude">([^<]+)</span><span class="p%-longitude longitude">([^<]+)</span>')
if lat then
return tonumber(para == 'longitude' and long or lat)
end
local result = mw.text.split(mw.ustring.match(coord,'%-?[%.%d]+°[NS] %-?[%.%d]+°[EW]') or '', '[ °]')
if para == 'longitude' then result = {result[3], result[4]} end
if not tonumber(result[1]) or not result[2] then
mw.log('Malformed coordinates value')
mw.logObject(para, 'para')
mw.logObject(coord, 'coord')
return error('Malformed coordinates value', 2)
end
return tonumber(result[1]) * hemisphereMultipliers[para][result[2]]
end
-- effectively make removeBlanks false for caption and maplink, and true for everything else
-- if useWikidata is present but blank, convert it to false instead of nil
-- p.top, p.bottom, and their callers need to use this
function p.valueFunc(key, value)
if value then
value = mw.text.trim(value)
end
if value ~= '' or key == 'caption' or key == 'maplink' then
return value
elseif key == 'useWikidata' then
return false
end
end
local function getContainerImage(args, map)
if args.AlternativeMap then
return args.AlternativeMap
elseif args.relief then
local digits = mw.ustring.match(args.relief,'^[1-9][0-9]?$') -- image1 to image99
if digits then
local imageDigits = map('image' .. digits)
if imageDigits ~= '' then return imageDigits end
end
local yesNo = require('Module:Yesno')
if yesNo(args.relief,true) then
local image1 = map('image1')
if image1 ~= '' then return image1 end
end
end
return map('image')
end
function p.top(frame, args, map)
if not args then
args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc})
end
if not map then
map = p.getMapParams(args[1], frame)
end
local width
local default_as_number = tonumber(mw.ustring.match(tostring(args.default_width),"%d*"))
if not args.width then
width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))
elseif mw.ustring.sub(args.width, -2) == 'px' then
width = mw.ustring.sub(args.width, 1, -3)
else
width = args.width
end
local width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0;
if width_as_number == 0 then
-- check to see if width is junk. If it is, then use default calculation
width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))
width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0;
end
if args.max_width ~= "" and args.max_width ~= nil then
-- check to see if width bigger than max_width
local max_as_number = tonumber(mw.ustring.match(args.max_width,"%d*")) or 0;
if width_as_number>max_as_number and max_as_number>0 then
width = args.max_width;
end
end
local retval = frame:extensionTag{name = 'templatestyles', args = {src = 'Module:Location map/styles.css'}}
if args.float == 'center' then
retval = retval .. '<div class="center">'
end
if args.caption and args.caption ~= '' and args.border ~= 'infobox' then
retval = retval .. '<div class="locmap noresize thumb '
if args.float == '"left"' or args.float == 'left' then
retval = retval .. 'floatleft'
elseif args.float == '"center"' or args.float == 'center' or args.float == '"none"' or args.float == 'none' then
retval = retval .. 'tnone'
else
retval = retval .. 'floatright'
end
retval = retval .. '"><div class="thumbinner" style="width:' .. (width + 2) .. 'px'
if args.border == 'none' then
retval = retval .. ';border:none'
elseif args.border then
retval = retval .. ';border-color:' .. args.border
end
retval = retval .. '"><div style="position:relative;width:' .. width .. 'px' .. (args.border ~= 'none' and ';border:1px solid lightgray">' or '">')
else
retval = retval .. '<div class="locmap" style="width:' .. width .. 'px;'
if args.float == '"left"' or args.float == 'left' then
retval = retval .. 'float:left;clear:left'
elseif args.float == '"center"' or args.float == 'center' then
retval = retval .. 'float:none;clear:both;margin-left:auto;margin-right:auto'
elseif args.float == '"none"' or args.float == 'none' then
retval = retval .. 'float:none;clear:none'
else
retval = retval .. 'float:right;clear:right'
end
retval = retval .. '"><div style="width:' .. width .. 'px;padding:0"><div style="position:relative;width:' .. width .. 'px">'
end
local image = getContainerImage(args, map)
local currentTitle = mw.title.getCurrentTitle()
retval = string.format(
'%s[[File:%s|%spx|%s%s|class=notpageimage noviewer]]',
retval,
image,
width,
args.alt or ((args.label or currentTitle.text) .. ' is located in ' .. map('name')),
args.maplink and ('|link=' .. args.maplink) or ''
)
if args.caption and args.caption ~= '' then
if (currentTitle.namespace == 0) and mw.ustring.find(args.caption, '##') then
retval = retval .. '[[Category:Pages using location map with a double number sign in the caption]]'
end
end
if args.overlay_image then
return retval .. '<div style="position:absolute;top:0;left:0">[[File:' .. args.overlay_image .. '|' .. width .. 'px|class=notpageimage noviewer]]</div>'
else
return retval
end
end
function p.bottom(frame, args, map)
if not args then
args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc})
end
if not map then
map = p.getMapParams(args[1], frame)
end
local retval = '</div>'
local currentTitle = mw.title.getCurrentTitle()
if not args.caption or args.border == 'infobox' then
if args.border then
retval = retval .. '<div style="padding-top:0.2em">'
else
retval = retval .. '<div style="font-size:91%;padding-top:3px">'
end
retval = retval
.. (args.caption or (args.label or currentTitle.text) .. ' (' .. map('name') .. ')')
.. '</div>'
elseif args.caption ~= '' then
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '| ]]</div>' .. args.caption .. '</div>'
end
if args.switcherLabel then
retval = retval .. '<span class="switcher-label" style="display:none">' .. args.switcherLabel .. '</span>'
elseif args.autoSwitcherLabel then
retval = retval .. '<span class="switcher-label" style="display:none">Show map of ' .. map('name') .. '</span>'
end
retval = retval .. '</div></div>'
if args.caption_undefined then
mw.log('Removed parameter caption_undefined used.')
local parent = frame:getParent()
if parent then
mw.log('Parent is ' .. parent:getTitle())
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
retval = retval .. '[[Category:Location maps with removed parameters|caption_undefined]]'
end
end
if map('skew') ~= '' or map('lat_skew') ~= '' or map('crosses180') ~= '' or map('type') ~= '' then
mw.log('Removed parameter used in map definition ' .. map())
if currentTitle.namespace == 0 then
local key = (map('skew') ~= '' and 'skew' or '') ..
(map('lat_skew') ~= '' and 'lat_skew' or '') ..
(map('crosses180') ~= '' and 'crosses180' or '') ..
(map('type') ~= '' and 'type' or '')
retval = retval .. '[[Category:Location maps with removed parameters|' .. key .. ' ]]'
end
end
if string.find(map('name'), '|', 1, true) then
mw.log('Pipe used in name of map definition ' .. map())
if currentTitle.namespace == 0 then
retval = retval .. '[[Category:Location maps with a name containing a pipe]]'
end
end
if args.float == 'center' then
retval = retval .. '</div>'
end
return retval
end
local function markOuterDiv(x, y, imageDiv, labelDiv, label_size)
return mw.html.create('div')
:addClass('od')
:addClass('notheme') -- T236137
:cssText('top:' .. round(y, 3) .. '%;left:' .. round(x, 3) .. '%;font-size:' .. label_size .. '%')
:node(imageDiv)
:node(labelDiv)
end
local function markImageDiv(mark, marksize, label, link, alt, title)
local builder = mw.html.create('div')
:addClass('id')
:cssText('left:-' .. round(marksize / 2) .. 'px;top:-' .. round(marksize / 2) .. 'px')
:attr('title', title)
if marksize ~= 0 then
builder:wikitext(string.format(
'[[File:%s|%dx%dpx|%s|link=%s%s|class=notpageimage noviewer]]',
mark,
marksize,
marksize,
label,
link,
alt and ('|alt=' .. alt) or ''
))
end
return builder
end
local function markLabelDiv(label, label_size, label_width, position, background, x, marksize)
if tonumber(label_size) == 0 then
return mw.html.create('div'):addClass('l0'):wikitext(label)
end
local builder = mw.html.create('div')
:cssText('width:' .. label_width .. 'em')
local distance = round(marksize / 2 + 1)
if position == 'top' then -- specified top
builder:addClass('pv'):cssText('bottom:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em')
elseif position == 'bottom' then -- specified bottom
builder:addClass('pv'):cssText('top:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em')
elseif position == 'left' or (tonumber(x) > 70 and position ~= 'right') then -- specified left or autodetected to left
builder:addClass('pl'):cssText('right:' .. distance .. 'px')
else -- specified right or autodetected to right
builder:addClass('pr'):cssText('left:' .. distance .. 'px')
end
builder = builder:tag('div')
:wikitext(label)
if background then
builder:cssText('background-color:' .. background)
end
return builder:done()
end
local function getX(longitude, left, right)
local width = (right - left) % 360
if width == 0 then
width = 360
end
local distanceFromLeft = (longitude - left) % 360
-- the distance needed past the map to the right equals distanceFromLeft - width. the distance needed past the map to the left equals 360 - distanceFromLeft. to minimize page stretching, go whichever way is shorter
if distanceFromLeft - width / 2 >= 180 then
distanceFromLeft = distanceFromLeft - 360
end
return 100 * distanceFromLeft / width
end
local function getY(latitude, top, bottom)
return 100 * (top - latitude) / (top - bottom)
end
function p.mark(frame, args, map)
if not args then
args = getArgs(frame, {wrappers = 'Template:Location map~'})
end
local mapnames = {}
if not map then
if args[1] then
map = {}
for mapname in mw.text.gsplit(args[1], '#', true) do
map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame)
mapnames[#mapnames + 1] = mapname
end
if #map == 1 then map = map[1] end
else
map = p.getMapParams('World', frame)
args[1] = 'World'
end
end
if type(map) == 'table' then
local outputs = {}
local oldargs = args[1]
for k,v in ipairs(map) do
args[1] = mapnames[k]
outputs[k] = tostring(p.mark(frame, args, v))
end
args[1] = oldargs
return table.concat(outputs, '#PlaceList#') .. '#PlaceList#'
end
local x, y, longitude, latitude
longitude = decdeg(args.lon_deg, args.lon_min, args.lon_sec, args.lon_dir, args.long, 'longitude')
latitude = decdeg(args.lat_deg, args.lat_min, args.lat_sec, args.lat_dir, args.lat, 'latitude')
if args.excludefrom then
-- If this mark is to be excluded from certain maps entirely (useful in the context of multiple maps)
for exclusionmap in mw.text.gsplit(args.excludefrom, '#', true) do
-- Check if this map is excluded. If so, return an empty string.
if args[1] == exclusionmap then
return ''
end
end
end
local builder = mw.html.create()
local currentTitle = mw.title.getCurrentTitle()
if args.coordinates then
-- Temporarily removed to facilitate infobox conversion. See [[Wikipedia:Coordinates in infoboxes]]
-- if longitude or latitude then
-- error('Coordinates from [[Module:Coordinates]] and individual coordinates cannot both be provided')
-- end
longitude = coord2text('longitude', args.coordinates)
latitude = coord2text('latitude', args.coordinates)
elseif not longitude and not latitude and args.useWikidata then
-- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't.
local entity = mw.wikibase.getEntity()
if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then
local value = entity.claims.P625[1].mainsnak.datavalue.value
longitude, latitude = value.longitude, value.latitude
end
if args.link and (currentTitle.namespace == 0) then
builder:wikitext('[[Category:Location maps with linked markers with coordinates from Wikidata]]')
end
end
if not longitude then
error('No value was provided for longitude')
elseif not latitude then
error('No value was provided for latitude')
end
if currentTitle.namespace > 0 then
if (not args.lon_deg) ~= (not args.lat_deg) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Degrees]]')
elseif (not args.lon_min) ~= (not args.lat_min) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Minutes]]')
elseif (not args.lon_sec) ~= (not args.lat_sec) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Seconds]]')
elseif (not args.lon_dir) ~= (not args.lat_dir) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Hemisphere]]')
elseif (not args.long) ~= (not args.lat) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Decimal]]')
end
end
if ((tonumber(args.lat_deg) or 0) < 0) and ((tonumber(args.lat_min) or 0) ~= 0 or (tonumber(args.lat_sec) or 0) ~= 0 or (args.lat_dir and args.lat_dir ~='')) then
builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')
end
if ((tonumber(args.lon_deg) or 0) < 0) and ((tonumber(args.lon_min) or 0) ~= 0 or (tonumber(args.lon_sec) or 0) ~= 0 or (args.lon_dir and args.lon_dir ~= '')) then
builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')
end
if (((tonumber(args.lat_min) or 0) < 0) or ((tonumber(args.lat_sec) or 0) < 0)) then
builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')
end
if (((tonumber(args.lon_min) or 0) < 0) or ((tonumber(args.lon_sec) or 0) < 0)) then
builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')
end
if args.skew or args.lon_shift or args.markhigh then
mw.log('Removed parameter used in invocation.')
local parent = frame:getParent()
if parent then
mw.log('Parent is ' .. parent:getTitle())
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
local key = (args.skew and 'skew' or '') ..
(args.lon_shift and 'lon_shift' or '') ..
(args.markhigh and 'markhigh' or '')
builder:wikitext('[[Category:Location maps with removed parameters|' .. key ..' ]]')
end
end
if map('x') ~= '' then
x = tonumber(mw.ext.ParserFunctions.expr(map('x', { latitude, longitude })))
else
x = tonumber(getX(longitude, map('left'), map('right')))
end
if map('y') ~= '' then
y = tonumber(mw.ext.ParserFunctions.expr(map('y', { latitude, longitude })))
else
y = tonumber(getY(latitude, map('top'), map('bottom')))
end
if (x < 0 or x > 100 or y < 0 or y > 100) and not args.outside then
mw.log('Mark placed outside map boundaries without outside flag set. x = ' .. x .. ', y = ' .. y)
local parent = frame:getParent()
if parent then
mw.log('Parent is ' .. parent:getTitle())
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
local key = currentTitle.prefixedText
builder:wikitext('[[Category:Location maps with marks outside map and outside parameter not set|' .. key .. ' ]]')
end
end
local mark = args.mark or map('mark')
if mark == '' then
mark = 'Red pog.svg'
end
local marksize = tonumber(args.marksize) or tonumber(map('marksize')) or 8
local imageDiv = markImageDiv(mark, marksize, args.label or mw.title.getCurrentTitle().text, args.link or '', args.alt, args[2])
local label_size = args.label_size or 91
local labelDiv
if args.label and args.position ~= 'none' then
labelDiv = markLabelDiv(args.label, label_size, args.label_width or 6, args.position, args.background, x, marksize)
end
return builder:node(markOuterDiv(x, y, imageDiv, labelDiv, label_size))
end
local function switcherSeparate(s)
if s == nil then return {} end
local retval = {}
for i in string.gmatch(s .. '#', '([^#]*)#') do
i = mw.text.trim(i)
retval[#retval + 1] = (i ~= '' and i)
end
return retval
end
function p.infobox_pushpin_map(frame)
--This function is designed to be invoked from an infobox template
--* Some parameters (generally starting with "pushpin_") are meant to be exposed as parameters
-- in the outer infobox, settable by editors
--* Others are meant to be "hidden" (e.g., only set inside the infobox template code)
-- First get the combined arguments from both parent and invocation frame
local raw_args = getArgs(frame,{parentFirst=true})
--If no map is supplied, return.
if not raw_args['pushpin_map'] then
return
end
-- Now get arguments from just the invocation frame
local frame_args = getArgs(frame,{frameOnly=true})
-- parsed_args will have the resulting merged parameters
local parsed_args = {}
-- Default to using wikidata coodinates if no other coordiantes supplied.
if raw_args.useWikidata == nil then
parsed_args.useWikidata = true
else
parsed_args.useWikidata = raw_args.useWikidata
end
-- Parse the arguments
parsed_args[1] = raw_args['pushpin_map']
parsed_args.float = frame_args.float or 'center'
parsed_args.border = frame_args.border or 'infobox'
parsed_args.default_width = frame_args.default_width
parsed_args.max_width = frame_args.max_width
parsed_args.coordinates = raw_args['coordinates']
parsed_args.caption = raw_args['pushpin_caption']
parsed_args.relief = raw_args['pushpin_relief']
parsed_args.label = raw_args['pushpin_label']
parsed_args.label_size = raw_args['pushpin_label_size']
parsed_args.position = raw_args['pushpin_label_position']
parsed_args.mark = raw_args['pushpin_mark']
parsed_args.marksize = raw_args['pushpin_mark_size']
parsed_args.alt = raw_args['pushpin_alt']
parsed_args.background = raw_args['pushpin_background']
parsed_args.width = raw_args['pushpin_map_size']
local map = {}
local caption_list = {}
for mapname in string.gmatch(parsed_args[1], '[^#]+') do
map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame)
end
if parsed_args['caption'] then
for caption in mw.text.gsplit(parsed_args['caption'], '##', true) do
caption_list[#caption_list + 1] = caption
end
end
if #map == 1 then
map = map[1]
if not parsed_args.caption then
parsed_args.caption = 'Location within ' .. map('name')
end
end
if type(map) == 'table' then
mw.log('----')
mw.logObject(map)
if #caption_list > #map then
error(string.format('%d captions were provided, but only %d maps were provided', #caption_list, #map))
elseif not parsed_args.caption then
-- Set a default caption for each of the multiple maps
for i=1, #map do
caption_list[#caption_list + 1] = 'Location within '.. map[i]('name')
end
end
local outputs = {}
parsed_args.autoSwitcherLabel = true
for k,v in ipairs(map) do
parsed_args.caption = caption_list[k]
outputs[k] = p.main(frame, parsed_args, v)
end
return '<div class="switcher-container">' .. table.concat(outputs) .. '</div>'
else
return p.top(frame, parsed_args, map) .. tostring( p.mark(frame, parsed_args, map) ) .. p.bottom(frame, parsed_args, map)
end
end
function p.main(frame, args, map)
local caption_list = {}
if not args then
args = getArgs(frame, {wrappers = 'Template:Location map', valueFunc = p.valueFunc})
end
if args.useWikidata == nil then
args.useWikidata = true
end
if not map then
if args[1] then
map = {}
for mapname in string.gmatch(args[1], '[^#]+') do
map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame)
end
if args['caption'] then
if args['caption'] == "" then
while #caption_list < #map do
caption_list[#caption_list + 1] = args['caption']
end
else
for caption in mw.text.gsplit(args['caption'], '##', true) do
caption_list[#caption_list + 1] = caption
end
end
end
if #map == 1 then map = map[1] end
else
map = p.getMapParams('World', frame)
end
end
if type(map) == 'table' then
local altmaps = switcherSeparate(args.AlternativeMap)
if #altmaps > #map then
error(string.format('%d AlternativeMaps were provided, but only %d maps were provided', #altmaps, #map))
end
local overlays = switcherSeparate(args.overlay_image)
if #overlays > #map then
error(string.format('%d overlay_images were provided, but only %d maps were provided', #overlays, #map))
end
if #caption_list > #map then
error(string.format('%d captions were provided, but only %d maps were provided', #caption_list, #map))
end
local outputs = {}
args.autoSwitcherLabel = true
for k,v in ipairs(map) do
args.AlternativeMap = altmaps[k]
args.overlay_image = overlays[k]
args.caption = caption_list[k]
outputs[k] = p.main(frame, args, v)
end
return '<div class="switcher-container">' .. table.concat(outputs) .. '</div>'
else
return p.top(frame, args, map) .. tostring( p.mark(frame, args, map) ) .. p.bottom(frame, args, map)
end
end
return p
3pqbnkg8pemwulwnvka0szt6hqc0tii
21836
21835
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Module:Location_map]]: Importing from the English wikipedia
21835
Scribunto
text/plain
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local function round(n, decimals)
local pow = 10^(decimals or 0)
return math.floor(n * pow + 0.5) / pow
end
function p.getMapParams(map, frame)
if not map then
error('The name of the location map definition to use must be specified', 2)
end
local moduletitle = mw.title.new('Module:Location map/data/' .. map)
if not moduletitle then
error(string.format('%q is not a valid name for a location map definition', map), 2)
elseif moduletitle.exists then
local mapData = mw.loadData('Module:Location map/data/' .. map)
return function(name, params)
if name == nil then
return 'Module:Location map/data/' .. map
elseif mapData[name] == nil then
return ''
elseif params then
return mw.message.newRawMessage(tostring(mapData[name]), unpack(params)):plain()
else
return mapData[name]
end
end
else
error('Unable to find the specified location map definition: "Module:Location map/data/' .. map .. '" does not exist', 2)
end
end
function p.data(frame, args, map)
if not args then
args = getArgs(frame, {frameOnly = true})
end
if not map then
map = p.getMapParams(args[1], frame)
end
local params = {}
for k,v in ipairs(args) do
if k > 2 then
params[k-2] = v
end
end
return map(args[2], #params ~= 0 and params)
end
local hemisphereMultipliers = {
longitude = { W = -1, w = -1, E = 1, e = 1 },
latitude = { S = -1, s = -1, N = 1, n = 1 }
}
local function decdeg(degrees, minutes, seconds, hemisphere, decimal, direction)
if decimal then
if degrees then
error('Decimal and DMS degrees cannot both be provided for ' .. direction, 2)
elseif minutes then
error('Minutes can only be provided with DMS degrees for ' .. direction, 2)
elseif seconds then
error('Seconds can only be provided with DMS degrees for ' .. direction, 2)
elseif hemisphere then
error('A hemisphere can only be provided with DMS degrees for ' .. direction, 2)
end
local retval = tonumber(decimal)
if retval then
return retval
end
error('The value "' .. decimal .. '" provided for ' .. direction .. ' is not valid', 2)
elseif seconds and not minutes then
error('Seconds were provided for ' .. direction .. ' without minutes also being provided', 2)
elseif not degrees then
if minutes then
error('Minutes were provided for ' .. direction .. ' without degrees also being provided', 2)
elseif hemisphere then
error('A hemisphere was provided for ' .. direction .. ' without degrees also being provided', 2)
end
return nil
end
decimal = tonumber(degrees)
if not decimal then
error('The degree value "' .. degrees .. '" provided for ' .. direction .. ' is not valid', 2)
elseif minutes and not tonumber(minutes) then
error('The minute value "' .. minutes .. '" provided for ' .. direction .. ' is not valid', 2)
elseif seconds and not tonumber(seconds) then
error('The second value "' .. seconds .. '" provided for ' .. direction .. ' is not valid', 2)
end
decimal = decimal + (minutes or 0)/60 + (seconds or 0)/3600
if hemisphere then
local multiplier = hemisphereMultipliers[direction][hemisphere]
if not multiplier then
error('The hemisphere "' .. hemisphere .. '" provided for ' .. direction .. ' is not valid', 2)
end
decimal = decimal * multiplier
end
return decimal
end
-- Finds a parameter in a transclusion of {{Coord}}.
local function coord2text(para,coord) -- this should be changed for languages which do not use Arabic numerals or the degree sign
local lat, long = mw.ustring.match(coord,'<span class="p%-latitude latitude">([^<]+)</span><span class="p%-longitude longitude">([^<]+)</span>')
if lat then
return tonumber(para == 'longitude' and long or lat)
end
local result = mw.text.split(mw.ustring.match(coord,'%-?[%.%d]+°[NS] %-?[%.%d]+°[EW]') or '', '[ °]')
if para == 'longitude' then result = {result[3], result[4]} end
if not tonumber(result[1]) or not result[2] then
mw.log('Malformed coordinates value')
mw.logObject(para, 'para')
mw.logObject(coord, 'coord')
return error('Malformed coordinates value', 2)
end
return tonumber(result[1]) * hemisphereMultipliers[para][result[2]]
end
-- effectively make removeBlanks false for caption and maplink, and true for everything else
-- if useWikidata is present but blank, convert it to false instead of nil
-- p.top, p.bottom, and their callers need to use this
function p.valueFunc(key, value)
if value then
value = mw.text.trim(value)
end
if value ~= '' or key == 'caption' or key == 'maplink' then
return value
elseif key == 'useWikidata' then
return false
end
end
local function getContainerImage(args, map)
if args.AlternativeMap then
return args.AlternativeMap
elseif args.relief then
local digits = mw.ustring.match(args.relief,'^[1-9][0-9]?$') -- image1 to image99
if digits then
local imageDigits = map('image' .. digits)
if imageDigits ~= '' then return imageDigits end
end
local yesNo = require('Module:Yesno')
if yesNo(args.relief,true) then
local image1 = map('image1')
if image1 ~= '' then return image1 end
end
end
return map('image')
end
function p.top(frame, args, map)
if not args then
args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc})
end
if not map then
map = p.getMapParams(args[1], frame)
end
local width
local default_as_number = tonumber(mw.ustring.match(tostring(args.default_width),"%d*"))
if not args.width then
width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))
elseif mw.ustring.sub(args.width, -2) == 'px' then
width = mw.ustring.sub(args.width, 1, -3)
else
width = args.width
end
local width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0;
if width_as_number == 0 then
-- check to see if width is junk. If it is, then use default calculation
width = round((default_as_number or 240) * (tonumber(map('defaultscale')) or 1))
width_as_number = tonumber(mw.ustring.match(tostring(width),"%d*")) or 0;
end
if args.max_width ~= "" and args.max_width ~= nil then
-- check to see if width bigger than max_width
local max_as_number = tonumber(mw.ustring.match(args.max_width,"%d*")) or 0;
if width_as_number>max_as_number and max_as_number>0 then
width = args.max_width;
end
end
local retval = frame:extensionTag{name = 'templatestyles', args = {src = 'Module:Location map/styles.css'}}
if args.float == 'center' then
retval = retval .. '<div class="center">'
end
if args.caption and args.caption ~= '' and args.border ~= 'infobox' then
retval = retval .. '<div class="locmap noresize thumb '
if args.float == '"left"' or args.float == 'left' then
retval = retval .. 'floatleft'
elseif args.float == '"center"' or args.float == 'center' or args.float == '"none"' or args.float == 'none' then
retval = retval .. 'tnone'
else
retval = retval .. 'floatright'
end
retval = retval .. '"><div class="thumbinner" style="width:' .. (width + 2) .. 'px'
if args.border == 'none' then
retval = retval .. ';border:none'
elseif args.border then
retval = retval .. ';border-color:' .. args.border
end
retval = retval .. '"><div style="position:relative;width:' .. width .. 'px' .. (args.border ~= 'none' and ';border:1px solid lightgray">' or '">')
else
retval = retval .. '<div class="locmap" style="width:' .. width .. 'px;'
if args.float == '"left"' or args.float == 'left' then
retval = retval .. 'float:left;clear:left'
elseif args.float == '"center"' or args.float == 'center' then
retval = retval .. 'float:none;clear:both;margin-left:auto;margin-right:auto'
elseif args.float == '"none"' or args.float == 'none' then
retval = retval .. 'float:none;clear:none'
else
retval = retval .. 'float:right;clear:right'
end
retval = retval .. '"><div style="width:' .. width .. 'px;padding:0"><div style="position:relative;width:' .. width .. 'px">'
end
local image = getContainerImage(args, map)
local currentTitle = mw.title.getCurrentTitle()
retval = string.format(
'%s[[File:%s|%spx|%s%s|class=notpageimage noviewer]]',
retval,
image,
width,
args.alt or ((args.label or currentTitle.text) .. ' is located in ' .. map('name')),
args.maplink and ('|link=' .. args.maplink) or ''
)
if args.caption and args.caption ~= '' then
if (currentTitle.namespace == 0) and mw.ustring.find(args.caption, '##') then
retval = retval .. '[[Category:Pages using location map with a double number sign in the caption]]'
end
end
if args.overlay_image then
return retval .. '<div style="position:absolute;top:0;left:0">[[File:' .. args.overlay_image .. '|' .. width .. 'px|class=notpageimage noviewer]]</div>'
else
return retval
end
end
function p.bottom(frame, args, map)
if not args then
args = getArgs(frame, {frameOnly = true, valueFunc = p.valueFunc})
end
if not map then
map = p.getMapParams(args[1], frame)
end
local retval = '</div>'
local currentTitle = mw.title.getCurrentTitle()
if not args.caption or args.border == 'infobox' then
if args.border then
retval = retval .. '<div style="padding-top:0.2em">'
else
retval = retval .. '<div style="font-size:91%;padding-top:3px">'
end
retval = retval
.. (args.caption or (args.label or currentTitle.text) .. ' (' .. map('name') .. ')')
.. '</div>'
elseif args.caption ~= '' then
-- This is not the pipe trick. We're creating a link with no text on purpose, so that CSS can give us a nice image
retval = retval .. '<div class="thumbcaption"><div class="magnify">[[:File:' .. getContainerImage(args, map) .. '| ]]</div>' .. args.caption .. '</div>'
end
if args.switcherLabel then
retval = retval .. '<span class="switcher-label" style="display:none">' .. args.switcherLabel .. '</span>'
elseif args.autoSwitcherLabel then
retval = retval .. '<span class="switcher-label" style="display:none">Show map of ' .. map('name') .. '</span>'
end
retval = retval .. '</div></div>'
if args.caption_undefined then
mw.log('Removed parameter caption_undefined used.')
local parent = frame:getParent()
if parent then
mw.log('Parent is ' .. parent:getTitle())
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
retval = retval .. '[[Category:Location maps with removed parameters|caption_undefined]]'
end
end
if map('skew') ~= '' or map('lat_skew') ~= '' or map('crosses180') ~= '' or map('type') ~= '' then
mw.log('Removed parameter used in map definition ' .. map())
if currentTitle.namespace == 0 then
local key = (map('skew') ~= '' and 'skew' or '') ..
(map('lat_skew') ~= '' and 'lat_skew' or '') ..
(map('crosses180') ~= '' and 'crosses180' or '') ..
(map('type') ~= '' and 'type' or '')
retval = retval .. '[[Category:Location maps with removed parameters|' .. key .. ' ]]'
end
end
if string.find(map('name'), '|', 1, true) then
mw.log('Pipe used in name of map definition ' .. map())
if currentTitle.namespace == 0 then
retval = retval .. '[[Category:Location maps with a name containing a pipe]]'
end
end
if args.float == 'center' then
retval = retval .. '</div>'
end
return retval
end
local function markOuterDiv(x, y, imageDiv, labelDiv, label_size)
return mw.html.create('div')
:addClass('od')
:addClass('notheme') -- T236137
:cssText('top:' .. round(y, 3) .. '%;left:' .. round(x, 3) .. '%;font-size:' .. label_size .. '%')
:node(imageDiv)
:node(labelDiv)
end
local function markImageDiv(mark, marksize, label, link, alt, title)
local builder = mw.html.create('div')
:addClass('id')
:cssText('left:-' .. round(marksize / 2) .. 'px;top:-' .. round(marksize / 2) .. 'px')
:attr('title', title)
if marksize ~= 0 then
builder:wikitext(string.format(
'[[File:%s|%dx%dpx|%s|link=%s%s|class=notpageimage noviewer]]',
mark,
marksize,
marksize,
label,
link,
alt and ('|alt=' .. alt) or ''
))
end
return builder
end
local function markLabelDiv(label, label_size, label_width, position, background, x, marksize)
if tonumber(label_size) == 0 then
return mw.html.create('div'):addClass('l0'):wikitext(label)
end
local builder = mw.html.create('div')
:cssText('width:' .. label_width .. 'em')
local distance = round(marksize / 2 + 1)
if position == 'top' then -- specified top
builder:addClass('pv'):cssText('bottom:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em')
elseif position == 'bottom' then -- specified bottom
builder:addClass('pv'):cssText('top:' .. distance .. 'px;left:' .. (-label_width / 2) .. 'em')
elseif position == 'left' or (tonumber(x) > 70 and position ~= 'right') then -- specified left or autodetected to left
builder:addClass('pl'):cssText('right:' .. distance .. 'px')
else -- specified right or autodetected to right
builder:addClass('pr'):cssText('left:' .. distance .. 'px')
end
builder = builder:tag('div')
:wikitext(label)
if background then
builder:cssText('background-color:' .. background)
end
return builder:done()
end
local function getX(longitude, left, right)
local width = (right - left) % 360
if width == 0 then
width = 360
end
local distanceFromLeft = (longitude - left) % 360
-- the distance needed past the map to the right equals distanceFromLeft - width. the distance needed past the map to the left equals 360 - distanceFromLeft. to minimize page stretching, go whichever way is shorter
if distanceFromLeft - width / 2 >= 180 then
distanceFromLeft = distanceFromLeft - 360
end
return 100 * distanceFromLeft / width
end
local function getY(latitude, top, bottom)
return 100 * (top - latitude) / (top - bottom)
end
function p.mark(frame, args, map)
if not args then
args = getArgs(frame, {wrappers = 'Template:Location map~'})
end
local mapnames = {}
if not map then
if args[1] then
map = {}
for mapname in mw.text.gsplit(args[1], '#', true) do
map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame)
mapnames[#mapnames + 1] = mapname
end
if #map == 1 then map = map[1] end
else
map = p.getMapParams('World', frame)
args[1] = 'World'
end
end
if type(map) == 'table' then
local outputs = {}
local oldargs = args[1]
for k,v in ipairs(map) do
args[1] = mapnames[k]
outputs[k] = tostring(p.mark(frame, args, v))
end
args[1] = oldargs
return table.concat(outputs, '#PlaceList#') .. '#PlaceList#'
end
local x, y, longitude, latitude
longitude = decdeg(args.lon_deg, args.lon_min, args.lon_sec, args.lon_dir, args.long, 'longitude')
latitude = decdeg(args.lat_deg, args.lat_min, args.lat_sec, args.lat_dir, args.lat, 'latitude')
if args.excludefrom then
-- If this mark is to be excluded from certain maps entirely (useful in the context of multiple maps)
for exclusionmap in mw.text.gsplit(args.excludefrom, '#', true) do
-- Check if this map is excluded. If so, return an empty string.
if args[1] == exclusionmap then
return ''
end
end
end
local builder = mw.html.create()
local currentTitle = mw.title.getCurrentTitle()
if args.coordinates then
-- Temporarily removed to facilitate infobox conversion. See [[Wikipedia:Coordinates in infoboxes]]
-- if longitude or latitude then
-- error('Coordinates from [[Module:Coordinates]] and individual coordinates cannot both be provided')
-- end
longitude = coord2text('longitude', args.coordinates)
latitude = coord2text('latitude', args.coordinates)
elseif not longitude and not latitude and args.useWikidata then
-- If they didn't provide either coordinate, try Wikidata. If they provided one but not the other, don't.
local entity = mw.wikibase.getEntity()
if entity and entity.claims and entity.claims.P625 and entity.claims.P625[1].mainsnak.snaktype == 'value' then
local value = entity.claims.P625[1].mainsnak.datavalue.value
longitude, latitude = value.longitude, value.latitude
end
if args.link and (currentTitle.namespace == 0) then
builder:wikitext('[[Category:Location maps with linked markers with coordinates from Wikidata]]')
end
end
if not longitude then
error('No value was provided for longitude')
elseif not latitude then
error('No value was provided for latitude')
end
if currentTitle.namespace > 0 then
if (not args.lon_deg) ~= (not args.lat_deg) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Degrees]]')
elseif (not args.lon_min) ~= (not args.lat_min) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Minutes]]')
elseif (not args.lon_sec) ~= (not args.lat_sec) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Seconds]]')
elseif (not args.lon_dir) ~= (not args.lat_dir) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Hemisphere]]')
elseif (not args.long) ~= (not args.lat) then
builder:wikitext('[[Category:Location maps with different longitude and latitude precisions|Decimal]]')
end
end
if ((tonumber(args.lat_deg) or 0) < 0) and ((tonumber(args.lat_min) or 0) ~= 0 or (tonumber(args.lat_sec) or 0) ~= 0 or (args.lat_dir and args.lat_dir ~='')) then
builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')
end
if ((tonumber(args.lon_deg) or 0) < 0) and ((tonumber(args.lon_min) or 0) ~= 0 or (tonumber(args.lon_sec) or 0) ~= 0 or (args.lon_dir and args.lon_dir ~= '')) then
builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')
end
if (((tonumber(args.lat_min) or 0) < 0) or ((tonumber(args.lat_sec) or 0) < 0)) then
builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')
end
if (((tonumber(args.lon_min) or 0) < 0) or ((tonumber(args.lon_sec) or 0) < 0)) then
builder:wikitext('[[Category:Location maps with negative degrees and minutes or seconds]]')
end
if args.skew or args.lon_shift or args.markhigh then
mw.log('Removed parameter used in invocation.')
local parent = frame:getParent()
if parent then
mw.log('Parent is ' .. parent:getTitle())
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
local key = (args.skew and 'skew' or '') ..
(args.lon_shift and 'lon_shift' or '') ..
(args.markhigh and 'markhigh' or '')
builder:wikitext('[[Category:Location maps with removed parameters|' .. key ..' ]]')
end
end
if map('x') ~= '' then
x = tonumber(mw.ext.ParserFunctions.expr(map('x', { latitude, longitude })))
else
x = tonumber(getX(longitude, map('left'), map('right')))
end
if map('y') ~= '' then
y = tonumber(mw.ext.ParserFunctions.expr(map('y', { latitude, longitude })))
else
y = tonumber(getY(latitude, map('top'), map('bottom')))
end
if (x < 0 or x > 100 or y < 0 or y > 100) and not args.outside then
mw.log('Mark placed outside map boundaries without outside flag set. x = ' .. x .. ', y = ' .. y)
local parent = frame:getParent()
if parent then
mw.log('Parent is ' .. parent:getTitle())
end
mw.logObject(args, 'args')
if currentTitle.namespace == 0 then
local key = currentTitle.prefixedText
builder:wikitext('[[Category:Location maps with marks outside map and outside parameter not set|' .. key .. ' ]]')
end
end
local mark = args.mark or map('mark')
if mark == '' then
mark = 'Red pog.svg'
end
local marksize = tonumber(args.marksize) or tonumber(map('marksize')) or 8
local imageDiv = markImageDiv(mark, marksize, args.label or mw.title.getCurrentTitle().text, args.link or '', args.alt, args[2])
local label_size = args.label_size or 91
local labelDiv
if args.label and args.position ~= 'none' then
labelDiv = markLabelDiv(args.label, label_size, args.label_width or 6, args.position, args.background, x, marksize)
end
return builder:node(markOuterDiv(x, y, imageDiv, labelDiv, label_size))
end
local function switcherSeparate(s)
if s == nil then return {} end
local retval = {}
for i in string.gmatch(s .. '#', '([^#]*)#') do
i = mw.text.trim(i)
retval[#retval + 1] = (i ~= '' and i)
end
return retval
end
function p.infobox_pushpin_map(frame)
--This function is designed to be invoked from an infobox template
--* Some parameters (generally starting with "pushpin_") are meant to be exposed as parameters
-- in the outer infobox, settable by editors
--* Others are meant to be "hidden" (e.g., only set inside the infobox template code)
-- First get the combined arguments from both parent and invocation frame
local raw_args = getArgs(frame,{parentFirst=true})
--If no map is supplied, return.
if not raw_args['pushpin_map'] then
return
end
-- Now get arguments from just the invocation frame
local frame_args = getArgs(frame,{frameOnly=true})
-- parsed_args will have the resulting merged parameters
local parsed_args = {}
-- Default to using wikidata coodinates if no other coordiantes supplied.
if raw_args.useWikidata == nil then
parsed_args.useWikidata = true
else
parsed_args.useWikidata = raw_args.useWikidata
end
-- Parse the arguments
parsed_args[1] = raw_args['pushpin_map']
parsed_args.float = frame_args.float or 'center'
parsed_args.border = frame_args.border or 'infobox'
parsed_args.default_width = frame_args.default_width
parsed_args.max_width = frame_args.max_width
parsed_args.coordinates = raw_args['coordinates']
parsed_args.caption = raw_args['pushpin_caption']
parsed_args.relief = raw_args['pushpin_relief']
parsed_args.label = raw_args['pushpin_label']
parsed_args.label_size = raw_args['pushpin_label_size']
parsed_args.position = raw_args['pushpin_label_position']
parsed_args.mark = raw_args['pushpin_mark']
parsed_args.marksize = raw_args['pushpin_mark_size']
parsed_args.alt = raw_args['pushpin_alt']
parsed_args.background = raw_args['pushpin_background']
parsed_args.width = raw_args['pushpin_map_size']
local map = {}
local caption_list = {}
for mapname in string.gmatch(parsed_args[1], '[^#]+') do
map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame)
end
if parsed_args['caption'] then
for caption in mw.text.gsplit(parsed_args['caption'], '##', true) do
caption_list[#caption_list + 1] = caption
end
end
if #map == 1 then
map = map[1]
if not parsed_args.caption then
parsed_args.caption = 'Location within ' .. map('name')
end
end
if type(map) == 'table' then
mw.log('----')
mw.logObject(map)
if #caption_list > #map then
error(string.format('%d captions were provided, but only %d maps were provided', #caption_list, #map))
elseif not parsed_args.caption then
-- Set a default caption for each of the multiple maps
for i=1, #map do
caption_list[#caption_list + 1] = 'Location within '.. map[i]('name')
end
end
local outputs = {}
parsed_args.autoSwitcherLabel = true
for k,v in ipairs(map) do
parsed_args.caption = caption_list[k]
outputs[k] = p.main(frame, parsed_args, v)
end
return '<div class="switcher-container">' .. table.concat(outputs) .. '</div>'
else
return p.top(frame, parsed_args, map) .. tostring( p.mark(frame, parsed_args, map) ) .. p.bottom(frame, parsed_args, map)
end
end
function p.main(frame, args, map)
local caption_list = {}
if not args then
args = getArgs(frame, {wrappers = 'Template:Location map', valueFunc = p.valueFunc})
end
if args.useWikidata == nil then
args.useWikidata = true
end
if not map then
if args[1] then
map = {}
for mapname in string.gmatch(args[1], '[^#]+') do
map[#map + 1] = p.getMapParams(mw.ustring.gsub(mapname, '^%s*(.-)%s*$', '%1'), frame)
end
if args['caption'] then
if args['caption'] == "" then
while #caption_list < #map do
caption_list[#caption_list + 1] = args['caption']
end
else
for caption in mw.text.gsplit(args['caption'], '##', true) do
caption_list[#caption_list + 1] = caption
end
end
end
if #map == 1 then map = map[1] end
else
map = p.getMapParams('World', frame)
end
end
if type(map) == 'table' then
local altmaps = switcherSeparate(args.AlternativeMap)
if #altmaps > #map then
error(string.format('%d AlternativeMaps were provided, but only %d maps were provided', #altmaps, #map))
end
local overlays = switcherSeparate(args.overlay_image)
if #overlays > #map then
error(string.format('%d overlay_images were provided, but only %d maps were provided', #overlays, #map))
end
if #caption_list > #map then
error(string.format('%d captions were provided, but only %d maps were provided', #caption_list, #map))
end
local outputs = {}
args.autoSwitcherLabel = true
for k,v in ipairs(map) do
args.AlternativeMap = altmaps[k]
args.overlay_image = overlays[k]
args.caption = caption_list[k]
outputs[k] = p.main(frame, args, v)
end
return '<div class="switcher-container">' .. table.concat(outputs) .. '</div>'
else
return p.top(frame, args, map) .. tostring( p.mark(frame, args, map) ) .. p.bottom(frame, args, map)
end
end
return p
3pqbnkg8pemwulwnvka0szt6hqc0tii
Шаблон:Coord
10
1466
21813
10659
2025-12-25T18:30:20Z
Primefac
2755
[[Wikipedia:Templates for discussion/Log/2025 December 13#Template:WikidataCoord]] closed as merge ([[WP:XFDC#4.0.16|XFDcloser]])
10659
wikitext
text/x-wiki
<includeonly>{{#invoke:Coordinates|coord}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
0o7lasvhdxe29mlczlsmvzkvka0kscy
21814
21813
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Coord]]: Importing from the English wikipedia
10659
wikitext
text/x-wiki
<includeonly>{{#invoke:Coordinates|coord}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
0o7lasvhdxe29mlczlsmvzkvka0kscy
Модул:Coordinates/styles.css
828
1468
21833
2023-05-24T21:17:17Z
Izno
2749
per tper
21833
sanitized-css
text/css
/* {{pp-template}} */
/* Geographical coordinates defaults. The classes "geo", "longitude", and
"latitude" are used by the [[Geo microformat]]. */
.geo-default,
.geo-dms,
.geo-dec {
display: inline;
}
.geo-nondefault,
.geo-multi-punct,
.geo-inline-hidden {
display: none;
}
.longitude,
.latitude {
white-space: nowrap;
}
372gk2cap99kasnuwl2084jfakikzgw
21834
10661
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Module:Coordinates/styles.css]]: Importing from the English wikipedia
10661
sanitized-css
text/css
/* Geographical coordinates defaults. The classes "geo", "longitude", and
"latitude" are used by the [[Geo microformat]]. */
.geo-default,
.geo-dms,
.geo-dec {
display: inline;
}
.geo-nondefault,
.geo-multi-punct,
.geo-inline-hidden {
display: none;
}
.longitude,
.latitude {
white-space: nowrap;
}
6kb1bv1kq6yo1ukxzqi15vrd26x01rl
Криж
0
2108
22039
12905
2026-09-19T10:29:43Z
Olirk55
19
Уложени фотоґрафиї
22039
wikitext
text/x-wiki
[[File:Kriz u cerkvi 20250520 084658.jpg|thumb|right|250px|Криж у [[церковна порта|порти]] [[святи храм|святого храму]] у [[Руски Керестур|Руским Керестуре]]]]
'''Криж''' (общеславянске слово, серб. крст) – у [[Руски язик|руским язику]] тото слово ма вецей значеня:
'''1'''. символ и предмет култа християнскей релиґиї; молитвов знак християнох. Криж антропоїдни символ двох длужох хтори ше режу, найчастейше под правим углом. Абстрактна представа чловека з розширенима руками.
== Форма крижа ==
У основи шицких теорийох толкованя форми крижа – чловек. Криж чловекоподобна форма – чловек з розширенима руками.
Даєдни з окремних файтох крижох:
[[Файл:Vrste krizeva2.jpg|алт=Файти крижох|мини|638x638px|Файти крижох]]
1. Латински криж (crux capitata, crux ordinaria)
2. Петров криж (crux inversa)
3. Тау криж (crux commissa, "T"-криж)
4. Рачкасти криж (збойнїцки криж, "Y"-криж)
5. Гречески криж (crux immissa, crux quadrata)
6. Андрийов криж (crux decussata)
7. Надвладически криж (crux gemina, двойнїсти криж)
8. Папов криж (crux papalis)
9. Русийски криж
10. Русийски криж
11. Зламани криж
12. Клїнкасти криж
13. Кляпчисти криж
14. Малтежски криж
15. Яблукасти криж
16. Тролїсцови криж (Лазаров криж)
17. Жезлови криж
[[File:Germania occidentale, croce detta di lotario, 1000 ca, con base tardogotica (XV secolo) 01.jpg|right|thumb|300px|Преднї бок Лотарового крижа-процесийни криж, 50 цм длугоки (коло 1000. року), класични приклад „святей уметностжци” (Ars Sacra).]]
18. Жезлови криж
19. Сидрови криж (crux ancorata)
20. Сидрови криж (crux ancorata)
21. Сидрови криж (crux ancorata)
22. Повторени криж
23. Єрусалимски криж (криж святого гроба)
24. Римски "Святи криж"
25. Кукасти криж (crux dissimulata, свастика)
26. Ротируюци кукасти криж
27. Слункови криж
28. Пошвецуюци криж
29. Дупловани кукасти криж
30. Нємецки ґимнастични криж
31. Ґамадия (crux gammata, составени зоз 4 словох T)
32. Коптски криж
33. Бисерни криж (crux gemmata)
34. Єгипетски криж (crux ansata)
35. Комбинация єгипетского, Антунового и слункового крижа
36. Комбинация сидрового и єгипетского крижа (crux ansata ancorata)
37. Криж воздзвигнути понад жеми
38. Вариянта воздзвигнутого крижа зоз шейсцома зарнами писку
[[File:Otto Mathilden Kreuz.jpg|right|thumb|300px|Матилдoв криж зоз коло 973. року, виваяни Христос на преднїм боку ]]
39. "Arbor vitae" (crux virescens)
40. Архангелски криж
41. Вариянта архангелского крижа
42. Криж штирох євангелистох
Студеницки криж
Напершови криж
Християнски чесни криж
Символистични нордийски криж
Македонски криж
Стилизовани криж у гералдики
Символистични червени криж
награда воєни криж
ознака †
== Криж – маґични символ поганских вереньох ==
Вично застарани чловек, и у своїм вчасним постояню, як вираз свойого найвекшого пошвеценя, поставя власну подобу – себе, и до перших символох зоз хторима виражує свою бриґу, алє и свою надїю до лєпшого. Так ше антропоїдни криж-чловек нашол уж на предметох неолиту. Значи, тисячи роки пред наставаньом християнства, ище у младшим каменим периодзе, наш злєкнути и нєобразовани предходнїк урезал и нарисовал криж на предметох каждодньового живота, жадаюци ше защициц. И єгипетски божества, Озирис и Изида, мали на своїх шматох по три крижи зоз хторима ше означовала їх божеска моц. Колумбо 1492. року, знова пред тим як християнство сцигло на америцки континент, медзи америцкима старобивателями застал криж як амайлию. Джеймс Кук 1772. року на Новим Зеланду видзел старобивательох як на гроб своїх соплеменїкох кладу крижи. Часто крижи урезани и на штредньовиковних богумилских надгробних каменьох. Анї тот криж нє бул християнски, алє погански цо вишол з вереньох и представох примитивного чловека. То була стилизована антропоїдна представа покойного у гробе пред надгробним [[Камень|каменьом]].
== Криж при старих Славянох и племенох поганских Сербох ==
Криж бул познати и медзи старима Славянами, та так и при племенох поганских Сербох, и знова вельо скорей як цо прияли християнство. Прето ше и нєшка розликую „Чесни криж“ и „Народни криж“. Сербски народни криж то вираз общого народного вереня до антропоїдного (чловекоподобного) божества хторе ше представя зоз соху (соха – идол старих Славянох).
== Криж у християнскей релиґиї ==
Погришна предрозсудка же криж здобуток лєм християнскей релиґиї. Криж вельо старши од християнства. Прешли тисячи роки до III вику новей ери кед ше криж конєчно одомашнєл у християнстве хторе ше уж зажило и постал його нєзаобиходни и найзначнєйши символ. Од реґресивней представи маґичних фиґурох настал антропоїдни криж з єднакима положенима краками: зоз горнїм найкратшим, даєдни место краку маю главку, и долнїм найдлугшим. Зоз стилизованьом народного крижа настали два основни християнски крижи: латински, хтори ше по форми нєбарз розликує од народного (ма по велькосци три єднаки краки, а долнї длугши); други то гречески, хтори ше, под уплївом маґийского круга и округлих судзинкох, по форми баржей оддалєл од народногo крижа; вон ма шицки штири єднаки краки.
== Правенє крижох ==
Крижи ше прави з каменя, лїпового або лїсковцового древа, зоз класкох жита, зоз квеца. Як значенє у чловековим живоце найлєпше потвердзує їх виробок у найдаргших племенїтих металох, украшени з найдрагшим драгоциним каменьом, як и у їх велькосци.
Крижи ше, окрем у [[Святи храм|церковних]] зданийох, кладло и на крижни драги и коло драгох до поля.
'''2.''' церковна застава:
Теди ше нє ишло на одпуст пре госцину на кочох, алє по християнски пешо у процесиї з крижами;
'''3.''' надгобни криж або памятнїк:
Кед ми помреме, / ховац нас дайце! / На нашо крижи / златни лїтери, / жовти нумери / вибиц нам дайце!
'''4.''' два марадики покошеного зарна (18 вельки або 28 мали снопи), серб. крстина:
А вецка перше док почитали кельо ґазда ма крижи жита, то ше волало дзешаток, та зоз свойого жита ґазда мушел дац седми криж: седми криж комора брала од ґазди;
'''5.''' двацец снопи нажатей конопи:
Вижату конопу ше вяже з конопками при верху и при сподку и склада ше до крижох (копкох), по 20 снопи єден криж (копка);
'''6.''' штос зложеного древа, щипанїцох, мехох:
Зложиц древо до крижа; Мехи зме складали до крижох, до ракашох, до штосох;
'''7.''' прен. животна терха, церпенє, нєщесце, судьба:
Видно було на нїм же церпи (од хороти), алє ше нїґда нє поносовал на свой криж.
==Фразеолоґия==
На криж – крижом єдно прейґ другого, у форми крижа
Дочекац дакого з крижами – дочекац з вельку помпу
Руциц (положиц) криж на дакого/дацо – дзвигнуц руки од дакого/дачого
Як з крижа зняти – барз вимучени, витрапени, вистати або хори
== Ґалерия ==
<gallery>
Файл:Kriz pri drahi za Kulu 20250318 162939.jpg|Криж при драги спрам Кули (Руски Керестур)
Файл:Kriz pri benzinskej pumpi 20250521 103045.jpg|Криж при бензинскей станїци (Руски Керестур)
Файл:Kriz pri Funzija 20250527 171214.jpg|Криж на Косцелїску (Руски Керестур)
Файл:Kriz u uljici M. tita, spram Kuli 20250412 154240.jpg|Криж на концу валала спрам Кули (Руски Керестур)
Файл:Kriz u uljici N. Fronta 20250425 113101.jpg|Криж у улїци Народни Фронт (Руски Керестур)
Файл:Kriz u keresturskim hotare.jpg
</gallery>
==Литература==
* ''Словнїк руского народного язика I А – Н'', Нови Сад 2017, б. 664-665.
* ''Церковни литурґийно литурґични лексикон'' от. др. Роман Миз, „Руске слово“ и „Грекокатолїцка парохия св. Петра и Павла“ , Нови Сад 2011. рок
==Вонкашнї вязи==
* [https://sr.wikipedia.org/sr-ec/%D0%9A%D1%80%D1%81%D1%82 Крст.] Википедија на српском језику, sr.wikipedia.org, 17. новембар 2006.
[[Катеґория:Християнство]]
gyxw8f6at2vbnf4s0vizilhithmkkei
Нихон Шоки
0
2964
22041
18177
2026-09-19T11:52:07Z
Olirk55
19
Додата буква, викивяза
22041
wikitext
text/x-wiki
[[Файл:Nihonshoki tanaka version.jpg|thumb|right|300px|Копия боку зоз ''Нихон Шоки''-ю, вчасни Хеян период.]]
'''''Нихон Шоки''''' (日本書紀), тиж познати и пoд назву '''''Хронїки Япону''''', друга найстарша кнїжка о историї Япону. Настала 720. року по розказу цара Ґеншоа дворскому ученякови Тонерови Шиноуови же би направел запис о Японє. Тото дїло ше, як и Кодїки, занїма з периодом богох, алє лєм по Джито.
Тиж так, ма вецей хронолоґиї и историйни податки, по углядзе на китайску историну хронїку, та обачлїва и даяка литературно-историна структура (вшелїяк, подобна китайскей). У тим дїлу акцент вецей на историйней точносци як на литерализациї, прецо є з литературного боку нїзшей вредносци, алє з историйного - векшей.
У селекциї дїлох нароком ше указує шицки познати вариянти, нє лєм тоти цо маю улогу у политичним живоце. То доказ же пририхтователь хасновал рижни жридла, виглєдовал други записи хтори було надосц, як гваря китайски жридла. Записи новшого датума историйно барз виродостойни.<ref>[https://en.wikisource.org/wiki/Nihongi/ Book_XXX]</ref>
Прозни текст написани на китайским язику, гоч єст и писнї за хтори ше хасновало китайску транскрибцию. Нихон Шоки ше состої зоз скоро трицец пантлїкох з папирусу, т.є. томох, дзе скоро шицки написани на китайским язику. Главни циль Кодїкию оправданє божого походзеня цара; док циль Нихон Шокия потримовка авторитета Япону у одношеню на сушедох, творенє слики Япону як моцней, сувереней, цивилизованей и културней [[Поверхносц|поверхносци]] жеми хтора нє заостава.
== Литература ==
* Nihongi : chronicles of Japan from the earliest times to A.D. 697 [Нихонги: хронике Јапана од најранијих времена до 697. године]. 1. Превод: Aston, William George. London: Japan Society. 1896.
* Nihongi : chronicles of Japan from the earliest times to A.D. 697 [Нихонги: хронике Јапана од најранијих времена до 697. године]. 2. Превод: Aston, William George. London: Japan Society. 1896.
* Brownlee, John S. (1997). Japanese historians and the national myths, 1600-1945: The Age of the Gods and Emperor Jimmu. Vancouver: University of British Columbia Press. ISBN 978-0-7748-0644-2.
* Brownlee, John S. (1991). Political Thought in Japanese Historical Writing: From Kojiki (712) to Tokushi Yoron (1712). Waterloo, Ontario: Wilfrid Laurier University Press. ISBN 978-0-88920-997-8.
* Sakamoto, Tarō; Brownlee, John S. (1991). The Six National Histories of Japan: Rikkokushi. Vancouver: University of British Columbia Press. ISBN 978-0-7748-0379-3.
== Референци ==
<references />
[[Катеґория:Япон]]
[[Катеґория:Японска митолоґия]]
[[Катеґория:Кнїжки]]
[[Катеґория:Видавательство]]
saxixp8bmmgjhl4jwq6bh8dv614x6wr
Список єгипетских божествох
0
3127
22042
19208
2026-09-19T11:56:48Z
Olirk55
19
Означени викивязи
22042
wikitext
text/x-wiki
== А ==
<hiero>G1</hiero>
* '''Ра|Амон''' – Державни бог у Новей держави и першебутне єгипетске божество
* '''Аммут''' – Чудовиско хторе є шерца гевтих цо нє заслужели загробни живот
* '''Анкет''' – Водова богиня Елефантине
* '''Анубис''' – Бог умартих и провадзач мертвих на [[Драга|драги]] за загробни живот (Бог – Шакал)
* '''Акер''' – Чувар виходзацого и захозацого [[Слунко|Слунка]]
* '''Апеп''' – Гад хтори пробує знїщиц Слунко
* '''Ару''' — Защитнїк пољох з [[Над|надом]]
* '''Атон''' – Слунков круг
* '''Атум''' – Бог заходзацого Слунка
* '''Аш''' - Бог оазох и винїцох на заходней делти Нилу
== Б ==
<hiero>D58</hiero>
* '''Ба''' — Богиня богатства
* '''Ба Неб Тет''' — Богиня одлуки
* '''Ба Пеф''' — Бог нєщесца и страху
* '''Баби''' — Бог маймунох (Бог — Маймун Бабун)
* '''Бат''' — Бог защитнїк кравох
* '''Бастет''' – Богиня обисца и слунковей [[Шветлосц|шветлосци]] (Богиня – Мачка)
* '''Баену''' — Слункова свята птица Нилу
* '''Бес''' – Бог танцу, [[Музика|музики]] и вояцких схопносцох (Бог – Патульок)
* '''Буто''' – Богиня Долнього Єгипту (Богиня – Кобра)
== Д ==
<hiero>D46</hiero>
* '''Дедун''' – Бог богатства и гнїву Дуа – Бог облєканя Дуамутеф – Чувар жалудкох од хоротох
==Ґ==
<hiero>W11</hiero>
* '''Ґеб''' – Бог Жеми
== И ==
<hiero>M17</hiero>
* '''Иат''' – Богиня млєка
* '''Иох''' — Бог Мешаца
* '''Имхотеп''' – Везир Дьосера
* '''Имсетy''' – Чувар печинки од хоротох
* '''Исис''' — Богиня маґичних моцох и здравя
* '''Изида''' – Богиня плодносци, защитнїца малженства и мацеринства (Велька богиња мац)
* '''Иху''' – Бог святей черкотки<br />
== К ==
<hiero>N29</hiero>
* '''Кебехсенуеф''' – Чувар черевох од рижних хоротох
* '''Кетесх''' – Семитска богиня природи
* '''Кепера Хепра''' – Бог виходзацохо Слунка
* '''Кнум Нун''' – Бог вилївох и гаосу (Творитель богох, людзох и води)
* '''Консу''' – Бог мешаца Теби
== М ==
<hiero>G17</hiero>
* '''Ма’ат''' – Богиня правди
* '''Маахес''' – Бог войованя
* '''Менхит''' – Богиня войни
* '''Меретсегер''' – Богиня Долїни кральох
* '''Мин''' – Бог хлопскей плодносци
* '''Мут''' – Богиня Теби
== Н ==
<hiero>N35</hiero>
* '''Нефертем''' – Бог лотуса Мемфиса
* '''Нефтис''' – Изидова шестра и жена бога Сета, Богиня шмерци
* '''Неитх''' — Богиня войни
* '''Некхебет''' – Богиня Горнього Єгипту (Богиня – Здохлїнар)
* '''Нут''' – Богиня нєба
== О ==
<hiero>O3</hiero>
* '''Онурис''' – Нєбесни бог Абyдоса и борец
* '''Озирис''' – Бог плодности и веґетациї<br />
== П ==
<hiero>Q3</hiero>
* '''Птах''' – Бог мертвих и пан судьби, творитель ЖемиР
== Р ==
<hiero>D21</hiero>
* '''Ра Ре''' – Бог Слунка
* '''Ренетет Ре''' – Бог щесца и напредованя
== С ==
<hiero>S29</hiero>
* '''Собек Себек''' – Бог води Нилу (Бог – Крокодил)
* '''Сатет''' – Богиня нилских вилївох и плодносци
* '''Селкет''' – Богиня маґиї (Богиня – Шкорпия)
* '''Секер''' – Бог шмерци
* '''Серапис''' – Геленистични бог Слунка и загробного живота
* '''Сесхат''' – Богиня писаня и мераня
* '''Секхемет''' – Богиня войни и знїщованя (Богиня – Лєвица)
* '''Су''' – Бог [[Воздух|воздуху]]
* '''Сет''' – Бог бурйох и оружия
== Т ==
<hiero>X1</hiero>
* '''Таурет''' – Богиня женох и породу (Богиня – Нилски коњ)
* '''Тефнут''' – Богиня [[Влага|влаги]] и дижджу
* '''Тот''' – Бог мудросци и ученя (Бог – Ибис)
== Х ==
<hiero>O4</hiero>
* '''Хапи''' – Бог Нилу
* '''Хапy''' – Чувар плюцох од хоротох
* '''Хатор''' – Богиня – Крава, Богиня нєба, музики и любови. Ґаздиня под'жемя и [[Гвизда|гвиздох]]
* '''Хароерис''' — Бог шветлосци
* '''Хатмехит''' — Богиня рибох
* '''Хаухет''' — Богиня нємерлївей безконєчносци
* '''Хекет''' — Богиня родзеня (Богиня — Жаба)
* '''Хемен''' — Богиня (Богиня — Сокол)
* '''Хемсут''' – Богиня судьби
* '''Хенет''' – Богиня (Богиня – Пеликан)
* '''Хике''' – Бог медицини
* '''Хорус''' – Бог нєба, Слунка и фараона (Бог – Сокол)
* '''Хух''' – Бог нєбесней безконєчносци
== Вонкашнї вязи ==
{{Commonscat|Egyptian deities}}
60fx88c4cw5jfxzvijdp8ua0wcrigno
Модул:Citation/CS1
828
3187
21759
19510
2026-08-08T13:56:56Z
Trappist the monk
2745
synch from sandbox;
21759
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
21760
21759
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Citation/CS1]]: Importing from the English wikipedia
21759
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
Модул:Citation/CS1/Configuration
828
3188
21761
19511
2026-08-11T19:05:25Z
Trappist the monk
2745
synch from sandbox;
21761
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
21762
21761
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Citation/CS1/Configuration]]: Importing from the English wikipedia
21761
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
Модул:Citation/CS1/Whitelist
828
3190
21763
19513
2026-08-08T13:56:52Z
Trappist the monk
2745
synch from sandbox;
21763
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
21764
21763
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Citation/CS1/Whitelist]]: Importing from the English wikipedia
21763
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
Модул:Citation/CS1/Utilities
828
3192
21765
19515
2026-08-08T13:56:45Z
Trappist the monk
2745
synch from sandbox;
21765
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
21766
21765
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Citation/CS1/Utilities]]: Importing from the English wikipedia
21765
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
Модул:Citation/CS1/Date validation
828
3194
21767
19518
2026-08-08T13:56:49Z
Trappist the monk
2745
synch from sandbox;
21767
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
21768
21767
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Citation/CS1/Date_validation]]: Importing from the English wikipedia
21767
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
Охридски бисер
0
3542
21742
21738
2026-09-18T13:44:52Z
Sveletanka
20
референци
21742
wikitext
text/x-wiki
[[File:Охридски бисер.jpg|right|thumb|300px|Охридски бисери (перли)]]Охридски бисер (або охридска перла) єден з препознатлївих символох [[Сиверна Македония|Македониї]] - жеми културних и историйних памятнїкох, природних красотох и богатствох, традициї и квалитету. Гоч Охрид ма велї културни и историйни знаменїтосци, памятнїки и, вшелїяк, [[Охридске озеро]], треба видзиц охридски бисер и одкриц приповедку хтора за нїм стої.<ref> [https://www.klix.ba/lifestyle/putovanja/ohridski-biser-tajna-cuvana-stotinu-godina-koju-znaju-samo-dvije-porodice/200124026 Ohridski biser - tajna čuvana stotinu godina koju znaju samo dvije porodice]. ''www.klix.ba''. Приступљено 18.09.2026.</ref>
== Леґенда о бисеру ==
Далєкого 1928. року, у Охриду, Михайло Филев – син Николе Филева, погосцителя и власнїка карчми „Велька Сербия” – упознал у тим обєкту таїнственого госца по мену Йован Субанович. Йован пришол на Балкан як емиґрант з далєкей Русиї, а до Охриду, у Македониї, пришол зошицким случайно. Док там бул, медзи нїм и Михайлом ше розвило глїбоке приятельство. Раз так, док ше шейтали по побрежю Охридского озера и бешедовали о рижних темох, збачели рибарох – хтори, иншак, були блїзка родзина Михайлови Филевови – як ноша [[Кошар|кошари]] полни з плашицу, єдну файту риби хтора автохтона за Охридске озеро. Потим як присуствовал тей подїї з рибу, Йован похопел же би ше тайна хтору принєсол з Русиї – точнєйше з Байкалског озера – могла одкриц праве ту. Тота тайна ше скривала у риби цо ше вола плашица (позната и як кедер, мала сладководна риба з фамилиї потькох (Cyprinidae), латинскей назви ''Alburnus alburn)'', ендемскей файти чийо ше лупки могло хасновац за виробок бисерох. Так, на знак глїбокого приятельства, Йован упознал пана Михайла Филева з таїнствену схопносцу виробку бисерох. По теди нїхто у Охриду нє знал за таке ''ремесло''.<ref>[https://ohridpearlsserbia.com/istorija-ohridskog-bisera Istorijat Ohridskog Bisera]. ''ohridpearlsserbia.com''. Приступљено18.09.2026.</ref><ref>[https://ohridpearlsserbia.com/tajna-ohridskog-bisera Tajna Ohridskog Bisera]. ''ohridpearlsserbia.com''. Приступљено 18.09.2026.</ref>
После того, фамелия Филев почала правиц бисери и преношиц фамелийну тайну з ґенерациї на ґенерацию – з оца на сина. Як вершински сувенир варошу Охриду и препознатлїви бренд Републики Македониї, тоти бисери украшую шиї и збогацую колекциї прикраскох велїх людзох у Македониї и ширцом швета.<ref> [https://zurnal.politika.rs/scc/clanak/146086/ohridski-biser-brend-grada-ohrida Охридски бисер – бренд града Охрида], ''Спортски журнал'', 26.01.2023. ''zurnal.politika.rs''. Приступљено 18.09.2026. .</ref>
== Продукция ==
Лєм фамелиї Филев и Талев знаю подполну тайну виробку того бисера. Тоти два фамелиї пестую традицию и продукую тото цо познате як „Ориґинални охридски бисер”. Процес у сущносци ручни. Ядро бисера ше достава з водового коритка – точнєйше, з материялу нукашнєй часци шкарупини – хтори ше оформює до рижних формох (як кульки, пацерки и у форми слизи) и велькосци (од F5 до F15). Потим ше зоз лупки риби плашици прави емулзию хтору ше наноши на ядро. Наношенє емулзиї представя найхарактеристичнєйшу часц процесу виробку бисерох. Емулзию ше наноши зоз щеточку з природного материялу – найчастейше зоз шерсци на вивирковим хвосце. Наноши ше вецей раз, у зависносци од велькосци ядра бисера (наприклад, на ядро типу „F5” наноши ше пейц пасма). Ядро ше зохабя док ше нє осуши, а поступок ше повторює. Тота ручна продукция бисерох то поступни процес хтори ше одвива у вецей фазох.
Тоти нови креациї представяю спокусу за младши ґенерацијї у фамелийох же би предлужели длугорочну фамелийну традицию.
'''Познати особи повязани з охридскима бисерами:'''
* Йованка Броз (перша дама Югославиї)
* Даяна (принцеза од Велсу)
* Марґарета II (кралїца Данскей)
* Юлияна (кралїца Голандиї)
* Мария (кралїца Югославиї)
* Дьована (кралїца Болгарскей)
* Вилма Трайковска (перша дама Македониї)
* Елизабета II (кралїца Зєдинєного Кральовства)
* Каролина Ґочева (македонска шпивачка)
* Жилиєт Бинош (французка ґлумица)
Продукт ма велї сертификати и призпознаня шветового ранґу.
== Референци ==
mcj073vhmdol75agdnxbcahiypao9n5
21743
21742
2026-09-18T13:46:43Z
Sveletanka
20
референци и катеґория
21743
wikitext
text/x-wiki
[[File:Охридски бисер.jpg|right|thumb|300px|Охридски бисери (перли)]]Охридски бисер (або охридска перла) єден з препознатлївих символох [[Сиверна Македония|Македониї]] - жеми културних и историйних памятнїкох, природних красотох и богатствох, традициї и квалитету. Гоч Охрид ма велї културни и историйни знаменїтосци, памятнїки и, вшелїяк, [[Охридске озеро]], треба видзиц охридски бисер и одкриц приповедку хтора за нїм стої.<ref> [https://www.klix.ba/lifestyle/putovanja/ohridski-biser-tajna-cuvana-stotinu-godina-koju-znaju-samo-dvije-porodice/200124026 Ohridski biser - tajna čuvana stotinu godina koju znaju samo dvije porodice]. ''www.klix.ba''. Приступљено 18.09.2026.</ref>
== Леґенда о бисеру ==
Далєкого 1928. року, у Охриду, Михайло Филев – син Николе Филева, погосцителя и власнїка карчми „Велька Сербия” – упознал у тим обєкту таїнственого госца по мену Йован Субанович. Йован пришол на Балкан як емиґрант з далєкей Русиї, а до Охриду, у Македониї, пришол зошицким случайно. Док там бул, медзи нїм и Михайлом ше розвило глїбоке приятельство. Раз так, док ше шейтали по побрежю Охридского озера и бешедовали о рижних темох, збачели рибарох – хтори, иншак, були блїзка родзина Михайлови Филевови – як ноша [[Кошар|кошари]] полни з плашицу, єдну файту риби хтора автохтона за Охридске озеро. Потим як присуствовал тей подїї з рибу, Йован похопел же би ше тайна хтору принєсол з Русиї – точнєйше з Байкалског озера – могла одкриц праве ту. Тота тайна ше скривала у риби цо ше вола плашица (позната и як кедер, мала сладководна риба з фамилиї потькох (Cyprinidae), латинскей назви ''Alburnus alburn)'', ендемскей файти чийо ше лупки могло хасновац за виробок бисерох. Так, на знак глїбокого приятельства, Йован упознал пана Михайла Филева з таїнствену схопносцу виробку бисерох. По теди нїхто у Охриду нє знал за таке ''ремесло''.<ref>[https://ohridpearlsserbia.com/istorija-ohridskog-bisera Istorijat Ohridskog Bisera]. ''ohridpearlsserbia.com''. Приступљено18.09.2026.</ref><ref>[https://ohridpearlsserbia.com/tajna-ohridskog-bisera Tajna Ohridskog Bisera]. ''ohridpearlsserbia.com''. Приступљено 18.09.2026.</ref>
После того, фамелия Филев почала правиц бисери и преношиц фамелийну тайну з ґенерациї на ґенерацию – з оца на сина. Як вершински сувенир варошу Охриду и препознатлїви бренд Републики Македониї, тоти бисери украшую шиї и збогацую колекциї прикраскох велїх людзох у Македониї и ширцом швета.<ref> [https://zurnal.politika.rs/scc/clanak/146086/ohridski-biser-brend-grada-ohrida Охридски бисер – бренд града Охрида], ''Спортски журнал'', 26.01.2023. ''zurnal.politika.rs''. Приступљено 18.09.2026. .</ref>
== Продукция ==
Лєм фамелиї Филев и Талев знаю подполну тайну виробку того бисера. Тоти два фамелиї пестую традицию и продукую тото цо познате як „Ориґинални охридски бисер”. Процес у сущносци ручни. Ядро бисера ше достава з водового коритка – точнєйше, з материялу нукашнєй часци шкарупини – хтори ше оформює до рижних формох (як кульки, пацерки и у форми слизи) и велькосци (од F5 до F15). Потим ше зоз лупки риби плашици прави емулзию хтору ше наноши на ядро. Наношенє емулзиї представя найхарактеристичнєйшу часц процесу виробку бисерох. Емулзию ше наноши зоз щеточку з природного материялу – найчастейше зоз шерсци на вивирковим хвосце. Наноши ше вецей раз, у зависносци од велькосци ядра бисера (наприклад, на ядро типу „F5” наноши ше пейц пасма). Ядро ше зохабя док ше нє осуши, а поступок ше повторює. Тота ручна продукция бисерох то поступни процес хтори ше одвива у вецей фазох.
Тоти нови креациї представяю спокусу за младши ґенерацијї у фамелийох же би предлужели длугорочну фамелийну традицию.
'''Познати особи повязани з охридскима бисерами:'''
* Йованка Броз (перша дама Югославиї)
* Даяна (принцеза од Велсу)
* Марґарета II (кралїца Данскей)
* Юлияна (кралїца Голандиї)
* Мария (кралїца Югославиї)
* Дьована (кралїца Болгарскей)
* Вилма Трайковска (перша дама Македониї)
* Елизабета II (кралїца Зєдинєного Кральовства)
* Каролина Ґочева (македонска шпивачка)
* Жилиєт Бинош (французка ґлумица)
Продукт ма велї сертификати и призпознаня шветового ранґу.
== Референци ==
<references />
[[Катеґория:Сиверна Македония]]
6e2wjtsufv2251gxrwysc9wki3ztcf6
Модул:Unicode data
828
3547
21751
21391
2026-09-16T18:07:22Z
Drmccreedy
2744
Update for v18.0
21751
Scribunto
text/plain
local p = {}
local floor = math.floor
local function errorf(level, ...)
if type(level) == "number" then
return error(string.format(...), level + 1)
else -- level is actually the format string.
return error(string.format(level, ...), 2)
end
end
local function binary_range_search(codepoint, ranges)
local low, mid, high
low, high = 1, ranges.length or require "Module:TableTools".length(ranges)
while low <= high do
mid = floor((low + high) / 2)
local range = ranges[mid]
if codepoint < range[1] then
high = mid - 1
elseif codepoint <= range[2] then
return range, mid
else
low = mid + 1
end
end
return nil, mid
end
p.binary_range_search = binary_range_search
--[[
local function linear_range_search(codepoint, ranges)
for i, range in ipairs(ranges) do
if range[1] <= codepoint and codepoint <= range[2] then
return range
end
end
end
--]]
-- Load a module by indexing "loader" with the name of the module minus the
-- "Module:Unicode data/" part. For instance, loader.blocks returns
-- [[Module:Unicode data/blocks]]. If a module cannot be loaded, false will be
-- returned.
local loader = setmetatable({}, {
__index = function (self, key)
local success, data = pcall(mw.loadData, "Module:Unicode data/" .. key)
if not success then
data = false
end
self[key] = data
return data
end
})
-- For the algorithm used to generate Hangul Syllable names,
-- see "Hangul Syllable Name Generation" in section 3.12 of the
-- Unicode Specification:
-- https://www.unicode.org/versions/Unicode11.0.0/ch03.pdf
-- binary_range_search assumes these are ordered by codepoint. Do not place them in a random order!
local name_hooks = {
{ 0x00, 0x1F, "<control-%04X>" }, -- C0 control characters
{ 0x7F, 0x9F, "<control-%04X>" }, -- DEL and C1 control characters
{ 0x3400, 0x4DBF, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension A
{ 0x4E00, 0x9FFF, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph
{ 0xAC00, 0xD7A3, function (codepoint) -- Hangul Syllables
local Hangul_data = loader.Hangul
local syllable_index = codepoint - 0xAC00
return ("HANGUL SYLLABLE %s%s%s"):format(
Hangul_data.leads[floor(syllable_index / Hangul_data.final_count)],
Hangul_data.vowels[floor((syllable_index % Hangul_data.final_count)
/ Hangul_data.trail_count)],
Hangul_data.trails[syllable_index % Hangul_data.trail_count]
)
end },
-- High Surrogates, High Private Use Surrogates, Low Surrogates
{ 0xD800, 0xDFFF, "<surrogate-%04X>" },
{ 0xE000, 0xF8FF, "<private-use-%04X>" }, -- Private Use
-- CJK Compatibility Ideographs
{ 0xF900, 0xFA6D, "CJK COMPATIBILITY IDEOGRAPH-%04X" },
{ 0xFA70, 0xFAD9, "CJK COMPATIBILITY IDEOGRAPH-%04X" },
{ 0xFE00, 0xFE0F, function (codepoint) -- Variation Selectors
return ("VARIATION SELECTOR-%d"):format(codepoint - 0xFE00 + 1)
end},
{ 0x13460, 0x143FA, "EGYPTIAN HIEROGLYPH-%04X" }, -- Egyptian Hieroglyphs Extended-A
{ 0x17000, 0x187FF, "TANGUT IDEOGRAPH-%04X" }, -- Tangut Ideograph
{ 0x18800, 0x18AFF, function (codepoint)
return ("TANGUT COMPONENT-%03d"):format(codepoint - 0x187FF)
end },
{ 0x18B00, 0x18CDA, "KHITAN SMALL SCRIPT CHARACTER-%04X" }, -- Khitan Small Script
{ 0x18CFF, 0x18CFF, "KHITAN SMALL SCRIPT CHARACTER-%04X" }, -- Khitan Small Script
{ 0x18D00, 0x18D20, "TANGUT IDEOGRAPH-%04X" }, -- Tangut Ideograph Supplement
{ 0x18D80, 0x18DF2, function (codepoint)
return ("TANGUT COMPONENT-%03d"):format(codepoint - 0x18A7F)
end },
{ 0x18E00, 0x19191, "JURCHEN IDEOGRAPH-%04X" }, -- Jurchen
{ 0x1B170, 0x1B2FB, "NUSHU CHARACTER-%04X" }, -- Nushu
{ 0x20000, 0x2A6DF, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension B
{ 0x2A700, 0x2B81E, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension C, D
{ 0x2B820, 0x2CEAD, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension E
{ 0x2CEB0, 0x2EBE0, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension F
{ 0x2EBF0, 0x2EE5D, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension I
{ 0x2F800, 0x2FA1D, "CJK COMPATIBILITY IDEOGRAPH-%04X" }, -- CJK Compatibility Ideographs Supplement (Supplementary Ideographic Plane)
{ 0x30000, 0x3134A, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension G
{ 0x31350, 0x33479, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension H, J
{ 0x3D000, 0x3FC3F, "SMALL SEAL CHARACTER-%04X" }, -- Seal
{ 0xE0100, 0xE01EF, function (codepoint) -- Variation Selectors Supplement
return ("VARIATION SELECTOR-%d"):format(codepoint - 0xE0100 + 17)
end},
{ 0xF0000, 0xFFFFD, "<private-use-%04X>" }, -- Plane 15 Private Use
{ 0x100000, 0x10FFFD, "<private-use-%04X>" } -- Plane 16 Private Use
}
name_hooks.length = #name_hooks
local name_range_cache
local function generate_name(data, codepoint)
if type(data) == "string" then
return data:format(codepoint)
else
return data(codepoint)
end
end
--[[
-- Checks that the code point is a number and in range.
-- Does not check whether code point is an integer.
-- Not used
local function check_codepoint(funcName, argIdx, val)
require 'libraryUtil'.checkType(funcName, argIdx, val, 'number')
if codepoint < 0 or 0x10FFFF < codepoint then
errorf("Codepoint %04X out of range", codepoint)
end
end
--]]
function p.is_noncharacter(codepoint)
-- U+FDD0-U+FDEF and all code points ending in FFFE or FFFF are Unassigned
-- (Cn) and specifically noncharacters:
-- https://www.unicode.org/faq/private_use.html#nonchar4
return 0xFDD0 <= codepoint and (codepoint <= 0xFDEF
or floor(codepoint % 0x10000) >= 0xFFFE)
end
-- https://www.unicode.org/versions/Unicode11.0.0/ch04.pdf, section 4.8
function p.lookup_name(codepoint)
if p.is_noncharacter(codepoint) then
return ("<noncharacter-%04X>"):format(codepoint)
end
if name_range_cache -- Check if previously used "name hook" applies to this code point.
and codepoint >= name_range_cache[1]
and codepoint <= name_range_cache[2] then
return generate_name(name_range_cache[3], codepoint)
end
local range = binary_range_search(codepoint, name_hooks)
if range then
name_range_cache = range
return generate_name(range[3], codepoint)
end
local data = loader[('names/%03X'):format(codepoint / 0x1000)]
if data and data[codepoint] then
return data[codepoint]
-- Unassigned (Cn) consists of noncharacters and reserved characters.
-- The character has been established not to be a noncharacter,
-- and if it were assigned, its name would already been retrieved,
-- so it must be reserved.
else
return ("<reserved-%04X>"):format(codepoint)
end
end
function p.lookup_image(codepoint)
local data = loader[('images/%03X'):format(codepoint / 0x1000)]
if data then
return data[codepoint]
end
end
local planes = {
[ 0] = "Basic Multilingual Plane";
[ 1] = "Supplementary Multilingual Plane";
[ 2] = "Supplementary Ideographic Plane";
[ 3] = "Tertiary Ideographic Plane";
[14] = "Supplementary Special-purpose Plane";
[15] = "Supplementary Private Use Area-A";
[16] = "Supplementary Private Use Area-B";
}
-- Load [[Module:Unicode data/blocks]] if needed and assign it to this variable.
local blocks
local function block_iter(blocks, i)
i = i + 1
local data = blocks[i]
if data then
-- Unpack doesn't work on tables loaded with mw.loadData.
return i, data[1], data[2], data[3]
end
end
-- An ipairs-type iterator generator for the list of blocks.
function p.enum_blocks()
local blocks = loader.blocks
return block_iter, blocks, 0
end
function p.lookup_plane(codepoint)
local i = floor(codepoint / 0x10000)
return planes[i] or ("Plane %u"):format(i)
end
function p.lookup_block(codepoint)
local blocks = loader.blocks
local range = binary_range_search(codepoint, blocks)
if range then
return range[3]
else
return "No Block"
end
end
function p.get_block_info(name)
for i, block in ipairs(loader.blocks) do
if block[3] == name then
return block
end
end
end
function p.is_valid_pagename(pagename)
local has_nonws = false
for cp in mw.ustring.gcodepoint(pagename) do
if (cp == 0x0023) -- #
or (cp == 0x005B) -- [
or (cp == 0x005D) -- ]
or (cp == 0x007B) -- {
or (cp == 0x007C) -- |
or (cp == 0x007D) -- }
or (cp == 0x180E) -- MONGOLIAN VOWEL SEPARATOR
or ((cp >= 0x2000) and (cp <= 0x200A)) -- spaces in General Punctuation block
or (cp == 0xFFFD) -- REPLACEMENT CHARACTER
then
return false
end
local printable, result = p.is_printable(cp)
if not printable then
return false
end
if result ~= "space-separator" then
has_nonws = true
end
end
return has_nonws
end
local function manual_unpack(what, from)
if what[from + 1] == nil then
return what[from]
end
local result = {}
from = from or 1
for i, item in ipairs(what) do
if i >= from then
table.insert(result, item)
end
end
return unpack(result)
end
local function compare_ranges(range1, range2)
return range1[1] < range2[1]
end
-- Creates a function to look up data in a module that contains "singles" (a
-- code point-to-data map) and "ranges" (an array containing arrays that contain
-- the low and high code points of a range and the data associated with that
-- range).
-- "loader" loads and returns the "singles" and "ranges" tables.
-- "match_func" is passed the code point and either the data or the "dots", and
-- generates the final result of the function.
-- The varargs ("dots") describes the default data to be returned if there wasn't
-- a match.
-- In case the function is used more than once, "cache" saves ranges that have
-- already been found to match, or a range whose data is the default if there
-- was no match.
local function memo_lookup(data_module_subpage, match_func, ...)
local dots = { ... }
local cache = {}
local singles, ranges
return function (codepoint)
if not singles then
local data_module = loader[data_module_subpage]
singles, ranges = data_module.singles, data_module.ranges
end
if singles[codepoint] then
return match_func(codepoint, singles[codepoint])
end
local range = binary_range_search(codepoint, cache)
if range then
return match_func(codepoint, manual_unpack(range, 3))
end
local range, index = binary_range_search(codepoint, ranges)
if range then
table.insert(cache, range)
table.sort(cache, compare_ranges)
return match_func(codepoint, manual_unpack(range, 3))
end
if ranges[index] then
local dots_range
if codepoint > ranges[index][2] then
dots_range = {
ranges[index][2] + 1,
ranges[index + 1] and ranges[index + 1][1] - 1 or 0x10FFFF,
unpack(dots)
}
else -- codepoint < range[index][1]
dots_range = {
ranges[index - 1] and ranges[index - 1][2] + 1 or 0,
ranges[index][1] - 1,
unpack(dots)
}
end
table.sort(cache, compare_ranges)
end
return match_func(codepoint)
end
end
-- Get a code point's combining class value in [[Module:Unicode data/combining]],
-- and return whether this value is not zero. Zero is assigned as the default
-- if the combining class value is not found in this data module.
-- That is, return true if character is combining, or false if it is not.
-- See https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values for
-- more information.
p.is_combining = memo_lookup(
"combining",
function (codepoint, combining_class)
return combining_class and combining_class ~= 0 or false
end,
0)
function p.add_dotted_circle(str)
return (mw.ustring.gsub(str, ".",
function(char)
if p.is_combining(mw.ustring.codepoint(char)) then
return '◌' .. char
end
end))
end
local lookup_control = memo_lookup(
"control",
function (codepoint, ccc)
return ccc or "assigned"
end,
"assigned")
p.lookup_control = lookup_control
function p.is_assigned(codepoint)
return lookup_control(codepoint) ~= "unassigned"
end
function p.is_printable(codepoint)
local result = lookup_control(codepoint)
return (result == "assigned") or (result == "space-separator"), result
end
function p.is_whitespace(codepoint)
local result = lookup_control(codepoint)
return (result == "space-separator"), result
end
p.lookup_category = memo_lookup(
"category",
function (codepoint, category)
return category
end,
"Cn")
local lookup_script = memo_lookup(
"scripts",
function (codepoint, script_code)
return script_code or 'Zzzz'
end,
"Zzzz")
p.lookup_script = lookup_script
function p.get_best_script(str)
-- Check type of argument, because mw.text.decode coerces numbers to strings!
require "libraryUtil".checkType("get_best_script", 1, str, "string")
-- Convert HTML character references (including named character references,
-- or character entities) to characters.
str = mw.text.decode(str, true)
local scripts = {}
for codepoint in mw.ustring.gcodepoint(str) do
local script = lookup_script(codepoint)
-- Ignore "Inherited", "Undetermined", or "Uncoded" scripts.
if not (script == "Zyyy" or script == "Zinh" or script == "Zzzz") then
scripts[script] = true
end
end
-- If scripts does not contain two or more keys,
-- return first and only key (script code) in table.
if not next(scripts, next(scripts)) then
return next(scripts)
end -- else return majority script, or else "Zzzz"?
end
function p.is_Latin(str)
require "libraryUtil".checkType("get_best_script", 1, str, "string")
str = mw.text.decode(str, true)
-- Search for the leading bytes that introduce the UTF-8 encoding of the
-- code points U+0340-U+10FFFF. If they are not found and there is at least
-- one Latin-script character, the string counts as Latin, because the rest
-- of the characters can only be Zyyy, Zinh, and Zzzz.
-- The only scripts found below U+0370 (the first code point of the Greek
-- and Coptic block) are Latn, Zyyy, Zinh, and Zzzz.
-- See the codepage in the [[UTF-8]] article.
if not str:find "[\205-\244]" then
for codepoint in mw.ustring.gcodepoint(str) do
if lookup_script(codepoint) == "Latn" then
return true
end
end
end
local Latn = false
local i = 0; -- indexer for use in error messages
for codepoint in mw.ustring.gcodepoint(str) do
i = i + 1; -- bump the indexer
local script = lookup_script(codepoint)
if script == "Latn" then
Latn = true
elseif not (script == "Zyyy" or script == "Zinh"
or script == "Zzzz") then
return false, i -- abandon as not Latn; identify the offending character's position
end
end
return Latn, (not Latn and i) or nil -- when <Latn> false, return offending charactor's position as second return value; nil else
end
-- Checks that a string contains only characters belonging to right-to-left
-- scripts, or characters of ignorable scripts.
function p.is_rtl(str)
require "libraryUtil".checkType("get_best_script", 1, str, "string")
str = mw.text.decode(str, true)
-- Search for the leading bytes that introduce the UTF-8 encoding of the
-- code points U+0580-U+10FFFF. If they are not found, the string can only
-- have characters from a left-to-right script, because the first code point
-- in a right-to-left script is U+0591, in the Hebrew block.
if not str:find "[\214-\244]" then
return false
end
local result = false
local rtl = loader.scripts.rtl
for codepoint in mw.ustring.gcodepoint(str) do
local script = lookup_script(codepoint)
if rtl[script] then
result = true
elseif not (script == "Zyyy" or script == "Zinh"
or script == "Zzzz") then
return false
end
end
return result
end
--[[--------------------------< I S _ R T L _ F R A M E >------------------------------------------------------
external entry from an {{#invoke:}} to determine if a string of text is rtl. Strips html and html-like tags so
that those tags don't corrupt the is-rtl-is-not-rtl determination; this added for the cases where the rtl text
has <br /> tags.
]]
function p.is_rtl_frame (frame)
local str = frame.args[1]; -- get the string from the {{#invoke:}} frame
str = str:gsub ('%b<>', ''); -- strip any html and html-like tags
return p.is_rtl (str); -- return if whatever remains rtl; false else
end
local function get_codepoint(args, arg)
local codepoint_string = args[arg]
or errorf(2, "Parameter %s is required", tostring(arg))
local codepoint = tonumber(codepoint_string, 16)
or errorf(2, "Parameter %s is not a code point in hexadecimal base",
tostring(arg))
if not (0 <= codepoint and codepoint <= 0x10FFFF) then
errorf(2, "code point in parameter %s out of range", tostring(arg))
end
return codepoint
end
local function get_func(args, arg, prefix)
local suffix = args[arg]
or errorf(2, "Parameter %s is required", tostring(arg))
suffix = mw.text.trim(suffix)
local func_name = prefix .. suffix
local func = p[func_name]
or errorf(2, "There is no function '%s'", func_name)
return func
end
-- This function allows any of the "lookup" functions to be invoked. The first
-- parameter is the word after "lookup_"; the second parameter is the code point
-- in hexadecimal base.
function p.lookup(frame)
local func = get_func(frame.args, 1, "lookup_")
local codepoint = get_codepoint(frame.args, 2)
local result = func(codepoint)
if func == p.lookup_name then
-- Prevent code point labels such as <control-0000> from being
-- interpreted as HTML tags.
result = result:gsub("<", "<")
end
return result
end
function p.is(frame)
local func = get_func(frame.args, 1, "is_")
-- is_Latin and is_valid_pagename take strings.
if func == p.is_Latin or func == p.is_valid_pagename or func == p.is_rtl then
return (func(frame.args[2]))
else -- The rest take code points.
local codepoint = get_codepoint(frame.args, 2)
return (func(codepoint)) -- Adjust to one result.
end
end
function p.lookup_kCantonese(codepoint)
local data = loader[('Unihan/kCantonese/%02X'):format(floor(codepoint / 0x1000))]
if data then
return data[codepoint]
end
end
return p
qsurfs20jboj5ejuj5ps85xjotbbrt3
21752
21751
2026-09-18T15:05:25Z
Keresturec
18
1 измена увезена из [[:en:Module:Unicode_data]]: Importing from the English wikipedia
21751
Scribunto
text/plain
local p = {}
local floor = math.floor
local function errorf(level, ...)
if type(level) == "number" then
return error(string.format(...), level + 1)
else -- level is actually the format string.
return error(string.format(level, ...), 2)
end
end
local function binary_range_search(codepoint, ranges)
local low, mid, high
low, high = 1, ranges.length or require "Module:TableTools".length(ranges)
while low <= high do
mid = floor((low + high) / 2)
local range = ranges[mid]
if codepoint < range[1] then
high = mid - 1
elseif codepoint <= range[2] then
return range, mid
else
low = mid + 1
end
end
return nil, mid
end
p.binary_range_search = binary_range_search
--[[
local function linear_range_search(codepoint, ranges)
for i, range in ipairs(ranges) do
if range[1] <= codepoint and codepoint <= range[2] then
return range
end
end
end
--]]
-- Load a module by indexing "loader" with the name of the module minus the
-- "Module:Unicode data/" part. For instance, loader.blocks returns
-- [[Module:Unicode data/blocks]]. If a module cannot be loaded, false will be
-- returned.
local loader = setmetatable({}, {
__index = function (self, key)
local success, data = pcall(mw.loadData, "Module:Unicode data/" .. key)
if not success then
data = false
end
self[key] = data
return data
end
})
-- For the algorithm used to generate Hangul Syllable names,
-- see "Hangul Syllable Name Generation" in section 3.12 of the
-- Unicode Specification:
-- https://www.unicode.org/versions/Unicode11.0.0/ch03.pdf
-- binary_range_search assumes these are ordered by codepoint. Do not place them in a random order!
local name_hooks = {
{ 0x00, 0x1F, "<control-%04X>" }, -- C0 control characters
{ 0x7F, 0x9F, "<control-%04X>" }, -- DEL and C1 control characters
{ 0x3400, 0x4DBF, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension A
{ 0x4E00, 0x9FFF, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph
{ 0xAC00, 0xD7A3, function (codepoint) -- Hangul Syllables
local Hangul_data = loader.Hangul
local syllable_index = codepoint - 0xAC00
return ("HANGUL SYLLABLE %s%s%s"):format(
Hangul_data.leads[floor(syllable_index / Hangul_data.final_count)],
Hangul_data.vowels[floor((syllable_index % Hangul_data.final_count)
/ Hangul_data.trail_count)],
Hangul_data.trails[syllable_index % Hangul_data.trail_count]
)
end },
-- High Surrogates, High Private Use Surrogates, Low Surrogates
{ 0xD800, 0xDFFF, "<surrogate-%04X>" },
{ 0xE000, 0xF8FF, "<private-use-%04X>" }, -- Private Use
-- CJK Compatibility Ideographs
{ 0xF900, 0xFA6D, "CJK COMPATIBILITY IDEOGRAPH-%04X" },
{ 0xFA70, 0xFAD9, "CJK COMPATIBILITY IDEOGRAPH-%04X" },
{ 0xFE00, 0xFE0F, function (codepoint) -- Variation Selectors
return ("VARIATION SELECTOR-%d"):format(codepoint - 0xFE00 + 1)
end},
{ 0x13460, 0x143FA, "EGYPTIAN HIEROGLYPH-%04X" }, -- Egyptian Hieroglyphs Extended-A
{ 0x17000, 0x187FF, "TANGUT IDEOGRAPH-%04X" }, -- Tangut Ideograph
{ 0x18800, 0x18AFF, function (codepoint)
return ("TANGUT COMPONENT-%03d"):format(codepoint - 0x187FF)
end },
{ 0x18B00, 0x18CDA, "KHITAN SMALL SCRIPT CHARACTER-%04X" }, -- Khitan Small Script
{ 0x18CFF, 0x18CFF, "KHITAN SMALL SCRIPT CHARACTER-%04X" }, -- Khitan Small Script
{ 0x18D00, 0x18D20, "TANGUT IDEOGRAPH-%04X" }, -- Tangut Ideograph Supplement
{ 0x18D80, 0x18DF2, function (codepoint)
return ("TANGUT COMPONENT-%03d"):format(codepoint - 0x18A7F)
end },
{ 0x18E00, 0x19191, "JURCHEN IDEOGRAPH-%04X" }, -- Jurchen
{ 0x1B170, 0x1B2FB, "NUSHU CHARACTER-%04X" }, -- Nushu
{ 0x20000, 0x2A6DF, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension B
{ 0x2A700, 0x2B81E, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension C, D
{ 0x2B820, 0x2CEAD, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension E
{ 0x2CEB0, 0x2EBE0, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension F
{ 0x2EBF0, 0x2EE5D, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension I
{ 0x2F800, 0x2FA1D, "CJK COMPATIBILITY IDEOGRAPH-%04X" }, -- CJK Compatibility Ideographs Supplement (Supplementary Ideographic Plane)
{ 0x30000, 0x3134A, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension G
{ 0x31350, 0x33479, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension H, J
{ 0x3D000, 0x3FC3F, "SMALL SEAL CHARACTER-%04X" }, -- Seal
{ 0xE0100, 0xE01EF, function (codepoint) -- Variation Selectors Supplement
return ("VARIATION SELECTOR-%d"):format(codepoint - 0xE0100 + 17)
end},
{ 0xF0000, 0xFFFFD, "<private-use-%04X>" }, -- Plane 15 Private Use
{ 0x100000, 0x10FFFD, "<private-use-%04X>" } -- Plane 16 Private Use
}
name_hooks.length = #name_hooks
local name_range_cache
local function generate_name(data, codepoint)
if type(data) == "string" then
return data:format(codepoint)
else
return data(codepoint)
end
end
--[[
-- Checks that the code point is a number and in range.
-- Does not check whether code point is an integer.
-- Not used
local function check_codepoint(funcName, argIdx, val)
require 'libraryUtil'.checkType(funcName, argIdx, val, 'number')
if codepoint < 0 or 0x10FFFF < codepoint then
errorf("Codepoint %04X out of range", codepoint)
end
end
--]]
function p.is_noncharacter(codepoint)
-- U+FDD0-U+FDEF and all code points ending in FFFE or FFFF are Unassigned
-- (Cn) and specifically noncharacters:
-- https://www.unicode.org/faq/private_use.html#nonchar4
return 0xFDD0 <= codepoint and (codepoint <= 0xFDEF
or floor(codepoint % 0x10000) >= 0xFFFE)
end
-- https://www.unicode.org/versions/Unicode11.0.0/ch04.pdf, section 4.8
function p.lookup_name(codepoint)
if p.is_noncharacter(codepoint) then
return ("<noncharacter-%04X>"):format(codepoint)
end
if name_range_cache -- Check if previously used "name hook" applies to this code point.
and codepoint >= name_range_cache[1]
and codepoint <= name_range_cache[2] then
return generate_name(name_range_cache[3], codepoint)
end
local range = binary_range_search(codepoint, name_hooks)
if range then
name_range_cache = range
return generate_name(range[3], codepoint)
end
local data = loader[('names/%03X'):format(codepoint / 0x1000)]
if data and data[codepoint] then
return data[codepoint]
-- Unassigned (Cn) consists of noncharacters and reserved characters.
-- The character has been established not to be a noncharacter,
-- and if it were assigned, its name would already been retrieved,
-- so it must be reserved.
else
return ("<reserved-%04X>"):format(codepoint)
end
end
function p.lookup_image(codepoint)
local data = loader[('images/%03X'):format(codepoint / 0x1000)]
if data then
return data[codepoint]
end
end
local planes = {
[ 0] = "Basic Multilingual Plane";
[ 1] = "Supplementary Multilingual Plane";
[ 2] = "Supplementary Ideographic Plane";
[ 3] = "Tertiary Ideographic Plane";
[14] = "Supplementary Special-purpose Plane";
[15] = "Supplementary Private Use Area-A";
[16] = "Supplementary Private Use Area-B";
}
-- Load [[Module:Unicode data/blocks]] if needed and assign it to this variable.
local blocks
local function block_iter(blocks, i)
i = i + 1
local data = blocks[i]
if data then
-- Unpack doesn't work on tables loaded with mw.loadData.
return i, data[1], data[2], data[3]
end
end
-- An ipairs-type iterator generator for the list of blocks.
function p.enum_blocks()
local blocks = loader.blocks
return block_iter, blocks, 0
end
function p.lookup_plane(codepoint)
local i = floor(codepoint / 0x10000)
return planes[i] or ("Plane %u"):format(i)
end
function p.lookup_block(codepoint)
local blocks = loader.blocks
local range = binary_range_search(codepoint, blocks)
if range then
return range[3]
else
return "No Block"
end
end
function p.get_block_info(name)
for i, block in ipairs(loader.blocks) do
if block[3] == name then
return block
end
end
end
function p.is_valid_pagename(pagename)
local has_nonws = false
for cp in mw.ustring.gcodepoint(pagename) do
if (cp == 0x0023) -- #
or (cp == 0x005B) -- [
or (cp == 0x005D) -- ]
or (cp == 0x007B) -- {
or (cp == 0x007C) -- |
or (cp == 0x007D) -- }
or (cp == 0x180E) -- MONGOLIAN VOWEL SEPARATOR
or ((cp >= 0x2000) and (cp <= 0x200A)) -- spaces in General Punctuation block
or (cp == 0xFFFD) -- REPLACEMENT CHARACTER
then
return false
end
local printable, result = p.is_printable(cp)
if not printable then
return false
end
if result ~= "space-separator" then
has_nonws = true
end
end
return has_nonws
end
local function manual_unpack(what, from)
if what[from + 1] == nil then
return what[from]
end
local result = {}
from = from or 1
for i, item in ipairs(what) do
if i >= from then
table.insert(result, item)
end
end
return unpack(result)
end
local function compare_ranges(range1, range2)
return range1[1] < range2[1]
end
-- Creates a function to look up data in a module that contains "singles" (a
-- code point-to-data map) and "ranges" (an array containing arrays that contain
-- the low and high code points of a range and the data associated with that
-- range).
-- "loader" loads and returns the "singles" and "ranges" tables.
-- "match_func" is passed the code point and either the data or the "dots", and
-- generates the final result of the function.
-- The varargs ("dots") describes the default data to be returned if there wasn't
-- a match.
-- In case the function is used more than once, "cache" saves ranges that have
-- already been found to match, or a range whose data is the default if there
-- was no match.
local function memo_lookup(data_module_subpage, match_func, ...)
local dots = { ... }
local cache = {}
local singles, ranges
return function (codepoint)
if not singles then
local data_module = loader[data_module_subpage]
singles, ranges = data_module.singles, data_module.ranges
end
if singles[codepoint] then
return match_func(codepoint, singles[codepoint])
end
local range = binary_range_search(codepoint, cache)
if range then
return match_func(codepoint, manual_unpack(range, 3))
end
local range, index = binary_range_search(codepoint, ranges)
if range then
table.insert(cache, range)
table.sort(cache, compare_ranges)
return match_func(codepoint, manual_unpack(range, 3))
end
if ranges[index] then
local dots_range
if codepoint > ranges[index][2] then
dots_range = {
ranges[index][2] + 1,
ranges[index + 1] and ranges[index + 1][1] - 1 or 0x10FFFF,
unpack(dots)
}
else -- codepoint < range[index][1]
dots_range = {
ranges[index - 1] and ranges[index - 1][2] + 1 or 0,
ranges[index][1] - 1,
unpack(dots)
}
end
table.sort(cache, compare_ranges)
end
return match_func(codepoint)
end
end
-- Get a code point's combining class value in [[Module:Unicode data/combining]],
-- and return whether this value is not zero. Zero is assigned as the default
-- if the combining class value is not found in this data module.
-- That is, return true if character is combining, or false if it is not.
-- See https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values for
-- more information.
p.is_combining = memo_lookup(
"combining",
function (codepoint, combining_class)
return combining_class and combining_class ~= 0 or false
end,
0)
function p.add_dotted_circle(str)
return (mw.ustring.gsub(str, ".",
function(char)
if p.is_combining(mw.ustring.codepoint(char)) then
return '◌' .. char
end
end))
end
local lookup_control = memo_lookup(
"control",
function (codepoint, ccc)
return ccc or "assigned"
end,
"assigned")
p.lookup_control = lookup_control
function p.is_assigned(codepoint)
return lookup_control(codepoint) ~= "unassigned"
end
function p.is_printable(codepoint)
local result = lookup_control(codepoint)
return (result == "assigned") or (result == "space-separator"), result
end
function p.is_whitespace(codepoint)
local result = lookup_control(codepoint)
return (result == "space-separator"), result
end
p.lookup_category = memo_lookup(
"category",
function (codepoint, category)
return category
end,
"Cn")
local lookup_script = memo_lookup(
"scripts",
function (codepoint, script_code)
return script_code or 'Zzzz'
end,
"Zzzz")
p.lookup_script = lookup_script
function p.get_best_script(str)
-- Check type of argument, because mw.text.decode coerces numbers to strings!
require "libraryUtil".checkType("get_best_script", 1, str, "string")
-- Convert HTML character references (including named character references,
-- or character entities) to characters.
str = mw.text.decode(str, true)
local scripts = {}
for codepoint in mw.ustring.gcodepoint(str) do
local script = lookup_script(codepoint)
-- Ignore "Inherited", "Undetermined", or "Uncoded" scripts.
if not (script == "Zyyy" or script == "Zinh" or script == "Zzzz") then
scripts[script] = true
end
end
-- If scripts does not contain two or more keys,
-- return first and only key (script code) in table.
if not next(scripts, next(scripts)) then
return next(scripts)
end -- else return majority script, or else "Zzzz"?
end
function p.is_Latin(str)
require "libraryUtil".checkType("get_best_script", 1, str, "string")
str = mw.text.decode(str, true)
-- Search for the leading bytes that introduce the UTF-8 encoding of the
-- code points U+0340-U+10FFFF. If they are not found and there is at least
-- one Latin-script character, the string counts as Latin, because the rest
-- of the characters can only be Zyyy, Zinh, and Zzzz.
-- The only scripts found below U+0370 (the first code point of the Greek
-- and Coptic block) are Latn, Zyyy, Zinh, and Zzzz.
-- See the codepage in the [[UTF-8]] article.
if not str:find "[\205-\244]" then
for codepoint in mw.ustring.gcodepoint(str) do
if lookup_script(codepoint) == "Latn" then
return true
end
end
end
local Latn = false
local i = 0; -- indexer for use in error messages
for codepoint in mw.ustring.gcodepoint(str) do
i = i + 1; -- bump the indexer
local script = lookup_script(codepoint)
if script == "Latn" then
Latn = true
elseif not (script == "Zyyy" or script == "Zinh"
or script == "Zzzz") then
return false, i -- abandon as not Latn; identify the offending character's position
end
end
return Latn, (not Latn and i) or nil -- when <Latn> false, return offending charactor's position as second return value; nil else
end
-- Checks that a string contains only characters belonging to right-to-left
-- scripts, or characters of ignorable scripts.
function p.is_rtl(str)
require "libraryUtil".checkType("get_best_script", 1, str, "string")
str = mw.text.decode(str, true)
-- Search for the leading bytes that introduce the UTF-8 encoding of the
-- code points U+0580-U+10FFFF. If they are not found, the string can only
-- have characters from a left-to-right script, because the first code point
-- in a right-to-left script is U+0591, in the Hebrew block.
if not str:find "[\214-\244]" then
return false
end
local result = false
local rtl = loader.scripts.rtl
for codepoint in mw.ustring.gcodepoint(str) do
local script = lookup_script(codepoint)
if rtl[script] then
result = true
elseif not (script == "Zyyy" or script == "Zinh"
or script == "Zzzz") then
return false
end
end
return result
end
--[[--------------------------< I S _ R T L _ F R A M E >------------------------------------------------------
external entry from an {{#invoke:}} to determine if a string of text is rtl. Strips html and html-like tags so
that those tags don't corrupt the is-rtl-is-not-rtl determination; this added for the cases where the rtl text
has <br /> tags.
]]
function p.is_rtl_frame (frame)
local str = frame.args[1]; -- get the string from the {{#invoke:}} frame
str = str:gsub ('%b<>', ''); -- strip any html and html-like tags
return p.is_rtl (str); -- return if whatever remains rtl; false else
end
local function get_codepoint(args, arg)
local codepoint_string = args[arg]
or errorf(2, "Parameter %s is required", tostring(arg))
local codepoint = tonumber(codepoint_string, 16)
or errorf(2, "Parameter %s is not a code point in hexadecimal base",
tostring(arg))
if not (0 <= codepoint and codepoint <= 0x10FFFF) then
errorf(2, "code point in parameter %s out of range", tostring(arg))
end
return codepoint
end
local function get_func(args, arg, prefix)
local suffix = args[arg]
or errorf(2, "Parameter %s is required", tostring(arg))
suffix = mw.text.trim(suffix)
local func_name = prefix .. suffix
local func = p[func_name]
or errorf(2, "There is no function '%s'", func_name)
return func
end
-- This function allows any of the "lookup" functions to be invoked. The first
-- parameter is the word after "lookup_"; the second parameter is the code point
-- in hexadecimal base.
function p.lookup(frame)
local func = get_func(frame.args, 1, "lookup_")
local codepoint = get_codepoint(frame.args, 2)
local result = func(codepoint)
if func == p.lookup_name then
-- Prevent code point labels such as <control-0000> from being
-- interpreted as HTML tags.
result = result:gsub("<", "<")
end
return result
end
function p.is(frame)
local func = get_func(frame.args, 1, "is_")
-- is_Latin and is_valid_pagename take strings.
if func == p.is_Latin or func == p.is_valid_pagename or func == p.is_rtl then
return (func(frame.args[2]))
else -- The rest take code points.
local codepoint = get_codepoint(frame.args, 2)
return (func(codepoint)) -- Adjust to one result.
end
end
function p.lookup_kCantonese(codepoint)
local data = loader[('Unihan/kCantonese/%02X'):format(floor(codepoint / 0x1000))]
if data then
return data[codepoint]
end
end
return p
qsurfs20jboj5ejuj5ps85xjotbbrt3
Шаблон:Sister project/styles.css
10
3608
21891
21619
2026-09-15T01:14:19Z
Axolitl
2782
21891
sanitized-css
text/css
/* {{pp-template|small=yes}} */
@media print {
body.ns-0 .sistersitebox {
display: none !important;
}
}
/* Special Wiktionary logo styling on dark mode */
@media screen {
html.skin-theme-clientpref-night .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"] {
filter: invert(1) brightness(55%) contrast(250%) hue-rotate(180deg);
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"] {
filter: invert(1) brightness(55%) contrast(250%) hue-rotate(180deg);
}
}
gpcjphquwjpr7um4t83mou92rbkmknt
21892
21891
2026-09-18T15:05:31Z
Keresturec
18
1 измена увезена из [[:en:Template:Sister_project/styles.css]]: Importing from the English wikipedia
21891
sanitized-css
text/css
/* {{pp-template|small=yes}} */
@media print {
body.ns-0 .sistersitebox {
display: none !important;
}
}
/* Special Wiktionary logo styling on dark mode */
@media screen {
html.skin-theme-clientpref-night .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"] {
filter: invert(1) brightness(55%) contrast(250%) hue-rotate(180deg);
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .sistersitebox img[src*="Wiktionary-logo-en-v2.svg"] {
filter: invert(1) brightness(55%) contrast(250%) hue-rotate(180deg);
}
}
gpcjphquwjpr7um4t83mou92rbkmknt
Главата апаца
0
3630
21746
21721
2026-09-18T13:55:39Z
Sveletanka
20
катеґория
21746
wikitext
text/x-wiki
{{Животинї
| Назва = Главата апаца
| Латинска назва =
| Слика =Lymantria dispar MHNT.CUT.2012.0.357 Col de Cricheto Bastelica male Dos.jpg
| Опис_слики = ''Lymantria dispar''
| Статус_очуваня = [[File:Status zahrozenosci (kategoriji), 26032026.png|250px]] <br />Файта зоз малу вироятносцу же будзе загрожена = ознака критериюма '''LC'''
| Домен =
| Царство = [[Животинї]] (Animalia)
| Кладус1 =
| Кладус2 =
| Дивизия = Arthropoda
| Подколєно =
| Класа = Insecta
| Подкласа =
| Ряд = Lepidoptera
| Надфамилия = Noctuoidea
| Фамилия = Erebidae
| Подфамилия =
| Род = ''Lymantria''
| Файта = L. dispar
| Подфайта =
| Биномне_мено = Lymantria dispar <br />([[Карл фон Лине|Linneus]], 1758)
| Слика розпрестартосци =
| Опис_розпрестартосци =
| Синоними = Phalaena dispar Linnaeus, 1758 <br />Ocneria dispar (Linnaeus, 1758) <br />Porthetria dispar (Linnaeus, 1758)
}}
'''Главата апаца''' (лат. ''Lymantria dispar'', серб. ''ґубар'', анґл. ''gypsy'' ''moth,'' у ЗАД познати як ''spongy moth'')<ref>[https://www.ukmoths.org.uk/species/lymantria-dispar/distribution-map/ Gypsy Moth ''Lymantria dispar'' at UK Moths]</ref>, ма даскельо подфайти, а найпрепознатлїви то подфайта ''L. d. dispar'' и ''L. d''. ''japonica''. Файта ''Lymantria dispar'' увежена на даскельо контитненти и нєшка представя инвазивну файту у Африки и Сиверней и Южней Америки. Полифаґни лїчинки жию на рижних лїсцопадних и игелкастих древох и можу направиц огромни чкоди у периодзе велького розмножованя. Пре тоти характеристики, тот чкодлївец медзи 100 инвазивнима файтами на швеце.<ref>[https://www.iucngisd.org/gisd/100_worst.php "100 of the World's Worst Invasive Alien Species"] .Global Invasive Species Database. Архивирано из [https://web.archive.org/web/20160304230622/http://www.iucngisd.org:80/gisd/100_worst.php оригинала ]04.03.2016.Приступљено 17.09.2026.</ref>
== Етимолоґия ==
Етимолоґия назви „''gypsy moth''” („циґански моль”) нє розяшнєна, а хаснована є ище 1832. року. Молї зоз подфамилиї ''Lymantriinae'' часто ше волаю ґубави молї („''tussock moths''”) пре ґуби (чомовчки) на їх гушенїцох.
Назва ''Lymantria dispar'' походзи од двох латински словох:
♦ ''Lymantria'' = знїчтожовач и
♦ ''dispar'' = розлични (одноши ше на розличносц медзи одроснутима женскима и хлопскима єдинками).
У юнию 2021. одлучене же би ше у назви gypsy moth слово gypsy заменєло зоз словом ''spongy'' (шпонджийови, пре шпонджийову масу у хторей ше находза ваїчка молю) прето же слово ''gypsy'' (циґан) увредзуюце за ромску популацию.
== Таксономия ==
Панує думанє же европска (автохтона) и сиверноамерицка (увежена) популация молю ''L. dispar'' припадаю истей подфайти, ''L. d. dispar,'' алє класификация файти и подфайти ище нє потвердзена. Министерство польопривреди ЗАД дефинує азийску подфайту як гоч хтори биотип файти ''L. dispar'' при хторих самички можу лєциц. Традиционално, файта ''L.dispar'' наволана циґански моль (''gypsy moth''), а подрозумює и японски, индийски и азийски популациї тей файти.
Европска подфайта ''L. d. dispar'' походзи зоз умерених подручох, односно лєсох заходней Европи. До ЗАД є увежена 1869. року, а до Канади 1912. року.
Азийска подфайта ''L. d. asiatica'' походзи зоз умерених подручох Азиї, восточно од гори Уралу. Од початку 20. вику єй присуство зазначене и коло заходного побрежя Сиверней Америки. Зоз южней Европи ше шири на сивер, до Нємецкей и других державох, дзе ше пари зоз европску подфайту ''L. d. dispar.''<ref>Димитрије Батричевић. [http://89.188.43.75/agricultforest/20120410-02%20Dimitrije%20Batricevic.pdf Ширење губара по Европи], Приступљено 17.09.2026. </ref>
== Животни циклус ==
Главата апаца ма єдну ґенерацию рочнє. Самичка кладзе вайца у позних лєтних мешацох и файта у векшей ґрупи прежимує у тим стадиюме, защицена зоз мохотками. Зоз звекшаньом [[Температура|температури]] вилягую ше млади гушенїци и у першим стадиюме розвою маю превидни вонкашнї обмоток и обачлїви чарни горбочки (ґужлїки) зоз хторих вирастаю мохотки. У зависносци од полу и вонкашнїх условийох, главата апаца ше преблєка седем раз. Як гушенїца рошнє, достава свойо препознатлїви характеристики, односно, у штред єй розвою, по штред хрибта (медиодорзална часц) є жовтей [[Фарба|фарби]], познєйше як стареє, на хрибце ше розвиваю вельки ґужлїки (папили) зоз хторих вирастаю мохотки. Преднї 5 пари папилох белавей, а заднї 6 пари папилох червеней фарби. Зоз обидвох бокох главки главатей апаци, на першим першовим сеґменту ясно виражени мали папили и длугоки, тварди мохотки хтори ґруповани до снопчкох. На главки лїчинки находза ше вельки обачлїви длуговасти цифри хтори служа за охрану од предатора бо випатраю як очи, алє нє представяю орґан за вид.<ref>[https://lepiforum.org/wiki/page/Lymantria_Dispar „Bestimmungshilfe des Lepiforums: Lymantria Dispar”]. ''www.lepiforum.de''. Приступљено 17.09.2026.</ref>
== Костиранє ==
Главата апаца нє виберни чкодлївец, є шицко пред собу (полифаґни), односно, карми ше зоз лїсцом вецей як 100 файтох рошлїнох. У поєдиних подручох преферує одредзени рошлїни. У континенталней часци то дуб, бук, били бук и брест, а од [[Овоц|овоци]] то яблуко и шлївка. При нєдостатку поживи, може оголїц и игелкасти древа як цо то сосна, ядловец и смрека. Тот чкодлївец примарни, односно єден з перших живих орґанизмох (чкодлївцох) хтори почина процес сушеня дубових лєсох у Сербиї, же би потим и други (секундарни) чкодлївци завжали свою улогу.
== Мири биолоґийней контроли чкодлївца ==
Файту ''Lymantria dispar'' до Сиверней Америки увезол уметнїк и астроном Етєн Леополд Трувело 1869. року. Вон увезол главату апацу за продукцию [[Гадваб|гадвабу]] пре нєдостаток памуку после Америцкей гражданскей войни (15анґл.). Од теди, же би ше застановело розмножованє того чкодлївца, увежени вецей файти паразитоїдох и предаторох. Од початку 19. вику присутни були вецей як дзевец файти предаторох, алє нє було нїяки предписаня анї виглєдованя о ефикасносци, а анї о нєжаданих ефектох тих увежених нєприятельох на файти хтори нє були цильни. Установело ше же даєдни нєприятелє мали слабу контролу над главату апацу, а нападали други домашнї инсекти.
Єдна з нєприятельох була тахинидна муха (''Compsilura concinnata'') хтора нападала други домашнї файти и знїщела велї файти вельких мотильох хтори у вельким чишлє жили на сиверовостоку ЗАД.
Од хвильки кед главата апаца увежена до Сиверней Америки, направела вельку биолоґийну чкоду. Єй ареал ше шири зоз штредню швидкосцу 21 километер рочнє, а у периодзе од 1970. по 2013. рок оголєла 33 000 гектари лєсох. Лєсова служба рочнє видвоює 30 милиони долари за мири защити од главатей апаци. Медзитим, климатски пременки допринєсли предлужованю циклусу инвазиї, хтори ше звичайно збувал кажди осем до дванац роки. Таке збуванє барз нєвигодно дїйствує на животни штредок.
У [[Сербия|Сербиї]], на основи податкох зоз 2003. року, утвердзене вельке число главатей апаци. Зазначена є у лєсох и овоцнїкох на [[Поверхносц|поверхносци]] 146 894 гектарох (у централней Сербиї на 128 992 гектарох, а у [[Войводина|Войводини]] на 17 902 гектарох).
Главата апаца у Сербиї автохтона файта. У периодзе од 141 року, у Сербиї було 16 ґрадациї, а седемнаста почала 2003. року. Число гнїздох зоз ваїчками по гектаре на дзешатки тисячи, а лїчинки подполно оголюю лєси. Податки указую же при єдним оголєню лєс траци свою древову масу (волуменски прирост) од 40 до 70 проценти у зависносци од файти древа и квалитету подлоги.
Гоч главата апаца нє на лїстини економски чкодлївих орґанизмох, кажди рок є у фокусу обласци защити рошлїнох и лєсох Управи за лєси Министарства за защиту природних богатствох и животного штредку Републики Сербиї.
Наукова и фахова явносц упозната зоз проґрадацию главатей апаци, а за єй знїчтожованє нєобходне сотруднїцтво Министерства польопривреди и водопривреди и Министерства за защиту природних богатствох и животного штредку Републики Сербиї.<ref>[https://poljoprivreda.info/tekst/nova-gradacija-gubara-u-srbiji Градација губара у Србији], ''poljoprivreda.info''. Приступљено 17.09.2026. </ref>
== Референци ==
<references />
[[Катеґория:Инсекти]]
[[Катеґория:Мотилї]]
gtrxfbqw9mqzixef741d0gt36txpmgg
21748
21746
2026-09-18T13:56:44Z
Sveletanka
20
21748
wikitext
text/x-wiki
{{Животинї
| Назва = Главата апаца
| Латинска назва =
| Слика =Lymantria dispar MHNT.CUT.2012.0.357 Col de Cricheto Bastelica male Dos.jpg
| Опис_слики = ''Lymantria dispar''
| Статус_очуваня = [[File:Status zahrozenosci (kategoriji), 26032026.png|250px]] <br />Файта зоз малу вироятносцу же будзе загрожена = ознака критериюма '''LC'''
| Домен =
| Царство = [[Животинї]] (Animalia)
| Кладус1 =
| Кладус2 =
| Дивизия = Arthropoda
| Подколєно =
| Класа = Insecta
| Подкласа =
| Ряд = Lepidoptera
| Надфамилия = Noctuoidea
| Фамилия = Erebidae
| Подфамилия =
| Род = ''Lymantria''
| Файта = L. dispar
| Подфайта =
| Биномне_мено = Lymantria dispar <br />([[Карл фон Лине|Linneus]], 1758)
| Слика розпрестартосци =
| Опис_розпрестартосци =
| Синоними = Phalaena dispar Linnaeus, 1758 <br />Ocneria dispar (Linnaeus, 1758) <br />Porthetria dispar (Linnaeus, 1758)
}}
'''Главата апаца''' (лат. ''Lymantria dispar'', серб. ''ґубар'', анґл. ''gypsy'' ''moth,'' у ЗАД познати як ''spongy moth'')<ref>[https://www.ukmoths.org.uk/species/lymantria-dispar/distribution-map/ Gypsy Moth ''Lymantria dispar'' at UK Moths]</ref>, ма даскельо подфайти, а найпрепознатлїви то подфайта ''L. d. dispar'' и ''L. d''. ''japonica''. Файта ''Lymantria dispar'' увежена на даскельо контитненти и нєшка представя инвазивну файту у Африки и Сиверней и Южней Америки. Полифаґни лїчинки жию на рижних лїсцопадних и игелкастих древох и можу направиц огромни чкоди у периодзе велького розмножованя. Пре тоти характеристики, тот чкодлївец медзи 100 инвазивнима файтами на швеце.<ref>[https://www.iucngisd.org/gisd/100_worst.php "100 of the World's Worst Invasive Alien Species"] .Global Invasive Species Database. Архивирано из [https://web.archive.org/web/20160304230622/http://www.iucngisd.org:80/gisd/100_worst.php оригинала ]04.03.2016.Приступљено 17.09.2026.</ref>
== Етимолоґия ==
Етимолоґия назви „''gypsy moth''” („циґански моль”) нє розяшнєна, а хаснована є ище 1832. року. Молї зоз подфамилиї ''Lymantriinae'' часто ше волаю ґубави молї („''tussock moths''”) пре ґуби (чомовчки) на їх гушенїцох.
Назва ''Lymantria dispar'' походзи од двох латински словох:
♦ ''Lymantria'' = знїчтожовач и
♦ ''dispar'' = розлични (одноши ше на розличносц медзи одроснутима женскима и хлопскима єдинками).
У юнию 2021. одлучене же би ше у назви gypsy moth слово gypsy заменєло зоз словом ''spongy'' (шпонджийови, пре шпонджийову масу у хторей ше находза ваїчка молю) прето же слово ''gypsy'' (циґан) увредзуюце за ромску популацию.
== Таксономия ==
Панує думанє же европска (автохтона) и сиверноамерицка (увежена) популация молю ''L. dispar'' припадаю истей подфайти, ''L. d. dispar,'' алє класификация файти и подфайти ище нє потвердзена. Министерство польопривреди ЗАД дефинує азийску подфайту як гоч хтори биотип файти ''L. dispar'' при хторих самички можу лєциц. Традиционално, файта ''L.dispar'' наволана циґански моль (''gypsy moth''), а подрозумює и японски, индийски и азийски популациї тей файти.
Европска подфайта ''L. d. dispar'' походзи зоз умерених подручох, односно лєсох заходней Европи. До ЗАД є увежена 1869. року, а до Канади 1912. року.
Азийска подфайта ''L. d. asiatica'' походзи зоз умерених подручох Азиї, восточно од гори Уралу. Од початку 20. вику єй присуство зазначене и коло заходного побрежя Сиверней Америки. Зоз южней Европи ше шири на сивер, до Нємецкей и других державох, дзе ше пари зоз европску подфайту ''L. d. dispar.''<ref>Димитрије Батричевић. [http://89.188.43.75/agricultforest/20120410-02%20Dimitrije%20Batricevic.pdf Ширење губара по Европи], Приступљено 17.09.2026. </ref>
== Животни циклус ==
Главата апаца ма єдну ґенерацию рочнє. Самичка кладзе вайца у позних лєтних мешацох и файта у векшей ґрупи прежимує у тим стадиюме, защицена зоз мохотками. Зоз звекшаньом [[Температура|температури]] вилягую ше млади гушенїци и у першим стадиюме розвою маю превидни вонкашнї обмоток и обачлїви чарни горбочки (ґужлїки) зоз хторих вирастаю мохотки. У зависносци од полу и вонкашнїх условийох, главата апаца ше преблєка седем раз. Як гушенїца рошнє, достава свойо препознатлїви характеристики, односно, у штред єй розвою, по штред хрибта (медиодорзална часц) є жовтей [[Фарба|фарби]], познєйше як стареє, на хрибце ше розвиваю вельки ґужлїки (папили) зоз хторих вирастаю мохотки. Преднї 5 пари папилох белавей, а заднї 6 пари папилох червеней фарби. Зоз обидвох бокох главки главатей апаци, на першим першовим сеґменту ясно виражени мали папили и длугоки, тварди мохотки хтори ґруповани до снопчкох. На главки лїчинки находза ше вельки обачлїви длуговасти цифри хтори служа за охрану од предатора бо випатраю як очи, алє нє представяю орґан за вид.<ref>[https://lepiforum.org/wiki/page/Lymantria_Dispar „Bestimmungshilfe des Lepiforums: Lymantria Dispar”]. ''www.lepiforum.de''. Приступљено 17.09.2026.</ref>
== Костиранє ==
Главата апаца нє виберни чкодлївец, є шицко пред собу (полифаґни), односно, карми ше зоз лїсцом вецей як 100 файтох рошлїнох. У поєдиних подручох преферує одредзени рошлїни. У континенталней часци то дуб, бук, били бук и брест, а од [[Овоц|овоци]] то яблуко и шлївка. При нєдостатку поживи, може оголїц и игелкасти древа як цо то сосна, ядловец и смрека. Тот чкодлївец примарни, односно єден з перших живих орґанизмох (чкодлївцох) хтори почина процес сушеня дубових лєсох у Сербиї, же би потим и други (секундарни) чкодлївци завжали свою улогу.
== Мири биолоґийней контроли чкодлївца ==
Файту ''Lymantria dispar'' до Сиверней Америки увезол уметнїк и астроном Етєн Леополд Трувело 1869. року. Вон увезол главату апацу за продукцию [[Гадваб|гадвабу]] пре нєдостаток памуку после Америцкей гражданскей войни (15анґл.). Од теди, же би ше застановело розмножованє того чкодлївца, увежени вецей файти паразитоїдох и предаторох. Од початку 19. вику присутни були вецей як дзевец файти предаторох, алє нє було нїяки предписаня анї виглєдованя о ефикасносци, а анї о нєжаданих ефектох тих увежених нєприятельох на файти хтори нє були цильни. Установело ше же даєдни нєприятелє мали слабу контролу над главату апацу, а нападали други домашнї инсекти.
Єдна з нєприятельох була тахинидна муха (''Compsilura concinnata'') хтора нападала други домашнї файти и знїщела велї файти вельких мотильох хтори у вельким чишлє жили на сиверовостоку ЗАД.
Од хвильки кед главата апаца увежена до Сиверней Америки, направела вельку биолоґийну чкоду. Єй ареал ше шири зоз штредню швидкосцу 21 километер рочнє, а у периодзе од 1970. по 2013. рок оголєла 33 000 гектари лєсох. Лєсова служба рочнє видвоює 30 милиони долари за мири защити од главатей апаци. Медзитим, климатски пременки допринєсли предлужованю циклусу инвазиї, хтори ше звичайно збувал кажди осем до дванац роки. Таке збуванє барз нєвигодно дїйствує на животни штредок.
У [[Сербия|Сербиї]], на основи податкох зоз 2003. року, утвердзене вельке число главатей апаци. Зазначена є у лєсох и овоцнїкох на [[Поверхносц|поверхносци]] 146 894 гектарох (у централней Сербиї на 128 992 гектарох, а у [[Войводина|Войводини]] на 17 902 гектарох).
Главата апаца у Сербиї автохтона файта. У периодзе од 141 року, у Сербиї було 16 ґрадациї, а седемнаста почала 2003. року. Число гнїздох зоз ваїчками по гектаре на дзешатки тисячи, а лїчинки подполно оголюю лєси. Податки указую же при єдним оголєню лєс траци свою древову масу (волуменски прирост) од 40 до 70 проценти у зависносци од файти древа и квалитету подлоги.
Гоч главата апаца нє на лїстини економски чкодлївих орґанизмох, кажди рок є у фокусу обласци защити рошлїнох и лєсох Управи за лєси Министарства за защиту природних богатствох и животного штредку Републики Сербиї.
Наукова и фахова явносц упозната зоз проґрадацию главатей апаци, а за єй знїчтожованє нєобходне сотруднїцтво Министерства польопривреди и водопривреди и Министерства за защиту природних богатствох и животного штредку Републики Сербиї.<ref>[https://poljoprivreda.info/tekst/nova-gradacija-gubara-u-srbiji Градација губара у Србији], ''poljoprivreda.info''. Приступљено 17.09.2026. </ref>
== Референци ==
<references />
[[Катеґория:Мотилї]]
roi7vnmvilu7ixv2asaxj0qbvgfzovv
Абажур
0
3635
22038
21711
2026-09-19T08:56:34Z
Olirk55
19
Ґалерия
22038
wikitext
text/x-wiki
[[File:Lampshades.jpg|right|thumb|300px|Абажур на лампи квадратней и округлей форми]]'''Абажур''' (франц. ''abat-jour'', буквално значи „зацмиц шветлосц“) файта [[Шветлосц|ошвиценя]] хторе ше хаснує при ушорйованю ентериєра и уметнїцкей декорациї. Найчастейше ма значеня:
♦ У будовательстве - абажур ше тиж хасновало за означованє конусного отвора у облаку, од горе на долу, або облакох зоз косину. Яновскийов словнїк зоз 1803. року дефинує го як „облак хтори ше шири до нукашньосци або вонка пре лєпшу шветлосц.“<ref name=":1">[https://bonjurabajur.ru/abazhury/ История абажура-] История возникновения абажуров.</ref>
♦ Абажур дизайновани же би защицел очи од шветлосци и же би оможлївел жадане ошвиценє так же го рефлектує, абсорбує и/або ,,емитує''.
♦ Абажури ше тиж часто хаснує як декоративни елемент у лампох, у хижох, конкох, терасох итд.
== История ==
Абажур ше першираз зявел у Французкей пред вецей як двасто роками и од теди освоєл швет и так постал порядни елемент у велїх домох. Од давна, людзе видумовали окремни метални щитнїки же би защицели очи од шветлосци факлї, швички, а познєйше и од керозинских [[File:Red Lampadaire.JPG|right|thumb|307x307px|Цуфровани абажур з ройтами]]лампох. Поступно, дизайнере и декоратере почали обрацац окремну повагу на тот декоративни елемент. Абажури ше почало правиц и дизайновац у розличних формох и ниянсох, зоз розличнх файтох платна и украшовани су зоз ройтами, фодрами и перлами. Тераз уж абажури нє лєм потребни як функционална часц ентериєра, алє и жридло естетского задовольства.
Ера сецесиї почала концм 19. вику. Характерую ю прицагуюци природни мотиви, цифровани мустри габасто дизайновани. Шицко ше то одражело на дизайн ентериєра. На абажури ше почало мальовац квеце, лїсце, мотилї и птици. Основа – ножка абажура тиж ше почала меняц, зоз широкима спектрами формох.
На початку абажури били направени лєм зоз платна, алє дзекуюци талантованим дизайнером Луйови Тифанийови (ЗАД) и Антонинови Домови (Французка), нєшка можеме видзиц абажури зоз скла и кристала. Тифани направел свой перши абажур у стилу витража зоз остаткох-фалткох офарбеного скла. Любел кед ше фалатки скла прелївали и мали шицки [[Фарба|фарби]] дуги. Так настал нови тренд/мода. Антонин Дома, медзитим, почал вирабяц абажур зоз кристала, хтори ше пред тим хасновало лєм за лустери. Дзекуюци новей технїки виробку кристала, абажури тераз маю природни форми и рижнородни ,,моцни и шветли'' ниянси.<ref name=":1" />
== Продукция ==
[[File:Armchair and peony floor lamp - Tiffany Studios (49343438632).jpg|right|thumb|303x303px|Tiffany Studios]]Абажури можу буц направени зоз рижних материялох, як цо скло, пластика, метал, платно, картон, штучна скора и права природна скора. Їх форма може буц, напр., конус, сфера параболоид, паралелопипед, цилиндер або гоч хтора комбинация, а єдна або вецей лампи ше поставяю знука абажура.
Абажур може буц прикрашени зоз перлами, вишивками и подобне.
Найчастейши абажури шлїдуюци:
● Рустични: єдноставни елементи подобни як [[лєн]], плута и памук цмейших жемових тонох хтори даваю окремни випатрунок рустичним ентериєром валалских хижох або викенд хижох.
● Традицийни: часто лєнови, паперови абажури и гадвабни абажури у форми шкатулох.
● Модерни: иновативни форми як бубень, квадратни и цилиндрични.
● Антиквитети и винтаже: симулация античних абажурох як имитация прешлих епохох, часто хаснуюци текстури скла, ройти и перли хтори ше хвильково нє находза на дизайнованих абажурох.<ref>[https://lampsbuy.com/lamp-shades/ "Lamp Shades". Lamps Buy.] Retrieved 6 February 2021. (реклама)</ref>
== Други значеня ==
Слово „абажур“ ше тиж одноши на облак поставени под углом або горизонтално, оможлївююци вонкашнєй шветлосци же би уходзела од горе, як и на горизонтални облак зоз моцно поставеним амрелом хтори скрива погляд на предмети хтори вонка (напр, у затворох).
== Ґалерия ==
<gallery>
Файл:Lampe abat-jour 05I81.jpg|Лампа-кинеска вазна з гадвабним абажуром (з часу Наполеона III)
Файл:Lamp2.jpg|Абажур на лампи
Файл:Columbio Sultan Kudarat coconut bambooworks lampshade15.jpg|Абажури модерного дизайна
Файл:Lampe toutlight.jpg|Абажури ''Toutlight - Collection 2010''
Файл:Romantic table lamp.jpg|Лампа - романтични абажур з ножку
Файл:Płock, Muzeum Mazowieckie (8).jpg|Лaмпа з абажуром (музей ''Mazowieckie'')
Файл:Pony wisteria lamp - Cleveland Museum of Art (49325173518).jpg
Файл:Light fixtures above the Smedsgränd street, Uppsala, Sweden julesvernex2-3.jpg|Абажури як улїчне ошшвиценє, (Смедсґренд, Упсала, Шведска)
Файл:The Plough in Lower Beeding, West Sussex, England, sash window and windowsill.jpg|Абажур-лампи як декорация у просториї
</gallery>
== Литература ==
* Kleine, Peter M. (2002). "Light for Working - More Than Merely Utilitarian". Bauhaus Lighting? Kandem Light!The Collaboration of the Bauhaus with the Leipzig Company Kandem. Stuttgart: Amoldsche. p. 65.
* Абажур — Краткая энциклопедия домашнего хозяйства/ред. И. М. Скворцов и др. — М.: Государственное Научное издательство «Большая Советская энциклопедия» — 1959.
* Шански, Н.М. др.., Кратки етимолоґийни словнїк русийского язика, (1971
== Вонкашня вяза ==
* [https://web.archive.org/web/20160611203457/https://www.lampsusa.com/blogs/buyers-guides/13740245-lamp-shades-buyers-guide#section9 "Hard Back Lining".] LampsUSA. Archived from the original on 11 June 2016. Retrieved 9 April 2018.
* [https://www.hotels-in-naples.com/fr/encyclopedie-universellecom/#ancre773447 Abat-jour <small>[archive]</small>
== Референци ==
16dpiln85ne0ad8ddggu7auzca2yjr8
22040
22038
2026-09-19T10:42:06Z
Olirk55
19
Креированє ґалериї
22040
wikitext
text/x-wiki
[[File:Lampshades.jpg|right|thumb|300px|Абажур на лампи квадратней и округлей форми]]'''Абажур''' (франц. ''abat-jour'', буквално значи „зацмиц шветлосц“) файта [[Шветлосц|ошвиценя]] хторе ше хаснує при ушорйованю ентериєра и уметнїцкей декорациї. Найчастейше ма значеня:
♦ У будовательстве - абажур ше тиж хасновало за означованє конусного отвора у облаку, од горе на долу, або облакох зоз косину. Яновскийов словнїк зоз 1803. року дефинує го як „облак хтори ше шири до нукашньосци або вонкашньосци пре лєпшу шветлосц.“<ref name=":1">[https://bonjurabajur.ru/abazhury/ История абажура-] История возникновения абажуров.</ref>
♦ Абажур дизайновани же би защицел очи од шветлосци и же би оможлївел жадане ошвиценє так же го рефлектує, абсорбує або и „емитує.“
♦ Абажури ше тиж часто хаснує як декоративни елемент у лампох, у хижох, конкох, терасох итд.
== История ==
[[File:Red Lampadaire.JPG|right|thumb|304x304px|Цифровани абажур з ройтами]]Абажур ше першираз зявел у Французкей пред вецей як двасто роками и од теди освоєл швет и так постал порядни елемент у велїх домох. Од давна, людзе видумовали окремни метални щитнїки же би защицели очи од шветлосци факлї, швички, а познєйше и од керозинских лампох. Поступно, дизайнере и декоратере почали обрацац окремну повагу на тот декоративни елемент. Абажури ше почало правиц и дизайновац у розличних формох и ниянсох, зоз розличнх файтох платна и украшовани су зоз ройтами, фодрами и перлами. Тераз уж абажури нє лєм потребни як функционална часц ентериєра, алє и жридло естетского задовольства.
Ера сецесиї почала концм 19. вику. Характерую ю прицагуюци природни мотиви, цифровани мустри габасто дизайновани. Шицко ше то одражело на дизайн ентериєра. На абажури ше почало мальовац квеце, лїсце, мотилї и птици. Основа – ножка абажура тиж ше почала меняц, зоз широкима спектрами формох.На початку абажури били направени лєм зоз платна, алє дзекуюци талантованим дизайнером Луйови Тифанийови (ЗАД) и Антонинови Домови (Французка), нєшка можеме видзиц абажури зоз скла и кристала.
== Тифанийово лампи и абажур ==
[[File:Wiki-Tiffany-daffodil-low-.jpg|right|thumb|309x309px|Тифни стил - абажур зоз офарбенима фалатками скла]]Тифани направел свой перши абажур у стилу витража зоз остаткох-фалткох офарбеного скла. Любел кед ше фалатки скла прелївали и мали шицки [[Фарба|фарби]] дуги. Так настал нови тренд/мода. Антонин Дома, медзитим, почал вирабяц абажур зоз кристала, хтори ше пред тим хасновало лєм за лустери. Дзекуюци новей технїки виробку кристала, абажури тераз маю природни форми и рижнородни ,,моцни и шветли'' ниянси.<ref name=":1" />
Тифанийово лампи припадали руху ''Арт нуво'' (сецесия), а окреме значни як приклад хаснованя скла у тим стилу. Студио „Тифани” (''Tiffany Studios'') продуковал вельке число моделох у периодзе од 1893. по двацети роки у 20. вику, кед компания престала зоз роботу.
Тифанийово абажур-лампи и подобни предмети були популарани як декоративна уметносц у цеку дзеведзешатих рокох 19. вику и спочатку 20. вику, алє по 30-ти роки починали виходзиц з моди. Познєйше 60-их рокох ознова були глєдани алє число ориґиналох було огранїчене та ше продуковали копиї инспировани и идеями у Тифани стилом. Нєшка таки ориґинални абажур-лампи барз ценєни медзи колекционарами и досцигую високи цени, и по даскельо тисячи милиони долари.
Пре Тифанийов доминантни уплїв на тот стил, назви „Тифани лампа” и „лампа у Тифановим стилу” нєшка ше хаснує за шицки лампи зоз абажурами зоз витражного скла составяни зоз оловом, аж и тоти цо нє продуковани у студию „Тифани“.
== Продукция ==
Абажури можу буц направени зоз рижних материялох, як цо скло, пластика, метал, платно, картон, штучна скора и права природна скора. Їх форма може буц, напр., конус, сфера параболоид, паралелопипед, цилиндер або гоч хтора комбинация, а єдна або вецей лампи ше поставяю знука абажура.
Абажур може буц прикрашени зоз перлами, вишивками и подобне.
Найчастейши абажури шлїдуюци:
● Рустични: єдноставни елементи подобни як [[лєн]], плута и памук цмейших жемових тонох хтори даваю окремни випатрунок рустичним ентериєром валалских хижох або викенд хижох.
● Традицийни: часто лєнови, паперови абажури и гадвабни абажури у форми шкатулох.
● Модерни: иновативни форми як бубень, квадратни и цилиндрични.
● Антиквитети и винтаже: симулация античних абажурох як имитация прешлих епохох, часто хаснуюци текстури скла, ройти и перли хтори ше хвильково нє находза на дизайнованих абажурох.<ref>[https://lampsbuy.com/lamp-shades/ "Lamp Shades". Lamps Buy.] Retrieved 6 February 2021. (реклама)</ref>
== Други значеня ==
Слово „абажур“ ше тиж одноши на облак поставени под углом або горизонтално, оможлївююци вонкашнєй шветлосци же би уходзела од горе, як и на горизонтални облак зоз моцно поставеним амрелом хтори скрива погляд на предмети хтори вонка (напр, у затворох).
== Ґалерия ==
<gallery>
Файл:Lampe abat-jour 05I81.jpg|Лампа-кинеска вазна зоз гадвабним абажуром (з епохи Наполеона III)
Файл:Lamp2.jpg|Абажур на лампи
Файл:Columbio Sultan Kudarat coconut bambooworks lampshade15.jpg|Абажури модерного дизайна
Файл:Romantic table lamp.jpg|Лампа - романтични абажур з ножку
Файл:Płock, Muzeum Mazowieckie (8).jpg|Лaмпа з абажуром (музей ''Mazowieckie'')
Файл:Pony wisteria lamp - Cleveland Museum of Art (49325173518).jpg
Файл:Light fixtures above the Smedsgränd street, Uppsala, Sweden julesvernex2-3.jpg|Абажури як улїчне ошшвиценє, (Смедсґренд, Упсала, Шведска)
Файл:The Plough in Lower Beeding, West Sussex, England, sash window and windowsill.jpg|Абажур-лампи як декорация у просториї
Файл:Lagenaria siceraria - gourd-lamps-calabarte-11 13.jpg|Абажур-лампи правени зоз [[Бундава|бундавки]] (окремна файта)
Файл:Louis Comfort Tiffany Lamps.jpg|Тифани лампа з окремним абажуром зоз фалаткох скла
Файл:Lampe toutlight.jpg|Абажури ''Toutlight - Collection 2010''
</gallery>
== Литература ==
* Kleine, Peter M. (2002). "Light for Working - More Than Merely Utilitarian". Bauhaus Lighting? Kandem Light!The Collaboration of the Bauhaus with the Leipzig Company Kandem. Stuttgart: Amoldsche. p. 65.
* Абажур — Краткая энциклопедия домашнего хозяйства/ред. И. М. Скворцов и др. — М.: Государственное Научное издательство «Большая Советская энциклопедия» — 1959.
* Шански, Н.М. др.., Кратки етимолоґийни словнїк русийского язика, (1971
== Вонкашня вяза ==
* [https://web.archive.org/web/20160611203457/https://www.lampsusa.com/blogs/buyers-guides/13740245-lamp-shades-buyers-guide#section9 "Hard Back Lining".] LampsUSA. Archived from the original on 11 June 2016. Retrieved 9 April 2018.
* [https://www.hotels-in-naples.com/fr/encyclopedie-universellecom/#ancre773447 Abat-jour <small>[archive]</small>
{{Commonscat}}
== Референци ==
<references />
[[Катеґория:Ошвиценє]]
20995w10w6xkmuxzk0lkwzhi7yneaw9
Хотар
0
3639
22035
21727
2026-09-18T16:20:09Z
Sveletanka
20
вики вязи
22035
wikitext
text/x-wiki
'''Хотар''' (серб. ''атар''; карп.укр. ''хотар'' 1. „гранїца”; 2. „околїско”; слц. диял. ''chotar'' „исте”; од мадь. ''hatar'' „меджа, гранїца”), територия єдного валалу.
У [[Руски Керестур|Руским Керестуре]], по приповеданю старих Керестурцох, валалски хотар скорей нє бул подзелєни и нє волало ше го так як нєшка. У одношеню на терашню локацию валала, часц польох (хотара) доставала, спрам своїх специфичносцох и характеристикох, и свойо назви. Часци хотара єдни од других оддзельовали драги хтори водзели од Керестура ґу другим валалом ([[Кула|Кули]], [[Червинка|Червинки]], [[Крущич|Вепровачу]], Брестовцу, [[Бачки Ґрачац|Филїпову]], [[Лалить|Лалитю]], [[Пиньвиц]], [[Савине Село|Торжи]] и на Билу).
'''Керестурски хотар ма шлїдуюци назви:'''
1. Сейки – часц хотара од Червинскей драги по Брестовску [[Драга|драгу]];
2. Медєш – часц хотара од Брестовскей драги по Лалицку драгу;
3. Селище – часц хотара од Лалицкей драги по Пиньвицку драгу;
4. Яраш – часц хотара од Пиньвицкей драги по Торжанску драгу;
5. Державка – часц хотара од Торжанскей цраги по Билянску драгу;
6. Била – часц кулянского хотара хтора блїжей ґу Керестуру, а находзи ше медзи Билянску и дакедишню Кулянску драгу, односно двої и єдни гони од терашнєй Кулянскей драги;
7. Косцелїско – часц хотара медзи Кулянску и Червинску драгу,
8. Брестовец – часц хотара од Чернвинскей драги спрам Вепровацкей драги, лєм нє такой од валалу, алє аж за Косцелїском.
После збиваня жеми (комасациї) 1876. року, попри главних або основних часцох хотара, єст и други назви хтори означую менше подруче, алє хторе состойна часц других часцох хотара и їх назви означую насампредз наменку одредзених [[Поверхносц|поверхносцох]].
'''То шлїдуюци назви:'''
1. Луки – часц Селища и Медєшу спрам Лалитю (на Лукох ше кошело траву);
2. Пажица – часц Державки дзе напасани рогати статок и конї;
3. Яращик – часц Пажици (Державки) за долїну Цегляру дзе дзеци напасали гушата и гуски и дзе були навязани кози;
4. Валалска – часц Државки при калдерми (драги) медзи Керестуром и Кулу дзе людзе кошели траву (куповали за кошенє од валалскей власци) и дзе ше напасало рогати статок;
5. Кулянска – орача жем медзи Кулянску [[Калдерма|калдерму]] и Билу;
6. Леї – пажица медзи [[Данчова долїна|Данчову долїну]], ярком и драгу за Червинку, дзе виходзели на пашу швинї з часци валала од Капитаньскей улїчки спрам Кули;
7. Швиньска пажица – пажица медзи [[Буяча долїна|Буячу долїну,]] ярком и Новим беґельом и валалом, дзе виганяни на пашу швинї з часци валала од Капитаньскей улїчки спрам Лалитю;
8. Вашарище – часц пажици (ярашу медзи [[Ґоловичова долїна|Ґоловичову долїну]] и [[Цегляра долїна|Цегляру]], дзе ше отримовало [[Вашар|вашари]]).
У нашим народзе присутни велї назви хотарох лєбо часцох сушедних хотарох, як напрклад: Стара Рискаша, Нова Рискаша, Палача, Зомборец, Осма, Вепровацка, Филїповска итд.
Свойо назви маю тиж так и менши локалитети: Широке, Буджацке, Шлайс, Базен и други.
== Литература ==
• ''Словнїк руского народного язика II, О – Я,'' Нови Сад 2017, б. 673.
• ''Тамаш, Юлиян, Руски Керестур, лїтопис и история 1745 – 1991'', Месна заєднїца Руски Керестур 1992, б. 383.
q7uo0wxhtwkfv3yask3naczks7iy66p
Плоднїца
0
3643
21741
21740
2026-09-18T12:16:46Z
Olirk55
19
Медѕиналови, викивязи (треба докончиц)
21741
wikitext
text/x-wiki
'''Плоднїца''' або '''матернїца''' ( ат. ''uterus'') то мускулово – шлїжацоскорови орґан хтори ше находзи помедзи обидва [[Вайцовод|вайцоводи]] и ваґини. Находзи ше у карлїцовей глїбки, за и понад мочового мехира и опрез ценкого черева. Плоднїца ма форму грушки зоз верхом хтори обрацени на долу спрам ваґини. [1][2]
Спада до репродуктивних орґанох женского полу при животиньох, а при цицарох улога плоднїци то прилапйованє и отримованє розвою плода у цеку ваготносци.
== Положенє плоднїци ==
Плоднїца ма форму наспак обраценей грушки, на єдним концу ше находзи гарлочко плоднїци (лат. ''cervix'') чий отвор у ваґини и вон твори дольню трецину плоднїци. Меньша часц збудована зоз мускулох, а векша часц од вязацей тканї. У штредку гарлочка ше находзи канал, хтори обложени зоз шлїжацу скорочку хтора ценьша од шлїжацей скорочки цела плоднїци и содержи вельо шлїжнїки, хтори вилучую шлїж хтора ше меня у цеку циклусу. На других двох концох плоднїци вязани вайцоводи.
Плоднїца змесцена помедзи мочового мехира и закончуюцей часци грубого черева. , а гарлочко виноши 3.5 cm, а ма чежину помедзи 50 и 60 ґрами. Вкупна длужина плоднїци при одроснутей жени то 7 до 8 cm. У цеку ваготносци плоднїца ше звекшує, же би ше после породзеня знова врацела на нормалну велькосц. Значи, стан плоднїци варирує зоз фазами менструалного циклусу и зоз роками жени.
Ембриолоґия
Ембрионалне походзенє и розвой плоднїци релативно зложени. До одприлики 8 тижньох ваготносци и за хлопски и за женски нукашнї ґениталиї - мезонефрични (''Wolffian'') и парамезонефрични (''Mullerian'') канал – коеґзистую у ембриону. [3] Процес сексуалней диференцияциї уключує вецей крочаї у хторих потребни гормонални сиґнали, фактори росту и специфични ґенетични вплїви. У женским ембриону, пре одсуство Y хромозому и нєдостатку тестостерону зоз функционалней тканї тестисох, нормални розвойни рядошлїд случованя резултує з фузию и канализацию парамезонефричних (''Mullerian'') каналох у штреднєй карлїци же би ше формовали женски карлїцово орґани. У медзичаше приходзи и до реґресиї мезонефричних (''Wolffian'') каналох. Абнормалносци у процесу хтори ше можу зявиц у цеку ембриоґенези, дакеди резултую шлїдом познатих парамезонефричних аномалийох. [4]
== Анатомия ==
[[File:Gray1167.svg|right|thumb|300px|Анатомске подзелєнє (пресек) плоднїци ]]На плоднїци ше розликую цело и гарлочко, помедзи хторих ше находзи зужена часц плоднїци. Цело плоднїци (''corpus uteri)'' то векша, горня часц на хторей ше розликую два боки и два бочни рубци:
Предня (facies vesicalis)
Задня (facies intestinalis)
Два бочни рубци.
Горня, звекшана и преширена часц цела плоднїци лєгко є конвексни и наволує ше плоднїцово дно (fundus uteri). Бочни конци плоднїцового дна спаяю ше зоз бочнима рубцами цела и так наставаю конусни формациї, плоднїцово роги (''cornu uteri dextrum et sinistrum'').
Зуженє плоднїци (''isthmus uteri'') то крадша и ужша часц плоднїци хтора лєжи помедзи цела и гарла плоднїци. Шия плоднїци (''cervix uteri'') ма форму цилиндра грубини до 3 cm. Окружена є зоз горню часцу, ваґиналного зводу, хтори го дзелї на два часци – горнї, суправаґинални (''portio supravaginalis'') и дольнї ваґинални (''portio vaginalis''). На дольнєй ваґиналней часци, видзи ше плоднїцов отвор (''ostium uteri'') хтори водзи до плоднїцовей глїбки.
Плоднїцова глїбка (''cavitas uteri'') ше состої зоз двох часцох, горнєй и дольнєй, хтора одвитує целу плоднїци и дольнєй хтора представя канал плоднїцовей шиї. Плоднїцова глїбка то троуглова глїбка у целу плоднїци, у чиїх бочних углох ше находза отвори вайцоводох. Верх плоднїцовей глїбки ше наставя през цервикални канал або канал шиї плоднїци (''canalis cervicis uteri'') хтори длуги 3 cm и закончує ше у ваґини виходним отвором плоднїцовей глїбки (''cavum uteri''). [5]
{| class="wikitable" align="center" style="margin-left:10px;"
|+Грубина мура плоднїци (cm)<ref>{{cite book|author1=Nandita Palshetkar|author2=Rishma Dhillon Pai|author3=Hrishikesh D Pai|title=Textbook of Hysteroscopy|url=https://books.google.com/books?id=WW9bQtmpR3sC&pg=PA135|date=2012-09-30|publisher=JP Medical Ltd|isbn=978-93-5025-781-4|pages=135–}}</ref>6
!Положенє
!Штреднї (mm)
!Разстоянє (mm)
|-
|Преднї мур плоднїци
|23
|17 - 25
|-
|Заднї мур плоднїци
|21
|15 - 25
|-
|Фундус плоднїци
|20
|15 - 22
|-
|Зуженє (истмус) плоднїци
|10
|8 - 22
|}
'''Доцек креви'''
Плоднїца ше обезпечує зоз артерийну креву зоз плоднїцовей артериї, хтора углавним настава зоз часци преднєй нукашнєй илиячней артериї. Уходзи до плоднїци, преходзаци опрез мочоводу и цага ше до кардиналного лиґаменту. [7] Преходзи през параметриюм дольнього широкого лиґаменту плоднїци. Найчастейше ше анастомозирує (повязує) зоз артерию ваєчнїкох. Плоднїцова артерия главни обезпечовач креви до плоднїци и значнє ше звекшує у цеку ваготносци.
'''Инервация'''
Аферентни нерви хтори инервую плоднїцу то Т11 и Т12. Симпатична инервация походзи зоз хипоґастричного плексусу и плексусу [[Ваєчнїки|ваєчнїкох]]. Парасимпатична инервация походзи зоз живцох C2, C3 и C4.
== Деформациї плоднїци ==
'''Милерова аґенеза або хипоплазия'''
Тота аномалия присутна при женох зоз нєдостатком або нєрозвитосцу ваґини, гарла плоднїци и цела плоднїци и вайцоводох. Части пошлїдок то стерилносц, а може буц и подполне одсуствованє менструациї або поремеценя єй ритму. Медзитим, постої могущносц зачаца кед нєрозвитосц меньша и кед очувана функция ваєчнїкох. Части случаї ектопичней ваготносци и поруценя, окреме у першей половки ваготносци. Тоти жени углавним маю и водза нормални малженски живот.
'''Єднорога плоднїца'''
Подполно є способна же би окончовала свою функцию, та ше ваготносц и породзенє одвиваю цалком нормално.
'''Двойнїста плоднїца зоз 2 одвоєнима целами.'''
Можу ше зявиц аж и два плоднїци, два ваґини и два гарла плоднїци. Тота аномалия нє муши виволац нїяки поремеценя и углавним ше случайно одкриє у цеку препатрунка, у цеку лїченя стерилитету або при женох хтори поруцели. Дияґноза ше поставя з помоцу ултразвуку, а дакеди и у цеку царского резу. Породзенє углавним вчасне, зоз могущима почежкосцами хтори можу привесц до хитного претаргнуца ваготносци. Постої ришенє: зоз правилну дияґнозу и лїченьом, жени можу остац ваготни, ношиц ваготносц нормално и породзиц ше природно. Прето важна дияґностика у форми ултразвуку, маґнетней резонанци, гистероскопиї або лапараскопиї.
'''Дворога плоднїца зоз 2 повязанима целами'''
Тота аномалия може буц причина стерилносци, поруценя, вчасних породзеньох и других компликацийох у ваготносци. Алє тиж так ваготносц и породзенє можу прейсц без почежкосцох. Прето важна дияґноза же би ше превжали мири процив могущих компликацийох. Лїченє може буц зоз хаснованьом проґестоґених ґормонох у ваготносци або на операциї.
'''Єдно цело плоднїци подзелєне зоз септумом'''
У тим случаю, плоднїца звонка випатра подполно нормално, а знука ю блокирує септум. Тото препреченє тиж так може поремециц интимни вязи. Одкрива ше зоз рендґеном або хистероскопию, хтора ше тиж так хаснує за одстраньованє септуму. Зоз тоту аномалию може присц до стерилносци. Компликациї частейши у цеку породзеня, прето же ше углавним зявює кирвавенє. Єдно од ришеньох може буц гистероскопия.
'''Плоднїца хтора ма форму шерца зоз лєгко углїбеним фундусом.'''
Тота аномалия ма минималне одступанє од нормалного. Гоч є найблїжша нормално розвитей плоднїци, може привесц до вчасного породзеня, крижаного положеня фетусу або предлуженей першей фази породзеня. Як и у прешлих случайох, дияґноза найважнєйша.
Функция
'''Улога плоднїци у ваготносци и породзеню'''
Улога плоднїци у ваготносци то же би прилапела оплодзену [[Ваїчкова клїтинка|ваїчкову клїтинку]] и усадзи ю до своєй шлїжацей скорочки. Оплодзена ваїчкова клїтинка ше дзелї и постава бластоциста хтора ше усадзує до ендометриюму и костира ше зоз кревових судзинох хтори ше розвиваю окреме пре тоту причину. Оплодзена ваїчкова клїтинка постава ембрион, и вяже ше за мур плоднїци, твори плаценту (посцелку) и розвива ше до фетусу (ґестация) хтори рошнє до породзеня.
Єй улога пресудна за нормални розвой фетусу у цеку цалей ваготносци. После имплантациї оплодзени ваїчково клїтинки, у цеку ваготносци плоднїца ше поступнє звекшує и єй мускулове пасмо постава густейше. Горня часц цела плоднїци або тло плоднїци порушує ше на горе и досцигує уровень пупка у шестим мешацу ваготносци. У осмим мешацу плоднїцове тло на уровню дольнього рубца першовей косци, же би ше познєйше кус спущело скорей породзеня.
Зоз контрахованьом мускулового пасма плоднїци (миометриюм), почина сцисканє фетусу, породзенє. После породзеня, плоднїцово тло ше поступнє спущує, а плоднїца ше враца до карлїцовей глїбки и з часом добива приблїжни випатрунок и велькосц як и скорей породзеня.
Пре анатомийни препреченя як цо то карлїцов персцень, плоднїца дакус ґура орґани до бруха пре ширенє у цеку ваготносци. Аж и у цеку ваготносци, маса людскей плоднїци виноши лєм коло єден килограм.
'''Сексуална улога плоднїци'''
Плоднїца тиж так ма улогу у сексуалним змислу, унапрямує доцек креви до карлїци и ваєчнїкох, як и до вонкашнїх ґениталийох, уключуюци ваґину, полни усточка и клиторис. Постоя и даєдни докази же плоднїца ма дознаюцу улогу на подобни способ як и ваєчнїки. Виглєдованє на моделох патканьох одкрило же патканї кед им одстранєна плоднїца горше окончовали задатки просторней мемориї. Толкованє то же ,, аутономни нервови систем цела, хтори реґулує ,,аутоматизовани'' метаболични процеси, як цо то пулс, диханє, претровйованє и сексуалне возбудзенє, тиж маю вязи источашнє зоз плоднїцу и мозґом.'' [8] Ище вше нє постоя нїяки подобни виглєдованя на людзох.
== Звудова плоднїци чловека ==
Плоднїца збудована зоз трох пасмох:
Вонкашнє глатке пасмо – периметриюм
Мускулове штреднє пасмо – миометриюм
Нукашнє пасмо шлїжацей скорочки – ендометриюм
Ендометриюм то пасмо плоднїци хторе барз важне за ваготносц, прето же ше у нїм змесцує плодзена ваїчкова клїтинка. У цеку ваготносци ендометриюм загрубнює и постава випольнєни зоз кревовима жилами за змесценє и потпору за розвиванє фетусу. Кед нє придзе до зачаца, ендометриюм ше лупи и одходзи як часц менструалного кирвавеня.
== Рост плоднїци у цеку ваготносци ==
У цеку ваготносци часто ше поставя питанє як ше цело будуцей мацери меня. Длужина и чежина беби указує же зоз фетусом шицко у шоре, алє важне и питанє велькосци плоднїци. Скорей ваготносци, плоднїца ше находзи глїбоко у карлїци и велькосци є помаранчеца, же би ше зоз ростом плоду звекшовала и ширела. Плоднїца у цеку ваготносци рошнє експоненциялно, наприклад, як балон хтори ше шири кед ше надує.
'''Велькосц плоднїци у першим тромешачю'''
У перших 12 тижньох ваготносци плоднїца велькосци векшого яблука, виходзи зоз карлїци (гоч ше ище вше до нєй уклопює) и почина роснуц. У случаю двойнятох, плоднїца ше будзе швидше розширйовац и роснуц, и зоз дорушованьом бруха ше може почувствовац плоднїца.
В'''елькосц плоднїци у другим тромешачю'''
У цеку того периоду плоднїца рошнє до велькосци папаї. Вецей є нє часц карлїци и
находзи ше на штредку помедзи пупка и першовей клїтки. Як рошнє, плоднїца прициска орґани коло себе и твори прицисок на мускули и лиґаменти. То дакеди вивола боль хтори часте зявенє, та нєт потреби за страхом. Тот прицисок може виволац випупченє пупку (хтори ше враци до нормали после породзеня).
Од 18. До 20. Тижня ваготносци, лїкар вимера розстоянє помедзи ганьбовей косци и верха плоднїци у центиметрох. Верх плоднїци ше наволує фундус, а тото меранє ше наволує фундаментална висина.
Тото число центиметрох углавним одвитує числу тижньох ваготносци, +/- 2 цм. Наприклад, кед основна висина 32 цм, вона би требала буц ваготна у 32. тижньох ваготносци. Медзитим, кед то нє перша ваготносц, нормале же би тото меранє було кус векше. Кед плоднїца одвитуюцей велькосци у цеку обовязних контролових препатрункох, то знак же шицко у шоре. Кед основна висина пребарз висока або пребарз нїзка, ґинеколоґ упуци ваготну жену же би поробела додатни тести.
'''Велькосц плоднїци у трецим тромешачю'''
У трецим тромешачю плоднїца престава роснуц и будзе велькосци ґереґи. У цеку породзеня плоднїца ше будзе шириц од ганьбовей косци до реброх. Як ше породзенє приблїжує, фетус помали почина падац до дольнєй карлїци.
'''Велькосц плоднїци после родзеня'''
После породзеня, плоднїца ше поступнє враца до своєй першобутней велькосци и положеня хторе мала скорей ваготносци. Тот процес хтори ше одвива у плоднїцу после породзеня, наволує ше инволуция и тирва коло 6 тижнї.
== Хороти плоднїци чловека ==
Найчастейши хороти плоднїци то: [9][10][11][12]
Пролапсус утери – випадованє плоднїци
Карцином гарла плоднїци
Карцином плоднїци
Звонкаплоднїцова ваготносц
Фиброиди – бениґни неоплазми
Миоми плоднїци
== Ґалерия ==
Анатомийни структури и положенє плоднїци
<gallery>
Файл:Gray34.png|Пресек плоднїци у 4 и 5 мешацу ваготносци
Файл:Gray589.png|Кревово судзини плоднїци
Файл:Gray1161.png|Плоднїца птрена од заднєй часци
Файл:Gray1165.png|Женска карлїца и єй структура патрена фронтално и каудално
</gallery>
'''Опать ище:'''
Породзенє
Ваготносц
Менструални циклус
Ваґина
[[Вайцовод|Вайцоводи]]
[[Ваєчнїки]]
== Референци ==
1. Palshetkar, Nandita; Pai, Rishma Dhillon; Pai, Hrishikesh D. (2012-09-30). Textbook of
Hysteroscopy (на језику: енглески). JP Medical Ltd. ISBN 978-93-5025-781-4.
2. Definition, Function, & Anatomy”. Encyclopedia Britannica (на језику: енглески). Приступљено 2021-03-25.
3. Strauss JF III, Lessey BA. The structure, function and evaluation of the female
reproductive tract. Strauss JF III, Barbieri RL, eds. Yen and Jaffe's Reproductive Endocrinology (5th изд.).. Philadelphia, Pa: Saunders-Elsevier; 2004. Chapter 9.
4. „Uterus Anatomy: Overview, Gross Anatomy, Natural Variants”. 2020-06-11.
5. „Latinski jezik za medicinske škole: Materica”. Latinski jezik za medicinske škole.
2018. Приступљено 2021-03-25.
6. Nandita Palshetkar; Rishma Dhillon Pai; Hrishikesh D Pai (2012-09-30). Textbook of
Hysteroscopy. JP Medical Ltd. стр. 135—. ISBN 978-93-5025-781-4.
7. Pelage, J.P.; Walker, W.J.; Le Dref, O.; Rymer, R. (2003). „Ovarian Artery:
Angiographic Appearance, Embolization and Relevance to Uterine Fibroid
Embolization”. CardioVascular and Interventional Radiology. 26 (3):
227—233. PMID 14562969. S2CID 23788447. doi:10.1007/s00270-002-1875-3.
8. Takacs, Peter; De Santis, Timothy; Nicholas, M. Catherine; Verma, Usha; Strassberg, Richard; Duthely, Lunthita (2005). „Echogenic Endometrial Fluid Collection in
Postmenopausal Women is a Significant Risk Factor for Disease”. Journal of Ultrasound
in Medicine. 24 (11):
1477—1481. PMID 16239648. S2CID 20258522. doi:10.7863/jum.2005.24.11.1477.
9. Speroff L, Glass RH, Kase NG. The uterus. Clinical Gynecologic Endocrinology and
Infertility (6th изд.).. Baltimore, Md: Lippincott Williams & Wilkins; 1999. Chapter 4.
10. Behera M, Couchman G, Walmer D, Price TM (јул 2005). „Mullerian agenesis and
thrombocytopenia absent radius syndrome: a case report and review of syndromes
associated with Mullerian agenesis”. Obstet Gynecol Surv. 60 (7):
453—61. PMID 15995562. doi:10.1097/01.ogx.0000165265.01778.55..[Medline].
11. Ascher, S. M.; Jha, R. C.; Reinhold, C. (август 2003). „Benign myometrial conditions: leiomyomas and adenomyosis”. Top Magn Reson Imaging. 14 (4): 281—304. PMID 14578775. doi:10.1097/00002142-200308000-00003.
12. Chaudhry S, Reinhold C, Guermazi A, Khalili I, Maheshwari S (август 2003). „Benign
and malignant diseases of the endometrium”. Top Magn Reson Imaging. 14 (4): 339—57. PMID 14578778. doi:10.1097/00002142-200308000-00006.
== Литература ==
Ross, Michael H.; Pawlina, Wojciech. Histology, a text and atlas (Sixth ed.). p. 848.
Franasiak, Jason M.; Scott, Richard T. (2015). „Reproductive tract microbiome in assisted
reproductive technologies”. Fertility and Sterility. 104 (6): 1364—1371. ISSN 0015 0282. PMID 26597628. doi:10.1016/j.fertnstert.2015.10.012.
Verstraelen, Hans; Vilchez-Vargas, Ramiro; Desimpel, Fabian; Jauregui, Ruy; Vankeirsbilck, Nele; Weyers, Steven; Verhelst, Rita; De Sutter, Petra; Pieper, Dietmar H.; Van De Wiele, Tom (2016). „Characterisation of the human uterine microbiome in non-
pregnant women through deep sequencing of the V1-2 region of the 16S rRNA gene”. PeerJ. 4: e1602. PMC 4730988 . PMID 26823997. doi:10.7717/peerj.1602 .
Mor, Gil; Kwon, Ja-Young (2015). „Trophoblast-microbiome interaction: A new paradigm on immune regulation”. American Journal of Obstetrics and Gynecology. 213 (4):
S131—S137. PMC 6800181 . PMID 26428492. doi:10.1016/j.ajog.2015.06.039.
Payne, Matthew S.; Bayatibojakhi, Sara (2014). „Exploring Preterm Birth as a Polymicrobial
Disease: An Overview of the Uterine Microbiome”. Frontiers in Immunology. 5: 595. PMC 4245917 . PMID 25505898. doi:10.3389/fimmu.2014.00595 .
== Вонкашнї вязи ==
GraySubject (језик: енглески)
Illustration at wku.edu (језик: енглески)
SUNYAnatomyLabs Архивирано на веб-сајту Wayback Machine (30. април 2007) (язик: анґлийски)
{{ПОДРАЗУМЕВАНОСОРТИРАЊЕ:Ґинеколоґия}}
[[Катеґория:Медицина]]
jhp9maf33putpknolt4oyyksiwbgarj
22036
21741
2026-09-19T06:24:11Z
Olirk55
19
22036
wikitext
text/x-wiki
'''Плоднїца''' або '''матернїца''' ( ат. ''uterus'') то мускулово – шлїжацоскорови орґан хтори ше находзи помедзи обидва [[Вайцовод|вайцоводи]] и ваґини. Находзи ше у карлїцовей глїбки, за и понад мочового мехира и опрез ценкого черева. Плоднїца ма форму грушки зоз верхом хтори обрацени на долу спрам ваґини.<ref>Palshetkar, Nandita; Pai, Rishma Dhillon; Pai, Hrishikesh D. (2012-09-30).[https://books.google.rs/books?id=WW9bQtmpR3sC&pg=PA135&redir_esc=y#v=onepage&q&f=false Textbook of Hysteroscopy] (на язику: анґлийски). JP Medical Ltd. [https://sr.wikipedia.org/wiki/Me%C4%91unarodni_standardni_broj_knjige ISBN 978-93-5025-781-4.]</ref><ref>Definition, Function, & Anatomy”. Encyclopedia Britannica (на језику: енглески). Приступљено 2021-03-25.</ref> Спада до репродуктивних орґанох женского полу при животиньох, а при цицарох улога плоднїци то прилапйованє и отримованє розвою плода у цеку ваготносци.
== Положенє плоднїци ==
Плоднїца ма форму наспак обраценей грушки, на єдним концу ше находзи гарлочко плоднїци (лат. ''cervix'') чий отвор у ваґини и вон твори дольню трецину плоднїци. Меньша часц збудована зоз мускулох, а векша часц од вязацей тканї. У штредку гарлочка ше находзи канал, хтори обложени зоз шлїжацу скорочку хтора ценьша од шлїжацей скорочки цела плоднїци и содержи вельо шлїжнїки, хтори вилучую шлїж хтора ше меня у цеку циклусу. На других двох концох плоднїци вязани вайцоводи.
Плоднїца змесцена помедзи мочового мехира и закончуюцей часци грубого черева, а гарлочко виноши 3.5 cm, а ма чежину помедзи 50 и 60 ґрами. Вкупна длужина плоднїци при одроснутей жени то 7 до 8 cm. У цеку ваготносци плоднїца ше звекшує, же би ше после породзеня знова врацела на нормалну велькосц. Значи, стан плоднїци варирує зоз фазами менструалного циклусу и зоз роками жени.
== Ембриолоґия ==
Ембрионалне походзенє и розвой плоднїци релативно зложени. До одприлики 8 тижньох ваготносци и за хлопски и за женски нукашнї ґениталиї - мезонефрични (''Wolffian'') и парамезонефрични (''Mullerian'') канал – коеґзистую у ембриону.<ref>Strauss JF III, Lessey BA. The structure, function and evaluation of the female reproductive tract. Strauss JF III, Barbieri RL, eds. Yen and Jaffe's Reproductive Endocrinology (5th изд.).. Philadelphia, Pa: Saunders-Elsevier; 2004. Chapter 9.</ref> Процес сексуалней диференцияциї уключує вецей крочаї у хторих потребни гормонални сиґнали, фактори росту и специфични ґенетични вплїви. У женским ембриону, пре одсуство Y хромозому и нєдостатку тестостерону зоз функционалней тканї тестисох, нормални розвойни рядошлїд случованя резултує з фузию и канализацию парамезонефричних (''Mullerian'') каналох у штреднєй карлїци же би ше формовали женски карлїцово орґани. У медзичаше приходзи и до реґресиї мезонефричних (''Wolffian'') каналох. Абнормалносци у процесу хтори ше можу зявиц у цеку ембриоґенези, дакеди резултую шлїдом познатих парамезонефричних аномалийох.<ref>[https://emedicine.medscape.com/article/1949215-overview „Uterus Anatomy: Overview, Gross Anatomy, Natural Variants”. 2020-06-11.]</ref>
== Анатомия ==
[[File:Gray1167.svg|right|thumb|300px|Анатомске подзелєнє (пресек) плоднїци ]]На плоднїци ше розликую цело и гарлочко, помедзи хторих ше находзи зужена часц плоднїци. Цело плоднїци (''corpus uteri)'' то векша, горня часц на хторей ше розликую два боки и два бочни рубци:
:♦ Предня (facies vesicalis)
:♦ Задня (facies intestinalis)
:♦ Два бочни рубци.
Горня, звекшана и преширена часц цела плоднїци лєгко є конвексни и наволує ше плоднїцово дно (fundus uteri). Бочни конци плоднїцового дна спаяю ше зоз бочнима рубцами цела и так наставаю конусни формациї, плоднїцово роги (''cornu uteri dextrum et sinistrum'').
Зуженє плоднїци (''isthmus uteri'') то крадша и ужша часц плоднїци хтора лєжи помедзи цела и гарла плоднїци. Шия плоднїци (''cervix uteri'') ма форму цилиндра грубини до 3 cm. Окружена є зоз горню часцу, ваґиналного зводу, хтори го дзелї на два часци – горнї, суправаґинални (''portio supravaginalis'') и дольнї ваґинални (''portio vaginalis''). На дольнєй ваґиналней часци, видзи ше плоднїцов отвор (''ostium uteri'') хтори водзи до плоднїцовей глїбки.
Плоднїцова глїбка (''cavitas uteri'') ше состої зоз двох часцох, горнєй и дольнєй, хтора одвитує целу плоднїци и дольнєй хтора представя канал плоднїцовей шиї. Плоднїцова глїбка то троуглова глїбка у целу плоднїци, у чиїх бочних углох ше находза отвори вайцоводох. Верх плоднїцовей глїбки ше наставя през цервикални канал або канал шиї плоднїци (''canalis cervicis uteri'') хтори длуги 3 cm и закончує ше у ваґини виходним отвором плоднїцовей глїбки (''cavum uteri'').<ref>[https://medicinskilatinski.blogspot.com/2018/04/materica.html „Latinski jezik za medicinske škole: Materica”.] Latinski jezik za medicinske škole. 2018. Приступљено 2021-03-25.</ref>
{| class="wikitable" align="center" style="margin-left:10px;"
|+Грубина мура плоднїци (cm)<ref>Nandita Palshetkar; Rishma Dhillon Pai; Hrishikesh D Pai (2012-09-30). [https://books.google.rs/books?id=WW9bQtmpR3sC&pg=PA135&redir_esc=y#v=onepage&q&f=false Textbook of Hysteroscopy.] JP Medical Ltd. стр. 135—. ISBN 978-93-5025-781-4.</ref>
!Положенє
!Штреднї (mm)
!Разстоянє (mm)
|-
|Преднї мур плоднїци
|23
|17 - 25
|-
|Заднї мур плоднїци
|21
|15 - 25
|-
|Фундус плоднїци
|20
|15 - 22
|-
|Зуженє (истмус) плоднїци
|10
|8 - 22
|}
'''Доцек креви'''
Плоднїца ше обезпечує зоз артерийну креву зоз плоднїцовей артериї, хтора углавним настава зоз часци преднєй нукашнєй илиячней артериї. Уходзи до плоднїци, преходзаци опрез мочоводу и цага ше до кардиналного лиґаменту.<ref>Pelage, J.P.; Walker, W.J.; Le Dref, O.; Rymer, R. (2003). „Ovarian Artery: Angiographic Appearance, Embolization and Relevance to Uterine Fibroid Embolization”. CardioVascular and Interventional Radiology. 26 (3): 227—233. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 14562969.] [https://sr.wikipedia.org/wiki/Semantic_Scholar S2CID 23788447.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1007/s00270-002-1875-3.]</ref> Преходзи през параметриюм дольнього широкого лиґаменту плоднїци. Найчастейше ше анастомозирує (повязує) зоз артерию ваєчнїкох. Плоднїцова артерия главни обезпечовач креви до плоднїци и значнє ше звекшує у цеку ваготносци.
'''Инервация'''
Аферентни нерви хтори инервую плоднїцу то Т11 и Т12. Симпатична инервация походзи зоз хипоґастричного плексусу и плексусу [[Ваєчнїки|ваєчнїкох]]. Парасимпатична инервация походзи зоз живцох C2, C3 и C4.
== Деформациї плоднїци ==
'''Милерова аґенеза або хипоплазия'''
Тота аномалия присутна при женох зоз нєдостатком або нєрозвитосцу ваґини, гарла плоднїци и цела плоднїци и вайцоводох. Части пошлїдок то стерилносц, а може буц и подполне одсуствованє менструациї або поремеценя єй ритму. Медзитим, постої могущносц зачаца кед нєрозвитосц меньша и кед очувана функция ваєчнїкох. Части случаї ектопичней ваготносци и поруценя, окреме у першей половки ваготносци. Тоти жени углавним маю и водза нормални малженски живот.
'''Єднорога плоднїца'''
Подполно є способна же би окончовала свою функцию, та ше ваготносц и породзенє одвиваю цалком нормално.
'''Двойнїста плоднїца зоз 2 одвоєнима целами.'''
Можу ше зявиц аж и два плоднїци, два ваґини и два гарла плоднїци. Тота аномалия нє муши виволац нїяки поремеценя и углавним ше случайно одкриє у цеку препатрунка, у цеку лїченя стерилитету або при женох хтори поруцели. Дияґноза ше поставя з помоцу ултразвуку, а дакеди и у цеку царского резу. Породзенє углавним вчасне, зоз могущима почежкосцами хтори можу привесц до хитного претаргнуца ваготносци. Постої ришенє: зоз правилну дияґнозу и лїченьом, жени можу остац ваготни, ношиц ваготносц нормално и породзиц ше природно. Прето важна дияґностика у форми ултразвуку, маґнетней резонанци, гистероскопиї або лапараскопиї.
'''Дворога плоднїца зоз 2 повязанима целами'''
Тота аномалия може буц причина стерилносци, поруценя, вчасних породзеньох и других компликацийох у ваготносци. Алє тиж так ваготносц и породзенє можу прейсц без почежкосцох. Прето важна дияґноза же би ше превжали мири процив могущих компликацийох. Лїченє може буц зоз хаснованьом проґестоґених ґормонох у ваготносци або на операциї.
'''Єдно цело плоднїци подзелєне зоз септумом'''
У тим случаю, плоднїца звонка випатра подполно нормално, а знука ю блокирує септум. Тото препреченє тиж так може поремециц интимни вязи. Одкрива ше зоз рендґеном або хистероскопию, хтора ше тиж так хаснує за одстраньованє септуму. Зоз тоту аномалию може присц до стерилносци. Компликациї частейши у цеку породзеня, прето же ше углавним зявює кирвавенє. Єдно од ришеньох може буц гистероскопия.
'''Плоднїца хтора ма форму шерца зоз лєгко углїбеним фундусом.'''
Тота аномалия ма минималне одступанє од нормалного. Гоч є найблїжша нормално розвитей плоднїци, може привесц до вчасного породзеня, крижаного положеня фетусу або предлуженей першей фази породзеня. Як и у прешлих случайох, дияґноза найважнєйша.
== Функция ==
'''Улога плоднїци у ваготносци и породзеню'''
Улога плоднїци у ваготносци то же би прилапела оплодзену [[Ваїчкова клїтинка|ваїчкову клїтинку]] и усадзи ю до своєй шлїжацей скорочки. Оплодзена ваїчкова клїтинка ше дзелї и постава бластоциста хтора ше усадзує до ендометриюму и костира ше зоз кревових судзинох хтори ше розвиваю окреме пре тоту причину. Оплодзена ваїчкова клїтинка постава ембрион, и вяже ше за мур плоднїци, твори плаценту (посцелку) и розвива ше до фетусу (ґестация) хтори рошнє до породзеня.
Єй улога пресудна за нормални розвой фетусу у цеку цалей ваготносци. После имплантациї оплодзени ваїчково клїтинки, у цеку ваготносци плоднїца ше поступнє звекшує и єй мускулове пасмо постава густейше. Горня часц цела плоднїци або тло плоднїци порушує ше на горе и досцигує уровень пупка у шестим мешацу ваготносци. У осмим мешацу плоднїцове тло на уровню дольнього рубца першовей косци, же би ше познєйше кус спущело скорей породзеня.
Зоз контрахованьом мускулового пасма плоднїци (миометриюм), почина сцисканє фетусу, породзенє. После породзеня, плоднїцово тло ше поступнє спущує, а плоднїца ше враца до карлїцовей глїбки и з часом добива приблїжни випатрунок и велькосц як и скорей породзеня.
Пре анатомийни препреченя як цо то карлїцов персцень, плоднїца дакус ґура орґани до бруха пре ширенє у цеку ваготносци. Аж и у цеку ваготносци, маса людскей плоднїци виноши лєм коло єден килограм.
'''Сексуална улога плоднїци'''
Плоднїца тиж так ма улогу у сексуалним змислу, унапрямує доцек креви до карлїци и ваєчнїкох, як и до вонкашнїх ґениталийох, уключуюци ваґину, полни усточка и клиторис. Постоя и даєдни докази же плоднїца ма дознаюцу улогу на подобни способ як и ваєчнїки. Виглєдованє на моделох патканьох одкрило же патканї кед им одстранєна плоднїца горше окончовали задатки просторней мемориї. Толкованє то же ,, аутономни нервови систем цела, хтори реґулує ,,аутоматизовани'' метаболични процеси, як цо то пулс, диханє, претровйованє и сексуалне возбудзенє, тиж маю вязи источашнє зоз плоднїцу и мозґом.''<ref>Takacs, Peter; De Santis, Timothy; Nicholas, M. Catherine; Verma, Usha; Strassberg, Richard; Duthely, Lunthita (2005). [https://archive.org/details/sim_journal-of-ultrasound-in-medicine_2005-11_24_11/page/1476/mode/2up „Echogenic Endometrial Fluid Collection in Postmenopausal Women is a Significant Risk Factor for Disease”.] Journal of Ultrasound in Medicine. 24 (11): 1477—1481. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 16239648.] [https://sr.wikipedia.org/wiki/Semantic_Scholar S2CID 20258522.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.7863/jum.2005.24.11.1477.]</ref> [8] Ище вше нє постоя нїяки подобни виглєдованя на людзох.
== Звудова плоднїци чловека ==
Плоднїца збудована зоз трох пасмох:
♦ Вонкашнє глатке пасмо – периметриюм
♦ Мускулове штреднє пасмо – миометриюм
♦ Нукашнє пасмо шлїжацей скорочки – ендометриюм
Ендометриюм то пасмо плоднїци хторе барз важне за ваготносц, прето же ше у нїм змесцує плодзена ваїчкова клїтинка. У цеку ваготносци ендометриюм загрубнює и постава випольнєни зоз кревовима жилами за змесценє и потпору за розвиванє фетусу. Кед нє придзе до зачаца, ендометриюм ше лупи и одходзи як часц менструалного кирвавеня.
== Рост плоднїци у цеку ваготносци ==
У цеку ваготносци часто ше поставя питанє як ше цело будуцей мацери меня. Длужина и чежина беби указує же зоз фетусом шицко у шоре, алє важне и питанє велькосци плоднїци. Скорей ваготносци, плоднїца ше находзи глїбоко у карлїци и велькосци є помаранчеца, же би ше зоз ростом плоду звекшовала и ширела. Плоднїца у цеку ваготносци рошнє експоненциялно, наприклад, як балон хтори ше шири кед ше надує.
'''Велькосц плоднїци у першим тромешачю'''
У перших 12 тижньох ваготносци плоднїца велькосци векшого яблука, виходзи зоз карлїци (гоч ше ище вше до нєй уклопює) и почина роснуц. У случаю двойнятох, плоднїца ше будзе швидше розширйовац и роснуц, и зоз дорушованьом бруха ше може почувствовац плоднїца.
В'''елькосц плоднїци у другим тромешачю'''
У цеку того периоду плоднїца рошнє до велькосци папаї. Вецей є нє часц карлїци и
находзи ше на штредку помедзи пупка и першовей клїтки. Як рошнє, плоднїца прициска орґани коло себе и твори прицисок на мускули и лиґаменти. То дакеди вивола боль хтори часте зявенє, та нєт потреби за страхом. Тот прицисок може виволац випупченє пупку (хтори ше враци до нормали после породзеня).
Од 18. До 20. Тижня ваготносци, лїкар вимера розстоянє помедзи ганьбовей косци и верха плоднїци у центиметрох. Верх плоднїци ше наволує фундус, а тото меранє ше наволує фундаментална висина.
Тото число центиметрох углавним одвитує числу тижньох ваготносци, +/- 2 цм. Наприклад, кед основна висина 32 цм, вона би требала буц ваготна у 32. тижньох ваготносци. Медзитим, кед то нє перша ваготносц, нормале же би тото меранє було кус векше. Кед плоднїца одвитуюцей велькосци у цеку обовязних контролових препатрункох, то знак же шицко у шоре. Кед основна висина пребарз висока або пребарз нїзка, ґинеколоґ упуци ваготну жену же би поробела додатни тести.
'''Велькосц плоднїци у трецим тромешачю'''
У трецим тромешачю плоднїца престава роснуц и будзе велькосци ґереґи. У цеку породзеня плоднїца ше будзе шириц од ганьбовей косци до реброх. Як ше породзенє приблїжує, фетус помали почина падац до дольнєй карлїци.
'''Велькосц плоднїци после родзеня'''
После породзеня, плоднїца ше поступнє враца до своєй першобутней велькосци и положеня хторе мала скорей ваготносци. Тот процес хтори ше одвива у плоднїцу после породзеня, наволує ше инволуция и тирва коло 6 тижнї.
== Хороти плоднїци чловека ==
Найчастейши хороти плоднїци то: <ref> Speroff L, Glass RH, Kase NG. The uterus. Clinical Gynecologic Endocrinology and Infertility (6th изд.).. Baltimore, Md: Lippincott Williams & Wilkins; 1999. Chapter 4.</ref><ref>Behera M, Couchman G, Walmer D, Price TM (јул 2005). „Mullerian agenesis and thrombocytopenia absent radius syndrome: a case report and review of syndromes associated with Mullerian agenesis”. Obstet Gynecol Surv. 60 (7): 453—61. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 15995562.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1097/01.ogx.0000165265.01778.55.][Medline].</ref><ref>Ascher, S. M.; Jha, R. C.; Reinhold, C. (август 2003). „Benign myometrial conditions: leiomyomas and adenomyosis”. Top Magn Reson Imaging. 14 (4): 281—304. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 14578775.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1097/00002142-200308000-00003.]</ref><ref>Chaudhry S, Reinhold C, Guermazi A, Khalili I, Maheshwari S (август 2003). „Benign and malignant diseases of the endometrium”. Top Magn Reson Imaging. 14 (4): 339—57. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 14578778.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objektadoi:10.1097/00002142-200308000-00006.]</ref>
♦ Пролапсус утери – випадованє плоднїци
♦ Карцином гарла плоднїци
♦ Карцином плоднїци
♦ Звонкаплоднїцова ваготносц
♦ Фиброиди – бениґни неоплазми
♦ Миоми плоднїци
== Ґалерия ==
Анатомийни структури и положенє плоднїци
<gallery>
Файл:Gray34.png|Пресек плоднїци у 4 и 5 мешацу ваготносци
Файл:Gray589.png|Кревово судзини плоднїци
Файл:Gray1161.png|Плоднїца птрена од заднєй часци
Файл:Gray1165.png|Женска карлїца и єй структура патрена фронтално и каудално
</gallery>
'''Опать ище:'''
Породзенє
Ваготносц
Менструални циклус
Ваґина
[[Вайцовод|Вайцоводи]]
[[Ваєчнїки]]
== Литература ==
* Ross, Michael H.; Pawlina, Wojciech. Histology, a text and atlas (Sixth ed.). p. 848.
* Franasiak, Jason M.; Scott, Richard T. (2015). „Reproductive tract microbiome in assisted
reproductive technologies”. Fertility and Sterility. 104 (6): 1364 1371. [https://sr.wikipedia.org/wiki/Me%C4%91unarodni_standardni_serijski_broj ISSN 00150282.] PMID 26597628. [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1016/j.fertnstert.2015.10.012.]
* Verstraelen, Hans; Vilchez-Vargas, Ramiro; Desimpel, Fabian; Jauregui, Ruy; Vankeirsbilck, Nele; Weyers, Steven; Verhelst, Rita; De Sutter, Petra; Pieper, Dietmar H.; Van De Wiele, Tom (2016). [https://pmc.ncbi.nlm.nih.gov/articles/PMC4730988/ . „Characterisation of the human uterine microbiome in non-pregnant women through deep sequencing of the V1-2 region of the 16S rRNA gene”] PeerJ. 4: e1602. [https://sr.wikipedia.org/wiki/PubMed_Central PMC 4730988.] PMID 26823997. [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.7717/peerj.1602]
* Mor, Gil; Kwon, Ja-Young (2015). [https://pmc.ncbi.nlm.nih.gov/articles/PMC6800181/ „Trophoblast-microbiome interaction: A new paradigm on immune regulation”.] American Journal of Obstetrics and Gynecology. 213 (4):
S131—S137. [https://sr.wikipedia.org/wiki/PubMed_Central PMC 6800181.] [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 26428492.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1016/j.ajog.2015.06.039.]
* Payne, Matthew S.; Bayatibojakhi, Sara (2014). [https://pmc.ncbi.nlm.nih.gov/articles/PMC4245917/ „Exploring Preterm Birth as a Polymicrobial
Disease: An Overview of the Uterine Microbiome”.] Frontiers in Immunology. 5: 595. [https://sr.wikipedia.org/wiki/PubMed_Central PMC 4245917.] [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 25505898.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.3389/fimmu.2014.00595.]
== Вонкашнї вязи ==
* [https://web.archive.org/web/20070220201239/http://education.yahoo.com/reference/gray/subjects/subject?id=268 GraySubject] (язик: анґлийски)
* [https://web.archive.org/web/20070307090801/http://bioweb.wku.edu/courses/Biol131/images/uterus.jpg Illustration at wku.edu] (језик: енглески)
* [https://web.archive.org/web/20121026003758/http://medicalterms.info/anatomy/Uterus/ Uterus Anatomy]
* [https://web.archive.org/web/20160306122300/http://ect.downstate.edu/courseware/haonline/labs/l43/010102.htm SUNYAnatomyLabs] [https://web.archive.org/web/20070430055930/http://ect.downstate.edu/courseware/haonline/labs/l43/010102.htm Архивирано] на веб-сајту [https://sr.wikipedia.org/wiki/Wayback_Machine Wayback Machine] (30. април 2007) (язик: анґлийски)
{{ПОДРАЗУМЕВАНОСОРТИРАЊЕ:Ґинеколоґия}}
== Референци ==
[[Катеґория:Медицина]]
4k69976vrapc7wmlcsmgfs6kjt3ennd
22037
22036
2026-09-19T06:28:52Z
Olirk55
19
Референци, литература, вонкашнї вязи
22037
wikitext
text/x-wiki
'''Плоднїца''' або '''матернїца''' ( ат. ''uterus'') то мускулово – шлїжацоскорови орґан хтори ше находзи помедзи обидва [[Вайцовод|вайцоводи]] и ваґини. Находзи ше у карлїцовей глїбки, за и понад мочового мехира и опрез ценкого черева. Плоднїца ма форму грушки зоз верхом хтори обрацени на долу спрам ваґини.<ref>Palshetkar, Nandita; Pai, Rishma Dhillon; Pai, Hrishikesh D. (2012-09-30).[https://books.google.rs/books?id=WW9bQtmpR3sC&pg=PA135&redir_esc=y#v=onepage&q&f=false Textbook of Hysteroscopy] (на язику: анґлийски). JP Medical Ltd. [https://sr.wikipedia.org/wiki/Me%C4%91unarodni_standardni_broj_knjige ISBN 978-93-5025-781-4.]</ref><ref>Definition, Function, & Anatomy”. Encyclopedia Britannica (на језику: енглески). Приступљено 2021-03-25.</ref> Спада до репродуктивних орґанох женского полу при животиньох, а при цицарох улога плоднїци то прилапйованє и отримованє розвою плода у цеку ваготносци.
== Положенє плоднїци ==
Плоднїца ма форму наспак обраценей грушки, на єдним концу ше находзи гарлочко плоднїци (лат. ''cervix'') чий отвор у ваґини и вон твори дольню трецину плоднїци. Меньша часц збудована зоз мускулох, а векша часц од вязацей тканї. У штредку гарлочка ше находзи канал, хтори обложени зоз шлїжацу скорочку хтора ценьша од шлїжацей скорочки цела плоднїци и содержи вельо шлїжнїки, хтори вилучую шлїж хтора ше меня у цеку циклусу. На других двох концох плоднїци вязани вайцоводи.
Плоднїца змесцена помедзи мочового мехира и закончуюцей часци грубого черева, а гарлочко виноши 3.5 cm, а ма чежину помедзи 50 и 60 ґрами. Вкупна длужина плоднїци при одроснутей жени то 7 до 8 cm. У цеку ваготносци плоднїца ше звекшує, же би ше после породзеня знова врацела на нормалну велькосц. Значи, стан плоднїци варирує зоз фазами менструалного циклусу и зоз роками жени.
== Ембриолоґия ==
Ембрионалне походзенє и розвой плоднїци релативно зложени. До одприлики 8 тижньох ваготносци и за хлопски и за женски нукашнї ґениталиї - мезонефрични (''Wolffian'') и парамезонефрични (''Mullerian'') канал – коеґзистую у ембриону.<ref>Strauss JF III, Lessey BA. The structure, function and evaluation of the female reproductive tract. Strauss JF III, Barbieri RL, eds. Yen and Jaffe's Reproductive Endocrinology (5th изд.).. Philadelphia, Pa: Saunders-Elsevier; 2004. Chapter 9.</ref> Процес сексуалней диференцияциї уключує вецей крочаї у хторих потребни гормонални сиґнали, фактори росту и специфични ґенетични вплїви. У женским ембриону, пре одсуство Y хромозому и нєдостатку тестостерону зоз функционалней тканї тестисох, нормални розвойни рядошлїд случованя резултує з фузию и канализацию парамезонефричних (''Mullerian'') каналох у штреднєй карлїци же би ше формовали женски карлїцово орґани. У медзичаше приходзи и до реґресиї мезонефричних (''Wolffian'') каналох. Абнормалносци у процесу хтори ше можу зявиц у цеку ембриоґенези, дакеди резултую шлїдом познатих парамезонефричних аномалийох.<ref>[https://emedicine.medscape.com/article/1949215-overview „Uterus Anatomy: Overview, Gross Anatomy, Natural Variants”. 2020-06-11.]</ref>
== Анатомия ==
[[File:Gray1167.svg|right|thumb|300px|Анатомске подзелєнє (пресек) плоднїци ]]На плоднїци ше розликую цело и гарлочко, помедзи хторих ше находзи зужена часц плоднїци. Цело плоднїци (''corpus uteri)'' то векша, горня часц на хторей ше розликую два боки и два бочни рубци:
:♦ Предня (facies vesicalis)
:♦ Задня (facies intestinalis)
:♦ Два бочни рубци.
Горня, звекшана и преширена часц цела плоднїци лєгко є конвексни и наволує ше плоднїцово дно (fundus uteri). Бочни конци плоднїцового дна спаяю ше зоз бочнима рубцами цела и так наставаю конусни формациї, плоднїцово роги (''cornu uteri dextrum et sinistrum'').
Зуженє плоднїци (''isthmus uteri'') то крадша и ужша часц плоднїци хтора лєжи помедзи цела и гарла плоднїци. Шия плоднїци (''cervix uteri'') ма форму цилиндра грубини до 3 cm. Окружена є зоз горню часцу, ваґиналного зводу, хтори го дзелї на два часци – горнї, суправаґинални (''portio supravaginalis'') и дольнї ваґинални (''portio vaginalis''). На дольнєй ваґиналней часци, видзи ше плоднїцов отвор (''ostium uteri'') хтори водзи до плоднїцовей глїбки.
Плоднїцова глїбка (''cavitas uteri'') ше состої зоз двох часцох, горнєй и дольнєй, хтора одвитує целу плоднїци и дольнєй хтора представя канал плоднїцовей шиї. Плоднїцова глїбка то троуглова глїбка у целу плоднїци, у чиїх бочних углох ше находза отвори вайцоводох. Верх плоднїцовей глїбки ше наставя през цервикални канал або канал шиї плоднїци (''canalis cervicis uteri'') хтори длуги 3 cm и закончує ше у ваґини виходним отвором плоднїцовей глїбки (''cavum uteri'').<ref>[https://medicinskilatinski.blogspot.com/2018/04/materica.html „Latinski jezik za medicinske škole: Materica”.] Latinski jezik za medicinske škole. 2018. Приступљено 2021-03-25.</ref>
{| class="wikitable" align="center" style="margin-left:10px;"
|+Грубина мура плоднїци (cm)<ref>Nandita Palshetkar; Rishma Dhillon Pai; Hrishikesh D Pai (2012-09-30). [https://books.google.rs/books?id=WW9bQtmpR3sC&pg=PA135&redir_esc=y#v=onepage&q&f=false Textbook of Hysteroscopy.] JP Medical Ltd. стр. 135—. ISBN 978-93-5025-781-4.</ref>
!Положенє
!Штреднї (mm)
!Разстоянє (mm)
|-
|Преднї мур плоднїци
|23
|17 - 25
|-
|Заднї мур плоднїци
|21
|15 - 25
|-
|Фундус плоднїци
|20
|15 - 22
|-
|Зуженє (истмус) плоднїци
|10
|8 - 22
|}
'''Доцек креви'''
Плоднїца ше обезпечує зоз артерийну креву зоз плоднїцовей артериї, хтора углавним настава зоз часци преднєй нукашнєй илиячней артериї. Уходзи до плоднїци, преходзаци опрез мочоводу и цага ше до кардиналного лиґаменту.<ref>Pelage, J.P.; Walker, W.J.; Le Dref, O.; Rymer, R. (2003). „Ovarian Artery: Angiographic Appearance, Embolization and Relevance to Uterine Fibroid Embolization”. CardioVascular and Interventional Radiology. 26 (3): 227—233. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 14562969.] [https://sr.wikipedia.org/wiki/Semantic_Scholar S2CID 23788447.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1007/s00270-002-1875-3.]</ref> Преходзи през параметриюм дольнього широкого лиґаменту плоднїци. Найчастейше ше анастомозирує (повязує) зоз артерию ваєчнїкох. Плоднїцова артерия главни обезпечовач креви до плоднїци и значнє ше звекшує у цеку ваготносци.
'''Инервация'''
Аферентни нерви хтори инервую плоднїцу то Т11 и Т12. Симпатична инервация походзи зоз хипоґастричного плексусу и плексусу [[Ваєчнїки|ваєчнїкох]]. Парасимпатична инервация походзи зоз живцох C2, C3 и C4.
== Деформациї плоднїци ==
'''Милерова аґенеза або хипоплазия'''
Тота аномалия присутна при женох зоз нєдостатком або нєрозвитосцу ваґини, гарла плоднїци и цела плоднїци и вайцоводох. Части пошлїдок то стерилносц, а може буц и подполне одсуствованє менструациї або поремеценя єй ритму. Медзитим, постої могущносц зачаца кед нєрозвитосц меньша и кед очувана функция ваєчнїкох. Части случаї ектопичней ваготносци и поруценя, окреме у першей половки ваготносци. Тоти жени углавним маю и водза нормални малженски живот.
'''Єднорога плоднїца'''
Подполно є способна же би окончовала свою функцию, та ше ваготносц и породзенє одвиваю цалком нормално.
'''Двойнїста плоднїца зоз 2 одвоєнима целами.'''
Можу ше зявиц аж и два плоднїци, два ваґини и два гарла плоднїци. Тота аномалия нє муши виволац нїяки поремеценя и углавним ше случайно одкриє у цеку препатрунка, у цеку лїченя стерилитету або при женох хтори поруцели. Дияґноза ше поставя з помоцу ултразвуку, а дакеди и у цеку царского резу. Породзенє углавним вчасне, зоз могущима почежкосцами хтори можу привесц до хитного претаргнуца ваготносци. Постої ришенє: зоз правилну дияґнозу и лїченьом, жени можу остац ваготни, ношиц ваготносц нормално и породзиц ше природно. Прето важна дияґностика у форми ултразвуку, маґнетней резонанци, гистероскопиї або лапараскопиї.
'''Дворога плоднїца зоз 2 повязанима целами'''
Тота аномалия може буц причина стерилносци, поруценя, вчасних породзеньох и других компликацийох у ваготносци. Алє тиж так ваготносц и породзенє можу прейсц без почежкосцох. Прето важна дияґноза же би ше превжали мири процив могущих компликацийох. Лїченє може буц зоз хаснованьом проґестоґених ґормонох у ваготносци або на операциї.
'''Єдно цело плоднїци подзелєне зоз септумом'''
У тим случаю, плоднїца звонка випатра подполно нормално, а знука ю блокирує септум. Тото препреченє тиж так може поремециц интимни вязи. Одкрива ше зоз рендґеном або хистероскопию, хтора ше тиж так хаснує за одстраньованє септуму. Зоз тоту аномалию може присц до стерилносци. Компликациї частейши у цеку породзеня, прето же ше углавним зявює кирвавенє. Єдно од ришеньох може буц гистероскопия.
'''Плоднїца хтора ма форму шерца зоз лєгко углїбеним фундусом.'''
Тота аномалия ма минималне одступанє од нормалного. Гоч є найблїжша нормално розвитей плоднїци, може привесц до вчасного породзеня, крижаного положеня фетусу або предлуженей першей фази породзеня. Як и у прешлих случайох, дияґноза найважнєйша.
== Функция ==
'''Улога плоднїци у ваготносци и породзеню'''
Улога плоднїци у ваготносци то же би прилапела оплодзену [[Ваїчкова клїтинка|ваїчкову клїтинку]] и усадзи ю до своєй шлїжацей скорочки. Оплодзена ваїчкова клїтинка ше дзелї и постава бластоциста хтора ше усадзує до ендометриюму и костира ше зоз кревових судзинох хтори ше розвиваю окреме пре тоту причину. Оплодзена ваїчкова клїтинка постава ембрион, и вяже ше за мур плоднїци, твори плаценту (посцелку) и розвива ше до фетусу (ґестация) хтори рошнє до породзеня.
Єй улога пресудна за нормални розвой фетусу у цеку цалей ваготносци. После имплантациї оплодзени ваїчково клїтинки, у цеку ваготносци плоднїца ше поступнє звекшує и єй мускулове пасмо постава густейше. Горня часц цела плоднїци або тло плоднїци порушує ше на горе и досцигує уровень пупка у шестим мешацу ваготносци. У осмим мешацу плоднїцове тло на уровню дольнього рубца першовей косци, же би ше познєйше кус спущело скорей породзеня.
Зоз контрахованьом мускулового пасма плоднїци (миометриюм), почина сцисканє фетусу, породзенє. После породзеня, плоднїцово тло ше поступнє спущує, а плоднїца ше враца до карлїцовей глїбки и з часом добива приблїжни випатрунок и велькосц як и скорей породзеня.
Пре анатомийни препреченя як цо то карлїцов персцень, плоднїца дакус ґура орґани до бруха пре ширенє у цеку ваготносци. Аж и у цеку ваготносци, маса людскей плоднїци виноши лєм коло єден килограм.
'''Сексуална улога плоднїци'''
Плоднїца тиж так ма улогу у сексуалним змислу, унапрямує доцек креви до карлїци и ваєчнїкох, як и до вонкашнїх ґениталийох, уключуюци ваґину, полни усточка и клиторис. Постоя и даєдни докази же плоднїца ма дознаюцу улогу на подобни способ як и ваєчнїки. Виглєдованє на моделох патканьох одкрило же патканї кед им одстранєна плоднїца горше окончовали задатки просторней мемориї. Толкованє то же ,, аутономни нервови систем цела, хтори реґулує ,,аутоматизовани'' метаболични процеси, як цо то пулс, диханє, претровйованє и сексуалне возбудзенє, тиж маю вязи источашнє зоз плоднїцу и мозґом.''<ref>Takacs, Peter; De Santis, Timothy; Nicholas, M. Catherine; Verma, Usha; Strassberg, Richard; Duthely, Lunthita (2005). [https://archive.org/details/sim_journal-of-ultrasound-in-medicine_2005-11_24_11/page/1476/mode/2up „Echogenic Endometrial Fluid Collection in Postmenopausal Women is a Significant Risk Factor for Disease”.] Journal of Ultrasound in Medicine. 24 (11): 1477—1481. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 16239648.] [https://sr.wikipedia.org/wiki/Semantic_Scholar S2CID 20258522.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.7863/jum.2005.24.11.1477.]</ref> [8] Ище вше нє постоя нїяки подобни виглєдованя на людзох.
== Звудова плоднїци чловека ==
Плоднїца збудована зоз трох пасмох:
♦ Вонкашнє глатке пасмо – периметриюм
♦ Мускулове штреднє пасмо – миометриюм
♦ Нукашнє пасмо шлїжацей скорочки – ендометриюм
Ендометриюм то пасмо плоднїци хторе барз важне за ваготносц, прето же ше у нїм змесцує плодзена ваїчкова клїтинка. У цеку ваготносци ендометриюм загрубнює и постава випольнєни зоз кревовима жилами за змесценє и потпору за розвиванє фетусу. Кед нє придзе до зачаца, ендометриюм ше лупи и одходзи як часц менструалного кирвавеня.
== Рост плоднїци у цеку ваготносци ==
У цеку ваготносци часто ше поставя питанє як ше цело будуцей мацери меня. Длужина и чежина беби указує же зоз фетусом шицко у шоре, алє важне и питанє велькосци плоднїци. Скорей ваготносци, плоднїца ше находзи глїбоко у карлїци и велькосци є помаранчеца, же би ше зоз ростом плоду звекшовала и ширела. Плоднїца у цеку ваготносци рошнє експоненциялно, наприклад, як балон хтори ше шири кед ше надує.
'''Велькосц плоднїци у першим тромешачю'''
У перших 12 тижньох ваготносци плоднїца велькосци векшого яблука, виходзи зоз карлїци (гоч ше ище вше до нєй уклопює) и почина роснуц. У случаю двойнятох, плоднїца ше будзе швидше розширйовац и роснуц, и зоз дорушованьом бруха ше може почувствовац плоднїца.
В'''елькосц плоднїци у другим тромешачю'''
У цеку того периоду плоднїца рошнє до велькосци папаї. Вецей є нє часц карлїци и
находзи ше на штредку помедзи пупка и першовей клїтки. Як рошнє, плоднїца прициска орґани коло себе и твори прицисок на мускули и лиґаменти. То дакеди вивола боль хтори часте зявенє, та нєт потреби за страхом. Тот прицисок може виволац випупченє пупку (хтори ше враци до нормали после породзеня).
Од 18. До 20. Тижня ваготносци, лїкар вимера розстоянє помедзи ганьбовей косци и верха плоднїци у центиметрох. Верх плоднїци ше наволує фундус, а тото меранє ше наволує фундаментална висина.
Тото число центиметрох углавним одвитує числу тижньох ваготносци, +/- 2 цм. Наприклад, кед основна висина 32 цм, вона би требала буц ваготна у 32. тижньох ваготносци. Медзитим, кед то нє перша ваготносц, нормале же би тото меранє було кус векше. Кед плоднїца одвитуюцей велькосци у цеку обовязних контролових препатрункох, то знак же шицко у шоре. Кед основна висина пребарз висока або пребарз нїзка, ґинеколоґ упуци ваготну жену же би поробела додатни тести.
'''Велькосц плоднїци у трецим тромешачю'''
У трецим тромешачю плоднїца престава роснуц и будзе велькосци ґереґи. У цеку породзеня плоднїца ше будзе шириц од ганьбовей косци до реброх. Як ше породзенє приблїжує, фетус помали почина падац до дольнєй карлїци.
'''Велькосц плоднїци после родзеня'''
После породзеня, плоднїца ше поступнє враца до своєй першобутней велькосци и положеня хторе мала скорей ваготносци. Тот процес хтори ше одвива у плоднїцу после породзеня, наволує ше инволуция и тирва коло 6 тижнї.
== Хороти плоднїци чловека ==
Найчастейши хороти плоднїци то: <ref> Speroff L, Glass RH, Kase NG. The uterus. Clinical Gynecologic Endocrinology and Infertility (6th изд.).. Baltimore, Md: Lippincott Williams & Wilkins; 1999. Chapter 4.</ref><ref>Behera M, Couchman G, Walmer D, Price TM (јул 2005). „Mullerian agenesis and thrombocytopenia absent radius syndrome: a case report and review of syndromes associated with Mullerian agenesis”. Obstet Gynecol Surv. 60 (7): 453—61. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 15995562.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1097/01.ogx.0000165265.01778.55.][Medline].</ref><ref>Ascher, S. M.; Jha, R. C.; Reinhold, C. (август 2003). „Benign myometrial conditions: leiomyomas and adenomyosis”. Top Magn Reson Imaging. 14 (4): 281—304. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 14578775.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1097/00002142-200308000-00003.]</ref><ref>Chaudhry S, Reinhold C, Guermazi A, Khalili I, Maheshwari S (август 2003). „Benign and malignant diseases of the endometrium”. Top Magn Reson Imaging. 14 (4): 339—57. [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 14578778.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objektadoi:10.1097/00002142-200308000-00006.]</ref>
♦ Пролапсус утери – випадованє плоднїци
♦ Карцином гарла плоднїци
♦ Карцином плоднїци
♦ Звонкаплоднїцова ваготносц
♦ Фиброиди – бениґни неоплазми
♦ Миоми плоднїци
== Ґалерия ==
Анатомийни структури и положенє плоднїци
<gallery>
Файл:Gray34.png|Пресек плоднїци у 4 и 5 мешацу ваготносци
Файл:Gray589.png|Кревово судзини плоднїци
Файл:Gray1161.png|Плоднїца пaтрена од заднєй часци
Файл:Gray1165.png|Женска карлїца и єй структура патрена фронтално и каудално
</gallery>
'''Опать ище:'''
Породзенє
Ваготносц
Менструални циклус
Ваґина
[[Вайцовод|Вайцоводи]]
[[Ваєчнїки]]
== Литература ==
* Ross, Michael H.; Pawlina, Wojciech. Histology, a text and atlas (Sixth ed.). p. 848.
* Franasiak, Jason M.; Scott, Richard T. (2015). „Reproductive tract microbiome in assisted
reproductive technologies”. Fertility and Sterility. 104 (6): 1364 1371. [https://sr.wikipedia.org/wiki/Me%C4%91unarodni_standardni_serijski_broj ISSN 00150282.] PMID 26597628. [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1016/j.fertnstert.2015.10.012.]
* Verstraelen, Hans; Vilchez-Vargas, Ramiro; Desimpel, Fabian; Jauregui, Ruy; Vankeirsbilck, Nele; Weyers, Steven; Verhelst, Rita; De Sutter, Petra; Pieper, Dietmar H.; Van De Wiele, Tom (2016). [https://pmc.ncbi.nlm.nih.gov/articles/PMC4730988/ . „Characterisation of the human uterine microbiome in non-pregnant women through deep sequencing of the V1-2 region of the 16S rRNA gene”] PeerJ. 4: e1602. [https://sr.wikipedia.org/wiki/PubMed_Central PMC 4730988.] PMID 26823997. [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.7717/peerj.1602]
* Mor, Gil; Kwon, Ja-Young (2015). [https://pmc.ncbi.nlm.nih.gov/articles/PMC6800181/ „Trophoblast-microbiome interaction: A new paradigm on immune regulation”.] American Journal of Obstetrics and Gynecology. 213 (4):
S131—S137. [https://sr.wikipedia.org/wiki/PubMed_Central PMC 6800181.] [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 26428492.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.1016/j.ajog.2015.06.039.]
* Payne, Matthew S.; Bayatibojakhi, Sara (2014). [https://pmc.ncbi.nlm.nih.gov/articles/PMC4245917/ „Exploring Preterm Birth as a Polymicrobial
Disease: An Overview of the Uterine Microbiome”.] Frontiers in Immunology. 5: 595. [https://sr.wikipedia.org/wiki/PubMed_Central PMC 4245917.] [https://sr.wikipedia.org/wiki/PubMed#PMID PMID 25505898.] [https://sr.wikipedia.org/wiki/Digitalni_identifikator_objekta doi:10.3389/fimmu.2014.00595.]
== Вонкашнї вязи ==
* [https://web.archive.org/web/20070220201239/http://education.yahoo.com/reference/gray/subjects/subject?id=268 GraySubject] (язик: анґлийски)
* [https://web.archive.org/web/20070307090801/http://bioweb.wku.edu/courses/Biol131/images/uterus.jpg Illustration at wku.edu] (језик: енглески)
* [https://web.archive.org/web/20121026003758/http://medicalterms.info/anatomy/Uterus/ Uterus Anatomy]
* [https://web.archive.org/web/20160306122300/http://ect.downstate.edu/courseware/haonline/labs/l43/010102.htm SUNYAnatomyLabs] [https://web.archive.org/web/20070430055930/http://ect.downstate.edu/courseware/haonline/labs/l43/010102.htm Архивирано] на веб-сајту [https://sr.wikipedia.org/wiki/Wayback_Machine Wayback Machine] (30. април 2007) (язик: анґлийски)
{{ПОДРАЗУМЕВАНОСОРТИРАЊЕ:Ґинеколоґия}}
{{Commonscat}}
== Референци ==
[[Катеґория:Медицина]]
<references />
[[Катеґория:Ґинеколоґия]]
[[Катеґория:Женски репродуктивни орґани]]
[[Катеґория:Плоднїца]]
mgg3lq0j5wgj6jksfx62cnw7pka05m1
Катеґория:Мотилї
14
3644
21745
2026-09-18T13:55:11Z
Sveletanka
20
катеґория
21745
wikitext
text/x-wiki
[[Катеґория:Инсекти]]
16voudmyhumvdf1j6rwppigxjnfd7wz
Шаблон:Infobox settlement
10
3645
21749
2026-09-12T03:24:56Z
Zackmann08
2741
per [[MOS:INFOBOXNAME]] this should be the label.
21749
wikitext
text/x-wiki
<includeonly>{{main other|{{#invoke:Settlement short description|main}}|}}{{Infobox
| child = {{yesno|{{{embed|}}}}}
| templatestyles = Infobox settlement/styles.css
| bodyclass = ib-settlement vcard
<!--** names, type, and transliterations ** -->
| above = <div class="fn org">{{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}</div>
{{#if:{{{native_name|}}}|<div class="nickname ib-settlement-native" {{#if:{{{native_name_lang|}}}|lang="{{{native_name_lang}}}"}}>{{{native_name}}}</div>}}{{#if:{{{other_name|}}}|<div class="nickname ib-settlement-other-name">{{{other_name}}}</div>}}
| subheader = {{#if:{{{settlement_type|}}}{{{type|}}}|<div class="category">{{if empty|{{{settlement_type|}}}|{{{type|}}}}}</div>}}
| rowclass1 = mergedtoprow ib-settlement-official
| data1 = {{#if:{{{name|}}}|{{{official_name|}}}}}
<!-- ***Transliteration language 1*** -->
| rowclass2 = mergedtoprow
| header2 = {{#if:{{{translit_lang1|}}}|{{{translit_lang1}}} transcription(s)}}
| rowclass3 = {{#if:{{{translit_lang1_type1|}}}|mergedrow|mergedbottomrow}}
| label3 = • {{{translit_lang1_type}}}
| data3 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type|}}}|{{{translit_lang1_info|}}}}}}}
| rowclass4 = {{#if:{{{translit_lang1_type2|}}}|mergedrow|mergedbottomrow}}
| label4 = • {{{translit_lang1_type1}}}
| data4 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type1|}}}|{{{translit_lang1_info1|}}}}}}}
| rowclass5 = {{#if:{{{translit_lang1_type3|}}}|mergedrow|mergedbottomrow}}
| label5 = • {{{translit_lang1_type2}}}
| data5 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type2|}}}|{{{translit_lang1_info2|}}}}}}}
| rowclass6 = {{#if:{{{translit_lang1_type4|}}}|mergedrow|mergedbottomrow}}
| label6 = • {{{translit_lang1_type3}}}
| data6 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type3|}}}|{{{translit_lang1_info3|}}}}}}}
| rowclass7 = {{#if:{{{translit_lang1_type5|}}}|mergedrow|mergedbottomrow}}
| label7 = • {{{translit_lang1_type4}}}
| data7 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type4|}}}|{{{translit_lang1_info4|}}}}}}}
| rowclass8 = {{#if:{{{translit_lang1_type6|}}}|mergedrow|mergedbottomrow}}
| label8 = • {{{translit_lang1_type5}}}
| data8 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type5|}}}|{{{translit_lang1_info5|}}}}}}}
| rowclass9 = mergedbottomrow
| label9 = • {{{translit_lang1_type6}}}
| data9 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type6|}}}|{{{translit_lang1_info6|}}}}}}}
<!-- ***Transliteration language 2*** -->
| rowclass10 = mergedtoprow
| header10 = {{#if:{{{translit_lang2|}}}|{{{translit_lang2}}} transcription(s)}}
| rowclass11 = {{#if:{{{translit_lang2_type1|}}}|mergedrow|mergedbottomrow}}
| label11 = • {{{translit_lang2_type}}}
| data11 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type|}}}|{{{translit_lang2_info|}}}}}}}
| rowclass12 = {{#if:{{{translit_lang2_type2|}}}|mergedrow|mergedbottomrow}}
| label12 = • {{{translit_lang2_type1}}}
| data12 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type1|}}}|{{{translit_lang2_info1|}}}}}}}
| rowclass13 = {{#if:{{{translit_lang2_type3|}}}|mergedrow|mergedbottomrow}}
| label13 = • {{{translit_lang2_type2}}}
| data13 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type2|}}}|{{{translit_lang2_info2|}}}}}}}
| rowclass14 = {{#if:{{{translit_lang2_type4|}}}|mergedrow|mergedbottomrow}}
| label14 = • {{{translit_lang2_type3}}}
| data14 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type3|}}}|{{{translit_lang2_info3|}}}}}}}
| rowclass15 = {{#if:{{{translit_lang2_type5|}}}|mergedrow|mergedbottomrow}}
| label15 = • {{{translit_lang2_type4}}}
| data15 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type4|}}}|{{{translit_lang2_info4|}}}}}}}
| rowclass16 = {{#if:{{{translit_lang2_type6|}}}|mergedrow|mergedbottomrow}}
| label16 = • {{{translit_lang2_type5}}}
| data16 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type5|}}}|{{{translit_lang2_info5|}}}}}}}
| rowclass17 = mergedbottomrow
| label17 = • {{{translit_lang2_type6}}}
| data17 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type6|}}}|{{{translit_lang2_info6|}}}}}}}
<!-- end ** names, type, and transliterations ** -->
<!-- ***Skyline Image*** -->
| rowclass18 = mergedtoprow
| data18 = {{#if:{{{image_skyline|}}}{{{image|}}}|<!--
-->{{#invoke:InfoboxImage|InfoboxImage<!--
-->|image={{if empty|{{{image_skyline|}}}|{{{image|}}}}}<!--
-->|size={{if empty|{{{image_size|}}}|{{{imagesize|}}}}}|sizedefault=250px|upright={{{image_upright|}}}<!--
-->|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}<!--
-->|title={{if empty|{{{image_caption|}}}|{{{caption|}}}|{{{image_alt|}}}|{{{alt|}}}}}}}<!--
-->{{#if:{{{image_caption|}}}{{{caption|}}}|<div class="ib-settlement-caption">{{if empty|{{{image_caption|}}}|{{{caption|}}}}}</div>}} }}
<!-- ***Flag, Seal, Shield and Coat of arms*** -->
| rowclass19 = mergedtoprow
| class19 = maptable
| data19 = {{#if:{{{image_flag|}}}{{{image_seal|}}}{{{image_shield|}}}{{{image_blank_emblem|}}}{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}
|{{Infobox settlement/columns
| 1 = {{#if:{{{image_flag|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_flag}}}|size={{{flag_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|125px|100x100px}}|border={{yesno |{{{flag_border|}}}|yes=yes|blank=yes}}|alt={{{flag_alt|}}}|title=Flag of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type=Flag|link={{{flag_link|}}}|name={{{official_name}}}}}</div>}}
| 2 = {{#if:{{{image_seal|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_seal|}}}|size={{{seal_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|alt={{{seal_alt|}}}|title=Official seal of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}|class={{{seal_class|}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type={{if empty|{{{seal_type|}}}|Seal}}|link={{{seal_link|}}}|name={{{official_name}}}}}</div>}}
| 3 = {{#if:{{{image_shield|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_shield|}}}||size={{{shield_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|alt={{{shield_alt|}}}|title=Coat of arms of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type=Coat of arms|link={{{shield_link|}}}|name={{{official_name}}}}}</div>}}
| 4 = {{#if:{{{image_blank_emblem|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_blank_emblem|}}}|size={{{blank_emblem_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|upright={{{blank_emblem_upright|}}}|alt={{{blank_emblem_alt|}}}|title=Official logo of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type={{{blank_emblem_type|}}}|link={{{blank_emblem_link|}}}|name={{{official_name}}}}}</div>}}
| 5 = {{#if:{{{image_map|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map}}}|size={{if empty|{{{mapsize|}}}|{{{map_size|}}}}}|sizedefault=100x100px|alt={{{map_alt|}}}|title={{{map_caption|Location of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}}}}{{#if:{{{map_caption|}}}|<div class="ib-settlement-caption-link">{{{map_caption}}}</div>}}}}
| 0 = {{#if:{{{pushpin_map_narrow|}}}|{{#if:{{{coordinates|}}}{{#property:P625}}|{{#invoke:Location map|infobox_pushpin_map
| pushpin_alt = {{{pushpin_map_alt|}}}
| pushpin_caption = {{{pushpin_map_caption|}}}
| pushpin_label = {{if empty|{{{pushpin_label|}}}|{{{name|}}}|{{{official_name|}}}}}
| default_width = 250 <!-- Shouldn't this be set to 150 and the if empty below removed? -->
| pushpin_map_size = {{if empty|{{{pushpin_mapsize|}}}|150}}
}}}}}}
}}
}}
<!-- ***Etymology*** -->
| rowclass20 = mergedtoprow
| data20 = {{#if:{{{etymology|}}}|Etymology: {{{etymology}}} }}
<!-- ***Nickname*** -->
| rowclass21 = {{#if:{{{etymology|}}}|mergedrow|mergedtoprow}}
| data21 = {{#if:{{{nickname|}}}{{{nicknames|}}}|<!--
-->{{Pluralize from text|parse_links=1|{{if empty|{{{nickname|}}}|{{{nicknames|}}}{{force plural}}}}|<!--
-->link={{{nickname_link|}}}|singular=Nickname|likely=Nickname(s)|plural=Nicknames}}: <!--
--><div class="ib-settlement-nickname nickname">{{if empty|{{{nickname|}}}|{{{nicknames|}}}}}</div><!--
-->{{Main other|{{Pluralize from text|parse_links=1|{{{nickname|}}}|<!--
-->likely=[[Category:Pages using infobox settlement with possible nickname list]]}}}}}}
<!-- ***Motto*** -->
| rowclass22 = {{#if:{{{etymology|}}}{{{nickname|}}}{{{nicknames|}}}|mergedrow|mergedtoprow}}
| data22 = {{#if:{{{motto|}}}{{{mottoes|}}}|<!--
-->{{Pluralize from text|{{if empty|{{{motto|}}}|{{{mottoes|}}}{{force plural}}}}|<!--
-->link={{{motto_link|}}}|singular=Motto|likely=Motto(s)|plural=Mottoes}}: <!--
--><div class="ib-settlement-nickname nickname">{{if empty|{{{motto|}}}|{{{mottoes|}}}}}</div><!--
-->{{Main other|{{Pluralize from text|{{{motto|}}}|<!--
-->likely=[[Category:Pages using infobox settlement with possible motto list]]}}}}}}
<!-- ***Anthem*** -->
| rowclass23 = {{#if:{{{etymology|}}}{{{nickname|}}}{{{nicknames|}}}{{{motto|}}}{{{mottoes|}}}|mergedrow|mergedtoprow}}
| data23 = {{#if:{{{anthem|}}}|{{#if:{{{anthem_link|}}}|[[{{{anthem_link|}}}|Anthem:]]|Anthem:}} {{{anthem}}}}}
<!-- ***Map*** -->
| rowclass24 = mergedtoprow
| data24 = {{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}||{{#if:{{{image_map|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map}}}|size={{if empty|{{{mapsize|}}}|{{{map_size|}}}}}|sizedefault=250px|upright={{{image_upright|}}}|alt={{{map_alt|}}}|title={{{map_caption|Location of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}}}}{{#if:{{{map_caption|}}}|<div class="ib-settlement-caption">{{{map_caption}}}</div>}}
}}}}
| rowclass25 = mergedrow
| data25 = {{#if:{{{image_map1|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map1}}}|size={{if empty|{{{mapsize1|}}}|{{{map_size1|}}}}}|sizedefault=250px|upright={{{image_upright|}}}|alt={{{map_alt1|}}}|title={{{map_caption1|Location of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}}}}{{#if:{{{map_caption1|}}}|<div class="ib-settlement-caption">{{{map_caption1}}}</div>}} }}
| data26 = {{#invoke:Infobox mapframe
| autoWithCaption
| onByDefault = {{#if:{{{pushpin_map|}}}{{{image_map|}}}{{{image_map1|}}}|no|yes}}
| mapframe-frame-width = 250
| mapframe-stroke-width = 2
| mapframe-length_km = {{{length_km|}}}
| mapframe-length_mi = {{{length_mi|}}}
| mapframe-width_km = {{{width_km|}}}
| mapframe-width_mi = {{{width_mi|}}}
| mapframe-area_km2 = {{{area_total_km2|}}}
| mapframe-area_ha = {{{area_total_ha|}}}
| mapframe-area_acre = {{{area_total_acre|}}}
| mapframe-area_sq_mi = {{{area_total_sq_mi|}}}
| mapframe-type = city
| mapframe-population = {{if empty|{{{population_metro|}}}|{{{population_total|}}}}}
| mapframe-marker = town
| mapframe-wikidata = yes
| mapframe-caption = Interactive map of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}
}}
<!-- ***Pushpin Map*** -->
| rowclass28 = mergedtoprow
| data28 = {{#if:{{{pushpin_map_narrow|}}}||{{#if:{{{coordinates|}}}{{#property:P625}}|{{#invoke:Location map|infobox_pushpin_map
| default_width = 250
| pushpin_alt = {{{pushpin_map_alt|}}}
| pushpin_caption = {{{pushpin_map_caption|}}}
| pushpin_label = {{if empty|{{{pushpin_label|}}}|{{{name|}}}|{{{official_name|}}}}}
| pushpin_map_size = {{{pushpin_mapsize|}}}
}}
}}
}}
<!-- ***Coordinates*** -->
| data29 = {{#if:{{{coordinates|}}}|{{#if:{{#invoke:string|match|s={{{coordinates|}}}|pattern=geo-inline-hidden|ignore_errors=true|plain=true}}|<!-- Nothing to display -->
|Coordinates{{#if:{{{coor_pinpoint|}}}{{{coor_type|}}}| ({{if empty|{{{coor_pinpoint|}}}|{{{coor_type|}}}}})}}: {{#invoke:ISO 3166|geocoordinsert|nocat=true|1={{{coordinates|}}}|country={{{subdivision_name|}}}|subdivision1={{{subdivision_name1|}}}|subdivision2={{{subdivision_name2|}}}|subdivision3={{{subdivision_name3|}}}|type=city{{#if:{{{population_total|}}}|{{#iferror:{{#expr:{{formatnum:{{{population_total}}}|R}}+1}}||({{formatnum:{{replace|{{{population_total}}}|,|}}|R}})}}}} }}{{{coordinates_footnotes|}}} }}}}
| rowclass30 = {{#if:{{{image_map|}}}{{{image_map1|}}}{{{pushpin_map|}}}|mergedbottomrow|mergedrow}}
| label30 = {{if empty|{{{grid_name|}}}|Grid position}}
| data30 = {{{grid_position|}}}
<!-- ***Subdivisions*** -->
| rowclass31 = mergedtoprow
| label31 = {{{subdivision_type}}}
| data31 = {{#if:{{{subdivision_type|}}}|{{{subdivision_name|}}} }}
| rowclass32 = mergedrow
| label32 = {{{subdivision_type1}}}
| data32 = {{#if:{{{subdivision_type1|}}}|{{{subdivision_name1|}}} }}
| rowclass33 = mergedrow
| label33 = {{{subdivision_type2}}}
| data33 = {{#if:{{{subdivision_type2|}}}|{{{subdivision_name2|}}} }}
| rowclass34 = mergedrow
| label34 = {{{subdivision_type3}}}
| data34 = {{#if:{{{subdivision_type3|}}}|{{{subdivision_name3|}}} }}
| rowclass35 = mergedrow
| label35 = {{{subdivision_type4}}}
| data35 = {{#if:{{{subdivision_type4|}}}|{{{subdivision_name4|}}} }}
| rowclass36 = mergedrow
| label36 = {{{subdivision_type5}}}
| data36 = {{#if:{{{subdivision_type5|}}}|{{{subdivision_name5|}}} }}
| rowclass37 = mergedrow
| label37 = {{{subdivision_type6}}}
| data37 = {{#if:{{{subdivision_type6|}}}|{{{subdivision_name6|}}} }}
<!--***Established*** -->
| rowclass38 = mergedtoprow
| label38 = {{if empty|{{{established_title|}}}|Established}}
| data38 = {{{established_date|}}}
| rowclass39 = mergedrow
| label39 = {{{established_title1}}}
| data39 = {{#if:{{{established_title1|}}}|{{{established_date1|}}} }}
| rowclass40 = mergedrow
| label40 = {{{established_title2}}}
| data40 = {{#if:{{{established_title2|}}}|{{{established_date2|}}} }}
| rowclass41 = mergedrow
| label41 = {{{established_title3}}}
| data41 = {{#if:{{{established_title3|}}}|{{{established_date3|}}} }}
| rowclass42 = mergedrow
| label42 = {{{established_title4}}}
| data42 = {{#if:{{{established_title4|}}}|{{{established_date4|}}} }}
| rowclass43 = mergedrow
| label43 = {{{established_title5}}}
| data43 = {{#if:{{{established_title5|}}}|{{{established_date5|}}} }}
| rowclass44 = mergedrow
| label44 = {{{established_title6}}}
| data44 = {{#if:{{{established_title6|}}}|{{{established_date6|}}} }}
| rowclass45 = mergedrow
| label45 = {{{established_title7}}}
| data45 = {{#if:{{{established_title7|}}}|{{{established_date7|}}} }}
| rowclass46 = mergedrow
| label46 = {{{extinct_title}}}
| data46 = {{#if:{{{extinct_title|}}}|{{{extinct_date|}}} }}
| rowclass47 = mergedrow
| label47 = Founder
| data47 = {{{founder|}}}
| rowclass48 = mergedrow
| label48 = [[Namesake|Named for]]
| data48 = {{{named_for|}}}
<!-- ***Seat of government and subdivisions within the settlement*** -->
| rowclass49 = mergedtoprow
| label49 = {{if empty|{{{seat_type|}}}|Seat}}
| data49 = {{{seat|}}}
| rowclass50 = mergedrow
| label50 = {{if empty|{{{seat1_type|}}}|Former seat}}
| data50 = {{{seat1|}}}
| rowclass51 = mergedrow
| label51 = {{if empty|{{{seat2_type|}}}|Former seat}}
| data51 = {{{seat2|}}}
| rowclass52 = {{#if:{{{seat|}}}{{{seat1|}}}{{{seat2|}}}|mergedrow|mergedtoprow}}
| label52 = {{if empty|{{{parts_type|}}}|Boroughs}}
| data52 = {{#if:{{{parts|}}}{{{p1|}}}
|{{#ifeq:{{{parts_style|}}}|para
|<b>{{{parts|}}}{{#if:{{both|{{{parts|}}}|{{{p1|}}}}}|: |}}</b>{{comma separated entries|{{{p1|}}}|{{{p2|}}}|{{{p3|}}}|{{{p4|}}}|{{{p5|}}}|{{{p6|}}}|{{{p7|}}}|{{{p8|}}}|{{{p9|}}}|{{{p10|}}}|{{{p11|}}}|{{{p12|}}}|{{{p13|}}}|{{{p14|}}}|{{{p15|}}}|{{{p16|}}}|{{{p17|}}}|{{{p18|}}}|{{{p19|}}}|{{{p20|}}}|{{{p21|}}}|{{{p22|}}}|{{{p23|}}}|{{{p24|}}}|{{{p25|}}}|{{{p26|}}}|{{{p27|}}}|{{{p28|}}}|{{{p29|}}}|{{{p30|}}}|{{{p31|}}}|{{{p32|}}}|{{{p33|}}}|{{{p34|}}}|{{{p35|}}}|{{{p36|}}}|{{{p37|}}}|{{{p38|}}}|{{{p39|}}}|{{{p40|}}}|{{{p41|}}}|{{{p42|}}}|{{{p43|}}}|{{{p44|}}}|{{{p45|}}}|{{{p46|}}}|{{{p47|}}}|{{{p48|}}}|{{{p49|}}}|{{{p50|}}}}}
|{{#if:{{{p1|}}}|{{Collapsible list|title={{{parts|}}}|expand={{#switch:{{{parts_style|}}}|coll=|list=y|{{#if:{{{p6|}}}||y}}}}|1={{{p1|}}}|2={{{p2|}}}|3={{{p3|}}}|4={{{p4|}}}|5={{{p5|}}}|6={{{p6|}}}|7={{{p7|}}}|8={{{p8|}}}|9={{{p9|}}}|10={{{p10|}}}|11={{{p11|}}}|12={{{p12|}}}|13={{{p13|}}}|14={{{p14|}}}|15={{{p15|}}}|16={{{p16|}}}|17={{{p17|}}}|18={{{p18|}}}|19={{{p19|}}}|20={{{p20|}}}|21={{{p21|}}}|22={{{p22|}}}|23={{{p23|}}}|24={{{p24|}}}|25={{{p25|}}}|26={{{p26|}}}|27={{{p27|}}}|28={{{p28|}}}|29={{{p29|}}}|30={{{p30|}}}|31={{{p31|}}}|32={{{p32|}}}|33={{{p33|}}}|34={{{p34|}}}|35={{{p35|}}}|36={{{p36|}}}|37={{{p37|}}}|38={{{p38|}}}|39={{{p39|}}}|40={{{p40|}}}|41={{{p41|}}}|42={{{p42|}}}|43={{{p43|}}}|44={{{p44|}}}|45={{{p45|}}}|46={{{p46|}}}|47={{{p47|}}}|48={{{p48|}}}|49={{{p49|}}}|50={{{p50|}}}}}
|{{{parts}}}
}}
}} }}
<!-- ***Government type and Leader*** -->
| rowclass53 = mergedtoprow
| header53 = {{#if:{{{government_type|}}}{{{governing_body|}}}{{{leader_name|}}}{{{leader_name1|}}}{{{leader_name2|}}}{{{leader_name3|}}}{{{leader_name4|}}}|Government<div class="ib-settlement-fn">{{{government_footnotes|}}}</div>}}
<!-- ***Government*** -->
| rowclass54 = mergedrow
| label54 = • Type
| data54 = {{{government_type|}}}
| rowclass55 = mergedrow
| label55 = • Body
| class55 = agent
| data55 = {{{governing_body|}}}
| rowclass56 = mergedrow
| label56 = • {{{leader_title}}}
| data56 = {{#if:{{{leader_title|}}}|{{{leader_name|}}} {{#if:{{{leader_party|}}}|({{Polparty|{{{subdivision_name}}}|{{{leader_party}}}}})}}}}
| rowclass57 = mergedrow
| label57 = • {{{leader_title1}}}
| data57 = {{#if:{{{leader_title1|}}}|{{{leader_name1|}}}}}
| rowclass58 = mergedrow
| label58 = • {{{leader_title2}}}
| data58 = {{#if:{{{leader_title2|}}}|{{{leader_name2|}}}}}
| rowclass59 = mergedrow
| label59 = • {{{leader_title3}}}
| data59 = {{#if:{{{leader_title3|}}}|{{{leader_name3|}}}}}
| rowclass60 = mergedrow
| label60 = • {{{leader_title4}}}
| data60 = {{#if:{{{leader_title4|}}}|{{{leader_name4|}}}}}
| rowclass61 = mergedrow
| label61 = • {{{leader_title5}}}
| data61 = {{#if:{{{leader_title5|}}}|{{{leader_name5|}}}}}
| rowclass62 = mergedrow
| label62 = {{{government_blank1_title}}}
| data62 = {{#if:{{{government_blank1_title|}}}|{{{government_blank1|}}}}}
| rowclass63 = mergedrow
| label63 = {{{government_blank2_title}}}
| data63 = {{#if:{{{government_blank2_title|}}}|{{{government_blank2|}}}}}
| rowclass64 = mergedrow
| label64 = {{{government_blank3_title}}}
| data64 = {{#if:{{{government_blank3_title|}}}|{{{government_blank3|}}}}}
| rowclass65 = mergedrow
| label65 = {{{government_blank4_title}}}
| data65 = {{#if:{{{government_blank4_title|}}}|{{{government_blank4|}}}}}
| rowclass66 = mergedrow
| label66 = {{{government_blank5_title}}}
| data66 = {{#if:{{{government_blank5_title|}}}|{{{government_blank5|}}}}}
| rowclass67 = mergedrow
| label67 = {{{government_blank6_title}}}
| data67 = {{#if:{{{government_blank6_title|}}}|{{{government_blank6|}}}}}
<!-- ***Geographical characteristics*** -->
<!-- ***Area*** -->
| rowclass68 = mergedtoprow
| header68 = {{#if:{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}{{{area_land_km2|}}}{{{area_land_ha|}}}{{{area_land_acre|}}}{{{area_land_sq_mi|}}}{{{area_water_km2|}}}{{{area_water_ha|}}}{{{area_water_acre|}}}{{{area_water_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_ha|}}}{{{area_urban_acre|}}}{{{area_urban_sq_mi|}}}{{{area_rural_sq_mi|}}}{{{area_rural_ha|}}}{{{area_rural_acre|}}}{{{area_rural_km2|}}}{{{area_metro_km2|}}}{{{area_metro_ha|}}}{{{area_metro_acre|}}}{{{area_blank1_km2|}}}{{{area_blank1_ha|}}}{{{area_blank1_acre|}}}{{{area_metro_sq_mi|}}}{{{area_blank1_sq_mi|}}}
|{{#if:{{both|{{#ifeq:{{{total_type}}}| |1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}}
|<!-- displayed below -->
|Area<div class="ib-settlement-fn">{{{area_footnotes|}}}</div>
}}
}}
| rowclass69 = {{#if:{{both|{{#ifeq:{{{total_type}}}| |1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}}|mergedtoprow|mergedrow}}
| label69 = <div style="white-space:nowrap;">{{#if:{{both|{{#ifeq:{{{total_type}}}| |1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}}
|Area<div class="ib-settlement-fn">{{{area_footnotes|}}}</div>
| • {{#if:{{{total_type|}}}|{{{total_type}}}|{{#if:{{{area_metro_km2|}}}{{{area_metro_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_sq_mi|}}}{{{area_rural_km2|}}}{{{area_rural_sq_mi|}}}{{{population_metro|}}}{{{population_urban|}}}{{{population_rural|}}}|{{if empty|{{{settlement_type|}}}|{{{type|}}}|City}}|Total}}}}
}}</div>
| data69 = {{#if:{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_total_km2|}}}
|ha ={{{area_total_ha|}}}
|acre ={{{area_total_acre|}}}
|sqmi ={{{area_total_sq_mi|}}}
|dunam={{{area_total_dunam|}}}
|link ={{#switch:{{{dunam_link|}}}||on|total=on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass70 = mergedrow
| label70 = • Land
| data70 = {{#if:{{{area_land_km2|}}}{{{area_land_ha|}}}{{{area_land_acre|}}}{{{area_land_sq_mi|}}}{{{area_land_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_land_km2|}}}
|ha ={{{area_land_ha|}}}
|acre ={{{area_land_acre|}}}
|sqmi ={{{area_land_sq_mi|}}}
|dunam={{{area_land_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|land|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass71 = mergedrow
| label71 = • Water
| data71 = {{#if:{{{area_water_km2|}}}{{{area_water_ha|}}}{{{area_water_acre|}}}{{{area_water_sq_mi|}}}{{{area_water_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_water_km2|}}}
|ha ={{{area_water_ha|}}}
|acre ={{{area_water_acre|}}}
|sqmi ={{{area_water_sq_mi|}}}
|dunam={{{area_water_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|water|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}} {{#if:{{{area_water_percent|}}}| {{{area_water_percent}}}{{#ifeq:%|{{#invoke:string|sub|{{{area_water_percent|}}}|-1}}||%}}}}}}
| rowclass72 = mergedrow
| label72 = • [[Urban area|Urban]]<div class="ib-settlement-fn">{{{area_urban_footnotes|}}}</div>
| data72 = {{#if:{{{area_urban_km2|}}}{{{area_urban_ha|}}}{{{area_urban_acre|}}}{{{area_urban_sq_mi|}}}{{{area_urban_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_urban_km2|}}}
|ha ={{{area_urban_ha|}}}
|acre ={{{area_urban_acre|}}}
|sqmi ={{{area_urban_sq_mi|}}}
|dunam={{{area_urban_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|urban|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass73 = mergedrow
| label73 = • Rural<div class="ib-settlement-fn">{{{area_rural_footnotes|}}}</div>
| data73 = {{#if:{{{area_rural_km2|}}}{{{area_rural_ha|}}}{{{area_rural_acre|}}}{{{area_rural_sq_mi|}}}{{{area_rural_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_rural_km2|}}}
|ha ={{{area_rural_ha|}}}
|acre ={{{area_rural_acre|}}}
|sqmi ={{{area_rural_sq_mi|}}}
|dunam={{{area_rural_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|rural|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass74 = mergedrow
| label74 = • Metro<div class="ib-settlement-fn">{{{area_metro_footnotes|}}}</div>
| data74 = {{#if:{{{area_metro_km2|}}}{{{area_metro_ha|}}}{{{area_metro_acre|}}}{{{area_metro_sq_mi|}}}{{{area_metro_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_metro_km2|}}}
|ha ={{{area_metro_ha|}}}
|acre ={{{area_metro_acre|}}}
|sqmi ={{{area_metro_sq_mi|}}}
|dunam={{{area_metro_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|metro|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
<!-- ***Area rank*** -->
| rowclass75 = mergedrow
| label75 = • Rank
| data75 = {{{area_rank|}}}
| rowclass76 = mergedrow
| label76 = • {{{area_blank1_title}}}
| data76 = {{#if:{{{area_blank1_km2|}}}{{{area_blank1_ha|}}}{{{area_blank1_acre|}}}{{{area_blank1_sq_mi|}}}{{{area_blank1_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_blank1_km2|}}}
|ha ={{{area_blank1_ha|}}}
|acre ={{{area_blank1_acre|}}}
|sqmi ={{{area_blank1_sq_mi|}}}
|dunam={{{area_blank1_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|blank1|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass77 = mergedrow
| label77 = • {{{area_blank2_title}}}
| data77 = {{#if:{{{area_blank2_km2|}}}{{{area_blank2_ha|}}}{{{area_blank2_acre|}}}{{{area_blank2_sq_mi|}}}{{{area_blank2_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_blank2_km2|}}}
|ha ={{{area_blank2_ha|}}}
|acre ={{{area_blank2_acre|}}}
|sqmi ={{{area_blank2_sq_mi|}}}
|dunam={{{area_blank2_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|blank2|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass78 = mergedrow
| label78 =
| data78 = {{{area_note|}}}
<!-- ***Dimensions*** -->
| rowclass79 = mergedtoprow
| header79 = {{#if:{{{length_km|}}}{{{length_mi|}}}{{{width_km|}}}{{{width_mi|}}}|Dimensions<div class="ib-settlement-fn">{{{dimensions_footnotes|}}}</div>}}
| rowclass80 = mergedrow
| label80 = • Length
| data80 = {{#if:{{{length_km|}}}{{{length_mi|}}}
| {{infobox_settlement/lengthdisp
|km ={{{length_km|}}}
|mi ={{{length_mi|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
| rowclass81 = mergedrow
| label81 = • Width
| data81 = {{#if:{{{width_km|}}}{{{width_mi|}}}
|{{infobox_settlement/lengthdisp
|km ={{{width_km|}}}
|mi ={{{width_mi|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
<!-- ***Elevation*** -->
| rowclass82 = mergedtoprow
| label82 = {{#if:{{{elevation_link|}}}|[[{{{elevation_link|}}}|Elevation]]|Elevation}}<div class="ib-settlement-fn">{{{elevation_footnotes|}}}{{#if:{{{elevation_point|}}}| ({{{elevation_point}}})}}</div>
| data82 = {{#if:{{{elevation_m|}}}{{{elevation_ft|}}}
|{{infobox_settlement/lengthdisp
|m ={{{elevation_m|}}}
|ft ={{{elevation_ft|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
| rowclass83 = {{#if:{{{elevation_m|}}}{{{elevation_ft|}}}|mergedrow|mergedtoprow}}
| label83 = Highest elevation<div class="ib-settlement-fn">{{{elevation_max_footnotes|}}}{{#if:{{{elevation_max_point|}}}| ({{{elevation_max_point}}})}}</div>
| data83 = {{#if:{{{elevation_max_m|}}}{{{elevation_max_ft|}}}
|{{infobox_settlement/lengthdisp
|m ={{{elevation_max_m|}}}
|ft ={{{elevation_max_ft|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
<!-- ***Elevation max rank*** -->
| rowclass84 = mergedrow
| label84 = • Rank
| data84 = {{#if:{{{elevation_max_m|}}}{{{elevation_max_ft|}}}| {{{elevation_max_rank|}}} }}
| rowclass85 = {{#if:{{{elevation_min_rank|}}}|mergedrow|mergedbottomrow}}
| label85 = Lowest elevation<div class="ib-settlement-fn">{{{elevation_min_footnotes|}}}{{#if:{{{elevation_min_point|}}}| ({{{elevation_min_point}}})}}</div>
| data85 = {{#if:{{{elevation_min_m|}}}{{{elevation_min_ft|}}}
|{{infobox_settlement/lengthdisp
|m ={{{elevation_min_m|}}}
|ft ={{{elevation_min_ft|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
<!-- ***Elevation min rank*** -->
| rowclass86 = mergedrow
| label86 = • Rank
| data86 = {{#if:{{{elevation_min_m|}}}{{{elevation_min_ft|}}}|{{{elevation_min_rank|}}}}}
<!-- ***Population*** -->
| rowclass87 = mergedtoprow
| label87 = Population<div class="ib-settlement-fn">{{#if:{{{population_as_of|}}}|{{nbsp}}({{{population_as_of}}})}}{{{population_footnotes|}}}</div>
| data87 = {{fix comma category|{{#ifeq:{{{total_type}}}|
| {{#if:{{{population_total|}}}
| {{formatnum:{{replace|{{{population_total}}}|,|}}}}
}}
}}
}}
| rowclass88 = mergedtoprow
| header88 ={{#ifeq:{{{total_type}}}|
|
|{{#if:{{{population_total|}}}{{{population_urban|}}}{{{population_rural|}}}{{{population_metro|}}}{{{population_blank1|}}}{{{population_blank2|}}}{{{population_est|}}}
|Population<div class="ib-settlement-fn">{{#if:{{{population_as_of|}}}|{{nbsp}}({{{population_as_of}}})}}{{{population_footnotes|}}}</div>
}}
}}
| rowclass89 = mergedrow
| label89 = <div style="white-space:nowrap;"> • {{#if:{{{total_type|}}}|{{{total_type}}}|{{#if:{{{population_metro|}}}{{{population_urban|}}}{{{population_rural|}}}{{{area_metro_km2|}}}{{{area_metro_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_sq_mi|}}}{{{area_rural_km2|}}}{{{area_rural_sq_mi|}}}|{{if empty|{{{settlement_type|}}}|{{{type|}}}|City}}|Total}}}}</div>
| data89 = {{#ifeq:{{{total_type}}}|
|
|{{#if:{{{population_total|}}}
| {{fix comma category|{{formatnum:{{replace|{{{population_total}}}|,|}}}}}}
}}
}}
| rowclass90 = mergedrow
| label90 = <div style="white-space:nowrap;"> • Estimate {{#if:{{{pop_est_as_of|}}}|<div class="ib-settlement-fn">({{{pop_est_as_of}}}){{{pop_est_footnotes|}}}</div>}}</div>
| data90 = {{#if:{{{population_est|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_est}}}|,|}}}}}} }}
<!-- ***Population rank*** -->
| rowclass91 = mergedrow
| label91 = • Rank
| data91 = {{{population_rank|}}}
| rowclass92 = mergedrow
| label92 = • Density
| data92 = {{#if:{{{population_density_km2|}}}{{{population_density_sq_mi|}}}{{{population_total|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_km2|}}}
|/sqmi={{{population_density_sq_mi|}}}
|pop ={{{population_total|}}}
|dunam={{if empty|{{{area_land_dunam|}}}|{{{area_total_dunam|}}}}}
|ha ={{if empty|{{{area_land_ha|}}}|{{{area_total_ha|}}}}}
|km2 ={{if empty|{{{area_land_km2|}}}|{{{area_total_km2|}}}}}
|acre ={{if empty|{{{area_land_acre|}}}|{{{area_total_acre|}}}}}
|sqmi ={{if empty|{{{area_land_sq_mi|}}}|{{{area_total_sq_mi|}}}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
<!-- ***Population density rank*** -->
| rowclass93 = mergedrow
| label93 = • Rank
| data93 = {{{population_density_rank|}}}
| rowclass94 = mergedrow
| label94 = • [[Urban area|Urban]]<div class="ib-settlement-fn">{{{population_urban_footnotes|}}}</div>
| data94 = {{#if:{{{population_urban|}}}| {{fix comma category|{{formatnum:{{replace|{{{population_urban}}}|,|}}}}}} }}
| rowclass95 = mergedrow
| label95 = • Urban density
| data95 = {{#if:{{{population_density_urban_km2|}}}{{{population_density_urban_sq_mi|}}}{{{population_urban|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_urban_km2|}}}
|/sqmi={{{population_density_urban_sq_mi|}}}
|pop ={{{population_urban|}}}
|ha ={{{area_urban_ha|}}}
|km2 ={{{area_urban_km2|}}}
|acre ={{{area_urban_acre|}}}
|sqmi ={{{area_urban_sq_mi|}}}
|dunam={{{area_urban_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass96 = mergedrow
| label96 = • [[Rural area|Rural]]<div class="ib-settlement-fn">{{{population_rural_footnotes|}}}</div>
| data96 = {{#if:{{{population_rural|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_rural}}}|,|}}}}}}}}
| rowclass97 = mergedrow
| label97 = • Rural density
| data97 = {{#if:{{{population_density_rural_km2|}}}{{{population_density_rural_sq_mi|}}}{{{population_rural|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_rural_km2|}}}
|/sqmi={{{population_density_rural_sq_mi|}}}
|pop ={{{population_rural|}}}
|ha ={{{area_rural_ha|}}}
|km2 ={{{area_rural_km2|}}}
|acre ={{{area_rural_acre|}}}
|sqmi ={{{area_rural_sq_mi|}}}
|dunam={{{area_rural_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass98 = mergedrow
| label98 = • [[Metropolitan area|Metro]]<div class="ib-settlement-fn">{{{population_metro_footnotes|}}}</div>
| data98 = {{#if:{{{population_metro|}}}| {{fix comma category|{{formatnum:{{replace|{{{population_metro}}}|,|}}}}}} }}
| rowclass99 = mergedrow
| label99 = • Metro density
| data99 = {{#if:{{{population_density_metro_km2|}}}{{{population_density_metro_sq_mi|}}}{{{population_metro|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_metro_km2|}}}
|/sqmi={{{population_density_metro_sq_mi|}}}
|pop ={{{population_metro|}}}
|ha ={{{area_metro_ha|}}}
|km2 ={{{area_metro_km2|}}}
|acre ={{{area_metro_acre|}}}
|sqmi ={{{area_metro_sq_mi|}}}
|dunam={{{area_metro_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass100 = mergedrow
| label100 = • {{{population_blank1_title|}}}<div class="ib-settlement-fn">{{{population_blank1_footnotes|}}}</div>
| data100 = {{#if:{{{population_blank1|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_blank1}}}|,|}}}}}}}}
| rowclass101 = mergedrow
| label101 = • {{#if:{{{population_blank1_title|}}}|{{{population_blank1_title}}} density|Density}}
| data101 = {{#if:{{{population_density_blank1_km2|}}}{{{population_density_blank1_sq_mi|}}}{{{population_blank1|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_blank1_km2|}}}
|/sqmi={{{population_density_blank1_sq_mi|}}}
|pop ={{{population_blank1|}}}
|ha ={{{area_blank1_ha|}}}
|km2 ={{{area_blank1_km2|}}}
|acre ={{{area_blank1_acre|}}}
|sqmi ={{{area_blank1_sq_mi|}}}
|dunam={{{area_blank1_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass102 = mergedrow
| label102 = • {{{population_blank2_title|}}}<div class="ib-settlement-fn">{{{population_blank2_footnotes|}}}</div>
| data102 = {{#if:{{{population_blank2|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_blank2}}}|,|}}}}}}}}
| rowclass103 = mergedrow
| label103 = • {{#if:{{{population_blank2_title|}}}|{{{population_blank2_title}}} density|Density}}
| data103 = {{#if:{{{population_density_blank2_km2|}}}{{{population_density_blank2_sq_mi|}}}{{{population_blank2|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_blank2_km2|}}}
|/sqmi={{{population_density_blank2_sq_mi|}}}
|pop ={{{population_blank2|}}}
|ha ={{{area_blank2_ha|}}}
|km2 ={{{area_blank2_km2|}}}
|acre ={{{area_blank2_acre|}}}
|sqmi ={{{area_blank2_sq_mi|}}}
|dunam={{{area_blank2_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass104 = mergedrow
| label104 =
| data104 = {{{population_note|}}}
| rowclass105 = mergedtoprow
| label105 = {{Pluralize from text|{{if empty|{{{population_demonym|}}}|{{{population_demonyms|}}}{{force plural}}}}|<!--
-->link=Demonym|singular=Demonym|likely=Demonym(s)|plural=Demonyms}}
| data105 = {{if empty|{{{population_demonym|}}}|{{{population_demonyms|}}}}}{{Main other|{{Pluralize from text|{{{population_demonym|}}}|likely=[[Category:Pages using infobox settlement with possible demonym list]]}}}}
<!-- ***Demographics 1*** -->
| rowclass106 = mergedtoprow
| header106 = {{#if:{{{demographics_type1|}}}
|{{{demographics_type1}}}<div class="ib-settlement-fn">{{{demographics1_footnotes|}}}</div>}}
| rowclass107 = mergedrow
| label107 = • {{{demographics1_title1}}}
| data107 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title1|}}}|{{{demographics1_info1|}}}}}}}
| rowclass108 = mergedrow
| label108 = • {{{demographics1_title2}}}
| data108 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title2|}}}|{{{demographics1_info2|}}}}}}}
| rowclass109 = mergedrow
| label109 = • {{{demographics1_title3}}}
| data109 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title3|}}}|{{{demographics1_info3|}}}}}}}
| rowclass110 = mergedrow
| label110 = • {{{demographics1_title4}}}
| data110 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title4|}}}|{{{demographics1_info4|}}}}}}}
| rowclass111 = mergedrow
| label111 = • {{{demographics1_title5}}}
| data111 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title5|}}}|{{{demographics1_info5|}}}}}}}
| rowclass112 = mergedrow
| label112 = • {{{demographics1_title6}}}
| data112 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title6|}}}|{{{demographics1_info6|}}}}}}}
| rowclass113 = mergedrow
| label113 = • {{{demographics1_title7}}}
| data113 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title7|}}}|{{{demographics1_info7|}}}}}}}
| rowclass114 = mergedrow
| label114 = • {{{demographics1_title8}}}
| data114 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title8|}}}|{{{demographics1_info8|}}}}}}}
| rowclass115 = mergedrow
| label115 = • {{{demographics1_title9}}}
| data115 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title9|}}}|{{{demographics1_info9|}}}}}}}
| rowclass116 = mergedrow
| label116 = • {{{demographics1_title10}}}
| data116 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title10|}}}|{{{demographics1_info10|}}}}}}}
<!-- ***Demographics 2*** -->
| rowclass117 = mergedtoprow
| header117 = {{#if:{{{demographics_type2|}}}
|{{{demographics_type2}}}<div class="ib-settlement-fn">{{{demographics2_footnotes|}}}</div>}}
| rowclass118 = mergedrow
| label118 = • {{{demographics2_title1}}}
| data118 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title1|}}}|{{{demographics2_info1|}}}}}}}
| rowclass119 = mergedrow
| label119 = • {{{demographics2_title2}}}
| data119 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title2|}}}|{{{demographics2_info2|}}}}}}}
| rowclass120 = mergedrow
| label120 = • {{{demographics2_title3}}}
| data120 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title3|}}}|{{{demographics2_info3|}}}}}}}
| rowclass121 = mergedrow
| label121 = • {{{demographics2_title4}}}
| data121 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title4|}}}|{{{demographics2_info4|}}}}}}}
| rowclass122 = mergedrow
| label122 = • {{{demographics2_title5}}}
| data122 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title5|}}}|{{{demographics2_info5|}}}}}}}
| rowclass123 = mergedrow
| label123 = • {{{demographics2_title6}}}
| data123 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title6|}}}|{{{demographics2_info6|}}}}}}}
| rowclass124 = mergedrow
| label124 = • {{{demographics2_title7}}}
| data124 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title7|}}}|{{{demographics2_info7|}}}}}}}
| rowclass125 = mergedrow
| label125 = • {{{demographics2_title8}}}
| data125 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title8|}}}|{{{demographics2_info8|}}}}}}}
| rowclass126 = mergedrow
| label126 = • {{{demographics2_title9}}}
| data126 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title9|}}}|{{{demographics2_info9|}}}}}}}
| rowclass127 = mergedrow
| label127 = • {{{demographics2_title10}}}
| data127 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title10|}}}|{{{demographics2_info10|}}}}}}}
<!-- ***Time Zones*** -->
| rowclass128 = mergedtoprow
| header128 = {{#if:{{{timezone1_location|}}}{{{time_zone1_location|}}}|{{#if:{{{timezone2|}}}{{{time_zone2|}}}|[[{{if empty|{{{timezone_link|}}}|{{{time_zone_link|}}}|Time zone}}|Time zone]]s|[[{{if empty|{{{timezone_link|}}}|{{{time_zone_link|}}}|Time zone}}|Time zone]]}}|}}
| rowclass129 = {{#if:{{{timezone1_location|}}}{{{time_zone1_location|}}}|mergedrow|mergedtoprow}}
| label129 = {{#if:{{{timezone1_location|}}}{{{time_zone1_location|}}}|{{{timezone1_location|}}}{{{time_zone1_location|}}}|{{#if:{{{timezone2_location|}}}{{{time_zone2_location|}}}|{{{timezone2_location}}}{{{time_zone2_location|}}}|{{#if:{{{timezone2|}}}{{{time_zone2|}}}|[[{{if empty|{{{timezone_link|}}}|{{{time_zone_link|}}}|Time zone}}|Time zone]]s|[[{{if empty|{{{timezone_link|}}}|{{{time_zone_link|}}}|Time zone}}|Time zone]]}}}}}}
| data129 = {{#if:{{{utc_offset1|}}}{{{utc_offset|}}}
|[[UTC{{if empty|{{{utc_offset1|}}}|{{{utc_offset}}}}}]] {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}|({{if empty|{{{timezone1|}}}|{{{time_zone1|}}}|{{{timezone|}}}|{{{time_zone|}}}}})}}
|{{if empty|{{{timezone1|}}}|{{{time_zone1|}}}|{{{timezone|}}}|{{{time_zone|}}}}}
}}
| rowclass130 = mergedrow
| label130 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data130 = {{#if:{{{utc_offset1_DST|}}}{{{utc_offset_DST|}}}
|[[UTC{{if empty|{{{utc_offset1_DST|}}}|{{{utc_offset_DST|}}}}}]] {{#if:{{{timezone1_DST|}}}{{{time_zone1_DST|}}}{{{timezone_DST|}}}{{{time_zone_DST|}}}|({{if empty|{{{timezone1_DST|}}}|{{{time_zone1_DST|}}}|{{{timezone_DST|}}}|{{{time_zone_DST|}}}}})}}
|{{if empty|{{{timezone1_DST|}}}|{{{time_zone1_DST|}}}|{{{timezone_DST|}}}|{{{time_zone_DST|}}}}}
}}
| rowclass131 = mergedrow
| label131 = {{if empty|{{{timezone2_location|}}}|{{{time_zone2_location|}}}|<nowiki />}}
| data131 = {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}{{{utc_offset1|}}}{{{utc_offset|}}}
|{{#if:{{{utc_offset2|}}}
|[[UTC{{{utc_offset2|}}}]] {{#if:{{{timezone2|}}}{{{time_zone2|}}}|({{if empty|{{{timezone2|}}}|{{{time_zone2|}}}}})}}
|{{if empty|{{{timezone2|}}}|{{{time_zone2|}}}}}
}}
}}
| rowclass132 = mergedrow
| label132 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data132 = {{#if:{{{utc_offset2_DST|}}}|[[UTC{{{utc_offset2_DST|}}}]] {{#if:{{{timezone2_DST|}}}{{{time_zone2_DST|}}}|({{if empty|{{{timezone2_DST|}}}|{{{time_zone2_DST|}}}}})}}
|{{if empty|{{{timezone2_DST|}}}|{{{time_zone2_DST|}}}}}
}}
| rowclass133 = mergedrow
| label133 = {{if empty|{{{timezone3_location|}}}|{{{time_zone3_location|}}}|<nowiki />}}
| data133 = {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}{{{utc_offset1|}}}{{{utc_offset|}}}
|{{#if:{{{utc_offset3|}}}
|[[UTC{{{utc_offset3|}}}]] {{#if:{{{timezone3|}}}{{{time_zone3|}}}|({{if empty|{{{timezone3|}}}|{{{time_zone3|}}}}})}}
|{{if empty|{{{timezone3|}}}|{{{time_zone3|}}}}}
}}
}}
| rowclass134 = mergedrow
| label134 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data134 = {{#if:{{{utc_offset3_DST|}}}|[[UTC{{{utc_offset3_DST|}}}]] {{#if:{{{timezone3_DST|}}}{{{time_zone3_DST|}}}|({{if empty|{{{timezone3_DST|}}}|{{{time_zone3_DST|}}}}})}}
|{{if empty|{{{timezone3_DST|}}}|{{{time_zone3_DST|}}}}}
}}
| rowclass135 = mergedrow
| label135 = {{if empty|{{{timezone4_location|}}}|{{{time_zone4_location|}}}|<nowiki />}}
| data135 = {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}{{{utc_offset1|}}}{{{utc_offset|}}}
|{{#if:{{{utc_offset4|}}}
|[[UTC{{{utc_offset4|}}}]] {{#if:{{{timezone4|}}}{{{time_zone4|}}}|({{if empty|{{{timezone4|}}}|{{{time_zone4|}}}}})}}
|{{if empty|{{{timezone4|}}}|{{{time_zone4|}}}}}
}}
}}
| rowclass136 = mergedrow
| label136 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data136 = {{#if:{{{utc_offset4_DST|}}}|[[UTC{{{utc_offset4_DST|}}}]] {{#if:{{{timezone4_DST|}}}{{{time_zone4_DST|}}}|({{if empty|{{{timezone4_DST|}}}|{{{time_zone4_DST|}}}}})}}
|{{if empty|{{{timezone4_DST|}}}|{{{time_zone4_DST|}}}}}
}}
| rowclass137 = mergedrow
| label137 = {{if empty|{{{timezone5_location|}}}|{{{time_zone5_location|}}}|<nowiki />}}
| data137 = {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}{{{utc_offset1|}}}{{{utc_offset|}}}
|{{#if:{{{utc_offset5|}}}
|[[UTC{{{utc_offset5|}}}]] {{#if:{{{timezone5|}}}{{{time_zone5|}}}|({{if empty|{{{timezone5|}}}|{{{time_zone5|}}}}})}}
|{{if empty|{{{timezone5|}}}|{{{time_zone5|}}}}}
}}
}}
| rowclass138 = mergedrow
| label138 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data138 = {{#if:{{{utc_offset5_DST|}}}|[[UTC{{{utc_offset5_DST|}}}]] {{#if:{{{timezone5_DST|}}}{{{time_zone5_DST|}}}|({{if empty|{{{timezone5_DST|}}}|{{{time_zone5_DST|}}}}})}}
|{{if empty|{{{timezone5_DST|}}}|{{{time_zone5_DST|}}}}}
}}
<!-- ***Postal Code(s)*** -->
| rowclass139 = mergedtoprow
| label139 = {{if empty|{{{postal_code_type|}}}|{{Pluralize from text|any_comma=1|parse_links=1|{{{postal_code|}}}|link=Postal code|singular=Postal code|plural=Postal codes}}}}
| class139 = adr
| data139 = {{#if:{{{postal_code|}}}|<div class="postal-code">{{{postal_code}}}</div>}}
| rowclass140 = {{#if:{{{postal_code|}}}|mergedbottomrow|mergedtoprow}}
| label140 = {{if empty|{{{postal2_code_type|}}}|{{Pluralize from text|any_comma=1|parse_links=1|{{{postal2_code|}}}|link=Postal code|singular=Postal code|plural=Postal codes}}}}
| class140 = adr
| data140 = {{#if:{{{postal2_code|}}}|<div class="postal-code">{{{postal2_code}}}</div>}}
<!-- ***Area Code(s)*** -->
| rowclass141 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}|mergedrow|mergedtoprow}}
| label141 = {{if empty|{{{area_code_type|}}}|{{Pluralize from text|any_comma=1|parse_links=1|{{if empty|{{{area_code|}}}|{{{area_codes|}}}{{force plural}}}}|<!--
-->link=Telephone numbering plan|singular=Area code|likely=Area code(s)|plural=Area codes}}}}
| data141 = {{if empty|{{{area_code|}}}|{{{area_codes|}}}}}{{#if:{{{area_code_type|}}}||{{Main other|{{Pluralize from text|any_comma=1|parse_links=1|{{{area_code|}}}|||[[Category:Pages using infobox settlement with possible area code list]]}}}}}}
<!-- Geocode-->
| rowclass142 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}|mergedrow|mergedtoprow}}
| label142 = [[Geocode]]
| class142 = nickname
| data142 = {{{geocode|}}}
<!-- ISO Code-->
| rowclass143 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}{{{geocode|}}}|mergedrow|mergedtoprow}}
| label143 = [[ISO 3166|ISO 3166 code]]
| class143 = nickname
| data143 = {{{iso_code|}}}
<!-- Vehicle registration plate-->
| rowclass144 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}|mergedrow|mergedtoprow}}
| label144 = {{if empty|{{{registration_plate_type|}}}|[[Vehicle registration plate|Vehicle registration]]}}
| data144 = {{{registration_plate|}}}
<!-- Other codes -->
| rowclass145 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}{{{registration_plate|}}}|mergedrow|mergedtoprow}}
| label145 = {{{code1_name|}}}
| class145 = nickname
| data145 = {{#if:{{{code1_name|}}}|{{{code1_info|}}}}}
| rowclass146 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}{{{registration_plate|}}}{{{code1_name|}}}|mergedrow|mergedtoprow}}
| label146 = {{{code2_name|}}}
| class146 = nickname
| data146 = {{#if:{{{code2_name|}}}|{{{code2_info|}}}}}
<!-- ***Blank Fields (two sections)*** -->
| rowclass147 = mergedtoprow
| label147 = {{if empty|{{{blank_name_sec1|}}}|{{{blank_name|}}}|{{{custom_label_sec1|}}}}}
| data147 = {{#if:{{{blank_name_sec1|}}}{{{blank_name|}}}{{{custom_label_sec1|}}}|{{if empty|{{{blank_info_sec1|}}}|{{{blank_info|}}}|{{{custom_data_sec1|}}}}}}}
| rowclass148 = mergedrow
| label148 = {{if empty|{{{blank1_name_sec1|}}}|{{{blank1_name|}}}|{{{custom_label1_sec1|}}}}}
| data148 = {{#if:{{{blank1_name_sec1|}}}{{{blank1_name|}}}{{{custom_label1_sec1|}}}|{{if empty|{{{blank1_info_sec1|}}}|{{{blank1_info|}}}|{{{custom_data1_sec1|}}}}}}}
| rowclass149 = mergedrow
| label149 = {{if empty|{{{blank2_name_sec1|}}}|{{{blank2_name|}}}|{{{custom_label2_sec1|}}}}}
| data149 = {{#if:{{{blank2_name_sec1|}}}{{{blank2_name|}}}{{{custom_label2_sec1|}}}|{{if empty|{{{blank2_info_sec1|}}}|{{{blank2_info|}}}|{{{custom_data2_sec1|}}}}}}}
| rowclass150 = mergedrow
| label150 = {{if empty|{{{blank3_name_sec1|}}}|{{{blank3_name|}}}|{{{custom_label3_sec1|}}}}}
| data150 = {{#if:{{{blank3_name_sec1|}}}{{{blank3_name|}}}{{{custom_label3_sec1|}}}|{{if empty|{{{blank3_info_sec1|}}}|{{{blank3_info|}}}|{{{custom_data3_sec1|}}}}}}}
| rowclass151 = mergedrow
| label151 = {{if empty|{{{blank4_name_sec1|}}}|{{{blank4_name|}}}|{{{custom_label4_sec1|}}}}}
| data151 = {{#if:{{{blank4_name_sec1|}}}{{{blank4_name|}}}{{{custom_label4_sec1|}}}|{{if empty|{{{blank4_info_sec1|}}}|{{{blank4_info|}}}|{{{custom_data4_sec1|}}}}}}}
| rowclass152 = mergedrow
| label152 = {{if empty|{{{blank5_name_sec1|}}}|{{{blank5_name|}}}|{{{custom_label5_sec1|}}}}}
| data152 = {{#if:{{{blank5_name_sec1|}}}{{{blank5_name|}}}{{{custom_label5_sec1|}}}|{{if empty|{{{blank5_info_sec1|}}}|{{{blank5_info|}}}|{{{custom_data5_sec1|}}}}}}}
| rowclass153 = mergedrow
| label153 = {{if empty|{{{blank6_name_sec1|}}}|{{{blank6_name|}}}|{{{custom_label6_sec1|}}}}}
| data153 = {{#if:{{{blank6_name_sec1|}}}{{{blank6_name|}}}{{{custom_label6_sec1|}}}|{{if empty|{{{blank6_info_sec1|}}}|{{{blank6_info|}}}|{{{custom_data6_sec1|}}}}}}}
| rowclass154 = mergedrow
| label154 = {{if empty|{{{blank7_name_sec1|}}}|{{{blank7_name|}}}|{{{custom_label7_sec1|}}}}}
| data154 = {{#if:{{{blank7_name_sec1|}}}{{{blank7_name|}}}{{{custom_label7_sec1|}}}|{{if empty|{{{blank7_info_sec1|}}}|{{{blank7_info|}}}|{{{custom_data7_sec1|}}}}}}}
| rowclass155 = mergedtoprow
| label155 = {{if empty|{{{blank_name_sec2|}}}|{{{custom_label_sec2|}}}}}
| data155 = {{#if:{{{blank_name_sec2|}}}{{{custom_label_sec2|}}}|{{if empty|{{{blank_info_sec2|}}}|{{{custom_data_sec2|}}}}}}}
| rowclass156 = mergedrow
| label156 = {{if empty|{{{blank1_name_sec2|}}}|{{{custom_label1_sec2|}}}}}
| data156 = {{#if:{{{blank1_name_sec2|}}}{{{custom_label1_sec2|}}}|{{if empty|{{{blank1_info_sec2|}}}|{{{custom_data1_sec2|}}}}}}}
| rowclass157 = mergedrow
| label157 = {{if empty|{{{blank2_name_sec2|}}}|{{{custom_label2_sec2|}}}}}
| data157 = {{#if:{{{blank2_name_sec2|}}}{{{custom_label2_sec2|}}}|{{if empty|{{{blank2_info_sec2|}}}|{{{custom_data2_sec2|}}}}}}}
| rowclass158 = mergedrow
| label158 = {{if empty|{{{blank3_name_sec2|}}}|{{{custom_label3_sec2|}}}}}
| data158 = {{#if:{{{blank3_name_sec2|}}}{{{custom_label3_sec2|}}}|{{if empty|{{{blank3_info_sec2|}}}|{{{custom_data3_sec2|}}}}}}}
| rowclass159 = mergedrow
| label159 = {{if empty|{{{blank4_name_sec2|}}}|{{{custom_label4_sec2|}}}}}
| data159 = {{#if:{{{blank4_name_sec2|}}}{{{custom_label4_sec2|}}}|{{if empty|{{{blank4_info_sec2|}}}|{{{custom_data4_sec2|}}}}}}}
| rowclass160 = mergedrow
| label160 = {{if empty|{{{blank5_name_sec2|}}}|{{{custom_label5_sec2|}}}}}
| data160 = {{#if:{{{blank5_name_sec2|}}}{{{custom_label5_sec2|}}}|{{if empty|{{{blank5_info_sec2|}}}|{{{custom_data5_sec2|}}}}}}}
| rowclass161 = mergedrow
| label161 = {{if empty|{{{blank6_name_sec2|}}}|{{{custom_label6_sec2|}}}}}
| data161 = {{#if:{{{blank6_name_sec2|}}}{{{custom_label6_sec2|}}}|{{if empty|{{{blank6_info_sec2|}}}|{{{custom_data6_sec2|}}}}}}}
| rowclass162 = mergedrow
| label162 = {{if empty|{{{blank7_name_sec2|}}}|{{{custom_label7_sec2|}}}}}
| data162 = {{#if:{{{blank7_name_sec2|}}}{{{custom_label7_sec2|}}}|{{if empty|{{{blank7_info_sec2|}}}|{{{custom_data7_sec2|}}}}}}}
<!-- ***Website*** -->
| rowclass163 = mergedtoprow
| label163 = Website
| data163 = {{{website|}}}
| class164 = maptable
| data164 = {{{module|}}}
<!-- ***Footnotes*** -->
| belowrowclass = mergedtoprow
| below = {{{footnotes|}}}
}}<!-- Check for unknowns
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using {{if empty|{{lcfirst:{{{template_name|}}}}}|infobox settlement}} with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview = Page using [[Template:{{if empty|{{ucfirst:{{{template_name|}}}}}|Infobox settlement}}]] with unknown parameter "_VALUE_"|ignoreblank=y|mapframe_args=y
| alt | anthem | anthem_link | area_blank1_acre | area_blank1_dunam | area_blank1_ha | area_blank1_km2 | area_blank1_sq_mi | area_blank1_title | area_blank2_acre | area_blank2_dunam | area_blank2_ha | area_blank2_km2 | area_blank2_sq_mi | area_blank2_title | area_code | area_code_type | area_codes | area_footnotes | area_land_acre | area_land_dunam | area_land_ha | area_land_km2 | area_land_sq_mi | area_metro_acre | area_metro_dunam | area_metro_footnotes | area_metro_ha | area_metro_km2 | area_metro_sq_mi | area_note | area_rank | area_rural_acre | area_rural_dunam | area_rural_footnotes | area_rural_ha | area_rural_km2 | area_rural_sq_mi | area_total_acre | area_total_dunam | area_total_ha | area_total_km2 | area_total_sq_mi | area_urban_acre | area_urban_dunam | area_urban_footnotes | area_urban_ha | area_urban_km2 | area_urban_sq_mi | area_water_acre | area_water_dunam | area_water_ha | area_water_km2 | area_water_percent | area_water_sq_mi
| blank_emblem_alt | blank_emblem_link | blank_emblem_size | blank_emblem_type | blank_emblem_upright
| blank_info | blank_info_sec1 | blank_info_sec2 | blank_name | blank_name_sec1 | blank_name_sec2 | blank1_info | blank1_info_sec1 | blank1_info_sec2 | blank1_name | blank1_name_sec1 | blank1_name_sec2 | blank2_info | blank2_info_sec1 | blank2_info_sec2 | blank2_name | blank2_name_sec1 | blank2_name_sec2 | blank3_info | blank3_info_sec1 | blank3_info_sec2 | blank3_name | blank3_name_sec1 | blank3_name_sec2 | blank4_info | blank4_info_sec1 | blank4_info_sec2 | blank4_name | blank4_name_sec1 | blank4_name_sec2 | blank5_info | blank5_info_sec1 | blank5_info_sec2 | blank5_name | blank5_name_sec1 | blank5_name_sec2 | blank6_info | blank6_info_sec1 | blank6_info_sec2 | blank6_name | blank6_name_sec1 | blank6_name_sec2 | blank7_info | blank7_info_sec1 | blank7_info_sec2 | blank7_name | blank7_name_sec1 | blank7_name_sec2 | caption | code1_info | code1_name | code2_info | code2_name | coor_pinpoint | coor_type | coordinates | coordinates_footnotes | demographics_type1 | demographics_type2 | demographics1_footnotes | demographics1_info1 | demographics1_info10 | demographics1_info2 | demographics1_info3 | demographics1_info4 | demographics1_info5 | demographics1_info6 | demographics1_info7 | demographics1_info8 | demographics1_info9 | demographics1_title1 | demographics1_title10 | demographics1_title2 | demographics1_title3 | demographics1_title4 | demographics1_title5 | demographics1_title6 | demographics1_title7 | demographics1_title8 | demographics1_title9 | demographics2_footnotes | demographics2_info1 | demographics2_info10 | demographics2_info2 | demographics2_info3 | demographics2_info4 | demographics2_info5 | demographics2_info6 | demographics2_info7 | demographics2_info8 | demographics2_info9 | demographics2_title1 | demographics2_title10 | demographics2_title2 | demographics2_title3 | demographics2_title4 | demographics2_title5 | demographics2_title6 | demographics2_title7 | demographics2_title8 | demographics2_title9 | dimensions_footnotes | dunam_link | elevation_footnotes | elevation_ft | elevation_link | elevation_m | elevation_max_footnotes | elevation_max_ft | elevation_max_m | elevation_max_point | elevation_max_rank | elevation_min_footnotes | elevation_min_ft | elevation_min_m | elevation_min_point | elevation_min_rank | elevation_point | embed | established_date | established_date1 | established_date2 | established_date3 | established_date4 | established_date5 | established_date6 | established_date7 | established_title | established_title1 | established_title2 | established_title3 | established_title4 | established_title5 | established_title6 | established_title7 | etymology | extinct_date | extinct_title | flag_alt | flag_border | flag_link | flag_size | footnotes | founder | geocode | governing_body | government_footnotes | government_type | government_blank1_title | government_blank1 | government_blank2_title | government_blank2 | government_blank3 | government_blank3_title | government_blank4_title | government_blank4 | government_blank5_title | government_blank5 | government_blank6_title | government_blank6 | grid_name | grid_position
| image_alt | image_blank_emblem | image_caption | image_flag | image_map | image_map1 | image_seal | image_shield | image_size | image_skyline | imagesize | image_upright
| iso_code | leader_name | leader_name1 | leader_name2 | leader_name3 | leader_name4 | leader_name5 | leader_party | leader_title | leader_title1 | leader_title2 | leader_title3 | leader_title4 | leader_title5 | length_km | length_mi | map_alt | map_alt1 | map_caption | map_caption1 | mapsize | mapsize1 | module | motto | motto_link | mottoes | name | named_for | native_name | native_name_lang | nickname | nickname_link | nicknames | official_name | other_name | p1 | p10 | p11 | p12 | p13 | p14 | p15 | p16 | p17 | p18 | p19 | p2 | p20 | p21 | p22 | p23 | p24 | p25 | p26 | p27 | p28 | p29 | p3 | p30 | p31 | p32 | p33 | p34 | p35 | p36 | p37 | p38 | p39 | p4 | p40 | p41 | p42 | p43 | p44 | p45 | p46 | p47 | p48 | p49 | p5 | p50 | p6 | p7 | p8 | p9 | parts | parts_style | parts_type | pop_est_as_of | pop_est_footnotes | population_as_of | population_blank1 | population_blank1_footnotes | population_blank1_title | population_blank2 | population_blank2_footnotes | population_blank2_title | population_demonym | population_demonyms | population_density_blank1_km2 | population_density_blank1_sq_mi | population_density_blank2_km2 | population_density_blank2_sq_mi | population_density_km2 | population_density_metro_km2 | population_density_metro_sq_mi | population_density_rank | population_density_rural_km2 | population_density_rural_sq_mi | population_density_sq_mi | population_density_urban_km2 | population_density_urban_sq_mi | population_est | population_footnotes | population_metro | population_metro_footnotes | population_note | population_rank | population_rural | population_rural_footnotes | population_total | population_urban | population_urban_footnotes | postal_code | postal_code_type | postal2_code | postal2_code_type | pushpin_image | pushpin_label | pushpin_label_position | pushpin_map | pushpin_map_alt | pushpin_map_caption | pushpin_map_caption_notsmall | pushpin_map_narrow | pushpin_mapsize | pushpin_outside | pushpin_overlay | pushpin_relief | registration_plate | registration_plate_type | seal_alt | seal_class | seal_link | seal_size | seal_type | seat | seat_type | seat1 | seat1_type | seat2 | seat2_type | settlement_type | shield_alt | shield_link | shield_size | short_description <!--used by Module:Settlement short description-->| subdivision_name | subdivision_name1 | subdivision_name2 | subdivision_name3 | subdivision_name4 | subdivision_name5 | subdivision_name6 | subdivision_type | subdivision_type1 | subdivision_type2 | subdivision_type3 | subdivision_type4 | subdivision_type5 | subdivision_type6 | template_name | timezone | timezone_DST | timezone_link | timezone1 | timezone1_DST | timezone1_location | timezone2 | timezone2_DST | timezone2_location | timezone3 | timezone3_DST | timezone3_location | timezone4 | timezone4_DST | timezone4_location | timezone5 | timezone5_DST | timezone5_location | total_type | translit_lang1 | translit_lang1_info | translit_lang1_info1 | translit_lang1_info2 | translit_lang1_info3 | translit_lang1_info4 | translit_lang1_info5 | translit_lang1_info6 | translit_lang1_type | translit_lang1_type1 | translit_lang1_type2 | translit_lang1_type3 | translit_lang1_type4 | translit_lang1_type5 | translit_lang1_type6 | translit_lang2 | translit_lang2_info | translit_lang2_info1 | translit_lang2_info2 | translit_lang2_info3 | translit_lang2_info4 | translit_lang2_info5 | translit_lang2_info6 | translit_lang2_type | translit_lang2_type1 | translit_lang2_type2 | translit_lang2_type3 | translit_lang2_type4 | translit_lang2_type5 | translit_lang2_type6 | type | unit_pref | utc_offset | utc_offset_DST | utc_offset1 | utc_offset1_DST | utc_offset2 | utc_offset2_DST | utc_offset3 | utc_offset3_DST | utc_offset4 | utc_offset4_DST | utc_offset5 | utc_offset5_DST | website | width_km | width_mi <!--
NEW PARAMETERS AS PART OF REFACTOR - Will be integrated in alphebetical order once refactor is completed
-->| pushpin_map_args=y | map_size | map_size1 | image | custom_label_sec1 | custom_data_sec1 | custom_label1_sec1 | custom_data1_sec1 | custom_label2_sec1 | custom_data2_sec1 | custom_label3_sec1 | custom_data3_sec1 | custom_label4_sec1 | custom_data4_sec1 | custom_label5_sec1 | custom_data5_sec1 | custom_label6_sec1 | custom_data6_sec1 | custom_label7_sec1 | custom_data7_sec1 | custom_label_sec2 | custom_data_sec2 | custom_label1_sec2 | custom_data1_sec2 | custom_label2_sec2 | custom_data2_sec2 | custom_label3_sec2 | custom_data3_sec2 | custom_label4_sec2 | custom_data4_sec2 | custom_label5_sec2 | custom_data5_sec2 | custom_label6_sec2 | custom_data6_sec2 | custom_label7_sec2 | custom_data7_sec2 | time_zone | time_zone1_location | time_zone2 | time_zone_link | time_zone2_location | time_zone1 | time_zone1_DST | time_zone_DST | time_zone2_DST | time_zone3_location | time_zone3 | time_zone3_DST | time_zone4_location | time_zone4 | time_zone4_DST | time_zone5_location | time_zone5 | time_zone5_DST }}<!--
-->{{#invoke:Check for conflicting parameters|check|nested=1
| template = [[Template:{{if empty|{{ucfirst:{{{template_name|}}}}}|Infobox settlement}}]]
| cat = {{main other|Category:Pages using {{if empty|{{lcfirst:{{{template_name|}}}}}|infobox settlement}} with conflicting parameters}}
| settlement_type; type
| image_size; imagesize
| image_alt; alt
| image_caption; caption
| nickname; nicknames
| motto; mottoes
| coor_pinpoint; coor_type
| population_demonym; population_demonyms
| utc_offset1; utc_offset
| timezone1; timezone
| utc_offset1_DST; utc_offset_DST
| timezone1_DST; timezone_DST
| area_code; area_codes
| blank_name_sec1; blank_name
| blank_info_sec1; blank_info
| blank1_name_sec1; blank1_name
| blank1_info_sec1; blank1_info
| blank2_name_sec1; blank2_name
| blank2_info_sec1; blank2_info
| blank3_name_sec1; blank3_name
| blank3_info_sec1; blank3_info
| blank4_name_sec1; blank4_name
| blank4_info_sec1; blank4_info
| blank5_name_sec1; blank5_name
| blank5_info_sec1; blank5_info
| blank6_name_sec1; blank6_name
| blank6_info_sec1; blank6_info
| blank7_name_sec1; blank7_name
| blank7_info_sec1; blank7_info
}}<!-- Wikidata
-->{{#if:{{{coordinates_wikidata|}}}{{{wikidata|}}}
|[[Category:Pages using infobox settlement with the wikidata parameter]]
}}{{main other|<!-- Missing country
-->{{#if:{{{subdivision_name|}}}||[[Category:Pages using infobox settlement with missing country]]}}<!-- No map
-->{{#if:{{{pushpin_map|}}}{{{image_map|}}}{{{image_map1|}}}||[[Category:Pages using infobox settlement with no map]]}}<!-- Image_map1 without image_map
-->{{#if:{{{image_map1|}}}|{{#if:{{{image_map|}}}||[[Category:Pages using infobox settlement with image_map1 but not image_map]]}}}}<!-- No coordinates
-->{{#if:{{{coordinates|}}}||[[Category:Pages using infobox settlement with no coordinates]]}}<!--
-->{{#if:{{{embed|}}}|[[Category:Pages using infobox settlement with embed]]}}
}}<!-- Gathering information on over-use of maps
-->{{#ifexpr:{{#invoke:ParameterCount|main|mapframe|image_map|image_map1|pushpin_map}} >2 |{{main other| [[Category:Pages using infobox settlement with potentially too many maps]]}}}}</includeonly>{{#invoke:Check for deprecated parameters|check
| _category = {{main other|[[Category:Pages using infobox settlement with deprecated parameters|_VALUE_]]}}
| _remove = pushpin_map_caption_notsmall; pushpin_outside; pushpin_overlay; pushpin_image
| settlement_type = type
| image_skyline = image
| imagesize = image_size
| image_alt = alt
| image_caption = caption
| mapsize = map_size
| mapsize1 = map_size1
| pushpin_map_alt = pushpin_alt
| pushpin_map_caption = pushpin_caption
| pushpin_mapsize = pushpin_map_size
| _regexp1 = blank(%d*)_name = custom_label%1_sec1
| _regexp2 = blank(%d*)_info = custom_data%1_sec1
| _regexp3 = blank(%d*)_name_sec(%d) = custom_label%1_sec%2
| _regexp4 = blank(%d*)_info_sec(%d) = custom_data%1_sec%2
| timezone = time_zone
| timezone_DST = time_zone_DST
| timezone_link = time_zone_link
| _regexp5 = timezone(%d) = time_zone%1
| _regexp6 = timezone(%d)_DST = time_zone%1_DST
| _regexp7 = timezone(%d)_location = time_zone%1_location
}}<noinclude>
{{documentation}}
<!--Please add this template's categories to the /doc subpage, not here - thanks!-->
</noinclude>
4f9mvbj3eh4zogv4xcy6l5erci596gf
21750
21749
2026-09-18T15:05:25Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement]]: Importing from the English wikipedia
21749
wikitext
text/x-wiki
<includeonly>{{main other|{{#invoke:Settlement short description|main}}|}}{{Infobox
| child = {{yesno|{{{embed|}}}}}
| templatestyles = Infobox settlement/styles.css
| bodyclass = ib-settlement vcard
<!--** names, type, and transliterations ** -->
| above = <div class="fn org">{{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}</div>
{{#if:{{{native_name|}}}|<div class="nickname ib-settlement-native" {{#if:{{{native_name_lang|}}}|lang="{{{native_name_lang}}}"}}>{{{native_name}}}</div>}}{{#if:{{{other_name|}}}|<div class="nickname ib-settlement-other-name">{{{other_name}}}</div>}}
| subheader = {{#if:{{{settlement_type|}}}{{{type|}}}|<div class="category">{{if empty|{{{settlement_type|}}}|{{{type|}}}}}</div>}}
| rowclass1 = mergedtoprow ib-settlement-official
| data1 = {{#if:{{{name|}}}|{{{official_name|}}}}}
<!-- ***Transliteration language 1*** -->
| rowclass2 = mergedtoprow
| header2 = {{#if:{{{translit_lang1|}}}|{{{translit_lang1}}} transcription(s)}}
| rowclass3 = {{#if:{{{translit_lang1_type1|}}}|mergedrow|mergedbottomrow}}
| label3 = • {{{translit_lang1_type}}}
| data3 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type|}}}|{{{translit_lang1_info|}}}}}}}
| rowclass4 = {{#if:{{{translit_lang1_type2|}}}|mergedrow|mergedbottomrow}}
| label4 = • {{{translit_lang1_type1}}}
| data4 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type1|}}}|{{{translit_lang1_info1|}}}}}}}
| rowclass5 = {{#if:{{{translit_lang1_type3|}}}|mergedrow|mergedbottomrow}}
| label5 = • {{{translit_lang1_type2}}}
| data5 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type2|}}}|{{{translit_lang1_info2|}}}}}}}
| rowclass6 = {{#if:{{{translit_lang1_type4|}}}|mergedrow|mergedbottomrow}}
| label6 = • {{{translit_lang1_type3}}}
| data6 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type3|}}}|{{{translit_lang1_info3|}}}}}}}
| rowclass7 = {{#if:{{{translit_lang1_type5|}}}|mergedrow|mergedbottomrow}}
| label7 = • {{{translit_lang1_type4}}}
| data7 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type4|}}}|{{{translit_lang1_info4|}}}}}}}
| rowclass8 = {{#if:{{{translit_lang1_type6|}}}|mergedrow|mergedbottomrow}}
| label8 = • {{{translit_lang1_type5}}}
| data8 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type5|}}}|{{{translit_lang1_info5|}}}}}}}
| rowclass9 = mergedbottomrow
| label9 = • {{{translit_lang1_type6}}}
| data9 = {{#if:{{{translit_lang1|}}}|{{#if:{{{translit_lang1_type6|}}}|{{{translit_lang1_info6|}}}}}}}
<!-- ***Transliteration language 2*** -->
| rowclass10 = mergedtoprow
| header10 = {{#if:{{{translit_lang2|}}}|{{{translit_lang2}}} transcription(s)}}
| rowclass11 = {{#if:{{{translit_lang2_type1|}}}|mergedrow|mergedbottomrow}}
| label11 = • {{{translit_lang2_type}}}
| data11 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type|}}}|{{{translit_lang2_info|}}}}}}}
| rowclass12 = {{#if:{{{translit_lang2_type2|}}}|mergedrow|mergedbottomrow}}
| label12 = • {{{translit_lang2_type1}}}
| data12 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type1|}}}|{{{translit_lang2_info1|}}}}}}}
| rowclass13 = {{#if:{{{translit_lang2_type3|}}}|mergedrow|mergedbottomrow}}
| label13 = • {{{translit_lang2_type2}}}
| data13 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type2|}}}|{{{translit_lang2_info2|}}}}}}}
| rowclass14 = {{#if:{{{translit_lang2_type4|}}}|mergedrow|mergedbottomrow}}
| label14 = • {{{translit_lang2_type3}}}
| data14 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type3|}}}|{{{translit_lang2_info3|}}}}}}}
| rowclass15 = {{#if:{{{translit_lang2_type5|}}}|mergedrow|mergedbottomrow}}
| label15 = • {{{translit_lang2_type4}}}
| data15 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type4|}}}|{{{translit_lang2_info4|}}}}}}}
| rowclass16 = {{#if:{{{translit_lang2_type6|}}}|mergedrow|mergedbottomrow}}
| label16 = • {{{translit_lang2_type5}}}
| data16 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type5|}}}|{{{translit_lang2_info5|}}}}}}}
| rowclass17 = mergedbottomrow
| label17 = • {{{translit_lang2_type6}}}
| data17 = {{#if:{{{translit_lang2|}}}|{{#if:{{{translit_lang2_type6|}}}|{{{translit_lang2_info6|}}}}}}}
<!-- end ** names, type, and transliterations ** -->
<!-- ***Skyline Image*** -->
| rowclass18 = mergedtoprow
| data18 = {{#if:{{{image_skyline|}}}{{{image|}}}|<!--
-->{{#invoke:InfoboxImage|InfoboxImage<!--
-->|image={{if empty|{{{image_skyline|}}}|{{{image|}}}}}<!--
-->|size={{if empty|{{{image_size|}}}|{{{imagesize|}}}}}|sizedefault=250px|upright={{{image_upright|}}}<!--
-->|alt={{if empty|{{{image_alt|}}}|{{{alt|}}}}}<!--
-->|title={{if empty|{{{image_caption|}}}|{{{caption|}}}|{{{image_alt|}}}|{{{alt|}}}}}}}<!--
-->{{#if:{{{image_caption|}}}{{{caption|}}}|<div class="ib-settlement-caption">{{if empty|{{{image_caption|}}}|{{{caption|}}}}}</div>}} }}
<!-- ***Flag, Seal, Shield and Coat of arms*** -->
| rowclass19 = mergedtoprow
| class19 = maptable
| data19 = {{#if:{{{image_flag|}}}{{{image_seal|}}}{{{image_shield|}}}{{{image_blank_emblem|}}}{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}
|{{Infobox settlement/columns
| 1 = {{#if:{{{image_flag|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_flag}}}|size={{{flag_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|125px|100x100px}}|border={{yesno |{{{flag_border|}}}|yes=yes|blank=yes}}|alt={{{flag_alt|}}}|title=Flag of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type=Flag|link={{{flag_link|}}}|name={{{official_name}}}}}</div>}}
| 2 = {{#if:{{{image_seal|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_seal|}}}|size={{{seal_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|alt={{{seal_alt|}}}|title=Official seal of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}|class={{{seal_class|}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type={{if empty|{{{seal_type|}}}|Seal}}|link={{{seal_link|}}}|name={{{official_name}}}}}</div>}}
| 3 = {{#if:{{{image_shield|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_shield|}}}||size={{{shield_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|alt={{{shield_alt|}}}|title=Coat of arms of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type=Coat of arms|link={{{shield_link|}}}|name={{{official_name}}}}}</div>}}
| 4 = {{#if:{{{image_blank_emblem|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_blank_emblem|}}}|size={{{blank_emblem_size|}}}|sizedefault={{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}|85px|100x100px}}|upright={{{blank_emblem_upright|}}}|alt={{{blank_emblem_alt|}}}|title=Official logo of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}<div class="ib-settlement-caption-link">{{Infobox settlement/link|type={{{blank_emblem_type|}}}|link={{{blank_emblem_link|}}}|name={{{official_name}}}}}</div>}}
| 5 = {{#if:{{{image_map|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map}}}|size={{if empty|{{{mapsize|}}}|{{{map_size|}}}}}|sizedefault=100x100px|alt={{{map_alt|}}}|title={{{map_caption|Location of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}}}}{{#if:{{{map_caption|}}}|<div class="ib-settlement-caption-link">{{{map_caption}}}</div>}}}}
| 0 = {{#if:{{{pushpin_map_narrow|}}}|{{#if:{{{coordinates|}}}{{#property:P625}}|{{#invoke:Location map|infobox_pushpin_map
| pushpin_alt = {{{pushpin_map_alt|}}}
| pushpin_caption = {{{pushpin_map_caption|}}}
| pushpin_label = {{if empty|{{{pushpin_label|}}}|{{{name|}}}|{{{official_name|}}}}}
| default_width = 250 <!-- Shouldn't this be set to 150 and the if empty below removed? -->
| pushpin_map_size = {{if empty|{{{pushpin_mapsize|}}}|150}}
}}}}}}
}}
}}
<!-- ***Etymology*** -->
| rowclass20 = mergedtoprow
| data20 = {{#if:{{{etymology|}}}|Etymology: {{{etymology}}} }}
<!-- ***Nickname*** -->
| rowclass21 = {{#if:{{{etymology|}}}|mergedrow|mergedtoprow}}
| data21 = {{#if:{{{nickname|}}}{{{nicknames|}}}|<!--
-->{{Pluralize from text|parse_links=1|{{if empty|{{{nickname|}}}|{{{nicknames|}}}{{force plural}}}}|<!--
-->link={{{nickname_link|}}}|singular=Nickname|likely=Nickname(s)|plural=Nicknames}}: <!--
--><div class="ib-settlement-nickname nickname">{{if empty|{{{nickname|}}}|{{{nicknames|}}}}}</div><!--
-->{{Main other|{{Pluralize from text|parse_links=1|{{{nickname|}}}|<!--
-->likely=[[Category:Pages using infobox settlement with possible nickname list]]}}}}}}
<!-- ***Motto*** -->
| rowclass22 = {{#if:{{{etymology|}}}{{{nickname|}}}{{{nicknames|}}}|mergedrow|mergedtoprow}}
| data22 = {{#if:{{{motto|}}}{{{mottoes|}}}|<!--
-->{{Pluralize from text|{{if empty|{{{motto|}}}|{{{mottoes|}}}{{force plural}}}}|<!--
-->link={{{motto_link|}}}|singular=Motto|likely=Motto(s)|plural=Mottoes}}: <!--
--><div class="ib-settlement-nickname nickname">{{if empty|{{{motto|}}}|{{{mottoes|}}}}}</div><!--
-->{{Main other|{{Pluralize from text|{{{motto|}}}|<!--
-->likely=[[Category:Pages using infobox settlement with possible motto list]]}}}}}}
<!-- ***Anthem*** -->
| rowclass23 = {{#if:{{{etymology|}}}{{{nickname|}}}{{{nicknames|}}}{{{motto|}}}{{{mottoes|}}}|mergedrow|mergedtoprow}}
| data23 = {{#if:{{{anthem|}}}|{{#if:{{{anthem_link|}}}|[[{{{anthem_link|}}}|Anthem:]]|Anthem:}} {{{anthem}}}}}
<!-- ***Map*** -->
| rowclass24 = mergedtoprow
| data24 = {{#if:{{both|{{{pushpin_map_narrow|}}}|{{{pushpin_map|}}}}}||{{#if:{{{image_map|}}}
|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map}}}|size={{if empty|{{{mapsize|}}}|{{{map_size|}}}}}|sizedefault=250px|upright={{{image_upright|}}}|alt={{{map_alt|}}}|title={{{map_caption|Location of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}}}}{{#if:{{{map_caption|}}}|<div class="ib-settlement-caption">{{{map_caption}}}</div>}}
}}}}
| rowclass25 = mergedrow
| data25 = {{#if:{{{image_map1|}}}|{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map1}}}|size={{if empty|{{{mapsize1|}}}|{{{map_size1|}}}}}|sizedefault=250px|upright={{{image_upright|}}}|alt={{{map_alt1|}}}|title={{{map_caption1|Location of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}}}}}}{{#if:{{{map_caption1|}}}|<div class="ib-settlement-caption">{{{map_caption1}}}</div>}} }}
| data26 = {{#invoke:Infobox mapframe
| autoWithCaption
| onByDefault = {{#if:{{{pushpin_map|}}}{{{image_map|}}}{{{image_map1|}}}|no|yes}}
| mapframe-frame-width = 250
| mapframe-stroke-width = 2
| mapframe-length_km = {{{length_km|}}}
| mapframe-length_mi = {{{length_mi|}}}
| mapframe-width_km = {{{width_km|}}}
| mapframe-width_mi = {{{width_mi|}}}
| mapframe-area_km2 = {{{area_total_km2|}}}
| mapframe-area_ha = {{{area_total_ha|}}}
| mapframe-area_acre = {{{area_total_acre|}}}
| mapframe-area_sq_mi = {{{area_total_sq_mi|}}}
| mapframe-type = city
| mapframe-population = {{if empty|{{{population_metro|}}}|{{{population_total|}}}}}
| mapframe-marker = town
| mapframe-wikidata = yes
| mapframe-caption = Interactive map of {{if empty|{{{name|}}}|{{{official_name|}}}|{{PAGENAMEBASE}}}}
}}
<!-- ***Pushpin Map*** -->
| rowclass28 = mergedtoprow
| data28 = {{#if:{{{pushpin_map_narrow|}}}||{{#if:{{{coordinates|}}}{{#property:P625}}|{{#invoke:Location map|infobox_pushpin_map
| default_width = 250
| pushpin_alt = {{{pushpin_map_alt|}}}
| pushpin_caption = {{{pushpin_map_caption|}}}
| pushpin_label = {{if empty|{{{pushpin_label|}}}|{{{name|}}}|{{{official_name|}}}}}
| pushpin_map_size = {{{pushpin_mapsize|}}}
}}
}}
}}
<!-- ***Coordinates*** -->
| data29 = {{#if:{{{coordinates|}}}|{{#if:{{#invoke:string|match|s={{{coordinates|}}}|pattern=geo-inline-hidden|ignore_errors=true|plain=true}}|<!-- Nothing to display -->
|Coordinates{{#if:{{{coor_pinpoint|}}}{{{coor_type|}}}| ({{if empty|{{{coor_pinpoint|}}}|{{{coor_type|}}}}})}}: {{#invoke:ISO 3166|geocoordinsert|nocat=true|1={{{coordinates|}}}|country={{{subdivision_name|}}}|subdivision1={{{subdivision_name1|}}}|subdivision2={{{subdivision_name2|}}}|subdivision3={{{subdivision_name3|}}}|type=city{{#if:{{{population_total|}}}|{{#iferror:{{#expr:{{formatnum:{{{population_total}}}|R}}+1}}||({{formatnum:{{replace|{{{population_total}}}|,|}}|R}})}}}} }}{{{coordinates_footnotes|}}} }}}}
| rowclass30 = {{#if:{{{image_map|}}}{{{image_map1|}}}{{{pushpin_map|}}}|mergedbottomrow|mergedrow}}
| label30 = {{if empty|{{{grid_name|}}}|Grid position}}
| data30 = {{{grid_position|}}}
<!-- ***Subdivisions*** -->
| rowclass31 = mergedtoprow
| label31 = {{{subdivision_type}}}
| data31 = {{#if:{{{subdivision_type|}}}|{{{subdivision_name|}}} }}
| rowclass32 = mergedrow
| label32 = {{{subdivision_type1}}}
| data32 = {{#if:{{{subdivision_type1|}}}|{{{subdivision_name1|}}} }}
| rowclass33 = mergedrow
| label33 = {{{subdivision_type2}}}
| data33 = {{#if:{{{subdivision_type2|}}}|{{{subdivision_name2|}}} }}
| rowclass34 = mergedrow
| label34 = {{{subdivision_type3}}}
| data34 = {{#if:{{{subdivision_type3|}}}|{{{subdivision_name3|}}} }}
| rowclass35 = mergedrow
| label35 = {{{subdivision_type4}}}
| data35 = {{#if:{{{subdivision_type4|}}}|{{{subdivision_name4|}}} }}
| rowclass36 = mergedrow
| label36 = {{{subdivision_type5}}}
| data36 = {{#if:{{{subdivision_type5|}}}|{{{subdivision_name5|}}} }}
| rowclass37 = mergedrow
| label37 = {{{subdivision_type6}}}
| data37 = {{#if:{{{subdivision_type6|}}}|{{{subdivision_name6|}}} }}
<!--***Established*** -->
| rowclass38 = mergedtoprow
| label38 = {{if empty|{{{established_title|}}}|Established}}
| data38 = {{{established_date|}}}
| rowclass39 = mergedrow
| label39 = {{{established_title1}}}
| data39 = {{#if:{{{established_title1|}}}|{{{established_date1|}}} }}
| rowclass40 = mergedrow
| label40 = {{{established_title2}}}
| data40 = {{#if:{{{established_title2|}}}|{{{established_date2|}}} }}
| rowclass41 = mergedrow
| label41 = {{{established_title3}}}
| data41 = {{#if:{{{established_title3|}}}|{{{established_date3|}}} }}
| rowclass42 = mergedrow
| label42 = {{{established_title4}}}
| data42 = {{#if:{{{established_title4|}}}|{{{established_date4|}}} }}
| rowclass43 = mergedrow
| label43 = {{{established_title5}}}
| data43 = {{#if:{{{established_title5|}}}|{{{established_date5|}}} }}
| rowclass44 = mergedrow
| label44 = {{{established_title6}}}
| data44 = {{#if:{{{established_title6|}}}|{{{established_date6|}}} }}
| rowclass45 = mergedrow
| label45 = {{{established_title7}}}
| data45 = {{#if:{{{established_title7|}}}|{{{established_date7|}}} }}
| rowclass46 = mergedrow
| label46 = {{{extinct_title}}}
| data46 = {{#if:{{{extinct_title|}}}|{{{extinct_date|}}} }}
| rowclass47 = mergedrow
| label47 = Founder
| data47 = {{{founder|}}}
| rowclass48 = mergedrow
| label48 = [[Namesake|Named for]]
| data48 = {{{named_for|}}}
<!-- ***Seat of government and subdivisions within the settlement*** -->
| rowclass49 = mergedtoprow
| label49 = {{if empty|{{{seat_type|}}}|Seat}}
| data49 = {{{seat|}}}
| rowclass50 = mergedrow
| label50 = {{if empty|{{{seat1_type|}}}|Former seat}}
| data50 = {{{seat1|}}}
| rowclass51 = mergedrow
| label51 = {{if empty|{{{seat2_type|}}}|Former seat}}
| data51 = {{{seat2|}}}
| rowclass52 = {{#if:{{{seat|}}}{{{seat1|}}}{{{seat2|}}}|mergedrow|mergedtoprow}}
| label52 = {{if empty|{{{parts_type|}}}|Boroughs}}
| data52 = {{#if:{{{parts|}}}{{{p1|}}}
|{{#ifeq:{{{parts_style|}}}|para
|<b>{{{parts|}}}{{#if:{{both|{{{parts|}}}|{{{p1|}}}}}|: |}}</b>{{comma separated entries|{{{p1|}}}|{{{p2|}}}|{{{p3|}}}|{{{p4|}}}|{{{p5|}}}|{{{p6|}}}|{{{p7|}}}|{{{p8|}}}|{{{p9|}}}|{{{p10|}}}|{{{p11|}}}|{{{p12|}}}|{{{p13|}}}|{{{p14|}}}|{{{p15|}}}|{{{p16|}}}|{{{p17|}}}|{{{p18|}}}|{{{p19|}}}|{{{p20|}}}|{{{p21|}}}|{{{p22|}}}|{{{p23|}}}|{{{p24|}}}|{{{p25|}}}|{{{p26|}}}|{{{p27|}}}|{{{p28|}}}|{{{p29|}}}|{{{p30|}}}|{{{p31|}}}|{{{p32|}}}|{{{p33|}}}|{{{p34|}}}|{{{p35|}}}|{{{p36|}}}|{{{p37|}}}|{{{p38|}}}|{{{p39|}}}|{{{p40|}}}|{{{p41|}}}|{{{p42|}}}|{{{p43|}}}|{{{p44|}}}|{{{p45|}}}|{{{p46|}}}|{{{p47|}}}|{{{p48|}}}|{{{p49|}}}|{{{p50|}}}}}
|{{#if:{{{p1|}}}|{{Collapsible list|title={{{parts|}}}|expand={{#switch:{{{parts_style|}}}|coll=|list=y|{{#if:{{{p6|}}}||y}}}}|1={{{p1|}}}|2={{{p2|}}}|3={{{p3|}}}|4={{{p4|}}}|5={{{p5|}}}|6={{{p6|}}}|7={{{p7|}}}|8={{{p8|}}}|9={{{p9|}}}|10={{{p10|}}}|11={{{p11|}}}|12={{{p12|}}}|13={{{p13|}}}|14={{{p14|}}}|15={{{p15|}}}|16={{{p16|}}}|17={{{p17|}}}|18={{{p18|}}}|19={{{p19|}}}|20={{{p20|}}}|21={{{p21|}}}|22={{{p22|}}}|23={{{p23|}}}|24={{{p24|}}}|25={{{p25|}}}|26={{{p26|}}}|27={{{p27|}}}|28={{{p28|}}}|29={{{p29|}}}|30={{{p30|}}}|31={{{p31|}}}|32={{{p32|}}}|33={{{p33|}}}|34={{{p34|}}}|35={{{p35|}}}|36={{{p36|}}}|37={{{p37|}}}|38={{{p38|}}}|39={{{p39|}}}|40={{{p40|}}}|41={{{p41|}}}|42={{{p42|}}}|43={{{p43|}}}|44={{{p44|}}}|45={{{p45|}}}|46={{{p46|}}}|47={{{p47|}}}|48={{{p48|}}}|49={{{p49|}}}|50={{{p50|}}}}}
|{{{parts}}}
}}
}} }}
<!-- ***Government type and Leader*** -->
| rowclass53 = mergedtoprow
| header53 = {{#if:{{{government_type|}}}{{{governing_body|}}}{{{leader_name|}}}{{{leader_name1|}}}{{{leader_name2|}}}{{{leader_name3|}}}{{{leader_name4|}}}|Government<div class="ib-settlement-fn">{{{government_footnotes|}}}</div>}}
<!-- ***Government*** -->
| rowclass54 = mergedrow
| label54 = • Type
| data54 = {{{government_type|}}}
| rowclass55 = mergedrow
| label55 = • Body
| class55 = agent
| data55 = {{{governing_body|}}}
| rowclass56 = mergedrow
| label56 = • {{{leader_title}}}
| data56 = {{#if:{{{leader_title|}}}|{{{leader_name|}}} {{#if:{{{leader_party|}}}|({{Polparty|{{{subdivision_name}}}|{{{leader_party}}}}})}}}}
| rowclass57 = mergedrow
| label57 = • {{{leader_title1}}}
| data57 = {{#if:{{{leader_title1|}}}|{{{leader_name1|}}}}}
| rowclass58 = mergedrow
| label58 = • {{{leader_title2}}}
| data58 = {{#if:{{{leader_title2|}}}|{{{leader_name2|}}}}}
| rowclass59 = mergedrow
| label59 = • {{{leader_title3}}}
| data59 = {{#if:{{{leader_title3|}}}|{{{leader_name3|}}}}}
| rowclass60 = mergedrow
| label60 = • {{{leader_title4}}}
| data60 = {{#if:{{{leader_title4|}}}|{{{leader_name4|}}}}}
| rowclass61 = mergedrow
| label61 = • {{{leader_title5}}}
| data61 = {{#if:{{{leader_title5|}}}|{{{leader_name5|}}}}}
| rowclass62 = mergedrow
| label62 = {{{government_blank1_title}}}
| data62 = {{#if:{{{government_blank1_title|}}}|{{{government_blank1|}}}}}
| rowclass63 = mergedrow
| label63 = {{{government_blank2_title}}}
| data63 = {{#if:{{{government_blank2_title|}}}|{{{government_blank2|}}}}}
| rowclass64 = mergedrow
| label64 = {{{government_blank3_title}}}
| data64 = {{#if:{{{government_blank3_title|}}}|{{{government_blank3|}}}}}
| rowclass65 = mergedrow
| label65 = {{{government_blank4_title}}}
| data65 = {{#if:{{{government_blank4_title|}}}|{{{government_blank4|}}}}}
| rowclass66 = mergedrow
| label66 = {{{government_blank5_title}}}
| data66 = {{#if:{{{government_blank5_title|}}}|{{{government_blank5|}}}}}
| rowclass67 = mergedrow
| label67 = {{{government_blank6_title}}}
| data67 = {{#if:{{{government_blank6_title|}}}|{{{government_blank6|}}}}}
<!-- ***Geographical characteristics*** -->
<!-- ***Area*** -->
| rowclass68 = mergedtoprow
| header68 = {{#if:{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}{{{area_land_km2|}}}{{{area_land_ha|}}}{{{area_land_acre|}}}{{{area_land_sq_mi|}}}{{{area_water_km2|}}}{{{area_water_ha|}}}{{{area_water_acre|}}}{{{area_water_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_ha|}}}{{{area_urban_acre|}}}{{{area_urban_sq_mi|}}}{{{area_rural_sq_mi|}}}{{{area_rural_ha|}}}{{{area_rural_acre|}}}{{{area_rural_km2|}}}{{{area_metro_km2|}}}{{{area_metro_ha|}}}{{{area_metro_acre|}}}{{{area_blank1_km2|}}}{{{area_blank1_ha|}}}{{{area_blank1_acre|}}}{{{area_metro_sq_mi|}}}{{{area_blank1_sq_mi|}}}
|{{#if:{{both|{{#ifeq:{{{total_type}}}| |1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}}
|<!-- displayed below -->
|Area<div class="ib-settlement-fn">{{{area_footnotes|}}}</div>
}}
}}
| rowclass69 = {{#if:{{both|{{#ifeq:{{{total_type}}}| |1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}}|mergedtoprow|mergedrow}}
| label69 = <div style="white-space:nowrap;">{{#if:{{both|{{#ifeq:{{{total_type}}}| |1}}|{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}}}
|Area<div class="ib-settlement-fn">{{{area_footnotes|}}}</div>
| • {{#if:{{{total_type|}}}|{{{total_type}}}|{{#if:{{{area_metro_km2|}}}{{{area_metro_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_sq_mi|}}}{{{area_rural_km2|}}}{{{area_rural_sq_mi|}}}{{{population_metro|}}}{{{population_urban|}}}{{{population_rural|}}}|{{if empty|{{{settlement_type|}}}|{{{type|}}}|City}}|Total}}}}
}}</div>
| data69 = {{#if:{{{area_total_km2|}}}{{{area_total_ha|}}}{{{area_total_acre|}}}{{{area_total_sq_mi|}}}{{{area_total_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_total_km2|}}}
|ha ={{{area_total_ha|}}}
|acre ={{{area_total_acre|}}}
|sqmi ={{{area_total_sq_mi|}}}
|dunam={{{area_total_dunam|}}}
|link ={{#switch:{{{dunam_link|}}}||on|total=on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass70 = mergedrow
| label70 = • Land
| data70 = {{#if:{{{area_land_km2|}}}{{{area_land_ha|}}}{{{area_land_acre|}}}{{{area_land_sq_mi|}}}{{{area_land_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_land_km2|}}}
|ha ={{{area_land_ha|}}}
|acre ={{{area_land_acre|}}}
|sqmi ={{{area_land_sq_mi|}}}
|dunam={{{area_land_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|land|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass71 = mergedrow
| label71 = • Water
| data71 = {{#if:{{{area_water_km2|}}}{{{area_water_ha|}}}{{{area_water_acre|}}}{{{area_water_sq_mi|}}}{{{area_water_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_water_km2|}}}
|ha ={{{area_water_ha|}}}
|acre ={{{area_water_acre|}}}
|sqmi ={{{area_water_sq_mi|}}}
|dunam={{{area_water_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|water|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}} {{#if:{{{area_water_percent|}}}| {{{area_water_percent}}}{{#ifeq:%|{{#invoke:string|sub|{{{area_water_percent|}}}|-1}}||%}}}}}}
| rowclass72 = mergedrow
| label72 = • [[Urban area|Urban]]<div class="ib-settlement-fn">{{{area_urban_footnotes|}}}</div>
| data72 = {{#if:{{{area_urban_km2|}}}{{{area_urban_ha|}}}{{{area_urban_acre|}}}{{{area_urban_sq_mi|}}}{{{area_urban_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_urban_km2|}}}
|ha ={{{area_urban_ha|}}}
|acre ={{{area_urban_acre|}}}
|sqmi ={{{area_urban_sq_mi|}}}
|dunam={{{area_urban_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|urban|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass73 = mergedrow
| label73 = • Rural<div class="ib-settlement-fn">{{{area_rural_footnotes|}}}</div>
| data73 = {{#if:{{{area_rural_km2|}}}{{{area_rural_ha|}}}{{{area_rural_acre|}}}{{{area_rural_sq_mi|}}}{{{area_rural_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_rural_km2|}}}
|ha ={{{area_rural_ha|}}}
|acre ={{{area_rural_acre|}}}
|sqmi ={{{area_rural_sq_mi|}}}
|dunam={{{area_rural_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|rural|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass74 = mergedrow
| label74 = • Metro<div class="ib-settlement-fn">{{{area_metro_footnotes|}}}</div>
| data74 = {{#if:{{{area_metro_km2|}}}{{{area_metro_ha|}}}{{{area_metro_acre|}}}{{{area_metro_sq_mi|}}}{{{area_metro_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_metro_km2|}}}
|ha ={{{area_metro_ha|}}}
|acre ={{{area_metro_acre|}}}
|sqmi ={{{area_metro_sq_mi|}}}
|dunam={{{area_metro_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|metro|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
<!-- ***Area rank*** -->
| rowclass75 = mergedrow
| label75 = • Rank
| data75 = {{{area_rank|}}}
| rowclass76 = mergedrow
| label76 = • {{{area_blank1_title}}}
| data76 = {{#if:{{{area_blank1_km2|}}}{{{area_blank1_ha|}}}{{{area_blank1_acre|}}}{{{area_blank1_sq_mi|}}}{{{area_blank1_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_blank1_km2|}}}
|ha ={{{area_blank1_ha|}}}
|acre ={{{area_blank1_acre|}}}
|sqmi ={{{area_blank1_sq_mi|}}}
|dunam={{{area_blank1_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|blank1|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass77 = mergedrow
| label77 = • {{{area_blank2_title}}}
| data77 = {{#if:{{{area_blank2_km2|}}}{{{area_blank2_ha|}}}{{{area_blank2_acre|}}}{{{area_blank2_sq_mi|}}}{{{area_blank2_dunam|}}}
|{{infobox_settlement/areadisp
|km2 ={{{area_blank2_km2|}}}
|ha ={{{area_blank2_ha|}}}
|acre ={{{area_blank2_acre|}}}
|sqmi ={{{area_blank2_sq_mi|}}}
|dunam={{{area_blank2_dunam|}}}
|link ={{#ifeq:{{{dunam_link|}}}|blank2|on}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass78 = mergedrow
| label78 =
| data78 = {{{area_note|}}}
<!-- ***Dimensions*** -->
| rowclass79 = mergedtoprow
| header79 = {{#if:{{{length_km|}}}{{{length_mi|}}}{{{width_km|}}}{{{width_mi|}}}|Dimensions<div class="ib-settlement-fn">{{{dimensions_footnotes|}}}</div>}}
| rowclass80 = mergedrow
| label80 = • Length
| data80 = {{#if:{{{length_km|}}}{{{length_mi|}}}
| {{infobox_settlement/lengthdisp
|km ={{{length_km|}}}
|mi ={{{length_mi|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
| rowclass81 = mergedrow
| label81 = • Width
| data81 = {{#if:{{{width_km|}}}{{{width_mi|}}}
|{{infobox_settlement/lengthdisp
|km ={{{width_km|}}}
|mi ={{{width_mi|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
<!-- ***Elevation*** -->
| rowclass82 = mergedtoprow
| label82 = {{#if:{{{elevation_link|}}}|[[{{{elevation_link|}}}|Elevation]]|Elevation}}<div class="ib-settlement-fn">{{{elevation_footnotes|}}}{{#if:{{{elevation_point|}}}| ({{{elevation_point}}})}}</div>
| data82 = {{#if:{{{elevation_m|}}}{{{elevation_ft|}}}
|{{infobox_settlement/lengthdisp
|m ={{{elevation_m|}}}
|ft ={{{elevation_ft|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
| rowclass83 = {{#if:{{{elevation_m|}}}{{{elevation_ft|}}}|mergedrow|mergedtoprow}}
| label83 = Highest elevation<div class="ib-settlement-fn">{{{elevation_max_footnotes|}}}{{#if:{{{elevation_max_point|}}}| ({{{elevation_max_point}}})}}</div>
| data83 = {{#if:{{{elevation_max_m|}}}{{{elevation_max_ft|}}}
|{{infobox_settlement/lengthdisp
|m ={{{elevation_max_m|}}}
|ft ={{{elevation_max_ft|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
<!-- ***Elevation max rank*** -->
| rowclass84 = mergedrow
| label84 = • Rank
| data84 = {{#if:{{{elevation_max_m|}}}{{{elevation_max_ft|}}}| {{{elevation_max_rank|}}} }}
| rowclass85 = {{#if:{{{elevation_min_rank|}}}|mergedrow|mergedbottomrow}}
| label85 = Lowest elevation<div class="ib-settlement-fn">{{{elevation_min_footnotes|}}}{{#if:{{{elevation_min_point|}}}| ({{{elevation_min_point}}})}}</div>
| data85 = {{#if:{{{elevation_min_m|}}}{{{elevation_min_ft|}}}
|{{infobox_settlement/lengthdisp
|m ={{{elevation_min_m|}}}
|ft ={{{elevation_min_ft|}}}
|pref={{{unit_pref|}}}
|name={{{subdivision_name}}}
}} }}
<!-- ***Elevation min rank*** -->
| rowclass86 = mergedrow
| label86 = • Rank
| data86 = {{#if:{{{elevation_min_m|}}}{{{elevation_min_ft|}}}|{{{elevation_min_rank|}}}}}
<!-- ***Population*** -->
| rowclass87 = mergedtoprow
| label87 = Population<div class="ib-settlement-fn">{{#if:{{{population_as_of|}}}|{{nbsp}}({{{population_as_of}}})}}{{{population_footnotes|}}}</div>
| data87 = {{fix comma category|{{#ifeq:{{{total_type}}}|
| {{#if:{{{population_total|}}}
| {{formatnum:{{replace|{{{population_total}}}|,|}}}}
}}
}}
}}
| rowclass88 = mergedtoprow
| header88 ={{#ifeq:{{{total_type}}}|
|
|{{#if:{{{population_total|}}}{{{population_urban|}}}{{{population_rural|}}}{{{population_metro|}}}{{{population_blank1|}}}{{{population_blank2|}}}{{{population_est|}}}
|Population<div class="ib-settlement-fn">{{#if:{{{population_as_of|}}}|{{nbsp}}({{{population_as_of}}})}}{{{population_footnotes|}}}</div>
}}
}}
| rowclass89 = mergedrow
| label89 = <div style="white-space:nowrap;"> • {{#if:{{{total_type|}}}|{{{total_type}}}|{{#if:{{{population_metro|}}}{{{population_urban|}}}{{{population_rural|}}}{{{area_metro_km2|}}}{{{area_metro_sq_mi|}}}{{{area_urban_km2|}}}{{{area_urban_sq_mi|}}}{{{area_rural_km2|}}}{{{area_rural_sq_mi|}}}|{{if empty|{{{settlement_type|}}}|{{{type|}}}|City}}|Total}}}}</div>
| data89 = {{#ifeq:{{{total_type}}}|
|
|{{#if:{{{population_total|}}}
| {{fix comma category|{{formatnum:{{replace|{{{population_total}}}|,|}}}}}}
}}
}}
| rowclass90 = mergedrow
| label90 = <div style="white-space:nowrap;"> • Estimate {{#if:{{{pop_est_as_of|}}}|<div class="ib-settlement-fn">({{{pop_est_as_of}}}){{{pop_est_footnotes|}}}</div>}}</div>
| data90 = {{#if:{{{population_est|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_est}}}|,|}}}}}} }}
<!-- ***Population rank*** -->
| rowclass91 = mergedrow
| label91 = • Rank
| data91 = {{{population_rank|}}}
| rowclass92 = mergedrow
| label92 = • Density
| data92 = {{#if:{{{population_density_km2|}}}{{{population_density_sq_mi|}}}{{{population_total|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_km2|}}}
|/sqmi={{{population_density_sq_mi|}}}
|pop ={{{population_total|}}}
|dunam={{if empty|{{{area_land_dunam|}}}|{{{area_total_dunam|}}}}}
|ha ={{if empty|{{{area_land_ha|}}}|{{{area_total_ha|}}}}}
|km2 ={{if empty|{{{area_land_km2|}}}|{{{area_total_km2|}}}}}
|acre ={{if empty|{{{area_land_acre|}}}|{{{area_total_acre|}}}}}
|sqmi ={{if empty|{{{area_land_sq_mi|}}}|{{{area_total_sq_mi|}}}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
<!-- ***Population density rank*** -->
| rowclass93 = mergedrow
| label93 = • Rank
| data93 = {{{population_density_rank|}}}
| rowclass94 = mergedrow
| label94 = • [[Urban area|Urban]]<div class="ib-settlement-fn">{{{population_urban_footnotes|}}}</div>
| data94 = {{#if:{{{population_urban|}}}| {{fix comma category|{{formatnum:{{replace|{{{population_urban}}}|,|}}}}}} }}
| rowclass95 = mergedrow
| label95 = • Urban density
| data95 = {{#if:{{{population_density_urban_km2|}}}{{{population_density_urban_sq_mi|}}}{{{population_urban|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_urban_km2|}}}
|/sqmi={{{population_density_urban_sq_mi|}}}
|pop ={{{population_urban|}}}
|ha ={{{area_urban_ha|}}}
|km2 ={{{area_urban_km2|}}}
|acre ={{{area_urban_acre|}}}
|sqmi ={{{area_urban_sq_mi|}}}
|dunam={{{area_urban_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass96 = mergedrow
| label96 = • [[Rural area|Rural]]<div class="ib-settlement-fn">{{{population_rural_footnotes|}}}</div>
| data96 = {{#if:{{{population_rural|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_rural}}}|,|}}}}}}}}
| rowclass97 = mergedrow
| label97 = • Rural density
| data97 = {{#if:{{{population_density_rural_km2|}}}{{{population_density_rural_sq_mi|}}}{{{population_rural|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_rural_km2|}}}
|/sqmi={{{population_density_rural_sq_mi|}}}
|pop ={{{population_rural|}}}
|ha ={{{area_rural_ha|}}}
|km2 ={{{area_rural_km2|}}}
|acre ={{{area_rural_acre|}}}
|sqmi ={{{area_rural_sq_mi|}}}
|dunam={{{area_rural_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass98 = mergedrow
| label98 = • [[Metropolitan area|Metro]]<div class="ib-settlement-fn">{{{population_metro_footnotes|}}}</div>
| data98 = {{#if:{{{population_metro|}}}| {{fix comma category|{{formatnum:{{replace|{{{population_metro}}}|,|}}}}}} }}
| rowclass99 = mergedrow
| label99 = • Metro density
| data99 = {{#if:{{{population_density_metro_km2|}}}{{{population_density_metro_sq_mi|}}}{{{population_metro|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_metro_km2|}}}
|/sqmi={{{population_density_metro_sq_mi|}}}
|pop ={{{population_metro|}}}
|ha ={{{area_metro_ha|}}}
|km2 ={{{area_metro_km2|}}}
|acre ={{{area_metro_acre|}}}
|sqmi ={{{area_metro_sq_mi|}}}
|dunam={{{area_metro_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass100 = mergedrow
| label100 = • {{{population_blank1_title|}}}<div class="ib-settlement-fn">{{{population_blank1_footnotes|}}}</div>
| data100 = {{#if:{{{population_blank1|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_blank1}}}|,|}}}}}}}}
| rowclass101 = mergedrow
| label101 = • {{#if:{{{population_blank1_title|}}}|{{{population_blank1_title}}} density|Density}}
| data101 = {{#if:{{{population_density_blank1_km2|}}}{{{population_density_blank1_sq_mi|}}}{{{population_blank1|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_blank1_km2|}}}
|/sqmi={{{population_density_blank1_sq_mi|}}}
|pop ={{{population_blank1|}}}
|ha ={{{area_blank1_ha|}}}
|km2 ={{{area_blank1_km2|}}}
|acre ={{{area_blank1_acre|}}}
|sqmi ={{{area_blank1_sq_mi|}}}
|dunam={{{area_blank1_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass102 = mergedrow
| label102 = • {{{population_blank2_title|}}}<div class="ib-settlement-fn">{{{population_blank2_footnotes|}}}</div>
| data102 = {{#if:{{{population_blank2|}}}|{{fix comma category|{{formatnum:{{replace|{{{population_blank2}}}|,|}}}}}}}}
| rowclass103 = mergedrow
| label103 = • {{#if:{{{population_blank2_title|}}}|{{{population_blank2_title}}} density|Density}}
| data103 = {{#if:{{{population_density_blank2_km2|}}}{{{population_density_blank2_sq_mi|}}}{{{population_blank2|}}}
|{{infobox_settlement/densdisp
|/km2 ={{{population_density_blank2_km2|}}}
|/sqmi={{{population_density_blank2_sq_mi|}}}
|pop ={{{population_blank2|}}}
|ha ={{{area_blank2_ha|}}}
|km2 ={{{area_blank2_km2|}}}
|acre ={{{area_blank2_acre|}}}
|sqmi ={{{area_blank2_sq_mi|}}}
|dunam={{{area_blank2_dunam|}}}
|pref ={{{unit_pref|}}}
|name ={{{subdivision_name}}}
}}}}
| rowclass104 = mergedrow
| label104 =
| data104 = {{{population_note|}}}
| rowclass105 = mergedtoprow
| label105 = {{Pluralize from text|{{if empty|{{{population_demonym|}}}|{{{population_demonyms|}}}{{force plural}}}}|<!--
-->link=Demonym|singular=Demonym|likely=Demonym(s)|plural=Demonyms}}
| data105 = {{if empty|{{{population_demonym|}}}|{{{population_demonyms|}}}}}{{Main other|{{Pluralize from text|{{{population_demonym|}}}|likely=[[Category:Pages using infobox settlement with possible demonym list]]}}}}
<!-- ***Demographics 1*** -->
| rowclass106 = mergedtoprow
| header106 = {{#if:{{{demographics_type1|}}}
|{{{demographics_type1}}}<div class="ib-settlement-fn">{{{demographics1_footnotes|}}}</div>}}
| rowclass107 = mergedrow
| label107 = • {{{demographics1_title1}}}
| data107 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title1|}}}|{{{demographics1_info1|}}}}}}}
| rowclass108 = mergedrow
| label108 = • {{{demographics1_title2}}}
| data108 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title2|}}}|{{{demographics1_info2|}}}}}}}
| rowclass109 = mergedrow
| label109 = • {{{demographics1_title3}}}
| data109 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title3|}}}|{{{demographics1_info3|}}}}}}}
| rowclass110 = mergedrow
| label110 = • {{{demographics1_title4}}}
| data110 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title4|}}}|{{{demographics1_info4|}}}}}}}
| rowclass111 = mergedrow
| label111 = • {{{demographics1_title5}}}
| data111 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title5|}}}|{{{demographics1_info5|}}}}}}}
| rowclass112 = mergedrow
| label112 = • {{{demographics1_title6}}}
| data112 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title6|}}}|{{{demographics1_info6|}}}}}}}
| rowclass113 = mergedrow
| label113 = • {{{demographics1_title7}}}
| data113 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title7|}}}|{{{demographics1_info7|}}}}}}}
| rowclass114 = mergedrow
| label114 = • {{{demographics1_title8}}}
| data114 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title8|}}}|{{{demographics1_info8|}}}}}}}
| rowclass115 = mergedrow
| label115 = • {{{demographics1_title9}}}
| data115 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title9|}}}|{{{demographics1_info9|}}}}}}}
| rowclass116 = mergedrow
| label116 = • {{{demographics1_title10}}}
| data116 = {{#if:{{{demographics_type1|}}}
|{{#if:{{{demographics1_title10|}}}|{{{demographics1_info10|}}}}}}}
<!-- ***Demographics 2*** -->
| rowclass117 = mergedtoprow
| header117 = {{#if:{{{demographics_type2|}}}
|{{{demographics_type2}}}<div class="ib-settlement-fn">{{{demographics2_footnotes|}}}</div>}}
| rowclass118 = mergedrow
| label118 = • {{{demographics2_title1}}}
| data118 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title1|}}}|{{{demographics2_info1|}}}}}}}
| rowclass119 = mergedrow
| label119 = • {{{demographics2_title2}}}
| data119 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title2|}}}|{{{demographics2_info2|}}}}}}}
| rowclass120 = mergedrow
| label120 = • {{{demographics2_title3}}}
| data120 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title3|}}}|{{{demographics2_info3|}}}}}}}
| rowclass121 = mergedrow
| label121 = • {{{demographics2_title4}}}
| data121 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title4|}}}|{{{demographics2_info4|}}}}}}}
| rowclass122 = mergedrow
| label122 = • {{{demographics2_title5}}}
| data122 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title5|}}}|{{{demographics2_info5|}}}}}}}
| rowclass123 = mergedrow
| label123 = • {{{demographics2_title6}}}
| data123 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title6|}}}|{{{demographics2_info6|}}}}}}}
| rowclass124 = mergedrow
| label124 = • {{{demographics2_title7}}}
| data124 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title7|}}}|{{{demographics2_info7|}}}}}}}
| rowclass125 = mergedrow
| label125 = • {{{demographics2_title8}}}
| data125 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title8|}}}|{{{demographics2_info8|}}}}}}}
| rowclass126 = mergedrow
| label126 = • {{{demographics2_title9}}}
| data126 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title9|}}}|{{{demographics2_info9|}}}}}}}
| rowclass127 = mergedrow
| label127 = • {{{demographics2_title10}}}
| data127 = {{#if:{{{demographics_type2|}}}
|{{#if:{{{demographics2_title10|}}}|{{{demographics2_info10|}}}}}}}
<!-- ***Time Zones*** -->
| rowclass128 = mergedtoprow
| header128 = {{#if:{{{timezone1_location|}}}{{{time_zone1_location|}}}|{{#if:{{{timezone2|}}}{{{time_zone2|}}}|[[{{if empty|{{{timezone_link|}}}|{{{time_zone_link|}}}|Time zone}}|Time zone]]s|[[{{if empty|{{{timezone_link|}}}|{{{time_zone_link|}}}|Time zone}}|Time zone]]}}|}}
| rowclass129 = {{#if:{{{timezone1_location|}}}{{{time_zone1_location|}}}|mergedrow|mergedtoprow}}
| label129 = {{#if:{{{timezone1_location|}}}{{{time_zone1_location|}}}|{{{timezone1_location|}}}{{{time_zone1_location|}}}|{{#if:{{{timezone2_location|}}}{{{time_zone2_location|}}}|{{{timezone2_location}}}{{{time_zone2_location|}}}|{{#if:{{{timezone2|}}}{{{time_zone2|}}}|[[{{if empty|{{{timezone_link|}}}|{{{time_zone_link|}}}|Time zone}}|Time zone]]s|[[{{if empty|{{{timezone_link|}}}|{{{time_zone_link|}}}|Time zone}}|Time zone]]}}}}}}
| data129 = {{#if:{{{utc_offset1|}}}{{{utc_offset|}}}
|[[UTC{{if empty|{{{utc_offset1|}}}|{{{utc_offset}}}}}]] {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}|({{if empty|{{{timezone1|}}}|{{{time_zone1|}}}|{{{timezone|}}}|{{{time_zone|}}}}})}}
|{{if empty|{{{timezone1|}}}|{{{time_zone1|}}}|{{{timezone|}}}|{{{time_zone|}}}}}
}}
| rowclass130 = mergedrow
| label130 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data130 = {{#if:{{{utc_offset1_DST|}}}{{{utc_offset_DST|}}}
|[[UTC{{if empty|{{{utc_offset1_DST|}}}|{{{utc_offset_DST|}}}}}]] {{#if:{{{timezone1_DST|}}}{{{time_zone1_DST|}}}{{{timezone_DST|}}}{{{time_zone_DST|}}}|({{if empty|{{{timezone1_DST|}}}|{{{time_zone1_DST|}}}|{{{timezone_DST|}}}|{{{time_zone_DST|}}}}})}}
|{{if empty|{{{timezone1_DST|}}}|{{{time_zone1_DST|}}}|{{{timezone_DST|}}}|{{{time_zone_DST|}}}}}
}}
| rowclass131 = mergedrow
| label131 = {{if empty|{{{timezone2_location|}}}|{{{time_zone2_location|}}}|<nowiki />}}
| data131 = {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}{{{utc_offset1|}}}{{{utc_offset|}}}
|{{#if:{{{utc_offset2|}}}
|[[UTC{{{utc_offset2|}}}]] {{#if:{{{timezone2|}}}{{{time_zone2|}}}|({{if empty|{{{timezone2|}}}|{{{time_zone2|}}}}})}}
|{{if empty|{{{timezone2|}}}|{{{time_zone2|}}}}}
}}
}}
| rowclass132 = mergedrow
| label132 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data132 = {{#if:{{{utc_offset2_DST|}}}|[[UTC{{{utc_offset2_DST|}}}]] {{#if:{{{timezone2_DST|}}}{{{time_zone2_DST|}}}|({{if empty|{{{timezone2_DST|}}}|{{{time_zone2_DST|}}}}})}}
|{{if empty|{{{timezone2_DST|}}}|{{{time_zone2_DST|}}}}}
}}
| rowclass133 = mergedrow
| label133 = {{if empty|{{{timezone3_location|}}}|{{{time_zone3_location|}}}|<nowiki />}}
| data133 = {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}{{{utc_offset1|}}}{{{utc_offset|}}}
|{{#if:{{{utc_offset3|}}}
|[[UTC{{{utc_offset3|}}}]] {{#if:{{{timezone3|}}}{{{time_zone3|}}}|({{if empty|{{{timezone3|}}}|{{{time_zone3|}}}}})}}
|{{if empty|{{{timezone3|}}}|{{{time_zone3|}}}}}
}}
}}
| rowclass134 = mergedrow
| label134 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data134 = {{#if:{{{utc_offset3_DST|}}}|[[UTC{{{utc_offset3_DST|}}}]] {{#if:{{{timezone3_DST|}}}{{{time_zone3_DST|}}}|({{if empty|{{{timezone3_DST|}}}|{{{time_zone3_DST|}}}}})}}
|{{if empty|{{{timezone3_DST|}}}|{{{time_zone3_DST|}}}}}
}}
| rowclass135 = mergedrow
| label135 = {{if empty|{{{timezone4_location|}}}|{{{time_zone4_location|}}}|<nowiki />}}
| data135 = {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}{{{utc_offset1|}}}{{{utc_offset|}}}
|{{#if:{{{utc_offset4|}}}
|[[UTC{{{utc_offset4|}}}]] {{#if:{{{timezone4|}}}{{{time_zone4|}}}|({{if empty|{{{timezone4|}}}|{{{time_zone4|}}}}})}}
|{{if empty|{{{timezone4|}}}|{{{time_zone4|}}}}}
}}
}}
| rowclass136 = mergedrow
| label136 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data136 = {{#if:{{{utc_offset4_DST|}}}|[[UTC{{{utc_offset4_DST|}}}]] {{#if:{{{timezone4_DST|}}}{{{time_zone4_DST|}}}|({{if empty|{{{timezone4_DST|}}}|{{{time_zone4_DST|}}}}})}}
|{{if empty|{{{timezone4_DST|}}}|{{{time_zone4_DST|}}}}}
}}
| rowclass137 = mergedrow
| label137 = {{if empty|{{{timezone5_location|}}}|{{{time_zone5_location|}}}|<nowiki />}}
| data137 = {{#if:{{{timezone1|}}}{{{time_zone1|}}}{{{timezone|}}}{{{time_zone|}}}{{{utc_offset1|}}}{{{utc_offset|}}}
|{{#if:{{{utc_offset5|}}}
|[[UTC{{{utc_offset5|}}}]] {{#if:{{{timezone5|}}}{{{time_zone5|}}}|({{if empty|{{{timezone5|}}}|{{{time_zone5|}}}}})}}
|{{if empty|{{{timezone5|}}}|{{{time_zone5|}}}}}
}}
}}
| rowclass138 = mergedrow
| label138 = <span class="nowrap"> • Summer ([[Daylight saving time|DST]])</span>
| data138 = {{#if:{{{utc_offset5_DST|}}}|[[UTC{{{utc_offset5_DST|}}}]] {{#if:{{{timezone5_DST|}}}{{{time_zone5_DST|}}}|({{if empty|{{{timezone5_DST|}}}|{{{time_zone5_DST|}}}}})}}
|{{if empty|{{{timezone5_DST|}}}|{{{time_zone5_DST|}}}}}
}}
<!-- ***Postal Code(s)*** -->
| rowclass139 = mergedtoprow
| label139 = {{if empty|{{{postal_code_type|}}}|{{Pluralize from text|any_comma=1|parse_links=1|{{{postal_code|}}}|link=Postal code|singular=Postal code|plural=Postal codes}}}}
| class139 = adr
| data139 = {{#if:{{{postal_code|}}}|<div class="postal-code">{{{postal_code}}}</div>}}
| rowclass140 = {{#if:{{{postal_code|}}}|mergedbottomrow|mergedtoprow}}
| label140 = {{if empty|{{{postal2_code_type|}}}|{{Pluralize from text|any_comma=1|parse_links=1|{{{postal2_code|}}}|link=Postal code|singular=Postal code|plural=Postal codes}}}}
| class140 = adr
| data140 = {{#if:{{{postal2_code|}}}|<div class="postal-code">{{{postal2_code}}}</div>}}
<!-- ***Area Code(s)*** -->
| rowclass141 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}|mergedrow|mergedtoprow}}
| label141 = {{if empty|{{{area_code_type|}}}|{{Pluralize from text|any_comma=1|parse_links=1|{{if empty|{{{area_code|}}}|{{{area_codes|}}}{{force plural}}}}|<!--
-->link=Telephone numbering plan|singular=Area code|likely=Area code(s)|plural=Area codes}}}}
| data141 = {{if empty|{{{area_code|}}}|{{{area_codes|}}}}}{{#if:{{{area_code_type|}}}||{{Main other|{{Pluralize from text|any_comma=1|parse_links=1|{{{area_code|}}}|||[[Category:Pages using infobox settlement with possible area code list]]}}}}}}
<!-- Geocode-->
| rowclass142 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}|mergedrow|mergedtoprow}}
| label142 = [[Geocode]]
| class142 = nickname
| data142 = {{{geocode|}}}
<!-- ISO Code-->
| rowclass143 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}{{{geocode|}}}|mergedrow|mergedtoprow}}
| label143 = [[ISO 3166|ISO 3166 code]]
| class143 = nickname
| data143 = {{{iso_code|}}}
<!-- Vehicle registration plate-->
| rowclass144 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}|mergedrow|mergedtoprow}}
| label144 = {{if empty|{{{registration_plate_type|}}}|[[Vehicle registration plate|Vehicle registration]]}}
| data144 = {{{registration_plate|}}}
<!-- Other codes -->
| rowclass145 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}{{{registration_plate|}}}|mergedrow|mergedtoprow}}
| label145 = {{{code1_name|}}}
| class145 = nickname
| data145 = {{#if:{{{code1_name|}}}|{{{code1_info|}}}}}
| rowclass146 = {{#if:{{{postal_code|}}}{{{postal2_code|}}}{{{area_code|}}}{{{geocode|}}}{{{iso_code|}}}{{{registration_plate|}}}{{{code1_name|}}}|mergedrow|mergedtoprow}}
| label146 = {{{code2_name|}}}
| class146 = nickname
| data146 = {{#if:{{{code2_name|}}}|{{{code2_info|}}}}}
<!-- ***Blank Fields (two sections)*** -->
| rowclass147 = mergedtoprow
| label147 = {{if empty|{{{blank_name_sec1|}}}|{{{blank_name|}}}|{{{custom_label_sec1|}}}}}
| data147 = {{#if:{{{blank_name_sec1|}}}{{{blank_name|}}}{{{custom_label_sec1|}}}|{{if empty|{{{blank_info_sec1|}}}|{{{blank_info|}}}|{{{custom_data_sec1|}}}}}}}
| rowclass148 = mergedrow
| label148 = {{if empty|{{{blank1_name_sec1|}}}|{{{blank1_name|}}}|{{{custom_label1_sec1|}}}}}
| data148 = {{#if:{{{blank1_name_sec1|}}}{{{blank1_name|}}}{{{custom_label1_sec1|}}}|{{if empty|{{{blank1_info_sec1|}}}|{{{blank1_info|}}}|{{{custom_data1_sec1|}}}}}}}
| rowclass149 = mergedrow
| label149 = {{if empty|{{{blank2_name_sec1|}}}|{{{blank2_name|}}}|{{{custom_label2_sec1|}}}}}
| data149 = {{#if:{{{blank2_name_sec1|}}}{{{blank2_name|}}}{{{custom_label2_sec1|}}}|{{if empty|{{{blank2_info_sec1|}}}|{{{blank2_info|}}}|{{{custom_data2_sec1|}}}}}}}
| rowclass150 = mergedrow
| label150 = {{if empty|{{{blank3_name_sec1|}}}|{{{blank3_name|}}}|{{{custom_label3_sec1|}}}}}
| data150 = {{#if:{{{blank3_name_sec1|}}}{{{blank3_name|}}}{{{custom_label3_sec1|}}}|{{if empty|{{{blank3_info_sec1|}}}|{{{blank3_info|}}}|{{{custom_data3_sec1|}}}}}}}
| rowclass151 = mergedrow
| label151 = {{if empty|{{{blank4_name_sec1|}}}|{{{blank4_name|}}}|{{{custom_label4_sec1|}}}}}
| data151 = {{#if:{{{blank4_name_sec1|}}}{{{blank4_name|}}}{{{custom_label4_sec1|}}}|{{if empty|{{{blank4_info_sec1|}}}|{{{blank4_info|}}}|{{{custom_data4_sec1|}}}}}}}
| rowclass152 = mergedrow
| label152 = {{if empty|{{{blank5_name_sec1|}}}|{{{blank5_name|}}}|{{{custom_label5_sec1|}}}}}
| data152 = {{#if:{{{blank5_name_sec1|}}}{{{blank5_name|}}}{{{custom_label5_sec1|}}}|{{if empty|{{{blank5_info_sec1|}}}|{{{blank5_info|}}}|{{{custom_data5_sec1|}}}}}}}
| rowclass153 = mergedrow
| label153 = {{if empty|{{{blank6_name_sec1|}}}|{{{blank6_name|}}}|{{{custom_label6_sec1|}}}}}
| data153 = {{#if:{{{blank6_name_sec1|}}}{{{blank6_name|}}}{{{custom_label6_sec1|}}}|{{if empty|{{{blank6_info_sec1|}}}|{{{blank6_info|}}}|{{{custom_data6_sec1|}}}}}}}
| rowclass154 = mergedrow
| label154 = {{if empty|{{{blank7_name_sec1|}}}|{{{blank7_name|}}}|{{{custom_label7_sec1|}}}}}
| data154 = {{#if:{{{blank7_name_sec1|}}}{{{blank7_name|}}}{{{custom_label7_sec1|}}}|{{if empty|{{{blank7_info_sec1|}}}|{{{blank7_info|}}}|{{{custom_data7_sec1|}}}}}}}
| rowclass155 = mergedtoprow
| label155 = {{if empty|{{{blank_name_sec2|}}}|{{{custom_label_sec2|}}}}}
| data155 = {{#if:{{{blank_name_sec2|}}}{{{custom_label_sec2|}}}|{{if empty|{{{blank_info_sec2|}}}|{{{custom_data_sec2|}}}}}}}
| rowclass156 = mergedrow
| label156 = {{if empty|{{{blank1_name_sec2|}}}|{{{custom_label1_sec2|}}}}}
| data156 = {{#if:{{{blank1_name_sec2|}}}{{{custom_label1_sec2|}}}|{{if empty|{{{blank1_info_sec2|}}}|{{{custom_data1_sec2|}}}}}}}
| rowclass157 = mergedrow
| label157 = {{if empty|{{{blank2_name_sec2|}}}|{{{custom_label2_sec2|}}}}}
| data157 = {{#if:{{{blank2_name_sec2|}}}{{{custom_label2_sec2|}}}|{{if empty|{{{blank2_info_sec2|}}}|{{{custom_data2_sec2|}}}}}}}
| rowclass158 = mergedrow
| label158 = {{if empty|{{{blank3_name_sec2|}}}|{{{custom_label3_sec2|}}}}}
| data158 = {{#if:{{{blank3_name_sec2|}}}{{{custom_label3_sec2|}}}|{{if empty|{{{blank3_info_sec2|}}}|{{{custom_data3_sec2|}}}}}}}
| rowclass159 = mergedrow
| label159 = {{if empty|{{{blank4_name_sec2|}}}|{{{custom_label4_sec2|}}}}}
| data159 = {{#if:{{{blank4_name_sec2|}}}{{{custom_label4_sec2|}}}|{{if empty|{{{blank4_info_sec2|}}}|{{{custom_data4_sec2|}}}}}}}
| rowclass160 = mergedrow
| label160 = {{if empty|{{{blank5_name_sec2|}}}|{{{custom_label5_sec2|}}}}}
| data160 = {{#if:{{{blank5_name_sec2|}}}{{{custom_label5_sec2|}}}|{{if empty|{{{blank5_info_sec2|}}}|{{{custom_data5_sec2|}}}}}}}
| rowclass161 = mergedrow
| label161 = {{if empty|{{{blank6_name_sec2|}}}|{{{custom_label6_sec2|}}}}}
| data161 = {{#if:{{{blank6_name_sec2|}}}{{{custom_label6_sec2|}}}|{{if empty|{{{blank6_info_sec2|}}}|{{{custom_data6_sec2|}}}}}}}
| rowclass162 = mergedrow
| label162 = {{if empty|{{{blank7_name_sec2|}}}|{{{custom_label7_sec2|}}}}}
| data162 = {{#if:{{{blank7_name_sec2|}}}{{{custom_label7_sec2|}}}|{{if empty|{{{blank7_info_sec2|}}}|{{{custom_data7_sec2|}}}}}}}
<!-- ***Website*** -->
| rowclass163 = mergedtoprow
| label163 = Website
| data163 = {{{website|}}}
| class164 = maptable
| data164 = {{{module|}}}
<!-- ***Footnotes*** -->
| belowrowclass = mergedtoprow
| below = {{{footnotes|}}}
}}<!-- Check for unknowns
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using {{if empty|{{lcfirst:{{{template_name|}}}}}|infobox settlement}} with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview = Page using [[Template:{{if empty|{{ucfirst:{{{template_name|}}}}}|Infobox settlement}}]] with unknown parameter "_VALUE_"|ignoreblank=y|mapframe_args=y
| alt | anthem | anthem_link | area_blank1_acre | area_blank1_dunam | area_blank1_ha | area_blank1_km2 | area_blank1_sq_mi | area_blank1_title | area_blank2_acre | area_blank2_dunam | area_blank2_ha | area_blank2_km2 | area_blank2_sq_mi | area_blank2_title | area_code | area_code_type | area_codes | area_footnotes | area_land_acre | area_land_dunam | area_land_ha | area_land_km2 | area_land_sq_mi | area_metro_acre | area_metro_dunam | area_metro_footnotes | area_metro_ha | area_metro_km2 | area_metro_sq_mi | area_note | area_rank | area_rural_acre | area_rural_dunam | area_rural_footnotes | area_rural_ha | area_rural_km2 | area_rural_sq_mi | area_total_acre | area_total_dunam | area_total_ha | area_total_km2 | area_total_sq_mi | area_urban_acre | area_urban_dunam | area_urban_footnotes | area_urban_ha | area_urban_km2 | area_urban_sq_mi | area_water_acre | area_water_dunam | area_water_ha | area_water_km2 | area_water_percent | area_water_sq_mi
| blank_emblem_alt | blank_emblem_link | blank_emblem_size | blank_emblem_type | blank_emblem_upright
| blank_info | blank_info_sec1 | blank_info_sec2 | blank_name | blank_name_sec1 | blank_name_sec2 | blank1_info | blank1_info_sec1 | blank1_info_sec2 | blank1_name | blank1_name_sec1 | blank1_name_sec2 | blank2_info | blank2_info_sec1 | blank2_info_sec2 | blank2_name | blank2_name_sec1 | blank2_name_sec2 | blank3_info | blank3_info_sec1 | blank3_info_sec2 | blank3_name | blank3_name_sec1 | blank3_name_sec2 | blank4_info | blank4_info_sec1 | blank4_info_sec2 | blank4_name | blank4_name_sec1 | blank4_name_sec2 | blank5_info | blank5_info_sec1 | blank5_info_sec2 | blank5_name | blank5_name_sec1 | blank5_name_sec2 | blank6_info | blank6_info_sec1 | blank6_info_sec2 | blank6_name | blank6_name_sec1 | blank6_name_sec2 | blank7_info | blank7_info_sec1 | blank7_info_sec2 | blank7_name | blank7_name_sec1 | blank7_name_sec2 | caption | code1_info | code1_name | code2_info | code2_name | coor_pinpoint | coor_type | coordinates | coordinates_footnotes | demographics_type1 | demographics_type2 | demographics1_footnotes | demographics1_info1 | demographics1_info10 | demographics1_info2 | demographics1_info3 | demographics1_info4 | demographics1_info5 | demographics1_info6 | demographics1_info7 | demographics1_info8 | demographics1_info9 | demographics1_title1 | demographics1_title10 | demographics1_title2 | demographics1_title3 | demographics1_title4 | demographics1_title5 | demographics1_title6 | demographics1_title7 | demographics1_title8 | demographics1_title9 | demographics2_footnotes | demographics2_info1 | demographics2_info10 | demographics2_info2 | demographics2_info3 | demographics2_info4 | demographics2_info5 | demographics2_info6 | demographics2_info7 | demographics2_info8 | demographics2_info9 | demographics2_title1 | demographics2_title10 | demographics2_title2 | demographics2_title3 | demographics2_title4 | demographics2_title5 | demographics2_title6 | demographics2_title7 | demographics2_title8 | demographics2_title9 | dimensions_footnotes | dunam_link | elevation_footnotes | elevation_ft | elevation_link | elevation_m | elevation_max_footnotes | elevation_max_ft | elevation_max_m | elevation_max_point | elevation_max_rank | elevation_min_footnotes | elevation_min_ft | elevation_min_m | elevation_min_point | elevation_min_rank | elevation_point | embed | established_date | established_date1 | established_date2 | established_date3 | established_date4 | established_date5 | established_date6 | established_date7 | established_title | established_title1 | established_title2 | established_title3 | established_title4 | established_title5 | established_title6 | established_title7 | etymology | extinct_date | extinct_title | flag_alt | flag_border | flag_link | flag_size | footnotes | founder | geocode | governing_body | government_footnotes | government_type | government_blank1_title | government_blank1 | government_blank2_title | government_blank2 | government_blank3 | government_blank3_title | government_blank4_title | government_blank4 | government_blank5_title | government_blank5 | government_blank6_title | government_blank6 | grid_name | grid_position
| image_alt | image_blank_emblem | image_caption | image_flag | image_map | image_map1 | image_seal | image_shield | image_size | image_skyline | imagesize | image_upright
| iso_code | leader_name | leader_name1 | leader_name2 | leader_name3 | leader_name4 | leader_name5 | leader_party | leader_title | leader_title1 | leader_title2 | leader_title3 | leader_title4 | leader_title5 | length_km | length_mi | map_alt | map_alt1 | map_caption | map_caption1 | mapsize | mapsize1 | module | motto | motto_link | mottoes | name | named_for | native_name | native_name_lang | nickname | nickname_link | nicknames | official_name | other_name | p1 | p10 | p11 | p12 | p13 | p14 | p15 | p16 | p17 | p18 | p19 | p2 | p20 | p21 | p22 | p23 | p24 | p25 | p26 | p27 | p28 | p29 | p3 | p30 | p31 | p32 | p33 | p34 | p35 | p36 | p37 | p38 | p39 | p4 | p40 | p41 | p42 | p43 | p44 | p45 | p46 | p47 | p48 | p49 | p5 | p50 | p6 | p7 | p8 | p9 | parts | parts_style | parts_type | pop_est_as_of | pop_est_footnotes | population_as_of | population_blank1 | population_blank1_footnotes | population_blank1_title | population_blank2 | population_blank2_footnotes | population_blank2_title | population_demonym | population_demonyms | population_density_blank1_km2 | population_density_blank1_sq_mi | population_density_blank2_km2 | population_density_blank2_sq_mi | population_density_km2 | population_density_metro_km2 | population_density_metro_sq_mi | population_density_rank | population_density_rural_km2 | population_density_rural_sq_mi | population_density_sq_mi | population_density_urban_km2 | population_density_urban_sq_mi | population_est | population_footnotes | population_metro | population_metro_footnotes | population_note | population_rank | population_rural | population_rural_footnotes | population_total | population_urban | population_urban_footnotes | postal_code | postal_code_type | postal2_code | postal2_code_type | pushpin_image | pushpin_label | pushpin_label_position | pushpin_map | pushpin_map_alt | pushpin_map_caption | pushpin_map_caption_notsmall | pushpin_map_narrow | pushpin_mapsize | pushpin_outside | pushpin_overlay | pushpin_relief | registration_plate | registration_plate_type | seal_alt | seal_class | seal_link | seal_size | seal_type | seat | seat_type | seat1 | seat1_type | seat2 | seat2_type | settlement_type | shield_alt | shield_link | shield_size | short_description <!--used by Module:Settlement short description-->| subdivision_name | subdivision_name1 | subdivision_name2 | subdivision_name3 | subdivision_name4 | subdivision_name5 | subdivision_name6 | subdivision_type | subdivision_type1 | subdivision_type2 | subdivision_type3 | subdivision_type4 | subdivision_type5 | subdivision_type6 | template_name | timezone | timezone_DST | timezone_link | timezone1 | timezone1_DST | timezone1_location | timezone2 | timezone2_DST | timezone2_location | timezone3 | timezone3_DST | timezone3_location | timezone4 | timezone4_DST | timezone4_location | timezone5 | timezone5_DST | timezone5_location | total_type | translit_lang1 | translit_lang1_info | translit_lang1_info1 | translit_lang1_info2 | translit_lang1_info3 | translit_lang1_info4 | translit_lang1_info5 | translit_lang1_info6 | translit_lang1_type | translit_lang1_type1 | translit_lang1_type2 | translit_lang1_type3 | translit_lang1_type4 | translit_lang1_type5 | translit_lang1_type6 | translit_lang2 | translit_lang2_info | translit_lang2_info1 | translit_lang2_info2 | translit_lang2_info3 | translit_lang2_info4 | translit_lang2_info5 | translit_lang2_info6 | translit_lang2_type | translit_lang2_type1 | translit_lang2_type2 | translit_lang2_type3 | translit_lang2_type4 | translit_lang2_type5 | translit_lang2_type6 | type | unit_pref | utc_offset | utc_offset_DST | utc_offset1 | utc_offset1_DST | utc_offset2 | utc_offset2_DST | utc_offset3 | utc_offset3_DST | utc_offset4 | utc_offset4_DST | utc_offset5 | utc_offset5_DST | website | width_km | width_mi <!--
NEW PARAMETERS AS PART OF REFACTOR - Will be integrated in alphebetical order once refactor is completed
-->| pushpin_map_args=y | map_size | map_size1 | image | custom_label_sec1 | custom_data_sec1 | custom_label1_sec1 | custom_data1_sec1 | custom_label2_sec1 | custom_data2_sec1 | custom_label3_sec1 | custom_data3_sec1 | custom_label4_sec1 | custom_data4_sec1 | custom_label5_sec1 | custom_data5_sec1 | custom_label6_sec1 | custom_data6_sec1 | custom_label7_sec1 | custom_data7_sec1 | custom_label_sec2 | custom_data_sec2 | custom_label1_sec2 | custom_data1_sec2 | custom_label2_sec2 | custom_data2_sec2 | custom_label3_sec2 | custom_data3_sec2 | custom_label4_sec2 | custom_data4_sec2 | custom_label5_sec2 | custom_data5_sec2 | custom_label6_sec2 | custom_data6_sec2 | custom_label7_sec2 | custom_data7_sec2 | time_zone | time_zone1_location | time_zone2 | time_zone_link | time_zone2_location | time_zone1 | time_zone1_DST | time_zone_DST | time_zone2_DST | time_zone3_location | time_zone3 | time_zone3_DST | time_zone4_location | time_zone4 | time_zone4_DST | time_zone5_location | time_zone5 | time_zone5_DST }}<!--
-->{{#invoke:Check for conflicting parameters|check|nested=1
| template = [[Template:{{if empty|{{ucfirst:{{{template_name|}}}}}|Infobox settlement}}]]
| cat = {{main other|Category:Pages using {{if empty|{{lcfirst:{{{template_name|}}}}}|infobox settlement}} with conflicting parameters}}
| settlement_type; type
| image_size; imagesize
| image_alt; alt
| image_caption; caption
| nickname; nicknames
| motto; mottoes
| coor_pinpoint; coor_type
| population_demonym; population_demonyms
| utc_offset1; utc_offset
| timezone1; timezone
| utc_offset1_DST; utc_offset_DST
| timezone1_DST; timezone_DST
| area_code; area_codes
| blank_name_sec1; blank_name
| blank_info_sec1; blank_info
| blank1_name_sec1; blank1_name
| blank1_info_sec1; blank1_info
| blank2_name_sec1; blank2_name
| blank2_info_sec1; blank2_info
| blank3_name_sec1; blank3_name
| blank3_info_sec1; blank3_info
| blank4_name_sec1; blank4_name
| blank4_info_sec1; blank4_info
| blank5_name_sec1; blank5_name
| blank5_info_sec1; blank5_info
| blank6_name_sec1; blank6_name
| blank6_info_sec1; blank6_info
| blank7_name_sec1; blank7_name
| blank7_info_sec1; blank7_info
}}<!-- Wikidata
-->{{#if:{{{coordinates_wikidata|}}}{{{wikidata|}}}
|[[Category:Pages using infobox settlement with the wikidata parameter]]
}}{{main other|<!-- Missing country
-->{{#if:{{{subdivision_name|}}}||[[Category:Pages using infobox settlement with missing country]]}}<!-- No map
-->{{#if:{{{pushpin_map|}}}{{{image_map|}}}{{{image_map1|}}}||[[Category:Pages using infobox settlement with no map]]}}<!-- Image_map1 without image_map
-->{{#if:{{{image_map1|}}}|{{#if:{{{image_map|}}}||[[Category:Pages using infobox settlement with image_map1 but not image_map]]}}}}<!-- No coordinates
-->{{#if:{{{coordinates|}}}||[[Category:Pages using infobox settlement with no coordinates]]}}<!--
-->{{#if:{{{embed|}}}|[[Category:Pages using infobox settlement with embed]]}}
}}<!-- Gathering information on over-use of maps
-->{{#ifexpr:{{#invoke:ParameterCount|main|mapframe|image_map|image_map1|pushpin_map}} >2 |{{main other| [[Category:Pages using infobox settlement with potentially too many maps]]}}}}</includeonly>{{#invoke:Check for deprecated parameters|check
| _category = {{main other|[[Category:Pages using infobox settlement with deprecated parameters|_VALUE_]]}}
| _remove = pushpin_map_caption_notsmall; pushpin_outside; pushpin_overlay; pushpin_image
| settlement_type = type
| image_skyline = image
| imagesize = image_size
| image_alt = alt
| image_caption = caption
| mapsize = map_size
| mapsize1 = map_size1
| pushpin_map_alt = pushpin_alt
| pushpin_map_caption = pushpin_caption
| pushpin_mapsize = pushpin_map_size
| _regexp1 = blank(%d*)_name = custom_label%1_sec1
| _regexp2 = blank(%d*)_info = custom_data%1_sec1
| _regexp3 = blank(%d*)_name_sec(%d) = custom_label%1_sec%2
| _regexp4 = blank(%d*)_info_sec(%d) = custom_data%1_sec%2
| timezone = time_zone
| timezone_DST = time_zone_DST
| timezone_link = time_zone_link
| _regexp5 = timezone(%d) = time_zone%1
| _regexp6 = timezone(%d)_DST = time_zone%1_DST
| _regexp7 = timezone(%d)_location = time_zone%1_location
}}<noinclude>
{{documentation}}
<!--Please add this template's categories to the /doc subpage, not here - thanks!-->
</noinclude>
4f9mvbj3eh4zogv4xcy6l5erci596gf
Модул:Convert/data
828
3646
21755
2026-01-15T09:43:54Z
Johnuniq
2793
fix problem with last release: unit eVpar needs symbol *eV to not use the eV default exception
21755
Scribunto
text/plain
-- Conversion data used by [[Module:Convert]] which uses mw.loadData() for
-- read-only access to this module so that it is loaded only once per page.
-- See [[:en:Template:Convert/Transwiki guide]] if copying to another wiki.
--
-- These data tables follow:
-- all_units all properties for a unit, including default output
-- default_exceptions exceptions for default output ('kg' and 'g' have different defaults)
-- link_exceptions exceptions for links ('kg' and 'g' have different links)
--
-- These tables are generated by a script which reads the wikitext of a page that
-- documents the required properties of each unit; see [[:en:Module:Convert/doc]].
---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above). --
---------------------------------------------------------------------------
local all_units = {
["Gy"] = {
_name1 = "gray",
_symbol = "Gy",
utype = "absorbed radiation dose",
scale = 1,
prefixes = 1,
default = "rad",
link = "Gray (unit)",
},
["rad"] = {
_name1 = "rad",
_symbol = "rad",
utype = "absorbed radiation dose",
scale = 0.01,
prefixes = 1,
default = "Gy",
link = "Rad (unit)",
},
["cm/s2"] = {
name1 = "centimetre per second squared",
name1_us = "centimeter per second squared",
name2 = "centimetres per second squared",
name2_us = "centimeters per second squared",
symbol = "cm/s<sup>2</sup>",
utype = "acceleration",
scale = 0.01,
default = "ft/s2",
link = "Gal (unit)",
},
["ft/s2"] = {
name1 = "foot per second squared",
name2 = "feet per second squared",
symbol = "ft/s<sup>2</sup>",
utype = "acceleration",
scale = 0.3048,
default = "m/s2",
},
["g0"] = {
name1 = "standard gravity",
name2 = "standard gravities",
symbol = "''g''<sub>0</sub>",
utype = "acceleration",
scale = 9.80665,
default = "m/s2",
},
["g-force"] = {
name2 = "''g''",
symbol = "''g''",
utype = "acceleration",
scale = 9.80665,
default = "m/s2",
link = "g-force",
},
["km/hs"] = {
name1 = "kilometre per hour per second",
name1_us = "kilometer per hour per second",
name2 = "kilometres per hour per second",
name2_us = "kilometers per hour per second",
symbol = "km/(h⋅s)",
utype = "acceleration",
scale = 0.27777777777777779,
default = "mph/s",
link = "Acceleration",
},
["km/s2"] = {
name1 = "kilometre per second squared",
name1_us = "kilometer per second squared",
name2 = "kilometres per second squared",
name2_us = "kilometers per second squared",
symbol = "km/s<sup>2</sup>",
utype = "acceleration",
scale = 1000,
default = "mph/s",
link = "Acceleration",
},
["m/s2"] = {
name1 = "metre per second squared",
name1_us = "meter per second squared",
name2 = "metres per second squared",
name2_us = "meters per second squared",
symbol = "m/s<sup>2</sup>",
utype = "acceleration",
scale = 1,
default = "ft/s2",
},
["mph/s"] = {
name1 = "mile per hour per second",
name2 = "miles per hour per second",
symbol = "mph/s",
utype = "acceleration",
scale = 0.44704,
default = "km/hs",
link = "Acceleration",
},
["km/h/s"] = {
target = "km/hs",
},
["standard gravity"] = {
target = "g0",
},
["1000sqft"] = {
name1 = "thousand square feet",
name2 = "thousand square feet",
symbol = "1000 sq ft",
utype = "area",
scale = 92.90304,
default = "m2",
link = "Square foot",
},
["a"] = {
_name1 = "are",
_symbol = "a",
utype = "area",
scale = 100,
prefixes = 1,
default = "sqft",
link = "Hectare#Are",
},
["acre"] = {
symbol = "acre",
usename = 1,
utype = "area",
scale = 4046.8564224,
default = "ha",
subdivs = { ["rood"] = { 4, default = "ha" }, ["sqperch"] = { 160, default = "ha" } },
},
["acre-sing"] = {
target = "acre",
},
["arpent"] = {
symbol = "arpent",
usename = 1,
utype = "area",
scale = 3418.89,
default = "ha",
},
["cda"] = {
name1 = "cuerda",
symbol = "cda",
utype = "area",
scale = 3930.395625,
default = "ha acre",
},
["daa"] = {
name1 = "decare",
symbol = "daa",
utype = "area",
scale = 1000,
default = "km2 sqmi",
},
["dunam"] = {
symbol = "dunam",
usename = 1,
utype = "area",
scale = 1000,
default = "km2 sqmi",
},
["dunum"] = {
symbol = "dunum",
usename = 1,
utype = "area",
scale = 1000,
default = "km2 sqmi",
link = "Dunam",
},
["ha"] = {
name1 = "hectare",
symbol = "ha",
utype = "area",
scale = 10000,
default = "acre",
},
["hectare"] = {
name1 = "hectare",
symbol = "ha",
usename = 1,
utype = "area",
scale = 10000,
default = "acre",
},
["Irish acre"] = {
name1 = "Irish acre",
symbol = "Irish acres",
utype = "area",
scale = 6555.2385024,
default = "ha",
link = "Acre (Irish)",
},
["m2"] = {
_name1 = "square metre",
_name1_us= "square meter",
_symbol = "m<sup>2</sup>",
prefix_position= 8,
utype = "area",
scale = 1,
prefixes = 2,
default = "sqft",
link = "Square metre",
},
["pondemaat"] = {
name1 = "pondemaat",
name2 = "pondemaat",
symbol = "pond",
utype = "area",
scale = 3674.363358816,
default = "m2",
link = ":nl:pondemaat",
},
["pyeong"] = {
name2 = "pyeong",
symbol = "pyeong",
usename = 1,
utype = "area",
scale = 3.3057851239669422,
default = "m2",
},
["rai"] = {
name2 = "rai",
symbol = "rai",
utype = "area",
scale = 1600,
default = "m2",
link = "Rai (unit)",
},
["rood"] = {
symbol = "rood",
usename = 1,
utype = "area",
scale = 1011.7141056,
default = "sqft m2",
subdivs = { ["sqperch"] = { 40, default = "m2" } },
link = "Rood (unit)",
},
["sqfoot"] = {
name1 = "square foot",
name2 = "square foot",
symbol = "sq ft",
utype = "area",
scale = 0.09290304,
default = "m2",
},
["sqft"] = {
name1 = "square foot",
name2 = "square feet",
symbol = "sq ft",
utype = "area",
scale = 0.09290304,
default = "m2",
},
["sqin"] = {
name1 = "square inch",
name2 = "square inches",
symbol = "sq in",
utype = "area",
scale = 0.00064516,
default = "cm2",
},
["sqmi"] = {
name1 = "square mile",
symbol = "sq mi",
utype = "area",
scale = 2589988.110336,
default = "km2",
},
["sqnmi"] = {
name1 = "square nautical mile",
symbol = "sq nmi",
utype = "area",
scale = 3429904,
default = "km2 sqmi",
link = "Nautical mile",
},
["sqperch"] = {
name2 = "perches",
symbol = "perch",
usename = 1,
utype = "area",
scale = 25.29285264,
default = "m2",
link = "Rod (unit)#Area and volume",
},
["sqverst"] = {
symbol = "square verst",
usename = 1,
utype = "area",
scale = 1138062.24,
default = "km2 sqmi",
link = "Verst",
},
["sqyd"] = {
name1 = "square yard",
symbol = "sq yd",
utype = "area",
scale = 0.83612736,
default = "m2",
},
["tsubo"] = {
name2 = "tsubo",
symbol = "tsubo",
usename = 1,
utype = "area",
scale = 3.3057851239669422,
default = "m2",
link = "Japanese units of measurement#Area",
},
["acres"] = {
target = "acre",
},
["are"] = {
target = "a",
},
["decare"] = {
target = "daa",
},
["foot2"] = {
target = "sqfoot",
},
["ft2"] = {
target = "sqft",
symbol = "ft<sup>2</sup>",
},
["in2"] = {
target = "sqin",
symbol = "in<sup>2</sup>",
},
["km²"] = {
target = "km2",
},
["mi2"] = {
target = "sqmi",
symbol = "mi<sup>2</sup>",
},
["million acre"] = {
target = "e6acre",
},
["million acres"] = {
target = "e6acre",
},
["million hectares"] = {
target = "e6ha",
},
["m²"] = {
target = "m2",
},
["nmi2"] = {
target = "sqnmi",
},
["pond"] = {
target = "pondemaat",
},
["sq arp"] = {
target = "arpent",
},
["sqkm"] = {
target = "km2",
},
["sqm"] = {
target = "m2",
},
["square verst"] = {
target = "sqverst",
},
["verst2"] = {
target = "sqverst",
},
["yd2"] = {
target = "sqyd",
symbol = "yd<sup>2</sup>",
},
["m2/ha"] = {
name1 = "square metre per hectare",
name1_us = "square meter per hectare",
name2 = "square metres per hectare",
name2_us = "square meters per hectare",
symbol = "m<sup>2</sup>/ha",
utype = "area per unit area",
scale = 0.0001,
default = "sqft/acre",
link = "Basal area",
},
["sqft/acre"] = {
name1 = "square foot per acre",
name2 = "square feet per acre",
symbol = "sq ft/acre",
utype = "area per unit area",
scale = 2.295684113865932e-5,
default = "m2/ha",
link = "Basal area",
},
["cent"] = {
name1 = "cent",
symbol = "¢",
utype = "cent",
scale = 1,
default = "cent",
link = "Cent (currency)",
},
["¢"] = {
target = "cent",
},
["A.h"] = {
name1 = "ampere hour",
symbol = "A⋅h",
utype = "charge",
scale = 3600,
default = "coulomb",
},
["coulomb"] = {
_name1 = "coulomb",
_symbol = "C",
utype = "charge",
scale = 1,
prefixes = 1,
default = "e",
link = "Coulomb",
},
["e"] = {
name1 = "elementary charge",
symbol = "''e''",
utype = "charge",
scale = 1.602176634e-19,
default = "coulomb",
},
["g-mol"] = {
name1 = "gram-mole",
symbol = "g‑mol",
utype = "chemical amount",
scale = 1,
default = "lbmol",
link = "Mole (unit)",
},
["gmol"] = {
name1 = "gram-mole",
symbol = "gmol",
utype = "chemical amount",
scale = 1,
default = "lbmol",
link = "Mole (unit)",
},
["kmol"] = {
name1 = "kilomole",
symbol = "kmol",
utype = "chemical amount",
scale = 1000,
default = "lbmol",
link = "Mole (unit)",
},
["lb-mol"] = {
name1 = "pound-mole",
symbol = "lb‑mol",
utype = "chemical amount",
scale = 453.59237,
default = "mol",
},
["lbmol"] = {
name1 = "pound-mole",
symbol = "lbmol",
utype = "chemical amount",
scale = 453.59237,
default = "mol",
},
["mol"] = {
name1 = "mole",
symbol = "mol",
utype = "chemical amount",
scale = 1,
default = "lbmol",
link = "Mole (unit)",
},
["kgCO2/L"] = {
name1 = "kilogram per litre",
name1_us = "kilogram per liter",
name2 = "kilograms per litre",
name2_us = "kilograms per liter",
symbol = "kg(CO<sub>2</sub>)/L",
utype = "co2 per unit volume",
scale = 1000,
default = "lbCO2/USgal",
link = "Exhaust gas",
},
["lbCO2/USgal"] = {
name1 = "pound per US gallon",
name2 = "pounds per US gallon",
symbol = "lbCO2/US gal",
utype = "co2 per unit volume",
scale = 119.82642731689663,
default = "kgCO2/L",
link = "Exhaust gas",
},
["oz/lb"] = {
per = { "oz", "lb" },
utype = "concentration",
default = "mg/kg",
},
["mg/kg"] = {
per = { "mg", "kg" },
utype = "concentration",
default = "oz/lb",
},
["g/dm3"] = {
name1 = "gram per cubic decimetre",
name1_us = "gram per cubic decimeter",
name2 = "grams per cubic decimetre",
name2_us = "grams per cubic decimeter",
symbol = "g/dm<sup>3</sup>",
utype = "density",
scale = 1,
default = "kg/m3",
link = "Density",
},
["g/L"] = {
name1 = "gram per litre",
name1_us = "gram per liter",
name2 = "grams per litre",
name2_us = "grams per liter",
symbol = "g/L",
utype = "density",
scale = 1,
default = "lb/cuin",
link = "Density",
},
["g/mL"] = {
name1 = "gram per millilitre",
name1_us = "gram per milliliter",
name2 = "grams per millilitre",
name2_us = "grams per milliliter",
symbol = "g/mL",
utype = "density",
scale = 1000,
default = "lb/cuin",
link = "Density",
},
["g/ml"] = {
name1 = "gram per millilitre",
name1_us = "gram per milliliter",
name2 = "grams per millilitre",
name2_us = "grams per milliliter",
symbol = "g/ml",
utype = "density",
scale = 1000,
default = "lb/cuin",
link = "Density",
},
["kg/dm3"] = {
name1 = "kilogram per cubic decimetre",
name1_us = "kilogram per cubic decimeter",
name2 = "kilograms per cubic decimetre",
name2_us = "kilograms per cubic decimeter",
symbol = "kg/dm<sup>3</sup>",
utype = "density",
scale = 1000,
default = "lb/cuft",
link = "Density",
},
["kg/L"] = {
name1 = "kilogram per litre",
name1_us = "kilogram per liter",
name2 = "kilograms per litre",
name2_us = "kilograms per liter",
symbol = "kg/L",
utype = "density",
scale = 1000,
default = "lb/USgal",
link = "Density",
},
["kg/l"] = {
name1 = "kilogram per litre",
name1_us = "kilogram per liter",
name2 = "kilograms per litre",
name2_us = "kilograms per liter",
symbol = "kg/l",
utype = "density",
scale = 1000,
default = "lb/USgal",
link = "Density",
},
["kg/m3"] = {
name1 = "kilogram per cubic metre",
name1_us = "kilogram per cubic meter",
name2 = "kilograms per cubic metre",
name2_us = "kilograms per cubic meter",
symbol = "kg/m<sup>3</sup>",
utype = "density",
scale = 1,
default = "lb/cuyd",
link = "Density",
},
["lb/cuft"] = {
name1 = "pound per cubic foot",
name2 = "pounds per cubic foot",
symbol = "lb/cu ft",
utype = "density",
scale = 16.018463373960142,
default = "g/cm3",
link = "Density",
},
["lb/cuin"] = {
name1 = "pound per cubic inch",
name2 = "pounds per cubic inch",
symbol = "lb/cu in",
utype = "density",
scale = 27679.904710203122,
default = "g/cm3",
link = "Density",
},
["lb/cuyd"] = {
name1 = "pound per cubic yard",
name2 = "pounds per cubic yard",
symbol = "lb/cu yd",
utype = "density",
scale = 0.5932764212577829,
default = "kg/m3",
link = "Density",
},
["lb/impgal"] = {
name1 = "pound per imperial gallon",
name2 = "pounds per imperial gallon",
symbol = "lb/imp gal",
utype = "density",
scale = 99.776372663101697,
default = "kg/L",
link = "Density",
},
["lb/in3"] = {
name1 = "pound per cubic inch",
name2 = "pounds per cubic inch",
symbol = "lb/cu in",
utype = "density",
scale = 27679.904710203122,
default = "g/cm3",
link = "Density",
},
["lb/U.S.gal"] = {
name1 = "pound per U.S. gallon",
name2 = "pounds per U.S. gallon",
symbol = "lb/U.S. gal",
utype = "density",
scale = 119.82642731689663,
default = "kg/L",
link = "Density",
},
["lb/USbu"] = {
name1 = "pound per US bushel",
name2 = "pounds per US bushel",
symbol = "lb/US bu",
utype = "density",
scale = 12.871859780974471,
default = "kg/m3",
link = "Bushel",
},
["lb/USgal"] = {
name1 = "pound per US gallon",
name2 = "pounds per US gallon",
symbol = "lb/US gal",
utype = "density",
scale = 119.82642731689663,
default = "kg/L",
link = "Density",
},
["lbm/cuin"] = {
name1 = "pound mass per cubic inch",
name2 = "pounds mass per cubic inch",
symbol = "lbm/cu in",
utype = "density",
scale = 27679.904710203122,
default = "g/cm3",
link = "Density",
},
["mg/L"] = {
name1 = "milligram per litre",
name1_us = "milligram per liter",
name2 = "milligrams per litre",
name2_us = "milligrams per liter",
symbol = "mg/L",
utype = "density",
scale = 0.001,
default = "lb/cuin",
link = "Density",
},
["oz/cuin"] = {
name1 = "ounce per cubic inch",
name2 = "ounces per cubic inch",
symbol = "oz/cu in",
utype = "density",
scale = 1729.9940443876951,
default = "g/cm3",
link = "Density",
},
["g/cm3"] = {
per = { "g", "cm3" },
utype = "density",
default = "lb/cuin",
},
["g/m3"] = {
per = { "g", "m3" },
utype = "density",
default = "lb/cuyd",
link = "Density",
},
["Mg/m3"] = {
per = { "Mg", "m3" },
utype = "density",
default = "lb/cuft",
},
["mg/l"] = {
per = { "mg", "ll" },
utype = "density",
default = "oz/cuin",
},
["μg/dL"] = {
per = { "μg", "dL" },
utype = "density",
default = "lb/cuin",
},
["μg/l"] = {
per = { "μg", "ll" },
utype = "density",
default = "oz/cuin",
},
["lb/ft3"] = {
target = "lb/cuft",
},
["lb/yd3"] = {
target = "lb/cuyd",
},
["lbm/in3"] = {
target = "lbm/cuin",
},
["mcg/dL"] = {
target = "μg/dL",
},
["oz/in3"] = {
target = "oz/cuin",
},
["ug/dL"] = {
target = "μg/dL",
},
["ug/l"] = {
target = "μg/l",
},
["B.O.T.U."] = {
name1 = "Board of Trade Unit",
symbol = "B.O.T.U.",
utype = "energy",
scale = 3600000,
default = "MJ",
link = "Kilowatt-hour",
},
["bboe"] = {
name1 = "barrel of oil equivalent",
name2 = "barrels of oil equivalent",
symbol = "bboe",
utype = "energy",
scale = 6117863200,
default = "GJ",
},
["BOE"] = {
name1 = "barrel of oil equivalent",
name2 = "barrels of oil equivalent",
symbol = "BOE",
utype = "energy",
scale = 6117863200,
default = "GJ",
},
["BTU"] = {
name1 = "British thermal unit",
symbol = "BTU",
utype = "energy",
scale = 1055.05585262,
default = "kJ",
},
["Btu"] = {
name1 = "British thermal unit",
symbol = "Btu",
utype = "energy",
scale = 1055.05585262,
default = "kJ",
},
["BTU-39F"] = {
name1 = "British thermal unit (39°F)",
name2 = "British thermal units (39°F)",
symbol = "BTU<sub>39°F</sub>",
utype = "energy",
scale = 1059.67,
default = "kJ",
link = "British thermal unit",
},
["Btu-39F"] = {
name1 = "British thermal unit (39°F)",
name2 = "British thermal units (39°F)",
symbol = "Btu<sub>39°F</sub>",
utype = "energy",
scale = 1059.67,
default = "kJ",
link = "British thermal unit",
},
["BTU-59F"] = {
name1 = "British thermal unit (59°F)",
name2 = "British thermal units (59°F)",
symbol = "BTU<sub>59°F</sub>",
utype = "energy",
scale = 1054.804,
default = "kJ",
link = "British thermal unit",
},
["Btu-59F"] = {
name1 = "British thermal unit (59°F)",
name2 = "British thermal units (59°F)",
symbol = "Btu<sub>59°F</sub>",
utype = "energy",
scale = 1054.804,
default = "kJ",
link = "British thermal unit",
},
["BTU-60F"] = {
name1 = "British thermal unit (60°F)",
name2 = "British thermal units (60°F)",
symbol = "BTU<sub>60°F</sub>",
utype = "energy",
scale = 1054.68,
default = "kJ",
link = "British thermal unit",
},
["Btu-60F"] = {
name1 = "British thermal unit (60°F)",
name2 = "British thermal units (60°F)",
symbol = "Btu<sub>60°F</sub>",
utype = "energy",
scale = 1054.68,
default = "kJ",
link = "British thermal unit",
},
["BTU-63F"] = {
name1 = "British thermal unit (63°F)",
name2 = "British thermal units (63°F)",
symbol = "BTU<sub>63°F</sub>",
utype = "energy",
scale = 1054.6,
default = "kJ",
link = "British thermal unit",
},
["Btu-63F"] = {
name1 = "British thermal unit (63°F)",
name2 = "British thermal units (63°F)",
symbol = "Btu<sub>63°F</sub>",
utype = "energy",
scale = 1054.6,
default = "kJ",
link = "British thermal unit",
},
["BTU-ISO"] = {
name1 = "British thermal unit (ISO)",
name2 = "British thermal units (ISO)",
symbol = "BTU<sub>ISO</sub>",
utype = "energy",
scale = 1055.056,
default = "kJ",
link = "British thermal unit",
},
["Btu-ISO"] = {
target = "BTU-ISO",
},
["BTU-IT"] = {
name1 = "British thermal unit (IT)",
name2 = "British thermal units (IT)",
symbol = "BTU<sub>IT</sub>",
utype = "energy",
scale = 1055.05585262,
default = "kJ",
link = "British thermal unit",
},
["Btu-IT"] = {
name1 = "British thermal unit (IT)",
name2 = "British thermal units (IT)",
symbol = "Btu<sub>IT</sub>",
utype = "energy",
scale = 1055.05585262,
default = "kJ",
link = "British thermal unit",
},
["BTU-mean"] = {
name1 = "British thermal unit (mean)",
name2 = "British thermal units (mean)",
symbol = "BTU<sub>mean</sub>",
utype = "energy",
scale = 1055.87,
default = "kJ",
link = "British thermal unit",
},
["Btu-mean"] = {
name1 = "British thermal unit (mean)",
name2 = "British thermal units (mean)",
symbol = "Btu<sub>mean</sub>",
utype = "energy",
scale = 1055.87,
default = "kJ",
link = "British thermal unit",
},
["BTU-th"] = {
name1 = "British thermal unit (thermochemical)",
name2 = "British thermal units (thermochemical)",
symbol = "BTU<sub>th</sub>",
utype = "energy",
scale = 1054.35026444,
default = "kJ",
link = "British thermal unit",
},
["Btu-th"] = {
name1 = "British thermal unit (thermochemical)",
name2 = "British thermal units (thermochemical)",
symbol = "Btu<sub>th</sub>",
utype = "energy",
scale = 1054.35026444,
default = "kJ",
link = "British thermal unit",
},
["Cal"] = {
name1 = "calorie",
symbol = "Cal",
utype = "energy",
scale = 4184,
default = "kJ",
},
["cal"] = {
name1 = "calorie",
symbol = "cal",
utype = "energy",
scale = 4.184,
default = "J",
},
["Cal-15"] = {
name1 = "Calorie (15°C)",
name2 = "Calories (15°C)",
symbol = "Cal<sub>15</sub>",
utype = "energy",
scale = 4185.8,
default = "kJ",
link = "Calorie",
},
["cal-15"] = {
name1 = "calorie (15°C)",
name2 = "calories (15°C)",
symbol = "cal<sub>15</sub>",
utype = "energy",
scale = 4.1858,
default = "J",
link = "Calorie",
},
["Cal-IT"] = {
name1 = "Calorie (International Steam Table)",
name2 = "Calories (International Steam Table)",
symbol = "Cal<sub>IT</sub>",
utype = "energy",
scale = 4186.8,
default = "kJ",
link = "Calorie",
},
["cal-IT"] = {
name1 = "calorie (International Steam Table)",
name2 = "calories (International Steam Table)",
symbol = "cal<sub>IT</sub>",
utype = "energy",
scale = 4.1868,
default = "J",
link = "Calorie",
},
["Cal-th"] = {
name1 = "Calorie (thermochemical)",
name2 = "Calories (thermochemical)",
symbol = "Cal<sub>th</sub>",
utype = "energy",
scale = 4184,
default = "kJ",
link = "Calorie",
},
["cal-th"] = {
name1 = "calorie (thermochemical)",
name2 = "calories (thermochemical)",
symbol = "cal<sub>th</sub>",
utype = "energy",
scale = 4.184,
default = "J",
link = "Calorie",
},
["CHU-IT"] = {
name1 = "Celsius heat unit (International Table)",
name2 = "Celsius heat units (International Table)",
symbol = "CHU<sub>IT</sub>",
utype = "energy",
scale = 1899.100534716,
default = "kJ",
link = "Conversion of units#Energy",
},
["cufootnaturalgas"] = {
name1 = "cubic foot of natural gas",
name2 = "cubic foot of natural gas",
symbol = "cuftnaturalgas",
usename = 1,
utype = "energy",
scale = 1055055.85262,
default = "MJ",
link = "Conversion of units#Energy",
},
["cuftnaturalgas"] = {
name1 = "cubic foot of natural gas",
name2 = "cubic feet of natural gas",
symbol = "cuftnaturalgas",
usename = 1,
utype = "energy",
scale = 1055055.85262,
default = "MJ",
link = "Conversion of units#Energy",
},
["Eh"] = {
name1 = "Hartree",
symbol = "''E''<sub>h</sub>",
utype = "energy",
scale = 4.35974417e-18,
default = "eV",
},
["erg"] = {
symbol = "erg",
utype = "energy",
scale = 0.0000001,
default = "μJ",
},
["eV"] = {
_name1 = "electronvolt",
_symbol = "eV",
utype = "energy",
scale = 1.602176634e-19,
prefixes = 1,
default = "aJ",
link = "Electronvolt",
},
["foe"] = {
symbol = "foe",
utype = "energy",
scale = 1e44,
default = "YJ",
link = "Foe (unit)",
},
["ftlb"] = {
name1 = "foot-pound",
symbol = "ft⋅lb",
utype = "energy",
alttype = "torque",
scale = 1.3558179483314004,
default = "J",
link = "Foot-pound (energy)",
},
["ftlb-f"] = {
name1 = "foot-pound force",
name2 = "foot-pounds force",
symbol = "ft⋅lb<sub>f</sub>",
utype = "energy",
alttype = "torque",
scale = 1.3558179483314004,
default = "J",
link = "Foot-pound (energy)",
},
["ftlbf"] = {
name1 = "foot-pound force",
name2 = "foot-pounds force",
symbol = "ft⋅lbf",
utype = "energy",
alttype = "torque",
scale = 1.3558179483314004,
default = "J",
link = "Foot-pound (energy)",
},
["ftpdl"] = {
name1 = "foot-poundal",
symbol = "ft⋅pdl",
utype = "energy",
scale = 0.0421401100938048,
default = "J",
},
["gTNT"] = {
name2 = "grams of TNT",
symbol = "gram of TNT",
usename = 1,
utype = "energy",
scale = 4184,
default = "kJ",
link = "TNT equivalent",
},
["Gtoe"] = {
name1 = "gigatonne of oil equivalent",
name2 = "gigatonnes of oil equivalent",
symbol = "Gtoe",
utype = "energy",
scale = 4.1868e19,
default = "EJ",
link = "Tonne of oil equivalent",
},
["GtonTNT"] = {
name2 = "gigatons of TNT",
symbol = "gigaton of TNT",
usename = 1,
utype = "energy",
scale = 4.184e18,
default = "EJ",
link = "TNT equivalent",
},
["GtTNT"] = {
name2 = "gigatonnes of TNT",
symbol = "gigatonne of TNT",
usename = 1,
utype = "energy",
scale = 4.184e18,
default = "EJ",
link = "TNT equivalent",
},
["GW.h"] = {
name1 = "gigawatt-hour",
symbol = "GW⋅h",
utype = "energy",
scale = 3.6e12,
default = "TJ",
link = "Kilowatt-hour",
},
["GWh"] = {
name1 = "gigawatt-hour",
symbol = "GWh",
utype = "energy",
scale = 3.6e12,
default = "TJ",
link = "Kilowatt-hour",
},
["hph"] = {
name1 = "horsepower-hour",
symbol = "hp⋅h",
utype = "energy",
scale = 2684519.537696172792,
default = "kWh",
link = "Horsepower",
},
["inlb"] = {
name1 = "inch-pound",
symbol = "in⋅lb",
utype = "energy",
alttype = "torque",
scale = 0.1129848290276167,
default = "mJ",
link = "Foot-pound (energy)",
},
["inlb-f"] = {
name1 = "inch-pound force",
name2 = "inch-pounds force",
symbol = "in⋅lb<sub>f</sub>",
utype = "energy",
alttype = "torque",
scale = 0.1129848290276167,
default = "mJ",
link = "Foot-pound (energy)",
},
["inlbf"] = {
name1 = "inch-pound force",
name2 = "inch-pounds force",
symbol = "in⋅lbf",
utype = "energy",
alttype = "torque",
scale = 0.1129848290276167,
default = "mJ",
link = "Foot-pound (energy)",
},
["inoz-f"] = {
name1 = "inch-ounce force",
name2 = "inch-ounces force",
symbol = "in⋅oz<sub>f</sub>",
utype = "energy",
alttype = "torque",
scale = 0.00706155181422604375,
default = "mJ",
link = "Foot-pound (energy)",
},
["inozf"] = {
name1 = "inch-ounce force",
name2 = "inch-ounces force",
symbol = "in⋅ozf",
utype = "energy",
alttype = "torque",
scale = 0.00706155181422604375,
default = "mJ",
link = "Foot-pound (energy)",
},
["J"] = {
_name1 = "joule",
_symbol = "J",
utype = "energy",
scale = 1,
prefixes = 1,
default = "cal",
link = "Joule",
},
["kBOE"] = {
name1 = "kilo barrel of oil equivalent",
name2 = "kilo barrels of oil equivalent",
symbol = "kBOE",
utype = "energy",
scale = 6.1178632e12,
default = "TJ",
link = "Barrel of oil equivalent",
},
["kcal"] = {
name1 = "kilocalorie",
symbol = "kcal",
utype = "energy",
scale = 4184,
default = "kJ",
link = "Calorie",
},
["kcal-15"] = {
name1 = "kilocalorie (15°C)",
name2 = "kilocalories (15°C)",
symbol = "kcal<sub>15</sub>",
utype = "energy",
scale = 4185.8,
default = "kJ",
link = "Calorie",
},
["kcal-IT"] = {
name1 = "kilocalorie (International Steam Table)",
name2 = "kilocalories (International Steam Table)",
symbol = "kcal<sub>IT</sub>",
utype = "energy",
scale = 4186.8,
default = "kJ",
link = "Calorie",
},
["kcal-th"] = {
name1 = "kilocalorie (thermochemical)",
name2 = "kilocalories (thermochemical)",
symbol = "kcal<sub>th</sub>",
utype = "energy",
scale = 4184,
default = "kJ",
link = "Calorie",
},
["kerg"] = {
name1 = "kiloerg",
symbol = "kerg",
utype = "energy",
scale = 0.0001,
default = "mJ",
link = "Erg",
},
["kgTNT"] = {
name2 = "kilograms of TNT",
symbol = "kilogram of TNT",
usename = 1,
utype = "energy",
scale = 4184000,
default = "MJ",
link = "TNT equivalent",
},
["kt(TNT)"] = {
name1 = "kilotonne",
name1_us = "kiloton",
symbol = "kt",
utype = "energy",
scale = 4.184e12,
default = "TJ",
link = "TNT equivalent",
},
["ktoe"] = {
name1 = "kilotonne of oil equivalent",
name2 = "kilotonnes of oil equivalent",
symbol = "ktoe",
utype = "energy",
scale = 4.1868e13,
default = "TJ",
link = "Tonne of oil equivalent",
},
["ktonTNT"] = {
name1 = "kiloton of TNT",
name2 = "kilotons of TNT",
symbol = "kt",
utype = "energy",
scale = 4.184e12,
default = "TJ",
link = "TNT equivalent",
},
["ktTNT"] = {
name2 = "kilotonnes of TNT",
symbol = "kilotonne of TNT",
usename = 1,
utype = "energy",
scale = 4.184e12,
default = "TJ",
link = "TNT equivalent",
},
["kW.h"] = {
name1 = "kilowatt-hour",
symbol = "kW⋅h",
utype = "energy",
scale = 3600000,
default = "MJ",
},
["kWh"] = {
name1 = "kilowatt-hour",
symbol = "kWh",
utype = "energy",
scale = 3600000,
default = "MJ",
},
["Mcal"] = {
name1 = "megacalorie",
symbol = "Mcal",
utype = "energy",
scale = 4184000,
default = "MJ",
link = "Calorie",
},
["mcal"] = {
name1 = "millicalorie",
symbol = "mcal",
utype = "energy",
scale = 0.004184,
default = "mJ",
link = "Calorie",
},
["Mcal-15"] = {
name1 = "megacalorie (15°C)",
name2 = "megacalories (15°C)",
symbol = "Mcal<sub>15</sub>",
utype = "energy",
scale = 4185800,
default = "MJ",
link = "Calorie",
},
["mcal-15"] = {
name1 = "millicalorie (15°C)",
name2 = "millicalories (15°C)",
symbol = "mcal<sub>15</sub>",
utype = "energy",
scale = 0.0041858,
default = "mJ",
link = "Calorie",
},
["Mcal-IT"] = {
name1 = "megacalorie (International Steam Table)",
name2 = "megacalories (International Steam Table)",
symbol = "Mcal<sub>IT</sub>",
utype = "energy",
scale = 4186800,
default = "MJ",
link = "Calorie",
},
["mcal-IT"] = {
name1 = "millicalorie (International Steam Table)",
name2 = "millicalories (International Steam Table)",
symbol = "mcal<sub>IT</sub>",
utype = "energy",
scale = 0.0041868,
default = "mJ",
link = "Calorie",
},
["Mcal-th"] = {
name1 = "megacalorie (thermochemical)",
name2 = "megacalories (thermochemical)",
symbol = "Mcal<sub>th</sub>",
utype = "energy",
scale = 4184000,
default = "MJ",
link = "Calorie",
},
["mcal-th"] = {
name1 = "millicalorie (thermochemical)",
name2 = "millicalories (thermochemical)",
symbol = "mcal<sub>th</sub>",
utype = "energy",
scale = 0.004184,
default = "mJ",
link = "Calorie",
},
["Merg"] = {
name1 = "megaerg",
symbol = "Merg",
utype = "energy",
scale = 0.1,
default = "J",
link = "Erg",
},
["merg"] = {
name1 = "millierg",
symbol = "merg",
utype = "energy",
scale = 0.0000000001,
default = "μJ",
link = "Erg",
},
["MMBtu"] = {
name1 = "million British thermal units",
name2 = "million British thermal units",
symbol = "MMBtu",
utype = "energy",
scale = 1055055852.62,
default = "GJ",
link = "British thermal unit",
},
["Mt(TNT)"] = {
name1 = "megatonne",
name1_us = "megaton",
symbol = "Mt",
utype = "energy",
scale = 4.184e15,
default = "PJ",
link = "TNT equivalent",
},
["Mtoe"] = {
name1 = "megatonne of oil equivalent",
name2 = "megatonnes of oil equivalent",
symbol = "Mtoe",
utype = "energy",
scale = 4.1868e16,
default = "PJ",
link = "Tonne of oil equivalent",
},
["MtonTNT"] = {
name1 = "megaton of TNT",
name2 = "megatons of TNT",
symbol = "Mt",
utype = "energy",
scale = 4.184e15,
default = "PJ",
link = "TNT equivalent",
},
["mtonTNT"] = {
name2 = "millitons of TNT",
symbol = "milliton of TNT",
usename = 1,
utype = "energy",
scale = 4184000,
default = "MJ",
link = "TNT equivalent",
},
["MtTNT"] = {
name2 = "megatonnes of TNT",
symbol = "megatonne of TNT",
usename = 1,
utype = "energy",
scale = 4.184e15,
default = "PJ",
link = "TNT equivalent",
},
["mtTNT"] = {
name2 = "millitonnes of TNT",
symbol = "millitonne of TNT",
usename = 1,
utype = "energy",
scale = 4184000,
default = "MJ",
link = "TNT equivalent",
},
["MW.h"] = {
name1 = "megawatt-hour",
symbol = "MW⋅h",
utype = "energy",
scale = 3600000000,
default = "GJ",
link = "Kilowatt-hour",
},
["mW.h"] = {
name1 = "milliwatt-hour",
symbol = "mW⋅h",
utype = "energy",
scale = 3.6,
default = "J",
link = "Kilowatt-hour",
},
["MWh"] = {
name1 = "megawatt-hour",
symbol = "MWh",
utype = "energy",
scale = 3600000000,
default = "GJ",
link = "Kilowatt-hour",
},
["mWh"] = {
name1 = "milliwatt-hour",
symbol = "mWh",
utype = "energy",
scale = 3.6,
default = "J",
link = "Kilowatt-hour",
},
["PSh"] = {
name1 = "Pferdestärkenstunde",
symbol = "PSh",
utype = "energy",
scale = 2647795.5,
default = "kWh",
},
["quad"] = {
name1 = "quadrillion British thermal units",
name2 = "quadrillion British thermal units",
symbol = "quad",
utype = "energy",
scale = 1.054804e18,
default = "EJ",
link = "Quad (unit)",
},
["Ry"] = {
name1 = "rydberg",
symbol = "Ry",
utype = "energy",
scale = 2.1798741e-18,
default = "eV",
link = "Rydberg constant",
},
["scf"] = {
name1 = "standard cubic foot",
name2 = "standard cubic feet",
symbol = "scf",
utype = "energy",
scale = 2869.2044809344,
default = "kJ",
},
["scfoot"] = {
name1 = "standard cubic foot",
name2 = "standard cubic foot",
symbol = "scf",
utype = "energy",
scale = 2869.2044809344,
default = "kJ",
},
["t(TNT)"] = {
name1 = "tonne",
name1_us = "ton",
symbol = "t",
utype = "energy",
scale = 4184000000,
default = "GJ",
link = "TNT equivalent",
},
["th"] = {
name1 = "thermie",
symbol = "th",
utype = "energy",
scale = 4186800,
default = "MJ",
link = "Conversion of units#Energy",
},
["thm-EC"] = {
name1 = "therm (EC)",
name2 = "therms (EC)",
symbol = "thm (EC)",
utype = "energy",
scale = 105506000,
default = "MJ",
link = "Therm",
},
["thm-UK"] = {
name1 = "therm (UK)",
name2 = "therms (UK)",
symbol = "thm (UK)",
utype = "energy",
scale = 105505585.257348,
default = "MJ",
link = "Therm",
},
["thm-US"] = {
name1 = "therm (US)",
name1_us = "therm (U.S.)",
name2 = "therms (US)",
name2_us = "therms (U.S.)",
symbol = "thm (US)",
sym_us = "thm (U.S.)",
utype = "energy",
scale = 105480400,
default = "MJ",
link = "Therm",
},
["toe"] = {
name1 = "tonne of oil equivalent",
name2 = "tonnes of oil equivalent",
symbol = "toe",
utype = "energy",
scale = 41868000000,
default = "GJ",
},
["tonTNT"] = {
name2 = "tons of TNT",
symbol = "ton of TNT",
usename = 1,
utype = "energy",
scale = 4184000000,
default = "GJ",
link = "TNT equivalent",
},
["tTNT"] = {
name2 = "tonnes of TNT",
symbol = "tonne of TNT",
usename = 1,
utype = "energy",
scale = 4184000000,
default = "GJ",
link = "TNT equivalent",
},
["TtonTNT"] = {
name2 = "teratons of TNT",
symbol = "teraton of TNT",
usename = 1,
utype = "energy",
scale = 4.184e21,
default = "ZJ",
link = "TNT equivalent",
},
["TtTNT"] = {
name2 = "teratonnes of TNT",
symbol = "teratonne of TNT",
usename = 1,
utype = "energy",
scale = 4.184e21,
default = "ZJ",
link = "TNT equivalent",
},
["TW.h"] = {
name1 = "terawatt-hour",
symbol = "TW⋅h",
utype = "energy",
scale = 3.6e15,
default = "PJ",
link = "Kilowatt-hour",
},
["TWh"] = {
name1 = "terawatt-hour",
symbol = "TWh",
utype = "energy",
scale = 3.6e15,
default = "PJ",
link = "Kilowatt-hour",
},
["W.h"] = {
name1 = "watt-hour",
symbol = "W⋅h",
utype = "energy",
scale = 3600,
default = "kJ",
link = "Kilowatt-hour",
},
["Wh"] = {
name1 = "watt-hour",
symbol = "Wh",
utype = "energy",
scale = 3600,
default = "kJ",
link = "Kilowatt-hour",
},
["μerg"] = {
name1 = "microerg",
symbol = "μerg",
utype = "energy",
scale = 1e-13,
default = "nJ",
link = "Erg",
},
["μW.h"] = {
name1 = "microwatt-hour",
symbol = "μW⋅h",
utype = "energy",
scale = 0.0036,
default = "mJ",
link = "Kilowatt-hour",
},
["μWh"] = {
name1 = "microwatt-hour",
symbol = "μWh",
utype = "energy",
scale = 0.0036,
default = "mJ",
link = "Kilowatt-hour",
},
["-kW.h"] = {
target = "kW.h",
link = "Kilowatt hour",
},
["btu"] = {
target = "BTU",
},
["Calorie"] = {
target = "Cal",
},
["ft.lbf"] = {
target = "ftlbf",
},
["ft·lbf"] = {
target = "ftlbf",
},
["g-cal-15"] = {
target = "cal-15",
},
["g-cal-IT"] = {
target = "cal-IT",
},
["g-cal-th"] = {
target = "cal-th",
},
["g-kcal-15"] = {
target = "kcal-15",
},
["g-kcal-IT"] = {
target = "kcal-IT",
},
["g-kcal-th"] = {
target = "kcal-th",
},
["g-Mcal-15"] = {
target = "Mcal-15",
},
["g-mcal-15"] = {
target = "mcal-15",
},
["g-Mcal-IT"] = {
target = "Mcal-IT",
},
["g-mcal-IT"] = {
target = "mcal-IT",
},
["g-Mcal-th"] = {
target = "Mcal-th",
},
["g-mcal-th"] = {
target = "mcal-th",
},
["GW-h"] = {
target = "GW.h",
},
["GW·h"] = {
target = "GW.h",
},
["Hartree"] = {
target = "Eh",
},
["hp.h"] = {
target = "hph",
},
["in.lb-f"] = {
target = "inlb-f",
},
["in.lbf"] = {
target = "inlbf",
},
["in.oz-f"] = {
target = "inoz-f",
},
["in.ozf"] = {
target = "inozf",
},
["kbboe"] = {
target = "kBOE",
symbol = "kbboe",
},
["kg-cal-15"] = {
target = "Cal-15",
},
["kg-cal-IT"] = {
target = "Cal-IT",
},
["kg-cal-th"] = {
target = "Cal-th",
},
["kW-h"] = {
target = "kW.h",
},
["kW·h"] = {
target = "kW.h",
},
["MW-h"] = {
target = "MW.h",
},
["mW-h"] = {
target = "mW.h",
},
["MW·h"] = {
target = "MW.h",
},
["TW-h"] = {
target = "TW.h",
},
["uerg"] = {
target = "μerg",
},
["uW-h"] = {
target = "μW.h",
},
["uW.h"] = {
target = "μW.h",
},
["uWh"] = {
target = "μWh",
},
["W-h"] = {
target = "W.h",
},
["eVpar"] = {
_name1 = "electronvolt",
_symbol = "eV",
utype = "energy per chemical amount",
scale = 96485.332123310014,
prefixes = 1,
default = "kcal/mol",
defkey = "eVpar",
linkey = "eVpar",
link = "Electronvolt",
},
["kcal/mol"] = {
per = { "kcal", "mol" },
utype = "energy per chemical amount",
default = "kJ/mol",
link = "Kilocalorie per mole",
},
["kJ/mol"] = {
per = { "kJ", "mol" },
utype = "energy per chemical amount",
default = "kcal/mol",
link = "Joule per mole",
},
["kWh/100 km"] = {
name1 = "kilowatt-hour per 100 kilometres",
name1_us = "kilowatt-hour per 100 kilometers",
name2 = "kilowatt-hours per 100 kilometres",
name2_us = "kilowatt-hours per 100 kilometers",
symbol = "kW⋅h/100 km",
utype = "energy per unit length",
scale = 36,
default = "MJ/km kWh/mi",
link = "Kilowatt-hour",
},
["kWh/100 mi"] = {
name1 = "kilowatt-hour per 100 miles",
name2 = "kilowatt-hours per 100 miles",
symbol = "kW⋅h/100 mi",
utype = "energy per unit length",
scale = 22.3694,
default = "mpge",
link = "Miles per gallon gasoline equivalent",
},
["MJ/100 km"] = {
name1 = "megajoule per 100 kilometres",
name1_us = "megajoule per 100 kilometers",
name2 = "megajoules per 100 kilometres",
name2_us = "megajoules per 100 kilometers",
symbol = "MJ/100 km",
utype = "energy per unit length",
scale = 10,
default = "BTU/mi",
link = "British thermal unit",
},
["mpge"] = {
name1 = "mile per gallon gasoline equivalent",
name2 = "miles per gallon gasoline equivalent",
symbol = "mpg‑e",
utype = "energy per unit length",
scale = 1.3263314048360777e-5,
invert = -1,
iscomplex= true,
default = "kWh/100 mi",
link = "Miles per gallon gasoline equivalent",
},
["BTU/mi"] = {
per = { "BTU", "mi" },
utype = "energy per unit length",
default = "v > 1525 ! M ! k ! J/km",
},
["kJ/km"] = {
per = { "kJ", "km" },
utype = "energy per unit length",
default = "BTU/mi",
},
["kWh/km"] = {
per = { "-kW.h", "km" },
utype = "energy per unit length",
default = "MJ/km kWh/mi",
},
["kWh/mi"] = {
per = { "-kW.h", "mi" },
utype = "energy per unit length",
default = "kWh/km MJ/km",
},
["MJ/km"] = {
per = { "MJ", "km" },
utype = "energy per unit length",
default = "BTU/mi",
},
["mpg-e"] = {
target = "mpge",
},
["BTU/lb"] = {
name1 = "British thermal unit per pound",
name2 = "British thermal units per pound",
symbol = "BTU/lb",
utype = "energy per unit mass",
scale = 2326,
default = "kJ/kg",
link = "British thermal unit",
},
["cal/g"] = {
name1 = "calorie per gram",
name2 = "calories per gram",
symbol = "cal/g",
utype = "energy per unit mass",
scale = 4184,
default = "J/g",
},
["GJ/kg"] = {
name1 = "gigajoule per kilogram",
name2 = "gigajoules per kilogram",
symbol = "GJ/kg",
utype = "energy per unit mass",
scale = 1e9,
default = "ktTNT/t",
link = "Specific energy",
},
["J/g"] = {
name1 = "joule per gram",
name2 = "joules per gram",
symbol = "J/g",
utype = "energy per unit mass",
scale = 1000,
default = "kcal/g",
link = "Specific energy",
},
["kcal/g"] = {
name1 = "kilocalorie per gram",
name2 = "kilocalories per gram",
symbol = "kcal/g",
utype = "energy per unit mass",
scale = 4184000,
default = "kJ/g",
},
["kJ/g"] = {
name1 = "kilojoule per gram",
name2 = "kilojoules per gram",
symbol = "kJ/g",
utype = "energy per unit mass",
scale = 1000000,
default = "kcal/g",
link = "Specific energy",
},
["kJ/kg"] = {
name1 = "kilojoule per kilogram",
name2 = "kilojoules per kilogram",
symbol = "kJ/kg",
utype = "energy per unit mass",
scale = 1000,
default = "BTU/lb",
link = "Specific energy",
},
["ktonTNT/MT"] = {
name2 = "kilotons of TNT per metric ton",
symbol = "kiloton of TNT per metric ton",
usename = 1,
utype = "energy per unit mass",
scale = 4184000000,
default = "GJ/kg",
link = "TNT equivalent",
},
["ktTNT/t"] = {
name2 = "kilotonnes of TNT per tonne",
symbol = "kilotonne of TNT per tonne",
usename = 1,
utype = "energy per unit mass",
scale = 4184000000,
default = "GJ/kg",
link = "TNT equivalent",
},
["MtonTNT/MT"] = {
name2 = "megatons of TNT per metric ton",
symbol = "megaton of TNT per metric ton",
usename = 1,
utype = "energy per unit mass",
scale = 4.184e12,
default = "TJ/kg",
link = "TNT equivalent",
},
["MtTNT/MT"] = {
name2 = "megatonnes of TNT per tonne",
symbol = "megatonne of TNT per tonne",
usename = 1,
utype = "energy per unit mass",
scale = 4.184e12,
default = "TJ/kg",
link = "TNT equivalent",
},
["TJ/kg"] = {
name1 = "terajoule per kilogram",
name2 = "terajoules per kilogram",
symbol = "TJ/kg",
utype = "energy per unit mass",
scale = 1e12,
default = "MtTNT/MT",
link = "Specific energy",
},
["Cal/g"] = {
per = { "Cal", "g" },
utype = "energy per unit mass",
default = "kJ/g",
},
["BTU/cuft"] = {
per = { "BTU", "cuft" },
utype = "energy per unit volume",
default = "kJ/L",
},
["Cal/12USoz(mL)serve"] = {
per = { "Cal", "-12USoz(mL)serve" },
utype = "energy per unit volume",
default = "kJ/L",
},
["Cal/12USoz(ml)serve"] = {
per = { "Cal", "-12USoz(ml)serve" },
utype = "energy per unit volume",
default = "kJ/l",
},
["Cal/12USozserve"] = {
per = { "Cal", "-12USozserve" },
utype = "energy per unit volume",
default = "kJ/L",
},
["Cal/USoz"] = {
per = { "Cal", "USoz" },
utype = "energy per unit volume",
default = "kJ/ml",
},
["kJ/L"] = {
per = { "kJ", "L" },
utype = "energy per unit volume",
default = "BTU/cuft",
},
["kJ/l"] = {
per = { "kJ", "ll" },
utype = "energy per unit volume",
default = "BTU/cuft",
},
["kJ/ml"] = {
per = { "kJ", "ml" },
utype = "energy per unit volume",
default = "Cal/USoz",
},
["MJ/m3"] = {
per = { "MJ", "m3" },
utype = "energy per unit volume",
default = "BTU/cuft",
},
["Sv"] = {
_name1 = "sievert",
_symbol = "Sv",
utype = "equivalent radiation dose",
scale = 1,
prefixes = 1,
default = "rem",
link = "Sievert",
},
["rem"] = {
_name1 = "rem",
_symbol = "rem",
utype = "equivalent radiation dose",
scale = 0.01,
prefixes = 1,
default = "Sv",
link = "Roentgen equivalent man",
},
["g/km"] = {
name1 = "gram per kilometre",
name1_us = "gram per kilometer",
name2 = "grams per kilometre",
name2_us = "grams per kilometer",
symbol = "g/km",
utype = "exhaust emission",
scale = 1e-6,
default = "oz/mi",
link = "Exhaust gas",
},
["g/mi"] = {
name1 = "gram per mile",
name2 = "grams per mile",
symbol = "g/mi",
utype = "exhaust emission",
scale = 6.2137119223733397e-7,
default = "g/km",
link = "Exhaust gas",
},
["gCO2/km"] = {
name1 = "gram of CO<sub>2</sub> per kilometre",
name1_us = "gram of CO<sub>2</sub> per kilometer",
name2 = "grams of CO<sub>2</sub> per kilometre",
name2_us = "grams of CO<sub>2</sub> per kilometer",
symbol = "g(CO<sub>2</sub>)/km",
utype = "exhaust emission",
scale = 1e-6,
default = "ozCO2/mi",
link = "Exhaust gas",
},
["gCO2/mi"] = {
name1 = "gram of CO<sub>2</sub> per mile",
name2 = "grams of CO<sub>2</sub> per mile",
symbol = "g(CO<sub>2</sub>)/mi",
utype = "exhaust emission",
scale = 6.2137119223733397e-7,
default = "gCO2/km",
link = "Exhaust gas",
},
["kg/km"] = {
name1 = "kilogram per kilometre",
name1_us = "kilogram per kilometer",
name2 = "kilograms per kilometre",
name2_us = "kilograms per kilometer",
symbol = "kg/km",
utype = "exhaust emission",
scale = 0.001,
default = "lb/mi",
link = "Exhaust gas",
},
["kgCO2/km"] = {
name1 = "kilogram of CO<sub>2</sub> per kilometre",
name1_us = "kilogram of CO<sub>2</sub> per kilometer",
name2 = "kilograms of CO<sub>2</sub> per kilometre",
name2_us = "kilograms of CO<sub>2</sub> per kilometer",
symbol = "kg(CO<sub>2</sub>)/km",
utype = "exhaust emission",
scale = 0.001,
default = "lbCO2/mi",
link = "Exhaust gas",
},
["lb/mi"] = {
name1 = "pound per mile",
name2 = "pounds per mile",
symbol = "lb/mi",
utype = "exhaust emission",
scale = 0.00028184923173665794,
default = "kg/km",
link = "Exhaust gas",
},
["lbCO2/mi"] = {
name1 = "pound of CO<sub>2</sub> per mile",
name2 = "pounds of CO<sub>2</sub> per mile",
symbol = "lb(CO<sub>2</sub>)/mi",
utype = "exhaust emission",
scale = 0.00028184923173665794,
default = "kgCO2/km",
link = "Exhaust gas",
},
["oz/mi"] = {
name1 = "ounce per mile",
name2 = "ounces per mile",
symbol = "oz/mi",
utype = "exhaust emission",
scale = 1.7615576983541121e-5,
default = "g/km",
link = "Exhaust gas",
},
["ozCO2/mi"] = {
name1 = "ounce of CO<sub>2</sub> per mile",
name2 = "ounces of CO<sub>2</sub> per mile",
symbol = "oz(CO<sub>2</sub>)/mi",
utype = "exhaust emission",
scale = 1.7615576983541121e-5,
default = "gCO2/km",
link = "Exhaust gas",
},
["cuft/a"] = {
name1 = "cubic foot per annum",
name2 = "cubic feet per annum",
symbol = "cu ft/a",
utype = "flow",
scale = 8.9730672142368242e-10,
default = "m3/a",
link = "Cubic foot per second",
},
["cuft/d"] = {
name1 = "cubic foot per day",
name2 = "cubic feet per day",
symbol = "cu ft/d",
utype = "flow",
scale = 3.2774128000000003e-7,
default = "m3/d",
link = "Cubic foot per second",
},
["cuft/h"] = {
name1 = "cubic foot per hour",
name2 = "cubic feet per hour",
symbol = "cu ft/h",
utype = "flow",
scale = 7.8657907200000004e-6,
default = "m3/h",
link = "Cubic foot per second",
},
["cuft/min"] = {
name1 = "cubic foot per minute",
name2 = "cubic feet per minute",
symbol = "cu ft/min",
utype = "flow",
scale = 0.00047194744319999999,
default = "m3/min",
},
["cuft/s"] = {
name1 = "cubic foot per second",
name2 = "cubic feet per second",
symbol = "cu ft/s",
utype = "flow",
scale = 28316846592e-12,
default = "m3/s",
},
["cumi/a"] = {
name1 = "cubic mile per annum",
name2 = "cubic miles per annum",
symbol = "cu mi/a",
utype = "flow",
scale = 132.08171170940057,
default = "km3/a",
link = "Cubic foot per second",
},
["cuyd/h"] = {
name1 = "cubic yard per hour",
name2 = "cubic yards per hour",
symbol = "cuyd/h",
utype = "flow",
scale = 0.00021237634944000001,
default = "m3/h",
link = "Cubic foot per second",
},
["cuyd/s"] = {
name1 = "cubic yard per second",
name2 = "cubic yards per second",
symbol = "cu yd/s",
utype = "flow",
scale = 0.76455485798400002,
default = "m3/s",
},
["Goilbbl/a"] = {
name1 = "billion barrels per year",
name2 = "billion barrels per year",
symbol = "Gbbl/a",
utype = "flow",
scale = 5.0380033629933836,
default = "v * 1.58987294928 < 10 ! e6 ! e9 ! m3/a",
link = "Barrel per day",
},
["impgal/h"] = {
name1 = "imperial gallon per hour",
name2 = "imperial gallons per hour",
symbol = "imp gal/h",
utype = "flow",
scale = 1.2628027777777779e-6,
default = "m3/h",
link = "Gallon",
},
["impgal/min"] = {
name1 = "imperial gallon per minute",
name2 = "imperial gallons per minute",
symbol = "imp gal/min",
utype = "flow",
scale = 7.5768166666666671e-5,
default = "m3/s",
link = "Gallon",
},
["impgal/s"] = {
name1 = "imperial gallon per second",
name2 = "imperial gallons per second",
symbol = "impgal/s",
utype = "flow",
scale = 0.00454609,
default = "m3/s",
link = "Imperial gallons per second",
},
["km3/a"] = {
name1 = "cubic kilometre per annum",
name1_us = "cubic kilometer per annum",
name2 = "cubic kilometres per annum",
name2_us = "cubic kilometers per annum",
symbol = "km<sup>3</sup>/a",
utype = "flow",
scale = 31.68808781402895,
default = "cumi/a",
link = "Cubic metre per second",
},
["km3/d"] = {
name1 = "cubic kilometre per day",
name1_us = "cubic kilometer per day",
name2 = "cubic kilometres per day",
name2_us = "cubic kilometers per day",
symbol = "km<sup>3</sup>/d",
utype = "flow",
scale = 11574.074074074075,
default = "cuft/d",
link = "Cubic metre per second",
},
["koilbbl/a"] = {
name1 = "thousand barrels per year",
name2 = "thousand barrels per year",
symbol = "kbbl/a",
utype = "flow",
scale = 5.0380033629933841e-6,
default = "v * 1.58987294928 < 10 ! ! e3 ! m3/a",
link = "Barrel per day",
},
["koilbbl/d"] = {
name1 = "thousand barrels per day",
name2 = "thousand barrels per day",
symbol = "kbbl/d",
utype = "flow",
scale = 0.0018401307283333335,
default = "v * 1.58987294928 < 10 ! ! e3 ! m3/d",
link = "Barrel per day",
},
["L/h"] = {
name1 = "litre per hour",
name1_us = "liter per hour",
name2 = "litres per hour",
name2_us = "liters per hour",
symbol = "L/h",
utype = "flow",
scale = 2.7777777777777776e-7,
default = "impgal/h USgal/h",
link = "Cubic metre per second",
},
["L/min"] = {
name1 = "litre per minute",
name1_us = "liter per minute",
name2 = "litres per minute",
name2_us = "liters per minute",
symbol = "L/min",
utype = "flow",
scale = 1.6666666666666667e-5,
default = "impgal/min USgal/min",
link = "Cubic metre per second",
},
["L/s"] = {
name1 = "litre per second",
name1_us = "liter per second",
name2 = "litres per second",
name2_us = "liters per second",
symbol = "L/s",
utype = "flow",
scale = 0.001,
default = "cuft/s",
link = "Cubic metre per second",
},
["m3/a"] = {
name1 = "cubic metre per annum",
name1_us = "cubic meter per annum",
name2 = "cubic metres per annum",
name2_us = "cubic meters per annum",
symbol = "m<sup>3</sup>/a",
utype = "flow",
scale = 3.1688087814028947e-8,
default = "cuft/a",
link = "Cubic metre per second",
},
["m3/d"] = {
name1 = "cubic metre per day",
name1_us = "cubic meter per day",
name2 = "cubic metres per day",
name2_us = "cubic meters per day",
symbol = "m<sup>3</sup>/d",
utype = "flow",
scale = 1.1574074074074073e-5,
default = "cuft/d",
link = "Cubic metre per second",
},
["m3/h"] = {
name1 = "cubic metre per hour",
name1_us = "cubic meter per hour",
name2 = "cubic metres per hour",
name2_us = "cubic meters per hour",
symbol = "m<sup>3</sup>/h",
utype = "flow",
scale = 0.00027777777777777778,
default = "cuft/h",
link = "Cubic metre per second",
},
["m3/min"] = {
name1 = "cubic metre per minute",
name1_us = "cubic meter per minute",
name2 = "cubic metres per minute",
name2_us = "cubic meters per minute",
symbol = "m<sup>3</sup>/min",
utype = "flow",
scale = 0.016666666666666666,
default = "cuft/min",
link = "Cubic metre per second",
},
["m3/s"] = {
name1 = "cubic metre per second",
name1_us = "cubic meter per second",
name2 = "cubic metres per second",
name2_us = "cubic meters per second",
symbol = "m<sup>3</sup>/s",
utype = "flow",
scale = 1,
default = "cuft/s",
},
["Moilbbl/a"] = {
name1 = "million barrels per year",
name2 = "million barrels per year",
symbol = "Mbbl/a",
utype = "flow",
scale = 0.0050380033629933837,
default = "v * 1.58987294928 < 10 ! e3 ! e6 ! m3/a",
link = "Barrel per day",
},
["Moilbbl/d"] = {
name1 = "million barrels per day",
name2 = "million barrels per day",
symbol = "Mbbl/d",
utype = "flow",
scale = 1.8401307283333335,
default = "v * 1.58987294928 < 10 ! e3 ! e6 ! m3/d",
link = "Barrel per day",
},
["oilbbl/a"] = {
name1 = "barrel per year",
name2 = "barrels per year",
symbol = "bbl/a",
utype = "flow",
scale = 5.0380033629933841e-9,
default = "m3/a",
link = "Barrel per day",
},
["oilbbl/d"] = {
name1 = "barrel per day",
name2 = "barrels per day",
symbol = "bbl/d",
utype = "flow",
scale = 1.8401307283333336e-6,
default = "m3/d",
},
["Toilbbl/a"] = {
name1 = "trillion barrels per year",
name2 = "trillion barrels per year",
symbol = "Tbbl/a",
utype = "flow",
scale = 5038.0033629933832,
default = "v * 1.58987294928 < 10 ! e9 ! e12 ! m3/a",
link = "Barrel per day",
},
["U.S.gal/d"] = {
name1 = "U.S. gallon per day",
name2 = "U.S. gallons per day",
symbol = "U.S. gal/d",
utype = "flow",
scale = 4.3812636388888893e-8,
default = "m3/s",
customary= 1,
},
["U.S.gal/h"] = {
name1 = "gallon per hour",
name2 = "gallons per hour",
symbol = "gal/h",
utype = "flow",
scale = 1.0515032733333334e-6,
default = "m3/h",
link = "Gallon",
customary= 2,
},
["U.S.gal/min"] = {
name1 = "U.S. gallon per minute",
name2 = "U.S. gallons per minute",
symbol = "U.S. gal/min",
utype = "flow",
scale = 6.3090196400000003e-5,
default = "m3/s",
link = "Gallon",
},
["USgal/a"] = {
name1 = "US gallon per year",
name2 = "US gallons per year",
symbol = "US gal/a",
utype = "flow",
scale = 1.1995246102365199e-10,
default = "m3/s",
},
["USgal/d"] = {
name1 = "US gallon per day",
name2 = "US gallons per day",
symbol = "US gal/d",
utype = "flow",
scale = 4.3812636388888893e-8,
default = "m3/s",
},
["USgal/h"] = {
name1 = "gallon per hour",
name2 = "gallons per hour",
symbol = "gal/h",
utype = "flow",
scale = 1.0515032733333334e-6,
default = "m3/h",
link = "Gallon",
customary= 1,
},
["USgal/min"] = {
name1 = "US gallon per minute",
name2 = "US gallons per minute",
symbol = "US gal/min",
utype = "flow",
scale = 6.3090196400000003e-5,
default = "m3/s",
link = "Gallon",
},
["USgal/s"] = {
name1 = "US gallon per second",
name1_us = "U.S. gallon per second",
name2 = "US gallons per second",
name2_us = "U.S. gallons per second",
symbol = "USgal/s",
utype = "flow",
scale = 0.003785411784,
default = "m3/s",
link = "US gallons per second",
},
["ft3/a"] = {
target = "cuft/a",
},
["ft3/d"] = {
target = "cuft/d",
},
["ft3/h"] = {
target = "cuft/h",
},
["ft3/s"] = {
target = "cuft/s",
},
["Gcuft/a"] = {
target = "e9cuft/a",
},
["Gcuft/d"] = {
target = "e9cuft/d",
},
["kcuft/a"] = {
target = "e3cuft/a",
},
["kcuft/d"] = {
target = "e3cuft/d",
},
["kcuft/s"] = {
target = "e3cuft/s",
},
["Mcuft/a"] = {
target = "e6cuft/a",
},
["Mcuft/d"] = {
target = "e6cuft/d",
},
["Mcuft/s"] = {
target = "e6cuft/s",
},
["m³/s"] = {
target = "m3/s",
},
["Tcuft/a"] = {
target = "e12cuft/a",
},
["Tcuft/d"] = {
target = "e12cuft/d",
},
["u.s.gal/min"] = {
target = "U.S.gal/min",
},
["usgal/min"] = {
target = "USgal/min",
},
["-LTf"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "LTf",
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["-STf"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "STf",
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["dyn"] = {
name1 = "dyne",
symbol = "dyn",
utype = "force",
scale = 0.00001,
default = "gr-f",
},
["g-f"] = {
name1 = "gram-force",
name2 = "grams-force",
symbol = "g<sub>f</sub>",
utype = "force",
scale = 0.00980665,
default = "mN oz-f",
link = "Kilogram-force",
},
["gf"] = {
name1 = "gram-force",
name2 = "grams-force",
symbol = "gf",
utype = "force",
scale = 0.00980665,
default = "mN ozf",
link = "Kilogram-force",
},
["gr-f"] = {
name1 = "grain-force",
name2 = "grains-force",
symbol = "gr<sub>f</sub>",
utype = "force",
scale = 0.0006354602307515,
default = "μN",
link = "Pound (force)",
},
["grf"] = {
name1 = "grain-force",
name2 = "grains-force",
symbol = "grf",
utype = "force",
scale = 0.0006354602307515,
default = "μN",
link = "Pound (force)",
},
["kdyn"] = {
name1 = "kilodyne",
symbol = "kdyn",
utype = "force",
scale = 0.01,
default = "oz-f",
link = "Dyne",
},
["kg-f"] = {
name1 = "kilogram-force",
name2 = "kilograms-force",
symbol = "kg<sub>f</sub>",
utype = "force",
scale = 9.80665,
default = "N lb-f",
},
["kgf"] = {
name1 = "kilogram-force",
name2 = "kilograms-force",
symbol = "kgf",
utype = "force",
scale = 9.80665,
default = "N lbf",
},
["kp"] = {
name1 = "kilopond",
symbol = "kp",
utype = "force",
scale = 9.80665,
default = "N lb-f",
link = "Kilogram-force",
},
["L/T-f"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "L/T<sub>f</sub>",
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["L/Tf"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "L/Tf",
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["lb-f"] = {
name1 = "pound-force",
name2 = "pounds-force",
symbol = "lb<sub>f</sub>",
utype = "force",
scale = 4.4482216152605,
default = "N",
link = "Pound (force)",
},
["lbf"] = {
name1 = "pound-force",
name2 = "pounds-force",
symbol = "lbf",
utype = "force",
scale = 4.4482216152605,
default = "N",
link = "Pound (force)",
},
["lb(f)"] = {
name1 = "pound",
symbol = "lb",
utype = "force",
scale = 4.4482216152605,
default = "N",
link = "Pound (force)",
},
["LT-f"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "LT<sub>f</sub>",
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["LTf"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "LTf",
usename = 1,
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["Mdyn"] = {
name1 = "megadyne",
symbol = "Mdyn",
utype = "force",
scale = 10,
default = "lb-f",
link = "Dyne",
},
["mdyn"] = {
name1 = "millidyne",
symbol = "mdyn",
utype = "force",
scale = 0.00000001,
default = "gr-f",
link = "Dyne",
},
["mg-f"] = {
name1 = "milligram-force",
name2 = "milligrams-force",
symbol = "mg<sub>f</sub>",
utype = "force",
scale = 0.00000980665,
default = "μN gr-f",
link = "Kilogram-force",
},
["mgf"] = {
name1 = "milligram-force",
name2 = "milligrams-force",
symbol = "mgf",
utype = "force",
scale = 0.00000980665,
default = "μN grf",
link = "Kilogram-force",
},
["Mp"] = {
name1 = "megapond",
symbol = "Mp",
utype = "force",
scale = 9806.65,
default = "kN LT-f ST-f",
link = "Kilogram-force",
},
["mp"] = {
name1 = "millipond",
symbol = "mp",
utype = "force",
scale = 0.00000980665,
default = "μN gr-f",
link = "Kilogram-force",
},
["N"] = {
_name1 = "newton",
_symbol = "N",
utype = "force",
scale = 1,
prefixes = 1,
default = "lb-f",
link = "Newton (unit)",
},
["oz-f"] = {
name1 = "ounce-force",
name2 = "ounces-force",
symbol = "oz<sub>f</sub>",
utype = "force",
scale = 0.2780138203095378125,
default = "mN",
link = "Pound (force)",
},
["ozf"] = {
name1 = "ounce-force",
name2 = "ounces-force",
symbol = "ozf",
utype = "force",
scale = 0.2780138203095378125,
default = "mN",
link = "Pound (force)",
},
["p"] = {
name1 = "pond",
symbol = "p",
utype = "force",
scale = 0.00980665,
default = "mN oz-f",
link = "Kilogram-force",
},
["pdl"] = {
name1 = "poundal",
symbol = "pdl",
utype = "force",
scale = 0.138254954376,
default = "N",
},
["S/T-f"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "S/T<sub>f</sub>",
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["S/Tf"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "S/Tf",
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["ST-f"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "ST<sub>f</sub>",
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["STf"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "STf",
usename = 1,
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["t-f"] = {
name1 = "tonne-force",
name2 = "tonnes-force",
symbol = "t<sub>f</sub>",
utype = "force",
scale = 9806.65,
default = "kN LT-f ST-f",
link = "Ton-force#Tonne-force",
},
["tf"] = {
name1 = "tonne-force",
name2 = "tonnes-force",
symbol = "tf",
utype = "force",
scale = 9806.65,
default = "kN LTf STf",
link = "Ton-force#Tonne-force",
},
["dyne"] = {
target = "dyn",
},
["newtons"] = {
target = "N",
},
["poundal"] = {
target = "pdl",
},
["tonne-force"] = {
target = "tf",
},
["impgal/mi"] = {
per = { "@impgal", "mi" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "L/km USgal/mi",
},
["km/L"] = {
per = { "km", "L" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "mpgimp mpgus",
},
["km/l"] = {
per = { "km", "ll" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "mpgimp mpgus",
},
["L/100 km"] = {
per = { "L", "100km" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "mpgimp mpgus",
symlink = "[[Fuel economy in automobiles#Units of measure|L/100 km]]",
},
["l/100 km"] = {
per = { "ll", "100km" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "mpgimp mpgus",
symlink = "[[Fuel economy in automobiles#Units of measure|l/100 km]]",
},
["L/km"] = {
per = { "L", "km" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "mpgimp mpgus",
},
["l/km"] = {
per = { "ll", "km" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "mpgimp mpgus",
},
["mi/impqt"] = {
per = { "mi", "impqt" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "km/L",
},
["mi/U.S.qt"] = {
per = { "mi", "U.S.qt" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "km/L",
},
["mi/USqt"] = {
per = { "mi", "USqt" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "km/L",
},
["mi/usqt"] = {
per = { "mi", "usqt" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "km/L",
},
["mpgimp"] = {
per = { "mi", "@impgal" },
symbol = "mpg<sub>‑imp</sub>",
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "L/100 km+mpgus",
symlink = "[[Fuel economy in automobiles#Units of measure|mpg]]<sub>‑[[Imperial units|imp]]</sub>",
},
["mpgus"] = {
per = { "mi", "+USgal" },
symbol = "mpg<sub>‑US</sub>",
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "L/100 km+mpgimp",
symlink = "[[Fuel economy in automobiles#Units of measure|mpg]]<sub>‑[[United States customary units|US]]</sub>",
},
["U.S.gal/mi"] = {
per = { "*U.S.gal", "mi" },
sp_us = true,
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "L/km impgal/mi",
},
["usgal/mi"] = {
per = { "+USgal", "mi" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "L/km impgal/mi",
},
["L/100km"] = {
target = "L/100 km",
},
["l/100km"] = {
target = "l/100 km",
},
["mpg"] = {
shouldbe = "Use %{mpgus%} for miles per US gallon or %{mpgimp%} for miles per imperial gallon (not %{mpg%})",
},
["mpgU.S."] = {
target = "mpgus",
symbol = "mpg<sub>‑U.S.</sub>",
sp_us = true,
symlink = "[[Fuel economy in automobiles#Units of measure|mpg]]<sub>‑[[United States customary units|U.S.]]</sub>",
},
["mpgu.s."] = {
target = "mpgus",
symbol = "mpg<sub>‑U.S.</sub>",
sp_us = true,
symlink = "[[Fuel economy in automobiles#Units of measure|mpg]]<sub>‑[[United States customary units|U.S.]]</sub>",
},
["mpgUS"] = {
target = "mpgus",
},
["USgal/mi"] = {
target = "usgal/mi",
},
["kPa/m"] = {
per = { "kPa", "-m-frac" },
utype = "fracture gradient",
default = "psi/ft",
},
["psi/ft"] = {
per = { "psi", "-ft-frac" },
utype = "fracture gradient",
default = "kPa/m",
},
["cm/km"] = {
name1 = "centimetre per kilometre",
name1_us = "centimeter per kilometer",
name2 = "centimetres per kilometre",
name2_us = "centimeters per kilometer",
symbol = "cm/km",
utype = "gradient",
scale = 0.00001,
default = "ft/mi",
link = "Grade (slope)",
},
["ft/mi"] = {
name1 = "foot per mile",
name2 = "feet per mile",
symbol = "ft/mi",
utype = "gradient",
scale = 0.00018939393939393939,
default = "v < 5.28 ! c ! ! m/km",
link = "Grade (slope)",
},
["ft/nmi"] = {
name1 = "foot per nautical mile",
name2 = "feet per nautical mile",
symbol = "ft/nmi",
utype = "gradient",
scale = 0.00016457883369330455,
default = "v < 6.076 ! c ! ! m/km",
link = "Grade (slope)",
},
["in/ft"] = {
name1 = "inch per foot",
name2 = "inches per foot",
symbol = "in/ft",
utype = "gradient",
scale = 0.083333333333333329,
default = "mm/m",
link = "Grade (slope)",
},
["in/mi"] = {
name1 = "inch per mile",
name2 = "inches per mile",
symbol = "in/mi",
utype = "gradient",
scale = 1.5782828282828283e-5,
default = "v < 0.6336 ! m ! c ! m/km",
link = "Grade (slope)",
},
["m/km"] = {
name1 = "metre per kilometre",
name1_us = "meter per kilometer",
name2 = "metres per kilometre",
name2_us = "meters per kilometer",
symbol = "m/km",
utype = "gradient",
scale = 0.001,
default = "ft/mi",
link = "Grade (slope)",
},
["mm/km"] = {
name1 = "millimetre per kilometre",
name1_us = "millimeter per kilometer",
name2 = "millimetres per kilometre",
name2_us = "millimeters per kilometer",
symbol = "mm/km",
utype = "gradient",
scale = 0.000001,
default = "in/mi",
link = "Grade (slope)",
},
["mm/m"] = {
name1 = "millimetre per metre",
name1_us = "millimeter per meter",
name2 = "millimetres per metre",
name2_us = "millimeters per meter",
symbol = "mm/m",
utype = "gradient",
scale = 0.001,
default = "in/ft",
link = "Grade (slope)",
},
["admi"] = {
name1 = "admiralty mile",
symbol = "nmi (admiralty)",
utype = "length",
scale = 1853.184,
default = "km mi",
link = "Nautical mile",
},
["AU"] = {
name1 = "astronomical unit",
symbol = "AU",
utype = "length",
scale = 149597870700,
default = "km mi",
},
["Brnmi"] = {
name1 = "British nautical mile",
symbol = "(Brit) nmi",
utype = "length",
scale = 1853.184,
default = "km mi",
link = "Nautical mile",
},
["bu"] = {
name2 = "bu",
symbol = "bu",
usename = 1,
utype = "length",
scale = 0.0030303030303030303,
default = "mm",
link = "Japanese units of measurement#Length",
},
["ch"] = {
name1 = "chain",
symbol = "ch",
utype = "length",
scale = 20.1168,
default = "ft m",
subdivs = { ["ft"] = { 66, default = "m" }, ["yd"] = { 22, default = "m" } },
link = "Chain (unit)",
},
["chlk"] = {
name1 = "[[Chain (unit)|chain]]",
symbol = "[[Chain (unit)|ch]]",
utype = "length",
scale = 20.1168,
default = "ft m",
link = "",
},
["chain"] = {
symbol = "chain",
usename = 1,
utype = "length",
scale = 20.1168,
default = "ft m",
subdivs = { ["ft"] = { 66, default = "m" }, ["yd"] = { 22, default = "m" } },
link = "Chain (unit)",
},
["chainlk"] = {
symbol = "[[Chain (unit)|chain]]",
usename = 1,
utype = "length",
scale = 20.1168,
default = "ft m",
link = "",
},
["dpcm"] = {
name2 = "dot/cm",
symbol = "dot/cm",
utype = "length",
scale = 100,
invert = -1,
iscomplex= true,
default = "dpi",
link = "Dots per inch",
},
["dpi"] = {
name2 = "DPI",
symbol = "DPI",
utype = "length",
scale = 39.370078740157481,
invert = -1,
iscomplex= true,
default = "pitch",
link = "Dots per inch",
},
["fathom"] = {
symbol = "fathom",
usename = 1,
utype = "length",
scale = 1.8288,
default = "ft m",
},
["foot"] = {
name1 = "foot",
name2 = "foot",
symbol = "ft",
utype = "length",
scale = 0.3048,
default = "m",
subdivs = { ["in"] = { 12, default = "m" } },
link = "Foot (unit)",
},
["ft"] = {
name1 = "foot",
name2 = "feet",
symbol = "ft",
utype = "length",
scale = 0.3048,
exception= "integer_more_precision",
default = "m",
subdivs = { ["in"] = { 12, default = "m" } },
link = "Foot (unit)",
},
["furlong"] = {
symbol = "furlong",
usename = 1,
utype = "length",
scale = 201.168,
default = "ft m",
},
["Gly"] = {
name1 = "gigalight-year",
symbol = "Gly",
utype = "length",
scale = 9.4607304725808e24,
default = "Mpc",
link = "Light-year#Definitions",
},
["Gpc"] = {
name1 = "gigaparsec",
symbol = "Gpc",
utype = "length",
scale = 3.0856775814671916e25,
default = "Gly",
link = "Parsec#Megaparsecs and gigaparsecs",
},
["hand"] = {
name1 = "hand",
symbol = "h",
utype = "length",
builtin = "hand",
scale = 0.1016,
iscomplex= true,
default = "in cm",
link = "Hand (unit)",
},
["in"] = {
name1 = "inch",
name2 = "inches",
symbol = "in",
utype = "length",
scale = 0.0254,
exception= "subunit_more_precision",
default = "mm",
},
["inabbreviated"] = {
name2 = "in",
symbol = "in",
utype = "length",
scale = 0.0254,
default = "mm",
link = "Inch",
},
["kly"] = {
name1 = "kilolight-year",
symbol = "kly",
utype = "length",
scale = 9.4607304725808e18,
default = "pc",
link = "Light-year#Definitions",
},
["kpc"] = {
name1 = "kiloparsec",
symbol = "kpc",
utype = "length",
scale = 3.0856775814671916e19,
default = "kly",
link = "Parsec#Parsecs and kiloparsecs",
},
["LD"] = {
name1 = "lunar distance",
symbol = "LD",
utype = "length",
scale = 384403000,
default = "km mi",
link = "Lunar distance (astronomy)",
},
["league"] = {
symbol = "league",
usename = 1,
utype = "length",
scale = 4828.032,
default = "km",
link = "League (unit)",
},
["ly"] = {
name1 = "light-year",
symbol = "ly",
utype = "length",
scale = 9.4607304725808e15,
default = "AU",
},
["m"] = {
_name1 = "metre",
_name1_us= "meter",
_symbol = "m",
utype = "length",
scale = 1,
prefixes = 1,
default = "v > 0 and v < 3 ! ftin ! ft",
link = "Metre",
},
["mi"] = {
name1 = "mile",
symbol = "mi",
utype = "length",
scale = 1609.344,
default = "km",
subdivs = { ["ch"] = { 80, default = "km" }, ["chlk"] = { 80, default = "km" }, ["chain"] = { 80, default = "km" }, ["chainlk"] = { 80, default = "km" }, ["ft"] = { 5280, default = "km" }, ["furlong"] = { 8, default = "km" }, ["yd"] = { 1760, default = "km" } },
},
["mil"] = {
symbol = "mil",
usename = 1,
utype = "length",
scale = 0.0000254,
default = "mm",
link = "Thousandth of an inch",
},
["Mly"] = {
name1 = "megalight-year",
symbol = "Mly",
utype = "length",
scale = 9.4607304725808e21,
default = "kpc",
link = "Light-year#Definitions",
},
["Mpc"] = {
name1 = "megaparsec",
symbol = "Mpc",
utype = "length",
scale = 3.0856775814671916e22,
default = "Mly",
link = "Parsec#Megaparsecs and gigaparsecs",
},
["NM"] = {
name1 = "nautical mile",
symbol = "NM",
utype = "length",
scale = 1852,
default = "km mi",
},
["nmi"] = {
name1 = "nautical mile",
symbol = "nmi",
utype = "length",
scale = 1852,
default = "km mi",
},
["oldUKnmi"] = {
name1 = "nautical mile",
symbol = "nmi",
utype = "length",
scale = 1853.184,
default = "km mi",
},
["oldUSnmi"] = {
name1 = "nautical mile",
symbol = "nmi",
utype = "length",
scale = 1853.24496,
default = "km mi",
},
["pc"] = {
name1 = "parsec",
symbol = "pc",
utype = "length",
scale = 3.0856775814671916e16,
default = "ly",
},
["perch"] = {
name2 = "perches",
symbol = "perch",
usename = 1,
utype = "length",
scale = 5.0292,
default = "ft m",
link = "Rod (unit)",
},
["pitch"] = {
name2 = "μm",
symbol = "μm",
utype = "length",
scale = 1e-6,
default = "dpi",
defkey = "pitch",
linkey = "pitch",
link = "Dots per inch",
},
["pole"] = {
symbol = "pole",
usename = 1,
utype = "length",
scale = 5.0292,
default = "ft m",
link = "Rod (unit)",
},
["pre1954U.S.nmi"] = {
name1 = "(pre-1954 U.S.) nautical mile",
symbol = "(pre‑1954 U.S.) nmi",
utype = "length",
scale = 1853.24496,
default = "km mi",
link = "Nautical mile",
},
["pre1954USnmi"] = {
name1 = "(pre-1954 US) nautical mile",
name1_us = "(pre-1954 U.S.) nautical mile",
symbol = "(pre‑1954 US) nmi",
sym_us = "(pre‑1954 U.S.) nmi",
utype = "length",
scale = 1853.24496,
default = "km mi",
link = "Nautical mile",
},
["rd"] = {
name1 = "rod",
symbol = "rd",
utype = "length",
scale = 5.0292,
default = "ft m",
link = "Rod (unit)",
},
["royal cubit"] = {
name1 = "royal cubit",
symbol = "cu",
utype = "length",
scale = 0.524,
default = "mm",
},
["rtkm"] = {
name1 = "route kilometre",
name1_us = "route kilometer",
symbol = "km",
utype = "length",
scale = 1000,
default = "mi",
link = "Kilometre",
},
["rtmi"] = {
name1 = "route mile",
symbol = "mi",
utype = "length",
scale = 1609.344,
default = "km",
link = "Mile",
},
["shaku"] = {
name2 = "shaku",
symbol = "shaku",
usename = 1,
utype = "length",
scale = 0.30303030303030304,
default = "m",
link = "Shaku (unit)",
},
["sm"] = {
name1 = "smoot",
symbol = "sm",
utype = "length",
scale = 1.70180,
default = "m",
link = "Smoot (unit)",
},
["smi"] = {
name1 = "statute mile",
symbol = "mi",
utype = "length",
scale = 1609.344,
default = "km",
subdivs = { ["chain"] = { 80, default = "km" } },
},
["solar radius"] = {
name1 = "solar radius",
name2 = "solar radii",
symbol = "''R''<sub>☉</sub>",
utype = "length",
scale = 695700e3,
default = "km",
},
["sun"] = {
name2 = "sun",
symbol = "sun",
usename = 1,
utype = "length",
scale = 0.030303030303030304,
default = "mm",
link = "Japanese units of measurement#Length",
},
["thou"] = {
name2 = "thou",
symbol = "thou",
usename = 1,
utype = "length",
scale = 0.0000254,
default = "mm",
link = "Thousandth of an inch",
},
["verst"] = {
symbol = "verst",
usename = 1,
utype = "length",
scale = 1066.8,
default = "km mi",
},
["yd"] = {
name1 = "yard",
symbol = "yd",
utype = "length",
scale = 0.9144,
default = "m",
subdivs = { ["ft"] = { 3, default = "m" } },
},
["μin"] = {
name1 = "microinch",
name2 = "microinches",
symbol = "μin",
utype = "length",
scale = 0.0000000254,
default = "nm",
link = "SI prefix#Non-metric units",
},
["Å"] = {
name1 = "ångström",
symbol = "Å",
utype = "length",
scale = 0.0000000001,
default = "in",
},
["Hz"] = {
_name1 = "hertz",
_name2 = "hertz",
_symbol = "Hz",
utype = "length",
scale = 3.3356409519815204e-9,
invert = -1,
iscomplex= true,
prefixes = 1,
default = "m",
link = "Hertz",
},
["rpm"] = {
name1 = "revolution per minute",
name2 = "revolutions per minute",
symbol = "rpm",
utype = "length",
scale = 5.5594015866358675e-11,
invert = -1,
iscomplex= true,
default = "Hz",
link = "Revolutions per minute",
},
["-ft-frac"] = {
target = "ft",
link = "Fracture gradient",
},
["-in-stiff"] = {
target = "in",
link = "Stiffness",
},
["-m-frac"] = {
target = "m",
link = "Fracture gradient",
},
["-m-stiff"] = {
target = "m",
link = "Stiffness",
},
["100km"] = {
target = "km",
multiplier= 100,
},
["100mi"] = {
target = "mi",
multiplier= 100,
},
["100miles"] = {
target = "mi",
symbol = "miles",
multiplier= 100,
},
["admiralty nmi"] = {
target = "oldUKnmi",
},
["angstrom"] = {
target = "Å",
},
["au"] = {
target = "AU",
symbol = "au",
},
["feet"] = {
target = "ft",
},
["hands"] = {
target = "hand",
},
["inch"] = {
target = "in",
},
["inches"] = {
target = "in",
},
["light-year"] = {
target = "ly",
},
["meter"] = {
target = "m",
sp_us = true,
},
["meters"] = {
target = "m",
sp_us = true,
},
["metre"] = {
target = "m",
},
["metres"] = {
target = "m",
},
["micrometre"] = {
target = "μm",
},
["micron"] = {
target = "μm",
default = "μin",
},
["mile"] = {
target = "mi",
usename = 1,
},
["miles"] = {
target = "mi",
usename = 1,
},
["parsec"] = {
target = "pc",
},
["rod"] = {
target = "rd",
},
["smoot"] = {
target = "sm",
},
["uin"] = {
target = "μin",
},
["yard"] = {
target = "yd",
},
["yards"] = {
target = "yd",
},
["yds"] = {
target = "yd",
},
["dtex"] = {
name1 = "decitex",
name2 = "decitex",
symbol = "dtex",
utype = "linear density",
scale = 1e-7,
default = "lb/yd",
link = "Units of textile measurement#Units",
},
["kg/cm"] = {
name1 = "kilogram per centimetre",
name1_us = "kilogram per centimeter",
name2 = "kilograms per centimetre",
name2_us = "kilograms per centimeter",
symbol = "kg/cm",
utype = "linear density",
scale = 100,
default = "lb/yd",
link = "Linear density",
},
["kg/m"] = {
name1 = "kilogram per metre",
name1_us = "kilogram per meter",
name2 = "kilograms per metre",
name2_us = "kilograms per meter",
symbol = "kg/m",
utype = "linear density",
scale = 1,
default = "lb/yd",
link = "Linear density",
},
["lb/ft"] = {
name1 = "pound per foot",
name2 = "pounds per foot",
symbol = "lb/ft",
utype = "linear density",
scale = 1.4881639435695539,
default = "kg/m",
link = "Linear density",
},
["lb/yd"] = {
name1 = "pound per yard",
name2 = "pounds per yard",
symbol = "lb/yd",
utype = "linear density",
scale = 0.49605464785651798,
default = "kg/m",
link = "Linear density",
},
["G"] = {
_name1 = "gauss",
_name2 = "gauss",
_symbol = "G",
utype = "magnetic field strength",
scale = 0.0001,
prefixes = 1,
default = "T",
link = "Gauss (unit)",
},
["T"] = {
_name1 = "tesla",
_symbol = "T",
utype = "magnetic field strength",
scale = 1,
prefixes = 1,
default = "G",
link = "Tesla (unit)",
},
["A/m"] = {
name1 = "ampere per metre",
name1_us = "ampere per meter",
name2 = "amperes per metre",
name2_us = "amperes per meter",
symbol = "A/m",
utype = "magnetizing field",
scale = 1,
default = "Oe",
},
["kA/m"] = {
name1 = "kiloampere per metre",
name1_us = "kiloampere per meter",
name2 = "kiloamperes per metre",
name2_us = "kiloamperes per meter",
symbol = "kA/m",
utype = "magnetizing field",
scale = 1000,
default = "kOe",
link = "Ampere per metre",
},
["MA/m"] = {
name1 = "megaampere per metre",
name1_us = "megaampere per meter",
name2 = "megaamperes per metre",
name2_us = "megaamperes per meter",
symbol = "MA/m",
utype = "magnetizing field",
scale = 1e6,
default = "kOe",
link = "Ampere per metre",
},
["Oe"] = {
_name1 = "oersted",
_symbol = "Oe",
utype = "magnetizing field",
scale = 79.5774715,
prefixes = 1,
default = "kA/m",
link = "Oersted",
},
["-Lcwt"] = {
name1 = "hundredweight",
name2 = "hundredweight",
symbol = "cwt",
utype = "mass",
scale = 50.80234544,
default = "lb",
},
["-Scwt"] = {
name1 = "hundredweight",
name2 = "hundredweight",
symbol = "cwt",
utype = "mass",
scale = 45.359237,
default = "lb",
},
["-ST"] = {
name1 = "short ton",
symbol = "ST",
utype = "mass",
scale = 907.18474,
default = "t",
},
["carat"] = {
symbol = "carat",
usename = 1,
utype = "mass",
scale = 0.0002,
default = "g",
link = "Carat (mass)",
},
["Da"] = {
_name1 = "dalton",
_symbol = "Da",
utype = "mass",
scale = 1.66053906892e-27,
prefixes = 1,
default = "kg",
link = "Dalton (unit)",
},
["drachm"] = {
name1_us = "dram",
symbol = "drachm",
usename = 1,
utype = "mass",
scale = 0.001771845195,
default = "g",
link = "Dram (unit)",
},
["dram"] = {
target = "drachm",
},
["dwt"] = {
name1 = "pennyweight",
symbol = "dwt",
utype = "mass",
scale = 0.00155517384,
default = "oz g",
},
["DWton"] = {
symbol = "deadweight ton",
usename = 1,
utype = "mass",
scale = 1016.0469088,
default = "DWtonne",
link = "Deadweight tonnage",
},
["DWtonne"] = {
name1_us = "deadweight metric ton",
symbol = "deadweight tonne",
sym_us = "~deadweight metric ton",
usename = 1,
utype = "mass",
scale = 1000,
default = "DWton",
link = "Deadweight tonnage",
},
["g"] = {
_name1 = "gram",
_symbol = "g",
utype = "mass",
scale = 0.001,
prefixes = 1,
default = "oz",
link = "Gram",
},
["gr"] = {
name1 = "grain",
symbol = "gr",
utype = "mass",
scale = 0.00006479891,
default = "g",
link = "Grain (unit)",
},
["Gt"] = {
name1 = "gigatonne",
symbol = "Gt",
utype = "mass",
scale = 1000000000000,
default = "LT ST",
link = "Tonne",
},
["impgalh2o"] = {
name1 = "imperial gallon of water",
name2 = "imperial gallons of water",
symbol = "imp gal H<sub>2</sub>O",
utype = "mass",
scale = 4.5359236999999499,
default = "lb kg",
link = "Imperial gallon",
},
["kt"] = {
name1 = "kilotonne",
symbol = "kt",
utype = "mass",
scale = 1000000,
default = "LT ST",
link = "Tonne",
},
["lb"] = {
name1 = "pound",
symbol = "lb",
utype = "mass",
scale = 0.45359237,
exception= "integer_more_precision",
default = "kg",
subdivs = { ["oz"] = { 16, default = "kg" } },
link = "Pound (mass)",
},
["Lcwt"] = {
name1 = "long hundredweight",
name2 = "long hundredweight",
symbol = "Lcwt",
usename = 1,
utype = "mass",
scale = 50.80234544,
default = "lb",
subdivs = { ["qtr"] = { 4, default = "kg" }, ["st"] = { 8, default = "kg" } },
link = "Hundredweight",
},
["long cwt"] = {
name1 = "long hundredweight",
name2 = "long hundredweight",
symbol = "long cwt",
utype = "mass",
scale = 50.80234544,
default = "lb kg",
subdivs = { ["qtr"] = { 4, default = "kg" } },
link = "Hundredweight",
},
["long qtr"] = {
name1 = "long quarter",
symbol = "long qtr",
utype = "mass",
scale = 12.70058636,
default = "lb kg",
},
["LT"] = {
symbol = "long ton",
usename = 1,
utype = "mass",
scale = 1016.0469088,
default = "t",
subdivs = { ["Lcwt"] = { 20, default = "t", unit = "-Lcwt" } },
},
["lt"] = {
name1 = "long ton",
symbol = "LT",
utype = "mass",
scale = 1016.0469088,
default = "t",
subdivs = { ["Lcwt"] = { 20, default = "t", unit = "-Lcwt" } },
},
["metric ton"] = {
symbol = "metric ton",
usename = 1,
utype = "mass",
scale = 1000,
default = "long ton",
link = "Tonne",
},
["MT"] = {
name1 = "metric ton",
symbol = "t",
utype = "mass",
scale = 1000,
default = "LT ST",
link = "Tonne",
},
["Mt"] = {
name1 = "megatonne",
symbol = "Mt",
utype = "mass",
scale = 1000000000,
default = "LT ST",
link = "Tonne",
},
["oz"] = {
name1 = "ounce",
symbol = "oz",
utype = "mass",
scale = 0.028349523125,
default = "g",
},
["ozt"] = {
name1 = "troy ounce",
symbol = "ozt",
utype = "mass",
scale = 0.0311034768,
default = "oz g",
},
["pdr"] = {
name1 = "pounder",
symbol = "pdr",
utype = "mass",
scale = 0.45359237,
default = "kg",
link = "Pound (mass)",
},
["qtr"] = {
name1 = "quarter",
symbol = "qtr",
utype = "mass",
scale = 12.70058636,
default = "lb kg",
subdivs = { ["lb"] = { 28, default = "kg" } },
link = "Long quarter",
},
["Scwt"] = {
name1 = "short hundredweight",
name2 = "short hundredweight",
symbol = "Scwt",
usename = 1,
utype = "mass",
scale = 45.359237,
default = "lb",
link = "Hundredweight",
},
["short cwt"] = {
name1 = "short hundredweight",
name2 = "short hundredweight",
symbol = "short cwt",
utype = "mass",
scale = 45.359237,
default = "lb kg",
link = "Hundredweight",
},
["short qtr"] = {
name1 = "short quarter",
symbol = "short qtr",
utype = "mass",
scale = 11.33980925,
default = "lb kg",
},
["ST"] = {
symbol = "short ton",
usename = 1,
utype = "mass",
scale = 907.18474,
default = "t",
subdivs = { ["Scwt"] = { 20, default = "t", unit = "-Scwt" } },
},
["shtn"] = {
name1 = "short ton",
symbol = "sh tn",
utype = "mass",
scale = 907.18474,
default = "t",
},
["shton"] = {
symbol = "ton",
usename = 1,
utype = "mass",
scale = 907.18474,
default = "t",
},
["solar mass"] = {
name1 = "solar mass",
name2 = "solar masses",
symbol = "''M''<sub>☉</sub>",
utype = "mass",
scale = 1.98855e30,
default = "kg",
},
["st"] = {
name1 = "stone",
name2 = "stone",
symbol = "st",
utype = "mass",
scale = 6.35029318,
default = "lb kg",
subdivs = { ["lb"] = { 14, default = "kg lb" } },
link = "Stone (unit)",
},
["t"] = {
name1 = "tonne",
name1_us = "metric ton",
symbol = "t",
utype = "mass",
scale = 1000,
default = "LT ST",
},
["tonne"] = {
name1 = "tonne",
name1_us = "metric ton",
symbol = "t",
utype = "mass",
scale = 1000,
default = "shton",
},
["troy pound"] = {
symbol = "troy pound",
usename = 1,
utype = "mass",
scale = 0.3732417216,
default = "lb kg",
link = "Troy weight",
},
["usgalh2o"] = {
name1 = "US gallon of water",
name1_us = "U.S. gallon of water",
name2 = "US gallons of water",
name2_us = "U.S. gallons of water",
symbol = "US gal H<sub>2</sub>O",
utype = "mass",
scale = 3.7776215836051126,
default = "lb kg",
link = "United States customary units#Fluid volume",
},
["viss"] = {
name2 = "viss",
symbol = "viss",
utype = "mass",
scale = 1.632932532,
default = "kg",
link = "Myanmar units of measurement#Mass",
},
["billion tonne"] = {
target = "e9t",
},
["grain"] = {
target = "gr",
},
["kilogram"] = {
target = "kg",
},
["kilotonne"] = {
target = "kt",
},
["lbs"] = {
target = "lb",
},
["lbt"] = {
target = "troy pound",
},
["lcwt"] = {
target = "Lcwt",
},
["long ton"] = {
target = "LT",
},
["mcg"] = {
target = "μg",
},
["million tonne"] = {
target = "e6t",
},
["scwt"] = {
target = "Scwt",
},
["short ton"] = {
target = "ST",
},
["stone"] = {
target = "st",
},
["thousand tonne"] = {
target = "e3t",
},
["tonnes"] = {
target = "t",
},
["kg/kW"] = {
name1 = "kilogram per kilowatt",
name2 = "kilograms per kilowatt",
symbol = "kg/kW",
utype = "mass per unit power",
scale = 0.001,
default = "lb/hp",
link = "Kilowatt",
},
["lb/hp"] = {
name1 = "pound per horsepower",
name2 = "pounds per horsepower",
symbol = "lb/hp",
utype = "mass per unit power",
scale = 0.00060827738784176115,
default = "kg/kW",
link = "Horsepower",
},
["kg/h"] = {
per = { "kg", "h" },
utype = "mass per unit time",
default = "lb/h",
},
["lb/h"] = {
per = { "lb", "h" },
utype = "mass per unit time",
default = "kg/h",
},
["g-mol/d"] = {
name1 = "gram-mole per day",
name2 = "gram-moles per day",
symbol = "g‑mol/d",
utype = "molar rate",
scale = 1.1574074074074073e-5,
default = "μmol/s",
link = "Mole (unit)",
},
["g-mol/h"] = {
name1 = "gram-mole per hour",
name2 = "gram-moles per hour",
symbol = "g‑mol/h",
utype = "molar rate",
scale = 0.00027777777777777778,
default = "mmol/s",
link = "Mole (unit)",
},
["g-mol/min"] = {
name1 = "gram-mole per minute",
name2 = "gram-moles per minute",
symbol = "g‑mol/min",
utype = "molar rate",
scale = 0.016666666666666666,
default = "g-mol/s",
link = "Mole (unit)",
},
["g-mol/s"] = {
name1 = "gram-mole per second",
name2 = "gram-moles per second",
symbol = "g‑mol/s",
utype = "molar rate",
scale = 1,
default = "lb-mol/min",
link = "Mole (unit)",
},
["gmol/d"] = {
name1 = "gram-mole per day",
name2 = "gram-moles per day",
symbol = "gmol/d",
utype = "molar rate",
scale = 1.1574074074074073e-5,
default = "μmol/s",
link = "Mole (unit)",
},
["gmol/h"] = {
name1 = "gram-mole per hour",
name2 = "gram-moles per hour",
symbol = "gmol/h",
utype = "molar rate",
scale = 0.00027777777777777778,
default = "mmol/s",
link = "Mole (unit)",
},
["gmol/min"] = {
name1 = "gram-mole per minute",
name2 = "gram-moles per minute",
symbol = "gmol/min",
utype = "molar rate",
scale = 0.016666666666666666,
default = "gmol/s",
link = "Mole (unit)",
},
["gmol/s"] = {
name1 = "gram-mole per second",
name2 = "gram-moles per second",
symbol = "gmol/s",
utype = "molar rate",
scale = 1,
default = "lbmol/min",
link = "Mole (unit)",
},
["kmol/d"] = {
name1 = "kilomole per day",
name2 = "kilomoles per day",
symbol = "kmol/d",
utype = "molar rate",
scale = 0.011574074074074073,
default = "mmol/s",
link = "Mole (unit)",
},
["kmol/h"] = {
name1 = "kilomole per hour",
name2 = "kilomoles per hour",
symbol = "kmol/h",
utype = "molar rate",
scale = 0.27777777777777779,
default = "mol/s",
link = "Mole (unit)",
},
["kmol/min"] = {
name1 = "kilomole per minute",
name2 = "kilomoles per minute",
symbol = "kmol/min",
utype = "molar rate",
scale = 16.666666666666668,
default = "mol/s",
link = "Kilomole (unit)",
},
["kmol/s"] = {
name1 = "kilomole per second",
name2 = "kilomoles per second",
symbol = "kmol/s",
utype = "molar rate",
scale = 1000,
default = "lb-mol/s",
link = "Mole (unit)",
},
["lb-mol/d"] = {
name1 = "pound-mole per day",
name2 = "pound-moles per day",
symbol = "lb‑mol/d",
utype = "molar rate",
scale = 0.0052499116898148141,
default = "mmol/s",
link = "Pound-mole",
},
["lb-mol/h"] = {
name1 = "pound-mole per hour",
name2 = "pound-moles per hour",
symbol = "lb‑mol/h",
utype = "molar rate",
scale = 0.12599788055555555,
default = "mol/s",
link = "Pound-mole",
},
["lb-mol/min"] = {
name1 = "pound-mole per minute",
name2 = "pound-moles per minute",
symbol = "lb‑mol/min",
utype = "molar rate",
scale = 7.5598728333333334,
default = "mol/s",
link = "Pound-mole",
},
["lb-mol/s"] = {
name1 = "pound-mole per second",
name2 = "pound-moles per second",
symbol = "lb‑mol/s",
utype = "molar rate",
scale = 453.59237,
default = "kmol/s",
link = "Pound-mole",
},
["lbmol/d"] = {
name1 = "pound-mole per day",
name2 = "pound-moles per day",
symbol = "lbmol/d",
utype = "molar rate",
scale = 0.0052499116898148141,
default = "mmol/s",
link = "Pound-mole",
},
["lbmol/h"] = {
name1 = "pound-mole per hour",
name2 = "pound-moles per hour",
symbol = "lbmol/h",
utype = "molar rate",
scale = 0.12599788055555555,
default = "mol/s",
link = "Pound-mole",
},
["lbmol/min"] = {
name1 = "pound-mole per minute",
name2 = "pound-moles per minute",
symbol = "lbmol/min",
utype = "molar rate",
scale = 7.5598728333333334,
default = "mol/s",
link = "Pound-mole",
},
["lbmol/s"] = {
name1 = "pound-mole per second",
name2 = "pound-moles per second",
symbol = "lbmol/s",
utype = "molar rate",
scale = 453.59237,
default = "kmol/s",
link = "Pound-mole",
},
["mmol/s"] = {
name1 = "millimole per second",
name2 = "millimoles per second",
symbol = "mmol/s",
utype = "molar rate",
scale = 0.001,
default = "lb-mol/d",
link = "Mole (unit)",
},
["mol/d"] = {
name1 = "mole per day",
name2 = "moles per day",
symbol = "mol/d",
utype = "molar rate",
scale = 1.1574074074074073e-5,
default = "μmol/s",
link = "Mole (unit)",
},
["mol/h"] = {
name1 = "mole per hour",
name2 = "moles per hour",
symbol = "mol/h",
utype = "molar rate",
scale = 0.00027777777777777778,
default = "mmol/s",
link = "Mole (unit)",
},
["mol/min"] = {
name1 = "mole per minute",
name2 = "moles per minute",
symbol = "mol/min",
utype = "molar rate",
scale = 0.016666666666666666,
default = "mol/s",
link = "Mole (unit)",
},
["mol/s"] = {
name1 = "mole per second",
name2 = "moles per second",
symbol = "mol/s",
utype = "molar rate",
scale = 1,
default = "lb-mol/min",
link = "Mole (unit)",
},
["μmol/s"] = {
name1 = "micromole per second",
name2 = "micromoles per second",
symbol = "μmol/s",
utype = "molar rate",
scale = 0.000001,
default = "lb-mol/d",
link = "Mole (unit)",
},
["umol/s"] = {
target = "μmol/s",
},
["/acre"] = {
name1 = "per acre",
name2 = "per acre",
symbol = "/acre",
utype = "per unit area",
scale = 0.00024710538146716532,
default = "/ha",
link = "Acre",
},
["/ha"] = {
name1 = "per hectare",
name2 = "per hectare",
symbol = "/ha",
utype = "per unit area",
scale = 100e-6,
default = "/acre",
link = "Hectare",
},
["/sqcm"] = {
name1 = "per square centimetre",
name1_us = "per square centimeter",
name2 = "per square centimetre",
name2_us = "per square centimeter",
symbol = "/cm<sup>2</sup>",
utype = "per unit area",
scale = 1e4,
default = "/sqin",
link = "Square centimetre",
},
["/sqin"] = {
name1 = "per square inch",
name2 = "per square inch",
symbol = "/in<sup>2</sup>",
utype = "per unit area",
scale = 1550.0031000062002,
default = "/sqcm",
link = "Square inch",
},
["/sqkm"] = {
name1 = "per square kilometre",
name1_us = "per square kilometer",
name2 = "per square kilometre",
name2_us = "per square kilometer",
symbol = "/km<sup>2</sup>",
utype = "per unit area",
scale = 1e-6,
default = "/sqmi",
link = "Square kilometre",
},
["/sqmi"] = {
name1 = "per square mile",
name2 = "per square mile",
symbol = "/sq mi",
utype = "per unit area",
scale = 3.8610215854244582e-7,
default = "/sqkm",
link = "Square mile",
},
["PD/acre"] = {
name1 = "inhabitant per acre",
name2 = "inhabitants per acre",
symbol = "/acre",
utype = "per unit area",
scale = 0.00024710538146716532,
default = "PD/ha",
link = "Acre",
},
["PD/ha"] = {
name1 = "inhabitant per hectare",
name2 = "inhabitants per hectare",
symbol = "/ha",
utype = "per unit area",
scale = 100e-6,
default = "PD/acre",
link = "Hectare",
},
["PD/sqkm"] = {
name1 = "inhabitant per square kilometre",
name1_us = "inhabitant per square kilometer",
name2 = "inhabitants per square kilometre",
name2_us = "inhabitants per square kilometer",
symbol = "/km<sup>2</sup>",
utype = "per unit area",
scale = 1e-6,
default = "PD/sqmi",
link = "Square kilometre",
},
["PD/sqmi"] = {
name1 = "inhabitant per square mile",
name2 = "inhabitants per square mile",
symbol = "/sq mi",
utype = "per unit area",
scale = 3.8610215854244582e-7,
default = "PD/sqkm",
link = "Square mile",
},
["/cm2"] = {
target = "/sqcm",
},
["/in2"] = {
target = "/sqin",
},
["/km2"] = {
target = "/sqkm",
},
["pd/acre"] = {
target = "PD/acre",
},
["pd/ha"] = {
target = "PD/ha",
},
["PD/km2"] = {
target = "PD/sqkm",
},
["pd/km2"] = {
target = "PD/sqkm",
},
["PD/km²"] = {
target = "PD/sqkm",
},
["pd/sqkm"] = {
target = "PD/sqkm",
},
["pd/sqmi"] = {
target = "PD/sqmi",
},
["/l"] = {
name1 = "per litre",
name1_us = "per liter",
name2 = "per litre",
name2_us = "per liter",
symbol = "/l",
utype = "per unit volume",
scale = 1000,
default = "/usgal",
link = "Litre",
},
["/L"] = {
name1 = "per litre",
name1_us = "per liter",
name2 = "per litre",
name2_us = "per liter",
symbol = "/L",
utype = "per unit volume",
scale = 1000,
default = "/usgal",
link = "Litre",
},
["/USgal"] = {
name1 = "per gallon",
name2 = "per gallon",
symbol = "/gal",
utype = "per unit volume",
scale = 264.172052,
default = "/L",
link = "US gallon",
customary= 2,
},
["/usgal"] = {
target = "/USgal",
},
["bhp"] = {
name1 = "brake horsepower",
name2 = "brake horsepower",
symbol = "bhp",
utype = "power",
scale = 745.69987158227022,
default = "kW",
link = "Horsepower#Brake horsepower",
},
["Cal/d"] = {
name1 = "large calorie per day",
name2 = "large calories per day",
symbol = "Cal/d",
utype = "power",
scale = 0.048425925925925928,
default = "kJ/d",
link = "Calorie",
},
["Cal/h"] = {
name1 = "large calorie per hour",
name2 = "large calories per hour",
symbol = "Cal/h",
utype = "power",
scale = 1.1622222222222223,
default = "kJ/h",
link = "Calorie",
},
["cal/h"] = {
name1 = "calorie per hour",
name2 = "calories per hour",
symbol = "cal/h",
utype = "power",
scale = 0.0011622222222222223,
default = "W",
link = "Calorie",
},
["CV"] = {
name1 = "metric horsepower",
name2 = "metric horsepower",
symbol = "CV",
utype = "power",
scale = 735.49875,
default = "kW",
},
["hk"] = {
name1 = "metric horsepower",
name2 = "metric horsepower",
symbol = "hk",
utype = "power",
scale = 735.49875,
default = "kW",
},
["hp"] = {
name1 = "horsepower",
name2 = "horsepower",
symbol = "hp",
utype = "power",
scale = 745.69987158227022,
default = "kW",
},
["hp-electric"] = {
name1 = "electric horsepower",
name2 = "electric horsepower",
symbol = "hp",
utype = "power",
scale = 746,
default = "kW",
link = "Horsepower#Electrical horsepower",
},
["hp-electrical"] = {
name1 = "electrical horsepower",
name2 = "electrical horsepower",
symbol = "hp",
utype = "power",
scale = 746,
default = "kW",
link = "Horsepower#Electrical horsepower",
},
["hp-metric"] = {
name1 = "metric horsepower",
name2 = "metric horsepower",
symbol = "hp",
utype = "power",
scale = 735.49875,
default = "kW",
},
["ihp"] = {
name1 = "indicated horsepower",
name2 = "indicated horsepower",
symbol = "ihp",
utype = "power",
scale = 745.69987158227022,
default = "kW",
link = "Horsepower#Indicated horsepower",
},
["kcal/h"] = {
name1 = "kilocalorie per hour",
name2 = "kilocalories per hour",
symbol = "kcal/h",
utype = "power",
scale = 1.1622222222222223,
default = "kW",
link = "Calorie",
},
["kJ/d"] = {
name1 = "kilojoule per day",
name2 = "kilojoules per day",
symbol = "kJ/d",
utype = "power",
scale = 0.011574074074074073,
default = "Cal/d",
link = "Kilojoule",
},
["kJ/h"] = {
name1 = "kilojoule per hour",
name2 = "kilojoules per hour",
symbol = "kJ/h",
utype = "power",
scale = 0.27777777777777779,
default = "W",
link = "Kilojoule",
},
["PS"] = {
name1 = "metric horsepower",
name2 = "metric horsepower",
symbol = "PS",
utype = "power",
scale = 735.49875,
default = "kW",
},
["shp"] = {
name1 = "shaft horsepower",
name2 = "shaft horsepower",
symbol = "shp",
utype = "power",
scale = 745.69987158227022,
default = "kW",
link = "Horsepower#Shaft horsepower",
},
["W"] = {
_name1 = "watt",
_symbol = "W",
utype = "power",
scale = 1,
prefixes = 1,
default = "hp",
link = "Watt",
},
["BTU/h"] = {
per = { "BTU", "h" },
utype = "power",
default = "W",
},
["Btu/h"] = {
per = { "Btu", "h" },
utype = "power",
default = "W",
},
["BHP"] = {
target = "bhp",
},
["btu/h"] = {
target = "BTU/h",
},
["HP"] = {
target = "hp",
},
["Hp"] = {
target = "hp",
},
["hp-mechanical"] = {
target = "hp",
},
["IHP"] = {
target = "ihp",
},
["SHP"] = {
target = "shp",
},
["whp"] = {
target = "hp",
},
["hp/lb"] = {
name1 = "horsepower per pound",
name2 = "horsepower per pound",
symbol = "hp/lb",
utype = "power per unit mass",
scale = 1643.986806,
default = "kW/kg",
link = "Power-to-weight ratio",
},
["hp/LT"] = {
name1 = "horsepower per long ton",
name2 = "horsepower per long ton",
symbol = "hp/LT",
utype = "power per unit mass",
scale = 0.73392268125000004,
default = "kW/t",
link = "Power-to-weight ratio",
},
["hp/ST"] = {
name1 = "horsepower per short ton",
name2 = "horsepower per short ton",
symbol = "hp/ST",
utype = "power per unit mass",
scale = 0.821993403,
default = "kW/t",
link = "Power-to-weight ratio",
},
["hp/t"] = {
name1 = "horsepower per tonne",
name2 = "horsepower per tonne",
symbol = "hp/t",
utype = "power per unit mass",
scale = 0.74569987158227022,
default = "kW/t",
link = "Power-to-weight ratio",
},
["kW/kg"] = {
name1 = "kilowatt per kilogram",
name2 = "kilowatts per kilogram",
symbol = "kW/kg",
utype = "power per unit mass",
scale = 1000,
default = "hp/lb",
link = "Power-to-weight ratio",
},
["kW/t"] = {
name1 = "kilowatt per tonne",
name2 = "kilowatts per tonne",
symbol = "kW/t",
utype = "power per unit mass",
scale = 1,
default = "PS/t",
link = "Power-to-weight ratio",
},
["PS/t"] = {
name1 = "metric horsepower per tonne",
name2 = "metric horsepower per tonne",
symbol = "PS/t",
utype = "power per unit mass",
scale = 0.73549875,
default = "kW/t",
link = "Power-to-weight ratio",
},
["shp/lb"] = {
name1 = "shaft horsepower per pound",
name2 = "shaft horsepower per pound",
symbol = "shp/lb",
utype = "power per unit mass",
scale = 1643.986806,
default = "kW/kg",
link = "Power-to-weight ratio",
},
["hp/tonne"] = {
target = "hp/t",
symbol = "hp/tonne",
default = "kW/tonne",
},
["kW/tonne"] = {
target = "kW/t",
symbol = "kW/tonne",
},
["-lb/in2"] = {
name1 = "pound per square inch",
name2 = "pounds per square inch",
symbol = "lb/in<sup>2</sup>",
utype = "pressure",
scale = 6894.7572931683608,
default = "kPa kgf/cm2",
},
["atm"] = {
name1 = "standard atmosphere",
symbol = "atm",
utype = "pressure",
scale = 101325,
default = "kPa",
link = "Atmosphere (unit)",
},
["Ba"] = {
name1 = "barye",
symbol = "Ba",
utype = "pressure",
scale = 0.1,
default = "Pa",
},
["bar"] = {
symbol = "bar",
utype = "pressure",
scale = 100000,
default = "kPa",
link = "Bar (unit)",
},
["dbar"] = {
name1 = "decibar",
symbol = "dbar",
utype = "pressure",
scale = 10000,
default = "kPa",
link = "Bar (unit)",
},
["inHg"] = {
name1 = "inch of mercury",
name2 = "inches of mercury",
symbol = "inHg",
utype = "pressure",
scale = 3386.388640341,
default = "kPa",
},
["kBa"] = {
name1 = "kilobarye",
symbol = "kBa",
utype = "pressure",
scale = 100,
default = "hPa",
link = "Barye",
},
["kg-f/cm2"] = {
name1 = "kilogram-force per square centimetre",
name1_us = "kilogram-force per square centimeter",
name2 = "kilograms-force per square centimetre",
name2_us = "kilograms-force per square centimeter",
symbol = "kg<sub>f</sub>/cm<sup>2</sup>",
utype = "pressure",
scale = 98066.5,
default = "psi",
link = "Kilogram-force",
},
["kg/cm2"] = {
name1 = "kilogram per square centimetre",
name1_us = "kilogram per square centimeter",
name2 = "kilograms per square centimetre",
name2_us = "kilograms per square centimeter",
symbol = "kg/cm<sup>2</sup>",
utype = "pressure",
scale = 98066.5,
default = "psi",
link = "Kilogram-force",
},
["kgf/cm2"] = {
name1 = "kilogram-force per square centimetre",
name1_us = "kilogram-force per square centimeter",
name2 = "kilograms-force per square centimetre",
name2_us = "kilograms-force per square centimeter",
symbol = "kgf/cm<sup>2</sup>",
utype = "pressure",
scale = 98066.5,
default = "psi",
link = "Kilogram-force",
},
["ksi"] = {
name1 = "kilopound per square inch",
name2 = "kilopounds per square inch",
symbol = "ksi",
utype = "pressure",
scale = 6894757.2931683613,
default = "MPa",
link = "Pound per square inch",
},
["lbf/in2"] = {
name1 = "pound-force per square inch",
name2 = "pounds-force per square inch",
symbol = "lbf/in<sup>2</sup>",
utype = "pressure",
scale = 6894.7572931683608,
default = "kPa kgf/cm2",
},
["mb"] = {
name1 = "millibar",
symbol = "mb",
utype = "pressure",
scale = 100,
default = "hPa",
link = "Bar (unit)",
},
["mbar"] = {
name1 = "millibar",
symbol = "mbar",
utype = "pressure",
scale = 100,
default = "hPa",
link = "Bar (unit)",
},
["mmHg"] = {
name1 = "millimetre of mercury",
name1_us = "millimeter of mercury",
name2 = "millimetres of mercury",
name2_us = "millimeters of mercury",
symbol = "mmHg",
utype = "pressure",
scale = 133.322387415,
default = "kPa",
},
["Pa"] = {
_name1 = "pascal",
_symbol = "Pa",
utype = "pressure",
scale = 1,
prefixes = 1,
default = "psi",
link = "Pascal (unit)",
},
["psf"] = {
name1 = "pound per square foot",
name2 = "pounds per square foot",
symbol = "psf",
utype = "pressure",
scale = 47.880258980335839,
default = "kPa",
link = "Pound per square inch",
},
["psi"] = {
name1 = "pound per square inch",
name2 = "pounds per square inch",
symbol = "psi",
utype = "pressure",
scale = 6894.7572931683608,
default = "kPa",
},
["Torr"] = {
name1 = "torr",
symbol = "Torr",
utype = "pressure",
scale = 133.32236842105263,
default = "kPa",
},
["N/cm2"] = {
per = { "N", "cm2" },
utype = "pressure",
default = "psi",
},
["N/m2"] = {
per = { "N", "m2" },
utype = "pressure",
default = "psi",
},
["g/cm2"] = {
per = { "g", "cm2" },
utype = "pressure",
default = "lb/sqft",
multiplier= 9.80665,
},
["g/m2"] = {
per = { "g", "m2" },
utype = "pressure",
default = "lb/sqft",
multiplier= 9.80665,
},
["kg/ha"] = {
per = { "kg", "ha" },
utype = "pressure",
default = "lb/acre",
multiplier= 9.80665,
},
["kg/m2"] = {
per = { "kg", "m2" },
utype = "pressure",
default = "lb/sqft",
multiplier= 9.80665,
},
["lb/1000sqft"] = {
per = { "lb", "1000sqft" },
utype = "pressure",
default = "g/m2",
multiplier= 9.80665,
},
["lb/acre"] = {
per = { "lb", "acre" },
utype = "pressure",
default = "kg/ha",
multiplier= 9.80665,
},
["lb/sqft"] = {
per = { "lb", "sqft" },
utype = "pressure",
default = "kg/m2",
multiplier= 9.80665,
},
["lb/sqyd"] = {
per = { "lb", "sqyd" },
utype = "pressure",
default = "kg/m2",
multiplier= 9.80665,
},
["LT/acre"] = {
per = { "LT", "acre" },
utype = "pressure",
default = "t/ha",
multiplier= 9.80665,
},
["MT/ha"] = {
per = { "MT", "ha" },
utype = "pressure",
default = "LT/acre ST/acre",
multiplier= 9.80665,
},
["oz/sqft"] = {
per = { "oz", "sqft" },
utype = "pressure",
default = "g/m2",
multiplier= 9.80665,
},
["oz/sqyd"] = {
per = { "oz", "sqyd" },
utype = "pressure",
default = "g/m2",
multiplier= 9.80665,
},
["ST/acre"] = {
per = { "ST", "acre" },
utype = "pressure",
default = "t/ha",
multiplier= 9.80665,
},
["t/ha"] = {
per = { "t", "ha" },
utype = "pressure",
default = "LT/acre ST/acre",
multiplier= 9.80665,
},
["tonne/acre"] = {
per = { "tonne", "acre" },
utype = "pressure",
default = "tonne/ha",
multiplier= 9.80665,
},
["tonne/ha"] = {
per = { "tonne", "ha" },
utype = "pressure",
default = "tonne/acre",
multiplier= 9.80665,
},
["kgfpsqcm"] = {
target = "kgf/cm2",
},
["kgpsqcm"] = {
target = "kg/cm2",
},
["kN/m2"] = {
target = "kPa",
},
["lb/in2"] = {
target = "lbf/in2",
},
["torr"] = {
target = "Torr",
},
["Bq"] = {
_name1 = "becquerel",
_symbol = "Bq",
utype = "radioactivity",
scale = 1,
prefixes = 1,
default = "pCi",
link = "Becquerel",
},
["Ci"] = {
_name1 = "curie",
_symbol = "Ci",
utype = "radioactivity",
scale = 3.7e10,
prefixes = 1,
default = "GBq",
link = "Curie (unit)",
},
["Rd"] = {
_name1 = "rutherford",
_symbol = "Rd",
utype = "radioactivity",
scale = 1e6,
prefixes = 1,
default = "MBq",
link = "Rutherford (unit)",
},
["cm/h"] = {
name1 = "centimetre per hour",
name1_us = "centimeter per hour",
name2 = "centimetres per hour",
name2_us = "centimeters per hour",
symbol = "cm/h",
utype = "speed",
scale = 2.7777777777777775e-6,
default = "in/h",
link = "Metre per second",
},
["cm/s"] = {
name1 = "centimetre per second",
name1_us = "centimeter per second",
name2 = "centimetres per second",
name2_us = "centimeters per second",
symbol = "cm/s",
utype = "speed",
scale = 0.01,
default = "in/s",
link = "Metre per second",
},
["cm/year"] = {
name1 = "centimetre per year",
name1_us = "centimeter per year",
name2 = "centimetres per year",
name2_us = "centimeters per year",
symbol = "cm/year",
utype = "speed",
scale = 3.168873850681143e-10,
default = "in/year",
link = "Orders of magnitude (speed)",
},
["foot/s"] = {
name1 = "foot per second",
name2 = "foot per second",
symbol = "ft/s",
utype = "speed",
scale = 0.3048,
default = "m/s",
},
["ft/min"] = {
name1 = "foot per minute",
name2 = "feet per minute",
symbol = "ft/min",
utype = "speed",
scale = 0.00508,
default = "m/min",
link = "Feet per second",
},
["ft/s"] = {
name1 = "foot per second",
name2 = "feet per second",
symbol = "ft/s",
utype = "speed",
scale = 0.3048,
default = "m/s",
link = "Feet per second",
},
["furlong per fortnight"] = {
name2 = "furlongs per fortnight",
symbol = "furlong per fortnight",
usename = 1,
utype = "speed",
scale = 0.00016630952380952381,
default = "km/h mph",
link = "FFF system",
},
["in/h"] = {
name1 = "inch per hour",
name2 = "inches per hour",
symbol = "in/h",
utype = "speed",
scale = 7.0555555555555559e-6,
default = "cm/h",
link = "Inch",
},
["in/s"] = {
name1 = "inch per second",
name2 = "inches per second",
symbol = "in/s",
utype = "speed",
scale = 0.0254,
default = "cm/s",
link = "Inch",
},
["in/year"] = {
name1 = "inch per year",
name2 = "inches per year",
symbol = "in/year",
utype = "speed",
scale = 8.0489395807301024e-10,
default = "cm/year",
link = "Orders of magnitude (speed)",
},
["isp"] = {
name1 = "second",
symbol = "s",
utype = "speed",
scale = 9.80665,
default = "km/s",
link = "Specific impulse",
},
["km/d"] = {
name1 = "kilometre per day",
name1_us = "kilometer per day",
name2 = "kilometres per day",
name2_us = "kilometers per day",
symbol = "km/d",
utype = "speed",
scale = 1.1574074074074074e-2,
default = "mi/d",
link = "Orders of magnitude (speed)",
},
["km/h"] = {
name1 = "kilometre per hour",
name1_us = "kilometer per hour",
name2 = "kilometres per hour",
name2_us = "kilometers per hour",
symbol = "km/h",
utype = "speed",
scale = 0.27777777777777779,
default = "mph",
link = "Kilometres per hour",
},
["km/s"] = {
name1 = "kilometre per second",
name1_us = "kilometer per second",
name2 = "kilometres per second",
name2_us = "kilometers per second",
symbol = "km/s",
utype = "speed",
scale = 1000,
default = "mi/s",
link = "Metre per second",
},
["kn"] = {
name1 = "knot",
symbol = "kn",
utype = "speed",
scale = 0.51444444444444448,
default = "km/h mph",
link = "Knot (unit)",
},
["kNs/kg"] = {
name2 = "kN‑s/kg",
symbol = "kN‑s/kg",
utype = "speed",
scale = 1000,
default = "isp",
link = "Specific impulse",
},
["m/min"] = {
name1 = "metre per minute",
name1_us = "meter per minute",
name2 = "metres per minute",
name2_us = "meters per minute",
symbol = "m/min",
utype = "speed",
scale = 0.016666666666666666,
default = "ft/min",
link = "Metre per second",
},
["m/s"] = {
name1 = "metre per second",
name1_us = "meter per second",
name2 = "metres per second",
name2_us = "meters per second",
symbol = "m/s",
utype = "speed",
scale = 1,
default = "ft/s",
},
["Mach"] = {
name2 = "Mach",
symbol = "Mach",
utype = "speed",
builtin = "mach",
scale = 0,
iscomplex= true,
default = "km/h mph",
link = "Mach number",
},
["mi/d"] = {
name1 = "mile per day",
name2 = "miles per day",
symbol = "mi/d",
utype = "speed",
scale = 1.8626666666666667e-2,
default = "km/d",
link = "Orders of magnitude (speed)",
},
["mi/s"] = {
name1 = "mile per second",
name2 = "miles per second",
symbol = "mi/s",
utype = "speed",
scale = 1609.344,
default = "km/s",
link = "Mile",
},
["mm/h"] = {
name1 = "millimetre per hour",
name1_us = "millimeter per hour",
name2 = "millimetres per hour",
name2_us = "millimeters per hour",
symbol = "mm/h",
utype = "speed",
scale = 2.7777777777777781e-7,
default = "in/h",
link = "Metre per second",
},
["mph"] = {
name1 = "mile per hour",
name2 = "miles per hour",
symbol = "mph",
utype = "speed",
scale = 0.44704,
default = "km/h",
link = "Miles per hour",
},
["Ns/kg"] = {
name2 = "N‑s/kg",
symbol = "N‑s/kg",
utype = "speed",
scale = 1,
default = "isp",
link = "Specific impulse",
},
["si tsfc"] = {
name2 = "g/(kN⋅s)",
symbol = "g/(kN⋅s)",
utype = "speed",
scale = 9.9999628621379242e-7,
invert = -1,
iscomplex= true,
default = "tsfc",
link = "Thrust specific fuel consumption",
},
["tsfc"] = {
name2 = "lb/(lbf⋅h)",
symbol = "lb/(lbf⋅h)",
utype = "speed",
scale = 2.832545036049801e-5,
invert = -1,
iscomplex= true,
default = "si tsfc",
link = "Thrust specific fuel consumption",
},
["cm/y"] = {
target = "cm/year",
},
["cm/yr"] = {
target = "cm/year",
},
["in/y"] = {
target = "in/year",
},
["in/yr"] = {
target = "in/year",
},
["knot"] = {
target = "kn",
},
["knots"] = {
target = "kn",
},
["kph"] = {
target = "km/h",
},
["mi/h"] = {
target = "mph",
},
["mm/s"] = {
per = { "mm", "s" },
utype = "speed",
default = "in/s",
link = "Metre per second",
},
["C"] = {
name1 = "degree Celsius",
name2 = "degrees Celsius",
symbol = "°C",
usesymbol= 1,
utype = "temperature",
scale = 1,
offset = -273.15,
iscomplex= true,
istemperature= true,
default = "F",
link = "Celsius",
},
["F"] = {
name1 = "degree Fahrenheit",
name2 = "degrees Fahrenheit",
symbol = "°F",
usesymbol= 1,
utype = "temperature",
scale = 0.55555555555555558,
offset = 32-273.15*(9/5),
iscomplex= true,
istemperature= true,
default = "C",
link = "Fahrenheit",
},
["K"] = {
_name1 = "kelvin",
_symbol = "K",
usesymbol= 1,
utype = "temperature",
scale = 1,
offset = 0,
iscomplex= true,
istemperature= true,
prefixes = 1,
default = "C F",
link = "Kelvin",
},
["keVT"] = {
name1 = "kiloelectronvolt",
symbol = "keV",
utype = "temperature",
scale = 11604518.121550081,
offset = 0,
iscomplex= true,
default = "MK",
defkey = "keVT",
linkey = "keVT",
link = "Electronvolt",
},
["R"] = {
name1 = "degree Rankine",
name2 = "degrees Rankine",
symbol = "°R",
usesymbol= 1,
utype = "temperature",
scale = 0.55555555555555558,
offset = 0,
iscomplex= true,
istemperature= true,
default = "K F C",
link = "Rankine scale",
},
["Celsius"] = {
target = "C",
},
["°C"] = {
target = "C",
},
["°F"] = {
target = "F",
},
["°R"] = {
target = "R",
},
["C-change"] = {
name1 = "degree Celsius change",
name2 = "degrees Celsius change",
symbol = "°C",
usesymbol= 1,
utype = "temperature change",
scale = 1,
default = "F-change",
link = "Celsius",
},
["F-change"] = {
name1 = "degree Fahrenheit change",
name2 = "degrees Fahrenheit change",
symbol = "°F",
usesymbol= 1,
utype = "temperature change",
scale = 0.55555555555555558,
default = "C-change",
link = "Fahrenheit",
},
["K-change"] = {
name1 = "kelvin change",
name2 = "kelvins change",
symbol = "K",
usesymbol= 1,
utype = "temperature change",
scale = 1,
default = "F-change",
link = "Kelvin",
},
["°C-change"] = {
target = "C-change",
},
["°F-change"] = {
target = "F-change",
},
["century"] = {
name1 = "century",
name2 = "centuries",
symbol = "ha",
utype = "time",
scale = 3155760000,
default = "Gs",
},
["d"] = {
name1 = "day",
symbol = "d",
utype = "time",
scale = 86400,
default = "ks",
},
["decade"] = {
name1 = "decade",
symbol = "daa",
utype = "time",
scale = 315576000,
default = "Ms",
},
["dog year"] = {
name1 = "dog year",
symbol = "dog yr",
utype = "time",
scale = 220903200,
default = "years",
link = "List of unusual units of measurement#Dog year",
},
["fortnight"] = {
symbol = "fortnight",
usename = 1,
utype = "time",
scale = 1209600,
default = "week",
},
["h"] = {
name1 = "hour",
symbol = "h",
utype = "time",
scale = 3600,
default = "ks",
},
["long billion year"] = {
name1 = "billion years",
name2 = "billion years",
symbol = "Ta",
utype = "time",
scale = 31557600000000000000,
default = "Es",
link = "Annum",
},
["millennium"] = {
name1 = "millennium",
name2 = "millennia",
symbol = "ka",
utype = "time",
scale = 31557600000,
default = "Gs",
},
["milliard year"] = {
name1 = "milliard years",
name2 = "milliard years",
symbol = "Ga",
utype = "time",
scale = 31557600000000000,
default = "Ps",
link = "Annum",
},
["million year"] = {
name1 = "million years",
name2 = "million years",
symbol = "Ma",
utype = "time",
scale = 31557600000000,
default = "Ts",
link = "Annum",
},
["min"] = {
name1 = "minute",
symbol = "min",
utype = "time",
scale = 60,
default = "s",
},
["month"] = {
symbol = "month",
usename = 1,
utype = "time",
scale = 2629800,
default = "Ms",
},
["months"] = {
name1 = "month",
symbol = "mo",
utype = "time",
scale = 2629800,
default = "year",
},
["s"] = {
_name1 = "second",
_symbol = "s",
utype = "time",
scale = 1,
prefixes = 1,
default = "v < 7200 ! min ! h",
link = "Second",
},
["short billion year"] = {
name1 = "billion years",
name2 = "billion years",
symbol = "Ga",
utype = "time",
scale = 31557600000000000,
default = "Ps",
link = "Annum",
},
["short trillion year"] = {
name1 = "trillion years",
name2 = "trillion years",
symbol = "Ta",
utype = "time",
scale = 31557600000000000000,
default = "Es",
link = "Annum",
},
["thousand million year"] = {
name1 = "thousand million years",
name2 = "thousand million years",
symbol = "Ga",
utype = "time",
scale = 31557600000000000,
default = "Ps",
link = "Annum",
},
["wk"] = {
symbol = "week",
usename = 1,
utype = "time",
scale = 604800,
default = "Ms",
},
["year"] = {
name1 = "year",
symbol = "a",
utype = "time",
scale = 31557600,
default = "Ms",
link = "Annum",
},
["years"] = {
name1 = "year",
symbol = "yr",
utype = "time",
scale = 31557600,
default = "Ms",
link = "Annum",
},
["byr"] = {
target = "short billion year",
},
["day"] = {
target = "d",
},
["days"] = {
target = "d",
},
["dog yr"] = {
target = "dog year",
},
["Gyr"] = {
target = "thousand million year",
},
["hour"] = {
target = "h",
},
["hours"] = {
target = "h",
},
["kMyr"] = {
target = "thousand million year",
},
["kmyr"] = {
target = "thousand million year",
},
["kyr"] = {
target = "millennium",
},
["long byr"] = {
target = "long billion year",
},
["minute"] = {
target = "min",
},
["minutes"] = {
target = "min",
},
["mth"] = {
target = "month",
},
["Myr"] = {
target = "million year",
},
["myr"] = {
target = "million year",
},
["sec"] = {
target = "s",
},
["second"] = {
target = "s",
},
["seconds"] = {
target = "s",
},
["tmyr"] = {
target = "thousand million year",
},
["tryr"] = {
target = "short trillion year",
},
["tyr"] = {
target = "millennium",
},
["week"] = {
target = "wk",
},
["weeks"] = {
target = "wk",
},
["yr"] = {
target = "year",
},
["kg.m"] = {
name1 = "kilogram metre",
name1_us = "kilogram meter",
symbol = "kg⋅m",
utype = "torque",
scale = 9.80665,
default = "Nm lbft",
link = "Kilogram metre (torque)",
},
["kgf.m"] = {
name1 = "kilogram force-metre",
name1_us = "kilogram force-meter",
symbol = "kgf⋅m",
utype = "torque",
scale = 9.80665,
default = "Nm lbfft",
link = "Kilogram metre (torque)",
},
["kgm"] = {
name1 = "kilogram metre",
name1_us = "kilogram meter",
symbol = "kg⋅m",
utype = "torque",
scale = 9.80665,
default = "Nm lbfft",
link = "Kilogram metre (torque)",
},
["kpm"] = {
name1 = "kilopond metre",
name1_us = "kilopond meter",
symbol = "kp⋅m",
utype = "torque",
scale = 9.80665,
default = "Nm lbft",
link = "Kilogram metre (torque)",
},
["lb-fft"] = {
name1 = "pound force-foot",
name2 = "pound force-feet",
symbol = "ft⋅lb<sub>f</sub>",
utype = "torque",
scale = 1.3558179483314004,
default = "Nm",
link = "Pound-foot (torque)",
},
["lb.ft"] = {
name1 = "pound force-foot",
name2 = "pound force-feet",
symbol = "lb⋅ft",
utype = "torque",
scale = 1.3558179483314004,
default = "Nm",
link = "Pound-foot (torque)",
},
["lb.in"] = {
name1 = "pound force-inch",
symbol = "lb⋅in",
utype = "torque",
scale = 0.1129848290276167,
default = "mN.m",
link = "Pound-foot (torque)",
},
["lbfft"] = {
name1 = "pound force-foot",
name2 = "pound force-feet",
symbol = "lbf⋅ft",
utype = "torque",
scale = 1.3558179483314004,
default = "Nm",
link = "Pound-foot (torque)",
},
["lbft"] = {
name1 = "pound-foot",
name2 = "pound-feet",
symbol = "lb⋅ft",
utype = "torque",
scale = 1.3558179483314004,
default = "Nm",
link = "Pound-foot (torque)",
},
["m.kg-f"] = {
name1 = "metre kilogram-force",
name1_us = "meter kilogram-force",
name2 = "metre kilograms-force",
name2_us = "meter kilograms-force",
symbol = "m⋅kg<sub>f</sub>",
utype = "torque",
scale = 9.80665,
default = "Nm lbfft",
link = "Kilogram metre (torque)",
},
["m.kgf"] = {
name1 = "metre kilogram-force",
name1_us = "meter kilogram-force",
name2 = "metre kilograms-force",
name2_us = "meter kilograms-force",
symbol = "m⋅kgf",
utype = "torque",
scale = 9.80665,
default = "Nm lbfft",
link = "Kilogram metre (torque)",
},
["mN.m"] = {
name1 = "millinewton-metre",
name1_us = "millinewton-meter",
symbol = "mN⋅m",
utype = "torque",
scale = 0.001,
default = "lb.in",
link = "Newton-metre",
},
["Nm"] = {
_name1 = "newton-metre",
_name1_us= "newton-meter",
_symbol = "N⋅m",
utype = "torque",
alttype = "energy",
scale = 1,
prefixes = 1,
default = "lbfft",
link = "Newton-metre",
},
["kN/m"] = {
per = { "kN", "-m-stiff" },
utype = "torque",
default = "lbf/in",
},
["lbf/in"] = {
per = { "lbf", "-in-stiff" },
utype = "torque",
default = "kN/m",
},
["lb-f.ft"] = {
target = "lb-fft",
},
["lbf.ft"] = {
target = "lbfft",
},
["lbf·ft"] = {
target = "lbfft",
},
["lb·ft"] = {
target = "lb.ft",
},
["mkg-f"] = {
target = "m.kg-f",
},
["mkgf"] = {
target = "m.kgf",
},
["N.m"] = {
target = "Nm",
},
["N·m"] = {
target = "Nm",
},
["ton-mile"] = {
symbol = "ton-mile",
usename = 1,
utype = "transportation",
scale = 1.4599723182105602,
default = "tkm",
},
["tkm"] = {
name1 = "tonne-kilometre",
name1_us = "tonne-kilometer",
symbol = "tkm",
utype = "transportation",
scale = 1,
default = "ton-mile",
},
["-12USoz(mL)serve"] = {
name1_us = "12 U.S. fl oz (355 mL) serving",
symbol = "12 US fl oz (355 mL) serving",
sym_us = "12 U.S. fl oz (355 mL) serving",
utype = "volume",
scale = 0.00035488235475000004,
default = "mL",
link = "Beverage can#Standard sizes",
},
["-12USoz(ml)serve"] = {
name1_us = "12 U.S. fl oz (355 ml) serving",
symbol = "12 US fl oz (355 ml) serving",
sym_us = "12 U.S. fl oz (355 ml) serving",
utype = "volume",
scale = 0.00035488235475000004,
default = "ml",
link = "Beverage can#Standard sizes",
},
["-12USozserve"] = {
name1_us = "12 U.S. fl oz serving",
symbol = "12 US fl oz serving",
sym_us = "12 U.S. fl oz serving",
utype = "volume",
scale = 0.00035488235475000004,
default = "mL",
link = "Beverage can#Standard sizes",
},
["acre-foot"] = {
name1 = "acre-foot",
name2 = "acre-foot",
symbol = "acre⋅ft",
utype = "volume",
scale = 1233.48183754752,
default = "m3",
},
["acre-ft"] = {
name1 = "acre-foot",
name2 = "acre-feet",
symbol = "acre⋅ft",
utype = "volume",
scale = 1233.48183754752,
default = "m3",
},
["AUtbsp"] = {
name1 = "Australian tablespoon",
symbol = "AU tbsp",
utype = "volume",
scale = 0.000020,
default = "ml",
},
["Bcuft"] = {
name1 = "billion cubic foot",
name2 = "billion cubic feet",
symbol = "billion cu ft",
utype = "volume",
scale = 28316846.592,
default = "Gl",
link = "Cubic foot",
},
["bdft"] = {
name1 = "board foot",
name2 = "board feet",
symbol = "bd ft",
utype = "volume",
scale = 0.0023597372167,
default = "m3",
},
["board feet"] = {
name2 = "board feet",
symbol = "board foot",
usename = 1,
utype = "volume",
scale = 0.0023597372167,
default = "m3",
},
["board foot"] = {
name2 = "board foot",
symbol = "board foot",
usename = 1,
utype = "volume",
scale = 0.0023597372167,
default = "m3",
},
["cc"] = {
name1 = "cubic centimetre",
name1_us = "cubic centimeter",
symbol = "cc",
utype = "volume",
scale = 0.000001,
default = "cuin",
},
["CID"] = {
name1 = "cubic inch",
name2 = "cubic inches",
symbol = "cu in",
utype = "volume",
scale = 0.000016387064,
default = "cc",
link = "Cubic inch#Engine displacement",
},
["cord"] = {
symbol = "cord",
utype = "volume",
scale = 3.624556363776,
default = "m3",
link = "Cord (unit)",
},
["cufoot"] = {
name1 = "cubic foot",
name2 = "cubic foot",
symbol = "cu ft",
utype = "volume",
scale = 0.028316846592,
default = "m3",
},
["cuft"] = {
name1 = "cubic foot",
name2 = "cubic feet",
symbol = "cu ft",
utype = "volume",
scale = 0.028316846592,
default = "m3",
},
["cuin"] = {
name1 = "cubic inch",
name2 = "cubic inches",
symbol = "cu in",
utype = "volume",
scale = 0.000016387064,
default = "cm3",
},
["cumi"] = {
name1 = "cubic mile",
symbol = "cu mi",
utype = "volume",
scale = 4168181825.440579584,
default = "km3",
},
["cuyd"] = {
name1 = "cubic yard",
symbol = "cu yd",
utype = "volume",
scale = 0.764554857984,
default = "m3",
},
["firkin"] = {
symbol = "firkin",
usename = 1,
utype = "volume",
scale = 0.04091481,
default = "L impgal USgal",
link = "Firkin (unit)",
},
["foot3"] = {
target = "cufoot",
},
["Goilbbl"] = {
name1 = "billion barrels",
name2 = "billion barrels",
symbol = "Gbbl",
utype = "volume",
scale = 158987294.928,
default = "v * 1.58987294928 < 10 ! e6 ! e9 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["gr water"] = {
name1 = "grains water",
name2 = "grains water",
symbol = "gr H<sub>2</sub>O",
utype = "volume",
scale = 0.00000006479891,
default = "cm3",
link = "Grain (unit)",
},
["grt"] = {
name1 = "gross register ton",
symbol = "grt",
utype = "volume",
scale = 2.8316846592,
default = "m3",
link = "Gross register tonnage",
},
["impbbl"] = {
name1 = "imperial barrel",
symbol = "imp bbl",
utype = "volume",
scale = 0.16365924,
default = "L impgal USgal",
link = "Barrel (unit)",
},
["impbsh"] = {
name1 = "imperial bushel",
symbol = "imp bsh",
utype = "volume",
scale = 0.03636872,
default = "L impgal USdrygal",
},
["impbu"] = {
name1 = "imperial bushel",
symbol = "imp bu",
utype = "volume",
scale = 0.03636872,
default = "m3",
},
["impgal"] = {
name1 = "imperial gallon",
symbol = "imp gal",
utype = "volume",
scale = 0.00454609,
default = "L USgal",
},
["impgi"] = {
name1 = "gill",
symbol = "gi",
utype = "volume",
scale = 0.0001420653125,
default = "ml USoz",
link = "Gill (unit)",
},
["impkenning"] = {
name1 = "imperial kenning",
symbol = "kenning",
utype = "volume",
scale = 0.01818436,
default = "L USdrygal",
link = "Kenning (unit)",
},
["impoz"] = {
name1 = "imperial fluid ounce",
symbol = "imp fl oz",
utype = "volume",
scale = 0.0000284130625,
default = "ml USoz",
},
["imppk"] = {
name1 = "imperial peck",
symbol = "pk",
utype = "volume",
scale = 0.00909218,
default = "L USdrygal",
link = "Peck",
},
["imppt"] = {
name1 = "imperial pint",
symbol = "imp pt",
utype = "volume",
scale = 0.00056826125,
default = "L",
},
["impqt"] = {
name1 = "imperial quart",
symbol = "imp qt",
utype = "volume",
scale = 0.0011365225,
default = "ml USoz",
customary= 3,
},
["kilderkin"] = {
symbol = "kilderkin",
usename = 1,
utype = "volume",
scale = 0.08182962,
default = "L impgal USgal",
},
["koilbbl"] = {
name1 = "thousand barrels",
name2 = "thousand barrels",
symbol = "kbbl",
utype = "volume",
scale = 158.987294928,
default = "v * 1.58987294928 < 10 ! ! e3 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["L"] = {
_name1 = "litre",
_name1_us= "liter",
_symbol = "L",
utype = "volume",
scale = 0.001,
prefixes = 1,
default = "impgal USgal",
link = "Litre",
},
["l"] = {
_name1 = "litre",
_name1_us= "liter",
_symbol = "l",
utype = "volume",
scale = 0.001,
prefixes = 1,
default = "impgal USgal",
link = "Litre",
},
["ll"] = {
name1 = "litre",
name1_us = "liter",
symbol = "l",
utype = "volume",
scale = 0.001,
default = "impgal USgal",
},
["m3"] = {
_name1 = "cubic metre",
_name1_us= "cubic meter",
_symbol = "m<sup>3</sup>",
prefix_position= 7,
utype = "volume",
scale = 1,
prefixes = 3,
default = "cuft",
link = "Cubic metre",
},
["Mbbl"] = {
name1 = "thousand barrels",
name2 = "thousand barrels",
symbol = "Mbbl",
utype = "volume",
scale = 158.987294928,
default = "v * 1.58987294928 < 10 ! e3 ! ! m3",
link = "Barrel (unit)#Oil barrel",
},
["MMoilbbl"] = {
name1 = "million barrels",
name2 = "million barrels",
symbol = "MMbbl",
utype = "volume",
scale = 158987.294928,
default = "v * 1.58987294928 < 10 ! e3 ! e6 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["Moilbbl"] = {
name1 = "million barrels",
name2 = "million barrels",
symbol = "Mbbl",
utype = "volume",
scale = 158987.294928,
default = "v * 1.58987294928 < 10 ! e3 ! e6 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["MTON"] = {
name1 = "measurement ton",
symbol = "MTON",
utype = "volume",
scale = 1.13267386368,
default = "m3",
},
["MUSgal"] = {
name1 = "million US gallons",
name1_us = "million U.S. gallons",
name2 = "million US gallons",
name2_us = "million U.S. gallons",
symbol = "million US gal",
sym_us = "million U.S. gal",
utype = "volume",
scale = 3785.411784,
default = "Ml",
link = "US gallon",
},
["oilbbl"] = {
name1 = "barrel",
symbol = "bbl",
utype = "volume",
scale = 0.158987294928,
default = "m3",
link = "Barrel (unit)#Oil barrel",
},
["stere"] = {
symbol = "stere",
usename = 1,
utype = "volume",
scale = 1,
default = "cuft",
},
["tmcft"] = {
name2 = "tmcft",
symbol = "tmcft",
utype = "volume",
scale = 28316846.592,
default = "km3",
},
["Tmcft"] = {
name1 = "thousand million cubic feet",
name2 = "thousand million cubic feet",
symbol = "tmcft",
utype = "volume",
scale = 28316846.592,
default = "km3",
link = "Tmcft",
},
["Toilbbl"] = {
name1 = "trillion barrels",
name2 = "trillion barrels",
symbol = "Tbbl",
utype = "volume",
scale = 158987294928,
default = "v * 1.58987294928 < 10 ! e9 ! e12 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["USbbl"] = {
name1 = "US barrel",
name1_us = "U.S. barrel",
symbol = "US bbl",
sym_us = "U.S. bbl",
utype = "volume",
scale = 0.119240471196,
default = "L USgal impgal",
link = "Barrel (unit)",
},
["USbeerbbl"] = {
name1 = "US beer barrel",
name1_us = "U.S. beer barrel",
symbol = "US bbl",
sym_us = "U.S. bbl",
utype = "volume",
scale = 0.117347765304,
default = "L USgal impgal",
link = "Barrel (unit)",
},
["USbsh"] = {
name1 = "US bushel",
name1_us = "U.S. bushel",
symbol = "US bsh",
sym_us = "U.S. bsh",
utype = "volume",
scale = 0.03523907016688,
default = "L USdrygal impgal",
link = "Bushel",
},
["USbu"] = {
name1 = "US bushel",
name1_us = "U.S. bushel",
symbol = "US bu",
sym_us = "U.S. bu",
utype = "volume",
scale = 0.03523907016688,
default = "L USdrygal impgal",
link = "Bushel",
},
["USdrybbl"] = {
name1 = "US dry barrel",
name1_us = "U.S. dry barrel",
symbol = "US dry bbl",
sym_us = "U.S. dry bbl",
utype = "volume",
scale = 0.11562819898508,
default = "m3",
link = "Barrel (unit)",
},
["USdrygal"] = {
name1 = "US dry gallon",
name1_us = "U.S. dry gallon",
symbol = "US dry gal",
sym_us = "U.S. dry gal",
utype = "volume",
scale = 0.00440488377086,
default = "L",
link = "Gallon",
},
["USdrypt"] = {
name1 = "US dry pint",
name1_us = "U.S. dry pint",
symbol = "US dry pt",
sym_us = "U.S. dry pt",
utype = "volume",
scale = 0.0005506104713575,
default = "ml",
link = "Pint",
},
["USdryqt"] = {
name1 = "US dry quart",
name1_us = "U.S. dry quart",
symbol = "US dry qt",
sym_us = "U.S. dry qt",
utype = "volume",
scale = 0.001101220942715,
default = "ml",
link = "Quart",
},
["USflgal"] = {
name1 = "US gallon",
name1_us = "U.S. gallon",
symbol = "US fl gal",
sym_us = "U.S. fl gal",
utype = "volume",
scale = 0.003785411784,
default = "L impgal",
link = "Gallon",
},
["USgal"] = {
name1 = "US gallon",
name1_us = "U.S. gallon",
symbol = "US gal",
sym_us = "U.S. gal",
utype = "volume",
scale = 0.003785411784,
default = "L impgal",
},
["USgi"] = {
name1 = "gill",
symbol = "gi",
utype = "volume",
scale = 0.0001182941183,
default = "ml impoz",
link = "Gill (unit)",
},
["USkenning"] = {
name1 = "US kenning",
name1_us = "U.S. kenning",
symbol = "US kenning",
sym_us = "U.S. kenning",
utype = "volume",
scale = 0.01761953508344,
default = "L impgal",
link = "Kenning (unit)",
},
["USmin"] = {
name1 = "US minim",
name1_us = "U.S. minim",
symbol = "US min",
sym_us = "U.S. min",
utype = "volume",
scale = 0.000000061611519921875,
default = "ml",
link = "Minim (unit)",
},
["USoz"] = {
name1 = "US fluid ounce",
name1_us = "U.S. fluid ounce",
symbol = "US fl oz",
sym_us = "U.S. fl oz",
utype = "volume",
scale = 0.0000295735295625,
default = "ml",
},
["USpk"] = {
name1 = "US peck",
name1_us = "U.S. peck",
symbol = "US pk",
sym_us = "U.S. pk",
utype = "volume",
scale = 0.00880976754172,
default = "L impgal",
link = "Peck",
},
["USpt"] = {
name1 = "US pint",
name1_us = "U.S. pint",
symbol = "US pt",
sym_us = "U.S. pt",
utype = "volume",
scale = 0.000473176473,
default = "L imppt",
link = "Pint",
},
["USqt"] = {
name1 = "US quart",
name1_us = "U.S. quart",
symbol = "US qt",
sym_us = "U.S. qt",
utype = "volume",
scale = 0.000946352946,
default = "ml",
link = "Quart",
customary= 1,
},
["USquart"] = {
name1 = "US quart",
name1_us = "U.S. quart",
symbol = "US qt",
sym_us = "U.S. qt",
utype = "volume",
scale = 0.000946352946,
default = "ml impoz",
link = "Quart",
},
["UStbsp"] = {
name1 = "US tablespoon",
name1_us = "U.S. tablespoon",
symbol = "US tbsp",
sym_us = "U.S. tbsp",
utype = "volume",
scale = 1.4786764781250001e-5,
default = "ml",
},
["winecase"] = {
symbol = "case",
usename = 1,
utype = "volume",
scale = 0.009,
default = "L",
link = "Case (goods)",
},
["*U.S.drygal"] = {
target = "USdrygal",
sp_us = true,
customary= 2,
},
["*U.S.gal"] = {
target = "USgal",
sp_us = true,
customary= 2,
},
["+USdrygal"] = {
target = "USdrygal",
customary= 1,
},
["+usfloz"] = {
target = "USoz",
link = "Fluid ounce",
customary= 1,
},
["+USgal"] = {
target = "USgal",
customary= 1,
},
["+USoz"] = {
target = "USoz",
customary= 1,
},
["@impgal"] = {
target = "impgal",
link = "Gallon",
customary= 3,
},
["acre feet"] = {
target = "acre-ft",
},
["acre foot"] = {
target = "acre-foot",
},
["acre ft"] = {
target = "acre-ft",
},
["acre-feet"] = {
target = "acre-ft",
},
["acre.foot"] = {
target = "acre-foot",
},
["acre.ft"] = {
target = "acre-ft",
},
["acre·ft"] = {
target = "acre-ft",
},
["bushels"] = {
target = "USbsh",
},
["cid"] = {
target = "CID",
},
["ft3"] = {
target = "cuft",
symbol = "ft<sup>3</sup>",
},
["gal"] = {
target = "USgal",
},
["gallon"] = {
shouldbe = "Use %{USgal%} for US gallons or %{impgal%} for imperial gallons (not %{gallon%})",
},
["gallons"] = {
shouldbe = "Use %{USgal%} for US gallons or %{impgal%} for imperial gallons (not %{gallons%})",
},
["Gcuft"] = {
target = "e9cuft",
},
["impfloz"] = {
target = "impoz",
},
["Impgal"] = {
target = "impgal",
},
["in3"] = {
target = "cuin",
symbol = "in<sup>3</sup>",
},
["hm³"] = {
target = "hm3",
},
["kcuft"] = {
target = "e3cuft",
},
["kcum"] = {
target = "e3m3",
},
["km³"] = {
target = "km3",
},
["liter"] = {
target = "L",
sp_us = true,
},
["liters"] = {
target = "L",
sp_us = true,
},
["litre"] = {
target = "L",
},
["litres"] = {
target = "L",
},
["Mcuft"] = {
target = "e6cuft",
},
["Mcum"] = {
target = "e6m3",
},
["Mft3"] = {
target = "e6cuft",
},
["mi3"] = {
target = "cumi",
symbol = "mi<sup>3</sup>",
},
["m³"] = {
target = "m3",
},
["Pcuft"] = {
target = "e15cuft",
},
["pt"] = {
shouldbe = "Use %{USpt%} for US pints or %{imppt%} for imperial pints (not %{pt%})",
},
["qt"] = {
shouldbe = "Use %{USqt%} for US quarts or %{impqt%} for imperial quarts (not %{qt%})",
},
["Tcuft"] = {
target = "e12cuft",
},
["Tft3"] = {
target = "e12cuft",
},
["U.S.bbl"] = {
target = "USbbl",
sp_us = true,
default = "L U.S.gal impgal",
},
["U.S.beerbbl"] = {
target = "USbeerbbl",
sp_us = true,
default = "L U.S.gal impgal",
},
["U.S.bsh"] = {
target = "USbsh",
sp_us = true,
default = "L U.S.drygal impgal",
},
["U.S.bu"] = {
target = "USbu",
sp_us = true,
default = "L U.S.drygal impgal",
},
["U.S.drybbl"] = {
target = "USdrybbl",
sp_us = true,
},
["U.S.drygal"] = {
target = "USdrygal",
sp_us = true,
},
["U.S.drypt"] = {
target = "USdrypt",
sp_us = true,
},
["U.S.dryqt"] = {
target = "USdryqt",
sp_us = true,
},
["U.S.flgal"] = {
target = "USflgal",
sp_us = true,
},
["U.S.floz"] = {
target = "USoz",
sp_us = true,
},
["U.S.gal"] = {
target = "USgal",
sp_us = true,
link = "U.S. gallon",
},
["u.s.gal"] = {
target = "USgal",
sp_us = true,
link = "U.S. gallon",
},
["U.S.gi"] = {
target = "USgi",
sp_us = true,
},
["U.S.kenning"] = {
target = "USkenning",
sp_us = true,
},
["U.S.oz"] = {
target = "USoz",
sp_us = true,
},
["U.S.pk"] = {
target = "USpk",
sp_us = true,
},
["U.S.pt"] = {
target = "USpt",
sp_us = true,
},
["U.S.qt"] = {
target = "USqt",
sp_us = true,
default = "L impqt",
customary= 2,
},
["usbbl"] = {
target = "USbbl",
},
["usbeerbbl"] = {
target = "USbeerbbl",
},
["usbsh"] = {
target = "USbsh",
},
["usbu"] = {
target = "USbu",
},
["usdrybbl"] = {
target = "USdrybbl",
},
["usdrygal"] = {
target = "USdrygal",
},
["usdrypt"] = {
target = "USdrypt",
},
["usdryqt"] = {
target = "USdryqt",
},
["USfloz"] = {
target = "USoz",
},
["usfloz"] = {
target = "USoz",
},
["USGAL"] = {
target = "USgal",
},
["usgal"] = {
target = "USgal",
},
["usgi"] = {
target = "USgi",
},
["uskenning"] = {
target = "USkenning",
},
["usoz"] = {
target = "USoz",
},
["uspk"] = {
target = "USpk",
},
["uspt"] = {
target = "USpt",
},
["usqt"] = {
target = "USqt",
},
["yd3"] = {
target = "cuyd",
symbol = "yd<sup>3</sup>",
},
["cuft/sqmi"] = {
per = { "cuft", "sqmi" },
utype = "volume per unit area",
default = "m3/km2",
},
["m3/ha"] = {
name1 = "cubic metre per hectare",
name1_us = "cubic meter per hectare",
name2 = "cubic metres per hectare",
name2_us = "cubic meters per hectare",
symbol = "m<sup>3</sup>/ha",
utype = "volume per unit area",
scale = 0.0001,
default = "USbu/acre",
link = "Hectare",
},
["m3/km2"] = {
per = { "m3", "km2" },
utype = "volume per unit area",
default = "cuft/sqmi",
},
["U.S.gal/acre"] = {
per = { "U.S.gal", "acre" },
utype = "volume per unit area",
default = "m3/km2",
},
["USbu/acre"] = {
name2 = "US bushels per acre",
symbol = "US bushel per acre",
usename = 1,
utype = "volume per unit area",
scale = 8.7077638761350888e-6,
default = "m3/ha",
link = "Bushel",
},
["USgal/acre"] = {
per = { "USgal", "acre" },
utype = "volume per unit area",
default = "m3/km2",
},
["cuyd/mi"] = {
per = { "cuyd", "mi" },
utype = "volume per unit length",
default = "m3/km",
},
["m3/km"] = {
per = { "m3", "km" },
utype = "volume per unit length",
default = "cuyd/mi",
},
["mich"] = {
combination= { "ch", "mi" },
multiple = { 80 },
utype = "length",
},
["michlk"] = {
combination= { "chlk", "mi" },
multiple = { 80 },
utype = "length",
},
["michainlk"] = {
combination= { "chainlk", "mi" },
multiple = { 80 },
utype = "length",
},
["miyd"] = {
combination= { "yd", "mi" },
multiple = { 1760 },
utype = "length",
},
["miydftin"] = {
combination= { "in", "ft", "yd", "mi" },
multiple = { 12, 3, 1760 },
utype = "length",
},
["mift"] = {
combination= { "ft", "mi" },
multiple = { 5280 },
utype = "length",
},
["ydftin"] = {
combination= { "in", "ft", "yd" },
multiple = { 12, 3 },
utype = "length",
},
["ydft"] = {
combination= { "ft", "yd" },
multiple = { 3 },
utype = "length",
},
["ftin"] = {
combination= { "in", "ft" },
multiple = { 12 },
utype = "length",
},
["footin"] = {
combination= { "in", "foot" },
multiple = { 12 },
utype = "length",
},
["handin"] = {
combination= { "in", "hand" },
multiple = { 4 },
utype = "length",
},
["lboz"] = {
combination= { "oz", "lb" },
multiple = { 16 },
utype = "mass",
},
["stlb"] = {
combination= { "lb", "st" },
multiple = { 14 },
utype = "mass",
},
["stlboz"] = {
combination= { "oz", "lb", "st" },
multiple = { 16, 14 },
utype = "mass",
},
["st and lb"] = {
combination= { "lb", "st" },
multiple = { 14 },
utype = "mass",
},
["GN LTf"] = {
combination= { "GN", "-LTf" },
utype = "force",
},
["GN LTf STf"] = {
combination= { "GN", "-LTf", "-STf" },
utype = "force",
},
["GN STf"] = {
combination= { "GN", "-STf" },
utype = "force",
},
["GN STf LTf"] = {
combination= { "GN", "-STf", "-LTf" },
utype = "force",
},
["kN LTf"] = {
combination= { "kN", "-LTf" },
utype = "force",
},
["kN LTf STf"] = {
combination= { "kN", "-LTf", "-STf" },
utype = "force",
},
["kN STf"] = {
combination= { "kN", "-STf" },
utype = "force",
},
["kN STf LTf"] = {
combination= { "kN", "-STf", "-LTf" },
utype = "force",
},
["LTf STf"] = {
combination= { "-LTf", "-STf" },
utype = "force",
},
["MN LTf"] = {
combination= { "MN", "-LTf" },
utype = "force",
},
["MN LTf STf"] = {
combination= { "MN", "-LTf", "-STf" },
utype = "force",
},
["MN STf"] = {
combination= { "MN", "-STf" },
utype = "force",
},
["MN STf LTf"] = {
combination= { "MN", "-STf", "-LTf" },
utype = "force",
},
["STf LTf"] = {
combination= { "-STf", "-LTf" },
utype = "force",
},
["L/100 km mpgimp"] = {
combination= { "L/100 km", "mpgimp" },
utype = "fuel efficiency",
},
["l/100 km mpgimp"] = {
combination= { "l/100 km", "mpgimp" },
utype = "fuel efficiency",
},
["L/100 km mpgUS"] = {
combination= { "L/100 km", "mpgus" },
utype = "fuel efficiency",
},
["L/100 km mpgus"] = {
combination= { "L/100 km", "mpgus" },
utype = "fuel efficiency",
},
["l/100 km mpgus"] = {
combination= { "l/100 km", "mpgus" },
utype = "fuel efficiency",
},
["mpgimp L/100 km"] = {
combination= { "mpgimp", "L/100 km" },
utype = "fuel efficiency",
},
["LT ST t"] = {
combination= { "lt", "-ST", "t" },
utype = "mass",
},
["LT t ST"] = {
combination= { "lt", "t", "-ST" },
utype = "mass",
},
["ST LT t"] = {
combination= { "-ST", "lt", "t" },
utype = "mass",
},
["ST t LT"] = {
combination= { "-ST", "t", "lt" },
utype = "mass",
},
["t LT ST"] = {
combination= { "t", "lt", "-ST" },
utype = "mass",
},
["ton"] = {
combination= { "LT", "ST" },
utype = "mass",
},
["kPa kg/cm2"] = {
combination= { "kPa", "kgf/cm2" },
utype = "pressure",
},
["kPa lb/in2"] = {
combination= { "kPa", "-lb/in2" },
utype = "pressure",
},
["floz"] = {
combination= { "impoz", "USoz" },
utype = "volume",
},
}
---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above). --
---------------------------------------------------------------------------
local default_exceptions = {
-- Prefixed units with a default different from that of the base unit.
-- Each key item is a prefixed symbol (unitcode for engineering notation).
["cm<sup>2</sup>"] = "sqin",
["dm<sup>2</sup>"] = "sqin",
["e3acre"] = "km2",
["e3m2"] = "e6sqft",
["e6acre"] = "km2",
["e6ha"] = "e6acre",
["e6km2"] = "e6sqmi",
["e6m2"] = "e6sqft",
["e6sqft"] = "v * 9.290304 < 100 ! e3 ! e6 ! m2",
["e6sqmi"] = "e6km2",
["hm<sup>2</sup>"] = "acre",
["km<sup>2</sup>"] = "sqmi",
["mm<sup>2</sup>"] = "sqin",
["aJ"] = "eV",
["e3BTU"] = "MJ",
["e6BTU"] = "GJ",
["EJ"] = "kWh",
["eV"] = "aJ",
["feV"] = "yJ",
["fJ"] = "keV",
["GeV"] = "nJ",
["GJ"] = "kWh",
["keV"] = "fJ",
["MeV"] = "pJ",
["meV"] = "zJ",
["MJ"] = "kWh",
["neV"] = "yJ",
["PeV"] = "mJ",
["peV"] = "yJ",
["PJ"] = "kWh",
["pJ"] = "MeV",
["TeV"] = "μJ",
["TJ"] = "kWh",
["YJ"] = "kWh",
["yJ"] = "μeV",
["ZJ"] = "kWh",
["zJ"] = "meV",
["μeV"] = "yJ",
["e12cuft/a"] = "v * 2.8316846592 < 100 ! e9 ! e12 ! m3/a",
["e12cuft/d"] = "v * 2.8316846592 < 100 ! e9 ! e12 ! m3/d",
["e12m3/a"] = "Tcuft/a",
["e12m3/d"] = "Tcuft/d",
["e3cuft/a"] = "v * 2.8316846592 < 100 ! ! e3 ! m3/a",
["e3cuft/d"] = "v * 2.8316846592 < 100 ! ! e3 ! m3/d",
["e3cuft/s"] = "v * 2.8316846592 < 100 ! ! e3 ! m3/s",
["e3m3/a"] = "v < 28.316846592 ! k ! M ! cuft/a",
["e3m3/d"] = "v < 28.316846592 ! k ! M ! cuft/d",
["e3m3/s"] = "v < 28.316846592 ! k ! M ! cuft/s",
["e3USgal/a"] = "v * 3.785411784 < 1000 ! ! e3 ! m3/a",
["e6cuft/a"] = "v * 2.8316846592 < 100 ! e3 ! e6 ! m3/a",
["e6cuft/d"] = "v * 2.8316846592 < 100 ! e3 ! e6 ! m3/d",
["e6cuft/s"] = "v * 2.8316846592 < 100 ! e3 ! e6 ! m3/s",
["e6m3/a"] = "v < 28.316846592 ! M ! G ! cuft/a",
["e6m3/d"] = "v < 28.316846592 ! M ! G ! cuft/d",
["e6m3/s"] = "v < 28.316846592 ! e6 ! e9 ! cuft/s",
["e6USgal/a"] = "v * 3.785411784 < 1000 ! e3 ! e6 ! m3/a",
["e9cuft/a"] = "m3/a",
["e9cuft/d"] = "v * 2.8316846592 < 100 ! e6 ! e9 ! m3/d",
["e9m3/a"] = "v < 28.316846592 ! G ! T ! cuft/a",
["e9m3/d"] = "v < 28.316846592 ! G ! T ! cuft/d",
["e9m3/s"] = "v < 28.316846592 ! e9 ! e12 ! cuft/s",
["e9USgal/a"] = "v * 3.785411784 < 1000 ! e6 ! e9 ! m3/a",
["e9USgal/s"] = "v * 3.785411784 < 1000 ! e6 ! e9 ! m3/s",
["nN"] = "gr-f",
["μN"] = "gr-f",
["mN"] = "oz-f",
["am"] = "in",
["cm"] = "in",
["dam"] = "ft",
["dm"] = "in",
["e12km"] = "e12mi",
["e12mi"] = "e12km",
["e3AU"] = "ly",
["e3km"] = "e3mi",
["e3mi"] = "e3km",
["e6km"] = "e6mi",
["e6mi"] = "e6km",
["e9km"] = "AU",
["e9mi"] = "e9km",
["Em"] = "mi",
["fm"] = "in",
["Gm"] = "mi",
["hm"] = "ft",
["km"] = "mi",
["mm"] = "in",
["Mm"] = "mi",
["nm"] = "in",
["Pm"] = "mi",
["pm"] = "in",
["Tm"] = "mi",
["Ym"] = "mi",
["ym"] = "in",
["Zm"] = "mi",
["zm"] = "in",
["μm"] = "in",
["e12lb"] = "v * 4.5359237 < 10 ! Mt ! Gt",
["e3lb"] = "v * 4.5359237 < 10 ! kg ! t",
["e3ozt"] = "v * 0.311034768 < 10 ! kg ! t",
["e3t"] = "LT ST",
["e6carat"] = "t",
["e6lb"] = "v * 4.5359237 < 10 ! t ! kilotonne",
["e6ozt"] = "lb kg",
["e6ST"] = "Mt",
["e6t"] = "LT ST",
["e9lb"] = "v * 4.5359237 < 10 ! kilotonne ! Mt",
["e9t"] = "LT ST",
["Gg"] = "lb",
["kg"] = "lb",
["mg"] = "gr",
["Mg"] = "LT ST",
["ng"] = "gr",
["μg"] = "gr",
["mBq"] = "fCi",
["kBq"] = "nCi",
["MBq"] = "μCi",
["GBq"] = "mCi",
["TBq"] = "Ci",
["PBq"] = "kCi",
["EBq"] = "kCi",
["fCi"] = "mBq",
["pCi"] = "Bq",
["nCi"] = "Bq",
["μCi"] = "kBq",
["mCi"] = "MBq",
["kCi"] = "TBq",
["MCi"] = "PBq",
["ns"] = "μs",
["μs"] = "ms",
["ms"] = "s",
["ks"] = "h",
["Ms"] = "week",
["Gs"] = "decade",
["Ts"] = "millennium",
["Ps"] = "million year",
["Es"] = "thousand million year",
["MK"] = "keVT",
["cL"] = "impoz usoz",
["cl"] = "impoz usoz",
["cm<sup>3</sup>"] = "cuin",
["dL"] = "impoz usoz",
["dl"] = "impoz usoz",
["mm<sup>3</sup>"] = "cuin",
["dm<sup>3</sup>"] = "cuin",
["e12cuft"] = "v * 2.8316846592 < 100 ! e9 ! e12 ! m3",
["e12impgal"] = "v * 4.54609 < 1000 ! T ! P ! l",
["e12m3"] = "v < 28.316846592 ! T ! P ! cuft",
["e12U.S.gal"] = "v * 3.785411784 < 1000 ! T ! P ! l",
["e12USgal"] = "v * 3.785411784 < 1000 ! T ! P ! l",
["e15cuft"] = "v * 2.8316846592 < 100 ! e12 ! e15 ! m3",
["e15m3"] = "Pcuft",
["e3bdft"] = "v * 0.23597372167 < 100 ! e3 ! e6 ! m3",
["e3cuft"] = "v * 2.8316846592 < 100 ! ! e3 ! m3",
["e3impgal"] = "v * 4.54609 < 1000 ! k ! M ! l",
["e3m3"] = "v < 28.316846592 ! k ! M ! cuft",
["e3U.S.gal"] = "v * 3.785411784 < 1000 ! k ! M ! l",
["e3USgal"] = "v * 3.785411784 < 1000 ! k ! M ! l",
["e6bdft"] = "v * 0.23597372167 < 100 ! e3 ! e6 ! m3",
["e6cuft"] = "v * 2.8316846592 < 100 ! e3 ! e6 ! m3",
["e6cuyd"] = "v * 7.64554857984 < 10 ! e3 ! e6 ! m3",
["e6impgal"] = "v * 4.54609 < 1000 ! M ! G ! l",
["e6L"] = "USgal",
["e6m3"] = "v < 28.316846592 ! M ! G ! cuft",
["e6U.S.gal"] = "v * 3.785411784 < 1000 ! M ! G ! l",
["e6USgal"] = "v * 3.785411784 < 1000 ! M ! G ! l",
["e9bdft"] = "v * 0.23597372167 < 100 ! e6 ! e9 ! m3",
["e9cuft"] = "v * 2.8316846592 < 100 ! e6 ! e9 ! m3",
["e9impgal"] = "v * 4.54609 < 1000 ! G ! T ! l",
["e9m3"] = "v < 28.316846592 ! G ! T ! cuft",
["e9U.S.gal"] = "v * 3.785411784 < 1000 ! G ! T ! l",
["e9USgal"] = "v * 3.785411784 < 1000 ! G ! T ! l",
["GL"] = "cuft",
["Gl"] = "cuft",
["kL"] = "cuft",
["kl"] = "cuft",
["km<sup>3</sup>"] = "cumi",
["mL"] = "impoz usoz",
["ml"] = "impoz usoz",
["Ml"] = "v < 28.316846592 ! e3 ! e6 ! cuft",
["ML"] = "v < 28.316846592 ! e3 ! e6 ! cuft",
["TL"] = "cumi",
["Tl"] = "cumi",
["μL"] = "cuin",
["μl"] = "cuin",
}
---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above). --
---------------------------------------------------------------------------
local link_exceptions = {
-- Prefixed units with a linked article different from that of the base unit.
-- Each key item is a prefixed symbol (not unitcode).
["mm<sup>2</sup>"] = "Square millimetre",
["cm<sup>2</sup>"] = "Square centimetre",
["dm<sup>2</sup>"] = "Square decimetre",
["km<sup>2</sup>"] = "Square kilometre",
["kJ"] = "Kilojoule",
["MJ"] = "Megajoule",
["GJ"] = "Gigajoule",
["TJ"] = "Terajoule",
["fm"] = "Femtometre",
["pm"] = "Picometre",
["nm"] = "Nanometre",
["μm"] = "Micrometre",
["mm"] = "Millimetre",
["cm"] = "Centimetre",
["dm"] = "Decimetre",
["dam"] = "Decametre",
["hm"] = "Hectometre",
["km"] = "Kilometre",
["Mm"] = "Megametre",
["Gm"] = "Gigametre",
["Tm"] = "Terametre",
["Pm"] = "Petametre",
["Em"] = "Exametre",
["Zm"] = "Zettametre",
["Ym"] = "Yottametre",
["μg"] = "Microgram",
["mg"] = "Milligram",
["kg"] = "Kilogram",
["Mg"] = "Tonne",
["yW"] = "Yoctowatt",
["zW"] = "Zeptowatt",
["aW"] = "Attowatt",
["fW"] = "Femtowatt",
["pW"] = "Picowatt",
["nW"] = "Nanowatt",
["μW"] = "Microwatt",
["mW"] = "Milliwatt",
["kW"] = "Kilowatt",
["MW"] = "Megawatt",
["GW"] = "Gigawatt",
["TW"] = "Terawatt",
["PW"] = "Petawatt",
["EW"] = "Exawatt",
["ZW"] = "Zettawatt",
["YW"] = "Yottawatt",
["as"] = "Attosecond",
["fs"] = "Femtosecond",
["ps"] = "Picosecond",
["ns"] = "Nanosecond",
["μs"] = "Microsecond",
["ms"] = "Millisecond",
["ks"] = "Kilosecond",
["Ms"] = "Megasecond",
["Gs"] = "Gigasecond",
["Ts"] = "Terasecond",
["Ps"] = "Petasecond",
["Es"] = "Exasecond",
["Zs"] = "Zettasecond",
["Ys"] = "Yottasecond",
["mm<sup>3</sup>"] = "Cubic millimetre",
["cm<sup>3</sup>"] = "Cubic centimetre",
["dm<sup>3</sup>"] = "Cubic decimetre",
["dam<sup>3</sup>"] = "Cubic decametre",
["km<sup>3</sup>"] = "Cubic kilometre",
["μL"] = "Microlitre",
["μl"] = "Microlitre",
["mL"] = "Millilitre",
["ml"] = "Millilitre",
["cL"] = "Centilitre",
["cl"] = "Centilitre",
["dL"] = "Decilitre",
["dl"] = "Decilitre",
["daL"] = "Decalitre",
["dal"] = "Decalitre",
["hL"] = "Hectolitre",
["hl"] = "Hectolitre",
["kL"] = "Kilolitre",
["kl"] = "Kilolitre",
["ML"] = "Megalitre",
["Ml"] = "Megalitre",
["GL"] = "Gigalitre",
["Gl"] = "Gigalitre",
["TL"] = "Teralitre",
["Tl"] = "Teralitre",
["PL"] = "Petalitre",
["Pl"] = "Petalitre",
}
---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above). --
---------------------------------------------------------------------------
local per_unit_fixups = {
-- Automatically created per units of form "x/y" may have their unit type
-- changed, for example, "length/time" is changed to "speed".
-- Other adjustments can also be specified.
["/area"] = "per unit area",
["/volume"] = "per unit volume",
["area/area"] = "area per unit area",
["energy/length"] = "energy per unit length",
["energy/mass"] = "energy per unit mass",
["energy/time"] = { utype = "power", link = "Power (physics)" },
["energy/volume"] = "energy per unit volume",
["force/area"] = { utype = "pressure", link = "Pressure" },
["length/length"] = { utype = "gradient", link = "Grade (slope)" },
["length/time"] = { utype = "speed", link = "Speed" },
["length/time/time"] = { utype = "acceleration", link = "Acceleration" },
["mass/area"] = { utype = "pressure", multiplier = 9.80665 },
["mass/length"] = "linear density",
["mass/mass"] = "concentration",
["mass/power"] = "mass per unit power",
["mass/time"] = "mass per unit time",
["mass/volume"] = { utype = "density", link = "Density" },
["power/mass"] = "power per unit mass",
["power/volume"] = { link = "Power density" },
["pressure/length"] = "fracture gradient",
["speed/time"] = { utype = "acceleration", link = "Acceleration" },
["volume/area"] = "volume per unit area",
["volume/length"] = "volume per unit length",
["volume/time"] = "flow",
}
return {
all_units = all_units,
default_exceptions = default_exceptions,
link_exceptions = link_exceptions,
per_unit_fixups = per_unit_fixups,
}
hqgudow086bv1ct4yxtqfzm8bjmx0b1
21756
21755
2026-09-18T15:05:25Z
Keresturec
18
1 измена увезена из [[:en:Module:Convert/data]]: Importing from the English wikipedia
21755
Scribunto
text/plain
-- Conversion data used by [[Module:Convert]] which uses mw.loadData() for
-- read-only access to this module so that it is loaded only once per page.
-- See [[:en:Template:Convert/Transwiki guide]] if copying to another wiki.
--
-- These data tables follow:
-- all_units all properties for a unit, including default output
-- default_exceptions exceptions for default output ('kg' and 'g' have different defaults)
-- link_exceptions exceptions for links ('kg' and 'g' have different links)
--
-- These tables are generated by a script which reads the wikitext of a page that
-- documents the required properties of each unit; see [[:en:Module:Convert/doc]].
---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above). --
---------------------------------------------------------------------------
local all_units = {
["Gy"] = {
_name1 = "gray",
_symbol = "Gy",
utype = "absorbed radiation dose",
scale = 1,
prefixes = 1,
default = "rad",
link = "Gray (unit)",
},
["rad"] = {
_name1 = "rad",
_symbol = "rad",
utype = "absorbed radiation dose",
scale = 0.01,
prefixes = 1,
default = "Gy",
link = "Rad (unit)",
},
["cm/s2"] = {
name1 = "centimetre per second squared",
name1_us = "centimeter per second squared",
name2 = "centimetres per second squared",
name2_us = "centimeters per second squared",
symbol = "cm/s<sup>2</sup>",
utype = "acceleration",
scale = 0.01,
default = "ft/s2",
link = "Gal (unit)",
},
["ft/s2"] = {
name1 = "foot per second squared",
name2 = "feet per second squared",
symbol = "ft/s<sup>2</sup>",
utype = "acceleration",
scale = 0.3048,
default = "m/s2",
},
["g0"] = {
name1 = "standard gravity",
name2 = "standard gravities",
symbol = "''g''<sub>0</sub>",
utype = "acceleration",
scale = 9.80665,
default = "m/s2",
},
["g-force"] = {
name2 = "''g''",
symbol = "''g''",
utype = "acceleration",
scale = 9.80665,
default = "m/s2",
link = "g-force",
},
["km/hs"] = {
name1 = "kilometre per hour per second",
name1_us = "kilometer per hour per second",
name2 = "kilometres per hour per second",
name2_us = "kilometers per hour per second",
symbol = "km/(h⋅s)",
utype = "acceleration",
scale = 0.27777777777777779,
default = "mph/s",
link = "Acceleration",
},
["km/s2"] = {
name1 = "kilometre per second squared",
name1_us = "kilometer per second squared",
name2 = "kilometres per second squared",
name2_us = "kilometers per second squared",
symbol = "km/s<sup>2</sup>",
utype = "acceleration",
scale = 1000,
default = "mph/s",
link = "Acceleration",
},
["m/s2"] = {
name1 = "metre per second squared",
name1_us = "meter per second squared",
name2 = "metres per second squared",
name2_us = "meters per second squared",
symbol = "m/s<sup>2</sup>",
utype = "acceleration",
scale = 1,
default = "ft/s2",
},
["mph/s"] = {
name1 = "mile per hour per second",
name2 = "miles per hour per second",
symbol = "mph/s",
utype = "acceleration",
scale = 0.44704,
default = "km/hs",
link = "Acceleration",
},
["km/h/s"] = {
target = "km/hs",
},
["standard gravity"] = {
target = "g0",
},
["1000sqft"] = {
name1 = "thousand square feet",
name2 = "thousand square feet",
symbol = "1000 sq ft",
utype = "area",
scale = 92.90304,
default = "m2",
link = "Square foot",
},
["a"] = {
_name1 = "are",
_symbol = "a",
utype = "area",
scale = 100,
prefixes = 1,
default = "sqft",
link = "Hectare#Are",
},
["acre"] = {
symbol = "acre",
usename = 1,
utype = "area",
scale = 4046.8564224,
default = "ha",
subdivs = { ["rood"] = { 4, default = "ha" }, ["sqperch"] = { 160, default = "ha" } },
},
["acre-sing"] = {
target = "acre",
},
["arpent"] = {
symbol = "arpent",
usename = 1,
utype = "area",
scale = 3418.89,
default = "ha",
},
["cda"] = {
name1 = "cuerda",
symbol = "cda",
utype = "area",
scale = 3930.395625,
default = "ha acre",
},
["daa"] = {
name1 = "decare",
symbol = "daa",
utype = "area",
scale = 1000,
default = "km2 sqmi",
},
["dunam"] = {
symbol = "dunam",
usename = 1,
utype = "area",
scale = 1000,
default = "km2 sqmi",
},
["dunum"] = {
symbol = "dunum",
usename = 1,
utype = "area",
scale = 1000,
default = "km2 sqmi",
link = "Dunam",
},
["ha"] = {
name1 = "hectare",
symbol = "ha",
utype = "area",
scale = 10000,
default = "acre",
},
["hectare"] = {
name1 = "hectare",
symbol = "ha",
usename = 1,
utype = "area",
scale = 10000,
default = "acre",
},
["Irish acre"] = {
name1 = "Irish acre",
symbol = "Irish acres",
utype = "area",
scale = 6555.2385024,
default = "ha",
link = "Acre (Irish)",
},
["m2"] = {
_name1 = "square metre",
_name1_us= "square meter",
_symbol = "m<sup>2</sup>",
prefix_position= 8,
utype = "area",
scale = 1,
prefixes = 2,
default = "sqft",
link = "Square metre",
},
["pondemaat"] = {
name1 = "pondemaat",
name2 = "pondemaat",
symbol = "pond",
utype = "area",
scale = 3674.363358816,
default = "m2",
link = ":nl:pondemaat",
},
["pyeong"] = {
name2 = "pyeong",
symbol = "pyeong",
usename = 1,
utype = "area",
scale = 3.3057851239669422,
default = "m2",
},
["rai"] = {
name2 = "rai",
symbol = "rai",
utype = "area",
scale = 1600,
default = "m2",
link = "Rai (unit)",
},
["rood"] = {
symbol = "rood",
usename = 1,
utype = "area",
scale = 1011.7141056,
default = "sqft m2",
subdivs = { ["sqperch"] = { 40, default = "m2" } },
link = "Rood (unit)",
},
["sqfoot"] = {
name1 = "square foot",
name2 = "square foot",
symbol = "sq ft",
utype = "area",
scale = 0.09290304,
default = "m2",
},
["sqft"] = {
name1 = "square foot",
name2 = "square feet",
symbol = "sq ft",
utype = "area",
scale = 0.09290304,
default = "m2",
},
["sqin"] = {
name1 = "square inch",
name2 = "square inches",
symbol = "sq in",
utype = "area",
scale = 0.00064516,
default = "cm2",
},
["sqmi"] = {
name1 = "square mile",
symbol = "sq mi",
utype = "area",
scale = 2589988.110336,
default = "km2",
},
["sqnmi"] = {
name1 = "square nautical mile",
symbol = "sq nmi",
utype = "area",
scale = 3429904,
default = "km2 sqmi",
link = "Nautical mile",
},
["sqperch"] = {
name2 = "perches",
symbol = "perch",
usename = 1,
utype = "area",
scale = 25.29285264,
default = "m2",
link = "Rod (unit)#Area and volume",
},
["sqverst"] = {
symbol = "square verst",
usename = 1,
utype = "area",
scale = 1138062.24,
default = "km2 sqmi",
link = "Verst",
},
["sqyd"] = {
name1 = "square yard",
symbol = "sq yd",
utype = "area",
scale = 0.83612736,
default = "m2",
},
["tsubo"] = {
name2 = "tsubo",
symbol = "tsubo",
usename = 1,
utype = "area",
scale = 3.3057851239669422,
default = "m2",
link = "Japanese units of measurement#Area",
},
["acres"] = {
target = "acre",
},
["are"] = {
target = "a",
},
["decare"] = {
target = "daa",
},
["foot2"] = {
target = "sqfoot",
},
["ft2"] = {
target = "sqft",
symbol = "ft<sup>2</sup>",
},
["in2"] = {
target = "sqin",
symbol = "in<sup>2</sup>",
},
["km²"] = {
target = "km2",
},
["mi2"] = {
target = "sqmi",
symbol = "mi<sup>2</sup>",
},
["million acre"] = {
target = "e6acre",
},
["million acres"] = {
target = "e6acre",
},
["million hectares"] = {
target = "e6ha",
},
["m²"] = {
target = "m2",
},
["nmi2"] = {
target = "sqnmi",
},
["pond"] = {
target = "pondemaat",
},
["sq arp"] = {
target = "arpent",
},
["sqkm"] = {
target = "km2",
},
["sqm"] = {
target = "m2",
},
["square verst"] = {
target = "sqverst",
},
["verst2"] = {
target = "sqverst",
},
["yd2"] = {
target = "sqyd",
symbol = "yd<sup>2</sup>",
},
["m2/ha"] = {
name1 = "square metre per hectare",
name1_us = "square meter per hectare",
name2 = "square metres per hectare",
name2_us = "square meters per hectare",
symbol = "m<sup>2</sup>/ha",
utype = "area per unit area",
scale = 0.0001,
default = "sqft/acre",
link = "Basal area",
},
["sqft/acre"] = {
name1 = "square foot per acre",
name2 = "square feet per acre",
symbol = "sq ft/acre",
utype = "area per unit area",
scale = 2.295684113865932e-5,
default = "m2/ha",
link = "Basal area",
},
["cent"] = {
name1 = "cent",
symbol = "¢",
utype = "cent",
scale = 1,
default = "cent",
link = "Cent (currency)",
},
["¢"] = {
target = "cent",
},
["A.h"] = {
name1 = "ampere hour",
symbol = "A⋅h",
utype = "charge",
scale = 3600,
default = "coulomb",
},
["coulomb"] = {
_name1 = "coulomb",
_symbol = "C",
utype = "charge",
scale = 1,
prefixes = 1,
default = "e",
link = "Coulomb",
},
["e"] = {
name1 = "elementary charge",
symbol = "''e''",
utype = "charge",
scale = 1.602176634e-19,
default = "coulomb",
},
["g-mol"] = {
name1 = "gram-mole",
symbol = "g‑mol",
utype = "chemical amount",
scale = 1,
default = "lbmol",
link = "Mole (unit)",
},
["gmol"] = {
name1 = "gram-mole",
symbol = "gmol",
utype = "chemical amount",
scale = 1,
default = "lbmol",
link = "Mole (unit)",
},
["kmol"] = {
name1 = "kilomole",
symbol = "kmol",
utype = "chemical amount",
scale = 1000,
default = "lbmol",
link = "Mole (unit)",
},
["lb-mol"] = {
name1 = "pound-mole",
symbol = "lb‑mol",
utype = "chemical amount",
scale = 453.59237,
default = "mol",
},
["lbmol"] = {
name1 = "pound-mole",
symbol = "lbmol",
utype = "chemical amount",
scale = 453.59237,
default = "mol",
},
["mol"] = {
name1 = "mole",
symbol = "mol",
utype = "chemical amount",
scale = 1,
default = "lbmol",
link = "Mole (unit)",
},
["kgCO2/L"] = {
name1 = "kilogram per litre",
name1_us = "kilogram per liter",
name2 = "kilograms per litre",
name2_us = "kilograms per liter",
symbol = "kg(CO<sub>2</sub>)/L",
utype = "co2 per unit volume",
scale = 1000,
default = "lbCO2/USgal",
link = "Exhaust gas",
},
["lbCO2/USgal"] = {
name1 = "pound per US gallon",
name2 = "pounds per US gallon",
symbol = "lbCO2/US gal",
utype = "co2 per unit volume",
scale = 119.82642731689663,
default = "kgCO2/L",
link = "Exhaust gas",
},
["oz/lb"] = {
per = { "oz", "lb" },
utype = "concentration",
default = "mg/kg",
},
["mg/kg"] = {
per = { "mg", "kg" },
utype = "concentration",
default = "oz/lb",
},
["g/dm3"] = {
name1 = "gram per cubic decimetre",
name1_us = "gram per cubic decimeter",
name2 = "grams per cubic decimetre",
name2_us = "grams per cubic decimeter",
symbol = "g/dm<sup>3</sup>",
utype = "density",
scale = 1,
default = "kg/m3",
link = "Density",
},
["g/L"] = {
name1 = "gram per litre",
name1_us = "gram per liter",
name2 = "grams per litre",
name2_us = "grams per liter",
symbol = "g/L",
utype = "density",
scale = 1,
default = "lb/cuin",
link = "Density",
},
["g/mL"] = {
name1 = "gram per millilitre",
name1_us = "gram per milliliter",
name2 = "grams per millilitre",
name2_us = "grams per milliliter",
symbol = "g/mL",
utype = "density",
scale = 1000,
default = "lb/cuin",
link = "Density",
},
["g/ml"] = {
name1 = "gram per millilitre",
name1_us = "gram per milliliter",
name2 = "grams per millilitre",
name2_us = "grams per milliliter",
symbol = "g/ml",
utype = "density",
scale = 1000,
default = "lb/cuin",
link = "Density",
},
["kg/dm3"] = {
name1 = "kilogram per cubic decimetre",
name1_us = "kilogram per cubic decimeter",
name2 = "kilograms per cubic decimetre",
name2_us = "kilograms per cubic decimeter",
symbol = "kg/dm<sup>3</sup>",
utype = "density",
scale = 1000,
default = "lb/cuft",
link = "Density",
},
["kg/L"] = {
name1 = "kilogram per litre",
name1_us = "kilogram per liter",
name2 = "kilograms per litre",
name2_us = "kilograms per liter",
symbol = "kg/L",
utype = "density",
scale = 1000,
default = "lb/USgal",
link = "Density",
},
["kg/l"] = {
name1 = "kilogram per litre",
name1_us = "kilogram per liter",
name2 = "kilograms per litre",
name2_us = "kilograms per liter",
symbol = "kg/l",
utype = "density",
scale = 1000,
default = "lb/USgal",
link = "Density",
},
["kg/m3"] = {
name1 = "kilogram per cubic metre",
name1_us = "kilogram per cubic meter",
name2 = "kilograms per cubic metre",
name2_us = "kilograms per cubic meter",
symbol = "kg/m<sup>3</sup>",
utype = "density",
scale = 1,
default = "lb/cuyd",
link = "Density",
},
["lb/cuft"] = {
name1 = "pound per cubic foot",
name2 = "pounds per cubic foot",
symbol = "lb/cu ft",
utype = "density",
scale = 16.018463373960142,
default = "g/cm3",
link = "Density",
},
["lb/cuin"] = {
name1 = "pound per cubic inch",
name2 = "pounds per cubic inch",
symbol = "lb/cu in",
utype = "density",
scale = 27679.904710203122,
default = "g/cm3",
link = "Density",
},
["lb/cuyd"] = {
name1 = "pound per cubic yard",
name2 = "pounds per cubic yard",
symbol = "lb/cu yd",
utype = "density",
scale = 0.5932764212577829,
default = "kg/m3",
link = "Density",
},
["lb/impgal"] = {
name1 = "pound per imperial gallon",
name2 = "pounds per imperial gallon",
symbol = "lb/imp gal",
utype = "density",
scale = 99.776372663101697,
default = "kg/L",
link = "Density",
},
["lb/in3"] = {
name1 = "pound per cubic inch",
name2 = "pounds per cubic inch",
symbol = "lb/cu in",
utype = "density",
scale = 27679.904710203122,
default = "g/cm3",
link = "Density",
},
["lb/U.S.gal"] = {
name1 = "pound per U.S. gallon",
name2 = "pounds per U.S. gallon",
symbol = "lb/U.S. gal",
utype = "density",
scale = 119.82642731689663,
default = "kg/L",
link = "Density",
},
["lb/USbu"] = {
name1 = "pound per US bushel",
name2 = "pounds per US bushel",
symbol = "lb/US bu",
utype = "density",
scale = 12.871859780974471,
default = "kg/m3",
link = "Bushel",
},
["lb/USgal"] = {
name1 = "pound per US gallon",
name2 = "pounds per US gallon",
symbol = "lb/US gal",
utype = "density",
scale = 119.82642731689663,
default = "kg/L",
link = "Density",
},
["lbm/cuin"] = {
name1 = "pound mass per cubic inch",
name2 = "pounds mass per cubic inch",
symbol = "lbm/cu in",
utype = "density",
scale = 27679.904710203122,
default = "g/cm3",
link = "Density",
},
["mg/L"] = {
name1 = "milligram per litre",
name1_us = "milligram per liter",
name2 = "milligrams per litre",
name2_us = "milligrams per liter",
symbol = "mg/L",
utype = "density",
scale = 0.001,
default = "lb/cuin",
link = "Density",
},
["oz/cuin"] = {
name1 = "ounce per cubic inch",
name2 = "ounces per cubic inch",
symbol = "oz/cu in",
utype = "density",
scale = 1729.9940443876951,
default = "g/cm3",
link = "Density",
},
["g/cm3"] = {
per = { "g", "cm3" },
utype = "density",
default = "lb/cuin",
},
["g/m3"] = {
per = { "g", "m3" },
utype = "density",
default = "lb/cuyd",
link = "Density",
},
["Mg/m3"] = {
per = { "Mg", "m3" },
utype = "density",
default = "lb/cuft",
},
["mg/l"] = {
per = { "mg", "ll" },
utype = "density",
default = "oz/cuin",
},
["μg/dL"] = {
per = { "μg", "dL" },
utype = "density",
default = "lb/cuin",
},
["μg/l"] = {
per = { "μg", "ll" },
utype = "density",
default = "oz/cuin",
},
["lb/ft3"] = {
target = "lb/cuft",
},
["lb/yd3"] = {
target = "lb/cuyd",
},
["lbm/in3"] = {
target = "lbm/cuin",
},
["mcg/dL"] = {
target = "μg/dL",
},
["oz/in3"] = {
target = "oz/cuin",
},
["ug/dL"] = {
target = "μg/dL",
},
["ug/l"] = {
target = "μg/l",
},
["B.O.T.U."] = {
name1 = "Board of Trade Unit",
symbol = "B.O.T.U.",
utype = "energy",
scale = 3600000,
default = "MJ",
link = "Kilowatt-hour",
},
["bboe"] = {
name1 = "barrel of oil equivalent",
name2 = "barrels of oil equivalent",
symbol = "bboe",
utype = "energy",
scale = 6117863200,
default = "GJ",
},
["BOE"] = {
name1 = "barrel of oil equivalent",
name2 = "barrels of oil equivalent",
symbol = "BOE",
utype = "energy",
scale = 6117863200,
default = "GJ",
},
["BTU"] = {
name1 = "British thermal unit",
symbol = "BTU",
utype = "energy",
scale = 1055.05585262,
default = "kJ",
},
["Btu"] = {
name1 = "British thermal unit",
symbol = "Btu",
utype = "energy",
scale = 1055.05585262,
default = "kJ",
},
["BTU-39F"] = {
name1 = "British thermal unit (39°F)",
name2 = "British thermal units (39°F)",
symbol = "BTU<sub>39°F</sub>",
utype = "energy",
scale = 1059.67,
default = "kJ",
link = "British thermal unit",
},
["Btu-39F"] = {
name1 = "British thermal unit (39°F)",
name2 = "British thermal units (39°F)",
symbol = "Btu<sub>39°F</sub>",
utype = "energy",
scale = 1059.67,
default = "kJ",
link = "British thermal unit",
},
["BTU-59F"] = {
name1 = "British thermal unit (59°F)",
name2 = "British thermal units (59°F)",
symbol = "BTU<sub>59°F</sub>",
utype = "energy",
scale = 1054.804,
default = "kJ",
link = "British thermal unit",
},
["Btu-59F"] = {
name1 = "British thermal unit (59°F)",
name2 = "British thermal units (59°F)",
symbol = "Btu<sub>59°F</sub>",
utype = "energy",
scale = 1054.804,
default = "kJ",
link = "British thermal unit",
},
["BTU-60F"] = {
name1 = "British thermal unit (60°F)",
name2 = "British thermal units (60°F)",
symbol = "BTU<sub>60°F</sub>",
utype = "energy",
scale = 1054.68,
default = "kJ",
link = "British thermal unit",
},
["Btu-60F"] = {
name1 = "British thermal unit (60°F)",
name2 = "British thermal units (60°F)",
symbol = "Btu<sub>60°F</sub>",
utype = "energy",
scale = 1054.68,
default = "kJ",
link = "British thermal unit",
},
["BTU-63F"] = {
name1 = "British thermal unit (63°F)",
name2 = "British thermal units (63°F)",
symbol = "BTU<sub>63°F</sub>",
utype = "energy",
scale = 1054.6,
default = "kJ",
link = "British thermal unit",
},
["Btu-63F"] = {
name1 = "British thermal unit (63°F)",
name2 = "British thermal units (63°F)",
symbol = "Btu<sub>63°F</sub>",
utype = "energy",
scale = 1054.6,
default = "kJ",
link = "British thermal unit",
},
["BTU-ISO"] = {
name1 = "British thermal unit (ISO)",
name2 = "British thermal units (ISO)",
symbol = "BTU<sub>ISO</sub>",
utype = "energy",
scale = 1055.056,
default = "kJ",
link = "British thermal unit",
},
["Btu-ISO"] = {
target = "BTU-ISO",
},
["BTU-IT"] = {
name1 = "British thermal unit (IT)",
name2 = "British thermal units (IT)",
symbol = "BTU<sub>IT</sub>",
utype = "energy",
scale = 1055.05585262,
default = "kJ",
link = "British thermal unit",
},
["Btu-IT"] = {
name1 = "British thermal unit (IT)",
name2 = "British thermal units (IT)",
symbol = "Btu<sub>IT</sub>",
utype = "energy",
scale = 1055.05585262,
default = "kJ",
link = "British thermal unit",
},
["BTU-mean"] = {
name1 = "British thermal unit (mean)",
name2 = "British thermal units (mean)",
symbol = "BTU<sub>mean</sub>",
utype = "energy",
scale = 1055.87,
default = "kJ",
link = "British thermal unit",
},
["Btu-mean"] = {
name1 = "British thermal unit (mean)",
name2 = "British thermal units (mean)",
symbol = "Btu<sub>mean</sub>",
utype = "energy",
scale = 1055.87,
default = "kJ",
link = "British thermal unit",
},
["BTU-th"] = {
name1 = "British thermal unit (thermochemical)",
name2 = "British thermal units (thermochemical)",
symbol = "BTU<sub>th</sub>",
utype = "energy",
scale = 1054.35026444,
default = "kJ",
link = "British thermal unit",
},
["Btu-th"] = {
name1 = "British thermal unit (thermochemical)",
name2 = "British thermal units (thermochemical)",
symbol = "Btu<sub>th</sub>",
utype = "energy",
scale = 1054.35026444,
default = "kJ",
link = "British thermal unit",
},
["Cal"] = {
name1 = "calorie",
symbol = "Cal",
utype = "energy",
scale = 4184,
default = "kJ",
},
["cal"] = {
name1 = "calorie",
symbol = "cal",
utype = "energy",
scale = 4.184,
default = "J",
},
["Cal-15"] = {
name1 = "Calorie (15°C)",
name2 = "Calories (15°C)",
symbol = "Cal<sub>15</sub>",
utype = "energy",
scale = 4185.8,
default = "kJ",
link = "Calorie",
},
["cal-15"] = {
name1 = "calorie (15°C)",
name2 = "calories (15°C)",
symbol = "cal<sub>15</sub>",
utype = "energy",
scale = 4.1858,
default = "J",
link = "Calorie",
},
["Cal-IT"] = {
name1 = "Calorie (International Steam Table)",
name2 = "Calories (International Steam Table)",
symbol = "Cal<sub>IT</sub>",
utype = "energy",
scale = 4186.8,
default = "kJ",
link = "Calorie",
},
["cal-IT"] = {
name1 = "calorie (International Steam Table)",
name2 = "calories (International Steam Table)",
symbol = "cal<sub>IT</sub>",
utype = "energy",
scale = 4.1868,
default = "J",
link = "Calorie",
},
["Cal-th"] = {
name1 = "Calorie (thermochemical)",
name2 = "Calories (thermochemical)",
symbol = "Cal<sub>th</sub>",
utype = "energy",
scale = 4184,
default = "kJ",
link = "Calorie",
},
["cal-th"] = {
name1 = "calorie (thermochemical)",
name2 = "calories (thermochemical)",
symbol = "cal<sub>th</sub>",
utype = "energy",
scale = 4.184,
default = "J",
link = "Calorie",
},
["CHU-IT"] = {
name1 = "Celsius heat unit (International Table)",
name2 = "Celsius heat units (International Table)",
symbol = "CHU<sub>IT</sub>",
utype = "energy",
scale = 1899.100534716,
default = "kJ",
link = "Conversion of units#Energy",
},
["cufootnaturalgas"] = {
name1 = "cubic foot of natural gas",
name2 = "cubic foot of natural gas",
symbol = "cuftnaturalgas",
usename = 1,
utype = "energy",
scale = 1055055.85262,
default = "MJ",
link = "Conversion of units#Energy",
},
["cuftnaturalgas"] = {
name1 = "cubic foot of natural gas",
name2 = "cubic feet of natural gas",
symbol = "cuftnaturalgas",
usename = 1,
utype = "energy",
scale = 1055055.85262,
default = "MJ",
link = "Conversion of units#Energy",
},
["Eh"] = {
name1 = "Hartree",
symbol = "''E''<sub>h</sub>",
utype = "energy",
scale = 4.35974417e-18,
default = "eV",
},
["erg"] = {
symbol = "erg",
utype = "energy",
scale = 0.0000001,
default = "μJ",
},
["eV"] = {
_name1 = "electronvolt",
_symbol = "eV",
utype = "energy",
scale = 1.602176634e-19,
prefixes = 1,
default = "aJ",
link = "Electronvolt",
},
["foe"] = {
symbol = "foe",
utype = "energy",
scale = 1e44,
default = "YJ",
link = "Foe (unit)",
},
["ftlb"] = {
name1 = "foot-pound",
symbol = "ft⋅lb",
utype = "energy",
alttype = "torque",
scale = 1.3558179483314004,
default = "J",
link = "Foot-pound (energy)",
},
["ftlb-f"] = {
name1 = "foot-pound force",
name2 = "foot-pounds force",
symbol = "ft⋅lb<sub>f</sub>",
utype = "energy",
alttype = "torque",
scale = 1.3558179483314004,
default = "J",
link = "Foot-pound (energy)",
},
["ftlbf"] = {
name1 = "foot-pound force",
name2 = "foot-pounds force",
symbol = "ft⋅lbf",
utype = "energy",
alttype = "torque",
scale = 1.3558179483314004,
default = "J",
link = "Foot-pound (energy)",
},
["ftpdl"] = {
name1 = "foot-poundal",
symbol = "ft⋅pdl",
utype = "energy",
scale = 0.0421401100938048,
default = "J",
},
["gTNT"] = {
name2 = "grams of TNT",
symbol = "gram of TNT",
usename = 1,
utype = "energy",
scale = 4184,
default = "kJ",
link = "TNT equivalent",
},
["Gtoe"] = {
name1 = "gigatonne of oil equivalent",
name2 = "gigatonnes of oil equivalent",
symbol = "Gtoe",
utype = "energy",
scale = 4.1868e19,
default = "EJ",
link = "Tonne of oil equivalent",
},
["GtonTNT"] = {
name2 = "gigatons of TNT",
symbol = "gigaton of TNT",
usename = 1,
utype = "energy",
scale = 4.184e18,
default = "EJ",
link = "TNT equivalent",
},
["GtTNT"] = {
name2 = "gigatonnes of TNT",
symbol = "gigatonne of TNT",
usename = 1,
utype = "energy",
scale = 4.184e18,
default = "EJ",
link = "TNT equivalent",
},
["GW.h"] = {
name1 = "gigawatt-hour",
symbol = "GW⋅h",
utype = "energy",
scale = 3.6e12,
default = "TJ",
link = "Kilowatt-hour",
},
["GWh"] = {
name1 = "gigawatt-hour",
symbol = "GWh",
utype = "energy",
scale = 3.6e12,
default = "TJ",
link = "Kilowatt-hour",
},
["hph"] = {
name1 = "horsepower-hour",
symbol = "hp⋅h",
utype = "energy",
scale = 2684519.537696172792,
default = "kWh",
link = "Horsepower",
},
["inlb"] = {
name1 = "inch-pound",
symbol = "in⋅lb",
utype = "energy",
alttype = "torque",
scale = 0.1129848290276167,
default = "mJ",
link = "Foot-pound (energy)",
},
["inlb-f"] = {
name1 = "inch-pound force",
name2 = "inch-pounds force",
symbol = "in⋅lb<sub>f</sub>",
utype = "energy",
alttype = "torque",
scale = 0.1129848290276167,
default = "mJ",
link = "Foot-pound (energy)",
},
["inlbf"] = {
name1 = "inch-pound force",
name2 = "inch-pounds force",
symbol = "in⋅lbf",
utype = "energy",
alttype = "torque",
scale = 0.1129848290276167,
default = "mJ",
link = "Foot-pound (energy)",
},
["inoz-f"] = {
name1 = "inch-ounce force",
name2 = "inch-ounces force",
symbol = "in⋅oz<sub>f</sub>",
utype = "energy",
alttype = "torque",
scale = 0.00706155181422604375,
default = "mJ",
link = "Foot-pound (energy)",
},
["inozf"] = {
name1 = "inch-ounce force",
name2 = "inch-ounces force",
symbol = "in⋅ozf",
utype = "energy",
alttype = "torque",
scale = 0.00706155181422604375,
default = "mJ",
link = "Foot-pound (energy)",
},
["J"] = {
_name1 = "joule",
_symbol = "J",
utype = "energy",
scale = 1,
prefixes = 1,
default = "cal",
link = "Joule",
},
["kBOE"] = {
name1 = "kilo barrel of oil equivalent",
name2 = "kilo barrels of oil equivalent",
symbol = "kBOE",
utype = "energy",
scale = 6.1178632e12,
default = "TJ",
link = "Barrel of oil equivalent",
},
["kcal"] = {
name1 = "kilocalorie",
symbol = "kcal",
utype = "energy",
scale = 4184,
default = "kJ",
link = "Calorie",
},
["kcal-15"] = {
name1 = "kilocalorie (15°C)",
name2 = "kilocalories (15°C)",
symbol = "kcal<sub>15</sub>",
utype = "energy",
scale = 4185.8,
default = "kJ",
link = "Calorie",
},
["kcal-IT"] = {
name1 = "kilocalorie (International Steam Table)",
name2 = "kilocalories (International Steam Table)",
symbol = "kcal<sub>IT</sub>",
utype = "energy",
scale = 4186.8,
default = "kJ",
link = "Calorie",
},
["kcal-th"] = {
name1 = "kilocalorie (thermochemical)",
name2 = "kilocalories (thermochemical)",
symbol = "kcal<sub>th</sub>",
utype = "energy",
scale = 4184,
default = "kJ",
link = "Calorie",
},
["kerg"] = {
name1 = "kiloerg",
symbol = "kerg",
utype = "energy",
scale = 0.0001,
default = "mJ",
link = "Erg",
},
["kgTNT"] = {
name2 = "kilograms of TNT",
symbol = "kilogram of TNT",
usename = 1,
utype = "energy",
scale = 4184000,
default = "MJ",
link = "TNT equivalent",
},
["kt(TNT)"] = {
name1 = "kilotonne",
name1_us = "kiloton",
symbol = "kt",
utype = "energy",
scale = 4.184e12,
default = "TJ",
link = "TNT equivalent",
},
["ktoe"] = {
name1 = "kilotonne of oil equivalent",
name2 = "kilotonnes of oil equivalent",
symbol = "ktoe",
utype = "energy",
scale = 4.1868e13,
default = "TJ",
link = "Tonne of oil equivalent",
},
["ktonTNT"] = {
name1 = "kiloton of TNT",
name2 = "kilotons of TNT",
symbol = "kt",
utype = "energy",
scale = 4.184e12,
default = "TJ",
link = "TNT equivalent",
},
["ktTNT"] = {
name2 = "kilotonnes of TNT",
symbol = "kilotonne of TNT",
usename = 1,
utype = "energy",
scale = 4.184e12,
default = "TJ",
link = "TNT equivalent",
},
["kW.h"] = {
name1 = "kilowatt-hour",
symbol = "kW⋅h",
utype = "energy",
scale = 3600000,
default = "MJ",
},
["kWh"] = {
name1 = "kilowatt-hour",
symbol = "kWh",
utype = "energy",
scale = 3600000,
default = "MJ",
},
["Mcal"] = {
name1 = "megacalorie",
symbol = "Mcal",
utype = "energy",
scale = 4184000,
default = "MJ",
link = "Calorie",
},
["mcal"] = {
name1 = "millicalorie",
symbol = "mcal",
utype = "energy",
scale = 0.004184,
default = "mJ",
link = "Calorie",
},
["Mcal-15"] = {
name1 = "megacalorie (15°C)",
name2 = "megacalories (15°C)",
symbol = "Mcal<sub>15</sub>",
utype = "energy",
scale = 4185800,
default = "MJ",
link = "Calorie",
},
["mcal-15"] = {
name1 = "millicalorie (15°C)",
name2 = "millicalories (15°C)",
symbol = "mcal<sub>15</sub>",
utype = "energy",
scale = 0.0041858,
default = "mJ",
link = "Calorie",
},
["Mcal-IT"] = {
name1 = "megacalorie (International Steam Table)",
name2 = "megacalories (International Steam Table)",
symbol = "Mcal<sub>IT</sub>",
utype = "energy",
scale = 4186800,
default = "MJ",
link = "Calorie",
},
["mcal-IT"] = {
name1 = "millicalorie (International Steam Table)",
name2 = "millicalories (International Steam Table)",
symbol = "mcal<sub>IT</sub>",
utype = "energy",
scale = 0.0041868,
default = "mJ",
link = "Calorie",
},
["Mcal-th"] = {
name1 = "megacalorie (thermochemical)",
name2 = "megacalories (thermochemical)",
symbol = "Mcal<sub>th</sub>",
utype = "energy",
scale = 4184000,
default = "MJ",
link = "Calorie",
},
["mcal-th"] = {
name1 = "millicalorie (thermochemical)",
name2 = "millicalories (thermochemical)",
symbol = "mcal<sub>th</sub>",
utype = "energy",
scale = 0.004184,
default = "mJ",
link = "Calorie",
},
["Merg"] = {
name1 = "megaerg",
symbol = "Merg",
utype = "energy",
scale = 0.1,
default = "J",
link = "Erg",
},
["merg"] = {
name1 = "millierg",
symbol = "merg",
utype = "energy",
scale = 0.0000000001,
default = "μJ",
link = "Erg",
},
["MMBtu"] = {
name1 = "million British thermal units",
name2 = "million British thermal units",
symbol = "MMBtu",
utype = "energy",
scale = 1055055852.62,
default = "GJ",
link = "British thermal unit",
},
["Mt(TNT)"] = {
name1 = "megatonne",
name1_us = "megaton",
symbol = "Mt",
utype = "energy",
scale = 4.184e15,
default = "PJ",
link = "TNT equivalent",
},
["Mtoe"] = {
name1 = "megatonne of oil equivalent",
name2 = "megatonnes of oil equivalent",
symbol = "Mtoe",
utype = "energy",
scale = 4.1868e16,
default = "PJ",
link = "Tonne of oil equivalent",
},
["MtonTNT"] = {
name1 = "megaton of TNT",
name2 = "megatons of TNT",
symbol = "Mt",
utype = "energy",
scale = 4.184e15,
default = "PJ",
link = "TNT equivalent",
},
["mtonTNT"] = {
name2 = "millitons of TNT",
symbol = "milliton of TNT",
usename = 1,
utype = "energy",
scale = 4184000,
default = "MJ",
link = "TNT equivalent",
},
["MtTNT"] = {
name2 = "megatonnes of TNT",
symbol = "megatonne of TNT",
usename = 1,
utype = "energy",
scale = 4.184e15,
default = "PJ",
link = "TNT equivalent",
},
["mtTNT"] = {
name2 = "millitonnes of TNT",
symbol = "millitonne of TNT",
usename = 1,
utype = "energy",
scale = 4184000,
default = "MJ",
link = "TNT equivalent",
},
["MW.h"] = {
name1 = "megawatt-hour",
symbol = "MW⋅h",
utype = "energy",
scale = 3600000000,
default = "GJ",
link = "Kilowatt-hour",
},
["mW.h"] = {
name1 = "milliwatt-hour",
symbol = "mW⋅h",
utype = "energy",
scale = 3.6,
default = "J",
link = "Kilowatt-hour",
},
["MWh"] = {
name1 = "megawatt-hour",
symbol = "MWh",
utype = "energy",
scale = 3600000000,
default = "GJ",
link = "Kilowatt-hour",
},
["mWh"] = {
name1 = "milliwatt-hour",
symbol = "mWh",
utype = "energy",
scale = 3.6,
default = "J",
link = "Kilowatt-hour",
},
["PSh"] = {
name1 = "Pferdestärkenstunde",
symbol = "PSh",
utype = "energy",
scale = 2647795.5,
default = "kWh",
},
["quad"] = {
name1 = "quadrillion British thermal units",
name2 = "quadrillion British thermal units",
symbol = "quad",
utype = "energy",
scale = 1.054804e18,
default = "EJ",
link = "Quad (unit)",
},
["Ry"] = {
name1 = "rydberg",
symbol = "Ry",
utype = "energy",
scale = 2.1798741e-18,
default = "eV",
link = "Rydberg constant",
},
["scf"] = {
name1 = "standard cubic foot",
name2 = "standard cubic feet",
symbol = "scf",
utype = "energy",
scale = 2869.2044809344,
default = "kJ",
},
["scfoot"] = {
name1 = "standard cubic foot",
name2 = "standard cubic foot",
symbol = "scf",
utype = "energy",
scale = 2869.2044809344,
default = "kJ",
},
["t(TNT)"] = {
name1 = "tonne",
name1_us = "ton",
symbol = "t",
utype = "energy",
scale = 4184000000,
default = "GJ",
link = "TNT equivalent",
},
["th"] = {
name1 = "thermie",
symbol = "th",
utype = "energy",
scale = 4186800,
default = "MJ",
link = "Conversion of units#Energy",
},
["thm-EC"] = {
name1 = "therm (EC)",
name2 = "therms (EC)",
symbol = "thm (EC)",
utype = "energy",
scale = 105506000,
default = "MJ",
link = "Therm",
},
["thm-UK"] = {
name1 = "therm (UK)",
name2 = "therms (UK)",
symbol = "thm (UK)",
utype = "energy",
scale = 105505585.257348,
default = "MJ",
link = "Therm",
},
["thm-US"] = {
name1 = "therm (US)",
name1_us = "therm (U.S.)",
name2 = "therms (US)",
name2_us = "therms (U.S.)",
symbol = "thm (US)",
sym_us = "thm (U.S.)",
utype = "energy",
scale = 105480400,
default = "MJ",
link = "Therm",
},
["toe"] = {
name1 = "tonne of oil equivalent",
name2 = "tonnes of oil equivalent",
symbol = "toe",
utype = "energy",
scale = 41868000000,
default = "GJ",
},
["tonTNT"] = {
name2 = "tons of TNT",
symbol = "ton of TNT",
usename = 1,
utype = "energy",
scale = 4184000000,
default = "GJ",
link = "TNT equivalent",
},
["tTNT"] = {
name2 = "tonnes of TNT",
symbol = "tonne of TNT",
usename = 1,
utype = "energy",
scale = 4184000000,
default = "GJ",
link = "TNT equivalent",
},
["TtonTNT"] = {
name2 = "teratons of TNT",
symbol = "teraton of TNT",
usename = 1,
utype = "energy",
scale = 4.184e21,
default = "ZJ",
link = "TNT equivalent",
},
["TtTNT"] = {
name2 = "teratonnes of TNT",
symbol = "teratonne of TNT",
usename = 1,
utype = "energy",
scale = 4.184e21,
default = "ZJ",
link = "TNT equivalent",
},
["TW.h"] = {
name1 = "terawatt-hour",
symbol = "TW⋅h",
utype = "energy",
scale = 3.6e15,
default = "PJ",
link = "Kilowatt-hour",
},
["TWh"] = {
name1 = "terawatt-hour",
symbol = "TWh",
utype = "energy",
scale = 3.6e15,
default = "PJ",
link = "Kilowatt-hour",
},
["W.h"] = {
name1 = "watt-hour",
symbol = "W⋅h",
utype = "energy",
scale = 3600,
default = "kJ",
link = "Kilowatt-hour",
},
["Wh"] = {
name1 = "watt-hour",
symbol = "Wh",
utype = "energy",
scale = 3600,
default = "kJ",
link = "Kilowatt-hour",
},
["μerg"] = {
name1 = "microerg",
symbol = "μerg",
utype = "energy",
scale = 1e-13,
default = "nJ",
link = "Erg",
},
["μW.h"] = {
name1 = "microwatt-hour",
symbol = "μW⋅h",
utype = "energy",
scale = 0.0036,
default = "mJ",
link = "Kilowatt-hour",
},
["μWh"] = {
name1 = "microwatt-hour",
symbol = "μWh",
utype = "energy",
scale = 0.0036,
default = "mJ",
link = "Kilowatt-hour",
},
["-kW.h"] = {
target = "kW.h",
link = "Kilowatt hour",
},
["btu"] = {
target = "BTU",
},
["Calorie"] = {
target = "Cal",
},
["ft.lbf"] = {
target = "ftlbf",
},
["ft·lbf"] = {
target = "ftlbf",
},
["g-cal-15"] = {
target = "cal-15",
},
["g-cal-IT"] = {
target = "cal-IT",
},
["g-cal-th"] = {
target = "cal-th",
},
["g-kcal-15"] = {
target = "kcal-15",
},
["g-kcal-IT"] = {
target = "kcal-IT",
},
["g-kcal-th"] = {
target = "kcal-th",
},
["g-Mcal-15"] = {
target = "Mcal-15",
},
["g-mcal-15"] = {
target = "mcal-15",
},
["g-Mcal-IT"] = {
target = "Mcal-IT",
},
["g-mcal-IT"] = {
target = "mcal-IT",
},
["g-Mcal-th"] = {
target = "Mcal-th",
},
["g-mcal-th"] = {
target = "mcal-th",
},
["GW-h"] = {
target = "GW.h",
},
["GW·h"] = {
target = "GW.h",
},
["Hartree"] = {
target = "Eh",
},
["hp.h"] = {
target = "hph",
},
["in.lb-f"] = {
target = "inlb-f",
},
["in.lbf"] = {
target = "inlbf",
},
["in.oz-f"] = {
target = "inoz-f",
},
["in.ozf"] = {
target = "inozf",
},
["kbboe"] = {
target = "kBOE",
symbol = "kbboe",
},
["kg-cal-15"] = {
target = "Cal-15",
},
["kg-cal-IT"] = {
target = "Cal-IT",
},
["kg-cal-th"] = {
target = "Cal-th",
},
["kW-h"] = {
target = "kW.h",
},
["kW·h"] = {
target = "kW.h",
},
["MW-h"] = {
target = "MW.h",
},
["mW-h"] = {
target = "mW.h",
},
["MW·h"] = {
target = "MW.h",
},
["TW-h"] = {
target = "TW.h",
},
["uerg"] = {
target = "μerg",
},
["uW-h"] = {
target = "μW.h",
},
["uW.h"] = {
target = "μW.h",
},
["uWh"] = {
target = "μWh",
},
["W-h"] = {
target = "W.h",
},
["eVpar"] = {
_name1 = "electronvolt",
_symbol = "eV",
utype = "energy per chemical amount",
scale = 96485.332123310014,
prefixes = 1,
default = "kcal/mol",
defkey = "eVpar",
linkey = "eVpar",
link = "Electronvolt",
},
["kcal/mol"] = {
per = { "kcal", "mol" },
utype = "energy per chemical amount",
default = "kJ/mol",
link = "Kilocalorie per mole",
},
["kJ/mol"] = {
per = { "kJ", "mol" },
utype = "energy per chemical amount",
default = "kcal/mol",
link = "Joule per mole",
},
["kWh/100 km"] = {
name1 = "kilowatt-hour per 100 kilometres",
name1_us = "kilowatt-hour per 100 kilometers",
name2 = "kilowatt-hours per 100 kilometres",
name2_us = "kilowatt-hours per 100 kilometers",
symbol = "kW⋅h/100 km",
utype = "energy per unit length",
scale = 36,
default = "MJ/km kWh/mi",
link = "Kilowatt-hour",
},
["kWh/100 mi"] = {
name1 = "kilowatt-hour per 100 miles",
name2 = "kilowatt-hours per 100 miles",
symbol = "kW⋅h/100 mi",
utype = "energy per unit length",
scale = 22.3694,
default = "mpge",
link = "Miles per gallon gasoline equivalent",
},
["MJ/100 km"] = {
name1 = "megajoule per 100 kilometres",
name1_us = "megajoule per 100 kilometers",
name2 = "megajoules per 100 kilometres",
name2_us = "megajoules per 100 kilometers",
symbol = "MJ/100 km",
utype = "energy per unit length",
scale = 10,
default = "BTU/mi",
link = "British thermal unit",
},
["mpge"] = {
name1 = "mile per gallon gasoline equivalent",
name2 = "miles per gallon gasoline equivalent",
symbol = "mpg‑e",
utype = "energy per unit length",
scale = 1.3263314048360777e-5,
invert = -1,
iscomplex= true,
default = "kWh/100 mi",
link = "Miles per gallon gasoline equivalent",
},
["BTU/mi"] = {
per = { "BTU", "mi" },
utype = "energy per unit length",
default = "v > 1525 ! M ! k ! J/km",
},
["kJ/km"] = {
per = { "kJ", "km" },
utype = "energy per unit length",
default = "BTU/mi",
},
["kWh/km"] = {
per = { "-kW.h", "km" },
utype = "energy per unit length",
default = "MJ/km kWh/mi",
},
["kWh/mi"] = {
per = { "-kW.h", "mi" },
utype = "energy per unit length",
default = "kWh/km MJ/km",
},
["MJ/km"] = {
per = { "MJ", "km" },
utype = "energy per unit length",
default = "BTU/mi",
},
["mpg-e"] = {
target = "mpge",
},
["BTU/lb"] = {
name1 = "British thermal unit per pound",
name2 = "British thermal units per pound",
symbol = "BTU/lb",
utype = "energy per unit mass",
scale = 2326,
default = "kJ/kg",
link = "British thermal unit",
},
["cal/g"] = {
name1 = "calorie per gram",
name2 = "calories per gram",
symbol = "cal/g",
utype = "energy per unit mass",
scale = 4184,
default = "J/g",
},
["GJ/kg"] = {
name1 = "gigajoule per kilogram",
name2 = "gigajoules per kilogram",
symbol = "GJ/kg",
utype = "energy per unit mass",
scale = 1e9,
default = "ktTNT/t",
link = "Specific energy",
},
["J/g"] = {
name1 = "joule per gram",
name2 = "joules per gram",
symbol = "J/g",
utype = "energy per unit mass",
scale = 1000,
default = "kcal/g",
link = "Specific energy",
},
["kcal/g"] = {
name1 = "kilocalorie per gram",
name2 = "kilocalories per gram",
symbol = "kcal/g",
utype = "energy per unit mass",
scale = 4184000,
default = "kJ/g",
},
["kJ/g"] = {
name1 = "kilojoule per gram",
name2 = "kilojoules per gram",
symbol = "kJ/g",
utype = "energy per unit mass",
scale = 1000000,
default = "kcal/g",
link = "Specific energy",
},
["kJ/kg"] = {
name1 = "kilojoule per kilogram",
name2 = "kilojoules per kilogram",
symbol = "kJ/kg",
utype = "energy per unit mass",
scale = 1000,
default = "BTU/lb",
link = "Specific energy",
},
["ktonTNT/MT"] = {
name2 = "kilotons of TNT per metric ton",
symbol = "kiloton of TNT per metric ton",
usename = 1,
utype = "energy per unit mass",
scale = 4184000000,
default = "GJ/kg",
link = "TNT equivalent",
},
["ktTNT/t"] = {
name2 = "kilotonnes of TNT per tonne",
symbol = "kilotonne of TNT per tonne",
usename = 1,
utype = "energy per unit mass",
scale = 4184000000,
default = "GJ/kg",
link = "TNT equivalent",
},
["MtonTNT/MT"] = {
name2 = "megatons of TNT per metric ton",
symbol = "megaton of TNT per metric ton",
usename = 1,
utype = "energy per unit mass",
scale = 4.184e12,
default = "TJ/kg",
link = "TNT equivalent",
},
["MtTNT/MT"] = {
name2 = "megatonnes of TNT per tonne",
symbol = "megatonne of TNT per tonne",
usename = 1,
utype = "energy per unit mass",
scale = 4.184e12,
default = "TJ/kg",
link = "TNT equivalent",
},
["TJ/kg"] = {
name1 = "terajoule per kilogram",
name2 = "terajoules per kilogram",
symbol = "TJ/kg",
utype = "energy per unit mass",
scale = 1e12,
default = "MtTNT/MT",
link = "Specific energy",
},
["Cal/g"] = {
per = { "Cal", "g" },
utype = "energy per unit mass",
default = "kJ/g",
},
["BTU/cuft"] = {
per = { "BTU", "cuft" },
utype = "energy per unit volume",
default = "kJ/L",
},
["Cal/12USoz(mL)serve"] = {
per = { "Cal", "-12USoz(mL)serve" },
utype = "energy per unit volume",
default = "kJ/L",
},
["Cal/12USoz(ml)serve"] = {
per = { "Cal", "-12USoz(ml)serve" },
utype = "energy per unit volume",
default = "kJ/l",
},
["Cal/12USozserve"] = {
per = { "Cal", "-12USozserve" },
utype = "energy per unit volume",
default = "kJ/L",
},
["Cal/USoz"] = {
per = { "Cal", "USoz" },
utype = "energy per unit volume",
default = "kJ/ml",
},
["kJ/L"] = {
per = { "kJ", "L" },
utype = "energy per unit volume",
default = "BTU/cuft",
},
["kJ/l"] = {
per = { "kJ", "ll" },
utype = "energy per unit volume",
default = "BTU/cuft",
},
["kJ/ml"] = {
per = { "kJ", "ml" },
utype = "energy per unit volume",
default = "Cal/USoz",
},
["MJ/m3"] = {
per = { "MJ", "m3" },
utype = "energy per unit volume",
default = "BTU/cuft",
},
["Sv"] = {
_name1 = "sievert",
_symbol = "Sv",
utype = "equivalent radiation dose",
scale = 1,
prefixes = 1,
default = "rem",
link = "Sievert",
},
["rem"] = {
_name1 = "rem",
_symbol = "rem",
utype = "equivalent radiation dose",
scale = 0.01,
prefixes = 1,
default = "Sv",
link = "Roentgen equivalent man",
},
["g/km"] = {
name1 = "gram per kilometre",
name1_us = "gram per kilometer",
name2 = "grams per kilometre",
name2_us = "grams per kilometer",
symbol = "g/km",
utype = "exhaust emission",
scale = 1e-6,
default = "oz/mi",
link = "Exhaust gas",
},
["g/mi"] = {
name1 = "gram per mile",
name2 = "grams per mile",
symbol = "g/mi",
utype = "exhaust emission",
scale = 6.2137119223733397e-7,
default = "g/km",
link = "Exhaust gas",
},
["gCO2/km"] = {
name1 = "gram of CO<sub>2</sub> per kilometre",
name1_us = "gram of CO<sub>2</sub> per kilometer",
name2 = "grams of CO<sub>2</sub> per kilometre",
name2_us = "grams of CO<sub>2</sub> per kilometer",
symbol = "g(CO<sub>2</sub>)/km",
utype = "exhaust emission",
scale = 1e-6,
default = "ozCO2/mi",
link = "Exhaust gas",
},
["gCO2/mi"] = {
name1 = "gram of CO<sub>2</sub> per mile",
name2 = "grams of CO<sub>2</sub> per mile",
symbol = "g(CO<sub>2</sub>)/mi",
utype = "exhaust emission",
scale = 6.2137119223733397e-7,
default = "gCO2/km",
link = "Exhaust gas",
},
["kg/km"] = {
name1 = "kilogram per kilometre",
name1_us = "kilogram per kilometer",
name2 = "kilograms per kilometre",
name2_us = "kilograms per kilometer",
symbol = "kg/km",
utype = "exhaust emission",
scale = 0.001,
default = "lb/mi",
link = "Exhaust gas",
},
["kgCO2/km"] = {
name1 = "kilogram of CO<sub>2</sub> per kilometre",
name1_us = "kilogram of CO<sub>2</sub> per kilometer",
name2 = "kilograms of CO<sub>2</sub> per kilometre",
name2_us = "kilograms of CO<sub>2</sub> per kilometer",
symbol = "kg(CO<sub>2</sub>)/km",
utype = "exhaust emission",
scale = 0.001,
default = "lbCO2/mi",
link = "Exhaust gas",
},
["lb/mi"] = {
name1 = "pound per mile",
name2 = "pounds per mile",
symbol = "lb/mi",
utype = "exhaust emission",
scale = 0.00028184923173665794,
default = "kg/km",
link = "Exhaust gas",
},
["lbCO2/mi"] = {
name1 = "pound of CO<sub>2</sub> per mile",
name2 = "pounds of CO<sub>2</sub> per mile",
symbol = "lb(CO<sub>2</sub>)/mi",
utype = "exhaust emission",
scale = 0.00028184923173665794,
default = "kgCO2/km",
link = "Exhaust gas",
},
["oz/mi"] = {
name1 = "ounce per mile",
name2 = "ounces per mile",
symbol = "oz/mi",
utype = "exhaust emission",
scale = 1.7615576983541121e-5,
default = "g/km",
link = "Exhaust gas",
},
["ozCO2/mi"] = {
name1 = "ounce of CO<sub>2</sub> per mile",
name2 = "ounces of CO<sub>2</sub> per mile",
symbol = "oz(CO<sub>2</sub>)/mi",
utype = "exhaust emission",
scale = 1.7615576983541121e-5,
default = "gCO2/km",
link = "Exhaust gas",
},
["cuft/a"] = {
name1 = "cubic foot per annum",
name2 = "cubic feet per annum",
symbol = "cu ft/a",
utype = "flow",
scale = 8.9730672142368242e-10,
default = "m3/a",
link = "Cubic foot per second",
},
["cuft/d"] = {
name1 = "cubic foot per day",
name2 = "cubic feet per day",
symbol = "cu ft/d",
utype = "flow",
scale = 3.2774128000000003e-7,
default = "m3/d",
link = "Cubic foot per second",
},
["cuft/h"] = {
name1 = "cubic foot per hour",
name2 = "cubic feet per hour",
symbol = "cu ft/h",
utype = "flow",
scale = 7.8657907200000004e-6,
default = "m3/h",
link = "Cubic foot per second",
},
["cuft/min"] = {
name1 = "cubic foot per minute",
name2 = "cubic feet per minute",
symbol = "cu ft/min",
utype = "flow",
scale = 0.00047194744319999999,
default = "m3/min",
},
["cuft/s"] = {
name1 = "cubic foot per second",
name2 = "cubic feet per second",
symbol = "cu ft/s",
utype = "flow",
scale = 28316846592e-12,
default = "m3/s",
},
["cumi/a"] = {
name1 = "cubic mile per annum",
name2 = "cubic miles per annum",
symbol = "cu mi/a",
utype = "flow",
scale = 132.08171170940057,
default = "km3/a",
link = "Cubic foot per second",
},
["cuyd/h"] = {
name1 = "cubic yard per hour",
name2 = "cubic yards per hour",
symbol = "cuyd/h",
utype = "flow",
scale = 0.00021237634944000001,
default = "m3/h",
link = "Cubic foot per second",
},
["cuyd/s"] = {
name1 = "cubic yard per second",
name2 = "cubic yards per second",
symbol = "cu yd/s",
utype = "flow",
scale = 0.76455485798400002,
default = "m3/s",
},
["Goilbbl/a"] = {
name1 = "billion barrels per year",
name2 = "billion barrels per year",
symbol = "Gbbl/a",
utype = "flow",
scale = 5.0380033629933836,
default = "v * 1.58987294928 < 10 ! e6 ! e9 ! m3/a",
link = "Barrel per day",
},
["impgal/h"] = {
name1 = "imperial gallon per hour",
name2 = "imperial gallons per hour",
symbol = "imp gal/h",
utype = "flow",
scale = 1.2628027777777779e-6,
default = "m3/h",
link = "Gallon",
},
["impgal/min"] = {
name1 = "imperial gallon per minute",
name2 = "imperial gallons per minute",
symbol = "imp gal/min",
utype = "flow",
scale = 7.5768166666666671e-5,
default = "m3/s",
link = "Gallon",
},
["impgal/s"] = {
name1 = "imperial gallon per second",
name2 = "imperial gallons per second",
symbol = "impgal/s",
utype = "flow",
scale = 0.00454609,
default = "m3/s",
link = "Imperial gallons per second",
},
["km3/a"] = {
name1 = "cubic kilometre per annum",
name1_us = "cubic kilometer per annum",
name2 = "cubic kilometres per annum",
name2_us = "cubic kilometers per annum",
symbol = "km<sup>3</sup>/a",
utype = "flow",
scale = 31.68808781402895,
default = "cumi/a",
link = "Cubic metre per second",
},
["km3/d"] = {
name1 = "cubic kilometre per day",
name1_us = "cubic kilometer per day",
name2 = "cubic kilometres per day",
name2_us = "cubic kilometers per day",
symbol = "km<sup>3</sup>/d",
utype = "flow",
scale = 11574.074074074075,
default = "cuft/d",
link = "Cubic metre per second",
},
["koilbbl/a"] = {
name1 = "thousand barrels per year",
name2 = "thousand barrels per year",
symbol = "kbbl/a",
utype = "flow",
scale = 5.0380033629933841e-6,
default = "v * 1.58987294928 < 10 ! ! e3 ! m3/a",
link = "Barrel per day",
},
["koilbbl/d"] = {
name1 = "thousand barrels per day",
name2 = "thousand barrels per day",
symbol = "kbbl/d",
utype = "flow",
scale = 0.0018401307283333335,
default = "v * 1.58987294928 < 10 ! ! e3 ! m3/d",
link = "Barrel per day",
},
["L/h"] = {
name1 = "litre per hour",
name1_us = "liter per hour",
name2 = "litres per hour",
name2_us = "liters per hour",
symbol = "L/h",
utype = "flow",
scale = 2.7777777777777776e-7,
default = "impgal/h USgal/h",
link = "Cubic metre per second",
},
["L/min"] = {
name1 = "litre per minute",
name1_us = "liter per minute",
name2 = "litres per minute",
name2_us = "liters per minute",
symbol = "L/min",
utype = "flow",
scale = 1.6666666666666667e-5,
default = "impgal/min USgal/min",
link = "Cubic metre per second",
},
["L/s"] = {
name1 = "litre per second",
name1_us = "liter per second",
name2 = "litres per second",
name2_us = "liters per second",
symbol = "L/s",
utype = "flow",
scale = 0.001,
default = "cuft/s",
link = "Cubic metre per second",
},
["m3/a"] = {
name1 = "cubic metre per annum",
name1_us = "cubic meter per annum",
name2 = "cubic metres per annum",
name2_us = "cubic meters per annum",
symbol = "m<sup>3</sup>/a",
utype = "flow",
scale = 3.1688087814028947e-8,
default = "cuft/a",
link = "Cubic metre per second",
},
["m3/d"] = {
name1 = "cubic metre per day",
name1_us = "cubic meter per day",
name2 = "cubic metres per day",
name2_us = "cubic meters per day",
symbol = "m<sup>3</sup>/d",
utype = "flow",
scale = 1.1574074074074073e-5,
default = "cuft/d",
link = "Cubic metre per second",
},
["m3/h"] = {
name1 = "cubic metre per hour",
name1_us = "cubic meter per hour",
name2 = "cubic metres per hour",
name2_us = "cubic meters per hour",
symbol = "m<sup>3</sup>/h",
utype = "flow",
scale = 0.00027777777777777778,
default = "cuft/h",
link = "Cubic metre per second",
},
["m3/min"] = {
name1 = "cubic metre per minute",
name1_us = "cubic meter per minute",
name2 = "cubic metres per minute",
name2_us = "cubic meters per minute",
symbol = "m<sup>3</sup>/min",
utype = "flow",
scale = 0.016666666666666666,
default = "cuft/min",
link = "Cubic metre per second",
},
["m3/s"] = {
name1 = "cubic metre per second",
name1_us = "cubic meter per second",
name2 = "cubic metres per second",
name2_us = "cubic meters per second",
symbol = "m<sup>3</sup>/s",
utype = "flow",
scale = 1,
default = "cuft/s",
},
["Moilbbl/a"] = {
name1 = "million barrels per year",
name2 = "million barrels per year",
symbol = "Mbbl/a",
utype = "flow",
scale = 0.0050380033629933837,
default = "v * 1.58987294928 < 10 ! e3 ! e6 ! m3/a",
link = "Barrel per day",
},
["Moilbbl/d"] = {
name1 = "million barrels per day",
name2 = "million barrels per day",
symbol = "Mbbl/d",
utype = "flow",
scale = 1.8401307283333335,
default = "v * 1.58987294928 < 10 ! e3 ! e6 ! m3/d",
link = "Barrel per day",
},
["oilbbl/a"] = {
name1 = "barrel per year",
name2 = "barrels per year",
symbol = "bbl/a",
utype = "flow",
scale = 5.0380033629933841e-9,
default = "m3/a",
link = "Barrel per day",
},
["oilbbl/d"] = {
name1 = "barrel per day",
name2 = "barrels per day",
symbol = "bbl/d",
utype = "flow",
scale = 1.8401307283333336e-6,
default = "m3/d",
},
["Toilbbl/a"] = {
name1 = "trillion barrels per year",
name2 = "trillion barrels per year",
symbol = "Tbbl/a",
utype = "flow",
scale = 5038.0033629933832,
default = "v * 1.58987294928 < 10 ! e9 ! e12 ! m3/a",
link = "Barrel per day",
},
["U.S.gal/d"] = {
name1 = "U.S. gallon per day",
name2 = "U.S. gallons per day",
symbol = "U.S. gal/d",
utype = "flow",
scale = 4.3812636388888893e-8,
default = "m3/s",
customary= 1,
},
["U.S.gal/h"] = {
name1 = "gallon per hour",
name2 = "gallons per hour",
symbol = "gal/h",
utype = "flow",
scale = 1.0515032733333334e-6,
default = "m3/h",
link = "Gallon",
customary= 2,
},
["U.S.gal/min"] = {
name1 = "U.S. gallon per minute",
name2 = "U.S. gallons per minute",
symbol = "U.S. gal/min",
utype = "flow",
scale = 6.3090196400000003e-5,
default = "m3/s",
link = "Gallon",
},
["USgal/a"] = {
name1 = "US gallon per year",
name2 = "US gallons per year",
symbol = "US gal/a",
utype = "flow",
scale = 1.1995246102365199e-10,
default = "m3/s",
},
["USgal/d"] = {
name1 = "US gallon per day",
name2 = "US gallons per day",
symbol = "US gal/d",
utype = "flow",
scale = 4.3812636388888893e-8,
default = "m3/s",
},
["USgal/h"] = {
name1 = "gallon per hour",
name2 = "gallons per hour",
symbol = "gal/h",
utype = "flow",
scale = 1.0515032733333334e-6,
default = "m3/h",
link = "Gallon",
customary= 1,
},
["USgal/min"] = {
name1 = "US gallon per minute",
name2 = "US gallons per minute",
symbol = "US gal/min",
utype = "flow",
scale = 6.3090196400000003e-5,
default = "m3/s",
link = "Gallon",
},
["USgal/s"] = {
name1 = "US gallon per second",
name1_us = "U.S. gallon per second",
name2 = "US gallons per second",
name2_us = "U.S. gallons per second",
symbol = "USgal/s",
utype = "flow",
scale = 0.003785411784,
default = "m3/s",
link = "US gallons per second",
},
["ft3/a"] = {
target = "cuft/a",
},
["ft3/d"] = {
target = "cuft/d",
},
["ft3/h"] = {
target = "cuft/h",
},
["ft3/s"] = {
target = "cuft/s",
},
["Gcuft/a"] = {
target = "e9cuft/a",
},
["Gcuft/d"] = {
target = "e9cuft/d",
},
["kcuft/a"] = {
target = "e3cuft/a",
},
["kcuft/d"] = {
target = "e3cuft/d",
},
["kcuft/s"] = {
target = "e3cuft/s",
},
["Mcuft/a"] = {
target = "e6cuft/a",
},
["Mcuft/d"] = {
target = "e6cuft/d",
},
["Mcuft/s"] = {
target = "e6cuft/s",
},
["m³/s"] = {
target = "m3/s",
},
["Tcuft/a"] = {
target = "e12cuft/a",
},
["Tcuft/d"] = {
target = "e12cuft/d",
},
["u.s.gal/min"] = {
target = "U.S.gal/min",
},
["usgal/min"] = {
target = "USgal/min",
},
["-LTf"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "LTf",
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["-STf"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "STf",
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["dyn"] = {
name1 = "dyne",
symbol = "dyn",
utype = "force",
scale = 0.00001,
default = "gr-f",
},
["g-f"] = {
name1 = "gram-force",
name2 = "grams-force",
symbol = "g<sub>f</sub>",
utype = "force",
scale = 0.00980665,
default = "mN oz-f",
link = "Kilogram-force",
},
["gf"] = {
name1 = "gram-force",
name2 = "grams-force",
symbol = "gf",
utype = "force",
scale = 0.00980665,
default = "mN ozf",
link = "Kilogram-force",
},
["gr-f"] = {
name1 = "grain-force",
name2 = "grains-force",
symbol = "gr<sub>f</sub>",
utype = "force",
scale = 0.0006354602307515,
default = "μN",
link = "Pound (force)",
},
["grf"] = {
name1 = "grain-force",
name2 = "grains-force",
symbol = "grf",
utype = "force",
scale = 0.0006354602307515,
default = "μN",
link = "Pound (force)",
},
["kdyn"] = {
name1 = "kilodyne",
symbol = "kdyn",
utype = "force",
scale = 0.01,
default = "oz-f",
link = "Dyne",
},
["kg-f"] = {
name1 = "kilogram-force",
name2 = "kilograms-force",
symbol = "kg<sub>f</sub>",
utype = "force",
scale = 9.80665,
default = "N lb-f",
},
["kgf"] = {
name1 = "kilogram-force",
name2 = "kilograms-force",
symbol = "kgf",
utype = "force",
scale = 9.80665,
default = "N lbf",
},
["kp"] = {
name1 = "kilopond",
symbol = "kp",
utype = "force",
scale = 9.80665,
default = "N lb-f",
link = "Kilogram-force",
},
["L/T-f"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "L/T<sub>f</sub>",
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["L/Tf"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "L/Tf",
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["lb-f"] = {
name1 = "pound-force",
name2 = "pounds-force",
symbol = "lb<sub>f</sub>",
utype = "force",
scale = 4.4482216152605,
default = "N",
link = "Pound (force)",
},
["lbf"] = {
name1 = "pound-force",
name2 = "pounds-force",
symbol = "lbf",
utype = "force",
scale = 4.4482216152605,
default = "N",
link = "Pound (force)",
},
["lb(f)"] = {
name1 = "pound",
symbol = "lb",
utype = "force",
scale = 4.4482216152605,
default = "N",
link = "Pound (force)",
},
["LT-f"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "LT<sub>f</sub>",
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["LTf"] = {
name1 = "long ton-force",
name2 = "long tons-force",
symbol = "LTf",
usename = 1,
utype = "force",
scale = 9964.01641818352,
default = "kN",
},
["Mdyn"] = {
name1 = "megadyne",
symbol = "Mdyn",
utype = "force",
scale = 10,
default = "lb-f",
link = "Dyne",
},
["mdyn"] = {
name1 = "millidyne",
symbol = "mdyn",
utype = "force",
scale = 0.00000001,
default = "gr-f",
link = "Dyne",
},
["mg-f"] = {
name1 = "milligram-force",
name2 = "milligrams-force",
symbol = "mg<sub>f</sub>",
utype = "force",
scale = 0.00000980665,
default = "μN gr-f",
link = "Kilogram-force",
},
["mgf"] = {
name1 = "milligram-force",
name2 = "milligrams-force",
symbol = "mgf",
utype = "force",
scale = 0.00000980665,
default = "μN grf",
link = "Kilogram-force",
},
["Mp"] = {
name1 = "megapond",
symbol = "Mp",
utype = "force",
scale = 9806.65,
default = "kN LT-f ST-f",
link = "Kilogram-force",
},
["mp"] = {
name1 = "millipond",
symbol = "mp",
utype = "force",
scale = 0.00000980665,
default = "μN gr-f",
link = "Kilogram-force",
},
["N"] = {
_name1 = "newton",
_symbol = "N",
utype = "force",
scale = 1,
prefixes = 1,
default = "lb-f",
link = "Newton (unit)",
},
["oz-f"] = {
name1 = "ounce-force",
name2 = "ounces-force",
symbol = "oz<sub>f</sub>",
utype = "force",
scale = 0.2780138203095378125,
default = "mN",
link = "Pound (force)",
},
["ozf"] = {
name1 = "ounce-force",
name2 = "ounces-force",
symbol = "ozf",
utype = "force",
scale = 0.2780138203095378125,
default = "mN",
link = "Pound (force)",
},
["p"] = {
name1 = "pond",
symbol = "p",
utype = "force",
scale = 0.00980665,
default = "mN oz-f",
link = "Kilogram-force",
},
["pdl"] = {
name1 = "poundal",
symbol = "pdl",
utype = "force",
scale = 0.138254954376,
default = "N",
},
["S/T-f"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "S/T<sub>f</sub>",
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["S/Tf"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "S/Tf",
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["ST-f"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "ST<sub>f</sub>",
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["STf"] = {
name1 = "short ton-force",
name2 = "short tons-force",
symbol = "STf",
usename = 1,
utype = "force",
scale = 8896.443230521,
default = "kN",
},
["t-f"] = {
name1 = "tonne-force",
name2 = "tonnes-force",
symbol = "t<sub>f</sub>",
utype = "force",
scale = 9806.65,
default = "kN LT-f ST-f",
link = "Ton-force#Tonne-force",
},
["tf"] = {
name1 = "tonne-force",
name2 = "tonnes-force",
symbol = "tf",
utype = "force",
scale = 9806.65,
default = "kN LTf STf",
link = "Ton-force#Tonne-force",
},
["dyne"] = {
target = "dyn",
},
["newtons"] = {
target = "N",
},
["poundal"] = {
target = "pdl",
},
["tonne-force"] = {
target = "tf",
},
["impgal/mi"] = {
per = { "@impgal", "mi" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "L/km USgal/mi",
},
["km/L"] = {
per = { "km", "L" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "mpgimp mpgus",
},
["km/l"] = {
per = { "km", "ll" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "mpgimp mpgus",
},
["L/100 km"] = {
per = { "L", "100km" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "mpgimp mpgus",
symlink = "[[Fuel economy in automobiles#Units of measure|L/100 km]]",
},
["l/100 km"] = {
per = { "ll", "100km" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "mpgimp mpgus",
symlink = "[[Fuel economy in automobiles#Units of measure|l/100 km]]",
},
["L/km"] = {
per = { "L", "km" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "mpgimp mpgus",
},
["l/km"] = {
per = { "ll", "km" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "mpgimp mpgus",
},
["mi/impqt"] = {
per = { "mi", "impqt" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "km/L",
},
["mi/U.S.qt"] = {
per = { "mi", "U.S.qt" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "km/L",
},
["mi/USqt"] = {
per = { "mi", "USqt" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "km/L",
},
["mi/usqt"] = {
per = { "mi", "usqt" },
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "km/L",
},
["mpgimp"] = {
per = { "mi", "@impgal" },
symbol = "mpg<sub>‑imp</sub>",
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "L/100 km+mpgus",
symlink = "[[Fuel economy in automobiles#Units of measure|mpg]]<sub>‑[[Imperial units|imp]]</sub>",
},
["mpgus"] = {
per = { "mi", "+USgal" },
symbol = "mpg<sub>‑US</sub>",
utype = "fuel efficiency",
invert = -1,
iscomplex= true,
default = "L/100 km+mpgimp",
symlink = "[[Fuel economy in automobiles#Units of measure|mpg]]<sub>‑[[United States customary units|US]]</sub>",
},
["U.S.gal/mi"] = {
per = { "*U.S.gal", "mi" },
sp_us = true,
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "L/km impgal/mi",
},
["usgal/mi"] = {
per = { "+USgal", "mi" },
utype = "fuel efficiency",
invert = 1,
iscomplex= true,
default = "L/km impgal/mi",
},
["L/100km"] = {
target = "L/100 km",
},
["l/100km"] = {
target = "l/100 km",
},
["mpg"] = {
shouldbe = "Use %{mpgus%} for miles per US gallon or %{mpgimp%} for miles per imperial gallon (not %{mpg%})",
},
["mpgU.S."] = {
target = "mpgus",
symbol = "mpg<sub>‑U.S.</sub>",
sp_us = true,
symlink = "[[Fuel economy in automobiles#Units of measure|mpg]]<sub>‑[[United States customary units|U.S.]]</sub>",
},
["mpgu.s."] = {
target = "mpgus",
symbol = "mpg<sub>‑U.S.</sub>",
sp_us = true,
symlink = "[[Fuel economy in automobiles#Units of measure|mpg]]<sub>‑[[United States customary units|U.S.]]</sub>",
},
["mpgUS"] = {
target = "mpgus",
},
["USgal/mi"] = {
target = "usgal/mi",
},
["kPa/m"] = {
per = { "kPa", "-m-frac" },
utype = "fracture gradient",
default = "psi/ft",
},
["psi/ft"] = {
per = { "psi", "-ft-frac" },
utype = "fracture gradient",
default = "kPa/m",
},
["cm/km"] = {
name1 = "centimetre per kilometre",
name1_us = "centimeter per kilometer",
name2 = "centimetres per kilometre",
name2_us = "centimeters per kilometer",
symbol = "cm/km",
utype = "gradient",
scale = 0.00001,
default = "ft/mi",
link = "Grade (slope)",
},
["ft/mi"] = {
name1 = "foot per mile",
name2 = "feet per mile",
symbol = "ft/mi",
utype = "gradient",
scale = 0.00018939393939393939,
default = "v < 5.28 ! c ! ! m/km",
link = "Grade (slope)",
},
["ft/nmi"] = {
name1 = "foot per nautical mile",
name2 = "feet per nautical mile",
symbol = "ft/nmi",
utype = "gradient",
scale = 0.00016457883369330455,
default = "v < 6.076 ! c ! ! m/km",
link = "Grade (slope)",
},
["in/ft"] = {
name1 = "inch per foot",
name2 = "inches per foot",
symbol = "in/ft",
utype = "gradient",
scale = 0.083333333333333329,
default = "mm/m",
link = "Grade (slope)",
},
["in/mi"] = {
name1 = "inch per mile",
name2 = "inches per mile",
symbol = "in/mi",
utype = "gradient",
scale = 1.5782828282828283e-5,
default = "v < 0.6336 ! m ! c ! m/km",
link = "Grade (slope)",
},
["m/km"] = {
name1 = "metre per kilometre",
name1_us = "meter per kilometer",
name2 = "metres per kilometre",
name2_us = "meters per kilometer",
symbol = "m/km",
utype = "gradient",
scale = 0.001,
default = "ft/mi",
link = "Grade (slope)",
},
["mm/km"] = {
name1 = "millimetre per kilometre",
name1_us = "millimeter per kilometer",
name2 = "millimetres per kilometre",
name2_us = "millimeters per kilometer",
symbol = "mm/km",
utype = "gradient",
scale = 0.000001,
default = "in/mi",
link = "Grade (slope)",
},
["mm/m"] = {
name1 = "millimetre per metre",
name1_us = "millimeter per meter",
name2 = "millimetres per metre",
name2_us = "millimeters per meter",
symbol = "mm/m",
utype = "gradient",
scale = 0.001,
default = "in/ft",
link = "Grade (slope)",
},
["admi"] = {
name1 = "admiralty mile",
symbol = "nmi (admiralty)",
utype = "length",
scale = 1853.184,
default = "km mi",
link = "Nautical mile",
},
["AU"] = {
name1 = "astronomical unit",
symbol = "AU",
utype = "length",
scale = 149597870700,
default = "km mi",
},
["Brnmi"] = {
name1 = "British nautical mile",
symbol = "(Brit) nmi",
utype = "length",
scale = 1853.184,
default = "km mi",
link = "Nautical mile",
},
["bu"] = {
name2 = "bu",
symbol = "bu",
usename = 1,
utype = "length",
scale = 0.0030303030303030303,
default = "mm",
link = "Japanese units of measurement#Length",
},
["ch"] = {
name1 = "chain",
symbol = "ch",
utype = "length",
scale = 20.1168,
default = "ft m",
subdivs = { ["ft"] = { 66, default = "m" }, ["yd"] = { 22, default = "m" } },
link = "Chain (unit)",
},
["chlk"] = {
name1 = "[[Chain (unit)|chain]]",
symbol = "[[Chain (unit)|ch]]",
utype = "length",
scale = 20.1168,
default = "ft m",
link = "",
},
["chain"] = {
symbol = "chain",
usename = 1,
utype = "length",
scale = 20.1168,
default = "ft m",
subdivs = { ["ft"] = { 66, default = "m" }, ["yd"] = { 22, default = "m" } },
link = "Chain (unit)",
},
["chainlk"] = {
symbol = "[[Chain (unit)|chain]]",
usename = 1,
utype = "length",
scale = 20.1168,
default = "ft m",
link = "",
},
["dpcm"] = {
name2 = "dot/cm",
symbol = "dot/cm",
utype = "length",
scale = 100,
invert = -1,
iscomplex= true,
default = "dpi",
link = "Dots per inch",
},
["dpi"] = {
name2 = "DPI",
symbol = "DPI",
utype = "length",
scale = 39.370078740157481,
invert = -1,
iscomplex= true,
default = "pitch",
link = "Dots per inch",
},
["fathom"] = {
symbol = "fathom",
usename = 1,
utype = "length",
scale = 1.8288,
default = "ft m",
},
["foot"] = {
name1 = "foot",
name2 = "foot",
symbol = "ft",
utype = "length",
scale = 0.3048,
default = "m",
subdivs = { ["in"] = { 12, default = "m" } },
link = "Foot (unit)",
},
["ft"] = {
name1 = "foot",
name2 = "feet",
symbol = "ft",
utype = "length",
scale = 0.3048,
exception= "integer_more_precision",
default = "m",
subdivs = { ["in"] = { 12, default = "m" } },
link = "Foot (unit)",
},
["furlong"] = {
symbol = "furlong",
usename = 1,
utype = "length",
scale = 201.168,
default = "ft m",
},
["Gly"] = {
name1 = "gigalight-year",
symbol = "Gly",
utype = "length",
scale = 9.4607304725808e24,
default = "Mpc",
link = "Light-year#Definitions",
},
["Gpc"] = {
name1 = "gigaparsec",
symbol = "Gpc",
utype = "length",
scale = 3.0856775814671916e25,
default = "Gly",
link = "Parsec#Megaparsecs and gigaparsecs",
},
["hand"] = {
name1 = "hand",
symbol = "h",
utype = "length",
builtin = "hand",
scale = 0.1016,
iscomplex= true,
default = "in cm",
link = "Hand (unit)",
},
["in"] = {
name1 = "inch",
name2 = "inches",
symbol = "in",
utype = "length",
scale = 0.0254,
exception= "subunit_more_precision",
default = "mm",
},
["inabbreviated"] = {
name2 = "in",
symbol = "in",
utype = "length",
scale = 0.0254,
default = "mm",
link = "Inch",
},
["kly"] = {
name1 = "kilolight-year",
symbol = "kly",
utype = "length",
scale = 9.4607304725808e18,
default = "pc",
link = "Light-year#Definitions",
},
["kpc"] = {
name1 = "kiloparsec",
symbol = "kpc",
utype = "length",
scale = 3.0856775814671916e19,
default = "kly",
link = "Parsec#Parsecs and kiloparsecs",
},
["LD"] = {
name1 = "lunar distance",
symbol = "LD",
utype = "length",
scale = 384403000,
default = "km mi",
link = "Lunar distance (astronomy)",
},
["league"] = {
symbol = "league",
usename = 1,
utype = "length",
scale = 4828.032,
default = "km",
link = "League (unit)",
},
["ly"] = {
name1 = "light-year",
symbol = "ly",
utype = "length",
scale = 9.4607304725808e15,
default = "AU",
},
["m"] = {
_name1 = "metre",
_name1_us= "meter",
_symbol = "m",
utype = "length",
scale = 1,
prefixes = 1,
default = "v > 0 and v < 3 ! ftin ! ft",
link = "Metre",
},
["mi"] = {
name1 = "mile",
symbol = "mi",
utype = "length",
scale = 1609.344,
default = "km",
subdivs = { ["ch"] = { 80, default = "km" }, ["chlk"] = { 80, default = "km" }, ["chain"] = { 80, default = "km" }, ["chainlk"] = { 80, default = "km" }, ["ft"] = { 5280, default = "km" }, ["furlong"] = { 8, default = "km" }, ["yd"] = { 1760, default = "km" } },
},
["mil"] = {
symbol = "mil",
usename = 1,
utype = "length",
scale = 0.0000254,
default = "mm",
link = "Thousandth of an inch",
},
["Mly"] = {
name1 = "megalight-year",
symbol = "Mly",
utype = "length",
scale = 9.4607304725808e21,
default = "kpc",
link = "Light-year#Definitions",
},
["Mpc"] = {
name1 = "megaparsec",
symbol = "Mpc",
utype = "length",
scale = 3.0856775814671916e22,
default = "Mly",
link = "Parsec#Megaparsecs and gigaparsecs",
},
["NM"] = {
name1 = "nautical mile",
symbol = "NM",
utype = "length",
scale = 1852,
default = "km mi",
},
["nmi"] = {
name1 = "nautical mile",
symbol = "nmi",
utype = "length",
scale = 1852,
default = "km mi",
},
["oldUKnmi"] = {
name1 = "nautical mile",
symbol = "nmi",
utype = "length",
scale = 1853.184,
default = "km mi",
},
["oldUSnmi"] = {
name1 = "nautical mile",
symbol = "nmi",
utype = "length",
scale = 1853.24496,
default = "km mi",
},
["pc"] = {
name1 = "parsec",
symbol = "pc",
utype = "length",
scale = 3.0856775814671916e16,
default = "ly",
},
["perch"] = {
name2 = "perches",
symbol = "perch",
usename = 1,
utype = "length",
scale = 5.0292,
default = "ft m",
link = "Rod (unit)",
},
["pitch"] = {
name2 = "μm",
symbol = "μm",
utype = "length",
scale = 1e-6,
default = "dpi",
defkey = "pitch",
linkey = "pitch",
link = "Dots per inch",
},
["pole"] = {
symbol = "pole",
usename = 1,
utype = "length",
scale = 5.0292,
default = "ft m",
link = "Rod (unit)",
},
["pre1954U.S.nmi"] = {
name1 = "(pre-1954 U.S.) nautical mile",
symbol = "(pre‑1954 U.S.) nmi",
utype = "length",
scale = 1853.24496,
default = "km mi",
link = "Nautical mile",
},
["pre1954USnmi"] = {
name1 = "(pre-1954 US) nautical mile",
name1_us = "(pre-1954 U.S.) nautical mile",
symbol = "(pre‑1954 US) nmi",
sym_us = "(pre‑1954 U.S.) nmi",
utype = "length",
scale = 1853.24496,
default = "km mi",
link = "Nautical mile",
},
["rd"] = {
name1 = "rod",
symbol = "rd",
utype = "length",
scale = 5.0292,
default = "ft m",
link = "Rod (unit)",
},
["royal cubit"] = {
name1 = "royal cubit",
symbol = "cu",
utype = "length",
scale = 0.524,
default = "mm",
},
["rtkm"] = {
name1 = "route kilometre",
name1_us = "route kilometer",
symbol = "km",
utype = "length",
scale = 1000,
default = "mi",
link = "Kilometre",
},
["rtmi"] = {
name1 = "route mile",
symbol = "mi",
utype = "length",
scale = 1609.344,
default = "km",
link = "Mile",
},
["shaku"] = {
name2 = "shaku",
symbol = "shaku",
usename = 1,
utype = "length",
scale = 0.30303030303030304,
default = "m",
link = "Shaku (unit)",
},
["sm"] = {
name1 = "smoot",
symbol = "sm",
utype = "length",
scale = 1.70180,
default = "m",
link = "Smoot (unit)",
},
["smi"] = {
name1 = "statute mile",
symbol = "mi",
utype = "length",
scale = 1609.344,
default = "km",
subdivs = { ["chain"] = { 80, default = "km" } },
},
["solar radius"] = {
name1 = "solar radius",
name2 = "solar radii",
symbol = "''R''<sub>☉</sub>",
utype = "length",
scale = 695700e3,
default = "km",
},
["sun"] = {
name2 = "sun",
symbol = "sun",
usename = 1,
utype = "length",
scale = 0.030303030303030304,
default = "mm",
link = "Japanese units of measurement#Length",
},
["thou"] = {
name2 = "thou",
symbol = "thou",
usename = 1,
utype = "length",
scale = 0.0000254,
default = "mm",
link = "Thousandth of an inch",
},
["verst"] = {
symbol = "verst",
usename = 1,
utype = "length",
scale = 1066.8,
default = "km mi",
},
["yd"] = {
name1 = "yard",
symbol = "yd",
utype = "length",
scale = 0.9144,
default = "m",
subdivs = { ["ft"] = { 3, default = "m" } },
},
["μin"] = {
name1 = "microinch",
name2 = "microinches",
symbol = "μin",
utype = "length",
scale = 0.0000000254,
default = "nm",
link = "SI prefix#Non-metric units",
},
["Å"] = {
name1 = "ångström",
symbol = "Å",
utype = "length",
scale = 0.0000000001,
default = "in",
},
["Hz"] = {
_name1 = "hertz",
_name2 = "hertz",
_symbol = "Hz",
utype = "length",
scale = 3.3356409519815204e-9,
invert = -1,
iscomplex= true,
prefixes = 1,
default = "m",
link = "Hertz",
},
["rpm"] = {
name1 = "revolution per minute",
name2 = "revolutions per minute",
symbol = "rpm",
utype = "length",
scale = 5.5594015866358675e-11,
invert = -1,
iscomplex= true,
default = "Hz",
link = "Revolutions per minute",
},
["-ft-frac"] = {
target = "ft",
link = "Fracture gradient",
},
["-in-stiff"] = {
target = "in",
link = "Stiffness",
},
["-m-frac"] = {
target = "m",
link = "Fracture gradient",
},
["-m-stiff"] = {
target = "m",
link = "Stiffness",
},
["100km"] = {
target = "km",
multiplier= 100,
},
["100mi"] = {
target = "mi",
multiplier= 100,
},
["100miles"] = {
target = "mi",
symbol = "miles",
multiplier= 100,
},
["admiralty nmi"] = {
target = "oldUKnmi",
},
["angstrom"] = {
target = "Å",
},
["au"] = {
target = "AU",
symbol = "au",
},
["feet"] = {
target = "ft",
},
["hands"] = {
target = "hand",
},
["inch"] = {
target = "in",
},
["inches"] = {
target = "in",
},
["light-year"] = {
target = "ly",
},
["meter"] = {
target = "m",
sp_us = true,
},
["meters"] = {
target = "m",
sp_us = true,
},
["metre"] = {
target = "m",
},
["metres"] = {
target = "m",
},
["micrometre"] = {
target = "μm",
},
["micron"] = {
target = "μm",
default = "μin",
},
["mile"] = {
target = "mi",
usename = 1,
},
["miles"] = {
target = "mi",
usename = 1,
},
["parsec"] = {
target = "pc",
},
["rod"] = {
target = "rd",
},
["smoot"] = {
target = "sm",
},
["uin"] = {
target = "μin",
},
["yard"] = {
target = "yd",
},
["yards"] = {
target = "yd",
},
["yds"] = {
target = "yd",
},
["dtex"] = {
name1 = "decitex",
name2 = "decitex",
symbol = "dtex",
utype = "linear density",
scale = 1e-7,
default = "lb/yd",
link = "Units of textile measurement#Units",
},
["kg/cm"] = {
name1 = "kilogram per centimetre",
name1_us = "kilogram per centimeter",
name2 = "kilograms per centimetre",
name2_us = "kilograms per centimeter",
symbol = "kg/cm",
utype = "linear density",
scale = 100,
default = "lb/yd",
link = "Linear density",
},
["kg/m"] = {
name1 = "kilogram per metre",
name1_us = "kilogram per meter",
name2 = "kilograms per metre",
name2_us = "kilograms per meter",
symbol = "kg/m",
utype = "linear density",
scale = 1,
default = "lb/yd",
link = "Linear density",
},
["lb/ft"] = {
name1 = "pound per foot",
name2 = "pounds per foot",
symbol = "lb/ft",
utype = "linear density",
scale = 1.4881639435695539,
default = "kg/m",
link = "Linear density",
},
["lb/yd"] = {
name1 = "pound per yard",
name2 = "pounds per yard",
symbol = "lb/yd",
utype = "linear density",
scale = 0.49605464785651798,
default = "kg/m",
link = "Linear density",
},
["G"] = {
_name1 = "gauss",
_name2 = "gauss",
_symbol = "G",
utype = "magnetic field strength",
scale = 0.0001,
prefixes = 1,
default = "T",
link = "Gauss (unit)",
},
["T"] = {
_name1 = "tesla",
_symbol = "T",
utype = "magnetic field strength",
scale = 1,
prefixes = 1,
default = "G",
link = "Tesla (unit)",
},
["A/m"] = {
name1 = "ampere per metre",
name1_us = "ampere per meter",
name2 = "amperes per metre",
name2_us = "amperes per meter",
symbol = "A/m",
utype = "magnetizing field",
scale = 1,
default = "Oe",
},
["kA/m"] = {
name1 = "kiloampere per metre",
name1_us = "kiloampere per meter",
name2 = "kiloamperes per metre",
name2_us = "kiloamperes per meter",
symbol = "kA/m",
utype = "magnetizing field",
scale = 1000,
default = "kOe",
link = "Ampere per metre",
},
["MA/m"] = {
name1 = "megaampere per metre",
name1_us = "megaampere per meter",
name2 = "megaamperes per metre",
name2_us = "megaamperes per meter",
symbol = "MA/m",
utype = "magnetizing field",
scale = 1e6,
default = "kOe",
link = "Ampere per metre",
},
["Oe"] = {
_name1 = "oersted",
_symbol = "Oe",
utype = "magnetizing field",
scale = 79.5774715,
prefixes = 1,
default = "kA/m",
link = "Oersted",
},
["-Lcwt"] = {
name1 = "hundredweight",
name2 = "hundredweight",
symbol = "cwt",
utype = "mass",
scale = 50.80234544,
default = "lb",
},
["-Scwt"] = {
name1 = "hundredweight",
name2 = "hundredweight",
symbol = "cwt",
utype = "mass",
scale = 45.359237,
default = "lb",
},
["-ST"] = {
name1 = "short ton",
symbol = "ST",
utype = "mass",
scale = 907.18474,
default = "t",
},
["carat"] = {
symbol = "carat",
usename = 1,
utype = "mass",
scale = 0.0002,
default = "g",
link = "Carat (mass)",
},
["Da"] = {
_name1 = "dalton",
_symbol = "Da",
utype = "mass",
scale = 1.66053906892e-27,
prefixes = 1,
default = "kg",
link = "Dalton (unit)",
},
["drachm"] = {
name1_us = "dram",
symbol = "drachm",
usename = 1,
utype = "mass",
scale = 0.001771845195,
default = "g",
link = "Dram (unit)",
},
["dram"] = {
target = "drachm",
},
["dwt"] = {
name1 = "pennyweight",
symbol = "dwt",
utype = "mass",
scale = 0.00155517384,
default = "oz g",
},
["DWton"] = {
symbol = "deadweight ton",
usename = 1,
utype = "mass",
scale = 1016.0469088,
default = "DWtonne",
link = "Deadweight tonnage",
},
["DWtonne"] = {
name1_us = "deadweight metric ton",
symbol = "deadweight tonne",
sym_us = "~deadweight metric ton",
usename = 1,
utype = "mass",
scale = 1000,
default = "DWton",
link = "Deadweight tonnage",
},
["g"] = {
_name1 = "gram",
_symbol = "g",
utype = "mass",
scale = 0.001,
prefixes = 1,
default = "oz",
link = "Gram",
},
["gr"] = {
name1 = "grain",
symbol = "gr",
utype = "mass",
scale = 0.00006479891,
default = "g",
link = "Grain (unit)",
},
["Gt"] = {
name1 = "gigatonne",
symbol = "Gt",
utype = "mass",
scale = 1000000000000,
default = "LT ST",
link = "Tonne",
},
["impgalh2o"] = {
name1 = "imperial gallon of water",
name2 = "imperial gallons of water",
symbol = "imp gal H<sub>2</sub>O",
utype = "mass",
scale = 4.5359236999999499,
default = "lb kg",
link = "Imperial gallon",
},
["kt"] = {
name1 = "kilotonne",
symbol = "kt",
utype = "mass",
scale = 1000000,
default = "LT ST",
link = "Tonne",
},
["lb"] = {
name1 = "pound",
symbol = "lb",
utype = "mass",
scale = 0.45359237,
exception= "integer_more_precision",
default = "kg",
subdivs = { ["oz"] = { 16, default = "kg" } },
link = "Pound (mass)",
},
["Lcwt"] = {
name1 = "long hundredweight",
name2 = "long hundredweight",
symbol = "Lcwt",
usename = 1,
utype = "mass",
scale = 50.80234544,
default = "lb",
subdivs = { ["qtr"] = { 4, default = "kg" }, ["st"] = { 8, default = "kg" } },
link = "Hundredweight",
},
["long cwt"] = {
name1 = "long hundredweight",
name2 = "long hundredweight",
symbol = "long cwt",
utype = "mass",
scale = 50.80234544,
default = "lb kg",
subdivs = { ["qtr"] = { 4, default = "kg" } },
link = "Hundredweight",
},
["long qtr"] = {
name1 = "long quarter",
symbol = "long qtr",
utype = "mass",
scale = 12.70058636,
default = "lb kg",
},
["LT"] = {
symbol = "long ton",
usename = 1,
utype = "mass",
scale = 1016.0469088,
default = "t",
subdivs = { ["Lcwt"] = { 20, default = "t", unit = "-Lcwt" } },
},
["lt"] = {
name1 = "long ton",
symbol = "LT",
utype = "mass",
scale = 1016.0469088,
default = "t",
subdivs = { ["Lcwt"] = { 20, default = "t", unit = "-Lcwt" } },
},
["metric ton"] = {
symbol = "metric ton",
usename = 1,
utype = "mass",
scale = 1000,
default = "long ton",
link = "Tonne",
},
["MT"] = {
name1 = "metric ton",
symbol = "t",
utype = "mass",
scale = 1000,
default = "LT ST",
link = "Tonne",
},
["Mt"] = {
name1 = "megatonne",
symbol = "Mt",
utype = "mass",
scale = 1000000000,
default = "LT ST",
link = "Tonne",
},
["oz"] = {
name1 = "ounce",
symbol = "oz",
utype = "mass",
scale = 0.028349523125,
default = "g",
},
["ozt"] = {
name1 = "troy ounce",
symbol = "ozt",
utype = "mass",
scale = 0.0311034768,
default = "oz g",
},
["pdr"] = {
name1 = "pounder",
symbol = "pdr",
utype = "mass",
scale = 0.45359237,
default = "kg",
link = "Pound (mass)",
},
["qtr"] = {
name1 = "quarter",
symbol = "qtr",
utype = "mass",
scale = 12.70058636,
default = "lb kg",
subdivs = { ["lb"] = { 28, default = "kg" } },
link = "Long quarter",
},
["Scwt"] = {
name1 = "short hundredweight",
name2 = "short hundredweight",
symbol = "Scwt",
usename = 1,
utype = "mass",
scale = 45.359237,
default = "lb",
link = "Hundredweight",
},
["short cwt"] = {
name1 = "short hundredweight",
name2 = "short hundredweight",
symbol = "short cwt",
utype = "mass",
scale = 45.359237,
default = "lb kg",
link = "Hundredweight",
},
["short qtr"] = {
name1 = "short quarter",
symbol = "short qtr",
utype = "mass",
scale = 11.33980925,
default = "lb kg",
},
["ST"] = {
symbol = "short ton",
usename = 1,
utype = "mass",
scale = 907.18474,
default = "t",
subdivs = { ["Scwt"] = { 20, default = "t", unit = "-Scwt" } },
},
["shtn"] = {
name1 = "short ton",
symbol = "sh tn",
utype = "mass",
scale = 907.18474,
default = "t",
},
["shton"] = {
symbol = "ton",
usename = 1,
utype = "mass",
scale = 907.18474,
default = "t",
},
["solar mass"] = {
name1 = "solar mass",
name2 = "solar masses",
symbol = "''M''<sub>☉</sub>",
utype = "mass",
scale = 1.98855e30,
default = "kg",
},
["st"] = {
name1 = "stone",
name2 = "stone",
symbol = "st",
utype = "mass",
scale = 6.35029318,
default = "lb kg",
subdivs = { ["lb"] = { 14, default = "kg lb" } },
link = "Stone (unit)",
},
["t"] = {
name1 = "tonne",
name1_us = "metric ton",
symbol = "t",
utype = "mass",
scale = 1000,
default = "LT ST",
},
["tonne"] = {
name1 = "tonne",
name1_us = "metric ton",
symbol = "t",
utype = "mass",
scale = 1000,
default = "shton",
},
["troy pound"] = {
symbol = "troy pound",
usename = 1,
utype = "mass",
scale = 0.3732417216,
default = "lb kg",
link = "Troy weight",
},
["usgalh2o"] = {
name1 = "US gallon of water",
name1_us = "U.S. gallon of water",
name2 = "US gallons of water",
name2_us = "U.S. gallons of water",
symbol = "US gal H<sub>2</sub>O",
utype = "mass",
scale = 3.7776215836051126,
default = "lb kg",
link = "United States customary units#Fluid volume",
},
["viss"] = {
name2 = "viss",
symbol = "viss",
utype = "mass",
scale = 1.632932532,
default = "kg",
link = "Myanmar units of measurement#Mass",
},
["billion tonne"] = {
target = "e9t",
},
["grain"] = {
target = "gr",
},
["kilogram"] = {
target = "kg",
},
["kilotonne"] = {
target = "kt",
},
["lbs"] = {
target = "lb",
},
["lbt"] = {
target = "troy pound",
},
["lcwt"] = {
target = "Lcwt",
},
["long ton"] = {
target = "LT",
},
["mcg"] = {
target = "μg",
},
["million tonne"] = {
target = "e6t",
},
["scwt"] = {
target = "Scwt",
},
["short ton"] = {
target = "ST",
},
["stone"] = {
target = "st",
},
["thousand tonne"] = {
target = "e3t",
},
["tonnes"] = {
target = "t",
},
["kg/kW"] = {
name1 = "kilogram per kilowatt",
name2 = "kilograms per kilowatt",
symbol = "kg/kW",
utype = "mass per unit power",
scale = 0.001,
default = "lb/hp",
link = "Kilowatt",
},
["lb/hp"] = {
name1 = "pound per horsepower",
name2 = "pounds per horsepower",
symbol = "lb/hp",
utype = "mass per unit power",
scale = 0.00060827738784176115,
default = "kg/kW",
link = "Horsepower",
},
["kg/h"] = {
per = { "kg", "h" },
utype = "mass per unit time",
default = "lb/h",
},
["lb/h"] = {
per = { "lb", "h" },
utype = "mass per unit time",
default = "kg/h",
},
["g-mol/d"] = {
name1 = "gram-mole per day",
name2 = "gram-moles per day",
symbol = "g‑mol/d",
utype = "molar rate",
scale = 1.1574074074074073e-5,
default = "μmol/s",
link = "Mole (unit)",
},
["g-mol/h"] = {
name1 = "gram-mole per hour",
name2 = "gram-moles per hour",
symbol = "g‑mol/h",
utype = "molar rate",
scale = 0.00027777777777777778,
default = "mmol/s",
link = "Mole (unit)",
},
["g-mol/min"] = {
name1 = "gram-mole per minute",
name2 = "gram-moles per minute",
symbol = "g‑mol/min",
utype = "molar rate",
scale = 0.016666666666666666,
default = "g-mol/s",
link = "Mole (unit)",
},
["g-mol/s"] = {
name1 = "gram-mole per second",
name2 = "gram-moles per second",
symbol = "g‑mol/s",
utype = "molar rate",
scale = 1,
default = "lb-mol/min",
link = "Mole (unit)",
},
["gmol/d"] = {
name1 = "gram-mole per day",
name2 = "gram-moles per day",
symbol = "gmol/d",
utype = "molar rate",
scale = 1.1574074074074073e-5,
default = "μmol/s",
link = "Mole (unit)",
},
["gmol/h"] = {
name1 = "gram-mole per hour",
name2 = "gram-moles per hour",
symbol = "gmol/h",
utype = "molar rate",
scale = 0.00027777777777777778,
default = "mmol/s",
link = "Mole (unit)",
},
["gmol/min"] = {
name1 = "gram-mole per minute",
name2 = "gram-moles per minute",
symbol = "gmol/min",
utype = "molar rate",
scale = 0.016666666666666666,
default = "gmol/s",
link = "Mole (unit)",
},
["gmol/s"] = {
name1 = "gram-mole per second",
name2 = "gram-moles per second",
symbol = "gmol/s",
utype = "molar rate",
scale = 1,
default = "lbmol/min",
link = "Mole (unit)",
},
["kmol/d"] = {
name1 = "kilomole per day",
name2 = "kilomoles per day",
symbol = "kmol/d",
utype = "molar rate",
scale = 0.011574074074074073,
default = "mmol/s",
link = "Mole (unit)",
},
["kmol/h"] = {
name1 = "kilomole per hour",
name2 = "kilomoles per hour",
symbol = "kmol/h",
utype = "molar rate",
scale = 0.27777777777777779,
default = "mol/s",
link = "Mole (unit)",
},
["kmol/min"] = {
name1 = "kilomole per minute",
name2 = "kilomoles per minute",
symbol = "kmol/min",
utype = "molar rate",
scale = 16.666666666666668,
default = "mol/s",
link = "Kilomole (unit)",
},
["kmol/s"] = {
name1 = "kilomole per second",
name2 = "kilomoles per second",
symbol = "kmol/s",
utype = "molar rate",
scale = 1000,
default = "lb-mol/s",
link = "Mole (unit)",
},
["lb-mol/d"] = {
name1 = "pound-mole per day",
name2 = "pound-moles per day",
symbol = "lb‑mol/d",
utype = "molar rate",
scale = 0.0052499116898148141,
default = "mmol/s",
link = "Pound-mole",
},
["lb-mol/h"] = {
name1 = "pound-mole per hour",
name2 = "pound-moles per hour",
symbol = "lb‑mol/h",
utype = "molar rate",
scale = 0.12599788055555555,
default = "mol/s",
link = "Pound-mole",
},
["lb-mol/min"] = {
name1 = "pound-mole per minute",
name2 = "pound-moles per minute",
symbol = "lb‑mol/min",
utype = "molar rate",
scale = 7.5598728333333334,
default = "mol/s",
link = "Pound-mole",
},
["lb-mol/s"] = {
name1 = "pound-mole per second",
name2 = "pound-moles per second",
symbol = "lb‑mol/s",
utype = "molar rate",
scale = 453.59237,
default = "kmol/s",
link = "Pound-mole",
},
["lbmol/d"] = {
name1 = "pound-mole per day",
name2 = "pound-moles per day",
symbol = "lbmol/d",
utype = "molar rate",
scale = 0.0052499116898148141,
default = "mmol/s",
link = "Pound-mole",
},
["lbmol/h"] = {
name1 = "pound-mole per hour",
name2 = "pound-moles per hour",
symbol = "lbmol/h",
utype = "molar rate",
scale = 0.12599788055555555,
default = "mol/s",
link = "Pound-mole",
},
["lbmol/min"] = {
name1 = "pound-mole per minute",
name2 = "pound-moles per minute",
symbol = "lbmol/min",
utype = "molar rate",
scale = 7.5598728333333334,
default = "mol/s",
link = "Pound-mole",
},
["lbmol/s"] = {
name1 = "pound-mole per second",
name2 = "pound-moles per second",
symbol = "lbmol/s",
utype = "molar rate",
scale = 453.59237,
default = "kmol/s",
link = "Pound-mole",
},
["mmol/s"] = {
name1 = "millimole per second",
name2 = "millimoles per second",
symbol = "mmol/s",
utype = "molar rate",
scale = 0.001,
default = "lb-mol/d",
link = "Mole (unit)",
},
["mol/d"] = {
name1 = "mole per day",
name2 = "moles per day",
symbol = "mol/d",
utype = "molar rate",
scale = 1.1574074074074073e-5,
default = "μmol/s",
link = "Mole (unit)",
},
["mol/h"] = {
name1 = "mole per hour",
name2 = "moles per hour",
symbol = "mol/h",
utype = "molar rate",
scale = 0.00027777777777777778,
default = "mmol/s",
link = "Mole (unit)",
},
["mol/min"] = {
name1 = "mole per minute",
name2 = "moles per minute",
symbol = "mol/min",
utype = "molar rate",
scale = 0.016666666666666666,
default = "mol/s",
link = "Mole (unit)",
},
["mol/s"] = {
name1 = "mole per second",
name2 = "moles per second",
symbol = "mol/s",
utype = "molar rate",
scale = 1,
default = "lb-mol/min",
link = "Mole (unit)",
},
["μmol/s"] = {
name1 = "micromole per second",
name2 = "micromoles per second",
symbol = "μmol/s",
utype = "molar rate",
scale = 0.000001,
default = "lb-mol/d",
link = "Mole (unit)",
},
["umol/s"] = {
target = "μmol/s",
},
["/acre"] = {
name1 = "per acre",
name2 = "per acre",
symbol = "/acre",
utype = "per unit area",
scale = 0.00024710538146716532,
default = "/ha",
link = "Acre",
},
["/ha"] = {
name1 = "per hectare",
name2 = "per hectare",
symbol = "/ha",
utype = "per unit area",
scale = 100e-6,
default = "/acre",
link = "Hectare",
},
["/sqcm"] = {
name1 = "per square centimetre",
name1_us = "per square centimeter",
name2 = "per square centimetre",
name2_us = "per square centimeter",
symbol = "/cm<sup>2</sup>",
utype = "per unit area",
scale = 1e4,
default = "/sqin",
link = "Square centimetre",
},
["/sqin"] = {
name1 = "per square inch",
name2 = "per square inch",
symbol = "/in<sup>2</sup>",
utype = "per unit area",
scale = 1550.0031000062002,
default = "/sqcm",
link = "Square inch",
},
["/sqkm"] = {
name1 = "per square kilometre",
name1_us = "per square kilometer",
name2 = "per square kilometre",
name2_us = "per square kilometer",
symbol = "/km<sup>2</sup>",
utype = "per unit area",
scale = 1e-6,
default = "/sqmi",
link = "Square kilometre",
},
["/sqmi"] = {
name1 = "per square mile",
name2 = "per square mile",
symbol = "/sq mi",
utype = "per unit area",
scale = 3.8610215854244582e-7,
default = "/sqkm",
link = "Square mile",
},
["PD/acre"] = {
name1 = "inhabitant per acre",
name2 = "inhabitants per acre",
symbol = "/acre",
utype = "per unit area",
scale = 0.00024710538146716532,
default = "PD/ha",
link = "Acre",
},
["PD/ha"] = {
name1 = "inhabitant per hectare",
name2 = "inhabitants per hectare",
symbol = "/ha",
utype = "per unit area",
scale = 100e-6,
default = "PD/acre",
link = "Hectare",
},
["PD/sqkm"] = {
name1 = "inhabitant per square kilometre",
name1_us = "inhabitant per square kilometer",
name2 = "inhabitants per square kilometre",
name2_us = "inhabitants per square kilometer",
symbol = "/km<sup>2</sup>",
utype = "per unit area",
scale = 1e-6,
default = "PD/sqmi",
link = "Square kilometre",
},
["PD/sqmi"] = {
name1 = "inhabitant per square mile",
name2 = "inhabitants per square mile",
symbol = "/sq mi",
utype = "per unit area",
scale = 3.8610215854244582e-7,
default = "PD/sqkm",
link = "Square mile",
},
["/cm2"] = {
target = "/sqcm",
},
["/in2"] = {
target = "/sqin",
},
["/km2"] = {
target = "/sqkm",
},
["pd/acre"] = {
target = "PD/acre",
},
["pd/ha"] = {
target = "PD/ha",
},
["PD/km2"] = {
target = "PD/sqkm",
},
["pd/km2"] = {
target = "PD/sqkm",
},
["PD/km²"] = {
target = "PD/sqkm",
},
["pd/sqkm"] = {
target = "PD/sqkm",
},
["pd/sqmi"] = {
target = "PD/sqmi",
},
["/l"] = {
name1 = "per litre",
name1_us = "per liter",
name2 = "per litre",
name2_us = "per liter",
symbol = "/l",
utype = "per unit volume",
scale = 1000,
default = "/usgal",
link = "Litre",
},
["/L"] = {
name1 = "per litre",
name1_us = "per liter",
name2 = "per litre",
name2_us = "per liter",
symbol = "/L",
utype = "per unit volume",
scale = 1000,
default = "/usgal",
link = "Litre",
},
["/USgal"] = {
name1 = "per gallon",
name2 = "per gallon",
symbol = "/gal",
utype = "per unit volume",
scale = 264.172052,
default = "/L",
link = "US gallon",
customary= 2,
},
["/usgal"] = {
target = "/USgal",
},
["bhp"] = {
name1 = "brake horsepower",
name2 = "brake horsepower",
symbol = "bhp",
utype = "power",
scale = 745.69987158227022,
default = "kW",
link = "Horsepower#Brake horsepower",
},
["Cal/d"] = {
name1 = "large calorie per day",
name2 = "large calories per day",
symbol = "Cal/d",
utype = "power",
scale = 0.048425925925925928,
default = "kJ/d",
link = "Calorie",
},
["Cal/h"] = {
name1 = "large calorie per hour",
name2 = "large calories per hour",
symbol = "Cal/h",
utype = "power",
scale = 1.1622222222222223,
default = "kJ/h",
link = "Calorie",
},
["cal/h"] = {
name1 = "calorie per hour",
name2 = "calories per hour",
symbol = "cal/h",
utype = "power",
scale = 0.0011622222222222223,
default = "W",
link = "Calorie",
},
["CV"] = {
name1 = "metric horsepower",
name2 = "metric horsepower",
symbol = "CV",
utype = "power",
scale = 735.49875,
default = "kW",
},
["hk"] = {
name1 = "metric horsepower",
name2 = "metric horsepower",
symbol = "hk",
utype = "power",
scale = 735.49875,
default = "kW",
},
["hp"] = {
name1 = "horsepower",
name2 = "horsepower",
symbol = "hp",
utype = "power",
scale = 745.69987158227022,
default = "kW",
},
["hp-electric"] = {
name1 = "electric horsepower",
name2 = "electric horsepower",
symbol = "hp",
utype = "power",
scale = 746,
default = "kW",
link = "Horsepower#Electrical horsepower",
},
["hp-electrical"] = {
name1 = "electrical horsepower",
name2 = "electrical horsepower",
symbol = "hp",
utype = "power",
scale = 746,
default = "kW",
link = "Horsepower#Electrical horsepower",
},
["hp-metric"] = {
name1 = "metric horsepower",
name2 = "metric horsepower",
symbol = "hp",
utype = "power",
scale = 735.49875,
default = "kW",
},
["ihp"] = {
name1 = "indicated horsepower",
name2 = "indicated horsepower",
symbol = "ihp",
utype = "power",
scale = 745.69987158227022,
default = "kW",
link = "Horsepower#Indicated horsepower",
},
["kcal/h"] = {
name1 = "kilocalorie per hour",
name2 = "kilocalories per hour",
symbol = "kcal/h",
utype = "power",
scale = 1.1622222222222223,
default = "kW",
link = "Calorie",
},
["kJ/d"] = {
name1 = "kilojoule per day",
name2 = "kilojoules per day",
symbol = "kJ/d",
utype = "power",
scale = 0.011574074074074073,
default = "Cal/d",
link = "Kilojoule",
},
["kJ/h"] = {
name1 = "kilojoule per hour",
name2 = "kilojoules per hour",
symbol = "kJ/h",
utype = "power",
scale = 0.27777777777777779,
default = "W",
link = "Kilojoule",
},
["PS"] = {
name1 = "metric horsepower",
name2 = "metric horsepower",
symbol = "PS",
utype = "power",
scale = 735.49875,
default = "kW",
},
["shp"] = {
name1 = "shaft horsepower",
name2 = "shaft horsepower",
symbol = "shp",
utype = "power",
scale = 745.69987158227022,
default = "kW",
link = "Horsepower#Shaft horsepower",
},
["W"] = {
_name1 = "watt",
_symbol = "W",
utype = "power",
scale = 1,
prefixes = 1,
default = "hp",
link = "Watt",
},
["BTU/h"] = {
per = { "BTU", "h" },
utype = "power",
default = "W",
},
["Btu/h"] = {
per = { "Btu", "h" },
utype = "power",
default = "W",
},
["BHP"] = {
target = "bhp",
},
["btu/h"] = {
target = "BTU/h",
},
["HP"] = {
target = "hp",
},
["Hp"] = {
target = "hp",
},
["hp-mechanical"] = {
target = "hp",
},
["IHP"] = {
target = "ihp",
},
["SHP"] = {
target = "shp",
},
["whp"] = {
target = "hp",
},
["hp/lb"] = {
name1 = "horsepower per pound",
name2 = "horsepower per pound",
symbol = "hp/lb",
utype = "power per unit mass",
scale = 1643.986806,
default = "kW/kg",
link = "Power-to-weight ratio",
},
["hp/LT"] = {
name1 = "horsepower per long ton",
name2 = "horsepower per long ton",
symbol = "hp/LT",
utype = "power per unit mass",
scale = 0.73392268125000004,
default = "kW/t",
link = "Power-to-weight ratio",
},
["hp/ST"] = {
name1 = "horsepower per short ton",
name2 = "horsepower per short ton",
symbol = "hp/ST",
utype = "power per unit mass",
scale = 0.821993403,
default = "kW/t",
link = "Power-to-weight ratio",
},
["hp/t"] = {
name1 = "horsepower per tonne",
name2 = "horsepower per tonne",
symbol = "hp/t",
utype = "power per unit mass",
scale = 0.74569987158227022,
default = "kW/t",
link = "Power-to-weight ratio",
},
["kW/kg"] = {
name1 = "kilowatt per kilogram",
name2 = "kilowatts per kilogram",
symbol = "kW/kg",
utype = "power per unit mass",
scale = 1000,
default = "hp/lb",
link = "Power-to-weight ratio",
},
["kW/t"] = {
name1 = "kilowatt per tonne",
name2 = "kilowatts per tonne",
symbol = "kW/t",
utype = "power per unit mass",
scale = 1,
default = "PS/t",
link = "Power-to-weight ratio",
},
["PS/t"] = {
name1 = "metric horsepower per tonne",
name2 = "metric horsepower per tonne",
symbol = "PS/t",
utype = "power per unit mass",
scale = 0.73549875,
default = "kW/t",
link = "Power-to-weight ratio",
},
["shp/lb"] = {
name1 = "shaft horsepower per pound",
name2 = "shaft horsepower per pound",
symbol = "shp/lb",
utype = "power per unit mass",
scale = 1643.986806,
default = "kW/kg",
link = "Power-to-weight ratio",
},
["hp/tonne"] = {
target = "hp/t",
symbol = "hp/tonne",
default = "kW/tonne",
},
["kW/tonne"] = {
target = "kW/t",
symbol = "kW/tonne",
},
["-lb/in2"] = {
name1 = "pound per square inch",
name2 = "pounds per square inch",
symbol = "lb/in<sup>2</sup>",
utype = "pressure",
scale = 6894.7572931683608,
default = "kPa kgf/cm2",
},
["atm"] = {
name1 = "standard atmosphere",
symbol = "atm",
utype = "pressure",
scale = 101325,
default = "kPa",
link = "Atmosphere (unit)",
},
["Ba"] = {
name1 = "barye",
symbol = "Ba",
utype = "pressure",
scale = 0.1,
default = "Pa",
},
["bar"] = {
symbol = "bar",
utype = "pressure",
scale = 100000,
default = "kPa",
link = "Bar (unit)",
},
["dbar"] = {
name1 = "decibar",
symbol = "dbar",
utype = "pressure",
scale = 10000,
default = "kPa",
link = "Bar (unit)",
},
["inHg"] = {
name1 = "inch of mercury",
name2 = "inches of mercury",
symbol = "inHg",
utype = "pressure",
scale = 3386.388640341,
default = "kPa",
},
["kBa"] = {
name1 = "kilobarye",
symbol = "kBa",
utype = "pressure",
scale = 100,
default = "hPa",
link = "Barye",
},
["kg-f/cm2"] = {
name1 = "kilogram-force per square centimetre",
name1_us = "kilogram-force per square centimeter",
name2 = "kilograms-force per square centimetre",
name2_us = "kilograms-force per square centimeter",
symbol = "kg<sub>f</sub>/cm<sup>2</sup>",
utype = "pressure",
scale = 98066.5,
default = "psi",
link = "Kilogram-force",
},
["kg/cm2"] = {
name1 = "kilogram per square centimetre",
name1_us = "kilogram per square centimeter",
name2 = "kilograms per square centimetre",
name2_us = "kilograms per square centimeter",
symbol = "kg/cm<sup>2</sup>",
utype = "pressure",
scale = 98066.5,
default = "psi",
link = "Kilogram-force",
},
["kgf/cm2"] = {
name1 = "kilogram-force per square centimetre",
name1_us = "kilogram-force per square centimeter",
name2 = "kilograms-force per square centimetre",
name2_us = "kilograms-force per square centimeter",
symbol = "kgf/cm<sup>2</sup>",
utype = "pressure",
scale = 98066.5,
default = "psi",
link = "Kilogram-force",
},
["ksi"] = {
name1 = "kilopound per square inch",
name2 = "kilopounds per square inch",
symbol = "ksi",
utype = "pressure",
scale = 6894757.2931683613,
default = "MPa",
link = "Pound per square inch",
},
["lbf/in2"] = {
name1 = "pound-force per square inch",
name2 = "pounds-force per square inch",
symbol = "lbf/in<sup>2</sup>",
utype = "pressure",
scale = 6894.7572931683608,
default = "kPa kgf/cm2",
},
["mb"] = {
name1 = "millibar",
symbol = "mb",
utype = "pressure",
scale = 100,
default = "hPa",
link = "Bar (unit)",
},
["mbar"] = {
name1 = "millibar",
symbol = "mbar",
utype = "pressure",
scale = 100,
default = "hPa",
link = "Bar (unit)",
},
["mmHg"] = {
name1 = "millimetre of mercury",
name1_us = "millimeter of mercury",
name2 = "millimetres of mercury",
name2_us = "millimeters of mercury",
symbol = "mmHg",
utype = "pressure",
scale = 133.322387415,
default = "kPa",
},
["Pa"] = {
_name1 = "pascal",
_symbol = "Pa",
utype = "pressure",
scale = 1,
prefixes = 1,
default = "psi",
link = "Pascal (unit)",
},
["psf"] = {
name1 = "pound per square foot",
name2 = "pounds per square foot",
symbol = "psf",
utype = "pressure",
scale = 47.880258980335839,
default = "kPa",
link = "Pound per square inch",
},
["psi"] = {
name1 = "pound per square inch",
name2 = "pounds per square inch",
symbol = "psi",
utype = "pressure",
scale = 6894.7572931683608,
default = "kPa",
},
["Torr"] = {
name1 = "torr",
symbol = "Torr",
utype = "pressure",
scale = 133.32236842105263,
default = "kPa",
},
["N/cm2"] = {
per = { "N", "cm2" },
utype = "pressure",
default = "psi",
},
["N/m2"] = {
per = { "N", "m2" },
utype = "pressure",
default = "psi",
},
["g/cm2"] = {
per = { "g", "cm2" },
utype = "pressure",
default = "lb/sqft",
multiplier= 9.80665,
},
["g/m2"] = {
per = { "g", "m2" },
utype = "pressure",
default = "lb/sqft",
multiplier= 9.80665,
},
["kg/ha"] = {
per = { "kg", "ha" },
utype = "pressure",
default = "lb/acre",
multiplier= 9.80665,
},
["kg/m2"] = {
per = { "kg", "m2" },
utype = "pressure",
default = "lb/sqft",
multiplier= 9.80665,
},
["lb/1000sqft"] = {
per = { "lb", "1000sqft" },
utype = "pressure",
default = "g/m2",
multiplier= 9.80665,
},
["lb/acre"] = {
per = { "lb", "acre" },
utype = "pressure",
default = "kg/ha",
multiplier= 9.80665,
},
["lb/sqft"] = {
per = { "lb", "sqft" },
utype = "pressure",
default = "kg/m2",
multiplier= 9.80665,
},
["lb/sqyd"] = {
per = { "lb", "sqyd" },
utype = "pressure",
default = "kg/m2",
multiplier= 9.80665,
},
["LT/acre"] = {
per = { "LT", "acre" },
utype = "pressure",
default = "t/ha",
multiplier= 9.80665,
},
["MT/ha"] = {
per = { "MT", "ha" },
utype = "pressure",
default = "LT/acre ST/acre",
multiplier= 9.80665,
},
["oz/sqft"] = {
per = { "oz", "sqft" },
utype = "pressure",
default = "g/m2",
multiplier= 9.80665,
},
["oz/sqyd"] = {
per = { "oz", "sqyd" },
utype = "pressure",
default = "g/m2",
multiplier= 9.80665,
},
["ST/acre"] = {
per = { "ST", "acre" },
utype = "pressure",
default = "t/ha",
multiplier= 9.80665,
},
["t/ha"] = {
per = { "t", "ha" },
utype = "pressure",
default = "LT/acre ST/acre",
multiplier= 9.80665,
},
["tonne/acre"] = {
per = { "tonne", "acre" },
utype = "pressure",
default = "tonne/ha",
multiplier= 9.80665,
},
["tonne/ha"] = {
per = { "tonne", "ha" },
utype = "pressure",
default = "tonne/acre",
multiplier= 9.80665,
},
["kgfpsqcm"] = {
target = "kgf/cm2",
},
["kgpsqcm"] = {
target = "kg/cm2",
},
["kN/m2"] = {
target = "kPa",
},
["lb/in2"] = {
target = "lbf/in2",
},
["torr"] = {
target = "Torr",
},
["Bq"] = {
_name1 = "becquerel",
_symbol = "Bq",
utype = "radioactivity",
scale = 1,
prefixes = 1,
default = "pCi",
link = "Becquerel",
},
["Ci"] = {
_name1 = "curie",
_symbol = "Ci",
utype = "radioactivity",
scale = 3.7e10,
prefixes = 1,
default = "GBq",
link = "Curie (unit)",
},
["Rd"] = {
_name1 = "rutherford",
_symbol = "Rd",
utype = "radioactivity",
scale = 1e6,
prefixes = 1,
default = "MBq",
link = "Rutherford (unit)",
},
["cm/h"] = {
name1 = "centimetre per hour",
name1_us = "centimeter per hour",
name2 = "centimetres per hour",
name2_us = "centimeters per hour",
symbol = "cm/h",
utype = "speed",
scale = 2.7777777777777775e-6,
default = "in/h",
link = "Metre per second",
},
["cm/s"] = {
name1 = "centimetre per second",
name1_us = "centimeter per second",
name2 = "centimetres per second",
name2_us = "centimeters per second",
symbol = "cm/s",
utype = "speed",
scale = 0.01,
default = "in/s",
link = "Metre per second",
},
["cm/year"] = {
name1 = "centimetre per year",
name1_us = "centimeter per year",
name2 = "centimetres per year",
name2_us = "centimeters per year",
symbol = "cm/year",
utype = "speed",
scale = 3.168873850681143e-10,
default = "in/year",
link = "Orders of magnitude (speed)",
},
["foot/s"] = {
name1 = "foot per second",
name2 = "foot per second",
symbol = "ft/s",
utype = "speed",
scale = 0.3048,
default = "m/s",
},
["ft/min"] = {
name1 = "foot per minute",
name2 = "feet per minute",
symbol = "ft/min",
utype = "speed",
scale = 0.00508,
default = "m/min",
link = "Feet per second",
},
["ft/s"] = {
name1 = "foot per second",
name2 = "feet per second",
symbol = "ft/s",
utype = "speed",
scale = 0.3048,
default = "m/s",
link = "Feet per second",
},
["furlong per fortnight"] = {
name2 = "furlongs per fortnight",
symbol = "furlong per fortnight",
usename = 1,
utype = "speed",
scale = 0.00016630952380952381,
default = "km/h mph",
link = "FFF system",
},
["in/h"] = {
name1 = "inch per hour",
name2 = "inches per hour",
symbol = "in/h",
utype = "speed",
scale = 7.0555555555555559e-6,
default = "cm/h",
link = "Inch",
},
["in/s"] = {
name1 = "inch per second",
name2 = "inches per second",
symbol = "in/s",
utype = "speed",
scale = 0.0254,
default = "cm/s",
link = "Inch",
},
["in/year"] = {
name1 = "inch per year",
name2 = "inches per year",
symbol = "in/year",
utype = "speed",
scale = 8.0489395807301024e-10,
default = "cm/year",
link = "Orders of magnitude (speed)",
},
["isp"] = {
name1 = "second",
symbol = "s",
utype = "speed",
scale = 9.80665,
default = "km/s",
link = "Specific impulse",
},
["km/d"] = {
name1 = "kilometre per day",
name1_us = "kilometer per day",
name2 = "kilometres per day",
name2_us = "kilometers per day",
symbol = "km/d",
utype = "speed",
scale = 1.1574074074074074e-2,
default = "mi/d",
link = "Orders of magnitude (speed)",
},
["km/h"] = {
name1 = "kilometre per hour",
name1_us = "kilometer per hour",
name2 = "kilometres per hour",
name2_us = "kilometers per hour",
symbol = "km/h",
utype = "speed",
scale = 0.27777777777777779,
default = "mph",
link = "Kilometres per hour",
},
["km/s"] = {
name1 = "kilometre per second",
name1_us = "kilometer per second",
name2 = "kilometres per second",
name2_us = "kilometers per second",
symbol = "km/s",
utype = "speed",
scale = 1000,
default = "mi/s",
link = "Metre per second",
},
["kn"] = {
name1 = "knot",
symbol = "kn",
utype = "speed",
scale = 0.51444444444444448,
default = "km/h mph",
link = "Knot (unit)",
},
["kNs/kg"] = {
name2 = "kN‑s/kg",
symbol = "kN‑s/kg",
utype = "speed",
scale = 1000,
default = "isp",
link = "Specific impulse",
},
["m/min"] = {
name1 = "metre per minute",
name1_us = "meter per minute",
name2 = "metres per minute",
name2_us = "meters per minute",
symbol = "m/min",
utype = "speed",
scale = 0.016666666666666666,
default = "ft/min",
link = "Metre per second",
},
["m/s"] = {
name1 = "metre per second",
name1_us = "meter per second",
name2 = "metres per second",
name2_us = "meters per second",
symbol = "m/s",
utype = "speed",
scale = 1,
default = "ft/s",
},
["Mach"] = {
name2 = "Mach",
symbol = "Mach",
utype = "speed",
builtin = "mach",
scale = 0,
iscomplex= true,
default = "km/h mph",
link = "Mach number",
},
["mi/d"] = {
name1 = "mile per day",
name2 = "miles per day",
symbol = "mi/d",
utype = "speed",
scale = 1.8626666666666667e-2,
default = "km/d",
link = "Orders of magnitude (speed)",
},
["mi/s"] = {
name1 = "mile per second",
name2 = "miles per second",
symbol = "mi/s",
utype = "speed",
scale = 1609.344,
default = "km/s",
link = "Mile",
},
["mm/h"] = {
name1 = "millimetre per hour",
name1_us = "millimeter per hour",
name2 = "millimetres per hour",
name2_us = "millimeters per hour",
symbol = "mm/h",
utype = "speed",
scale = 2.7777777777777781e-7,
default = "in/h",
link = "Metre per second",
},
["mph"] = {
name1 = "mile per hour",
name2 = "miles per hour",
symbol = "mph",
utype = "speed",
scale = 0.44704,
default = "km/h",
link = "Miles per hour",
},
["Ns/kg"] = {
name2 = "N‑s/kg",
symbol = "N‑s/kg",
utype = "speed",
scale = 1,
default = "isp",
link = "Specific impulse",
},
["si tsfc"] = {
name2 = "g/(kN⋅s)",
symbol = "g/(kN⋅s)",
utype = "speed",
scale = 9.9999628621379242e-7,
invert = -1,
iscomplex= true,
default = "tsfc",
link = "Thrust specific fuel consumption",
},
["tsfc"] = {
name2 = "lb/(lbf⋅h)",
symbol = "lb/(lbf⋅h)",
utype = "speed",
scale = 2.832545036049801e-5,
invert = -1,
iscomplex= true,
default = "si tsfc",
link = "Thrust specific fuel consumption",
},
["cm/y"] = {
target = "cm/year",
},
["cm/yr"] = {
target = "cm/year",
},
["in/y"] = {
target = "in/year",
},
["in/yr"] = {
target = "in/year",
},
["knot"] = {
target = "kn",
},
["knots"] = {
target = "kn",
},
["kph"] = {
target = "km/h",
},
["mi/h"] = {
target = "mph",
},
["mm/s"] = {
per = { "mm", "s" },
utype = "speed",
default = "in/s",
link = "Metre per second",
},
["C"] = {
name1 = "degree Celsius",
name2 = "degrees Celsius",
symbol = "°C",
usesymbol= 1,
utype = "temperature",
scale = 1,
offset = -273.15,
iscomplex= true,
istemperature= true,
default = "F",
link = "Celsius",
},
["F"] = {
name1 = "degree Fahrenheit",
name2 = "degrees Fahrenheit",
symbol = "°F",
usesymbol= 1,
utype = "temperature",
scale = 0.55555555555555558,
offset = 32-273.15*(9/5),
iscomplex= true,
istemperature= true,
default = "C",
link = "Fahrenheit",
},
["K"] = {
_name1 = "kelvin",
_symbol = "K",
usesymbol= 1,
utype = "temperature",
scale = 1,
offset = 0,
iscomplex= true,
istemperature= true,
prefixes = 1,
default = "C F",
link = "Kelvin",
},
["keVT"] = {
name1 = "kiloelectronvolt",
symbol = "keV",
utype = "temperature",
scale = 11604518.121550081,
offset = 0,
iscomplex= true,
default = "MK",
defkey = "keVT",
linkey = "keVT",
link = "Electronvolt",
},
["R"] = {
name1 = "degree Rankine",
name2 = "degrees Rankine",
symbol = "°R",
usesymbol= 1,
utype = "temperature",
scale = 0.55555555555555558,
offset = 0,
iscomplex= true,
istemperature= true,
default = "K F C",
link = "Rankine scale",
},
["Celsius"] = {
target = "C",
},
["°C"] = {
target = "C",
},
["°F"] = {
target = "F",
},
["°R"] = {
target = "R",
},
["C-change"] = {
name1 = "degree Celsius change",
name2 = "degrees Celsius change",
symbol = "°C",
usesymbol= 1,
utype = "temperature change",
scale = 1,
default = "F-change",
link = "Celsius",
},
["F-change"] = {
name1 = "degree Fahrenheit change",
name2 = "degrees Fahrenheit change",
symbol = "°F",
usesymbol= 1,
utype = "temperature change",
scale = 0.55555555555555558,
default = "C-change",
link = "Fahrenheit",
},
["K-change"] = {
name1 = "kelvin change",
name2 = "kelvins change",
symbol = "K",
usesymbol= 1,
utype = "temperature change",
scale = 1,
default = "F-change",
link = "Kelvin",
},
["°C-change"] = {
target = "C-change",
},
["°F-change"] = {
target = "F-change",
},
["century"] = {
name1 = "century",
name2 = "centuries",
symbol = "ha",
utype = "time",
scale = 3155760000,
default = "Gs",
},
["d"] = {
name1 = "day",
symbol = "d",
utype = "time",
scale = 86400,
default = "ks",
},
["decade"] = {
name1 = "decade",
symbol = "daa",
utype = "time",
scale = 315576000,
default = "Ms",
},
["dog year"] = {
name1 = "dog year",
symbol = "dog yr",
utype = "time",
scale = 220903200,
default = "years",
link = "List of unusual units of measurement#Dog year",
},
["fortnight"] = {
symbol = "fortnight",
usename = 1,
utype = "time",
scale = 1209600,
default = "week",
},
["h"] = {
name1 = "hour",
symbol = "h",
utype = "time",
scale = 3600,
default = "ks",
},
["long billion year"] = {
name1 = "billion years",
name2 = "billion years",
symbol = "Ta",
utype = "time",
scale = 31557600000000000000,
default = "Es",
link = "Annum",
},
["millennium"] = {
name1 = "millennium",
name2 = "millennia",
symbol = "ka",
utype = "time",
scale = 31557600000,
default = "Gs",
},
["milliard year"] = {
name1 = "milliard years",
name2 = "milliard years",
symbol = "Ga",
utype = "time",
scale = 31557600000000000,
default = "Ps",
link = "Annum",
},
["million year"] = {
name1 = "million years",
name2 = "million years",
symbol = "Ma",
utype = "time",
scale = 31557600000000,
default = "Ts",
link = "Annum",
},
["min"] = {
name1 = "minute",
symbol = "min",
utype = "time",
scale = 60,
default = "s",
},
["month"] = {
symbol = "month",
usename = 1,
utype = "time",
scale = 2629800,
default = "Ms",
},
["months"] = {
name1 = "month",
symbol = "mo",
utype = "time",
scale = 2629800,
default = "year",
},
["s"] = {
_name1 = "second",
_symbol = "s",
utype = "time",
scale = 1,
prefixes = 1,
default = "v < 7200 ! min ! h",
link = "Second",
},
["short billion year"] = {
name1 = "billion years",
name2 = "billion years",
symbol = "Ga",
utype = "time",
scale = 31557600000000000,
default = "Ps",
link = "Annum",
},
["short trillion year"] = {
name1 = "trillion years",
name2 = "trillion years",
symbol = "Ta",
utype = "time",
scale = 31557600000000000000,
default = "Es",
link = "Annum",
},
["thousand million year"] = {
name1 = "thousand million years",
name2 = "thousand million years",
symbol = "Ga",
utype = "time",
scale = 31557600000000000,
default = "Ps",
link = "Annum",
},
["wk"] = {
symbol = "week",
usename = 1,
utype = "time",
scale = 604800,
default = "Ms",
},
["year"] = {
name1 = "year",
symbol = "a",
utype = "time",
scale = 31557600,
default = "Ms",
link = "Annum",
},
["years"] = {
name1 = "year",
symbol = "yr",
utype = "time",
scale = 31557600,
default = "Ms",
link = "Annum",
},
["byr"] = {
target = "short billion year",
},
["day"] = {
target = "d",
},
["days"] = {
target = "d",
},
["dog yr"] = {
target = "dog year",
},
["Gyr"] = {
target = "thousand million year",
},
["hour"] = {
target = "h",
},
["hours"] = {
target = "h",
},
["kMyr"] = {
target = "thousand million year",
},
["kmyr"] = {
target = "thousand million year",
},
["kyr"] = {
target = "millennium",
},
["long byr"] = {
target = "long billion year",
},
["minute"] = {
target = "min",
},
["minutes"] = {
target = "min",
},
["mth"] = {
target = "month",
},
["Myr"] = {
target = "million year",
},
["myr"] = {
target = "million year",
},
["sec"] = {
target = "s",
},
["second"] = {
target = "s",
},
["seconds"] = {
target = "s",
},
["tmyr"] = {
target = "thousand million year",
},
["tryr"] = {
target = "short trillion year",
},
["tyr"] = {
target = "millennium",
},
["week"] = {
target = "wk",
},
["weeks"] = {
target = "wk",
},
["yr"] = {
target = "year",
},
["kg.m"] = {
name1 = "kilogram metre",
name1_us = "kilogram meter",
symbol = "kg⋅m",
utype = "torque",
scale = 9.80665,
default = "Nm lbft",
link = "Kilogram metre (torque)",
},
["kgf.m"] = {
name1 = "kilogram force-metre",
name1_us = "kilogram force-meter",
symbol = "kgf⋅m",
utype = "torque",
scale = 9.80665,
default = "Nm lbfft",
link = "Kilogram metre (torque)",
},
["kgm"] = {
name1 = "kilogram metre",
name1_us = "kilogram meter",
symbol = "kg⋅m",
utype = "torque",
scale = 9.80665,
default = "Nm lbfft",
link = "Kilogram metre (torque)",
},
["kpm"] = {
name1 = "kilopond metre",
name1_us = "kilopond meter",
symbol = "kp⋅m",
utype = "torque",
scale = 9.80665,
default = "Nm lbft",
link = "Kilogram metre (torque)",
},
["lb-fft"] = {
name1 = "pound force-foot",
name2 = "pound force-feet",
symbol = "ft⋅lb<sub>f</sub>",
utype = "torque",
scale = 1.3558179483314004,
default = "Nm",
link = "Pound-foot (torque)",
},
["lb.ft"] = {
name1 = "pound force-foot",
name2 = "pound force-feet",
symbol = "lb⋅ft",
utype = "torque",
scale = 1.3558179483314004,
default = "Nm",
link = "Pound-foot (torque)",
},
["lb.in"] = {
name1 = "pound force-inch",
symbol = "lb⋅in",
utype = "torque",
scale = 0.1129848290276167,
default = "mN.m",
link = "Pound-foot (torque)",
},
["lbfft"] = {
name1 = "pound force-foot",
name2 = "pound force-feet",
symbol = "lbf⋅ft",
utype = "torque",
scale = 1.3558179483314004,
default = "Nm",
link = "Pound-foot (torque)",
},
["lbft"] = {
name1 = "pound-foot",
name2 = "pound-feet",
symbol = "lb⋅ft",
utype = "torque",
scale = 1.3558179483314004,
default = "Nm",
link = "Pound-foot (torque)",
},
["m.kg-f"] = {
name1 = "metre kilogram-force",
name1_us = "meter kilogram-force",
name2 = "metre kilograms-force",
name2_us = "meter kilograms-force",
symbol = "m⋅kg<sub>f</sub>",
utype = "torque",
scale = 9.80665,
default = "Nm lbfft",
link = "Kilogram metre (torque)",
},
["m.kgf"] = {
name1 = "metre kilogram-force",
name1_us = "meter kilogram-force",
name2 = "metre kilograms-force",
name2_us = "meter kilograms-force",
symbol = "m⋅kgf",
utype = "torque",
scale = 9.80665,
default = "Nm lbfft",
link = "Kilogram metre (torque)",
},
["mN.m"] = {
name1 = "millinewton-metre",
name1_us = "millinewton-meter",
symbol = "mN⋅m",
utype = "torque",
scale = 0.001,
default = "lb.in",
link = "Newton-metre",
},
["Nm"] = {
_name1 = "newton-metre",
_name1_us= "newton-meter",
_symbol = "N⋅m",
utype = "torque",
alttype = "energy",
scale = 1,
prefixes = 1,
default = "lbfft",
link = "Newton-metre",
},
["kN/m"] = {
per = { "kN", "-m-stiff" },
utype = "torque",
default = "lbf/in",
},
["lbf/in"] = {
per = { "lbf", "-in-stiff" },
utype = "torque",
default = "kN/m",
},
["lb-f.ft"] = {
target = "lb-fft",
},
["lbf.ft"] = {
target = "lbfft",
},
["lbf·ft"] = {
target = "lbfft",
},
["lb·ft"] = {
target = "lb.ft",
},
["mkg-f"] = {
target = "m.kg-f",
},
["mkgf"] = {
target = "m.kgf",
},
["N.m"] = {
target = "Nm",
},
["N·m"] = {
target = "Nm",
},
["ton-mile"] = {
symbol = "ton-mile",
usename = 1,
utype = "transportation",
scale = 1.4599723182105602,
default = "tkm",
},
["tkm"] = {
name1 = "tonne-kilometre",
name1_us = "tonne-kilometer",
symbol = "tkm",
utype = "transportation",
scale = 1,
default = "ton-mile",
},
["-12USoz(mL)serve"] = {
name1_us = "12 U.S. fl oz (355 mL) serving",
symbol = "12 US fl oz (355 mL) serving",
sym_us = "12 U.S. fl oz (355 mL) serving",
utype = "volume",
scale = 0.00035488235475000004,
default = "mL",
link = "Beverage can#Standard sizes",
},
["-12USoz(ml)serve"] = {
name1_us = "12 U.S. fl oz (355 ml) serving",
symbol = "12 US fl oz (355 ml) serving",
sym_us = "12 U.S. fl oz (355 ml) serving",
utype = "volume",
scale = 0.00035488235475000004,
default = "ml",
link = "Beverage can#Standard sizes",
},
["-12USozserve"] = {
name1_us = "12 U.S. fl oz serving",
symbol = "12 US fl oz serving",
sym_us = "12 U.S. fl oz serving",
utype = "volume",
scale = 0.00035488235475000004,
default = "mL",
link = "Beverage can#Standard sizes",
},
["acre-foot"] = {
name1 = "acre-foot",
name2 = "acre-foot",
symbol = "acre⋅ft",
utype = "volume",
scale = 1233.48183754752,
default = "m3",
},
["acre-ft"] = {
name1 = "acre-foot",
name2 = "acre-feet",
symbol = "acre⋅ft",
utype = "volume",
scale = 1233.48183754752,
default = "m3",
},
["AUtbsp"] = {
name1 = "Australian tablespoon",
symbol = "AU tbsp",
utype = "volume",
scale = 0.000020,
default = "ml",
},
["Bcuft"] = {
name1 = "billion cubic foot",
name2 = "billion cubic feet",
symbol = "billion cu ft",
utype = "volume",
scale = 28316846.592,
default = "Gl",
link = "Cubic foot",
},
["bdft"] = {
name1 = "board foot",
name2 = "board feet",
symbol = "bd ft",
utype = "volume",
scale = 0.0023597372167,
default = "m3",
},
["board feet"] = {
name2 = "board feet",
symbol = "board foot",
usename = 1,
utype = "volume",
scale = 0.0023597372167,
default = "m3",
},
["board foot"] = {
name2 = "board foot",
symbol = "board foot",
usename = 1,
utype = "volume",
scale = 0.0023597372167,
default = "m3",
},
["cc"] = {
name1 = "cubic centimetre",
name1_us = "cubic centimeter",
symbol = "cc",
utype = "volume",
scale = 0.000001,
default = "cuin",
},
["CID"] = {
name1 = "cubic inch",
name2 = "cubic inches",
symbol = "cu in",
utype = "volume",
scale = 0.000016387064,
default = "cc",
link = "Cubic inch#Engine displacement",
},
["cord"] = {
symbol = "cord",
utype = "volume",
scale = 3.624556363776,
default = "m3",
link = "Cord (unit)",
},
["cufoot"] = {
name1 = "cubic foot",
name2 = "cubic foot",
symbol = "cu ft",
utype = "volume",
scale = 0.028316846592,
default = "m3",
},
["cuft"] = {
name1 = "cubic foot",
name2 = "cubic feet",
symbol = "cu ft",
utype = "volume",
scale = 0.028316846592,
default = "m3",
},
["cuin"] = {
name1 = "cubic inch",
name2 = "cubic inches",
symbol = "cu in",
utype = "volume",
scale = 0.000016387064,
default = "cm3",
},
["cumi"] = {
name1 = "cubic mile",
symbol = "cu mi",
utype = "volume",
scale = 4168181825.440579584,
default = "km3",
},
["cuyd"] = {
name1 = "cubic yard",
symbol = "cu yd",
utype = "volume",
scale = 0.764554857984,
default = "m3",
},
["firkin"] = {
symbol = "firkin",
usename = 1,
utype = "volume",
scale = 0.04091481,
default = "L impgal USgal",
link = "Firkin (unit)",
},
["foot3"] = {
target = "cufoot",
},
["Goilbbl"] = {
name1 = "billion barrels",
name2 = "billion barrels",
symbol = "Gbbl",
utype = "volume",
scale = 158987294.928,
default = "v * 1.58987294928 < 10 ! e6 ! e9 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["gr water"] = {
name1 = "grains water",
name2 = "grains water",
symbol = "gr H<sub>2</sub>O",
utype = "volume",
scale = 0.00000006479891,
default = "cm3",
link = "Grain (unit)",
},
["grt"] = {
name1 = "gross register ton",
symbol = "grt",
utype = "volume",
scale = 2.8316846592,
default = "m3",
link = "Gross register tonnage",
},
["impbbl"] = {
name1 = "imperial barrel",
symbol = "imp bbl",
utype = "volume",
scale = 0.16365924,
default = "L impgal USgal",
link = "Barrel (unit)",
},
["impbsh"] = {
name1 = "imperial bushel",
symbol = "imp bsh",
utype = "volume",
scale = 0.03636872,
default = "L impgal USdrygal",
},
["impbu"] = {
name1 = "imperial bushel",
symbol = "imp bu",
utype = "volume",
scale = 0.03636872,
default = "m3",
},
["impgal"] = {
name1 = "imperial gallon",
symbol = "imp gal",
utype = "volume",
scale = 0.00454609,
default = "L USgal",
},
["impgi"] = {
name1 = "gill",
symbol = "gi",
utype = "volume",
scale = 0.0001420653125,
default = "ml USoz",
link = "Gill (unit)",
},
["impkenning"] = {
name1 = "imperial kenning",
symbol = "kenning",
utype = "volume",
scale = 0.01818436,
default = "L USdrygal",
link = "Kenning (unit)",
},
["impoz"] = {
name1 = "imperial fluid ounce",
symbol = "imp fl oz",
utype = "volume",
scale = 0.0000284130625,
default = "ml USoz",
},
["imppk"] = {
name1 = "imperial peck",
symbol = "pk",
utype = "volume",
scale = 0.00909218,
default = "L USdrygal",
link = "Peck",
},
["imppt"] = {
name1 = "imperial pint",
symbol = "imp pt",
utype = "volume",
scale = 0.00056826125,
default = "L",
},
["impqt"] = {
name1 = "imperial quart",
symbol = "imp qt",
utype = "volume",
scale = 0.0011365225,
default = "ml USoz",
customary= 3,
},
["kilderkin"] = {
symbol = "kilderkin",
usename = 1,
utype = "volume",
scale = 0.08182962,
default = "L impgal USgal",
},
["koilbbl"] = {
name1 = "thousand barrels",
name2 = "thousand barrels",
symbol = "kbbl",
utype = "volume",
scale = 158.987294928,
default = "v * 1.58987294928 < 10 ! ! e3 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["L"] = {
_name1 = "litre",
_name1_us= "liter",
_symbol = "L",
utype = "volume",
scale = 0.001,
prefixes = 1,
default = "impgal USgal",
link = "Litre",
},
["l"] = {
_name1 = "litre",
_name1_us= "liter",
_symbol = "l",
utype = "volume",
scale = 0.001,
prefixes = 1,
default = "impgal USgal",
link = "Litre",
},
["ll"] = {
name1 = "litre",
name1_us = "liter",
symbol = "l",
utype = "volume",
scale = 0.001,
default = "impgal USgal",
},
["m3"] = {
_name1 = "cubic metre",
_name1_us= "cubic meter",
_symbol = "m<sup>3</sup>",
prefix_position= 7,
utype = "volume",
scale = 1,
prefixes = 3,
default = "cuft",
link = "Cubic metre",
},
["Mbbl"] = {
name1 = "thousand barrels",
name2 = "thousand barrels",
symbol = "Mbbl",
utype = "volume",
scale = 158.987294928,
default = "v * 1.58987294928 < 10 ! e3 ! ! m3",
link = "Barrel (unit)#Oil barrel",
},
["MMoilbbl"] = {
name1 = "million barrels",
name2 = "million barrels",
symbol = "MMbbl",
utype = "volume",
scale = 158987.294928,
default = "v * 1.58987294928 < 10 ! e3 ! e6 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["Moilbbl"] = {
name1 = "million barrels",
name2 = "million barrels",
symbol = "Mbbl",
utype = "volume",
scale = 158987.294928,
default = "v * 1.58987294928 < 10 ! e3 ! e6 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["MTON"] = {
name1 = "measurement ton",
symbol = "MTON",
utype = "volume",
scale = 1.13267386368,
default = "m3",
},
["MUSgal"] = {
name1 = "million US gallons",
name1_us = "million U.S. gallons",
name2 = "million US gallons",
name2_us = "million U.S. gallons",
symbol = "million US gal",
sym_us = "million U.S. gal",
utype = "volume",
scale = 3785.411784,
default = "Ml",
link = "US gallon",
},
["oilbbl"] = {
name1 = "barrel",
symbol = "bbl",
utype = "volume",
scale = 0.158987294928,
default = "m3",
link = "Barrel (unit)#Oil barrel",
},
["stere"] = {
symbol = "stere",
usename = 1,
utype = "volume",
scale = 1,
default = "cuft",
},
["tmcft"] = {
name2 = "tmcft",
symbol = "tmcft",
utype = "volume",
scale = 28316846.592,
default = "km3",
},
["Tmcft"] = {
name1 = "thousand million cubic feet",
name2 = "thousand million cubic feet",
symbol = "tmcft",
utype = "volume",
scale = 28316846.592,
default = "km3",
link = "Tmcft",
},
["Toilbbl"] = {
name1 = "trillion barrels",
name2 = "trillion barrels",
symbol = "Tbbl",
utype = "volume",
scale = 158987294928,
default = "v * 1.58987294928 < 10 ! e9 ! e12 ! m3",
link = "Barrel (unit)#Oil barrel",
},
["USbbl"] = {
name1 = "US barrel",
name1_us = "U.S. barrel",
symbol = "US bbl",
sym_us = "U.S. bbl",
utype = "volume",
scale = 0.119240471196,
default = "L USgal impgal",
link = "Barrel (unit)",
},
["USbeerbbl"] = {
name1 = "US beer barrel",
name1_us = "U.S. beer barrel",
symbol = "US bbl",
sym_us = "U.S. bbl",
utype = "volume",
scale = 0.117347765304,
default = "L USgal impgal",
link = "Barrel (unit)",
},
["USbsh"] = {
name1 = "US bushel",
name1_us = "U.S. bushel",
symbol = "US bsh",
sym_us = "U.S. bsh",
utype = "volume",
scale = 0.03523907016688,
default = "L USdrygal impgal",
link = "Bushel",
},
["USbu"] = {
name1 = "US bushel",
name1_us = "U.S. bushel",
symbol = "US bu",
sym_us = "U.S. bu",
utype = "volume",
scale = 0.03523907016688,
default = "L USdrygal impgal",
link = "Bushel",
},
["USdrybbl"] = {
name1 = "US dry barrel",
name1_us = "U.S. dry barrel",
symbol = "US dry bbl",
sym_us = "U.S. dry bbl",
utype = "volume",
scale = 0.11562819898508,
default = "m3",
link = "Barrel (unit)",
},
["USdrygal"] = {
name1 = "US dry gallon",
name1_us = "U.S. dry gallon",
symbol = "US dry gal",
sym_us = "U.S. dry gal",
utype = "volume",
scale = 0.00440488377086,
default = "L",
link = "Gallon",
},
["USdrypt"] = {
name1 = "US dry pint",
name1_us = "U.S. dry pint",
symbol = "US dry pt",
sym_us = "U.S. dry pt",
utype = "volume",
scale = 0.0005506104713575,
default = "ml",
link = "Pint",
},
["USdryqt"] = {
name1 = "US dry quart",
name1_us = "U.S. dry quart",
symbol = "US dry qt",
sym_us = "U.S. dry qt",
utype = "volume",
scale = 0.001101220942715,
default = "ml",
link = "Quart",
},
["USflgal"] = {
name1 = "US gallon",
name1_us = "U.S. gallon",
symbol = "US fl gal",
sym_us = "U.S. fl gal",
utype = "volume",
scale = 0.003785411784,
default = "L impgal",
link = "Gallon",
},
["USgal"] = {
name1 = "US gallon",
name1_us = "U.S. gallon",
symbol = "US gal",
sym_us = "U.S. gal",
utype = "volume",
scale = 0.003785411784,
default = "L impgal",
},
["USgi"] = {
name1 = "gill",
symbol = "gi",
utype = "volume",
scale = 0.0001182941183,
default = "ml impoz",
link = "Gill (unit)",
},
["USkenning"] = {
name1 = "US kenning",
name1_us = "U.S. kenning",
symbol = "US kenning",
sym_us = "U.S. kenning",
utype = "volume",
scale = 0.01761953508344,
default = "L impgal",
link = "Kenning (unit)",
},
["USmin"] = {
name1 = "US minim",
name1_us = "U.S. minim",
symbol = "US min",
sym_us = "U.S. min",
utype = "volume",
scale = 0.000000061611519921875,
default = "ml",
link = "Minim (unit)",
},
["USoz"] = {
name1 = "US fluid ounce",
name1_us = "U.S. fluid ounce",
symbol = "US fl oz",
sym_us = "U.S. fl oz",
utype = "volume",
scale = 0.0000295735295625,
default = "ml",
},
["USpk"] = {
name1 = "US peck",
name1_us = "U.S. peck",
symbol = "US pk",
sym_us = "U.S. pk",
utype = "volume",
scale = 0.00880976754172,
default = "L impgal",
link = "Peck",
},
["USpt"] = {
name1 = "US pint",
name1_us = "U.S. pint",
symbol = "US pt",
sym_us = "U.S. pt",
utype = "volume",
scale = 0.000473176473,
default = "L imppt",
link = "Pint",
},
["USqt"] = {
name1 = "US quart",
name1_us = "U.S. quart",
symbol = "US qt",
sym_us = "U.S. qt",
utype = "volume",
scale = 0.000946352946,
default = "ml",
link = "Quart",
customary= 1,
},
["USquart"] = {
name1 = "US quart",
name1_us = "U.S. quart",
symbol = "US qt",
sym_us = "U.S. qt",
utype = "volume",
scale = 0.000946352946,
default = "ml impoz",
link = "Quart",
},
["UStbsp"] = {
name1 = "US tablespoon",
name1_us = "U.S. tablespoon",
symbol = "US tbsp",
sym_us = "U.S. tbsp",
utype = "volume",
scale = 1.4786764781250001e-5,
default = "ml",
},
["winecase"] = {
symbol = "case",
usename = 1,
utype = "volume",
scale = 0.009,
default = "L",
link = "Case (goods)",
},
["*U.S.drygal"] = {
target = "USdrygal",
sp_us = true,
customary= 2,
},
["*U.S.gal"] = {
target = "USgal",
sp_us = true,
customary= 2,
},
["+USdrygal"] = {
target = "USdrygal",
customary= 1,
},
["+usfloz"] = {
target = "USoz",
link = "Fluid ounce",
customary= 1,
},
["+USgal"] = {
target = "USgal",
customary= 1,
},
["+USoz"] = {
target = "USoz",
customary= 1,
},
["@impgal"] = {
target = "impgal",
link = "Gallon",
customary= 3,
},
["acre feet"] = {
target = "acre-ft",
},
["acre foot"] = {
target = "acre-foot",
},
["acre ft"] = {
target = "acre-ft",
},
["acre-feet"] = {
target = "acre-ft",
},
["acre.foot"] = {
target = "acre-foot",
},
["acre.ft"] = {
target = "acre-ft",
},
["acre·ft"] = {
target = "acre-ft",
},
["bushels"] = {
target = "USbsh",
},
["cid"] = {
target = "CID",
},
["ft3"] = {
target = "cuft",
symbol = "ft<sup>3</sup>",
},
["gal"] = {
target = "USgal",
},
["gallon"] = {
shouldbe = "Use %{USgal%} for US gallons or %{impgal%} for imperial gallons (not %{gallon%})",
},
["gallons"] = {
shouldbe = "Use %{USgal%} for US gallons or %{impgal%} for imperial gallons (not %{gallons%})",
},
["Gcuft"] = {
target = "e9cuft",
},
["impfloz"] = {
target = "impoz",
},
["Impgal"] = {
target = "impgal",
},
["in3"] = {
target = "cuin",
symbol = "in<sup>3</sup>",
},
["hm³"] = {
target = "hm3",
},
["kcuft"] = {
target = "e3cuft",
},
["kcum"] = {
target = "e3m3",
},
["km³"] = {
target = "km3",
},
["liter"] = {
target = "L",
sp_us = true,
},
["liters"] = {
target = "L",
sp_us = true,
},
["litre"] = {
target = "L",
},
["litres"] = {
target = "L",
},
["Mcuft"] = {
target = "e6cuft",
},
["Mcum"] = {
target = "e6m3",
},
["Mft3"] = {
target = "e6cuft",
},
["mi3"] = {
target = "cumi",
symbol = "mi<sup>3</sup>",
},
["m³"] = {
target = "m3",
},
["Pcuft"] = {
target = "e15cuft",
},
["pt"] = {
shouldbe = "Use %{USpt%} for US pints or %{imppt%} for imperial pints (not %{pt%})",
},
["qt"] = {
shouldbe = "Use %{USqt%} for US quarts or %{impqt%} for imperial quarts (not %{qt%})",
},
["Tcuft"] = {
target = "e12cuft",
},
["Tft3"] = {
target = "e12cuft",
},
["U.S.bbl"] = {
target = "USbbl",
sp_us = true,
default = "L U.S.gal impgal",
},
["U.S.beerbbl"] = {
target = "USbeerbbl",
sp_us = true,
default = "L U.S.gal impgal",
},
["U.S.bsh"] = {
target = "USbsh",
sp_us = true,
default = "L U.S.drygal impgal",
},
["U.S.bu"] = {
target = "USbu",
sp_us = true,
default = "L U.S.drygal impgal",
},
["U.S.drybbl"] = {
target = "USdrybbl",
sp_us = true,
},
["U.S.drygal"] = {
target = "USdrygal",
sp_us = true,
},
["U.S.drypt"] = {
target = "USdrypt",
sp_us = true,
},
["U.S.dryqt"] = {
target = "USdryqt",
sp_us = true,
},
["U.S.flgal"] = {
target = "USflgal",
sp_us = true,
},
["U.S.floz"] = {
target = "USoz",
sp_us = true,
},
["U.S.gal"] = {
target = "USgal",
sp_us = true,
link = "U.S. gallon",
},
["u.s.gal"] = {
target = "USgal",
sp_us = true,
link = "U.S. gallon",
},
["U.S.gi"] = {
target = "USgi",
sp_us = true,
},
["U.S.kenning"] = {
target = "USkenning",
sp_us = true,
},
["U.S.oz"] = {
target = "USoz",
sp_us = true,
},
["U.S.pk"] = {
target = "USpk",
sp_us = true,
},
["U.S.pt"] = {
target = "USpt",
sp_us = true,
},
["U.S.qt"] = {
target = "USqt",
sp_us = true,
default = "L impqt",
customary= 2,
},
["usbbl"] = {
target = "USbbl",
},
["usbeerbbl"] = {
target = "USbeerbbl",
},
["usbsh"] = {
target = "USbsh",
},
["usbu"] = {
target = "USbu",
},
["usdrybbl"] = {
target = "USdrybbl",
},
["usdrygal"] = {
target = "USdrygal",
},
["usdrypt"] = {
target = "USdrypt",
},
["usdryqt"] = {
target = "USdryqt",
},
["USfloz"] = {
target = "USoz",
},
["usfloz"] = {
target = "USoz",
},
["USGAL"] = {
target = "USgal",
},
["usgal"] = {
target = "USgal",
},
["usgi"] = {
target = "USgi",
},
["uskenning"] = {
target = "USkenning",
},
["usoz"] = {
target = "USoz",
},
["uspk"] = {
target = "USpk",
},
["uspt"] = {
target = "USpt",
},
["usqt"] = {
target = "USqt",
},
["yd3"] = {
target = "cuyd",
symbol = "yd<sup>3</sup>",
},
["cuft/sqmi"] = {
per = { "cuft", "sqmi" },
utype = "volume per unit area",
default = "m3/km2",
},
["m3/ha"] = {
name1 = "cubic metre per hectare",
name1_us = "cubic meter per hectare",
name2 = "cubic metres per hectare",
name2_us = "cubic meters per hectare",
symbol = "m<sup>3</sup>/ha",
utype = "volume per unit area",
scale = 0.0001,
default = "USbu/acre",
link = "Hectare",
},
["m3/km2"] = {
per = { "m3", "km2" },
utype = "volume per unit area",
default = "cuft/sqmi",
},
["U.S.gal/acre"] = {
per = { "U.S.gal", "acre" },
utype = "volume per unit area",
default = "m3/km2",
},
["USbu/acre"] = {
name2 = "US bushels per acre",
symbol = "US bushel per acre",
usename = 1,
utype = "volume per unit area",
scale = 8.7077638761350888e-6,
default = "m3/ha",
link = "Bushel",
},
["USgal/acre"] = {
per = { "USgal", "acre" },
utype = "volume per unit area",
default = "m3/km2",
},
["cuyd/mi"] = {
per = { "cuyd", "mi" },
utype = "volume per unit length",
default = "m3/km",
},
["m3/km"] = {
per = { "m3", "km" },
utype = "volume per unit length",
default = "cuyd/mi",
},
["mich"] = {
combination= { "ch", "mi" },
multiple = { 80 },
utype = "length",
},
["michlk"] = {
combination= { "chlk", "mi" },
multiple = { 80 },
utype = "length",
},
["michainlk"] = {
combination= { "chainlk", "mi" },
multiple = { 80 },
utype = "length",
},
["miyd"] = {
combination= { "yd", "mi" },
multiple = { 1760 },
utype = "length",
},
["miydftin"] = {
combination= { "in", "ft", "yd", "mi" },
multiple = { 12, 3, 1760 },
utype = "length",
},
["mift"] = {
combination= { "ft", "mi" },
multiple = { 5280 },
utype = "length",
},
["ydftin"] = {
combination= { "in", "ft", "yd" },
multiple = { 12, 3 },
utype = "length",
},
["ydft"] = {
combination= { "ft", "yd" },
multiple = { 3 },
utype = "length",
},
["ftin"] = {
combination= { "in", "ft" },
multiple = { 12 },
utype = "length",
},
["footin"] = {
combination= { "in", "foot" },
multiple = { 12 },
utype = "length",
},
["handin"] = {
combination= { "in", "hand" },
multiple = { 4 },
utype = "length",
},
["lboz"] = {
combination= { "oz", "lb" },
multiple = { 16 },
utype = "mass",
},
["stlb"] = {
combination= { "lb", "st" },
multiple = { 14 },
utype = "mass",
},
["stlboz"] = {
combination= { "oz", "lb", "st" },
multiple = { 16, 14 },
utype = "mass",
},
["st and lb"] = {
combination= { "lb", "st" },
multiple = { 14 },
utype = "mass",
},
["GN LTf"] = {
combination= { "GN", "-LTf" },
utype = "force",
},
["GN LTf STf"] = {
combination= { "GN", "-LTf", "-STf" },
utype = "force",
},
["GN STf"] = {
combination= { "GN", "-STf" },
utype = "force",
},
["GN STf LTf"] = {
combination= { "GN", "-STf", "-LTf" },
utype = "force",
},
["kN LTf"] = {
combination= { "kN", "-LTf" },
utype = "force",
},
["kN LTf STf"] = {
combination= { "kN", "-LTf", "-STf" },
utype = "force",
},
["kN STf"] = {
combination= { "kN", "-STf" },
utype = "force",
},
["kN STf LTf"] = {
combination= { "kN", "-STf", "-LTf" },
utype = "force",
},
["LTf STf"] = {
combination= { "-LTf", "-STf" },
utype = "force",
},
["MN LTf"] = {
combination= { "MN", "-LTf" },
utype = "force",
},
["MN LTf STf"] = {
combination= { "MN", "-LTf", "-STf" },
utype = "force",
},
["MN STf"] = {
combination= { "MN", "-STf" },
utype = "force",
},
["MN STf LTf"] = {
combination= { "MN", "-STf", "-LTf" },
utype = "force",
},
["STf LTf"] = {
combination= { "-STf", "-LTf" },
utype = "force",
},
["L/100 km mpgimp"] = {
combination= { "L/100 km", "mpgimp" },
utype = "fuel efficiency",
},
["l/100 km mpgimp"] = {
combination= { "l/100 km", "mpgimp" },
utype = "fuel efficiency",
},
["L/100 km mpgUS"] = {
combination= { "L/100 km", "mpgus" },
utype = "fuel efficiency",
},
["L/100 km mpgus"] = {
combination= { "L/100 km", "mpgus" },
utype = "fuel efficiency",
},
["l/100 km mpgus"] = {
combination= { "l/100 km", "mpgus" },
utype = "fuel efficiency",
},
["mpgimp L/100 km"] = {
combination= { "mpgimp", "L/100 km" },
utype = "fuel efficiency",
},
["LT ST t"] = {
combination= { "lt", "-ST", "t" },
utype = "mass",
},
["LT t ST"] = {
combination= { "lt", "t", "-ST" },
utype = "mass",
},
["ST LT t"] = {
combination= { "-ST", "lt", "t" },
utype = "mass",
},
["ST t LT"] = {
combination= { "-ST", "t", "lt" },
utype = "mass",
},
["t LT ST"] = {
combination= { "t", "lt", "-ST" },
utype = "mass",
},
["ton"] = {
combination= { "LT", "ST" },
utype = "mass",
},
["kPa kg/cm2"] = {
combination= { "kPa", "kgf/cm2" },
utype = "pressure",
},
["kPa lb/in2"] = {
combination= { "kPa", "-lb/in2" },
utype = "pressure",
},
["floz"] = {
combination= { "impoz", "USoz" },
utype = "volume",
},
}
---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above). --
---------------------------------------------------------------------------
local default_exceptions = {
-- Prefixed units with a default different from that of the base unit.
-- Each key item is a prefixed symbol (unitcode for engineering notation).
["cm<sup>2</sup>"] = "sqin",
["dm<sup>2</sup>"] = "sqin",
["e3acre"] = "km2",
["e3m2"] = "e6sqft",
["e6acre"] = "km2",
["e6ha"] = "e6acre",
["e6km2"] = "e6sqmi",
["e6m2"] = "e6sqft",
["e6sqft"] = "v * 9.290304 < 100 ! e3 ! e6 ! m2",
["e6sqmi"] = "e6km2",
["hm<sup>2</sup>"] = "acre",
["km<sup>2</sup>"] = "sqmi",
["mm<sup>2</sup>"] = "sqin",
["aJ"] = "eV",
["e3BTU"] = "MJ",
["e6BTU"] = "GJ",
["EJ"] = "kWh",
["eV"] = "aJ",
["feV"] = "yJ",
["fJ"] = "keV",
["GeV"] = "nJ",
["GJ"] = "kWh",
["keV"] = "fJ",
["MeV"] = "pJ",
["meV"] = "zJ",
["MJ"] = "kWh",
["neV"] = "yJ",
["PeV"] = "mJ",
["peV"] = "yJ",
["PJ"] = "kWh",
["pJ"] = "MeV",
["TeV"] = "μJ",
["TJ"] = "kWh",
["YJ"] = "kWh",
["yJ"] = "μeV",
["ZJ"] = "kWh",
["zJ"] = "meV",
["μeV"] = "yJ",
["e12cuft/a"] = "v * 2.8316846592 < 100 ! e9 ! e12 ! m3/a",
["e12cuft/d"] = "v * 2.8316846592 < 100 ! e9 ! e12 ! m3/d",
["e12m3/a"] = "Tcuft/a",
["e12m3/d"] = "Tcuft/d",
["e3cuft/a"] = "v * 2.8316846592 < 100 ! ! e3 ! m3/a",
["e3cuft/d"] = "v * 2.8316846592 < 100 ! ! e3 ! m3/d",
["e3cuft/s"] = "v * 2.8316846592 < 100 ! ! e3 ! m3/s",
["e3m3/a"] = "v < 28.316846592 ! k ! M ! cuft/a",
["e3m3/d"] = "v < 28.316846592 ! k ! M ! cuft/d",
["e3m3/s"] = "v < 28.316846592 ! k ! M ! cuft/s",
["e3USgal/a"] = "v * 3.785411784 < 1000 ! ! e3 ! m3/a",
["e6cuft/a"] = "v * 2.8316846592 < 100 ! e3 ! e6 ! m3/a",
["e6cuft/d"] = "v * 2.8316846592 < 100 ! e3 ! e6 ! m3/d",
["e6cuft/s"] = "v * 2.8316846592 < 100 ! e3 ! e6 ! m3/s",
["e6m3/a"] = "v < 28.316846592 ! M ! G ! cuft/a",
["e6m3/d"] = "v < 28.316846592 ! M ! G ! cuft/d",
["e6m3/s"] = "v < 28.316846592 ! e6 ! e9 ! cuft/s",
["e6USgal/a"] = "v * 3.785411784 < 1000 ! e3 ! e6 ! m3/a",
["e9cuft/a"] = "m3/a",
["e9cuft/d"] = "v * 2.8316846592 < 100 ! e6 ! e9 ! m3/d",
["e9m3/a"] = "v < 28.316846592 ! G ! T ! cuft/a",
["e9m3/d"] = "v < 28.316846592 ! G ! T ! cuft/d",
["e9m3/s"] = "v < 28.316846592 ! e9 ! e12 ! cuft/s",
["e9USgal/a"] = "v * 3.785411784 < 1000 ! e6 ! e9 ! m3/a",
["e9USgal/s"] = "v * 3.785411784 < 1000 ! e6 ! e9 ! m3/s",
["nN"] = "gr-f",
["μN"] = "gr-f",
["mN"] = "oz-f",
["am"] = "in",
["cm"] = "in",
["dam"] = "ft",
["dm"] = "in",
["e12km"] = "e12mi",
["e12mi"] = "e12km",
["e3AU"] = "ly",
["e3km"] = "e3mi",
["e3mi"] = "e3km",
["e6km"] = "e6mi",
["e6mi"] = "e6km",
["e9km"] = "AU",
["e9mi"] = "e9km",
["Em"] = "mi",
["fm"] = "in",
["Gm"] = "mi",
["hm"] = "ft",
["km"] = "mi",
["mm"] = "in",
["Mm"] = "mi",
["nm"] = "in",
["Pm"] = "mi",
["pm"] = "in",
["Tm"] = "mi",
["Ym"] = "mi",
["ym"] = "in",
["Zm"] = "mi",
["zm"] = "in",
["μm"] = "in",
["e12lb"] = "v * 4.5359237 < 10 ! Mt ! Gt",
["e3lb"] = "v * 4.5359237 < 10 ! kg ! t",
["e3ozt"] = "v * 0.311034768 < 10 ! kg ! t",
["e3t"] = "LT ST",
["e6carat"] = "t",
["e6lb"] = "v * 4.5359237 < 10 ! t ! kilotonne",
["e6ozt"] = "lb kg",
["e6ST"] = "Mt",
["e6t"] = "LT ST",
["e9lb"] = "v * 4.5359237 < 10 ! kilotonne ! Mt",
["e9t"] = "LT ST",
["Gg"] = "lb",
["kg"] = "lb",
["mg"] = "gr",
["Mg"] = "LT ST",
["ng"] = "gr",
["μg"] = "gr",
["mBq"] = "fCi",
["kBq"] = "nCi",
["MBq"] = "μCi",
["GBq"] = "mCi",
["TBq"] = "Ci",
["PBq"] = "kCi",
["EBq"] = "kCi",
["fCi"] = "mBq",
["pCi"] = "Bq",
["nCi"] = "Bq",
["μCi"] = "kBq",
["mCi"] = "MBq",
["kCi"] = "TBq",
["MCi"] = "PBq",
["ns"] = "μs",
["μs"] = "ms",
["ms"] = "s",
["ks"] = "h",
["Ms"] = "week",
["Gs"] = "decade",
["Ts"] = "millennium",
["Ps"] = "million year",
["Es"] = "thousand million year",
["MK"] = "keVT",
["cL"] = "impoz usoz",
["cl"] = "impoz usoz",
["cm<sup>3</sup>"] = "cuin",
["dL"] = "impoz usoz",
["dl"] = "impoz usoz",
["mm<sup>3</sup>"] = "cuin",
["dm<sup>3</sup>"] = "cuin",
["e12cuft"] = "v * 2.8316846592 < 100 ! e9 ! e12 ! m3",
["e12impgal"] = "v * 4.54609 < 1000 ! T ! P ! l",
["e12m3"] = "v < 28.316846592 ! T ! P ! cuft",
["e12U.S.gal"] = "v * 3.785411784 < 1000 ! T ! P ! l",
["e12USgal"] = "v * 3.785411784 < 1000 ! T ! P ! l",
["e15cuft"] = "v * 2.8316846592 < 100 ! e12 ! e15 ! m3",
["e15m3"] = "Pcuft",
["e3bdft"] = "v * 0.23597372167 < 100 ! e3 ! e6 ! m3",
["e3cuft"] = "v * 2.8316846592 < 100 ! ! e3 ! m3",
["e3impgal"] = "v * 4.54609 < 1000 ! k ! M ! l",
["e3m3"] = "v < 28.316846592 ! k ! M ! cuft",
["e3U.S.gal"] = "v * 3.785411784 < 1000 ! k ! M ! l",
["e3USgal"] = "v * 3.785411784 < 1000 ! k ! M ! l",
["e6bdft"] = "v * 0.23597372167 < 100 ! e3 ! e6 ! m3",
["e6cuft"] = "v * 2.8316846592 < 100 ! e3 ! e6 ! m3",
["e6cuyd"] = "v * 7.64554857984 < 10 ! e3 ! e6 ! m3",
["e6impgal"] = "v * 4.54609 < 1000 ! M ! G ! l",
["e6L"] = "USgal",
["e6m3"] = "v < 28.316846592 ! M ! G ! cuft",
["e6U.S.gal"] = "v * 3.785411784 < 1000 ! M ! G ! l",
["e6USgal"] = "v * 3.785411784 < 1000 ! M ! G ! l",
["e9bdft"] = "v * 0.23597372167 < 100 ! e6 ! e9 ! m3",
["e9cuft"] = "v * 2.8316846592 < 100 ! e6 ! e9 ! m3",
["e9impgal"] = "v * 4.54609 < 1000 ! G ! T ! l",
["e9m3"] = "v < 28.316846592 ! G ! T ! cuft",
["e9U.S.gal"] = "v * 3.785411784 < 1000 ! G ! T ! l",
["e9USgal"] = "v * 3.785411784 < 1000 ! G ! T ! l",
["GL"] = "cuft",
["Gl"] = "cuft",
["kL"] = "cuft",
["kl"] = "cuft",
["km<sup>3</sup>"] = "cumi",
["mL"] = "impoz usoz",
["ml"] = "impoz usoz",
["Ml"] = "v < 28.316846592 ! e3 ! e6 ! cuft",
["ML"] = "v < 28.316846592 ! e3 ! e6 ! cuft",
["TL"] = "cumi",
["Tl"] = "cumi",
["μL"] = "cuin",
["μl"] = "cuin",
}
---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above). --
---------------------------------------------------------------------------
local link_exceptions = {
-- Prefixed units with a linked article different from that of the base unit.
-- Each key item is a prefixed symbol (not unitcode).
["mm<sup>2</sup>"] = "Square millimetre",
["cm<sup>2</sup>"] = "Square centimetre",
["dm<sup>2</sup>"] = "Square decimetre",
["km<sup>2</sup>"] = "Square kilometre",
["kJ"] = "Kilojoule",
["MJ"] = "Megajoule",
["GJ"] = "Gigajoule",
["TJ"] = "Terajoule",
["fm"] = "Femtometre",
["pm"] = "Picometre",
["nm"] = "Nanometre",
["μm"] = "Micrometre",
["mm"] = "Millimetre",
["cm"] = "Centimetre",
["dm"] = "Decimetre",
["dam"] = "Decametre",
["hm"] = "Hectometre",
["km"] = "Kilometre",
["Mm"] = "Megametre",
["Gm"] = "Gigametre",
["Tm"] = "Terametre",
["Pm"] = "Petametre",
["Em"] = "Exametre",
["Zm"] = "Zettametre",
["Ym"] = "Yottametre",
["μg"] = "Microgram",
["mg"] = "Milligram",
["kg"] = "Kilogram",
["Mg"] = "Tonne",
["yW"] = "Yoctowatt",
["zW"] = "Zeptowatt",
["aW"] = "Attowatt",
["fW"] = "Femtowatt",
["pW"] = "Picowatt",
["nW"] = "Nanowatt",
["μW"] = "Microwatt",
["mW"] = "Milliwatt",
["kW"] = "Kilowatt",
["MW"] = "Megawatt",
["GW"] = "Gigawatt",
["TW"] = "Terawatt",
["PW"] = "Petawatt",
["EW"] = "Exawatt",
["ZW"] = "Zettawatt",
["YW"] = "Yottawatt",
["as"] = "Attosecond",
["fs"] = "Femtosecond",
["ps"] = "Picosecond",
["ns"] = "Nanosecond",
["μs"] = "Microsecond",
["ms"] = "Millisecond",
["ks"] = "Kilosecond",
["Ms"] = "Megasecond",
["Gs"] = "Gigasecond",
["Ts"] = "Terasecond",
["Ps"] = "Petasecond",
["Es"] = "Exasecond",
["Zs"] = "Zettasecond",
["Ys"] = "Yottasecond",
["mm<sup>3</sup>"] = "Cubic millimetre",
["cm<sup>3</sup>"] = "Cubic centimetre",
["dm<sup>3</sup>"] = "Cubic decimetre",
["dam<sup>3</sup>"] = "Cubic decametre",
["km<sup>3</sup>"] = "Cubic kilometre",
["μL"] = "Microlitre",
["μl"] = "Microlitre",
["mL"] = "Millilitre",
["ml"] = "Millilitre",
["cL"] = "Centilitre",
["cl"] = "Centilitre",
["dL"] = "Decilitre",
["dl"] = "Decilitre",
["daL"] = "Decalitre",
["dal"] = "Decalitre",
["hL"] = "Hectolitre",
["hl"] = "Hectolitre",
["kL"] = "Kilolitre",
["kl"] = "Kilolitre",
["ML"] = "Megalitre",
["Ml"] = "Megalitre",
["GL"] = "Gigalitre",
["Gl"] = "Gigalitre",
["TL"] = "Teralitre",
["Tl"] = "Teralitre",
["PL"] = "Petalitre",
["Pl"] = "Petalitre",
}
---------------------------------------------------------------------------
-- Do not change the data in this table because it is created by running --
-- a script that reads the wikitext from a wiki page (see note above). --
---------------------------------------------------------------------------
local per_unit_fixups = {
-- Automatically created per units of form "x/y" may have their unit type
-- changed, for example, "length/time" is changed to "speed".
-- Other adjustments can also be specified.
["/area"] = "per unit area",
["/volume"] = "per unit volume",
["area/area"] = "area per unit area",
["energy/length"] = "energy per unit length",
["energy/mass"] = "energy per unit mass",
["energy/time"] = { utype = "power", link = "Power (physics)" },
["energy/volume"] = "energy per unit volume",
["force/area"] = { utype = "pressure", link = "Pressure" },
["length/length"] = { utype = "gradient", link = "Grade (slope)" },
["length/time"] = { utype = "speed", link = "Speed" },
["length/time/time"] = { utype = "acceleration", link = "Acceleration" },
["mass/area"] = { utype = "pressure", multiplier = 9.80665 },
["mass/length"] = "linear density",
["mass/mass"] = "concentration",
["mass/power"] = "mass per unit power",
["mass/time"] = "mass per unit time",
["mass/volume"] = { utype = "density", link = "Density" },
["power/mass"] = "power per unit mass",
["power/volume"] = { link = "Power density" },
["pressure/length"] = "fracture gradient",
["speed/time"] = { utype = "acceleration", link = "Acceleration" },
["volume/area"] = "volume per unit area",
["volume/length"] = "volume per unit length",
["volume/time"] = "flow",
}
return {
all_units = all_units,
default_exceptions = default_exceptions,
link_exceptions = link_exceptions,
per_unit_fixups = per_unit_fixups,
}
hqgudow086bv1ct4yxtqfzm8bjmx0b1
Модул:Convert/text
828
3647
21757
2025-10-05T07:15:45Z
Johnuniq
2793
update from sandbox per [[Template talk:Convert#Module version 31]]
21757
Scribunto
text/plain
-- Text used by Module:Convert for enwiki.
-- This is a separate module to simplify translation for use on another wiki.
-- See [[:en:Template:Convert/Transwiki guide]] if copying to another wiki.
-- Some units accept an SI prefix before the unit code, such as "kg" for kilogram.
local SIprefixes = {
-- The prefix field is what the prefix should be, if different from the prefix used.
['Q'] = { exponent = 30, name = 'quetta', },
['R'] = { exponent = 27, name = 'ronna', },
['Y'] = { exponent = 24, name = 'yotta', },
['Z'] = { exponent = 21, name = 'zetta', },
['E'] = { exponent = 18, name = 'exa' , },
['P'] = { exponent = 15, name = 'peta' , },
['T'] = { exponent = 12, name = 'tera' , },
['G'] = { exponent = 9, name = 'giga' , },
['M'] = { exponent = 6, name = 'mega' , },
['k'] = { exponent = 3, name = 'kilo' , },
['h'] = { exponent = 2, name = 'hecto', },
['da']= { exponent = 1, name = 'deca' , name_us = 'deka' },
['d'] = { exponent = -1, name = 'deci' , },
['c'] = { exponent = -2, name = 'centi', },
['m'] = { exponent = -3, name = 'milli', },
['μ'] = { exponent = -6, name = 'micro', }, -- key = 'GREEK SMALL LETTER MU' (U+03BC) utf-8 CE BC
['µ'] = { exponent = -6, name = 'micro', prefix = 'μ' }, -- key = 'MICRO SIGN' (U+00B5) utf-8 C2 B5
['u'] = { exponent = -6, name = 'micro', prefix = 'μ' }, -- not an SI prefix, but allow for people typing this
['n'] = { exponent = -9, name = 'nano' , },
['p'] = { exponent =-12, name = 'pico' , },
['f'] = { exponent =-15, name = 'femto', },
['a'] = { exponent =-18, name = 'atto' , },
['z'] = { exponent =-21, name = 'zepto', },
['y'] = { exponent =-24, name = 'yocto', },
['r'] = { exponent =-27, name = 'ronto', },
['q'] = { exponent =-30, name = 'quecto', },
}
-- Some units can be qualified with one of the following prefixes, when linked.
local customary_units = {
{ "US", link = "United States customary units" },
{ "U.S.", link = "United States customary units" },
{ "imperial", link = "Imperial units" },
{ "imp", link = "Imperial units" },
}
-- Names when using engineering notation (a prefix of "eN" where N is a number; example "e6km").
-- key = { "name", link = "article title", exponent = numeric_key_value }
-- If lk=on and link is defined, the name of the number will appear as a link.
local eng_scales = {
["3"] = { "thousand", exponent = 3 },
["6"] = { "million", exponent = 6 },
["9"] = { "billion", link = "1000000000 (number)", exponent = 9 },
["12"] = { "trillion", link = "1000000000000 (number)", exponent = 12 },
["15"] = { "quadrillion", link = "1000000000000000 (number)", exponent = 15 },
}
local all_categories = {
unit = "[[Category:Convert errors]]",
option = "[[Category:Convert errors]]",
warning = '[[Category:Convert invalid options]]',
tracking = '[[Category:Convert tracking]]',
}
-- For some error messages, the following puts the wanted style around
-- each unit code marked like '...%{ft%}...'.
local unitcode_regex = '%%([{}])'
local unitcode_replace = { ['{'] = '"', ['}'] = '"' } -- no longer need the more elaborate substitute used before 2013-09-28
-- All messages that may be displayed if a problem occurs.
local all_messages = {
-- Message format string: $1=title, $2=text, $3=category, $4=anchor.
-- Each displayed message starts with "Convert:" so can easily locate by searching article.
cvt_format = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i>[[Help:Convert messages#$4|<span title="Convert: $1">convert: $2</span>]]</i>]</sup>$3<span class="error"></span>',
cvt_format2 = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[[Help:Convert messages#$4|<span title="Convert: $1">$2</span>]]</sup>$3<span class="error"></span>',
cvt_format_preview = '<strong class="error">Error in convert: $1 [[Help:Convert messages#$4|(help)]]</strong>$3',
-- Each of following messages is a table:
-- { [1] = 'title', -- mouseover title text
-- [2] = 'text', -- link text displayed in article
-- [3] = 'category key', -- key to lookup category in all_categories
-- [4] = 'anchor', -- anchor for link to relevant section on help page
-- regex = gsub_regex,
-- replace = gsub_table,
-- } Mouseover title text Link text CatKey Anchor
cvt_bad_input = { 'input "$1" must be a number and unit' , 'invalid input' , 'option', 'invalid_input' },
cvt_bad_num = { 'Value "$1" must be a number' , 'invalid number' , 'option', 'invalid_number' },
cvt_big_prec = { 'Precision "$1" is too large' , 'precision too large' , 'option', 'precision_too_large' },
cvt_invalid_num = { 'Number has overflowed' , 'number overflow' , 'option', 'number_overflow' },
cvt_no_num = { 'Needs the number to be converted' , 'needs a number' , 'option', 'needs_number' },
cvt_no_num2 = { 'Needs another number for a range' , 'needs another number', 'option', 'needs_another_number' },
cvt_bad_altitude = { '"$1" needs an integer' , 'invalid altitude' , 'option', 'invalid_altitude' },
cvt_bad_frac = { '"$1" needs an integer above 1' , 'invalid fraction' , 'option', 'invalid_fraction' },
cvt_bad_prec = { 'Precision "$1" must be an integer' , 'invalid precision' , 'option', 'invalid_precision' },
cvt_bad_sigfig = { '"$1" needs a positive integer' , 'invalid sigfig' , 'option', 'invalid_sigfig' },
cvt_empty_option = { 'Ignored empty option "$1"' , 'empty option' , 'option', 'empty_option' },
cvt_deprecated = { 'Option "$1" is deprecated' , '*' , 'option', 'deprecated_option', format = 'cvt_format2', nowarn = true },
cvt_no_spell = { 'Spelling is not available' , 'bug, ask for help' , 'option', 'ask_for_help' },
cvt_unknown_option = { 'Ignored invalid option "$1"' , 'invalid option' , 'option', 'invalid_option' },
cvt_wd_fail = { 'Unable to access Wikidata' , 'wikidata problem' , 'option', 'wikidata_problem' },
cvt_bad_default = { 'Unit "$1" has an invalid default' , 'bug, ask for help' , 'unit' , 'ask_for_help' },
cvt_bad_unit = { 'Unit "$1" is invalid here' , 'unit invalid here' , 'unit' , 'unit_invalid_here' },
cvt_no_default = { 'Unit "$1" has no default output unit' , 'bug, ask for help' , 'unit' , 'ask_for_help' },
cvt_no_unit = { 'Needs name of unit' , 'needs unit name' , 'unit' , 'needs_unit_name' },
cvt_unknown = { 'Unit name "$1" is not known' , 'unknown unit' , 'unit' , 'unknown_unit' },
cvt_should_be = { '$1' , 'ambiguous unit' , 'unit' , 'ambiguous_unit', regex = unitcode_regex, replace = unitcode_replace },
cvt_mismatch = { 'Cannot convert "$1" to "$2"' , 'unit mismatch' , 'unit' , 'unit_mismatch' },
cvt_bug_convert = { 'Bug: Cannot convert between specified units', 'bug, ask for help' , 'unit' , 'ask_for_help' },
cvt_lookup = { 'Unit "$1" is incorrectly defined' , 'bug, ask for help' , 'unit' , 'ask_for_help' },
}
-- Text to join input value/unit with output value/unit.
local disp_joins = {
-- [1]=before output, [2]=after output, [3]=between outputs in a combination; default "; "
-- [wantname] gives default abbr=off
["or"] = { " or " , "" , " or ", wantname = true },
["sqbr-sp"] = { " [" , "]" },
["sqbr-nbsp"] = { " [" , "]" },
["comma"] = { ", " , "" , ", " },
["semicolon"] = { "; " , "" },
["slash-sp"] = { " / " , "" , wantname = true },
["slash-nbsp"] = { " / ", "" , wantname = true },
["slash-nosp"] = { "/" , "" , wantname = true },
["b"] = { " (" , ")" },
["(or)"] = { " (" , ")", " or " },
["br"] = { "<br />" , "" , wantname = true },
["br()"] = { "<br />(" , ")", wantname = true },
}
-- Text to separate values in a range.
local range_types = {
-- Specifying a table requires either:
-- * "off" and "on" values (for "abbr=off" and "abbr=on"), or
-- * "input" and "output" values (for LHS and RHS);
-- other fields are optional.
-- When "adj=on|abbr=off" applies, spaces in range text are replaced with hyphens.
-- With "exception = true", that also occurs with "adj=on|abbr=on".
-- If "adj" is defined here, that text (unchanged) is used with "adj=on".
["+"] = " + ",
[","] = ", ",
[", and"] = ", and ",
[", or"] = ", or ",
["by"] = " by ",
["-"] = "–",
["to about"] = " to about ",
["and"] = { off = " and ", on = " and ", exception = true },
["and(-)"] = { input = " and ", output = "–" },
["or"] = { off = " or " , on = " or " , exception = true },
["to"] = { off = " to " , on = " to " , exception = true },
["to(-)"] = { input = " to ", output = "–" },
["+/-"] = { off = " ± ", on = " ± ", adj = " ± ", is_range_change = true },
["by(x)"] = { input = " by ", output = " × ", out_range_x = true },
["x"] = { off = " by ", on = " × ", abbr_range_x = true },
["xx"] = " × ",
["*"] = "×",
["/"] = " / ", -- for a table of high/low temperatures with {{convert|83|/|63|F|disp=br()|abbr=values}}
}
local range_aliases = {
-- ["alternative name for a range"] = "standard range name"
["–"] = "-",
["–"] = "-",
["×"] = "x",
["×"] = "x",
["±"] = "+/-",
["±"] = "+/-",
}
-- Convert accepts range text delimited with whitespace, for example, {{convert|1 to 2|ft}}.
-- In addition, the following "words" are accepted without spaces, for example, {{convert|1-2|ft}}.
-- Words must be in correct order for searching, for example, 'x' after 'xx'.
local range_words = { '-', '–', 'xx', 'x', '*' }
local ranges = {
types = range_types,
aliases = range_aliases,
words = range_words,
}
-- Valid option names.
local en_option_name = {
-- ["local text for option name"] = "en name used in this module"
["$"] = "$",
["abbr"] = "abbr",
["adj"] = "adj",
["altitude_ft"] = "altitude_ft",
["altitude_m"] = "altitude_m",
["comma"] = "comma",
["debug"] = "debug",
["disp"] = "disp",
["error"] = "error",
["frac"] = "frac",
["input"] = "input",
["lang"] = "lang",
["link"] = "lk",
["lk"] = "lk",
["order"] = "order",
["qid"] = "qid",
["qual"] = "qual",
["qualifier"] = "qual",
["round"] = "round",
["sigfig"] = "sigfig",
["sing"] = "adj", -- "sing" is an old alias for "adj"
["sortable"] = "sortable",
["sp"] = "sp",
["spell"] = "spell",
["stylein"] = "stylein",
["styleout"] = "styleout",
["tracking"] = "tracking",
}
-- Valid option values.
-- Convention: parms.opt_xxx refers to an option that is set here
-- (not intended to be set by the template which invokes this module).
-- Example: At enwiki, "abbr" includes:
-- ["values"] = "opt_values"
-- As a result, if the template uses abbr=values, Module:Convert sets:
-- parms["opt_values"] = true
-- parms["abbr"] = nil
-- Therefore parms.abbr will be nil, or will have one of the listed values
-- that do not start with "opt_".
-- An option value of form "xxx?" is the same as "xxx" but shows the input as deprecated.
-- Options removed in January 2018 with remnants still in Module:Convert:
-- abbr=mos (in a range, repeat the input unit)
-- adj=1 (set opt_singular to make the unit name singular when 0 < abs(value) <= 1)
local en_option_value = {
["$"] = 'TEXT', -- TEXT should be a currency symbol that will be used instead of "$"
["abbr"] = {
-- ["local text for option value"] = "en value used in this module"
["def"] = "", -- ignored (some wrapper templates call convert with "abbr=def" to mean "default abbreviation")
["h"] = "on", -- abbr=on + use "h" for hand unit (default)
["hh"] = "opt_hand_hh", -- abbr=on + use "hh" for hand unit
["in"] = "in", -- use symbol for LHS unit
["none"] = "off", -- old name for "off"
["off"] = "off", -- use name for all units
["on"] = "on", -- use symbol for all units
["out"] = "out", -- use symbol for RHS unit (default)
["unit"] = "unit", -- abbr=on but abbreviate units only: e6km → million km (not ×10⁶ km)
["values"] = "opt_values", -- show only input and output numbers, not units
["~"] = "opt_also_symbol", -- show input unit symbol as well as name
},
["adj"] = {
["mid"] = "opt_adjectival, opt_adj_mid", -- adj=on with user-specified text after input unit (between input and output)
["off"] = "", -- ignored (off is the default)
["on"] = "opt_adjectival", -- unit name is singular and hyphenated
["pre"] = "opt_one_preunit", -- user-specified text before input unit
["ri0"] = "opt_ri=0", -- round input with precision = 0
["ri1"] = "opt_ri=1", -- round input with precision = 1
["ri2"] = "opt_ri=2", -- round input with precision = 2
["ri3"] = "opt_ri=3", -- round input with precision = 3
["~"] = "opt_also_symbol", -- same as abbr=~ so can have {{convert|1|C|K|abbr=off|adj=~}}
},
["altitude_ft"] = 'INTEGER',
["altitude_m"] = 'INTEGER',
["comma"] = {
["5"] = "opt_comma5", -- only use numsep grouping if 5 or more digits
["gaps"] = "opt_gaps", -- use gaps, not numsep, to separate groups of digits
["gaps3"] = "opt_gaps, opt_gaps3", -- group only in threes rather than default of no gap before a single digit after decimal mark
["off"] = "opt_nocomma", -- no numsep in input or output numbers
},
["debug"] = {
["yes"] = "opt_sortable_debug", -- make the normally hidden sort key visible
},
["disp"] = {
["5"] = "opt_round=5?", -- round output value to nearest 5
["b"] = "b", -- join: '(...)'
["(or)"] = "(or)", -- join: '(...)' with 'or' between outputs in a combination
["br"] = "br", -- join: '<br />'
["br()"] = "br()", -- join: '<br />(...)'
["comma"] = "comma", -- join: ','
["flip"] = "opt_flip", -- reverse order of input/output
["number"] = "opt_output_number_only", -- display output value (not input, and not output symbol/name)
["or"] = "or", -- join: 'or'
["out"] = "opt_output_only",
["output number only"] = "opt_output_number_only",
["output only"] = "opt_output_only",
["preunit"] = "opt_two_preunits", -- user-specified text before input and output units
["semicolon"] = "semicolon", -- join: ';'
["sqbr"] = "sqbr", -- join: '[...]'
["table"] = "opt_table", -- output is suitable for a table cell with align="right"
["tablecen"] = "opt_tablecen", -- output is suitable for a table cell with align="center"
["unit"] = "opt_input_unit_only", -- display input symbol/name (not output, and not input value)
["unit or text"] = "opt_input_unit_only, opt_ignore_error", -- display input symbol/name, or given unit code if not known
["unit2"] = "opt_output_unit_only",
["x"] = "x", -- join: <first>...<second> (user-specified text)
},
["error"] = 'TEXT', -- TEXT is any text that will be returned if the conversion fails, instead of an error occurring
["frac"] = 'INTEGER',
["input"] = 'TEXT', -- TEXT should be <value><space><unitcode> or <wikidata-property-id>
["lang"] = { -- language for output digits (both en and local digits are always accepted for input)
["en"] = "opt_lang_en", -- use en digits for numbers, regardless of local language
["local"] = "opt_lang_local", -- use local digits for numbers (default, although config can change default to en)
},
["lk"] = {
["in"] = "in", -- link LHS unit name or symbol
["off"] = "off", -- do not link: same as default except for hand unit
["on"] = "on", -- link all unit names or symbols (but not twice for the same unit)
["out"] = "out", -- link RHS unit name or symbol
},
["order"] = {
["flip"] = "opt_flip", -- reverse order of input/output
["out"] = "opt_order_out", -- do not show input; instead, use order in output combination, with the first output shown as the input
},
["qid"] = 'TEXT', -- TEXT should be a Wikidata Q item identifier
["qual"] = 'TEXT', -- TEXT should be a Wikidata Q item identifier
["round"] = {
["0.5"] = "opt_round=0.5", -- round output value to nearest 0.5
["5"] = "opt_round=5", -- round output value to nearest 5
["10"] = "opt_round=10", -- round output value to nearest 10 (same as but clearer than "|-1")
["25"] = "opt_round=25", -- round output value to nearest 25
["50"] = "opt_round=50", -- round output value to nearest 50
["each"] = "opt_round_each", -- using default precision in a range, round each output separately (default uses highest precision of each item in range)
},
["sigfig"] = 'INTEGER',
["sortable"] = {
["off"] = "", -- ignored (off is the default)
["on"] = "opt_sortable_on", -- output sort key for use in a sortable table, based on value from converting to a standard base unit
["debug"] = "opt_sortable_on, opt_sortable_debug", -- |sortable=debug is the same as |sortable=on|debug=yes
},
["sp"] = {
["us"] = "opt_sp_us", -- use U.S. spelling (like "meter" instead of default "metre")
},
["spell"] = { -- only English spelling is supported; not scientific notation; only some fractions
["in"] = "opt_spell_in", -- spell input value in words
["In"] = "opt_spell_in, opt_spell_upper", -- spell input value in words with first letter uppercase
["on"] = "opt_spell_in, opt_spell_out", -- spell input and output values in words
["On"] = "opt_spell_in, opt_spell_out, opt_spell_upper", -- same, with first letter of first word in result uppercase
["us"] = "opt_sp_us", -- use U.S. spelling; same as sp=us so spell=us also works
},
["stylein"] = 'TEXT',
["styleout"] = 'TEXT',
["tracking"] = 'TEXT',
}
local titles = {
["frac"] = "Fraction/styles.css",
["sfrac"] = "Sfrac/styles.css",
}
return {
SIprefixes = SIprefixes,
all_categories = all_categories,
all_messages = all_messages,
currency = { ['$'] = true, ['£'] = true, ['€'] = true, ['₱'] = true, ['₽'] = true, ['¥'] = true },
customary_units = customary_units,
disp_joins = disp_joins,
en_option_name = en_option_name,
en_option_value = en_option_value,
eng_scales = eng_scales,
ranges = ranges,
titles = titles,
}
8m007l7jx7mdwwt2dfy66a3yo6no2nr
21758
21757
2026-09-18T15:05:25Z
Keresturec
18
1 измена увезена из [[:en:Module:Convert/text]]: Importing from the English wikipedia
21757
Scribunto
text/plain
-- Text used by Module:Convert for enwiki.
-- This is a separate module to simplify translation for use on another wiki.
-- See [[:en:Template:Convert/Transwiki guide]] if copying to another wiki.
-- Some units accept an SI prefix before the unit code, such as "kg" for kilogram.
local SIprefixes = {
-- The prefix field is what the prefix should be, if different from the prefix used.
['Q'] = { exponent = 30, name = 'quetta', },
['R'] = { exponent = 27, name = 'ronna', },
['Y'] = { exponent = 24, name = 'yotta', },
['Z'] = { exponent = 21, name = 'zetta', },
['E'] = { exponent = 18, name = 'exa' , },
['P'] = { exponent = 15, name = 'peta' , },
['T'] = { exponent = 12, name = 'tera' , },
['G'] = { exponent = 9, name = 'giga' , },
['M'] = { exponent = 6, name = 'mega' , },
['k'] = { exponent = 3, name = 'kilo' , },
['h'] = { exponent = 2, name = 'hecto', },
['da']= { exponent = 1, name = 'deca' , name_us = 'deka' },
['d'] = { exponent = -1, name = 'deci' , },
['c'] = { exponent = -2, name = 'centi', },
['m'] = { exponent = -3, name = 'milli', },
['μ'] = { exponent = -6, name = 'micro', }, -- key = 'GREEK SMALL LETTER MU' (U+03BC) utf-8 CE BC
['µ'] = { exponent = -6, name = 'micro', prefix = 'μ' }, -- key = 'MICRO SIGN' (U+00B5) utf-8 C2 B5
['u'] = { exponent = -6, name = 'micro', prefix = 'μ' }, -- not an SI prefix, but allow for people typing this
['n'] = { exponent = -9, name = 'nano' , },
['p'] = { exponent =-12, name = 'pico' , },
['f'] = { exponent =-15, name = 'femto', },
['a'] = { exponent =-18, name = 'atto' , },
['z'] = { exponent =-21, name = 'zepto', },
['y'] = { exponent =-24, name = 'yocto', },
['r'] = { exponent =-27, name = 'ronto', },
['q'] = { exponent =-30, name = 'quecto', },
}
-- Some units can be qualified with one of the following prefixes, when linked.
local customary_units = {
{ "US", link = "United States customary units" },
{ "U.S.", link = "United States customary units" },
{ "imperial", link = "Imperial units" },
{ "imp", link = "Imperial units" },
}
-- Names when using engineering notation (a prefix of "eN" where N is a number; example "e6km").
-- key = { "name", link = "article title", exponent = numeric_key_value }
-- If lk=on and link is defined, the name of the number will appear as a link.
local eng_scales = {
["3"] = { "thousand", exponent = 3 },
["6"] = { "million", exponent = 6 },
["9"] = { "billion", link = "1000000000 (number)", exponent = 9 },
["12"] = { "trillion", link = "1000000000000 (number)", exponent = 12 },
["15"] = { "quadrillion", link = "1000000000000000 (number)", exponent = 15 },
}
local all_categories = {
unit = "[[Category:Convert errors]]",
option = "[[Category:Convert errors]]",
warning = '[[Category:Convert invalid options]]',
tracking = '[[Category:Convert tracking]]',
}
-- For some error messages, the following puts the wanted style around
-- each unit code marked like '...%{ft%}...'.
local unitcode_regex = '%%([{}])'
local unitcode_replace = { ['{'] = '"', ['}'] = '"' } -- no longer need the more elaborate substitute used before 2013-09-28
-- All messages that may be displayed if a problem occurs.
local all_messages = {
-- Message format string: $1=title, $2=text, $3=category, $4=anchor.
-- Each displayed message starts with "Convert:" so can easily locate by searching article.
cvt_format = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[<i>[[Help:Convert messages#$4|<span title="Convert: $1">convert: $2</span>]]</i>]</sup>$3<span class="error"></span>',
cvt_format2 = '<sup class="noprint Inline-Template" style="white-space:nowrap;">[[Help:Convert messages#$4|<span title="Convert: $1">$2</span>]]</sup>$3<span class="error"></span>',
cvt_format_preview = '<strong class="error">Error in convert: $1 [[Help:Convert messages#$4|(help)]]</strong>$3',
-- Each of following messages is a table:
-- { [1] = 'title', -- mouseover title text
-- [2] = 'text', -- link text displayed in article
-- [3] = 'category key', -- key to lookup category in all_categories
-- [4] = 'anchor', -- anchor for link to relevant section on help page
-- regex = gsub_regex,
-- replace = gsub_table,
-- } Mouseover title text Link text CatKey Anchor
cvt_bad_input = { 'input "$1" must be a number and unit' , 'invalid input' , 'option', 'invalid_input' },
cvt_bad_num = { 'Value "$1" must be a number' , 'invalid number' , 'option', 'invalid_number' },
cvt_big_prec = { 'Precision "$1" is too large' , 'precision too large' , 'option', 'precision_too_large' },
cvt_invalid_num = { 'Number has overflowed' , 'number overflow' , 'option', 'number_overflow' },
cvt_no_num = { 'Needs the number to be converted' , 'needs a number' , 'option', 'needs_number' },
cvt_no_num2 = { 'Needs another number for a range' , 'needs another number', 'option', 'needs_another_number' },
cvt_bad_altitude = { '"$1" needs an integer' , 'invalid altitude' , 'option', 'invalid_altitude' },
cvt_bad_frac = { '"$1" needs an integer above 1' , 'invalid fraction' , 'option', 'invalid_fraction' },
cvt_bad_prec = { 'Precision "$1" must be an integer' , 'invalid precision' , 'option', 'invalid_precision' },
cvt_bad_sigfig = { '"$1" needs a positive integer' , 'invalid sigfig' , 'option', 'invalid_sigfig' },
cvt_empty_option = { 'Ignored empty option "$1"' , 'empty option' , 'option', 'empty_option' },
cvt_deprecated = { 'Option "$1" is deprecated' , '*' , 'option', 'deprecated_option', format = 'cvt_format2', nowarn = true },
cvt_no_spell = { 'Spelling is not available' , 'bug, ask for help' , 'option', 'ask_for_help' },
cvt_unknown_option = { 'Ignored invalid option "$1"' , 'invalid option' , 'option', 'invalid_option' },
cvt_wd_fail = { 'Unable to access Wikidata' , 'wikidata problem' , 'option', 'wikidata_problem' },
cvt_bad_default = { 'Unit "$1" has an invalid default' , 'bug, ask for help' , 'unit' , 'ask_for_help' },
cvt_bad_unit = { 'Unit "$1" is invalid here' , 'unit invalid here' , 'unit' , 'unit_invalid_here' },
cvt_no_default = { 'Unit "$1" has no default output unit' , 'bug, ask for help' , 'unit' , 'ask_for_help' },
cvt_no_unit = { 'Needs name of unit' , 'needs unit name' , 'unit' , 'needs_unit_name' },
cvt_unknown = { 'Unit name "$1" is not known' , 'unknown unit' , 'unit' , 'unknown_unit' },
cvt_should_be = { '$1' , 'ambiguous unit' , 'unit' , 'ambiguous_unit', regex = unitcode_regex, replace = unitcode_replace },
cvt_mismatch = { 'Cannot convert "$1" to "$2"' , 'unit mismatch' , 'unit' , 'unit_mismatch' },
cvt_bug_convert = { 'Bug: Cannot convert between specified units', 'bug, ask for help' , 'unit' , 'ask_for_help' },
cvt_lookup = { 'Unit "$1" is incorrectly defined' , 'bug, ask for help' , 'unit' , 'ask_for_help' },
}
-- Text to join input value/unit with output value/unit.
local disp_joins = {
-- [1]=before output, [2]=after output, [3]=between outputs in a combination; default "; "
-- [wantname] gives default abbr=off
["or"] = { " or " , "" , " or ", wantname = true },
["sqbr-sp"] = { " [" , "]" },
["sqbr-nbsp"] = { " [" , "]" },
["comma"] = { ", " , "" , ", " },
["semicolon"] = { "; " , "" },
["slash-sp"] = { " / " , "" , wantname = true },
["slash-nbsp"] = { " / ", "" , wantname = true },
["slash-nosp"] = { "/" , "" , wantname = true },
["b"] = { " (" , ")" },
["(or)"] = { " (" , ")", " or " },
["br"] = { "<br />" , "" , wantname = true },
["br()"] = { "<br />(" , ")", wantname = true },
}
-- Text to separate values in a range.
local range_types = {
-- Specifying a table requires either:
-- * "off" and "on" values (for "abbr=off" and "abbr=on"), or
-- * "input" and "output" values (for LHS and RHS);
-- other fields are optional.
-- When "adj=on|abbr=off" applies, spaces in range text are replaced with hyphens.
-- With "exception = true", that also occurs with "adj=on|abbr=on".
-- If "adj" is defined here, that text (unchanged) is used with "adj=on".
["+"] = " + ",
[","] = ", ",
[", and"] = ", and ",
[", or"] = ", or ",
["by"] = " by ",
["-"] = "–",
["to about"] = " to about ",
["and"] = { off = " and ", on = " and ", exception = true },
["and(-)"] = { input = " and ", output = "–" },
["or"] = { off = " or " , on = " or " , exception = true },
["to"] = { off = " to " , on = " to " , exception = true },
["to(-)"] = { input = " to ", output = "–" },
["+/-"] = { off = " ± ", on = " ± ", adj = " ± ", is_range_change = true },
["by(x)"] = { input = " by ", output = " × ", out_range_x = true },
["x"] = { off = " by ", on = " × ", abbr_range_x = true },
["xx"] = " × ",
["*"] = "×",
["/"] = " / ", -- for a table of high/low temperatures with {{convert|83|/|63|F|disp=br()|abbr=values}}
}
local range_aliases = {
-- ["alternative name for a range"] = "standard range name"
["–"] = "-",
["–"] = "-",
["×"] = "x",
["×"] = "x",
["±"] = "+/-",
["±"] = "+/-",
}
-- Convert accepts range text delimited with whitespace, for example, {{convert|1 to 2|ft}}.
-- In addition, the following "words" are accepted without spaces, for example, {{convert|1-2|ft}}.
-- Words must be in correct order for searching, for example, 'x' after 'xx'.
local range_words = { '-', '–', 'xx', 'x', '*' }
local ranges = {
types = range_types,
aliases = range_aliases,
words = range_words,
}
-- Valid option names.
local en_option_name = {
-- ["local text for option name"] = "en name used in this module"
["$"] = "$",
["abbr"] = "abbr",
["adj"] = "adj",
["altitude_ft"] = "altitude_ft",
["altitude_m"] = "altitude_m",
["comma"] = "comma",
["debug"] = "debug",
["disp"] = "disp",
["error"] = "error",
["frac"] = "frac",
["input"] = "input",
["lang"] = "lang",
["link"] = "lk",
["lk"] = "lk",
["order"] = "order",
["qid"] = "qid",
["qual"] = "qual",
["qualifier"] = "qual",
["round"] = "round",
["sigfig"] = "sigfig",
["sing"] = "adj", -- "sing" is an old alias for "adj"
["sortable"] = "sortable",
["sp"] = "sp",
["spell"] = "spell",
["stylein"] = "stylein",
["styleout"] = "styleout",
["tracking"] = "tracking",
}
-- Valid option values.
-- Convention: parms.opt_xxx refers to an option that is set here
-- (not intended to be set by the template which invokes this module).
-- Example: At enwiki, "abbr" includes:
-- ["values"] = "opt_values"
-- As a result, if the template uses abbr=values, Module:Convert sets:
-- parms["opt_values"] = true
-- parms["abbr"] = nil
-- Therefore parms.abbr will be nil, or will have one of the listed values
-- that do not start with "opt_".
-- An option value of form "xxx?" is the same as "xxx" but shows the input as deprecated.
-- Options removed in January 2018 with remnants still in Module:Convert:
-- abbr=mos (in a range, repeat the input unit)
-- adj=1 (set opt_singular to make the unit name singular when 0 < abs(value) <= 1)
local en_option_value = {
["$"] = 'TEXT', -- TEXT should be a currency symbol that will be used instead of "$"
["abbr"] = {
-- ["local text for option value"] = "en value used in this module"
["def"] = "", -- ignored (some wrapper templates call convert with "abbr=def" to mean "default abbreviation")
["h"] = "on", -- abbr=on + use "h" for hand unit (default)
["hh"] = "opt_hand_hh", -- abbr=on + use "hh" for hand unit
["in"] = "in", -- use symbol for LHS unit
["none"] = "off", -- old name for "off"
["off"] = "off", -- use name for all units
["on"] = "on", -- use symbol for all units
["out"] = "out", -- use symbol for RHS unit (default)
["unit"] = "unit", -- abbr=on but abbreviate units only: e6km → million km (not ×10⁶ km)
["values"] = "opt_values", -- show only input and output numbers, not units
["~"] = "opt_also_symbol", -- show input unit symbol as well as name
},
["adj"] = {
["mid"] = "opt_adjectival, opt_adj_mid", -- adj=on with user-specified text after input unit (between input and output)
["off"] = "", -- ignored (off is the default)
["on"] = "opt_adjectival", -- unit name is singular and hyphenated
["pre"] = "opt_one_preunit", -- user-specified text before input unit
["ri0"] = "opt_ri=0", -- round input with precision = 0
["ri1"] = "opt_ri=1", -- round input with precision = 1
["ri2"] = "opt_ri=2", -- round input with precision = 2
["ri3"] = "opt_ri=3", -- round input with precision = 3
["~"] = "opt_also_symbol", -- same as abbr=~ so can have {{convert|1|C|K|abbr=off|adj=~}}
},
["altitude_ft"] = 'INTEGER',
["altitude_m"] = 'INTEGER',
["comma"] = {
["5"] = "opt_comma5", -- only use numsep grouping if 5 or more digits
["gaps"] = "opt_gaps", -- use gaps, not numsep, to separate groups of digits
["gaps3"] = "opt_gaps, opt_gaps3", -- group only in threes rather than default of no gap before a single digit after decimal mark
["off"] = "opt_nocomma", -- no numsep in input or output numbers
},
["debug"] = {
["yes"] = "opt_sortable_debug", -- make the normally hidden sort key visible
},
["disp"] = {
["5"] = "opt_round=5?", -- round output value to nearest 5
["b"] = "b", -- join: '(...)'
["(or)"] = "(or)", -- join: '(...)' with 'or' between outputs in a combination
["br"] = "br", -- join: '<br />'
["br()"] = "br()", -- join: '<br />(...)'
["comma"] = "comma", -- join: ','
["flip"] = "opt_flip", -- reverse order of input/output
["number"] = "opt_output_number_only", -- display output value (not input, and not output symbol/name)
["or"] = "or", -- join: 'or'
["out"] = "opt_output_only",
["output number only"] = "opt_output_number_only",
["output only"] = "opt_output_only",
["preunit"] = "opt_two_preunits", -- user-specified text before input and output units
["semicolon"] = "semicolon", -- join: ';'
["sqbr"] = "sqbr", -- join: '[...]'
["table"] = "opt_table", -- output is suitable for a table cell with align="right"
["tablecen"] = "opt_tablecen", -- output is suitable for a table cell with align="center"
["unit"] = "opt_input_unit_only", -- display input symbol/name (not output, and not input value)
["unit or text"] = "opt_input_unit_only, opt_ignore_error", -- display input symbol/name, or given unit code if not known
["unit2"] = "opt_output_unit_only",
["x"] = "x", -- join: <first>...<second> (user-specified text)
},
["error"] = 'TEXT', -- TEXT is any text that will be returned if the conversion fails, instead of an error occurring
["frac"] = 'INTEGER',
["input"] = 'TEXT', -- TEXT should be <value><space><unitcode> or <wikidata-property-id>
["lang"] = { -- language for output digits (both en and local digits are always accepted for input)
["en"] = "opt_lang_en", -- use en digits for numbers, regardless of local language
["local"] = "opt_lang_local", -- use local digits for numbers (default, although config can change default to en)
},
["lk"] = {
["in"] = "in", -- link LHS unit name or symbol
["off"] = "off", -- do not link: same as default except for hand unit
["on"] = "on", -- link all unit names or symbols (but not twice for the same unit)
["out"] = "out", -- link RHS unit name or symbol
},
["order"] = {
["flip"] = "opt_flip", -- reverse order of input/output
["out"] = "opt_order_out", -- do not show input; instead, use order in output combination, with the first output shown as the input
},
["qid"] = 'TEXT', -- TEXT should be a Wikidata Q item identifier
["qual"] = 'TEXT', -- TEXT should be a Wikidata Q item identifier
["round"] = {
["0.5"] = "opt_round=0.5", -- round output value to nearest 0.5
["5"] = "opt_round=5", -- round output value to nearest 5
["10"] = "opt_round=10", -- round output value to nearest 10 (same as but clearer than "|-1")
["25"] = "opt_round=25", -- round output value to nearest 25
["50"] = "opt_round=50", -- round output value to nearest 50
["each"] = "opt_round_each", -- using default precision in a range, round each output separately (default uses highest precision of each item in range)
},
["sigfig"] = 'INTEGER',
["sortable"] = {
["off"] = "", -- ignored (off is the default)
["on"] = "opt_sortable_on", -- output sort key for use in a sortable table, based on value from converting to a standard base unit
["debug"] = "opt_sortable_on, opt_sortable_debug", -- |sortable=debug is the same as |sortable=on|debug=yes
},
["sp"] = {
["us"] = "opt_sp_us", -- use U.S. spelling (like "meter" instead of default "metre")
},
["spell"] = { -- only English spelling is supported; not scientific notation; only some fractions
["in"] = "opt_spell_in", -- spell input value in words
["In"] = "opt_spell_in, opt_spell_upper", -- spell input value in words with first letter uppercase
["on"] = "opt_spell_in, opt_spell_out", -- spell input and output values in words
["On"] = "opt_spell_in, opt_spell_out, opt_spell_upper", -- same, with first letter of first word in result uppercase
["us"] = "opt_sp_us", -- use U.S. spelling; same as sp=us so spell=us also works
},
["stylein"] = 'TEXT',
["styleout"] = 'TEXT',
["tracking"] = 'TEXT',
}
local titles = {
["frac"] = "Fraction/styles.css",
["sfrac"] = "Sfrac/styles.css",
}
return {
SIprefixes = SIprefixes,
all_categories = all_categories,
all_messages = all_messages,
currency = { ['$'] = true, ['£'] = true, ['€'] = true, ['₱'] = true, ['₽'] = true, ['¥'] = true },
customary_units = customary_units,
disp_joins = disp_joins,
en_option_name = en_option_name,
en_option_value = en_option_value,
eng_scales = eng_scales,
ranges = ranges,
titles = titles,
}
8m007l7jx7mdwwt2dfy66a3yo6no2nr
Модул:Citation/CS1/Identifiers
828
3648
21769
2026-08-08T13:56:47Z
Trappist the monk
2745
synch from sandbox;
21769
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
21770
21769
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Citation/CS1/Identifiers]]: Importing from the English wikipedia
21769
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
Модул:Citation/CS1/COinS
828
3649
21771
2026-08-08T13:56:43Z
Trappist the monk
2745
synch from sandbox;
21771
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
21772
21771
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Citation/CS1/COinS]]: Importing from the English wikipedia
21771
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
Модул:Citation/CS1/styles.css
828
3650
21773
2026-01-17T19:25:08Z
Trappist the monk
2745
synch from sandbox;
21773
sanitized-css
text/css
/* Protection icon
the following line controls the page-protection icon in the upper right corner
it must remain within this comment
{{sandbox other||{{pp-template}}}}
*/
/* Overrides
Some wikis do not override user agent default styles for HTML <cite> and <q>,
unlike en.wp. On en.wp, keep these the same as [[MediaWiki:Common.css]].
The word-wrap and :target styles were moved here from Common.css.
On en.wp, keep these the same as [[Template:Citation/styles.css]].
*/
cite.citation {
font-style: inherit; /* Remove italics for <cite> */
/* Break long urls, etc., rather than overflowing box */
word-wrap: break-word;
}
.citation q {
quotes: '"' '"' "'" "'"; /* Straight quote marks for <q> */
}
/* Highlight linked elements (such as clicked references) in blue */
.citation:target {
/* ignore the linter - all browsers of interest implement this */
background-color: rgba(0, 127, 255, 0.133);
}
/* ID and URL access
Both core and Common.css have selector .mw-parser-output a[href$=".pdf"].external
for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need
to have specificity equal to a[href$=".pdf"].external for locks to override PDF icon.
That's essentially 2 classes and 1 element.
the .id-lock-... selectors are for use by non-citation templates like
{{Catalog lookup link}}
bg-size `contain` in Minerva and Timeless is too large, so we set a size for them
and then exclude them later
*/
.id-lock-free.id-lock-free a {
background: url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-limited.id-lock-limited a,
.id-lock-registration.id-lock-registration a {
background: url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-subscription.id-lock-subscription a {
background: url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg)
right 0.1em center/9px no-repeat;
}
/* Wikisource
Wikisource icon when |chapter= or |title= is wikilinked to Wikisource
as in cite wikisource
*/
.cs1-ws-icon a {
background: url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg)
right 0.1em center/12px no-repeat;
}
body:not(.skin-timeless):not(.skin-minerva) .id-lock-free a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-limited a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-registration a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-subscription a,
body:not(.skin-timeless):not(.skin-minerva) .cs1-ws-icon a {
background-size: contain;
/* Common.css has a padding set for PDF URLs. bg-contain expands to the
* size of the padding which makes the icons very large. we "reset" the
* padding here. 1em picked out of a hat based on console having a similar
* rule from elsewhere
*/
padding: 0 1em 0 0;
}
/* Errors and maintenance */
.cs1-code {
/* <code>...</code> style override: mediawiki's css definition is specified here:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/
69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199
*/
color: inherit;
background: inherit;
border: none;
padding: inherit;
}
.cs1-hidden-error {
display: none;
color: var(--color-error, #bf3c2c);
}
.cs1-visible-error {
color: var(--color-error, #bf3c2c);
}
.cs1-maint {
display: none;
color: #085;
margin-left: 0.3em;
}
/* kerning */
.cs1-kern-left {
padding-left: 0.2em;
}
.cs1-kern-right {
padding-right: 0.2em;
}
/* selflinks – avoid bold font style when cs1|2 template links to the current page */
.citation .mw-selflink {
font-weight: inherit;
}
@media screen {
/* Small text size
Set small text size in one place. 0.95 (here) * 0.9 (from references list) is
~0.85, which is the lower bound for size for accessibility. Old styling for this
was just 0.85. We could write the rule so that when this template is inside
references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */
.cs1-format {
font-size: 95%;
}
html.skin-theme-clientpref-night .cs1-maint {
color: #18911f;
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .cs1-maint {
color: #18911f;
}
}
2wrho6o1q12cvwhaslan5n9g140q3wl
21774
21773
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Module:Citation/CS1/styles.css]]: Importing from the English wikipedia
21773
sanitized-css
text/css
/* Protection icon
the following line controls the page-protection icon in the upper right corner
it must remain within this comment
{{sandbox other||{{pp-template}}}}
*/
/* Overrides
Some wikis do not override user agent default styles for HTML <cite> and <q>,
unlike en.wp. On en.wp, keep these the same as [[MediaWiki:Common.css]].
The word-wrap and :target styles were moved here from Common.css.
On en.wp, keep these the same as [[Template:Citation/styles.css]].
*/
cite.citation {
font-style: inherit; /* Remove italics for <cite> */
/* Break long urls, etc., rather than overflowing box */
word-wrap: break-word;
}
.citation q {
quotes: '"' '"' "'" "'"; /* Straight quote marks for <q> */
}
/* Highlight linked elements (such as clicked references) in blue */
.citation:target {
/* ignore the linter - all browsers of interest implement this */
background-color: rgba(0, 127, 255, 0.133);
}
/* ID and URL access
Both core and Common.css have selector .mw-parser-output a[href$=".pdf"].external
for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need
to have specificity equal to a[href$=".pdf"].external for locks to override PDF icon.
That's essentially 2 classes and 1 element.
the .id-lock-... selectors are for use by non-citation templates like
{{Catalog lookup link}}
bg-size `contain` in Minerva and Timeless is too large, so we set a size for them
and then exclude them later
*/
.id-lock-free.id-lock-free a {
background: url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-limited.id-lock-limited a,
.id-lock-registration.id-lock-registration a {
background: url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg)
right 0.1em center/9px no-repeat;
}
.id-lock-subscription.id-lock-subscription a {
background: url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg)
right 0.1em center/9px no-repeat;
}
/* Wikisource
Wikisource icon when |chapter= or |title= is wikilinked to Wikisource
as in cite wikisource
*/
.cs1-ws-icon a {
background: url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg)
right 0.1em center/12px no-repeat;
}
body:not(.skin-timeless):not(.skin-minerva) .id-lock-free a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-limited a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-registration a,
body:not(.skin-timeless):not(.skin-minerva) .id-lock-subscription a,
body:not(.skin-timeless):not(.skin-minerva) .cs1-ws-icon a {
background-size: contain;
/* Common.css has a padding set for PDF URLs. bg-contain expands to the
* size of the padding which makes the icons very large. we "reset" the
* padding here. 1em picked out of a hat based on console having a similar
* rule from elsewhere
*/
padding: 0 1em 0 0;
}
/* Errors and maintenance */
.cs1-code {
/* <code>...</code> style override: mediawiki's css definition is specified here:
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/
69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199
*/
color: inherit;
background: inherit;
border: none;
padding: inherit;
}
.cs1-hidden-error {
display: none;
color: var(--color-error, #bf3c2c);
}
.cs1-visible-error {
color: var(--color-error, #bf3c2c);
}
.cs1-maint {
display: none;
color: #085;
margin-left: 0.3em;
}
/* kerning */
.cs1-kern-left {
padding-left: 0.2em;
}
.cs1-kern-right {
padding-right: 0.2em;
}
/* selflinks – avoid bold font style when cs1|2 template links to the current page */
.citation .mw-selflink {
font-weight: inherit;
}
@media screen {
/* Small text size
Set small text size in one place. 0.95 (here) * 0.9 (from references list) is
~0.85, which is the lower bound for size for accessibility. Old styling for this
was just 0.85. We could write the rule so that when this template is inside
references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */
.cs1-format {
font-size: 95%;
}
html.skin-theme-clientpref-night .cs1-maint {
color: #18911f;
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .cs1-maint {
color: #18911f;
}
}
2wrho6o1q12cvwhaslan5n9g140q3wl
Шаблон:Both
10
3651
21779
2024-06-15T14:15:23Z
Explicit
2794
[[Wikipedia:Templates for discussion/Log/2024 June 8#Template:Both]] closed as keep ([[WP:XFDC#4.0.15|XFDcloser]])
21779
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{SAFESUBST:<noinclude />#if:{{{2|}}}|1}}}}<noinclude>
{{documentation}}
</noinclude>
a92g9dgn74wuyygsul02g6cnq29em4t
21780
21779
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Template:Both]]: Importing from the English wikipedia
21779
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#if:{{{1|}}}|{{SAFESUBST:<noinclude />#if:{{{2|}}}|1}}}}<noinclude>
{{documentation}}
</noinclude>
a92g9dgn74wuyygsul02g6cnq29em4t
Шаблон:Category handler
10
3652
21781
2018-12-16T20:13:00Z
Amorymeltzer
2756
Changed protection level for "[[Template:Category handler]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
21781
wikitext
text/x-wiki
{{#invoke:Category handler|main}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, and interwikis to Wikidata. -->
</noinclude>
og6fhyj2ssd4fmzpqzuodk12q3cms0z
21782
21781
2026-09-18T15:05:26Z
Keresturec
18
1 измена увезена из [[:en:Template:Category_handler]]: Importing from the English wikipedia
21781
wikitext
text/x-wiki
{{#invoke:Category handler|main}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, and interwikis to Wikidata. -->
</noinclude>
og6fhyj2ssd4fmzpqzuodk12q3cms0z
Шаблон:Spaces
10
3653
21793
2015-10-25T11:38:26Z
Edokter
2742
use class
21793
wikitext
text/x-wiki
<span class="nowrap">{{#iferror:{{#expr:{{{1|1}}}}}
|{{#switch:{{{1}}}
|fig= 
|en= 
|em= 
|thin= 
|hair= 
|
}}
|{{#invoke:String|rep|{{#switch:{{{2}}}
|fig= 
|en= 
|em= 
|thin= 
|hair= 
|
}}|{{{1|1}}}}}
}}</span><noinclude>
{{documentation}}
</noinclude>
jukvcl40dksi5vvimpqq0n6czue0473
21794
21793
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Template:Spaces]]: Importing from the English wikipedia
21793
wikitext
text/x-wiki
<span class="nowrap">{{#iferror:{{#expr:{{{1|1}}}}}
|{{#switch:{{{1}}}
|fig= 
|en= 
|em= 
|thin= 
|hair= 
|
}}
|{{#invoke:String|rep|{{#switch:{{{2}}}
|fig= 
|en= 
|em= 
|thin= 
|hair= 
|
}}|{{{1|1}}}}}
}}</span><noinclude>
{{documentation}}
</noinclude>
jukvcl40dksi5vvimpqq0n6czue0473
Шаблон:Reflist
10
3654
21797
2025-12-17T13:08:01Z
Anomie
2795
VE for some reason requires a div wrapping the references tag. 🤷
21797
wikitext
text/x-wiki
<templatestyles src="Reflist/styles.css" /><!--
-->{{#switch:{{{liststyle}}}|upper-alpha|upper-roman|lower-alpha|lower-greek|lower-roman=<div class="reflist-liststyle-{{{liststyle}}}">
<nowiki/>}}<!--
-->{{#if:{{{1|}}}{{{colwidth|}}}|
<div class="mw-references-wrap <!--
-->{{#iferror:{{#ifexpr: {{{1|}}} > 1 }}|mw-references-columns|{{#switch:{{{1|}}}|1=|2=mw-references-columns reflist-columns-2|#default=mw-references-columns reflist-columns-3}} }}" <!-- end class
-->{{#if: {{{1|}}}<!-- start style. The multiplication by 0.9 is for [[hysterical raisins]]. -->
| {{#iferror: {{#ifexpr: {{{1|1}}} > 1 }} |style="column-width: calc( 0.9 * {{{1}}} );"}}
| {{#if: {{{colwidth|}}}|style="column-width: calc( 0.9 * {{{colwidth}}} );"}}
}}>{{#tag:references|{{{refs|}}}|group={{{group|}}}|responsive=0}}</div>
|
<div><!-- VE for some reason requires a div wrapping the references tag. 🤷 -->
{{#tag:references|{{{refs|}}}|group={{{group|}}}|responsive=1}}</div>
}}<!--
-->{{#switch:{{{liststyle}}}|upper-alpha|upper-roman|lower-alpha|lower-greek|lower-roman=</div>}}<!--
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using reflist with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Reflist]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | colwidth | group | liststyle | refs }}<noinclude>
{{Documentation}}
</noinclude>
6ru6cuze0qz3wvjdrkqztati1gmdgd2
21798
21797
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Template:Reflist]]: Importing from the English wikipedia
21797
wikitext
text/x-wiki
<templatestyles src="Reflist/styles.css" /><!--
-->{{#switch:{{{liststyle}}}|upper-alpha|upper-roman|lower-alpha|lower-greek|lower-roman=<div class="reflist-liststyle-{{{liststyle}}}">
<nowiki/>}}<!--
-->{{#if:{{{1|}}}{{{colwidth|}}}|
<div class="mw-references-wrap <!--
-->{{#iferror:{{#ifexpr: {{{1|}}} > 1 }}|mw-references-columns|{{#switch:{{{1|}}}|1=|2=mw-references-columns reflist-columns-2|#default=mw-references-columns reflist-columns-3}} }}" <!-- end class
-->{{#if: {{{1|}}}<!-- start style. The multiplication by 0.9 is for [[hysterical raisins]]. -->
| {{#iferror: {{#ifexpr: {{{1|1}}} > 1 }} |style="column-width: calc( 0.9 * {{{1}}} );"}}
| {{#if: {{{colwidth|}}}|style="column-width: calc( 0.9 * {{{colwidth}}} );"}}
}}>{{#tag:references|{{{refs|}}}|group={{{group|}}}|responsive=0}}</div>
|
<div><!-- VE for some reason requires a div wrapping the references tag. 🤷 -->
{{#tag:references|{{{refs|}}}|group={{{group|}}}|responsive=1}}</div>
}}<!--
-->{{#switch:{{{liststyle}}}|upper-alpha|upper-roman|lower-alpha|lower-greek|lower-roman=</div>}}<!--
-->{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using reflist with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Reflist]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | colwidth | group | liststyle | refs }}<noinclude>
{{Documentation}}
</noinclude>
6ru6cuze0qz3wvjdrkqztati1gmdgd2
Шаблон:Reflist/styles.css
10
3655
21799
2025-12-13T15:43:44Z
Anomie
2795
Update to reduce differences in behavior between {{reflist}} and <references/>. See talk. Note, if this breaks some custom styles you have, likely they were already broken with <references/> and you should take this opportunity to update them.
21799
sanitized-css
text/css
/* {{pp|small=yes}} */
/* columns-2 and columns-3 are legacy for "2 or more" column view from when the
* template was implemented with column-count.
*/
.reflist-columns-2 {
column-width: 30em;
}
.reflist-columns-3 {
column-width: 25em;
}
/* Match Vector 2022 after [[gerrit:1185300]]. */
body.skin-vector-2022 .reflist-columns-2 {
column-width: 27em;
}
body.skin-vector-2022 .reflist-columns-3 {
column-width: 22.5em;
}
/* These should probably be moved to MediaWiki:Common.css to work with <references> as well. */
.references[data-mw-group=upper-alpha] {
list-style-type: upper-alpha;
}
.references[data-mw-group=upper-roman] {
list-style-type: upper-roman;
}
.references[data-mw-group=lower-alpha] {
list-style-type: lower-alpha;
}
.references[data-mw-group=lower-greek] {
list-style-type: lower-greek;
}
.references[data-mw-group=lower-roman] {
list-style-type: lower-roman;
}
/* Liststyle param. */
div.reflist-liststyle-upper-alpha .references {
list-style-type: upper-alpha;
}
div.reflist-liststyle-upper-roman .references {
list-style-type: upper-roman;
}
div.reflist-liststyle-lower-alpha .references {
list-style-type: lower-alpha;
}
div.reflist-liststyle-lower-greek .references {
list-style-type: lower-greek;
}
div.reflist-liststyle-lower-roman .references {
list-style-type: lower-roman;
}
0y79vyw9wqc26bp1ubg1khshuusjvc4
21800
21799
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Template:Reflist/styles.css]]: Importing from the English wikipedia
21799
sanitized-css
text/css
/* {{pp|small=yes}} */
/* columns-2 and columns-3 are legacy for "2 or more" column view from when the
* template was implemented with column-count.
*/
.reflist-columns-2 {
column-width: 30em;
}
.reflist-columns-3 {
column-width: 25em;
}
/* Match Vector 2022 after [[gerrit:1185300]]. */
body.skin-vector-2022 .reflist-columns-2 {
column-width: 27em;
}
body.skin-vector-2022 .reflist-columns-3 {
column-width: 22.5em;
}
/* These should probably be moved to MediaWiki:Common.css to work with <references> as well. */
.references[data-mw-group=upper-alpha] {
list-style-type: upper-alpha;
}
.references[data-mw-group=upper-roman] {
list-style-type: upper-roman;
}
.references[data-mw-group=lower-alpha] {
list-style-type: lower-alpha;
}
.references[data-mw-group=lower-greek] {
list-style-type: lower-greek;
}
.references[data-mw-group=lower-roman] {
list-style-type: lower-roman;
}
/* Liststyle param. */
div.reflist-liststyle-upper-alpha .references {
list-style-type: upper-alpha;
}
div.reflist-liststyle-upper-roman .references {
list-style-type: upper-roman;
}
div.reflist-liststyle-lower-alpha .references {
list-style-type: lower-alpha;
}
div.reflist-liststyle-lower-greek .references {
list-style-type: lower-greek;
}
div.reflist-liststyle-lower-roman .references {
list-style-type: lower-roman;
}
0y79vyw9wqc26bp1ubg1khshuusjvc4
Шаблон:Cite encyclopedia
10
3656
21805
2015-11-13T02:17:24Z
Fuhghettaboutit
2797
Changed protection level of Template:Cite encyclopedia: when I changed this to add template editors, I didn't realize it had cascding protection—so all my change did was make it appear as if it could be edited by them ([Edit=Allow only administrators...
21805
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=encyclopaedia
}}</includeonly><noinclude>
{{documentation}}
[[Category:Lua-based templates]]
</noinclude>
jdzpxvlfcwjuua45ovk7i5lcp6qre48
21806
21805
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Template:Cite_encyclopedia]]: Importing from the English wikipedia
21805
wikitext
text/x-wiki
<includeonly>{{#invoke:citation/CS1|citation
|CitationClass=encyclopaedia
}}</includeonly><noinclude>
{{documentation}}
[[Category:Lua-based templates]]
</noinclude>
jdzpxvlfcwjuua45ovk7i5lcp6qre48
Шаблон:Anchor
10
3657
21807
2021-01-31T22:06:17Z
Plastikspork
2767
Fix |=FOO bug where {{anchor|=FOO}} transcludes [[Template:FOO]]
21807
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:anchor|main}}<noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
enb6c4d9v8ozj2bh2wvmo7698r1sot4
21808
21807
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Template:Anchor]]: Importing from the English wikipedia
21807
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:anchor|main}}<noinclude>
{{Documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
enb6c4d9v8ozj2bh2wvmo7698r1sot4
Модул:Anchor
828
3658
21809
2020-09-24T22:32:51Z
Pppery
88
Add class per edit request
21809
Scribunto
text/plain
-- This module implements {{anchor}}.
local getArgs = require('Module:Arguments').getArgs
local tableTools = require('Module:TableTools')
local p = {}
function p.main(frame)
-- Get the positional arguments from #invoke, remove any nil values,
-- and pass them to p._main.
local args = getArgs(frame)
local argArray = tableTools.compressSparseArray(args)
return p._main(unpack(argArray))
end
function p._main(...)
-- Generate the list of anchors.
local anchors = {...}
local ret = {}
for _, anchor in ipairs(anchors) do
ret[#ret + 1] = '<span class="anchor" id="' .. anchor .. '"></span>'
end
return table.concat(ret)
end
return p
qn9l8z10vmc8ghld7804a9aaffg6g8o
21810
21809
2026-09-18T15:05:27Z
Keresturec
18
1 измена увезена из [[:en:Module:Anchor]]: Importing from the English wikipedia
21809
Scribunto
text/plain
-- This module implements {{anchor}}.
local getArgs = require('Module:Arguments').getArgs
local tableTools = require('Module:TableTools')
local p = {}
function p.main(frame)
-- Get the positional arguments from #invoke, remove any nil values,
-- and pass them to p._main.
local args = getArgs(frame)
local argArray = tableTools.compressSparseArray(args)
return p._main(unpack(argArray))
end
function p._main(...)
-- Generate the list of anchors.
local anchors = {...}
local ret = {}
for _, anchor in ipairs(anchors) do
ret[#ret + 1] = '<span class="anchor" id="' .. anchor .. '"></span>'
end
return table.concat(ret)
end
return p
qn9l8z10vmc8ghld7804a9aaffg6g8o
Шаблон:Infobox settlement/areadisp
10
3659
21815
2025-09-24T14:02:48Z
Hike395
2761
implement [[Template:Infobox/areadisp/]] in Lua, passing argument to {{tl|Convert}}
21815
wikitext
text/x-wiki
<includeonly>{{#invoke:ConvertIB|area}}</includeonly><noinclude>
{{documentation}}
</noinclude>
ssk9xtxciqyfcjp55grw02okglo90be
21816
21815
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement/areadisp]]: Importing from the English wikipedia
21815
wikitext
text/x-wiki
<includeonly>{{#invoke:ConvertIB|area}}</includeonly><noinclude>
{{documentation}}
</noinclude>
ssk9xtxciqyfcjp55grw02okglo90be
Шаблон:Infobox settlement/columns
10
3660
21817
2021-06-14T22:57:30Z
Izno
2749
templatestyles
21817
wikitext
text/x-wiki
<templatestyles src="Infobox settlement/columns/styles.css"/>
<div class="ib-settlement-cols">
<div class="ib-settlement-cols-row">{{#if:{{{0|}}}
|<!-- if 0
-->{{#if:{{{1|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}}
|<!-- if 0 and (1 or 2 or 3 or 4 or 5)
--><div class="ib-settlement-cols-cellt">
{{#if:{{{1|}}}|<div>{{{1}}}</div>}}
{{#if:{{{2|}}}|<div>{{{2}}}</div>}}
{{#if:{{{3|}}}|<div>{{{3}}}</div>}}
{{#if:{{{4|}}}|<div>{{{4}}}</div>}}
{{#if:{{{5|}}}|<div>{{{5}}}</div>}}
</div>
}}<div class="ib-settlement-cols-cellt">{{{0}}}</div>
|<!-- if not 0
-->{{#ifexpr:({{#if:{{{1|}}}|1|0}}+{{#if:{{{2|}}}|1|0}}+{{#if:{{{3|}}}|1|0}}+{{#if:{{{4|}}}|1|0}}) > 2
|<!-- if more than two images
-->{{#if:{{{1|}}}
|<div class="ib-settlement-cols-cell">{{{1}}}</div>{{#if:{{{2|}}}||</div></div><div class="ib-settlement-cols"><!-- TODO: The "3" element case currently produces two div-tables, which is non-optimal, but someone else should figure out how to fix it; 4 and 2 cases output as one "table". --><div class="ib-settlement-cols-row">}}
}}{{#if:{{{2|}}}
|<div class="ib-settlement-cols-cell">{{{2}}}</div>{{#if:{{{1|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}
}}</div><div class="ib-settlement-cols-row">{{#if:{{{3|}}}
|{{#if:{{{4|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{3}}}</div>
}}{{#if:{{{4|}}}
|{{#if:{{{3|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{4}}}</div>
}}
|<!-- if two or fewer images
-->{{#if:{{{1|}}}|<div class="ib-settlement-cols-cell">{{{1}}}</div>}}<!--
-->{{#if:{{{2|}}}|<div class="ib-settlement-cols-cell">{{{2}}}</div>}}<!--
-->{{#if:{{{3|}}}|<div class="ib-settlement-cols-cell">{{{3}}}</div>}}<!--
-->{{#if:{{{4|}}}|<div class="ib-settlement-cols-cell">{{{4}}}</div>}}
}}
}}</div></div><noinclude>
{{documentation}}
</noinclude>
m6cltb8m7e7fjw8dkkm6lmpt9mdftji
21818
21817
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement/columns]]: Importing from the English wikipedia
21817
wikitext
text/x-wiki
<templatestyles src="Infobox settlement/columns/styles.css"/>
<div class="ib-settlement-cols">
<div class="ib-settlement-cols-row">{{#if:{{{0|}}}
|<!-- if 0
-->{{#if:{{{1|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}}
|<!-- if 0 and (1 or 2 or 3 or 4 or 5)
--><div class="ib-settlement-cols-cellt">
{{#if:{{{1|}}}|<div>{{{1}}}</div>}}
{{#if:{{{2|}}}|<div>{{{2}}}</div>}}
{{#if:{{{3|}}}|<div>{{{3}}}</div>}}
{{#if:{{{4|}}}|<div>{{{4}}}</div>}}
{{#if:{{{5|}}}|<div>{{{5}}}</div>}}
</div>
}}<div class="ib-settlement-cols-cellt">{{{0}}}</div>
|<!-- if not 0
-->{{#ifexpr:({{#if:{{{1|}}}|1|0}}+{{#if:{{{2|}}}|1|0}}+{{#if:{{{3|}}}|1|0}}+{{#if:{{{4|}}}|1|0}}) > 2
|<!-- if more than two images
-->{{#if:{{{1|}}}
|<div class="ib-settlement-cols-cell">{{{1}}}</div>{{#if:{{{2|}}}||</div></div><div class="ib-settlement-cols"><!-- TODO: The "3" element case currently produces two div-tables, which is non-optimal, but someone else should figure out how to fix it; 4 and 2 cases output as one "table". --><div class="ib-settlement-cols-row">}}
}}{{#if:{{{2|}}}
|<div class="ib-settlement-cols-cell">{{{2}}}</div>{{#if:{{{1|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}
}}</div><div class="ib-settlement-cols-row">{{#if:{{{3|}}}
|{{#if:{{{4|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{3}}}</div>
}}{{#if:{{{4|}}}
|{{#if:{{{3|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{4}}}</div>
}}
|<!-- if two or fewer images
-->{{#if:{{{1|}}}|<div class="ib-settlement-cols-cell">{{{1}}}</div>}}<!--
-->{{#if:{{{2|}}}|<div class="ib-settlement-cols-cell">{{{2}}}</div>}}<!--
-->{{#if:{{{3|}}}|<div class="ib-settlement-cols-cell">{{{3}}}</div>}}<!--
-->{{#if:{{{4|}}}|<div class="ib-settlement-cols-cell">{{{4}}}</div>}}
}}
}}</div></div><noinclude>
{{documentation}}
</noinclude>
m6cltb8m7e7fjw8dkkm6lmpt9mdftji
Шаблон:Infobox settlement/columns/styles.css
10
3661
21819
2021-06-14T22:58:40Z
Izno
2749
Protected "[[Template:Infobox settlement/columns/styles.css]]": [[WP:High-risk templates|Highly visible template]]: match parent ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
21819
sanitized-css
text/css
/* {{pp|small=y}} */
.ib-settlement-cols {
text-align: center;
display: table;
width: 100%;
}
.ib-settlement-cols-row {
display: table-row;
}
.ib-settlement-cols-cell {
display: table-cell;
vertical-align: middle;
}
.ib-settlement-cols-cellt {
display: table-cell;
vertical-align: top;
}
eoq56w19zfw3akcqfxtw079peuodz3k
21820
21819
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement/columns/styles.css]]: Importing from the English wikipedia
21819
sanitized-css
text/css
/* {{pp|small=y}} */
.ib-settlement-cols {
text-align: center;
display: table;
width: 100%;
}
.ib-settlement-cols-row {
display: table-row;
}
.ib-settlement-cols-cell {
display: table-cell;
vertical-align: middle;
}
.ib-settlement-cols-cellt {
display: table-cell;
vertical-align: top;
}
eoq56w19zfw3akcqfxtw079peuodz3k
Шаблон:Infobox settlement/densdisp
10
3662
21821
2025-09-28T01:11:02Z
Hike395
2761
convert to Lua, computing significant figures correctly, calling [[Template:Convert]]
21821
wikitext
text/x-wiki
<includeonly>{{#invoke:ConvertIB|density}}</includeonly><noinclude>
{{documentation}}
</noinclude>
q5m7iugxijnh3rv6jucbvcon7hzui0v
21822
21821
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement/densdisp]]: Importing from the English wikipedia
21821
wikitext
text/x-wiki
<includeonly>{{#invoke:ConvertIB|density}}</includeonly><noinclude>
{{documentation}}
</noinclude>
q5m7iugxijnh3rv6jucbvcon7hzui0v
Шаблон:Infobox settlement/lengthdisp
10
3663
21823
2025-09-25T01:53:15Z
Hike395
2761
convert to Lua
21823
wikitext
text/x-wiki
<includeonly>{{#invoke:ConvertIB|length}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
e768qsml1qirs0ewlz6hghb5njmo0hv
21824
21823
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement/lengthdisp]]: Importing from the English wikipedia
21823
wikitext
text/x-wiki
<includeonly>{{#invoke:ConvertIB|length}}</includeonly><noinclude>
{{Documentation}}
</noinclude>
e768qsml1qirs0ewlz6hghb5njmo0hv
Шаблон:Infobox settlement/link
10
3664
21825
2013-10-19T11:19:36Z
WOSlinker
2753
Changed protection level of Template:Infobox settlement/link: allow template editors to modify ([Edit=Protected template] (indefinite) [Move=Protected template] (indefinite))
21825
wikitext
text/x-wiki
{{#if:{{{link|}}}<!--
-->|[[{{{link}}}|{{{type}}}]]<!--
-->|{{#ifexist:{{{type}}} of {{PAGENAME}}<!--
-->|[[{{{type}}} of {{PAGENAME}}|{{{type|}}}]]<!--
-->|{{#if:{{{name|}}}<!--
-->|{{#ifexist:{{{type}}} of {{{name}}}<!--
-->|[[{{{type}}} of {{{name}}}|{{{type|}}}]]<!--
-->|{{{type}}}<!--
-->}}<!--
-->|{{{type}}}<!--
-->}}<!--
-->}}<!--
-->}}<noinclude>
{{documentation}}
</noinclude>
euckr3nxynvcunu7on6g2ncksojbb5a
21826
21825
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement/link]]: Importing from the English wikipedia
21825
wikitext
text/x-wiki
{{#if:{{{link|}}}<!--
-->|[[{{{link}}}|{{{type}}}]]<!--
-->|{{#ifexist:{{{type}}} of {{PAGENAME}}<!--
-->|[[{{{type}}} of {{PAGENAME}}|{{{type|}}}]]<!--
-->|{{#if:{{{name|}}}<!--
-->|{{#ifexist:{{{type}}} of {{{name}}}<!--
-->|[[{{{type}}} of {{{name}}}|{{{type|}}}]]<!--
-->|{{{type}}}<!--
-->}}<!--
-->|{{{type}}}<!--
-->}}<!--
-->}}<!--
-->}}<noinclude>
{{documentation}}
</noinclude>
euckr3nxynvcunu7on6g2ncksojbb5a
Шаблон:Infobox settlement/styles.css
10
3665
21827
2025-10-03T02:11:47Z
Jonesey95
2757
fix text color in dark mode; this generally works but may cause problems, in which case revert or try specifying a different CSS value
21827
sanitized-css
text/css
/* {{pp|small=y}} */
.ib-settlement {
border-collapse: collapse;
line-height: 1.2em;
}
@media (min-width: 640px) {
.ib-settlement {
width: 23em;
}
}
/* TODO split definitions to appropriate class names when live from HTML element */
.ib-settlement td,
.ib-settlement th {
border-top: 1px solid #a2a9b1;
padding: 0.4em 0.6em 0.4em 0.6em;
}
.ib-settlement .mergedtoprow .infobox-full-data,
.ib-settlement .mergedtoprow .infobox-header,
.ib-settlement .mergedtoprow .infobox-data,
.ib-settlement .mergedtoprow .infobox-label,
.ib-settlement .mergedtoprow .infobox-below {
border-top: 1px solid #a2a9b1;
padding: 0.4em 0.6em 0.2em 0.6em;
}
.ib-settlement .mergedrow .infobox-full-data,
.ib-settlement .mergedrow .infobox-data,
.ib-settlement .mergedrow .infobox-label {
border: 0;
padding: 0 0.6em 0.2em 0.6em;
}
.ib-settlement .mergedbottomrow .infobox-full-data,
.ib-settlement .mergedbottomrow .infobox-data,
.ib-settlement .mergedbottomrow .infobox-label {
border-top: 0;
border-bottom: 1px solid #a2a9b1;
padding: 0 0.6em 0.4em 0.6em;
}
.ib-settlement .maptable {
border: 0;
padding: 0;
}
.ib-settlement .infobox-header,
.ib-settlement .infobox-below {
text-align: left;
}
.ib-settlement .infobox-above {
font-size: 125%;
line-height: 1.3em;
}
.ib-settlement .infobox-subheader {
background-color: #cddeff;color:inherit;
font-weight: bold;
}
.ib-settlement-native {
font-weight: normal;
padding-top: 0.2em;
}
.ib-settlement-other-name {
font-size: 78%;
}
.ib-settlement-official {
font-weight: bold;
}
.ib-settlement-caption {
padding: 0.3em 0 0 0;
}
.ib-settlement-caption-link {
padding: 0.2em 0;
}
.ib-settlement-nickname {
display: inline;
}
.ib-settlement-fn {
font-weight: normal;
display: inline;
}
r64slwko84pew5lxs3tepin9znpz4pc
21828
21827
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement/styles.css]]: Importing from the English wikipedia
21827
sanitized-css
text/css
/* {{pp|small=y}} */
.ib-settlement {
border-collapse: collapse;
line-height: 1.2em;
}
@media (min-width: 640px) {
.ib-settlement {
width: 23em;
}
}
/* TODO split definitions to appropriate class names when live from HTML element */
.ib-settlement td,
.ib-settlement th {
border-top: 1px solid #a2a9b1;
padding: 0.4em 0.6em 0.4em 0.6em;
}
.ib-settlement .mergedtoprow .infobox-full-data,
.ib-settlement .mergedtoprow .infobox-header,
.ib-settlement .mergedtoprow .infobox-data,
.ib-settlement .mergedtoprow .infobox-label,
.ib-settlement .mergedtoprow .infobox-below {
border-top: 1px solid #a2a9b1;
padding: 0.4em 0.6em 0.2em 0.6em;
}
.ib-settlement .mergedrow .infobox-full-data,
.ib-settlement .mergedrow .infobox-data,
.ib-settlement .mergedrow .infobox-label {
border: 0;
padding: 0 0.6em 0.2em 0.6em;
}
.ib-settlement .mergedbottomrow .infobox-full-data,
.ib-settlement .mergedbottomrow .infobox-data,
.ib-settlement .mergedbottomrow .infobox-label {
border-top: 0;
border-bottom: 1px solid #a2a9b1;
padding: 0 0.6em 0.4em 0.6em;
}
.ib-settlement .maptable {
border: 0;
padding: 0;
}
.ib-settlement .infobox-header,
.ib-settlement .infobox-below {
text-align: left;
}
.ib-settlement .infobox-above {
font-size: 125%;
line-height: 1.3em;
}
.ib-settlement .infobox-subheader {
background-color: #cddeff;color:inherit;
font-weight: bold;
}
.ib-settlement-native {
font-weight: normal;
padding-top: 0.2em;
}
.ib-settlement-other-name {
font-size: 78%;
}
.ib-settlement-official {
font-weight: bold;
}
.ib-settlement-caption {
padding: 0.3em 0 0 0;
}
.ib-settlement-caption-link {
padding: 0.2em 0;
}
.ib-settlement-nickname {
display: inline;
}
.ib-settlement-fn {
font-weight: normal;
display: inline;
}
r64slwko84pew5lxs3tepin9znpz4pc
Шаблон:Nbsp
10
3666
21829
2018-11-19T18:04:40Z
Amorymeltzer
2756
{{R from template shortcut}}
21829
wikitext
text/x-wiki
#REDIRECT [[Template:Spaces]]
{{Redirect category shell|
{{R from move}}
{{R from alternative name}}
{{R from template shortcut}}
}}
2axdy32whej7ce74avad8qnsbuwaoxi
21830
21829
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:Nbsp]]: Importing from the English wikipedia
21829
wikitext
text/x-wiki
#REDIRECT [[Template:Spaces]]
{{Redirect category shell|
{{R from move}}
{{R from alternative name}}
{{R from template shortcut}}
}}
2axdy32whej7ce74avad8qnsbuwaoxi
Шаблон:URL
10
3667
21831
2019-11-18T00:50:36Z
Jonesey95
2757
Adding unknown parameter tracking through [[:Category:Pages using URL template with unknown parameters]] using [[Module:check for unknown parameters]]
21831
wikitext
text/x-wiki
<includeonly>{{#invoke:URL|url}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using URL template with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:URL]] with unknown parameter "_VALUE_"|ignoreblank=y | 1 | 2 }}<noinclude>{{documentation}}</noinclude>
a3iaiir0mhs0y2mdlkbw2snyhxnxqwu
21832
21831
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Template:URL]]: Importing from the English wikipedia
21831
wikitext
text/x-wiki
<includeonly>{{#invoke:URL|url}}</includeonly>{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using URL template with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:URL]] with unknown parameter "_VALUE_"|ignoreblank=y | 1 | 2 }}<noinclude>{{documentation}}</noinclude>
a3iaiir0mhs0y2mdlkbw2snyhxnxqwu
Модул:Location map/styles.css
828
3668
21837
2025-05-23T23:48:41Z
Izno
2749
per tper
21837
sanitized-css
text/css
/* {{pp|small=yes}} */
.locmap .od {
position: absolute;
}
.locmap .id {
position: absolute;
line-height: 0;
}
.locmap .l0 {
font-size: 0;
position: absolute;
}
.locmap .pv {
line-height: 110%;
position: absolute;
text-align: center;
}
.locmap .pl {
line-height: 110%;
position: absolute;
top: -0.75em;
text-align: right;
}
.locmap .pr {
line-height: 110%;
position: absolute;
top: -0.75em;
text-align: left;
}
.locmap .pv > div {
display: inline;
padding: 1px;
}
.locmap .pl > div {
display: inline; /* inline does not impact floated elements */
padding: 1px;
float: right;
}
.locmap .pr > div {
display: inline; /* inline does not impact floated elements */
padding: 1px;
float: left;
}
/* Dark mode theme: */
@media screen {
html.skin-theme-clientpref-night .od,
html.skin-theme-clientpref-night .od .pv > div,
html.skin-theme-clientpref-night .od .pl > div,
html.skin-theme-clientpref-night .od .pr > div {
/* Use !important to override any infobox rules */
background: #fff !important;
color: #000 !important;
}
html.skin-theme-clientpref-night .locmap img {
filter: grayscale(0.6);
}
/* Special handling for maps inside infoboxes
* [[Module talk:Location map#Map label background bug in dark mode]]
*/
html.skin-theme-clientpref-night .infobox-full-data .locmap div {
background: transparent !important;
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .locmap img {
filter: grayscale(0.6);
}
html.skin-theme-clientpref-os .od,
html.skin-theme-clientpref-os .od .pv > div,
html.skin-theme-clientpref-os .od .pl > div,
html.skin-theme-clientpref-os .od .pr > div {
/* Use !important to override any infobox rules */
background: white !important;
color: #000 !important;
}
html.skin-theme-clientpref-os .infobox-full-data .locmap div {
background: transparent !important;
}
}
rs1zb23dpoja6q2k5yakw4kskmcnf7l
21838
21837
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Module:Location_map/styles.css]]: Importing from the English wikipedia
21837
sanitized-css
text/css
/* {{pp|small=yes}} */
.locmap .od {
position: absolute;
}
.locmap .id {
position: absolute;
line-height: 0;
}
.locmap .l0 {
font-size: 0;
position: absolute;
}
.locmap .pv {
line-height: 110%;
position: absolute;
text-align: center;
}
.locmap .pl {
line-height: 110%;
position: absolute;
top: -0.75em;
text-align: right;
}
.locmap .pr {
line-height: 110%;
position: absolute;
top: -0.75em;
text-align: left;
}
.locmap .pv > div {
display: inline;
padding: 1px;
}
.locmap .pl > div {
display: inline; /* inline does not impact floated elements */
padding: 1px;
float: right;
}
.locmap .pr > div {
display: inline; /* inline does not impact floated elements */
padding: 1px;
float: left;
}
/* Dark mode theme: */
@media screen {
html.skin-theme-clientpref-night .od,
html.skin-theme-clientpref-night .od .pv > div,
html.skin-theme-clientpref-night .od .pl > div,
html.skin-theme-clientpref-night .od .pr > div {
/* Use !important to override any infobox rules */
background: #fff !important;
color: #000 !important;
}
html.skin-theme-clientpref-night .locmap img {
filter: grayscale(0.6);
}
/* Special handling for maps inside infoboxes
* [[Module talk:Location map#Map label background bug in dark mode]]
*/
html.skin-theme-clientpref-night .infobox-full-data .locmap div {
background: transparent !important;
}
}
@media screen and (prefers-color-scheme: dark) {
html.skin-theme-clientpref-os .locmap img {
filter: grayscale(0.6);
}
html.skin-theme-clientpref-os .od,
html.skin-theme-clientpref-os .od .pv > div,
html.skin-theme-clientpref-os .od .pl > div,
html.skin-theme-clientpref-os .od .pr > div {
/* Use !important to override any infobox rules */
background: white !important;
color: #000 !important;
}
html.skin-theme-clientpref-os .infobox-full-data .locmap div {
background: transparent !important;
}
}
rs1zb23dpoja6q2k5yakw4kskmcnf7l
Модул:URL
828
3669
21839
2025-11-12T22:08:00Z
Zackmann08
2741
Check for nested calls. See [[Template_talk:URL]] for more details.
21839
Scribunto
text/plain
--
-- This module implements {{URL}}
--
-- See unit tests at [[Module:URL/testcases]]
local p = {}
local function safeUri(s)
local success, uri = pcall(function()
return mw.uri.new(s)
end)
if success then
return uri
end
end
local function extractUrl(args)
for name, val in pairs(args) do
if name ~= 2 and name ~= "msg" then
local url = name .. "=" .. val;
url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?):(/?)([^/])', 'http%1://%3')
local uri = safeUri(url);
if uri and uri.host then
return url
end
end
end
end
function p._url(url, text, msg)
url = mw.text.trim(url or '')
text = mw.text.trim(text or '')
-- Check for pre-formatted url. Catches '{{url|{{url|google.com}}}}' that can occur via template
if (mw.ustring.match(url, '^<span class="url">')) then
return url, text, msg
end
local nomsg = (msg or ''):sub(1,1):lower() == "n" or msg == 'false' -- boolean: true if msg is "false" or starts with n or N
if url == '' then
if text == '' then
if nomsg then
return nil
else
return mw.getCurrentFrame():expandTemplate{ title = 'tlx', args = { 'URL', "''example.com''", "''optional display text''" } }
end
else
return text
end
end
-- If the URL contains any unencoded spaces, encode them, because MediaWiki will otherwise interpret a space as the end of the URL.
url = mw.ustring.gsub(url, '%s', function(s) return mw.uri.encode(s, 'PATH') end)
-- If there is an empty query string or fragment id, remove it as it will cause mw.uri.new to throw an error
url = mw.ustring.gsub(url, '#$', '')
url = mw.ustring.gsub(url, '%?$', '')
-- If it's an HTTP[S] URL without the double slash, fix it.
url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?):(/?)([^/])', 'http%1://%3')
local uri = safeUri(url)
-- Handle URL's without a protocol and URL's that are protocol-relative,
-- e.g. www.example.com/foo or www.example.com:8080/foo, and //www.example.com/foo
if uri and (not uri.protocol or (uri.protocol and not uri.host)) and url:sub(1, 2) ~= '//' then
url = 'http://' .. url
uri = safeUri(url)
end
if text == '' then
if uri then
if uri.path == '/' then uri.path = '' end
local port = ''
if uri.port then port = ':' .. uri.port end
text = mw.ustring.lower(uri.host or '') .. port .. (uri.relativePath or '')
-- Add <wbr> before _/.-# sequences
text = mw.ustring.gsub(text,"(/+)","<wbr/>%1") -- This entry MUST be the first. "<wbr/>" has a "/" in it, you know.
text = mw.ustring.gsub(text,"(%.+)","<wbr/>%1")
-- text = mw.ustring.gsub(text,"(%-+)","<wbr/>%1") -- DISABLED for now
text = mw.ustring.gsub(text,"(%#+)","<wbr/>%1")
text = mw.ustring.gsub(text,"(_+)","<wbr/>%1")
else -- URL is badly-formed, so just display whatever was passed in
text = url
end
end
return mw.ustring.format('<span class="url">[%s %s]</span>', url, text)
end
--[[
The main entry point for calling from Template:URL.
--]]
function p.url(frame)
local templateArgs = frame.args
local parentArgs = frame:getParent().args
local url = templateArgs[1] or parentArgs[1]
local text = templateArgs[2] or parentArgs[2] or ''
local msg = templateArgs.msg or parentArgs.msg or ''
url = url or extractUrl(templateArgs) or extractUrl(parentArgs) or ''
return p._url(url, text, msg)
end
--[[
The entry point for calling from the forked Template:URL2.
This function returns no message by default.
It strips out wiki-link markup, html tags, and everything after a space.
--]]
function p.url2(frame)
local templateArgs = frame.args
local parentArgs = frame:getParent().args
local url = templateArgs[1] or parentArgs[1]
local text = templateArgs[2] or parentArgs[2] or ''
-- default to no message
local msg = templateArgs.msg or parentArgs.msg or 'no'
url = url or extractUrl(templateArgs) or extractUrl(parentArgs) or ''
-- if the url came from a Wikidata call, it might have a pen icon appended
-- we want to keep that and add it back at the end.
local u1, penicon = mw.ustring.match( url, "(.*)( <span class='penicon.*)" )
if penicon then url = u1 end
-- strip out html tags and [ ] from url
url = (url or ''):gsub("<[^>]*>", ""):gsub("[%[%]]", "")
-- truncate anything after a space
url = url:gsub("%%20", " "):gsub(" .*", "")
return (p._url(url, text, msg) or "") .. (penicon or "")
end
return p
rc4hltyh23z2og5tb2epk1nszo4pvtx
21840
21839
2026-09-18T15:05:28Z
Keresturec
18
1 измена увезена из [[:en:Module:URL]]: Importing from the English wikipedia
21839
Scribunto
text/plain
--
-- This module implements {{URL}}
--
-- See unit tests at [[Module:URL/testcases]]
local p = {}
local function safeUri(s)
local success, uri = pcall(function()
return mw.uri.new(s)
end)
if success then
return uri
end
end
local function extractUrl(args)
for name, val in pairs(args) do
if name ~= 2 and name ~= "msg" then
local url = name .. "=" .. val;
url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?):(/?)([^/])', 'http%1://%3')
local uri = safeUri(url);
if uri and uri.host then
return url
end
end
end
end
function p._url(url, text, msg)
url = mw.text.trim(url or '')
text = mw.text.trim(text or '')
-- Check for pre-formatted url. Catches '{{url|{{url|google.com}}}}' that can occur via template
if (mw.ustring.match(url, '^<span class="url">')) then
return url, text, msg
end
local nomsg = (msg or ''):sub(1,1):lower() == "n" or msg == 'false' -- boolean: true if msg is "false" or starts with n or N
if url == '' then
if text == '' then
if nomsg then
return nil
else
return mw.getCurrentFrame():expandTemplate{ title = 'tlx', args = { 'URL', "''example.com''", "''optional display text''" } }
end
else
return text
end
end
-- If the URL contains any unencoded spaces, encode them, because MediaWiki will otherwise interpret a space as the end of the URL.
url = mw.ustring.gsub(url, '%s', function(s) return mw.uri.encode(s, 'PATH') end)
-- If there is an empty query string or fragment id, remove it as it will cause mw.uri.new to throw an error
url = mw.ustring.gsub(url, '#$', '')
url = mw.ustring.gsub(url, '%?$', '')
-- If it's an HTTP[S] URL without the double slash, fix it.
url = mw.ustring.gsub(url, '^[Hh][Tt][Tt][Pp]([Ss]?):(/?)([^/])', 'http%1://%3')
local uri = safeUri(url)
-- Handle URL's without a protocol and URL's that are protocol-relative,
-- e.g. www.example.com/foo or www.example.com:8080/foo, and //www.example.com/foo
if uri and (not uri.protocol or (uri.protocol and not uri.host)) and url:sub(1, 2) ~= '//' then
url = 'http://' .. url
uri = safeUri(url)
end
if text == '' then
if uri then
if uri.path == '/' then uri.path = '' end
local port = ''
if uri.port then port = ':' .. uri.port end
text = mw.ustring.lower(uri.host or '') .. port .. (uri.relativePath or '')
-- Add <wbr> before _/.-# sequences
text = mw.ustring.gsub(text,"(/+)","<wbr/>%1") -- This entry MUST be the first. "<wbr/>" has a "/" in it, you know.
text = mw.ustring.gsub(text,"(%.+)","<wbr/>%1")
-- text = mw.ustring.gsub(text,"(%-+)","<wbr/>%1") -- DISABLED for now
text = mw.ustring.gsub(text,"(%#+)","<wbr/>%1")
text = mw.ustring.gsub(text,"(_+)","<wbr/>%1")
else -- URL is badly-formed, so just display whatever was passed in
text = url
end
end
return mw.ustring.format('<span class="url">[%s %s]</span>', url, text)
end
--[[
The main entry point for calling from Template:URL.
--]]
function p.url(frame)
local templateArgs = frame.args
local parentArgs = frame:getParent().args
local url = templateArgs[1] or parentArgs[1]
local text = templateArgs[2] or parentArgs[2] or ''
local msg = templateArgs.msg or parentArgs.msg or ''
url = url or extractUrl(templateArgs) or extractUrl(parentArgs) or ''
return p._url(url, text, msg)
end
--[[
The entry point for calling from the forked Template:URL2.
This function returns no message by default.
It strips out wiki-link markup, html tags, and everything after a space.
--]]
function p.url2(frame)
local templateArgs = frame.args
local parentArgs = frame:getParent().args
local url = templateArgs[1] or parentArgs[1]
local text = templateArgs[2] or parentArgs[2] or ''
-- default to no message
local msg = templateArgs.msg or parentArgs.msg or 'no'
url = url or extractUrl(templateArgs) or extractUrl(parentArgs) or ''
-- if the url came from a Wikidata call, it might have a pen icon appended
-- we want to keep that and add it back at the end.
local u1, penicon = mw.ustring.match( url, "(.*)( <span class='penicon.*)" )
if penicon then url = u1 end
-- strip out html tags and [ ] from url
url = (url or ''):gsub("<[^>]*>", ""):gsub("[%[%]]", "")
-- truncate anything after a space
url = url:gsub("%%20", " "):gsub(" .*", "")
return (p._url(url, text, msg) or "") .. (penicon or "")
end
return p
rc4hltyh23z2og5tb2epk1nszo4pvtx
Шаблон:Collapsible list
10
3670
21841
2013-11-02T05:07:45Z
Fuhghettaboutit
2797
Changed protection level of Template:Collapsible list: Enable access by template editors ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite))
21841
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:collapsible list|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
kjyb9efpgwjge2zs29nhobc7dc3xkmh
21842
21841
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Template:Collapsible_list]]: Importing from the English wikipedia
21841
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:collapsible list|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
kjyb9efpgwjge2zs29nhobc7dc3xkmh
Модул:Collapsible list
828
3671
21843
2026-05-20T00:05:09Z
Zackmann08
2741
This was producing wildly incorrect preview messages when the module is directly invoked.
21843
Scribunto
text/plain
local p = {}
local function getListItem( data )
if not type( data ) == 'string' then
return ''
end
return mw.ustring.format( '<li style="line-height: inherit; margin: 0">%s</li>', data )
end
-- Returns an array containing the keys of all positional arguments
-- that contain data (i.e. non-whitespace values).
local function getArgNums( args )
local nums = {}
for k, v in pairs( args ) do
if type( k ) == 'number' and
k >= 1 and
math.floor( k ) == k and
type( v ) == 'string' and
mw.ustring.match( v, '%S' ) then
table.insert( nums, k )
end
end
table.sort( nums )
return nums
end
-- Formats a list of classes, styles or other attributes.
local function formatAttributes( attrType, ... )
local attributes = { ... }
local nums = getArgNums( attributes )
local t = {}
for i, num in ipairs( nums ) do
table.insert( t, attributes[ num ] )
end
if #t == 0 then
return '' -- Return the blank string so concatenation will work.
end
return mw.ustring.format( ' %s="%s"', attrType, table.concat( t, ' ' ) )
end
-- TODO: use Module:List. Since the update for this comment is routine,
-- this is blocked without a consensus discussion by
-- [[MediaWiki_talk:Common.css/Archive_15#plainlist_+_hlist_indentation]]
-- if we decide hlist in plainlist in this template isn't an issue, we can use
-- module:list directly
-- [https://en.wikipedia.org/w/index.php?title=Module:Collapsible_list/sandbox&oldid=1130172480]
-- is an implementation (that will code rot slightly I expect)
local function buildList( args )
-- Get the list items.
local listItems = {}
local argNums = getArgNums( args )
for i, num in ipairs( argNums ) do
table.insert( listItems, getListItem( args[ num ] ) )
end
if #listItems == 0 then
return ''
end
listItems = table.concat( listItems )
-- hack around mw-collapsible show/hide jumpiness by looking for text-alignment
-- by setting a margin if centered
local textAlignmentCentered = 'text%-align%s*:%s*center'
local centeredTitle = (args.title_style and args.title_style:lower():match(textAlignmentCentered)
or args.titlestyle and args.titlestyle:lower():match(textAlignmentCentered))
local centeredTitleSpacing
if centeredTitle then
centeredTitleSpacing = 'margin: 0 4em'
else
centeredTitleSpacing = ''
end
-- Get class, style and title data.
local collapsibleContainerClass = formatAttributes(
'class',
'collapsible-list',
'mw-collapsible',
not args.expand and 'mw-collapsed'
)
local collapsibleContainerStyle = formatAttributes(
'style',
-- mostly work around .infobox-full-data defaulting to centered
'text-align: left;',
args.frame_style,
args.framestyle
)
local collapsibleTitleStyle = formatAttributes(
'style',
'line-height: 1.6em; font-weight: bold;',
args.title_style,
args.titlestyle
)
local jumpyTitleStyle = formatAttributes(
'style',
centeredTitleSpacing
)
local title = args.title or 'List'
local ulclass = formatAttributes( 'class', 'mw-collapsible-content', args.hlist and 'hlist' )
local ulstyle = formatAttributes(
'style',
'margin-top: 0; margin-bottom: 0; line-height: inherit;',
not args.bullets and 'list-style: none; margin-left: 0;',
args.list_style,
args.liststyle
)
local hlist_templatestyles = ''
if args.hlist then
hlist_templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Hlist/styles.css' }
}
end
-- Build the list.
return mw.ustring.format(
'%s<div%s%s>\n<div%s><div%s>%s</div></div>\n<ul%s%s>%s</ul>\n</div>',
hlist_templatestyles, collapsibleContainerClass, collapsibleContainerStyle,
collapsibleTitleStyle, jumpyTitleStyle, title, ulclass, ulstyle, listItems
)
end
function p.main( frame )
local origArgs
local current_frame = mw.getCurrentFrame()
if frame == current_frame then
origArgs = frame:getParent().args
for k, v in pairs( frame.args ) do
origArgs = frame.args
break
end
else
origArgs = frame
frame = current_frame
end
local args = {}
for k, v in pairs( origArgs ) do
if type( k ) == 'number' or v ~= '' then
args[ k ] = v
end
end
return buildList( args )
end
return p
5xl9rp2cmngmpjvr1qan9h87g1wcy39
21844
21843
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Module:Collapsible_list]]: Importing from the English wikipedia
21843
Scribunto
text/plain
local p = {}
local function getListItem( data )
if not type( data ) == 'string' then
return ''
end
return mw.ustring.format( '<li style="line-height: inherit; margin: 0">%s</li>', data )
end
-- Returns an array containing the keys of all positional arguments
-- that contain data (i.e. non-whitespace values).
local function getArgNums( args )
local nums = {}
for k, v in pairs( args ) do
if type( k ) == 'number' and
k >= 1 and
math.floor( k ) == k and
type( v ) == 'string' and
mw.ustring.match( v, '%S' ) then
table.insert( nums, k )
end
end
table.sort( nums )
return nums
end
-- Formats a list of classes, styles or other attributes.
local function formatAttributes( attrType, ... )
local attributes = { ... }
local nums = getArgNums( attributes )
local t = {}
for i, num in ipairs( nums ) do
table.insert( t, attributes[ num ] )
end
if #t == 0 then
return '' -- Return the blank string so concatenation will work.
end
return mw.ustring.format( ' %s="%s"', attrType, table.concat( t, ' ' ) )
end
-- TODO: use Module:List. Since the update for this comment is routine,
-- this is blocked without a consensus discussion by
-- [[MediaWiki_talk:Common.css/Archive_15#plainlist_+_hlist_indentation]]
-- if we decide hlist in plainlist in this template isn't an issue, we can use
-- module:list directly
-- [https://en.wikipedia.org/w/index.php?title=Module:Collapsible_list/sandbox&oldid=1130172480]
-- is an implementation (that will code rot slightly I expect)
local function buildList( args )
-- Get the list items.
local listItems = {}
local argNums = getArgNums( args )
for i, num in ipairs( argNums ) do
table.insert( listItems, getListItem( args[ num ] ) )
end
if #listItems == 0 then
return ''
end
listItems = table.concat( listItems )
-- hack around mw-collapsible show/hide jumpiness by looking for text-alignment
-- by setting a margin if centered
local textAlignmentCentered = 'text%-align%s*:%s*center'
local centeredTitle = (args.title_style and args.title_style:lower():match(textAlignmentCentered)
or args.titlestyle and args.titlestyle:lower():match(textAlignmentCentered))
local centeredTitleSpacing
if centeredTitle then
centeredTitleSpacing = 'margin: 0 4em'
else
centeredTitleSpacing = ''
end
-- Get class, style and title data.
local collapsibleContainerClass = formatAttributes(
'class',
'collapsible-list',
'mw-collapsible',
not args.expand and 'mw-collapsed'
)
local collapsibleContainerStyle = formatAttributes(
'style',
-- mostly work around .infobox-full-data defaulting to centered
'text-align: left;',
args.frame_style,
args.framestyle
)
local collapsibleTitleStyle = formatAttributes(
'style',
'line-height: 1.6em; font-weight: bold;',
args.title_style,
args.titlestyle
)
local jumpyTitleStyle = formatAttributes(
'style',
centeredTitleSpacing
)
local title = args.title or 'List'
local ulclass = formatAttributes( 'class', 'mw-collapsible-content', args.hlist and 'hlist' )
local ulstyle = formatAttributes(
'style',
'margin-top: 0; margin-bottom: 0; line-height: inherit;',
not args.bullets and 'list-style: none; margin-left: 0;',
args.list_style,
args.liststyle
)
local hlist_templatestyles = ''
if args.hlist then
hlist_templatestyles = mw.getCurrentFrame():extensionTag{
name = 'templatestyles', args = { src = 'Hlist/styles.css' }
}
end
-- Build the list.
return mw.ustring.format(
'%s<div%s%s>\n<div%s><div%s>%s</div></div>\n<ul%s%s>%s</ul>\n</div>',
hlist_templatestyles, collapsibleContainerClass, collapsibleContainerStyle,
collapsibleTitleStyle, jumpyTitleStyle, title, ulclass, ulstyle, listItems
)
end
function p.main( frame )
local origArgs
local current_frame = mw.getCurrentFrame()
if frame == current_frame then
origArgs = frame:getParent().args
for k, v in pairs( frame.args ) do
origArgs = frame.args
break
end
else
origArgs = frame
frame = current_frame
end
local args = {}
for k, v in pairs( origArgs ) do
if type( k ) == 'number' or v ~= '' then
args[ k ] = v
end
end
return buildList( args )
end
return p
5xl9rp2cmngmpjvr1qan9h87g1wcy39
Модул:ISO 3166
828
3672
21845
2026-08-12T01:42:26Z
Paine Ellsworth
2766
per edit request on talk page - merge changes from the sandbox
21845
Scribunto
text/plain
-- to enable us to replicate the current functioning of Country extract, we need to deal with:
-- 2 {{<name>}} DONE!
-- 3 [[<name>]] DONE!
-- 4 [[<name>|<junk>]] DONE!
-- 5 [[image:flag of <country>.[svg|gif|png|jpg]|\d+px]] DONE!
local p = {}
local getArgs = require("Module:Arguments").getArgs
local data = mw.loadData("Module:ISO 3166/data/National")
--[[----------C A T S----------]]-- -- Assign error categories
local function cats(cat, args)
if not (args.nocat and args.nocat == 'true') and mw.title.getCurrentTitle().namespace == 0 then
if cat == 'nocountry' then
return '[[Category:Wikipedia articles with obscure country]]'
elseif cat == 'nosubdivision' then
return '[[Category:Wikipedia articles with obscure subdivision]]'
end
end
return ''
end
--[[----------F I N D N A M E----------]]-- -- Finds the name in the database
local function findname(code,cdata,qry)
if cdata["name"] and qry==p.strip(cdata["name"])
or cdata["isoname"] and qry==p.strip(cdata["isoname"])
or not cdata["nocode"] and qry==code
or qry==cdata["alpha3"] or qry==cdata["numeric"]
then
return true
end
for _,tname in pairs(cdata["isonames"] or {}) do
if qry==p.strip(tname) then
return true
end
end
for _,tname in pairs(cdata["altnames"] or {}) do
if qry==p.strip(tname) then
return true
end
end
return false
end
--[[----------I S O N A M E----------]]-- -- Find the ISO name of a country/region
local function isoname(isodata,code,lang)
if isodata[code]["isonames"] then
local name = isodata[code]["isodisplaynames"] and isodata[code]["isodisplaynames"][lang]
or isodata[code]["isonames"][lang]
or isodata[code]["isodisplaynames"] and isodata[code]["isodisplaynames"][isodata[code]["defaultlang"] or isodata["defaultlang"]]
or isodata[code]["isonames"][isodata[code]["defaultlang"] or isodata["defaultlang"]]
or isodata[code]["isodisplaynames"] and isodata[code]["isodisplaynames"]["en"]
or isodata[code]["isonames"]["en"]
if name then return name end
for _,iname in pairs(isodata[code]["isonames"]) do return iname end
return isodata[code]["isodisplayname"] or isodata[code]["isoname"]
else
return isodata[code]["isodisplayname"] or isodata[code]["isoname"]
end
end
--[[----------S T R I P----------]]-- -- Removes junk from the input
function p.strip(text)
if not text then return nil end
local accents = {["À"]="A",["Á"]="A",["Â"]="A",["Ã"]="A",["Ä"]="A",
["Å"]="A",["Æ"]="AE",["Ç"]="C",["È"]="E",["É"]="E",["Ê"]="E",["Ë"]="E",
["Ì"]="I",["Í"]="I",["Î"]="I",["Ï"]="I",["Ð"]="D",["Ñ"]="N",["Ò"]="O",
["Ó"]="O",["Ô"]="O",["Õ"]="O",["Ö"]="O",["Ø"]="O",["Ù"]="U",["Ú"]="U",
["Û"]="U",["Ü"]="U",["Ý"]="Y",["Þ"]="TH",["Ā"]="A",["Ă"]="A",["Ą"]="A",
["Ć"]="C",["Ĉ"]="C",["Ċ"]="C",["Č"]="C",["Ď"]="D",["Đ"]="D",["Ē"]="E",
["Ĕ"]="E",["Ė"]="E",["Ę"]="E",["Ě"]="E",["Ĝ"]="G",["Ğ"]="G",["Ġ"]="G",
["Ģ"]="G",["Ĥ"]="H",["Ħ"]="H",["Ĩ"]="I",["Ī"]="I",["Ĭ"]="I",["Į"]="I",
["İ"]="I",["IJ"]="IJ",["Ĵ"]="J",["Ķ"]="K",["Ĺ"]="L",["Ļ"]="L",["Ľ"]="L",
["Ŀ"]="L",["Ł"]="L",["Ń"]="N",["Ņ"]="N",["Ň"]="N",["Ŋ"]="N",["Ō"]="O",
["Ŏ"]="O",["Ő"]="O",["Œ"]="OE",["Ŕ"]="R",["Ŗ"]="R",["Ř"]="R",["Ś"]="S",
["Ŝ"]="S",["Ş"]="S",["Š"]="S",["Ţ"]="T",["Ť"]="T",["Ŧ"]="T",["Ũ"]="U",
["Ū"]="U",["Ŭ"]="U",["Ů"]="U",["Ű"]="U",["Ų"]="U",["Ŵ"]="W",["Ŷ"]="Y",
["Ÿ"]="Y",["Ź"]="Z",["Ż"]="Z",["Ž"]="Z",["Ɓ"]="B",["Ƃ"]="B",["Ɔ"]="C",
["Ƈ"]="C",["Ɖ"]="D",["Ɗ"]="D",["Ƌ"]="D",["Ǝ"]="E",["Ə"]="E",["Ɛ"]="E",
["Ƒ"]="F",["Ɠ"]="G",["Ɣ"]="G",["Ɩ"]="I",["Ɨ"]="I",["Ƙ"]="K",["Ɯ"]="M",
["Ɲ"]="N",["Ɵ"]="O",["Ơ"]="O",["Ƣ"]="OI",["Ƥ"]="P",["Ʃ"]="SH",["Ƭ"]="T",
["Ʈ"]="T",["Ư"]="U",["Ʊ"]="U",["Ʋ"]="V",["Ƴ"]="Y",["Ƶ"]="Z",["Ʒ"]="Z",
["Ƹ"]="Z",["DŽ"]="DZ",["LJ"]="LJ",["NJ"]="NJ",["Ǎ"]="A",["Ǐ"]="I",
["Ǒ"]="O",["Ǔ"]="U",["Ǖ"]="U",["Ǘ"]="U",["Ǚ"]="U",["Ǜ"]="U",["Ǟ"]="A",
["Ǡ"]="A",["Ǣ"]="AE",["Ǥ"]="G",["Ǧ"]="G",["Ǩ"]="K",["Ǫ"]="O",["Ǭ"]="O",
["Ǯ"]="Z",["DZ"]="DZ",["Ǵ"]="G",["Ƕ"]="HV",["Ƿ"]="W",["Ǹ"]="N",["Ǻ"]="A",
["Ǽ"]="AE",["Ǿ"]="O",["Ȁ"]="A",["Ȃ"]="A",["Ȅ"]="E",["Ȇ"]="E",["Ȉ"]="I",
["Ȋ"]="I",["Ȍ"]="O",["Ȏ"]="O",["Ȑ"]="R",["Ȓ"]="R",["Ȕ"]="U",["Ȗ"]="U",
["Ș"]="S",["Ț"]="T",["Ȝ"]="Z",["Ȟ"]="H",["Ƞ"]="N",["Ȣ"]="OU",["Ȥ"]="Z",
["Ȧ"]="A",["Ȩ"]="E",["Ȫ"]="O",["Ȭ"]="O",["Ȯ"]="O",["Ȱ"]="O",["Ȳ"]="Y",
["Ⱥ"]="A",["Ȼ"]="C",["Ƚ"]="L",["Ⱦ"]="T",["Ƀ"]="B",["Ʉ"]="U",["Ʌ"]="V",
["Ɇ"]="E",["Ɉ"]="J",["Ɋ"]="Q",["Ɍ"]="R",["Ɏ"]="Y",
}
local remove = {"COUNTRY OF ", "COUNTY ", " COUNTY$", "FLAG OF ", " FLAG$", -- text to be removed list
" GOVERNORATE$", "KINGDOM OF ", "NATION OF ", "PROVINCE OF ",
" PROVINCE$", "STATE OF ", " STATE$", "TERRITORY OF ",
}
local patterns = {"(%a)%.(%a)%.", ".+:", "|.+", "%(.-%)", "%.%S.*", -- patterns to follow (order may matter)
"^%s*THE ", "_", "%-", "%d%d?%d?PX", "%s+"
}
local replacements = {["(%a)%.(%a)%."]="%1%2", -- Replacements for patterns above (order does not matter)
[".+:"]="", ["|.+"]="", ["%(.-%)"]="",
["%.%S.*"]="", ["^%s*THE "]="", ["_"]=" ", ["%-"]=" ",
["%d%d?%d?PX"]="", ["%s+"]=" "
}
text = mw.text.decode(text) -- Decode HTML entities (passed from wikidata?)
text = mw.text.killMarkers(text) -- Remove <nowiki> and <ref> tags
text = mw.ustring.upper(text) -- Case insensitivity
text = mw.ustring.gsub(text,"[À-Ɏ]",accents) -- Deaccent
for _,pattern in ipairs(patterns) do -- Follow patterns
text = mw.ustring.gsub(text,pattern,replacements[pattern])
end
for _,words in pairs(remove) do -- Remove unneeded words
text = mw.ustring.gsub(text,words,"")
end
text = mw.ustring.gsub(text,"^%s*THE ","") -- Final "The" replacement
text = mw.ustring.gsub(text,"%W","") -- Remove non alpha-numeric
return text
end
--[[----------P . C A L L S T R I P ---------]]-- -- Calls P.strip but using Module:Arguments
function p.callstrip(frame)
local args = getArgs(frame)
return p.strip(args[1]) or ""
end
--[[----------P . L U A C O D E---------]]-- -- Makes the ISO code of a country
function p.luacode(args)
args[1], args[2] = args[1] or '', args[2] or ''
local code1 = p.strip(args[1])
local code2 = p.strip(args[2])
if args["codetype"]=="3" then args["codetype"]="alpha3" end
local eot = args.error or ""
if code1 == "" then
mw.addWarning((args[1] ~= "" and ('Invalid parameter "' .. args[1] .. '"') or 'No parameter') ..
' for the country given ([[Module:ISO 3166]]).')
return cats('nocountry', args), '<span style="font-size:100%" class="error">"No parameter for the country given"</span>'
end
local notRecognized ='%s ("%s") is not a recognized %s in [[ISO 3166-%s]] ([[Module:ISO 3166]]).'
if code2 == "" then --3166-1 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,code1) then
if args["codetype"]=="numeric" or args["codetype"]=="alpha3" then
return cdata[args["codetype"]]
else
return alpha2
end
end
end
if string.find(args[1],"%-") then
args[1], args[2] = string.match(args[1],"^([^%-]*)%-(.*)$")
if args[2] then return p.luacode(args) end
end
mw.addWarning(string.format(notRecognized, code1, args[1], 'country', '1'))
return cats('nocountry', args)
else --3166-2 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,code1) then
if mw.ustring.match(alpha2,"GB") then -- For England, Wales etc.
alpha2 = "GB"
end
local sdata = mw.loadData("Module:ISO 3166/data/"..alpha2)
local empty = true
for scode,scdata in pairs(sdata) do
if type(scdata)=="table" then
empty = false
if findname(scode,scdata,code2) then
return alpha2.."-"..scode
end
end
end
if string.find(args[2] or '',"%-") then
code1, args[2] = string.match(args[2] or '',"^([^%-]*)%-(.*)$")
args[1] = args[1].."-"..code1
return p.luacode(args)
end
mw.addWarning(string.format(notRecognized, code2, args[2], 'subdivision', '2:' .. alpha2))
return cats('nosubdivision', args)
end
end
if string.find(args[1],"%-") then
args[1] = string.match(args[1],"^([^%-]*)%-(.*)$")
return p.luacode(args)
end
mw.addWarning(string.format(notRecognized, code1, args[1], 'country', '1'))
return cats('nocountry', args)
end
mw.addWarning(string.format(notRecognized, code1, args[1], 'country', '1'))
return cats('nocountry', args)
end
--[[----------P . C O D E---------]]-- -- Calls P.Luacode but using Module:Arguments
function p.code(frame)
return p.luacode(getArgs(frame)) or ""
end
--[[----------P . N U M E R I C---------]]-- -- Calls P.Luacode but using Module:Arguments and setting it to output a numeric value
function p.numeric(frame)
local args = getArgs(frame)
args["codetype"]="numeric"
return p.luacode(args) or ""
end
--[[----------P . L U A N A M E---------]]-- -- Makes the ISO/common name of a country
function p.luaname(args)
local code1 = p.luacode(args)
local code2 = ''
if string.find(code1,"%-") then
code1, code2 = string.match(code1,"^([^%-]*)%-(.*)$")
end
if string.find(code1,"^%u%u$") then
if code2=="" then --3166-1 alpha-2 code
if data[code1] then
return (args.isoname or args.lang) and isoname(data,code1,args.lang)
or (data[code1]["displayname"] or data[code1]["name"])
else
return cats('nocountry', args)
end
else --3166-2 code
local sdata
if data[code1] then
sdata = mw.loadData("Module:ISO 3166/data/"..code1)
else
return cats('nocountry', args)
end
if sdata[code2] then
return (args.isoname or args.lang) and isoname(sdata,code2,args.lang)
or (sdata[code2]["displayname"] or sdata[code2]["name"])
else
return cats('nocountry', args)
end
end
elseif args.notfound then
return args.notfound
end
end
--[[----------P . N A M E---------]]-- -- Calls P.Luaname but using Module:Arguments
function p.name(frame)
return p.luaname(getArgs(frame)) or ""
end
--[[----------P . G E O C O O R D I N S E R T---------]]-- -- Wrapper for Module:Coordinates.coordinsert
function p.geocoordinsert(frame)
-- {{#invoke:ISO 3166|geocoordinsert|{{coord|...}}
-- |country=..|subdivision1=...|subdivision2=...
-- |type=...|scale=...|dim=...|source=...|globe=...
-- }}
local args = frame.args
local subdivisionqueried = false
local tracking = ''
local targs = {}
targs[1] = args[1] or ''
for i, v in pairs(args) do
if i == 'country' and not mw.ustring.find(targs[1], 'region:') then
local country = v
local k, region = 1, ''
-- look for a valid subdivision
while region == '' and k < 3 do
local subdivision = args['subdivision' .. k] or ''
if subdivision ~= '' then
region = p.luacode({country, subdivision, nocat = 'true'})
subdivisionqueried = true
end
k = k + 1
end
-- subdivision lookup failed or never attempted, try country only
if region == '' then
region = p.luacode({country, nocat = 'true'})
if region == '' then
tracking = tracking .. cats('nocountry', args)
elseif subdivisionqueried == true then
tracking = tracking .. cats('nosubdivision', args)
end
end
-- something worked, add it to the targs
if region ~= '' then
targs[#targs + 1] = 'region:' .. region
end
elseif i == 'type' or i == 'scale' or i == 'dim'
or i == 'source' or i == 'globe' then
targs[#targs + 1] = i .. ':' .. v
end
end
-- call Module:Coordinates.coordinsert if there is something to insert
if #targs > 1 then
local coordinsert = require('Module:Coordinates').coordinsert
return coordinsert({args = targs}) .. tracking
end
-- otherwise, just return the coordinates
return targs[1] .. tracking
end
return p
e3x35su5n5ylld004jhjucg7g1msqfe
21846
21845
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Module:ISO_3166]]: Importing from the English wikipedia
21845
Scribunto
text/plain
-- to enable us to replicate the current functioning of Country extract, we need to deal with:
-- 2 {{<name>}} DONE!
-- 3 [[<name>]] DONE!
-- 4 [[<name>|<junk>]] DONE!
-- 5 [[image:flag of <country>.[svg|gif|png|jpg]|\d+px]] DONE!
local p = {}
local getArgs = require("Module:Arguments").getArgs
local data = mw.loadData("Module:ISO 3166/data/National")
--[[----------C A T S----------]]-- -- Assign error categories
local function cats(cat, args)
if not (args.nocat and args.nocat == 'true') and mw.title.getCurrentTitle().namespace == 0 then
if cat == 'nocountry' then
return '[[Category:Wikipedia articles with obscure country]]'
elseif cat == 'nosubdivision' then
return '[[Category:Wikipedia articles with obscure subdivision]]'
end
end
return ''
end
--[[----------F I N D N A M E----------]]-- -- Finds the name in the database
local function findname(code,cdata,qry)
if cdata["name"] and qry==p.strip(cdata["name"])
or cdata["isoname"] and qry==p.strip(cdata["isoname"])
or not cdata["nocode"] and qry==code
or qry==cdata["alpha3"] or qry==cdata["numeric"]
then
return true
end
for _,tname in pairs(cdata["isonames"] or {}) do
if qry==p.strip(tname) then
return true
end
end
for _,tname in pairs(cdata["altnames"] or {}) do
if qry==p.strip(tname) then
return true
end
end
return false
end
--[[----------I S O N A M E----------]]-- -- Find the ISO name of a country/region
local function isoname(isodata,code,lang)
if isodata[code]["isonames"] then
local name = isodata[code]["isodisplaynames"] and isodata[code]["isodisplaynames"][lang]
or isodata[code]["isonames"][lang]
or isodata[code]["isodisplaynames"] and isodata[code]["isodisplaynames"][isodata[code]["defaultlang"] or isodata["defaultlang"]]
or isodata[code]["isonames"][isodata[code]["defaultlang"] or isodata["defaultlang"]]
or isodata[code]["isodisplaynames"] and isodata[code]["isodisplaynames"]["en"]
or isodata[code]["isonames"]["en"]
if name then return name end
for _,iname in pairs(isodata[code]["isonames"]) do return iname end
return isodata[code]["isodisplayname"] or isodata[code]["isoname"]
else
return isodata[code]["isodisplayname"] or isodata[code]["isoname"]
end
end
--[[----------S T R I P----------]]-- -- Removes junk from the input
function p.strip(text)
if not text then return nil end
local accents = {["À"]="A",["Á"]="A",["Â"]="A",["Ã"]="A",["Ä"]="A",
["Å"]="A",["Æ"]="AE",["Ç"]="C",["È"]="E",["É"]="E",["Ê"]="E",["Ë"]="E",
["Ì"]="I",["Í"]="I",["Î"]="I",["Ï"]="I",["Ð"]="D",["Ñ"]="N",["Ò"]="O",
["Ó"]="O",["Ô"]="O",["Õ"]="O",["Ö"]="O",["Ø"]="O",["Ù"]="U",["Ú"]="U",
["Û"]="U",["Ü"]="U",["Ý"]="Y",["Þ"]="TH",["Ā"]="A",["Ă"]="A",["Ą"]="A",
["Ć"]="C",["Ĉ"]="C",["Ċ"]="C",["Č"]="C",["Ď"]="D",["Đ"]="D",["Ē"]="E",
["Ĕ"]="E",["Ė"]="E",["Ę"]="E",["Ě"]="E",["Ĝ"]="G",["Ğ"]="G",["Ġ"]="G",
["Ģ"]="G",["Ĥ"]="H",["Ħ"]="H",["Ĩ"]="I",["Ī"]="I",["Ĭ"]="I",["Į"]="I",
["İ"]="I",["IJ"]="IJ",["Ĵ"]="J",["Ķ"]="K",["Ĺ"]="L",["Ļ"]="L",["Ľ"]="L",
["Ŀ"]="L",["Ł"]="L",["Ń"]="N",["Ņ"]="N",["Ň"]="N",["Ŋ"]="N",["Ō"]="O",
["Ŏ"]="O",["Ő"]="O",["Œ"]="OE",["Ŕ"]="R",["Ŗ"]="R",["Ř"]="R",["Ś"]="S",
["Ŝ"]="S",["Ş"]="S",["Š"]="S",["Ţ"]="T",["Ť"]="T",["Ŧ"]="T",["Ũ"]="U",
["Ū"]="U",["Ŭ"]="U",["Ů"]="U",["Ű"]="U",["Ų"]="U",["Ŵ"]="W",["Ŷ"]="Y",
["Ÿ"]="Y",["Ź"]="Z",["Ż"]="Z",["Ž"]="Z",["Ɓ"]="B",["Ƃ"]="B",["Ɔ"]="C",
["Ƈ"]="C",["Ɖ"]="D",["Ɗ"]="D",["Ƌ"]="D",["Ǝ"]="E",["Ə"]="E",["Ɛ"]="E",
["Ƒ"]="F",["Ɠ"]="G",["Ɣ"]="G",["Ɩ"]="I",["Ɨ"]="I",["Ƙ"]="K",["Ɯ"]="M",
["Ɲ"]="N",["Ɵ"]="O",["Ơ"]="O",["Ƣ"]="OI",["Ƥ"]="P",["Ʃ"]="SH",["Ƭ"]="T",
["Ʈ"]="T",["Ư"]="U",["Ʊ"]="U",["Ʋ"]="V",["Ƴ"]="Y",["Ƶ"]="Z",["Ʒ"]="Z",
["Ƹ"]="Z",["DŽ"]="DZ",["LJ"]="LJ",["NJ"]="NJ",["Ǎ"]="A",["Ǐ"]="I",
["Ǒ"]="O",["Ǔ"]="U",["Ǖ"]="U",["Ǘ"]="U",["Ǚ"]="U",["Ǜ"]="U",["Ǟ"]="A",
["Ǡ"]="A",["Ǣ"]="AE",["Ǥ"]="G",["Ǧ"]="G",["Ǩ"]="K",["Ǫ"]="O",["Ǭ"]="O",
["Ǯ"]="Z",["DZ"]="DZ",["Ǵ"]="G",["Ƕ"]="HV",["Ƿ"]="W",["Ǹ"]="N",["Ǻ"]="A",
["Ǽ"]="AE",["Ǿ"]="O",["Ȁ"]="A",["Ȃ"]="A",["Ȅ"]="E",["Ȇ"]="E",["Ȉ"]="I",
["Ȋ"]="I",["Ȍ"]="O",["Ȏ"]="O",["Ȑ"]="R",["Ȓ"]="R",["Ȕ"]="U",["Ȗ"]="U",
["Ș"]="S",["Ț"]="T",["Ȝ"]="Z",["Ȟ"]="H",["Ƞ"]="N",["Ȣ"]="OU",["Ȥ"]="Z",
["Ȧ"]="A",["Ȩ"]="E",["Ȫ"]="O",["Ȭ"]="O",["Ȯ"]="O",["Ȱ"]="O",["Ȳ"]="Y",
["Ⱥ"]="A",["Ȼ"]="C",["Ƚ"]="L",["Ⱦ"]="T",["Ƀ"]="B",["Ʉ"]="U",["Ʌ"]="V",
["Ɇ"]="E",["Ɉ"]="J",["Ɋ"]="Q",["Ɍ"]="R",["Ɏ"]="Y",
}
local remove = {"COUNTRY OF ", "COUNTY ", " COUNTY$", "FLAG OF ", " FLAG$", -- text to be removed list
" GOVERNORATE$", "KINGDOM OF ", "NATION OF ", "PROVINCE OF ",
" PROVINCE$", "STATE OF ", " STATE$", "TERRITORY OF ",
}
local patterns = {"(%a)%.(%a)%.", ".+:", "|.+", "%(.-%)", "%.%S.*", -- patterns to follow (order may matter)
"^%s*THE ", "_", "%-", "%d%d?%d?PX", "%s+"
}
local replacements = {["(%a)%.(%a)%."]="%1%2", -- Replacements for patterns above (order does not matter)
[".+:"]="", ["|.+"]="", ["%(.-%)"]="",
["%.%S.*"]="", ["^%s*THE "]="", ["_"]=" ", ["%-"]=" ",
["%d%d?%d?PX"]="", ["%s+"]=" "
}
text = mw.text.decode(text) -- Decode HTML entities (passed from wikidata?)
text = mw.text.killMarkers(text) -- Remove <nowiki> and <ref> tags
text = mw.ustring.upper(text) -- Case insensitivity
text = mw.ustring.gsub(text,"[À-Ɏ]",accents) -- Deaccent
for _,pattern in ipairs(patterns) do -- Follow patterns
text = mw.ustring.gsub(text,pattern,replacements[pattern])
end
for _,words in pairs(remove) do -- Remove unneeded words
text = mw.ustring.gsub(text,words,"")
end
text = mw.ustring.gsub(text,"^%s*THE ","") -- Final "The" replacement
text = mw.ustring.gsub(text,"%W","") -- Remove non alpha-numeric
return text
end
--[[----------P . C A L L S T R I P ---------]]-- -- Calls P.strip but using Module:Arguments
function p.callstrip(frame)
local args = getArgs(frame)
return p.strip(args[1]) or ""
end
--[[----------P . L U A C O D E---------]]-- -- Makes the ISO code of a country
function p.luacode(args)
args[1], args[2] = args[1] or '', args[2] or ''
local code1 = p.strip(args[1])
local code2 = p.strip(args[2])
if args["codetype"]=="3" then args["codetype"]="alpha3" end
local eot = args.error or ""
if code1 == "" then
mw.addWarning((args[1] ~= "" and ('Invalid parameter "' .. args[1] .. '"') or 'No parameter') ..
' for the country given ([[Module:ISO 3166]]).')
return cats('nocountry', args), '<span style="font-size:100%" class="error">"No parameter for the country given"</span>'
end
local notRecognized ='%s ("%s") is not a recognized %s in [[ISO 3166-%s]] ([[Module:ISO 3166]]).'
if code2 == "" then --3166-1 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,code1) then
if args["codetype"]=="numeric" or args["codetype"]=="alpha3" then
return cdata[args["codetype"]]
else
return alpha2
end
end
end
if string.find(args[1],"%-") then
args[1], args[2] = string.match(args[1],"^([^%-]*)%-(.*)$")
if args[2] then return p.luacode(args) end
end
mw.addWarning(string.format(notRecognized, code1, args[1], 'country', '1'))
return cats('nocountry', args)
else --3166-2 code
for alpha2,cdata in pairs(data) do
if findname(alpha2,cdata,code1) then
if mw.ustring.match(alpha2,"GB") then -- For England, Wales etc.
alpha2 = "GB"
end
local sdata = mw.loadData("Module:ISO 3166/data/"..alpha2)
local empty = true
for scode,scdata in pairs(sdata) do
if type(scdata)=="table" then
empty = false
if findname(scode,scdata,code2) then
return alpha2.."-"..scode
end
end
end
if string.find(args[2] or '',"%-") then
code1, args[2] = string.match(args[2] or '',"^([^%-]*)%-(.*)$")
args[1] = args[1].."-"..code1
return p.luacode(args)
end
mw.addWarning(string.format(notRecognized, code2, args[2], 'subdivision', '2:' .. alpha2))
return cats('nosubdivision', args)
end
end
if string.find(args[1],"%-") then
args[1] = string.match(args[1],"^([^%-]*)%-(.*)$")
return p.luacode(args)
end
mw.addWarning(string.format(notRecognized, code1, args[1], 'country', '1'))
return cats('nocountry', args)
end
mw.addWarning(string.format(notRecognized, code1, args[1], 'country', '1'))
return cats('nocountry', args)
end
--[[----------P . C O D E---------]]-- -- Calls P.Luacode but using Module:Arguments
function p.code(frame)
return p.luacode(getArgs(frame)) or ""
end
--[[----------P . N U M E R I C---------]]-- -- Calls P.Luacode but using Module:Arguments and setting it to output a numeric value
function p.numeric(frame)
local args = getArgs(frame)
args["codetype"]="numeric"
return p.luacode(args) or ""
end
--[[----------P . L U A N A M E---------]]-- -- Makes the ISO/common name of a country
function p.luaname(args)
local code1 = p.luacode(args)
local code2 = ''
if string.find(code1,"%-") then
code1, code2 = string.match(code1,"^([^%-]*)%-(.*)$")
end
if string.find(code1,"^%u%u$") then
if code2=="" then --3166-1 alpha-2 code
if data[code1] then
return (args.isoname or args.lang) and isoname(data,code1,args.lang)
or (data[code1]["displayname"] or data[code1]["name"])
else
return cats('nocountry', args)
end
else --3166-2 code
local sdata
if data[code1] then
sdata = mw.loadData("Module:ISO 3166/data/"..code1)
else
return cats('nocountry', args)
end
if sdata[code2] then
return (args.isoname or args.lang) and isoname(sdata,code2,args.lang)
or (sdata[code2]["displayname"] or sdata[code2]["name"])
else
return cats('nocountry', args)
end
end
elseif args.notfound then
return args.notfound
end
end
--[[----------P . N A M E---------]]-- -- Calls P.Luaname but using Module:Arguments
function p.name(frame)
return p.luaname(getArgs(frame)) or ""
end
--[[----------P . G E O C O O R D I N S E R T---------]]-- -- Wrapper for Module:Coordinates.coordinsert
function p.geocoordinsert(frame)
-- {{#invoke:ISO 3166|geocoordinsert|{{coord|...}}
-- |country=..|subdivision1=...|subdivision2=...
-- |type=...|scale=...|dim=...|source=...|globe=...
-- }}
local args = frame.args
local subdivisionqueried = false
local tracking = ''
local targs = {}
targs[1] = args[1] or ''
for i, v in pairs(args) do
if i == 'country' and not mw.ustring.find(targs[1], 'region:') then
local country = v
local k, region = 1, ''
-- look for a valid subdivision
while region == '' and k < 3 do
local subdivision = args['subdivision' .. k] or ''
if subdivision ~= '' then
region = p.luacode({country, subdivision, nocat = 'true'})
subdivisionqueried = true
end
k = k + 1
end
-- subdivision lookup failed or never attempted, try country only
if region == '' then
region = p.luacode({country, nocat = 'true'})
if region == '' then
tracking = tracking .. cats('nocountry', args)
elseif subdivisionqueried == true then
tracking = tracking .. cats('nosubdivision', args)
end
end
-- something worked, add it to the targs
if region ~= '' then
targs[#targs + 1] = 'region:' .. region
end
elseif i == 'type' or i == 'scale' or i == 'dim'
or i == 'source' or i == 'globe' then
targs[#targs + 1] = i .. ':' .. v
end
end
-- call Module:Coordinates.coordinsert if there is something to insert
if #targs > 1 then
local coordinsert = require('Module:Coordinates').coordinsert
return coordinsert({args = targs}) .. tracking
end
-- otherwise, just return the coordinates
return targs[1] .. tracking
end
return p
e3x35su5n5ylld004jhjucg7g1msqfe
Модул:ISO 3166/data/National
828
3673
21847
2026-07-21T18:27:22Z
Ahecht
2748
Add altnames
21847
Scribunto
text/plain
return {
["AD"] = {alpha3="AND",numeric="020",name="Andorra"},
["AE"] = {alpha3="ARE",numeric="784",name="United Arab Emirates",altnames={"UAE"}},
["AF"] = {alpha3="AFG",numeric="004",name="Afghanistan"},
["AG"] = {alpha3="ATG",numeric="028",name="Antigua and Barbuda"},
["AI"] = {alpha3="AIA",numeric="660",name="Anguilla"},
["AL"] = {alpha3="ALB",numeric="008",name="Albania"},
["AM"] = {alpha3="ARM",numeric="051",name="Armenia"},
["AO"] = {alpha3="AGO",numeric="024",name="Angola"},
["AQ"] = {alpha3="ATA",numeric="010",name="Antarctica"},
["AR"] = {alpha3="ARG",numeric="032",name="Argentina"},
["AS"] = {alpha3="ASM",numeric="016",name="American Samoa"},
["AT"] = {alpha3="AUT",numeric="040",name="Austria"},
["AU"] = {alpha3="AUS",numeric="036",name="Australia"},
["AW"] = {alpha3="ABW",numeric="533",name="Aruba"},
["AX"] = {alpha3="ALA",numeric="248",name="Åland Islands",altnames={"Aland Islands","Åland","Aland"}},
["AZ"] = {alpha3="AZE",numeric="031",name="Azerbaijan"},
["BA"] = {alpha3="BIH",numeric="070",name="Bosnia and Herzegovina",altnames={"Bosnia"}},
["BB"] = {alpha3="BRB",numeric="052",name="Barbados"},
["BD"] = {alpha3="BGD",numeric="050",name="Bangladesh"},
["BE"] = {alpha3="BEL",numeric="056",name="Belgium"},
["BF"] = {alpha3="BFA",numeric="854",name="Burkina Faso"},
["BG"] = {alpha3="BGR",numeric="100",name="Bulgaria"},
["BH"] = {alpha3="BHR",numeric="048",name="Bahrain"},
["BI"] = {alpha3="BDI",numeric="108",name="Burundi"},
["BJ"] = {alpha3="BEN",numeric="204",name="Benin"},
["BL"] = {alpha3="BLM",numeric="652",name="Saint Barthélemy",altnames={"St Barthelemy", "St Barts", "St. Barths", "St Barth"}},
["BM"] = {alpha3="BMU",numeric="060",name="Bermuda"},
["BN"] = {alpha3="BRN",numeric="096",name="Brunei",isoname="Brunei Darussalam"},
["BO"] = {alpha3="BOL",numeric="068",name="Bolivia",isoname="Bolivia, Plurinational State of"},
["BQ"] = {alpha3="BES",numeric="535",name="Caribbean Netherlands",isoname="Bonaire, Sint Eustatius and Saba"},
["BR"] = {alpha3="BRA",numeric="076",name="Brazil"},
["BS"] = {alpha3="BHS",numeric="044",name="Bahamas"},
["BT"] = {alpha3="BTN",numeric="064",name="Bhutan"},
["BV"] = {alpha3="BVT",numeric="074",name="Bouvet Island"},
["BW"] = {alpha3="BWA",numeric="072",name="Botswana"},
["BY"] = {alpha3="BLR",numeric="112",name="Belarus"},
["BZ"] = {alpha3="BLZ",numeric="084",name="Belize"},
["CA"] = {alpha3="CAN",numeric="124",name="Canada"},
["CC"] = {alpha3="CCK",numeric="166",name="Cocos (Keeling) Islands",altnames={"Cocos Islands","Keeling Islands"}},
["CD"] = {alpha3="COD",numeric="180",name="Democratic Republic of the Congo",isoname="Congo, Democratic Republic of the",altnames={"Congo-Kinshasa","Congo–Kinshasa","DRC","DR Congo"}},
["CF"] = {alpha3="CAF",numeric="140",name="Central African Republic",altnames={"CAR"}},
["CG"] = {alpha3="COG",numeric="178",name="Republic of the Congo",isoname="Congo",altnames={"Congo-Brazzaville", "Congo–Brazzaville"}},
["CH"] = {alpha3="CHE",numeric="756",name="Switzerland"},
["CI"] = {alpha3="CIV",numeric="384",name="Côte d'Ivoire",altnames={"Ivory Coast"}},
["CK"] = {alpha3="COK",numeric="184",name="Cook Islands"},
["CL"] = {alpha3="CHL",numeric="152",name="Chile"},
["CM"] = {alpha3="CMR",numeric="120",name="Cameroon"},
["CN"] = {alpha3="CHN",numeric="156",name="China",altnames={"People's Republic of China","PRC"}},
["CO"] = {alpha3="COL",numeric="170",name="Colombia"},
["CR"] = {alpha3="CRI",numeric="188",name="Costa Rica"},
["CU"] = {alpha3="CUB",numeric="192",name="Cuba"},
["CV"] = {alpha3="CPV",numeric="132",name="Cabo Verde",altnames={"Cape Verde"}},
["CW"] = {alpha3="CUW",numeric="531",name="Curaçao",altnames={"Curacao"}},
["CX"] = {alpha3="CXR",numeric="162",name="Christmas Island"},
["CY"] = {alpha3="CYP",numeric="196",name="Cyprus"},
["CZ"] = {alpha3="CZE",numeric="203",name="Czech Republic",isoname="Czechia"},
["DE"] = {alpha3="DEU",numeric="276",name="Germany"},
["DJ"] = {alpha3="DJI",numeric="262",name="Djibouti"},
["DK"] = {alpha3="DNK",numeric="208",name="Denmark"},
["DM"] = {alpha3="DMA",numeric="212",name="Dominica"},
["DO"] = {alpha3="DOM",numeric="214",name="Dominican Republic"},
["DZ"] = {alpha3="DZA",numeric="012",name="Algeria"},
["EC"] = {alpha3="ECU",numeric="218",name="Ecuador"},
["EE"] = {alpha3="EST",numeric="233",name="Estonia"},
["EG"] = {alpha3="EGY",numeric="818",name="Egypt"},
["EH"] = {alpha3="ESH",numeric="732",name="Western Sahara"},
["ER"] = {alpha3="ERI",numeric="232",name="Eritrea"},
["ES"] = {alpha3="ESP",numeric="724",name="Spain"},
["ET"] = {alpha3="ETH",numeric="231",name="Ethiopia"},
["FI"] = {alpha3="FIN",numeric="246",name="Finland"},
["FJ"] = {alpha3="FJI",numeric="242",name="Fiji"},
["FK"] = {alpha3="FLK",numeric="238",name="Falkland Islands",isoname="Falkland Islands (Malvinas)",altnames={"Falklands","Islas Malvinas","Malvinas","Malvinas Islands"}},
["FM"] = {alpha3="FSM",numeric="583",name="Federated States of Micronesia",isoname="Micronesia, Federated States of",altnames={"Micronesia"}},
["FO"] = {alpha3="FRO",numeric="234",name="Faroe Islands",altnames={"Faroer","Faeroer"}},
["FR"] = {alpha3="FRA",numeric="250",name="France"},
["GA"] = {alpha3="GAB",numeric="266",name="Gabon"},
["GB"] = {alpha3="GBR",numeric="826",name="United Kingdom",isoname="United Kingdom of Great Britain and Northern Ireland",altnames={"UK","Great Britain"}},
["GB-ENG"] = {alpha3="ENG",numeric="000",name="England"}, --Considered to be a country
["GB-NIR"] = {alpha3="NIR",numeric="000",name="Northern Ireland"}, --Considered to be a country
["GB-SCT"] = {alpha3="SCT",numeric="000",name="Scotland"}, --Considered to be a country
["GB-WLS"] = {alpha3="WLS",numeric="000",name="Wales"}, --Considered to be a country
["GB-EAW"] = {alpha3="EAW",numeric="000",name="England and Wales"}, --Considered to be a country
["GD"] = {alpha3="GRD",numeric="308",name="Grenada"},
["GE"] = {alpha3="GEO",numeric="268",name="Georgia"},
["GF"] = {alpha3="GUF",numeric="254",name="French Guiana"},
["GG"] = {alpha3="GGY",numeric="831",name="Guernsey"},
["GH"] = {alpha3="GHA",numeric="288",name="Ghana"},
["GI"] = {alpha3="GIB",numeric="292",name="Gibraltar"},
["GL"] = {alpha3="GRL",numeric="304",name="Greenland"},
["GM"] = {alpha3="GMB",numeric="270",name="Gambia"},
["GN"] = {alpha3="GIN",numeric="324",name="Guinea"},
["GP"] = {alpha3="GLP",numeric="312",name="Guadeloupe"},
["GQ"] = {alpha3="GNQ",numeric="226",name="Equatorial Guinea"},
["GR"] = {alpha3="GRC",numeric="300",name="Greece"},
["GS"] = {alpha3="SGS",numeric="239",name="South Georgia and the South Sandwich Islands"},
["GT"] = {alpha3="GTM",numeric="320",name="Guatemala"},
["GU"] = {alpha3="GUM",numeric="316",name="Guam"},
["GW"] = {alpha3="GNB",numeric="624",name="Guinea-Bissau",altnames={"Guinea–Bissau"}},
["GY"] = {alpha3="GUY",numeric="328",name="Guyana"},
["HK"] = {alpha3="HKG",numeric="344",name="Hong Kong",altnames={"Hong Kong SAR","HKSAR"}},
["HM"] = {alpha3="HMD",numeric="334",name="Heard Island and McDonald Islands",altnames={"Heard and McDonald Islands"}},
["HN"] = {alpha3="HND",numeric="340",name="Honduras"},
["HR"] = {alpha3="HRV",numeric="191",name="Croatia"},
["HT"] = {alpha3="HTI",numeric="332",name="Haiti"},
["HU"] = {alpha3="HUN",numeric="348",name="Hungary"},
["ID"] = {alpha3="IDN",numeric="360",name="Indonesia"},
["IE"] = {alpha3="IRL",numeric="372",name="Ireland",altnames={"Republic of Ireland"}},
["IL"] = {alpha3="ISR",numeric="376",name="Israel"},
["IM"] = {alpha3="IMN",numeric="833",name="Isle of Man"},
["IN"] = {alpha3="IND",numeric="356",name="India"},
["IO"] = {alpha3="IOT",numeric="086",name="British Indian Ocean Territory"},
["IQ"] = {alpha3="IRQ",numeric="368",name="Iraq"},
["IR"] = {alpha3="IRN",numeric="364",name="Iran",isoname="Iran, Islamic Republic of"},
["IS"] = {alpha3="ISL",numeric="352",name="Iceland"},
["IT"] = {alpha3="ITA",numeric="380",name="Italy"},
["JE"] = {alpha3="JEY",numeric="832",name="Jersey"},
["JM"] = {alpha3="JAM",numeric="388",name="Jamaica"},
["JO"] = {alpha3="JOR",numeric="400",name="Jordan"},
["JP"] = {alpha3="JPN",numeric="392",name="Japan"},
["KE"] = {alpha3="KEN",numeric="404",name="Kenya"},
["KG"] = {alpha3="KGZ",numeric="417",name="Kyrgyzstan"},
["KH"] = {alpha3="KHM",numeric="116",name="Cambodia"},
["KI"] = {alpha3="KIR",numeric="296",name="Kiribati"},
["KM"] = {alpha3="COM",numeric="174",name="Comoros"},
["KN"] = {alpha3="KNA",numeric="659",name="Saint Kitts and Nevis",altnames={"St Kitts and Nevis", "Saint Christopher and Nevis", "St Christopher and Nevis"}},
["KP"] = {alpha3="PRK",numeric="408",name="North Korea",isoname="Korea, Democratic People's Republic of",altnames={"Democratic People's Republic of Korea"}},
["KR"] = {alpha3="KOR",numeric="410",name="South Korea",isoname="Korea, Republic of",altnames={"Republic of Korea"}},
["KW"] = {alpha3="KWT",numeric="414",name="Kuwait"},
["KY"] = {alpha3="CYM",numeric="136",name="Cayman Islands"},
["KZ"] = {alpha3="KAZ",numeric="398",name="Kazakhstan"},
["LA"] = {alpha3="LAO",numeric="418",name="Laos",isoname="Lao People's Democratic Republic"},
["LB"] = {alpha3="LBN",numeric="422",name="Lebanon"},
["LC"] = {alpha3="LCA",numeric="662",name="Saint Lucia",altnames={"St Lucia"}},
["LI"] = {alpha3="LIE",numeric="438",name="Liechtenstein"},
["LK"] = {alpha3="LKA",numeric="144",name="Sri Lanka"},
["LR"] = {alpha3="LBR",numeric="430",name="Liberia"},
["LS"] = {alpha3="LSO",numeric="426",name="Lesotho"},
["LT"] = {alpha3="LTU",numeric="440",name="Lithuania"},
["LU"] = {alpha3="LUX",numeric="442",name="Luxembourg"},
["LV"] = {alpha3="LVA",numeric="428",name="Latvia"},
["LY"] = {alpha3="LBY",numeric="434",name="Libya"},
["MA"] = {alpha3="MAR",numeric="504",name="Morocco"},
["MC"] = {alpha3="MCO",numeric="492",name="Monaco"},
["MD"] = {alpha3="MDA",numeric="498",name="Moldova",isoname="Moldova, Republic of"},
["ME"] = {alpha3="MNE",numeric="499",name="Montenegro"},
["MF"] = {alpha3="MAF",numeric="663",name="Saint-Martin",isoname="Saint Martin (French part)",altnames={"Saint–Martin", "St Martin","St Martin (French part)","Collectivity of Saint Martin","Collectivity of St Martin"}},
["MG"] = {alpha3="MDG",numeric="450",name="Madagascar"},
["MH"] = {alpha3="MHL",numeric="584",name="Marshall Islands"},
["MK"] = {alpha3="MKD",numeric="807",name="North Macedonia",altnames={"Republic of North Macedonia","Macedonia","Republic of Macedonia","Macedonia, the former Yugoslav Republic of"}},
["ML"] = {alpha3="MLI",numeric="466",name="Mali"},
["MM"] = {alpha3="MMR",numeric="104",name="Myanmar",altnames={"Burma"}},
["MN"] = {alpha3="MNG",numeric="496",name="Mongolia"},
["MO"] = {alpha3="MAC",numeric="446",name="Macau",isoname="Macao",altnames={"Macau SAR","Macao SAR"}},
["MP"] = {alpha3="MNP",numeric="580",name="Northern Mariana Islands"},
["MQ"] = {alpha3="MTQ",numeric="474",name="Martinique"},
["MR"] = {alpha3="MRT",numeric="478",name="Mauritania"},
["MS"] = {alpha3="MSR",numeric="500",name="Montserrat"},
["MT"] = {alpha3="MLT",numeric="470",name="Malta"},
["MU"] = {alpha3="MUS",numeric="480",name="Mauritius"},
["MV"] = {alpha3="MDV",numeric="462",name="Maldives"},
["MW"] = {alpha3="MWI",numeric="454",name="Malawi"},
["MX"] = {alpha3="MEX",numeric="484",name="Mexico"},
["MY"] = {alpha3="MYS",numeric="458",name="Malaysia"},
["MZ"] = {alpha3="MOZ",numeric="508",name="Mozambique"},
["NA"] = {alpha3="NAM",numeric="516",name="Namibia"},
["NC"] = {alpha3="NCL",numeric="540",name="New Caledonia"},
["NE"] = {alpha3="NER",numeric="562",name="Niger"},
["NF"] = {alpha3="NFK",numeric="574",name="Norfolk Island"},
["NG"] = {alpha3="NGA",numeric="566",name="Nigeria"},
["NI"] = {alpha3="NIC",numeric="558",name="Nicaragua"},
["NL"] = {alpha3="NLD",numeric="528",name="Netherlands"},
["NO"] = {alpha3="NOR",numeric="578",name="Norway"},
["NP"] = {alpha3="NPL",numeric="524",name="Nepal"},
["NR"] = {alpha3="NRU",numeric="520",name="Nauru"},
["NU"] = {alpha3="NIU",numeric="570",name="Niue"},
["NZ"] = {alpha3="NZL",numeric="554",name="New Zealand",altnames={"Aotearoa"}},
["OM"] = {alpha3="OMN",numeric="512",name="Oman"},
["PA"] = {alpha3="PAN",numeric="591",name="Panama"},
["PE"] = {alpha3="PER",numeric="604",name="Peru"},
["PF"] = {alpha3="PYF",numeric="258",name="French Polynesia"},
["PG"] = {alpha3="PNG",numeric="598",name="Papua New Guinea"},
["PH"] = {alpha3="PHL",numeric="608",name="Philippines"},
["PK"] = {alpha3="PAK",numeric="586",name="Pakistan"},
["PL"] = {alpha3="POL",numeric="616",name="Poland"},
["PM"] = {alpha3="SPM",numeric="666",name="Saint Pierre and Miquelon",altnames={"St Pierre and Miquelon"}},
["PN"] = {alpha3="PCN",numeric="612",name="Pitcairn"},
["PR"] = {alpha3="PRI",numeric="630",name="Puerto Rico"},
["PS"] = {alpha3="PSE",numeric="275",name="Palestine",isoname="Palestine, State of",altnames={"State of Palestine"}},
["PT"] = {alpha3="PRT",numeric="620",name="Portugal"},
["PW"] = {alpha3="PLW",numeric="585",name="Palau"},
["PY"] = {alpha3="PRY",numeric="600",name="Paraguay"},
["QA"] = {alpha3="QAT",numeric="634",name="Qatar"},
["RE"] = {alpha3="REU",numeric="638",name="Réunion"},
["RO"] = {alpha3="ROU",numeric="642",name="Romania"},
["RS"] = {alpha3="SRB",numeric="688",name="Serbia"},
["RU"] = {alpha3="RUS",numeric="643",name="Russia",isoname="Russian Federation"},
["RW"] = {alpha3="RWA",numeric="646",name="Rwanda"},
["SA"] = {alpha3="SAU",numeric="682",name="Saudi Arabia"},
["SB"] = {alpha3="SLB",numeric="090",name="Solomon Islands"},
["SC"] = {alpha3="SYC",numeric="690",name="Seychelles"},
["SD"] = {alpha3="SDN",numeric="729",name="Sudan"},
["SE"] = {alpha3="SWE",numeric="752",name="Sweden"},
["SG"] = {alpha3="SGP",numeric="702",name="Singapore"},
["SH"] = {alpha3="SHN",numeric="654",name="Saint Helena, Ascension and Tristan da Cunha",altnames={"St Helena Ascension and Tristan da Cunha", "Saint Helena and Dependencies", "St Helena and Dependencies"}},
["SI"] = {alpha3="SVN",numeric="705",name="Slovenia"},
["SJ"] = {alpha3="SJM",numeric="744",name="Svalbard and Jan Mayen"},
["SK"] = {alpha3="SVK",numeric="703",name="Slovakia"},
["SL"] = {alpha3="SLE",numeric="694",name="Sierra Leone"},
["SM"] = {alpha3="SMR",numeric="674",name="San Marino"},
["SN"] = {alpha3="SEN",numeric="686",name="Senegal"},
["SO"] = {alpha3="SOM",numeric="706",name="Somalia"},
["SR"] = {alpha3="SUR",numeric="740",name="Suriname"},
["SS"] = {alpha3="SSD",numeric="728",name="South Sudan"},
["ST"] = {alpha3="STP",numeric="678",name="São Tomé and Príncipe",isoname="Sao Tome and Principe",altnames={"Democratic Republic of Sao Tome and Principe"}},
["SV"] = {alpha3="SLV",numeric="222",name="El Salvador"},
["SX"] = {alpha3="SXM",numeric="534",name="Sint Maarten",isoname="Sint Maarten (Dutch part)",altnames={"St Maarten","Saint Martin (Dutch part)","St Martin (Dutch part)"}},
["SY"] = {alpha3="SYR",numeric="760",name="Syria",isoname="Syrian Arab Republic"},
["SZ"] = {alpha3="SWZ",numeric="748",name="Eswatini",altnames={"Swaziland"}},
["TC"] = {alpha3="TCA",numeric="796",name="Turks and Caicos Islands",altnames={"Turks and Caicos"}},
["TD"] = {alpha3="TCD",numeric="148",name="Chad"},
["TF"] = {alpha3="ATF",numeric="260",name="French Southern and Antarctic Lands",isoname="French Southern Territories"},
["TG"] = {alpha3="TGO",numeric="768",name="Togo"},
["TH"] = {alpha3="THA",numeric="764",name="Thailand"},
["TJ"] = {alpha3="TJK",numeric="762",name="Tajikistan"},
["TK"] = {alpha3="TKL",numeric="772",name="Tokelau"},
["TL"] = {alpha3="TLS",numeric="626",name="Timor-Leste",altnames={"East Timor", "Timor–Leste"}},
["TM"] = {alpha3="TKM",numeric="795",name="Turkmenistan"},
["TN"] = {alpha3="TUN",numeric="788",name="Tunisia"},
["TO"] = {alpha3="TON",numeric="776",name="Tonga"},
["TR"] = {alpha3="TUR",numeric="792",name="Turkey",isoname="Türkiye"},
["TT"] = {alpha3="TTO",numeric="780",name="Trinidad and Tobago"},
["TV"] = {alpha3="TUV",numeric="798",name="Tuvalu"},
["TW"] = {alpha3="TWN",numeric="158",name="Taiwan",isoname="Taiwan, Province of China",altnames={"Republic of China"}},
["TZ"] = {alpha3="TZA",numeric="834",name="Tanzania",isoname="Tanzania, United Republic of"},
["UA"] = {alpha3="UKR",numeric="804",name="Ukraine"},
["UG"] = {alpha3="UGA",numeric="800",name="Uganda"},
["UM"] = {alpha3="UMI",numeric="581",name="United States Minor Outlying Islands"},
["US"] = {alpha3="USA",numeric="840",name="United States",isoname="United States of America",altnames={"US","USA","U.S."}},
["UY"] = {alpha3="URY",numeric="858",name="Uruguay"},
["UZ"] = {alpha3="UZB",numeric="860",name="Uzbekistan"},
["VA"] = {alpha3="VAT",numeric="336",name="Vatican City",isoname="Holy See",altnames={"Holy See (Vatican City State)","Vatican City State"}},
["VC"] = {alpha3="VCT",numeric="670",name="Saint Vincent and the Grenadines",altnames={"St Vincent and the Grenadines"}},
["VE"] = {alpha3="VEN",numeric="862",name="Venezuela",isoname="Venezuela, Bolivarian Republic of"},
["VG"] = {alpha3="VGB",numeric="092",name="British Virgin Islands",isoname="Virgin Islands (British)",altnames={"UK Virgin Islands","BVI"}},
["VI"] = {alpha3="VIR",numeric="850",name="United States Virgin Islands",isoname="Virgin Islands (U.S.)",altnames={"US Virgin Islands","USVI"}},
["VN"] = {alpha3="VNM",numeric="704",name="Vietnam",isoname="Viet Nam"},
["VU"] = {alpha3="VUT",numeric="548",name="Vanuatu"},
["WF"] = {alpha3="WLF",numeric="876",name="Wallis and Futuna"},
["WS"] = {alpha3="WSM",numeric="882",name="Samoa"},
["XK"] = {alpha3="XKX",numeric="926",name="Kosovo",isoname="Republic of Kosovo",altnames={"XXK", "UNK"}},
["YE"] = {alpha3="YEM",numeric="887",name="Yemen"},
["YT"] = {alpha3="MYT",numeric="175",name="Mayotte"},
["ZA"] = {alpha3="ZAF",numeric="710",name="South Africa"},
["ZM"] = {alpha3="ZMB",numeric="894",name="Zambia"},
["ZW"] = {alpha3="ZWE",numeric="716",name="Zimbabwe"}
}
czr7druifnxnnkuvdmu7x2jir682ona
21848
21847
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Module:ISO_3166/data/National]]: Importing from the English wikipedia
21847
Scribunto
text/plain
return {
["AD"] = {alpha3="AND",numeric="020",name="Andorra"},
["AE"] = {alpha3="ARE",numeric="784",name="United Arab Emirates",altnames={"UAE"}},
["AF"] = {alpha3="AFG",numeric="004",name="Afghanistan"},
["AG"] = {alpha3="ATG",numeric="028",name="Antigua and Barbuda"},
["AI"] = {alpha3="AIA",numeric="660",name="Anguilla"},
["AL"] = {alpha3="ALB",numeric="008",name="Albania"},
["AM"] = {alpha3="ARM",numeric="051",name="Armenia"},
["AO"] = {alpha3="AGO",numeric="024",name="Angola"},
["AQ"] = {alpha3="ATA",numeric="010",name="Antarctica"},
["AR"] = {alpha3="ARG",numeric="032",name="Argentina"},
["AS"] = {alpha3="ASM",numeric="016",name="American Samoa"},
["AT"] = {alpha3="AUT",numeric="040",name="Austria"},
["AU"] = {alpha3="AUS",numeric="036",name="Australia"},
["AW"] = {alpha3="ABW",numeric="533",name="Aruba"},
["AX"] = {alpha3="ALA",numeric="248",name="Åland Islands",altnames={"Aland Islands","Åland","Aland"}},
["AZ"] = {alpha3="AZE",numeric="031",name="Azerbaijan"},
["BA"] = {alpha3="BIH",numeric="070",name="Bosnia and Herzegovina",altnames={"Bosnia"}},
["BB"] = {alpha3="BRB",numeric="052",name="Barbados"},
["BD"] = {alpha3="BGD",numeric="050",name="Bangladesh"},
["BE"] = {alpha3="BEL",numeric="056",name="Belgium"},
["BF"] = {alpha3="BFA",numeric="854",name="Burkina Faso"},
["BG"] = {alpha3="BGR",numeric="100",name="Bulgaria"},
["BH"] = {alpha3="BHR",numeric="048",name="Bahrain"},
["BI"] = {alpha3="BDI",numeric="108",name="Burundi"},
["BJ"] = {alpha3="BEN",numeric="204",name="Benin"},
["BL"] = {alpha3="BLM",numeric="652",name="Saint Barthélemy",altnames={"St Barthelemy", "St Barts", "St. Barths", "St Barth"}},
["BM"] = {alpha3="BMU",numeric="060",name="Bermuda"},
["BN"] = {alpha3="BRN",numeric="096",name="Brunei",isoname="Brunei Darussalam"},
["BO"] = {alpha3="BOL",numeric="068",name="Bolivia",isoname="Bolivia, Plurinational State of"},
["BQ"] = {alpha3="BES",numeric="535",name="Caribbean Netherlands",isoname="Bonaire, Sint Eustatius and Saba"},
["BR"] = {alpha3="BRA",numeric="076",name="Brazil"},
["BS"] = {alpha3="BHS",numeric="044",name="Bahamas"},
["BT"] = {alpha3="BTN",numeric="064",name="Bhutan"},
["BV"] = {alpha3="BVT",numeric="074",name="Bouvet Island"},
["BW"] = {alpha3="BWA",numeric="072",name="Botswana"},
["BY"] = {alpha3="BLR",numeric="112",name="Belarus"},
["BZ"] = {alpha3="BLZ",numeric="084",name="Belize"},
["CA"] = {alpha3="CAN",numeric="124",name="Canada"},
["CC"] = {alpha3="CCK",numeric="166",name="Cocos (Keeling) Islands",altnames={"Cocos Islands","Keeling Islands"}},
["CD"] = {alpha3="COD",numeric="180",name="Democratic Republic of the Congo",isoname="Congo, Democratic Republic of the",altnames={"Congo-Kinshasa","Congo–Kinshasa","DRC","DR Congo"}},
["CF"] = {alpha3="CAF",numeric="140",name="Central African Republic",altnames={"CAR"}},
["CG"] = {alpha3="COG",numeric="178",name="Republic of the Congo",isoname="Congo",altnames={"Congo-Brazzaville", "Congo–Brazzaville"}},
["CH"] = {alpha3="CHE",numeric="756",name="Switzerland"},
["CI"] = {alpha3="CIV",numeric="384",name="Côte d'Ivoire",altnames={"Ivory Coast"}},
["CK"] = {alpha3="COK",numeric="184",name="Cook Islands"},
["CL"] = {alpha3="CHL",numeric="152",name="Chile"},
["CM"] = {alpha3="CMR",numeric="120",name="Cameroon"},
["CN"] = {alpha3="CHN",numeric="156",name="China",altnames={"People's Republic of China","PRC"}},
["CO"] = {alpha3="COL",numeric="170",name="Colombia"},
["CR"] = {alpha3="CRI",numeric="188",name="Costa Rica"},
["CU"] = {alpha3="CUB",numeric="192",name="Cuba"},
["CV"] = {alpha3="CPV",numeric="132",name="Cabo Verde",altnames={"Cape Verde"}},
["CW"] = {alpha3="CUW",numeric="531",name="Curaçao",altnames={"Curacao"}},
["CX"] = {alpha3="CXR",numeric="162",name="Christmas Island"},
["CY"] = {alpha3="CYP",numeric="196",name="Cyprus"},
["CZ"] = {alpha3="CZE",numeric="203",name="Czech Republic",isoname="Czechia"},
["DE"] = {alpha3="DEU",numeric="276",name="Germany"},
["DJ"] = {alpha3="DJI",numeric="262",name="Djibouti"},
["DK"] = {alpha3="DNK",numeric="208",name="Denmark"},
["DM"] = {alpha3="DMA",numeric="212",name="Dominica"},
["DO"] = {alpha3="DOM",numeric="214",name="Dominican Republic"},
["DZ"] = {alpha3="DZA",numeric="012",name="Algeria"},
["EC"] = {alpha3="ECU",numeric="218",name="Ecuador"},
["EE"] = {alpha3="EST",numeric="233",name="Estonia"},
["EG"] = {alpha3="EGY",numeric="818",name="Egypt"},
["EH"] = {alpha3="ESH",numeric="732",name="Western Sahara"},
["ER"] = {alpha3="ERI",numeric="232",name="Eritrea"},
["ES"] = {alpha3="ESP",numeric="724",name="Spain"},
["ET"] = {alpha3="ETH",numeric="231",name="Ethiopia"},
["FI"] = {alpha3="FIN",numeric="246",name="Finland"},
["FJ"] = {alpha3="FJI",numeric="242",name="Fiji"},
["FK"] = {alpha3="FLK",numeric="238",name="Falkland Islands",isoname="Falkland Islands (Malvinas)",altnames={"Falklands","Islas Malvinas","Malvinas","Malvinas Islands"}},
["FM"] = {alpha3="FSM",numeric="583",name="Federated States of Micronesia",isoname="Micronesia, Federated States of",altnames={"Micronesia"}},
["FO"] = {alpha3="FRO",numeric="234",name="Faroe Islands",altnames={"Faroer","Faeroer"}},
["FR"] = {alpha3="FRA",numeric="250",name="France"},
["GA"] = {alpha3="GAB",numeric="266",name="Gabon"},
["GB"] = {alpha3="GBR",numeric="826",name="United Kingdom",isoname="United Kingdom of Great Britain and Northern Ireland",altnames={"UK","Great Britain"}},
["GB-ENG"] = {alpha3="ENG",numeric="000",name="England"}, --Considered to be a country
["GB-NIR"] = {alpha3="NIR",numeric="000",name="Northern Ireland"}, --Considered to be a country
["GB-SCT"] = {alpha3="SCT",numeric="000",name="Scotland"}, --Considered to be a country
["GB-WLS"] = {alpha3="WLS",numeric="000",name="Wales"}, --Considered to be a country
["GB-EAW"] = {alpha3="EAW",numeric="000",name="England and Wales"}, --Considered to be a country
["GD"] = {alpha3="GRD",numeric="308",name="Grenada"},
["GE"] = {alpha3="GEO",numeric="268",name="Georgia"},
["GF"] = {alpha3="GUF",numeric="254",name="French Guiana"},
["GG"] = {alpha3="GGY",numeric="831",name="Guernsey"},
["GH"] = {alpha3="GHA",numeric="288",name="Ghana"},
["GI"] = {alpha3="GIB",numeric="292",name="Gibraltar"},
["GL"] = {alpha3="GRL",numeric="304",name="Greenland"},
["GM"] = {alpha3="GMB",numeric="270",name="Gambia"},
["GN"] = {alpha3="GIN",numeric="324",name="Guinea"},
["GP"] = {alpha3="GLP",numeric="312",name="Guadeloupe"},
["GQ"] = {alpha3="GNQ",numeric="226",name="Equatorial Guinea"},
["GR"] = {alpha3="GRC",numeric="300",name="Greece"},
["GS"] = {alpha3="SGS",numeric="239",name="South Georgia and the South Sandwich Islands"},
["GT"] = {alpha3="GTM",numeric="320",name="Guatemala"},
["GU"] = {alpha3="GUM",numeric="316",name="Guam"},
["GW"] = {alpha3="GNB",numeric="624",name="Guinea-Bissau",altnames={"Guinea–Bissau"}},
["GY"] = {alpha3="GUY",numeric="328",name="Guyana"},
["HK"] = {alpha3="HKG",numeric="344",name="Hong Kong",altnames={"Hong Kong SAR","HKSAR"}},
["HM"] = {alpha3="HMD",numeric="334",name="Heard Island and McDonald Islands",altnames={"Heard and McDonald Islands"}},
["HN"] = {alpha3="HND",numeric="340",name="Honduras"},
["HR"] = {alpha3="HRV",numeric="191",name="Croatia"},
["HT"] = {alpha3="HTI",numeric="332",name="Haiti"},
["HU"] = {alpha3="HUN",numeric="348",name="Hungary"},
["ID"] = {alpha3="IDN",numeric="360",name="Indonesia"},
["IE"] = {alpha3="IRL",numeric="372",name="Ireland",altnames={"Republic of Ireland"}},
["IL"] = {alpha3="ISR",numeric="376",name="Israel"},
["IM"] = {alpha3="IMN",numeric="833",name="Isle of Man"},
["IN"] = {alpha3="IND",numeric="356",name="India"},
["IO"] = {alpha3="IOT",numeric="086",name="British Indian Ocean Territory"},
["IQ"] = {alpha3="IRQ",numeric="368",name="Iraq"},
["IR"] = {alpha3="IRN",numeric="364",name="Iran",isoname="Iran, Islamic Republic of"},
["IS"] = {alpha3="ISL",numeric="352",name="Iceland"},
["IT"] = {alpha3="ITA",numeric="380",name="Italy"},
["JE"] = {alpha3="JEY",numeric="832",name="Jersey"},
["JM"] = {alpha3="JAM",numeric="388",name="Jamaica"},
["JO"] = {alpha3="JOR",numeric="400",name="Jordan"},
["JP"] = {alpha3="JPN",numeric="392",name="Japan"},
["KE"] = {alpha3="KEN",numeric="404",name="Kenya"},
["KG"] = {alpha3="KGZ",numeric="417",name="Kyrgyzstan"},
["KH"] = {alpha3="KHM",numeric="116",name="Cambodia"},
["KI"] = {alpha3="KIR",numeric="296",name="Kiribati"},
["KM"] = {alpha3="COM",numeric="174",name="Comoros"},
["KN"] = {alpha3="KNA",numeric="659",name="Saint Kitts and Nevis",altnames={"St Kitts and Nevis", "Saint Christopher and Nevis", "St Christopher and Nevis"}},
["KP"] = {alpha3="PRK",numeric="408",name="North Korea",isoname="Korea, Democratic People's Republic of",altnames={"Democratic People's Republic of Korea"}},
["KR"] = {alpha3="KOR",numeric="410",name="South Korea",isoname="Korea, Republic of",altnames={"Republic of Korea"}},
["KW"] = {alpha3="KWT",numeric="414",name="Kuwait"},
["KY"] = {alpha3="CYM",numeric="136",name="Cayman Islands"},
["KZ"] = {alpha3="KAZ",numeric="398",name="Kazakhstan"},
["LA"] = {alpha3="LAO",numeric="418",name="Laos",isoname="Lao People's Democratic Republic"},
["LB"] = {alpha3="LBN",numeric="422",name="Lebanon"},
["LC"] = {alpha3="LCA",numeric="662",name="Saint Lucia",altnames={"St Lucia"}},
["LI"] = {alpha3="LIE",numeric="438",name="Liechtenstein"},
["LK"] = {alpha3="LKA",numeric="144",name="Sri Lanka"},
["LR"] = {alpha3="LBR",numeric="430",name="Liberia"},
["LS"] = {alpha3="LSO",numeric="426",name="Lesotho"},
["LT"] = {alpha3="LTU",numeric="440",name="Lithuania"},
["LU"] = {alpha3="LUX",numeric="442",name="Luxembourg"},
["LV"] = {alpha3="LVA",numeric="428",name="Latvia"},
["LY"] = {alpha3="LBY",numeric="434",name="Libya"},
["MA"] = {alpha3="MAR",numeric="504",name="Morocco"},
["MC"] = {alpha3="MCO",numeric="492",name="Monaco"},
["MD"] = {alpha3="MDA",numeric="498",name="Moldova",isoname="Moldova, Republic of"},
["ME"] = {alpha3="MNE",numeric="499",name="Montenegro"},
["MF"] = {alpha3="MAF",numeric="663",name="Saint-Martin",isoname="Saint Martin (French part)",altnames={"Saint–Martin", "St Martin","St Martin (French part)","Collectivity of Saint Martin","Collectivity of St Martin"}},
["MG"] = {alpha3="MDG",numeric="450",name="Madagascar"},
["MH"] = {alpha3="MHL",numeric="584",name="Marshall Islands"},
["MK"] = {alpha3="MKD",numeric="807",name="North Macedonia",altnames={"Republic of North Macedonia","Macedonia","Republic of Macedonia","Macedonia, the former Yugoslav Republic of"}},
["ML"] = {alpha3="MLI",numeric="466",name="Mali"},
["MM"] = {alpha3="MMR",numeric="104",name="Myanmar",altnames={"Burma"}},
["MN"] = {alpha3="MNG",numeric="496",name="Mongolia"},
["MO"] = {alpha3="MAC",numeric="446",name="Macau",isoname="Macao",altnames={"Macau SAR","Macao SAR"}},
["MP"] = {alpha3="MNP",numeric="580",name="Northern Mariana Islands"},
["MQ"] = {alpha3="MTQ",numeric="474",name="Martinique"},
["MR"] = {alpha3="MRT",numeric="478",name="Mauritania"},
["MS"] = {alpha3="MSR",numeric="500",name="Montserrat"},
["MT"] = {alpha3="MLT",numeric="470",name="Malta"},
["MU"] = {alpha3="MUS",numeric="480",name="Mauritius"},
["MV"] = {alpha3="MDV",numeric="462",name="Maldives"},
["MW"] = {alpha3="MWI",numeric="454",name="Malawi"},
["MX"] = {alpha3="MEX",numeric="484",name="Mexico"},
["MY"] = {alpha3="MYS",numeric="458",name="Malaysia"},
["MZ"] = {alpha3="MOZ",numeric="508",name="Mozambique"},
["NA"] = {alpha3="NAM",numeric="516",name="Namibia"},
["NC"] = {alpha3="NCL",numeric="540",name="New Caledonia"},
["NE"] = {alpha3="NER",numeric="562",name="Niger"},
["NF"] = {alpha3="NFK",numeric="574",name="Norfolk Island"},
["NG"] = {alpha3="NGA",numeric="566",name="Nigeria"},
["NI"] = {alpha3="NIC",numeric="558",name="Nicaragua"},
["NL"] = {alpha3="NLD",numeric="528",name="Netherlands"},
["NO"] = {alpha3="NOR",numeric="578",name="Norway"},
["NP"] = {alpha3="NPL",numeric="524",name="Nepal"},
["NR"] = {alpha3="NRU",numeric="520",name="Nauru"},
["NU"] = {alpha3="NIU",numeric="570",name="Niue"},
["NZ"] = {alpha3="NZL",numeric="554",name="New Zealand",altnames={"Aotearoa"}},
["OM"] = {alpha3="OMN",numeric="512",name="Oman"},
["PA"] = {alpha3="PAN",numeric="591",name="Panama"},
["PE"] = {alpha3="PER",numeric="604",name="Peru"},
["PF"] = {alpha3="PYF",numeric="258",name="French Polynesia"},
["PG"] = {alpha3="PNG",numeric="598",name="Papua New Guinea"},
["PH"] = {alpha3="PHL",numeric="608",name="Philippines"},
["PK"] = {alpha3="PAK",numeric="586",name="Pakistan"},
["PL"] = {alpha3="POL",numeric="616",name="Poland"},
["PM"] = {alpha3="SPM",numeric="666",name="Saint Pierre and Miquelon",altnames={"St Pierre and Miquelon"}},
["PN"] = {alpha3="PCN",numeric="612",name="Pitcairn"},
["PR"] = {alpha3="PRI",numeric="630",name="Puerto Rico"},
["PS"] = {alpha3="PSE",numeric="275",name="Palestine",isoname="Palestine, State of",altnames={"State of Palestine"}},
["PT"] = {alpha3="PRT",numeric="620",name="Portugal"},
["PW"] = {alpha3="PLW",numeric="585",name="Palau"},
["PY"] = {alpha3="PRY",numeric="600",name="Paraguay"},
["QA"] = {alpha3="QAT",numeric="634",name="Qatar"},
["RE"] = {alpha3="REU",numeric="638",name="Réunion"},
["RO"] = {alpha3="ROU",numeric="642",name="Romania"},
["RS"] = {alpha3="SRB",numeric="688",name="Serbia"},
["RU"] = {alpha3="RUS",numeric="643",name="Russia",isoname="Russian Federation"},
["RW"] = {alpha3="RWA",numeric="646",name="Rwanda"},
["SA"] = {alpha3="SAU",numeric="682",name="Saudi Arabia"},
["SB"] = {alpha3="SLB",numeric="090",name="Solomon Islands"},
["SC"] = {alpha3="SYC",numeric="690",name="Seychelles"},
["SD"] = {alpha3="SDN",numeric="729",name="Sudan"},
["SE"] = {alpha3="SWE",numeric="752",name="Sweden"},
["SG"] = {alpha3="SGP",numeric="702",name="Singapore"},
["SH"] = {alpha3="SHN",numeric="654",name="Saint Helena, Ascension and Tristan da Cunha",altnames={"St Helena Ascension and Tristan da Cunha", "Saint Helena and Dependencies", "St Helena and Dependencies"}},
["SI"] = {alpha3="SVN",numeric="705",name="Slovenia"},
["SJ"] = {alpha3="SJM",numeric="744",name="Svalbard and Jan Mayen"},
["SK"] = {alpha3="SVK",numeric="703",name="Slovakia"},
["SL"] = {alpha3="SLE",numeric="694",name="Sierra Leone"},
["SM"] = {alpha3="SMR",numeric="674",name="San Marino"},
["SN"] = {alpha3="SEN",numeric="686",name="Senegal"},
["SO"] = {alpha3="SOM",numeric="706",name="Somalia"},
["SR"] = {alpha3="SUR",numeric="740",name="Suriname"},
["SS"] = {alpha3="SSD",numeric="728",name="South Sudan"},
["ST"] = {alpha3="STP",numeric="678",name="São Tomé and Príncipe",isoname="Sao Tome and Principe",altnames={"Democratic Republic of Sao Tome and Principe"}},
["SV"] = {alpha3="SLV",numeric="222",name="El Salvador"},
["SX"] = {alpha3="SXM",numeric="534",name="Sint Maarten",isoname="Sint Maarten (Dutch part)",altnames={"St Maarten","Saint Martin (Dutch part)","St Martin (Dutch part)"}},
["SY"] = {alpha3="SYR",numeric="760",name="Syria",isoname="Syrian Arab Republic"},
["SZ"] = {alpha3="SWZ",numeric="748",name="Eswatini",altnames={"Swaziland"}},
["TC"] = {alpha3="TCA",numeric="796",name="Turks and Caicos Islands",altnames={"Turks and Caicos"}},
["TD"] = {alpha3="TCD",numeric="148",name="Chad"},
["TF"] = {alpha3="ATF",numeric="260",name="French Southern and Antarctic Lands",isoname="French Southern Territories"},
["TG"] = {alpha3="TGO",numeric="768",name="Togo"},
["TH"] = {alpha3="THA",numeric="764",name="Thailand"},
["TJ"] = {alpha3="TJK",numeric="762",name="Tajikistan"},
["TK"] = {alpha3="TKL",numeric="772",name="Tokelau"},
["TL"] = {alpha3="TLS",numeric="626",name="Timor-Leste",altnames={"East Timor", "Timor–Leste"}},
["TM"] = {alpha3="TKM",numeric="795",name="Turkmenistan"},
["TN"] = {alpha3="TUN",numeric="788",name="Tunisia"},
["TO"] = {alpha3="TON",numeric="776",name="Tonga"},
["TR"] = {alpha3="TUR",numeric="792",name="Turkey",isoname="Türkiye"},
["TT"] = {alpha3="TTO",numeric="780",name="Trinidad and Tobago"},
["TV"] = {alpha3="TUV",numeric="798",name="Tuvalu"},
["TW"] = {alpha3="TWN",numeric="158",name="Taiwan",isoname="Taiwan, Province of China",altnames={"Republic of China"}},
["TZ"] = {alpha3="TZA",numeric="834",name="Tanzania",isoname="Tanzania, United Republic of"},
["UA"] = {alpha3="UKR",numeric="804",name="Ukraine"},
["UG"] = {alpha3="UGA",numeric="800",name="Uganda"},
["UM"] = {alpha3="UMI",numeric="581",name="United States Minor Outlying Islands"},
["US"] = {alpha3="USA",numeric="840",name="United States",isoname="United States of America",altnames={"US","USA","U.S."}},
["UY"] = {alpha3="URY",numeric="858",name="Uruguay"},
["UZ"] = {alpha3="UZB",numeric="860",name="Uzbekistan"},
["VA"] = {alpha3="VAT",numeric="336",name="Vatican City",isoname="Holy See",altnames={"Holy See (Vatican City State)","Vatican City State"}},
["VC"] = {alpha3="VCT",numeric="670",name="Saint Vincent and the Grenadines",altnames={"St Vincent and the Grenadines"}},
["VE"] = {alpha3="VEN",numeric="862",name="Venezuela",isoname="Venezuela, Bolivarian Republic of"},
["VG"] = {alpha3="VGB",numeric="092",name="British Virgin Islands",isoname="Virgin Islands (British)",altnames={"UK Virgin Islands","BVI"}},
["VI"] = {alpha3="VIR",numeric="850",name="United States Virgin Islands",isoname="Virgin Islands (U.S.)",altnames={"US Virgin Islands","USVI"}},
["VN"] = {alpha3="VNM",numeric="704",name="Vietnam",isoname="Viet Nam"},
["VU"] = {alpha3="VUT",numeric="548",name="Vanuatu"},
["WF"] = {alpha3="WLF",numeric="876",name="Wallis and Futuna"},
["WS"] = {alpha3="WSM",numeric="882",name="Samoa"},
["XK"] = {alpha3="XKX",numeric="926",name="Kosovo",isoname="Republic of Kosovo",altnames={"XXK", "UNK"}},
["YE"] = {alpha3="YEM",numeric="887",name="Yemen"},
["YT"] = {alpha3="MYT",numeric="175",name="Mayotte"},
["ZA"] = {alpha3="ZAF",numeric="710",name="South Africa"},
["ZM"] = {alpha3="ZMB",numeric="894",name="Zambia"},
["ZW"] = {alpha3="ZWE",numeric="716",name="Zimbabwe"}
}
czr7druifnxnnkuvdmu7x2jir682ona
Шаблон:Space
10
3674
21851
2023-02-14T01:26:39Z
Xaosflux
146
shell params
21851
wikitext
text/x-wiki
#REDIRECT [[Template:Spaces]]
{{Rcat shell|
{{R from modification}}
{{R with history}}
{{R from template shortcut}}
}}
d521813tbyim2j2dsy9kxikkaoo0jnt
21852
21851
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Template:Space]]: Importing from the English wikipedia
21851
wikitext
text/x-wiki
#REDIRECT [[Template:Spaces]]
{{Rcat shell|
{{R from modification}}
{{R with history}}
{{R from template shortcut}}
}}
d521813tbyim2j2dsy9kxikkaoo0jnt
Шаблон:Polparty
10
3675
21853
2026-05-06T10:38:28Z
MSGJ
2752
changes to ODS and ANO requested on talk
21853
wikitext
text/x-wiki
{{#switch: {{ucfirst:{{{1}}}}}
| AT | Austria | [[Austria]] = {{#switch: {{uc:{{{2}}}}}
| SPÖ = [[Social Democratic Party of Austria|SPÖ]]
| ÖVP = [[Austrian People's Party|ÖVP]]
| FPÖ = [[Freedom Party of Austria|FPÖ]]
| BZÖ = [[Alliance for the Future of Austria|BZÖ]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Green | Greens | Grün | Grüne = [[The Greens – The Green Alternative|Green]]
| Independent | Ind | Neutral | Parteilos | [[Parteilos]] | [[parteilos]] = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| AU | Australia | [[Australia]] = {{#switch: {{uc:{{{2}}}}}
| ALP = [[Australian Labor Party|ALP]]
| CLP = [[Country Liberal Party|CLP]]
| LP = [[Liberal Party of Australia|Lib.]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Democrats | Dem = [[Australian Democrats|Dem.]]
| Greens | Green = [[Australian Greens|Greens]]
| Labor | Lab = [[Australian Labor Party|ALP]]
| Liberal | Lib = [[Liberal Party of Australia|Lib.]]
| National | Nat = [[National Party of Australia|Nat.]]
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| CA | Canada | [[Canada]] = {{#switch: {{uc:{{{2}}}}}
| BQ = [[Bloc Québécois|BQ]]
| CPC = [[Conservative Party of Canada|CPC]]
| LPC = [[Liberal Party of Canada|LPC]]
| NDP = [[New Democratic Party|NDP]]
| GPC = [[Green Party of Canada|Green]]
| FPNP = [[First Peoples National Party of Canada|FPNP]]
| CHP = [[Christian Heritage Party of Canada|CHP]]
| WBP = [[Western Block Party|WBP]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| CZ | Czechia | [[Czechia]] | [[Czech Republic]] | Czech Republic = {{#switch: {{uc:{{{2}}}}}
| ODS = [[Civic Democratic Party|ODS]]
| CSSD | SOCDEM = [[Social Democracy (Czech Republic)|SOCDEM]]
| KSCM = [[Communist Party of Bohemia and Moravia|KSČM]]
| KDU-CSL = [[Christian and Democratic Union – Czechoslovak People's Party|KDU-ČSL]]
| ANO = [[ANO 2011|ANO]]
| TOP09 = [[TOP 09]]
| STAN = [[Mayors and Independents|STAN]]
| Pirati = [[Czech Pirate Party|Pirates]]
| SPD = [[Freedom and Direct Democracy|SPD]]
| SZ = [[Green Party (Czech Republic)|Greens]]
| US-DEU = [[Freedom Union–Democratic Union|US-DEU]]
| LIRA = [[Liberal Reform Party|LIRA]]
| SNK = [[SNK European Democrats|SNK ED]]
| NEZDEM = [[Independent Democrats (Czech Republic)|Ind. Dem.]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| DE | Germany | [[Germany]] = {{#switch: {{uc:{{{2}}}}}
| CDU = [[Christian Democratic Union of Germany|CDU]]
| CSU = [[Christian Social Union in Bavaria|CSU]]
| SPD = [[Social Democratic Party of Germany|SPD]]
| FDP = [[Free Democratic Party (Germany)|FDP]]
| PDS = [[The Left (Germany)|Left]]
| FW | FWG = [[Free Voters|FW]]
| DDP = [[German Democratic Party|DDP]]
| NS | NSDAP = [[Nazi Party|NSDAP]]
| ODP | ÖDP = [[Ecological Democratic Party|ÖDP]]
| AfD | AFD = [[Alternative for Germany|AfD]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Left | Linke | The Left = [[The Left (Germany)|Left]]
| Green | Greens | Grün | Grüne | Bündnis 90/Die Grünen = [[Alliance 90/The Greens|Greens]]
| Freie Wähler | Freie wähler = [[Free Voters|FW]]
| Centre | Zentrum = [[Centre Party (Germany)|Centre]]
| Volt = [[Volt Germany|Volt]]
| PARTEI = [[die PARTEI|PARTEI]]
| Pirates | Piraten = [[Pirate Party Germany|Pirates]]
| Nazi = [[Nazi Party|NSDAP]]
| Independent | Ind | Neutral | Parteilos | [[Parteilos]] | [[parteilos]] = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| NL | Netherlands | [[Netherlands]] | The Netherlands | [[The Netherlands]] | Holland = {{#switch: {{uc:{{{2}}}}}
| CDA = [[Christian Democratic Appeal|CDA]]
| CU = [[ChristianUnion|CU]]
| D66 = [[Democrats 66|D66]]
| GL = [[GreenLeft|GL]]
| PVV = [[Party for Freedom|PVV]]
| SGP = [[Reformed Political Party|SGP]]
| SP = [[Socialist Party (Netherlands)|SP]]
| VVD = [[People's Party for Freedom and Democracy|VVD]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Green | Groen = [[GreenLeft|GL]]
| PvdA | Pvda = [[Labour Party (Netherlands)|PvdA]]
| Independent | Ind | Neutral | Parteilos | [[Parteilos]] | [[parteilos]] = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| CH | Switzerland | [[Switzerland]] = {{#switch: {{uc:{{{2}}}}}
| FDP | PRD | RAD | FDP/PRD = [[Free Democratic Party of Switzerland|FDP/PRD]]
| PLR = [[Free Democratic Party of Switzerland|FDP/PRD/PLR]]
| PLC = [[Free Democratic Party of Switzerland|FDP/PRD/PLC]]
| SPS | PSS | SP | PS | SP/PS | SPS/PSS | SOC = [[Social Democratic Party of Switzerland|SPS/PSS]]
| SVP | UDC | SVP/UDC = [[Swiss People's Party|SVP/UDC]]
| PPS = [[Swiss People's Party|SVP/UDC/PPS]]
| CVP | PDC | CVP/PDC = [[Christian Democratic People's Party of Switzerland|CVP/PDC]]
| PPD = [[Christian Democratic People's Party of Switzerland|CVP/PDC/PPD]]
| PCD = [[Christian Democratic People's Party of Switzerland|CVP/PDC/PCD]]
| GPS | PES = [[Green Party of Switzerland|GPS/PES]]
| GLP = [[Green Liberal Party of Switzerland|GLP]]
| PLS | LPS | LIB = [[Liberal Party of Switzerland|LPS/PLS]]
| EVP | PEV = [[Evangelical People's Party of Switzerland|EVP/PEV]]
| Ticino League | Lega = [[Ticino League]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Green = [[Green Party of Switzerland|GPS]]
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = [[List of political parties in Switzerland|{{{2}}}]] }}
}}
| RO | Romania | [[Romania]] = {{#switch: {{uc:{{{2}}}}}
| PSD = [[Social Democratic Party (Romania)|PSD]]
| PNL = [[National Liberal Party (Romania)|PNL]]
| UDMR | RMDSZ = [[Democratic Alliance of Hungarians in Romania|UDMR]]
| PNȚ-CD | PNT-CD = [[Christian Democratic National Peasants' Party|PNȚ-CD]]
| ALDE = [[Alliance of Liberals and Democrats (Romania)|ALDE]]
| PDL = [[Democratic Liberal Party (Romania)|PDL]]
| FDGR = [[Democratic Forum of Germans in Romania|FDGR]]
| PD = [[Democratic Party (Romania)|PD]]
| PCM | MPP | HCP = [[Hungarian Civic Party (Romania)|PCM]]
| PND = [[National Democratic Party (Romania)|PND]]
| PRM = [[Greater Romania Party|PRM]]
| USL = [[Social Liberal Union|USL]]
| PMP = [[People's Movement Party|PMP]]
| UNPR = [[National Union for the Progress of Romania|UNPR]]
| PPMT | EMNP = [[Hungarian People's Party of Transylvania|PPMT]]
| PC = [[Conservative Party (Romania)|PC]]
| PER = [[Ecologist Party of Romania|PER]]
| PSRO = [[Romanian Social Party|PSRO]]
| PRO = [[PRO Romania|PRO]]
| PLUS = [[Freedom, Unity and Solidarity Party|PLUS]]
| USR = [[Save Romania Union|USR]]
| USR PLUS = [[USR PLUS]]
| AD = [[The Right Alternative|AD]]
| AUR = [[Alliance for the Union of Romanians|AUR]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| TR | Turkey | [[Turkey]] = {{#switch: {{uc:{{{2}}}}}
| AKP = [[Justice and Development Party (Turkey)|AKP]]
| BBP = [[Great Unity Party|BBP]]
| CHP = [[Republican People's Party|CHP]]
| DEM = [[Peoples' Equality and Democracy Party|DEM]]
| HDP = [[Peoples' Democratic Party (Turkey)|HDP]]
| İYİ | IYI = [[Good Party|İYİ]]
| MHP = [[Nationalist Movement Party|MHP]]
| SP = [[Felicity Party|SP]]
| TKP = [[Communist Party of Turkey (modern)|TKP]]
| YRP = [[New Welfare Party|YRP]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| US | United States | [[United States]] | USA | [[USA]] = {{#switch: {{uc:{{{2}}}}}
| D = [[Democratic Party (United States)|D]]
| R = [[Republican Party (United States)|R]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Democrat = [[Democratic Party (United States)|D]]
| Republican = [[Republican Party (United States)|R]]
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| ZA | South Africa | [[South Africa]] = {{#switch: {{uc:{{{2}}}}}
| ANC | African National Congress = [[African National Congress|ANC]]
| DA | Democratic Alliance = [[Democratic Alliance (South Africa)|DA]]
| IFP | Inkatha Freedom Party = [[Inkatha Freedom Party|IFP]]
| NFP | National Freedom Party = [[National Freedom Party|NFP]]
| COPE | Congress of the People = [[Congress of the People (South African political party)|COPE]]
| FF+ | Freedom Front Plus = [[Freedom Front Plus]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Green | Greens | Grün | Grüne = [[The Greens – The Green Alternative|Green]]
| Independent | Ind | Neutral | Parteilos | [[Parteilos]] | [[parteilos]] = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| Independent | [[Independent]] | Ind | Ind. | Neutral = [[Independent politician|Ind.]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent (politician)|Ind.]]
| #default = {{{2|{{{1|}}}}}} }}
}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
pphd5y87md8fa8n8amvokes2h2tc3m4
21854
21853
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Template:Polparty]]: Importing from the English wikipedia
21853
wikitext
text/x-wiki
{{#switch: {{ucfirst:{{{1}}}}}
| AT | Austria | [[Austria]] = {{#switch: {{uc:{{{2}}}}}
| SPÖ = [[Social Democratic Party of Austria|SPÖ]]
| ÖVP = [[Austrian People's Party|ÖVP]]
| FPÖ = [[Freedom Party of Austria|FPÖ]]
| BZÖ = [[Alliance for the Future of Austria|BZÖ]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Green | Greens | Grün | Grüne = [[The Greens – The Green Alternative|Green]]
| Independent | Ind | Neutral | Parteilos | [[Parteilos]] | [[parteilos]] = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| AU | Australia | [[Australia]] = {{#switch: {{uc:{{{2}}}}}
| ALP = [[Australian Labor Party|ALP]]
| CLP = [[Country Liberal Party|CLP]]
| LP = [[Liberal Party of Australia|Lib.]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Democrats | Dem = [[Australian Democrats|Dem.]]
| Greens | Green = [[Australian Greens|Greens]]
| Labor | Lab = [[Australian Labor Party|ALP]]
| Liberal | Lib = [[Liberal Party of Australia|Lib.]]
| National | Nat = [[National Party of Australia|Nat.]]
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| CA | Canada | [[Canada]] = {{#switch: {{uc:{{{2}}}}}
| BQ = [[Bloc Québécois|BQ]]
| CPC = [[Conservative Party of Canada|CPC]]
| LPC = [[Liberal Party of Canada|LPC]]
| NDP = [[New Democratic Party|NDP]]
| GPC = [[Green Party of Canada|Green]]
| FPNP = [[First Peoples National Party of Canada|FPNP]]
| CHP = [[Christian Heritage Party of Canada|CHP]]
| WBP = [[Western Block Party|WBP]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| CZ | Czechia | [[Czechia]] | [[Czech Republic]] | Czech Republic = {{#switch: {{uc:{{{2}}}}}
| ODS = [[Civic Democratic Party|ODS]]
| CSSD | SOCDEM = [[Social Democracy (Czech Republic)|SOCDEM]]
| KSCM = [[Communist Party of Bohemia and Moravia|KSČM]]
| KDU-CSL = [[Christian and Democratic Union – Czechoslovak People's Party|KDU-ČSL]]
| ANO = [[ANO 2011|ANO]]
| TOP09 = [[TOP 09]]
| STAN = [[Mayors and Independents|STAN]]
| Pirati = [[Czech Pirate Party|Pirates]]
| SPD = [[Freedom and Direct Democracy|SPD]]
| SZ = [[Green Party (Czech Republic)|Greens]]
| US-DEU = [[Freedom Union–Democratic Union|US-DEU]]
| LIRA = [[Liberal Reform Party|LIRA]]
| SNK = [[SNK European Democrats|SNK ED]]
| NEZDEM = [[Independent Democrats (Czech Republic)|Ind. Dem.]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| DE | Germany | [[Germany]] = {{#switch: {{uc:{{{2}}}}}
| CDU = [[Christian Democratic Union of Germany|CDU]]
| CSU = [[Christian Social Union in Bavaria|CSU]]
| SPD = [[Social Democratic Party of Germany|SPD]]
| FDP = [[Free Democratic Party (Germany)|FDP]]
| PDS = [[The Left (Germany)|Left]]
| FW | FWG = [[Free Voters|FW]]
| DDP = [[German Democratic Party|DDP]]
| NS | NSDAP = [[Nazi Party|NSDAP]]
| ODP | ÖDP = [[Ecological Democratic Party|ÖDP]]
| AfD | AFD = [[Alternative for Germany|AfD]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Left | Linke | The Left = [[The Left (Germany)|Left]]
| Green | Greens | Grün | Grüne | Bündnis 90/Die Grünen = [[Alliance 90/The Greens|Greens]]
| Freie Wähler | Freie wähler = [[Free Voters|FW]]
| Centre | Zentrum = [[Centre Party (Germany)|Centre]]
| Volt = [[Volt Germany|Volt]]
| PARTEI = [[die PARTEI|PARTEI]]
| Pirates | Piraten = [[Pirate Party Germany|Pirates]]
| Nazi = [[Nazi Party|NSDAP]]
| Independent | Ind | Neutral | Parteilos | [[Parteilos]] | [[parteilos]] = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| NL | Netherlands | [[Netherlands]] | The Netherlands | [[The Netherlands]] | Holland = {{#switch: {{uc:{{{2}}}}}
| CDA = [[Christian Democratic Appeal|CDA]]
| CU = [[ChristianUnion|CU]]
| D66 = [[Democrats 66|D66]]
| GL = [[GreenLeft|GL]]
| PVV = [[Party for Freedom|PVV]]
| SGP = [[Reformed Political Party|SGP]]
| SP = [[Socialist Party (Netherlands)|SP]]
| VVD = [[People's Party for Freedom and Democracy|VVD]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Green | Groen = [[GreenLeft|GL]]
| PvdA | Pvda = [[Labour Party (Netherlands)|PvdA]]
| Independent | Ind | Neutral | Parteilos | [[Parteilos]] | [[parteilos]] = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| CH | Switzerland | [[Switzerland]] = {{#switch: {{uc:{{{2}}}}}
| FDP | PRD | RAD | FDP/PRD = [[Free Democratic Party of Switzerland|FDP/PRD]]
| PLR = [[Free Democratic Party of Switzerland|FDP/PRD/PLR]]
| PLC = [[Free Democratic Party of Switzerland|FDP/PRD/PLC]]
| SPS | PSS | SP | PS | SP/PS | SPS/PSS | SOC = [[Social Democratic Party of Switzerland|SPS/PSS]]
| SVP | UDC | SVP/UDC = [[Swiss People's Party|SVP/UDC]]
| PPS = [[Swiss People's Party|SVP/UDC/PPS]]
| CVP | PDC | CVP/PDC = [[Christian Democratic People's Party of Switzerland|CVP/PDC]]
| PPD = [[Christian Democratic People's Party of Switzerland|CVP/PDC/PPD]]
| PCD = [[Christian Democratic People's Party of Switzerland|CVP/PDC/PCD]]
| GPS | PES = [[Green Party of Switzerland|GPS/PES]]
| GLP = [[Green Liberal Party of Switzerland|GLP]]
| PLS | LPS | LIB = [[Liberal Party of Switzerland|LPS/PLS]]
| EVP | PEV = [[Evangelical People's Party of Switzerland|EVP/PEV]]
| Ticino League | Lega = [[Ticino League]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Green = [[Green Party of Switzerland|GPS]]
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = [[List of political parties in Switzerland|{{{2}}}]] }}
}}
| RO | Romania | [[Romania]] = {{#switch: {{uc:{{{2}}}}}
| PSD = [[Social Democratic Party (Romania)|PSD]]
| PNL = [[National Liberal Party (Romania)|PNL]]
| UDMR | RMDSZ = [[Democratic Alliance of Hungarians in Romania|UDMR]]
| PNȚ-CD | PNT-CD = [[Christian Democratic National Peasants' Party|PNȚ-CD]]
| ALDE = [[Alliance of Liberals and Democrats (Romania)|ALDE]]
| PDL = [[Democratic Liberal Party (Romania)|PDL]]
| FDGR = [[Democratic Forum of Germans in Romania|FDGR]]
| PD = [[Democratic Party (Romania)|PD]]
| PCM | MPP | HCP = [[Hungarian Civic Party (Romania)|PCM]]
| PND = [[National Democratic Party (Romania)|PND]]
| PRM = [[Greater Romania Party|PRM]]
| USL = [[Social Liberal Union|USL]]
| PMP = [[People's Movement Party|PMP]]
| UNPR = [[National Union for the Progress of Romania|UNPR]]
| PPMT | EMNP = [[Hungarian People's Party of Transylvania|PPMT]]
| PC = [[Conservative Party (Romania)|PC]]
| PER = [[Ecologist Party of Romania|PER]]
| PSRO = [[Romanian Social Party|PSRO]]
| PRO = [[PRO Romania|PRO]]
| PLUS = [[Freedom, Unity and Solidarity Party|PLUS]]
| USR = [[Save Romania Union|USR]]
| USR PLUS = [[USR PLUS]]
| AD = [[The Right Alternative|AD]]
| AUR = [[Alliance for the Union of Romanians|AUR]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| TR | Turkey | [[Turkey]] = {{#switch: {{uc:{{{2}}}}}
| AKP = [[Justice and Development Party (Turkey)|AKP]]
| BBP = [[Great Unity Party|BBP]]
| CHP = [[Republican People's Party|CHP]]
| DEM = [[Peoples' Equality and Democracy Party|DEM]]
| HDP = [[Peoples' Democratic Party (Turkey)|HDP]]
| İYİ | IYI = [[Good Party|İYİ]]
| MHP = [[Nationalist Movement Party|MHP]]
| SP = [[Felicity Party|SP]]
| TKP = [[Communist Party of Turkey (modern)|TKP]]
| YRP = [[New Welfare Party|YRP]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| US | United States | [[United States]] | USA | [[USA]] = {{#switch: {{uc:{{{2}}}}}
| D = [[Democratic Party (United States)|D]]
| R = [[Republican Party (United States)|R]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Democrat = [[Democratic Party (United States)|D]]
| Republican = [[Republican Party (United States)|R]]
| Independent | Ind | Neutral = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| ZA | South Africa | [[South Africa]] = {{#switch: {{uc:{{{2}}}}}
| ANC | African National Congress = [[African National Congress|ANC]]
| DA | Democratic Alliance = [[Democratic Alliance (South Africa)|DA]]
| IFP | Inkatha Freedom Party = [[Inkatha Freedom Party|IFP]]
| NFP | National Freedom Party = [[National Freedom Party|NFP]]
| COPE | Congress of the People = [[Congress of the People (South African political party)|COPE]]
| FF+ | Freedom Front Plus = [[Freedom Front Plus]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Green | Greens | Grün | Grüne = [[The Greens – The Green Alternative|Green]]
| Independent | Ind | Neutral | Parteilos | [[Parteilos]] | [[parteilos]] = [[Independent politician|Ind.]]
| #default = {{{2}}} }}
}}
| Independent | [[Independent]] | Ind | Ind. | Neutral = [[Independent politician|Ind.]]
| #default = {{#switch: {{ucfirst: {{{2}}} }}
| Independent | Ind | Neutral = [[Independent (politician)|Ind.]]
| #default = {{{2|{{{1|}}}}}} }}
}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
pphd5y87md8fa8n8amvokes2h2tc3m4
Модул:Location map/data/USA
828
3676
21857
2019-02-10T18:47:41Z
Zyxw
2799
update name used in automatic captions
21857
Scribunto
text/plain
return {
name = 'the United States',
x = '50.0 + 124.03149777329222 * ((1.9694462586094064-($1 * pi / 180)) * sin(0.6010514667026994 * ($2 + 96) * pi / 180))',
y = '50.0 + 1.6155950752393982 * 124.03149777329222 * ( 0.02613325650382181 - (1.3236744353715044 - (1.9694462586094064 - ($1 * pi / 180)) * cos(0.6010514667026994 * ($2 + 96) * pi / 180)))',
image = 'Usa edcp location map.svg',
image1 = 'Usa edcp relief location map.png'
}
omeidj06s1rkgvgxe87f9nu423e3wd2
21858
21857
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Module:Location_map/data/USA]]: Importing from the English wikipedia
21857
Scribunto
text/plain
return {
name = 'the United States',
x = '50.0 + 124.03149777329222 * ((1.9694462586094064-($1 * pi / 180)) * sin(0.6010514667026994 * ($2 + 96) * pi / 180))',
y = '50.0 + 1.6155950752393982 * 124.03149777329222 * ( 0.02613325650382181 - (1.3236744353715044 - (1.9694462586094064 - ($1 * pi / 180)) * cos(0.6010514667026994 * ($2 + 96) * pi / 180)))',
image = 'Usa edcp location map.svg',
image1 = 'Usa edcp relief location map.png'
}
omeidj06s1rkgvgxe87f9nu423e3wd2
Шаблон:GNIS URL
10
3677
21859
2026-08-16T17:42:46Z
Hike395
2761
correct fix: check if antarid is new (> 2800000), if so, refer to nationalmap.gov. Otherwise attempt to retrieve from archive.org
21859
wikitext
text/x-wiki
{{#switch:{{{type|}}}
|antarid={{#ifexpr:{{{1|{{{id|}}}}}} >= 2800000|<!--
-->https://edits.nationalmap.gov/apps/gaz-antarctica/public/search/names/{{urlencode:{{{1|{{{id|}}}}}}}}|<!--
-->https://web.archive.org/web/2020/https://geonames.usgs.gov/apex/f?p=gnispq:5:::NO::P5_ANTAR_ID:{{urlencode:{{{1|{{{id|}}}}}}}}}}
|retired|archived=https://web.archive.org/web/2020/https://geonames.usgs.gov/apex/f?p=gnispq:3:::NO::P3_FID:{{urlencode:{{{1|{{{id|}}}}}}}}
|#default=https://edits.nationalmap.gov/apps/gaz-domestic/public/search/names/{{urlencode:{{{1|{{{id|}}}}}}}}}}<noinclude>
{{Documentation}}
</noinclude>
puio3s6xv03ovg0clzilqqgpgkap8j6
21860
21859
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Template:GNIS_URL]]: Importing from the English wikipedia
21859
wikitext
text/x-wiki
{{#switch:{{{type|}}}
|antarid={{#ifexpr:{{{1|{{{id|}}}}}} >= 2800000|<!--
-->https://edits.nationalmap.gov/apps/gaz-antarctica/public/search/names/{{urlencode:{{{1|{{{id|}}}}}}}}|<!--
-->https://web.archive.org/web/2020/https://geonames.usgs.gov/apex/f?p=gnispq:5:::NO::P5_ANTAR_ID:{{urlencode:{{{1|{{{id|}}}}}}}}}}
|retired|archived=https://web.archive.org/web/2020/https://geonames.usgs.gov/apex/f?p=gnispq:3:::NO::P3_FID:{{urlencode:{{{1|{{{id|}}}}}}}}
|#default=https://edits.nationalmap.gov/apps/gaz-domestic/public/search/names/{{urlencode:{{{1|{{{id|}}}}}}}}}}<noinclude>
{{Documentation}}
</noinclude>
puio3s6xv03ovg0clzilqqgpgkap8j6
Шаблон:Cite gnis
10
3678
21861
2022-08-23T17:13:23Z
Buaidh
2800
United States Geological Survey
21861
wikitext
text/x-wiki
<includeonly>{{#if: {{{1|{{{id|}}}}}}
| {{#if: {{{2|{{{title|{{{name|}}}}}}}}}
| {{#invoke:Template wrapper|wrap|_template=cite encyclopedia
|_exclude=type,id,links
|_alias-map=2:entry,3:access-date,4:date,title:entry,name:entry,entrydate:date,entry-date:date
|entry-url={{GNIS URL|{{{1|{{{id|}}}}}}|type={{{type|}}}}}
|encyclopedia={{#ifeq:{{{links|}}}|off
| Geographic Names Information System
| [[Geographic Names Information System]]}}
|publisher={{#ifeq:{{{links|}}}|off
| United States Geological Survey
| [[United States Geological Survey]], [[United States Department of the Interior]]}}
}}
| {{Citation error|no {{para|name}} specified|cite gnis|nocat={{main other||true}}}}
}}
| {{Citation error|no {{para|id}} specified|cite gnis|nocat={{main other||true}}}}
}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->
</noinclude>
kfakhw7axnjexqzb57mu8upql2o5va5
21862
21861
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Template:Cite_gnis]]: Importing from the English wikipedia
21861
wikitext
text/x-wiki
<includeonly>{{#if: {{{1|{{{id|}}}}}}
| {{#if: {{{2|{{{title|{{{name|}}}}}}}}}
| {{#invoke:Template wrapper|wrap|_template=cite encyclopedia
|_exclude=type,id,links
|_alias-map=2:entry,3:access-date,4:date,title:entry,name:entry,entrydate:date,entry-date:date
|entry-url={{GNIS URL|{{{1|{{{id|}}}}}}|type={{{type|}}}}}
|encyclopedia={{#ifeq:{{{links|}}}|off
| Geographic Names Information System
| [[Geographic Names Information System]]}}
|publisher={{#ifeq:{{{links|}}}|off
| United States Geological Survey
| [[United States Geological Survey]], [[United States Department of the Interior]]}}
}}
| {{Citation error|no {{para|name}} specified|cite gnis|nocat={{main other||true}}}}
}}
| {{Citation error|no {{para|id}} specified|cite gnis|nocat={{main other||true}}}}
}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->
</noinclude>
kfakhw7axnjexqzb57mu8upql2o5va5
Шаблон:Subpage other
10
3679
21863
2025-08-05T04:51:03Z
Theknightwho
2769
Make substable.
21863
wikitext
text/x-wiki
<onlyinclude>{{safesubst:<noinclude/>#ifeq:{{safesubst:<noinclude/>SUBPAGENAME}}|{{safesubst:<noinclude/>ROOTPAGENAME}}|{{{2|}}}|{{{1|}}}}}</onlyinclude><!--
-->{{documentation}}
k0itkwe4s7i80kxzt0zhv9wfh26yh2z
21864
21863
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Template:Subpage_other]]: Importing from the English wikipedia
21863
wikitext
text/x-wiki
<onlyinclude>{{safesubst:<noinclude/>#ifeq:{{safesubst:<noinclude/>SUBPAGENAME}}|{{safesubst:<noinclude/>ROOTPAGENAME}}|{{{2|}}}|{{{1|}}}}}</onlyinclude><!--
-->{{documentation}}
k0itkwe4s7i80kxzt0zhv9wfh26yh2z
Модул:ISO 3166/data/US
828
3680
21865
2025-10-28T19:55:07Z
Ahecht
2748
include okina in Hawaiʻi (which should be represented by a turned comma, not an apostrophe)
21865
Scribunto
text/plain
return {
lang = "en",
["AK"] = {name="Alaska"},
["AL"] = {name="Alabama"},
["AR"] = {name="Arkansas"},
["AZ"] = {name="Arizona"},
["CA"] = {name="California"},
["CO"] = {name="Colorado"},
["CT"] = {name="Connecticut"},
["DE"] = {name="Delaware"},
["FL"] = {name="Florida"},
["GA"] = {name="Georgia"},
["HI"] = {name="Hawaii", altnames={"Hawaiʻi"}},
["IA"] = {name="Iowa"},
["ID"] = {name="Idaho"},
["IL"] = {name="Illinois"},
["IN"] = {name="Indiana"},
["KS"] = {name="Kansas"},
["KY"] = {name="Kentucky"},
["LA"] = {name="Louisiana"},
["MA"] = {name="Massachusetts"},
["MD"] = {name="Maryland"},
["ME"] = {name="Maine"},
["MI"] = {name="Michigan"},
["MN"] = {name="Minnesota"},
["MO"] = {name="Missouri"},
["MS"] = {name="Mississippi"},
["MT"] = {name="Montana"},
["NC"] = {name="North Carolina"},
["ND"] = {name="North Dakota"},
["NE"] = {name="Nebraska"},
["NH"] = {name="New Hampshire"},
["NJ"] = {name="New Jersey"},
["NM"] = {name="New Mexico"},
["NV"] = {name="Nevada"},
["NY"] = {name="New York",altnames={"New York State", "NYS"}},
["OH"] = {name="Ohio"},
["OK"] = {name="Oklahoma"},
["OR"] = {name="Oregon"},
["PA"] = {name="Pennsylvania"},
["RI"] = {name="Rhode Island"},
["SC"] = {name="South Carolina"},
["SD"] = {name="South Dakota"},
["TN"] = {name="Tennessee"},
["TX"] = {name="Texas"},
["UT"] = {name="Utah"},
["VA"] = {name="Virginia"},
["VT"] = {name="Vermont"},
["WA"] = {name="Washington", altnames={"Washington State"}},
["WI"] = {name="Wisconsin"},
["WV"] = {name="West Virginia"},
["WY"] = {name="Wyoming"},
["DC"] = {name="District of Columbia",altnames={"Washington, D.C."}},
["AS"] = {name="American Samoa"},
["GU"] = {name="Guam"},
["MP"] = {name="Northern Mariana Islands"},
["PR"] = {name="Puerto Rico"},
["UM"] = {name="United States Minor Outlying Islands"},
["VI"] = {name="United States Virgin Islands",isoname="Virgin Islands, U.S.",altnames={"U.S. Virgin Islands","Virgin Islands"}}
}
m8l57cr1ughp0mhfofh43fuerr01hvt
21866
21865
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Module:ISO_3166/data/US]]: Importing from the English wikipedia
21865
Scribunto
text/plain
return {
lang = "en",
["AK"] = {name="Alaska"},
["AL"] = {name="Alabama"},
["AR"] = {name="Arkansas"},
["AZ"] = {name="Arizona"},
["CA"] = {name="California"},
["CO"] = {name="Colorado"},
["CT"] = {name="Connecticut"},
["DE"] = {name="Delaware"},
["FL"] = {name="Florida"},
["GA"] = {name="Georgia"},
["HI"] = {name="Hawaii", altnames={"Hawaiʻi"}},
["IA"] = {name="Iowa"},
["ID"] = {name="Idaho"},
["IL"] = {name="Illinois"},
["IN"] = {name="Indiana"},
["KS"] = {name="Kansas"},
["KY"] = {name="Kentucky"},
["LA"] = {name="Louisiana"},
["MA"] = {name="Massachusetts"},
["MD"] = {name="Maryland"},
["ME"] = {name="Maine"},
["MI"] = {name="Michigan"},
["MN"] = {name="Minnesota"},
["MO"] = {name="Missouri"},
["MS"] = {name="Mississippi"},
["MT"] = {name="Montana"},
["NC"] = {name="North Carolina"},
["ND"] = {name="North Dakota"},
["NE"] = {name="Nebraska"},
["NH"] = {name="New Hampshire"},
["NJ"] = {name="New Jersey"},
["NM"] = {name="New Mexico"},
["NV"] = {name="Nevada"},
["NY"] = {name="New York",altnames={"New York State", "NYS"}},
["OH"] = {name="Ohio"},
["OK"] = {name="Oklahoma"},
["OR"] = {name="Oregon"},
["PA"] = {name="Pennsylvania"},
["RI"] = {name="Rhode Island"},
["SC"] = {name="South Carolina"},
["SD"] = {name="South Dakota"},
["TN"] = {name="Tennessee"},
["TX"] = {name="Texas"},
["UT"] = {name="Utah"},
["VA"] = {name="Virginia"},
["VT"] = {name="Vermont"},
["WA"] = {name="Washington", altnames={"Washington State"}},
["WI"] = {name="Wisconsin"},
["WV"] = {name="West Virginia"},
["WY"] = {name="Wyoming"},
["DC"] = {name="District of Columbia",altnames={"Washington, D.C."}},
["AS"] = {name="American Samoa"},
["GU"] = {name="Guam"},
["MP"] = {name="Northern Mariana Islands"},
["PR"] = {name="Puerto Rico"},
["UM"] = {name="United States Minor Outlying Islands"},
["VI"] = {name="United States Virgin Islands",isoname="Virgin Islands, U.S.",altnames={"U.S. Virgin Islands","Virgin Islands"}}
}
m8l57cr1ughp0mhfofh43fuerr01hvt
Шаблон:FIPS
10
3681
21867
2022-04-14T00:55:29Z
Zzyzx11
2801
updating link
21867
wikitext
text/x-wiki
{{#ifeq: {{#invoke:String|len|s={{{cs|}}}}} | 10
| [https://data.census.gov/cedsci/profile?g=0600000US{{{cs}}} {{{cs}}}]
| {{#ifeq: {{#invoke:String|len|s={{{p|}}}}} | 10
| [https://data.census.gov/cedsci/profile?g=1600000US{{#invoke:String|sub|{{{p}}}|1|2}}{{#invoke:String|sub|{{{p}}}|6|10}} {{{p}}}]
| [{{#if:{{{county|}}}{{{3|}}}
|https://data.census.gov/cedsci/profile?g=0600000US{{{state|{{{1}}}}}}{{{county|{{{3}}}}}}{{{place|{{{2}}}}}}
|https://data.census.gov/cedsci/profile?g=1600000US{{{state|{{{1}}}}}}{{{place|{{{2}}}}}}
}} {{{state|{{{1}}}}}}-{{{place|{{{2}}}}}}]
}}
}}<noinclude>
{{Documentation}}
</noinclude>
cw1j8n0aocqrg4c7g6augdd8bmengie
21868
21867
2026-09-18T15:05:29Z
Keresturec
18
1 измена увезена из [[:en:Template:FIPS]]: Importing from the English wikipedia
21867
wikitext
text/x-wiki
{{#ifeq: {{#invoke:String|len|s={{{cs|}}}}} | 10
| [https://data.census.gov/cedsci/profile?g=0600000US{{{cs}}} {{{cs}}}]
| {{#ifeq: {{#invoke:String|len|s={{{p|}}}}} | 10
| [https://data.census.gov/cedsci/profile?g=1600000US{{#invoke:String|sub|{{{p}}}|1|2}}{{#invoke:String|sub|{{{p}}}|6|10}} {{{p}}}]
| [{{#if:{{{county|}}}{{{3|}}}
|https://data.census.gov/cedsci/profile?g=0600000US{{{state|{{{1}}}}}}{{{county|{{{3}}}}}}{{{place|{{{2}}}}}}
|https://data.census.gov/cedsci/profile?g=1600000US{{{state|{{{1}}}}}}{{{place|{{{2}}}}}}
}} {{{state|{{{1}}}}}}-{{{place|{{{2}}}}}}]
}}
}}<noinclude>
{{Documentation}}
</noinclude>
cw1j8n0aocqrg4c7g6augdd8bmengie
Шаблон:GNIS 4
10
3682
21869
2021-09-21T11:00:25Z
Hike395
2761
use if empty
21869
wikitext
text/x-wiki
[{{GNIS URL|{{if empty|{{{1|}}}|{{{id|}}}}}|type={{{type|}}}}} {{if empty|{{{1|}}}{{{id|}}}}}]<noinclude>
{{Documentation}}
</noinclude>
8zyi076cost2qmf2c8k67nj8iqgrnjd
21870
21869
2026-09-18T15:05:30Z
Keresturec
18
1 измена увезена из [[:en:Template:GNIS_4]]: Importing from the English wikipedia
21869
wikitext
text/x-wiki
[{{GNIS URL|{{if empty|{{{1|}}}|{{{id|}}}}}|type={{{type|}}}}} {{if empty|{{{1|}}}{{{id|}}}}}]<noinclude>
{{Documentation}}
</noinclude>
8zyi076cost2qmf2c8k67nj8iqgrnjd
Модул:Check for deprecated parameters
828
3683
21871
2026-06-11T18:41:51Z
Zackmann08
2741
Adding support for regular expression matching. Credit for this edit goes to [[User:Frietjes]] who did this in the sandbox.
21871
Scribunto
text/plain
-- This module may be used to compare the arguments passed to the parent
-- with a list of arguments, returning a specified result if an argument is
-- on the list
local p = {}
local MAX_PARAMS = 9 -- Limit to only showing 10 preview warnings
local function isnotempty(s)
return s and mw.text.trim(s) ~= ''
end
local function scanValues(values,results,args,replaceTable)
for k, v in pairs(values) do
local c = args.category:gsub('_VALUE_', v)
table.insert(results, c)
if v == '' then
-- Fix odd bug for | = which gets stripped to the empty string
-- and breaks category links
v = ' '
end
local replaceString = '<code>'..v..'</code>. '
local replaceValue = replaceTable and replaceTable[v]
replaceString = replaceString..(replaceValue and 'Replace with <code>'..replaceValue..'</code>.' or 'It should be removed.')
local p = args.preview:gsub('_VALUE_',replaceString)
table.insert(results, p )
end
end
function p.check (frame)
-- create the table of deprecated values and their matching new value
return p._check(frame.args, frame:getParent().args, frame:getParent():getTitle())
end
local moduleParams = {ignoreblank=true, preview=true, _category=true, _remove=true}
function p._check(args, pargs, caller)
local dep_values = {}
local reg_exps = {}
for k, v in pairs(args) do
if ( type(k) == 'string' and k:find('^_regexp[1-9][0-9]*$') and v:find('=') ) then
local v_split = mw.text.split(v, '%s*=%s*')
if ( #v_split == 2 ) then
table.insert(reg_exps, { '^' .. v_split[1] .. '$', v_split[2] } )
end
elseif not moduleParams[k] then
dep_values[k] = v
end
end
-- Parse params to remove
local removes = {}
if args['_remove'] then
for r in args['_remove']:gmatch("([^;]+)") do
removes[mw.text.trim(r)] = 1
end
end
-- loop over the parent args and see if any are deprecated
local values = {}
local remove_values = {}
local ignoreblank = isnotempty(args['ignoreblank'])
for k, v in pairs(pargs) do
if not ignoreblank or isnotempty(v) then
if dep_values[k] then
table.insert(values, k)
elseif removes[k] then
table.insert(remove_values, k)
else
for _, regexp in ipairs(reg_exps) do
if mw.ustring.match( tostring(k), regexp[1] ) then
table.insert(values, k)
dep_values[k] = mw.ustring.gsub(tostring(k), regexp[1], regexp[2])
break
end
end
end
end
end
-- find out about calling context
local title = mw.title.getCurrentTitle()
-- create local defaulted arguments
local category = args["_category"] or title.namespace == 0 and "[[Category:Pages with deprecated parameters]]" or ""
local preview = args['preview'] or 'Page using [['..caller..']] with deprecated parameter _VALUE_'
if isnotempty(preview) then
preview = require('Module:If preview')._warning({preview})
end
local localArgs = {category=category,preview=preview}
-- scan through values and remove_values and create output results
local results = {}
scanValues(values,results,localArgs,dep_values)
scanValues(remove_values,results,localArgs)
if #results >= MAX_PARAMS*2 then
while #results > MAX_PARAMS*2 do
table.remove(results) -- Calling without index removes the last element
end
table.insert(results, require('Module:If preview')._warning({'Page using [['..caller..']] with <b>multiple other</b> deprecated parameters. Fix those above and preview again.'}))
end
return table.concat(results)
end
return p
nf33yh045bpqn46orpqnkwwyw4ret2j
21872
21871
2026-09-18T15:05:30Z
Keresturec
18
1 измена увезена из [[:en:Module:Check_for_deprecated_parameters]]: Importing from the English wikipedia
21871
Scribunto
text/plain
-- This module may be used to compare the arguments passed to the parent
-- with a list of arguments, returning a specified result if an argument is
-- on the list
local p = {}
local MAX_PARAMS = 9 -- Limit to only showing 10 preview warnings
local function isnotempty(s)
return s and mw.text.trim(s) ~= ''
end
local function scanValues(values,results,args,replaceTable)
for k, v in pairs(values) do
local c = args.category:gsub('_VALUE_', v)
table.insert(results, c)
if v == '' then
-- Fix odd bug for | = which gets stripped to the empty string
-- and breaks category links
v = ' '
end
local replaceString = '<code>'..v..'</code>. '
local replaceValue = replaceTable and replaceTable[v]
replaceString = replaceString..(replaceValue and 'Replace with <code>'..replaceValue..'</code>.' or 'It should be removed.')
local p = args.preview:gsub('_VALUE_',replaceString)
table.insert(results, p )
end
end
function p.check (frame)
-- create the table of deprecated values and their matching new value
return p._check(frame.args, frame:getParent().args, frame:getParent():getTitle())
end
local moduleParams = {ignoreblank=true, preview=true, _category=true, _remove=true}
function p._check(args, pargs, caller)
local dep_values = {}
local reg_exps = {}
for k, v in pairs(args) do
if ( type(k) == 'string' and k:find('^_regexp[1-9][0-9]*$') and v:find('=') ) then
local v_split = mw.text.split(v, '%s*=%s*')
if ( #v_split == 2 ) then
table.insert(reg_exps, { '^' .. v_split[1] .. '$', v_split[2] } )
end
elseif not moduleParams[k] then
dep_values[k] = v
end
end
-- Parse params to remove
local removes = {}
if args['_remove'] then
for r in args['_remove']:gmatch("([^;]+)") do
removes[mw.text.trim(r)] = 1
end
end
-- loop over the parent args and see if any are deprecated
local values = {}
local remove_values = {}
local ignoreblank = isnotempty(args['ignoreblank'])
for k, v in pairs(pargs) do
if not ignoreblank or isnotempty(v) then
if dep_values[k] then
table.insert(values, k)
elseif removes[k] then
table.insert(remove_values, k)
else
for _, regexp in ipairs(reg_exps) do
if mw.ustring.match( tostring(k), regexp[1] ) then
table.insert(values, k)
dep_values[k] = mw.ustring.gsub(tostring(k), regexp[1], regexp[2])
break
end
end
end
end
end
-- find out about calling context
local title = mw.title.getCurrentTitle()
-- create local defaulted arguments
local category = args["_category"] or title.namespace == 0 and "[[Category:Pages with deprecated parameters]]" or ""
local preview = args['preview'] or 'Page using [['..caller..']] with deprecated parameter _VALUE_'
if isnotempty(preview) then
preview = require('Module:If preview')._warning({preview})
end
local localArgs = {category=category,preview=preview}
-- scan through values and remove_values and create output results
local results = {}
scanValues(values,results,localArgs,dep_values)
scanValues(remove_values,results,localArgs)
if #results >= MAX_PARAMS*2 then
while #results > MAX_PARAMS*2 do
table.remove(results) -- Calling without index removes the last element
end
table.insert(results, require('Module:If preview')._warning({'Page using [['..caller..']] with <b>multiple other</b> deprecated parameters. Fix those above and preview again.'}))
end
return table.concat(results)
end
return p
nf33yh045bpqn46orpqnkwwyw4ret2j
Шаблон:Clc
10
3684
21873
2019-04-24T04:30:59Z
JJMC89
2754
actual template is in the category
21873
wikitext
text/x-wiki
#REDIRECT [[Template:Category link with count]]
092gm3mu5vr84eif0gc6y7q98csnc9h
21874
21873
2026-09-18T15:05:30Z
Keresturec
18
1 измена увезена из [[:en:Template:Clc]]: Importing from the English wikipedia
21873
wikitext
text/x-wiki
#REDIRECT [[Template:Category link with count]]
092gm3mu5vr84eif0gc6y7q98csnc9h
Шаблон:Uses TemplateStyles
10
3685
21875
2023-04-18T22:22:16Z
Grufo
2227
Move the preview inside the documentation
21875
wikitext
text/x-wiki
<includeonly>{{#invoke:Uses TemplateStyles|main}}</includeonly><noinclude>{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
bbov914irrnmmvc6pz3scgivkjsu4ve
21876
21875
2026-09-18T15:05:30Z
Keresturec
18
1 измена увезена из [[:en:Template:Uses_TemplateStyles]]: Importing from the English wikipedia
21875
wikitext
text/x-wiki
<includeonly>{{#invoke:Uses TemplateStyles|main}}</includeonly><noinclude>{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
bbov914irrnmmvc6pz3scgivkjsu4ve
Шаблон:Auto short description
10
3686
21881
2026-03-11T06:11:31Z
Steven (Editor)
2803
Added {{space}} before If the automatic...
21881
wikitext
text/x-wiki
{{Ombox
| type = notice
| text = This template {{#if:{{{sometimes|}}}|sometimes{{sp}}}}adds an automatically generated '''[[Wikipedia:Short description|short description]]'''{{#if:{{{category|}}}|{{sp}}({{{category}}})|}}{{#if:{{{indirect|}}}|{{sp}}via an embedded template}}{{#if:{{{conditions|}}}|{{space}}{{{conditions}}}}}.{{#if:{{{nooverride|}}}||{{space}}If the automatic short description is not optimal, override it by adding {{tl|Short description}} at the top of the article.}}
}}<includeonly>{{Category handler
|nocat={{{nocat|}}}
|template={{Subpage other|<!-- do not categorise -->|[[Category:Templates that generate short descriptions{{#if:{{{category|}}}|{{sp}}for {{{category}}}|}}]]}}
}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
g6s5wfdvgkew5dzrdfmnuycfbw5sxe5
21882
21881
2026-09-18T15:05:30Z
Keresturec
18
1 измена увезена из [[:en:Template:Auto_short_description]]: Importing from the English wikipedia
21881
wikitext
text/x-wiki
{{Ombox
| type = notice
| text = This template {{#if:{{{sometimes|}}}|sometimes{{sp}}}}adds an automatically generated '''[[Wikipedia:Short description|short description]]'''{{#if:{{{category|}}}|{{sp}}({{{category}}})|}}{{#if:{{{indirect|}}}|{{sp}}via an embedded template}}{{#if:{{{conditions|}}}|{{space}}{{{conditions}}}}}.{{#if:{{{nooverride|}}}||{{space}}If the automatic short description is not optimal, override it by adding {{tl|Short description}} at the top of the article.}}
}}<includeonly>{{Category handler
|nocat={{{nocat|}}}
|template={{Subpage other|<!-- do not categorise -->|[[Category:Templates that generate short descriptions{{#if:{{{category|}}}|{{sp}}for {{{category}}}|}}]]}}
}}</includeonly><noinclude>
{{Documentation}}
<!-- Add categories and interwikis to the /doc subpage, not here! -->
</noinclude>
g6s5wfdvgkew5dzrdfmnuycfbw5sxe5
Шаблон:Infobox settlement/doc
10
3687
21883
2026-09-11T22:41:29Z
Zackmann08
2741
21883
wikitext
text/x-wiki
{{Documentation subpage}}
<!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])-->
{{Auto short description}}
{{High-use}}
{{Lua|Module:Infobox|Module:InfoboxImage|Module:Coordinates|Module:Check for unknown parameters|Module:Check for conflicting parameters|Module:Settlement short description|Module:Wikidata}}
{{Uses TemplateStyles|Template:Infobox settlement/styles.css}}
{{Uses Wikidata|P41|P94|P158|P625|P856}}
This template should be used to produce an [[WP:Infobox|Infobox]] for human settlements (cities, towns, villages, communities) as well as other administrative districts, counties, provinces, et cetera—in fact, any subdivision below the level of a country, for which {{tl|Infobox country}} should be used. Parameters are described in the table below. For questions, see the [[Template talk:Infobox settlement|talk page]]. For a US city guideline, see [[WP:USCITIES]].
The template is aliased or used as a sub-template for several infobox front-end templates.
==Usage==
* '''Important''': Please enter all numeric values in a raw, unformatted fashion. References and {{tl|citation needed}} tags are to be included in their respective section footnotes field. Numeric values that are not "raw" may create an "Expression error". Raw values will be automatically formatted by the template. If you find a raw value is not formatted in your usage of the template, please post a notice on the discussion page for this template.
* An expression error may also occur when any coordinate parameter has a value, but one or more coordinate parameters are blank or invalid.
* To specify CSS class "X" should be applied to an image, append to the filename: <code><nowiki>{{!}}class=X</nowiki></code>
Basic blank template, ready to cut and paste. See the next section for a copy of the template with all parameters and comments. See the table below that for a full description of each parameter.
===Using metric units===
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox settlement
|name =
|native_name = <!-- Settlement name in the dominant local language(s), if different from the English name -->
|native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead -->
|type =
|image =
|image_size =
|alt =
|caption =
|image_flag =
|flag_alt =
|image_seal =
|seal_alt =
|image_shield =
|shield_alt =
|etymology =
|nickname =
|motto =
|image_map =
|map_alt =
|map_caption =
|pushpin_map =
|pushpin_alt =
|pushpin_caption =
|pushpin_map_size =
|pushpin_label_position =
|mapframe = <!-- "yes" to show an interactive map -->
|coordinates = <!-- {{coord|latitude|longitude|type:city|display=inline,title}} -->
|coor_pinpoint =
|coordinates_footnotes =
|subdivision_type = Country
|subdivision_name =
|subdivision_type1 =
|subdivision_name1 =
|subdivision_type2 =
|subdivision_name2 =
|subdivision_type3 =
|subdivision_name3 =
|established_title =
|established_date =
|founder =
|seat_type =
|seat =
|government_footnotes =
|government_type =
|governing_body =
|leader_party =
|leader_title =
|leader_name =
|leader_title1 =
|leader_name1 =
|leader_title2 =
|leader_name2 =
|leader_title3 =
|leader_name3 =
|leader_title4 =
|leader_name4 =
|unit_pref = Metric
<!-- ALL fields with measurements have automatic unit conversion -->
<!-- for references: use <ref> tags -->
|area_footnotes =
|area_urban_footnotes = <!-- <ref> </ref> -->
|area_rural_footnotes = <!-- <ref> </ref> -->
|area_metro_footnotes = <!-- <ref> </ref> -->
|area_note =
|area_water_percent =
|area_rank =
|area_blank1_title =
|area_blank2_title =
<!-- square kilometers -->
|area_total_km2 =
|area_land_km2 =
|area_water_km2 =
|area_urban_km2 =
|area_rural_km2 =
|area_metro_km2 =
|area_blank1_km2 =
|area_blank2_km2 =
<!-- hectares -->
|area_total_ha =
|area_land_ha =
|area_water_ha =
|area_urban_ha =
|area_rural_ha =
|area_metro_ha =
|area_blank1_ha =
|area_blank2_ha =
|length_km =
|width_km =
|dimensions_footnotes =
|elevation_footnotes =
|elevation_m =
|population_footnotes =
|population_as_of =
|population_total =
|population_density_km2 = auto
|population_note =
|population_demonym =
|time_zone1 =
|utc_offset1 =
|time_zone1_DST =
|utc_offset1_DST =
|postal_code_type =
|postal_code =
|area_code_type =
|area_code =
|area_codes = <!-- for multiple area codes -->
|iso_code =
|website = <!-- {{Official URL}} -->
|module =
|footnotes =
}}
</syntaxhighlight>
===Using non-metric units===
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox settlement
|name =
|native_name =
|native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead -->
|type =
|image =
|image_size =
|alt =
|caption =
|image_flag =
|flag_alt =
|image_seal =
|seal_alt =
|image_shield =
|shield_alt =
|etymology =
|nickname =
|motto =
|image_map =
|map_alt =
|map_caption =
|pushpin_map =
|pushpin_alt =
|pushpin_caption =
|pushpin_label_position =
|mapframe = <!-- "yes" to show an interactive map -->
|coordinates = <!-- {{coord|latitude|longitude|type:city|display=inline,title}} -->
|coor_pinpoint =
|coordinates_footnotes =
|subdivision_type = Country
|subdivision_name =
|subdivision_type1 =
|subdivision_name1 =
|subdivision_type2 =
|subdivision_name2 =
|subdivision_type3 =
|subdivision_name3 =
|established_title =
|established_date =
|founder =
|seat_type =
|seat =
|government_footnotes =
|leader_party =
|leader_title =
|leader_name =
|unit_pref = Imperial
<!-- ALL fields with measurements have automatic unit conversion -->
<!-- for references: use <ref> tags -->
|area_footnotes =
|area_urban_footnotes = <!-- <ref> </ref> -->
|area_rural_footnotes = <!-- <ref> </ref> -->
|area_metro_footnotes = <!-- <ref> </ref> -->
|area_note =
|area_water_percent =
|area_rank =
|area_blank1_title =
|area_blank2_title =
<!-- square miles -->
|area_total_sq_mi =
|area_land_sq_mi =
|area_water_sq_mi =
|area_urban_sq_mi =
|area_rural_sq_mi =
|area_metro_sq_mi =
|area_blank1_sq_mi =
|area_blank2_sq_mi =
<!-- acres -->
|area_total_acre =
|area_land_acre =
|area_water_acre =
|area_urban_acre =
|area_rural_acre =
|area_metro_acre =
|area_blank1_acre =
|area_blank2_acre =
|length_mi =
|width_mi =
|dimensions_footnotes =
|elevation_footnotes =
|elevation_ft =
|population_footnotes =
|population_as_of =
|population_total =
|population_density_sq_mi = auto
|population_note =
|population_demonym =
|time_zone1 =
|utc_offset1 =
|time_zone1_DST =
|utc_offset1_DST =
|postal_code_type =
|postal_code =
|area_code_type =
|area_code =
|iso_code =
|website = <!-- {{Official URL}} -->
|module =
|footnotes =
}}
</syntaxhighlight>
===Short version===
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox settlement
|name =
|native_name =
|native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead -->
|type =
|image =
|image_size =
|alt =
|caption =
|etymology =
|nickname =
|coordinates = <!-- {{Coord}} -->
|population_total =
|subdivision_type = Country
|subdivision_name =
|subdivision_type1 =
|subdivision_name1 =
|subdivision_type2 =
|subdivision_name2 =
|website = <!-- {{Official URL}} -->
}}
</syntaxhighlight>
===Complete empty syntax, with comments===
This copy of the template lists all parameters except for some of the repeating numbered parameters which are noted in the comments. Comments here should be brief; see the table below for full descriptions of each parameter.
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox settlement
| name = <!-- at least one of the first two fields must be filled in -->
| native_name = <!-- if different from the English name -->
| native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead -->
| other_name =
| type = <!-- such as Town, Village, City, Borough etc. -->
| official_name = <!-- avoid if redundant with e.g. `type` of `name` -->
<!-- transliteration(s) -->
| translit_lang1 =
| translit_lang1_type =
| translit_lang1_info =
| translit_lang1_type1 =
| translit_lang1_info1 =
| translit_lang1_type2 =
| translit_lang1_info2 = <!-- etc., up to translit_lang1_type6 / translit_lang1_info6 -->
| translit_lang2 =
| translit_lang2_type =
| translit_lang2_info =
| translit_lang2_type1 =
| translit_lang2_info1 =
| translit_lang2_type2 =
| translit_lang2_info2 = <!-- etc., up to translit_lang2_type6 / translit_lang2_info6 -->
<!-- images, nickname, motto -->
| image =
| image_size =
| alt =
| caption =
| image_flag =
| flag_size =
| flag_alt =
| flag_border =
| flag_link =
| image_seal =
| seal_size =
| seal_alt =
| seal_link =
| seal_type =
| seal_class =
| image_shield =
| shield_size =
| shield_alt =
| shield_link =
| image_blank_emblem =
| blank_emblem_type =
| blank_emblem_size =
| blank_emblem_alt =
| blank_emblem_link =
| etymology =
| nickname =
| nicknames =
| motto =
| mottoes =
| anthem =
<!-- maps and coordinates -->
| image_map =
| map_size =
| map_alt =
| map_caption =
| image_map1 =
| map_size1 =
| map_alt1 =
| map_caption1 =
| pushpin_map = <!-- name of a location map as per Template:Location_map -->
| pushpin_map_size =
| pushpin_alt =
| pushpin_caption =
| pushpin_label = <!-- only necessary if "name" or "official_name" are too long -->
| pushpin_label_position = <!-- position of the pushpin label: left, right, top, bottom, none -->
| pushpin_relief =
| mapframe = <!-- "yes" to show an interactive map -->
| coordinates = <!-- {{Coord}} -->
| coor_pinpoint = <!-- to specify exact location of coordinates (was coor_type) -->
| coordinates_footnotes = <!-- for references: use <ref> tags -->
| grid_name = <!-- name of a regional grid system -->
| grid_position = <!-- position on the regional grid system -->
<!-- location -->
| subdivision_type = Country
| subdivision_name = <!-- the name of the country -->
| subdivision_type1 =
| subdivision_name1 =
| subdivision_type2 =
| subdivision_name2 = <!-- etc., subdivision_type6 / subdivision_name6 -->
<!-- established -->
| established_title = <!-- Founded -->
| established_date = <!-- requires established_title= -->
| established_title1 = <!-- Incorporated (town) -->
| established_date1 = <!-- requires established_title1= -->
| established_title2 = <!-- Incorporated (city) -->
| established_date2 = <!-- requires established_title2= -->
| established_title3 =
| established_date3 = <!-- requires established_title3= -->
| established_title4 =
| established_date4 = <!-- requires established_title4= -->
| established_title5 =
| established_date5 = <!-- requires established_title5= -->
| established_title6 =
| established_date6 = <!-- requires established_title6= -->
| established_title7 =
| established_date7 = <!-- requires established_title7= -->
| extinct_title =
| extinct_date = <!-- requires extinct_title= -->
| founder =
| named_for =
<!-- seat, smaller parts -->
| seat_type = <!-- defaults to: Seat -->
| seat =
| seat1_type = <!-- defaults to: Former seat -->
| seat1 =
| parts_type = <!-- defaults to: Boroughs -->
| parts_style = <!-- list, coll (collapsed list), para (paragraph format) -->
| parts = <!-- parts text, or header for parts list -->
| p1 =
| p2 = <!-- etc., up to p50: for separate parts to be listed-->
<!-- government type, leaders -->
| government_footnotes = <!-- for references: use <ref> tags -->
| government_type =
| governing_body =
| leader_party =
| leader_title =
| leader_name = <!-- add &nbsp; (no-break space) to disable automatic links -->
| leader_title1 =
| leader_name1 = <!-- etc., up to leader_title4 / leader_name4 -->
<!-- display settings -->
| total_type = <!-- to set a non-standard label for total area and population rows -->
| unit_pref = <!-- enter: Imperial, to display imperial before metric -->
<!-- area -->
| area_footnotes = <!-- for references: use <ref> tags -->
| dunam_link = <!-- If dunams are used, this specifies which dunam to link. -->
| area_total_km2 = <!-- ALL fields with measurements have automatic unit conversion -->
| area_total_sq_mi = <!-- see table @ Template:Infobox settlement for details -->
| area_total_ha =
| area_total_acre =
| area_total_dunam = <!-- used in Middle East articles only -->
| area_land_km2 =
| area_land_sq_mi =
| area_land_ha =
| area_land_acre =
| area_land_dunam = <!-- used in Middle East articles only -->
| area_water_km2 =
| area_water_sq_mi =
| area_water_ha =
| area_water_acre =
| area_water_dunam = <!-- used in Middle East articles only -->
| area_water_percent =
| area_urban_footnotes = <!-- for references: use <ref> tags -->
| area_urban_km2 =
| area_urban_sq_mi =
| area_urban_ha =
| area_urban_acre =
| area_urban_dunam = <!-- used in Middle East articles only -->
| area_rural_footnotes = <!-- for references: use <ref> tags -->
| area_rural_km2 =
| area_rural_sq_mi =
| area_rural_ha =
| area_rural_acre =
| area_rural_dunam = <!-- used in Middle East articles only -->
| area_metro_footnotes = <!-- for references: use <ref> tags -->
| area_metro_km2 =
| area_metro_sq_mi =
| area_metro_ha =
| area_metro_acre =
| area_metro_dunam = <!-- used in Middle East articles only -->
| area_rank =
| area_blank1_title =
| area_blank1_km2 =
| area_blank1_sq_mi =
| area_blank1_ha =
| area_blank1_acre =
| area_blank1_dunam = <!-- used in Middle East articles only -->
| area_blank2_title =
| area_blank2_km2 =
| area_blank2_sq_mi =
| area_blank2_ha =
| area_blank2_acre =
| area_blank2_dunam = <!-- used in Middle East articles only -->
| area_note =
<!-- dimensions -->
| dimensions_footnotes = <!-- for references: use <ref> tags -->
| length_km =
| length_mi =
| width_km =
| width_mi =
<!-- elevation -->
| elevation_footnotes = <!-- for references: use <ref> tags -->
| elevation_m =
| elevation_ft =
| elevation_point = <!-- for denoting the measurement point -->
| elevation_max_footnotes = <!-- for references: use <ref> tags -->
| elevation_max_m =
| elevation_max_ft =
| elevation_max_point = <!-- for denoting the measurement point -->
| elevation_max_rank =
| elevation_min_footnotes = <!-- for references: use <ref> tags -->
| elevation_min_m =
| elevation_min_ft =
| elevation_min_point = <!-- for denoting the measurement point -->
| elevation_min_rank =
<!-- population -->
| population_footnotes = <!-- for references: use <ref> tags -->
| population_as_of =
| population_total =
| pop_est_footnotes =
| pop_est_as_of =
| population_est =
| population_rank =
| population_density_km2 = <!-- for automatic calculation of any density field, use: auto -->
| population_density_sq_mi =
| population_urban_footnotes =
| population_urban =
| population_density_urban_km2 =
| population_density_urban_sq_mi =
| population_rural_footnotes =
| population_rural =
| population_density_rural_km2 =
| population_density_rural_sq_mi =
| population_metro_footnotes =
| population_metro =
| population_density_metro_km2 =
| population_density_metro_sq_mi =
| population_density_rank =
| population_blank1_title =
| population_blank1 =
| population_density_blank1_km2 =
| population_density_blank1_sq_mi =
| population_blank2_title =
| population_blank2 =
| population_density_blank2_km2 =
| population_density_blank2_sq_mi =
| population_demonym = <!-- demonym, e.g. Liverpudlian for someone from Liverpool -->
| population_demonyms =
| population_note =
<!-- demographics (section 1) -->
| demographics_type1 =
| demographics1_footnotes = <!-- for references: use <ref> tags -->
| demographics1_title1 =
| demographics1_info1 = <!-- etc., up to demographics1_title7 / demographics1_info7 -->
<!-- demographics (section 2) -->
| demographics_type2 =
| demographics2_footnotes = <!-- for references: use <ref> tags -->
| demographics2_title1 =
| demographics2_info1 = <!-- etc., up to demographics2_title10 / demographics2_info10 -->
<!-- time zone(s) -->
| time_zone_link =
| time_zone1_location =
| time_zone1 =
| utc_offset1 =
| time_zone1_DST =
| utc_offset1_DST =
| time_zone2_location =
| time_zone2 =
| utc_offset2 =
| time_zone2_DST =
| utc_offset2_DST =
| time_zone3_location =
| time_zone3 =
| utc_offset3 =
| time_zone3_DST =
| utc_offset3_DST =
| time_zone4_location =
| time_zone4 =
| utc_offset4 =
| time_zone4_DST =
| utc_offset4_DST =
| time_zone5_location =
| time_zone5 =
| utc_offset5 =
| time_zone5_DST =
| utc_offset5_DST =
<!-- postal codes, area code -->
| postal_code_type = <!-- enter ZIP Code, Postcode, Post code, Postal code... -->
| postal_code =
| postal2_code_type = <!-- enter ZIP Code, Postcode, Post code, Postal code... -->
| postal2_code =
| area_code_type = <!-- defaults to: Area code(s) -->
| area_code =
| area_codes =
| geocode =
| iso_code =
| registration_plate_type =
| registration_plate =
| code1_name =
| code1_info =
| code2_name =
| code2_info =
<!-- custom fields (section 1) -->
| custom_label_sec1 =
| custom_data_sec1 =
| custom_label1_sec1 =
| custom_data1_sec1 =
| custom_label2_sec1 =
| custom_data2_sec1 = <!-- etc., up to custom_label7_sec1 / custom_data7_sec1 -->
<!-- custom fields (section 2) -->
| custom_label_sec2 =
| custom_data_sec2 =
| custom_label1_sec2 =
| custom_data1_sec2 =
| custom_label2_sec2 =
| custom_data2_sec2 = <!-- etc., up to custom_label7_sec2 / custom_data7_sec2 -->
<!-- website, footnotes -->
| website = <!-- {{Official URL}} -->
| module =
| footnotes =
}}
</syntaxhighlight>
<section begin=parameters /> <!-- Used to transclude this on wrapper templates via {{#section:Template:Infobox settlement/doc|parameters}} -->
==Parameter names and descriptions==
{| class="wikitable"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Name and transliteration===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
| '''name''' || optional || This is the usual name in English. If it's not specified, the infobox will use the '''official_name''' as a title unless this too is missing, in which case the page name will be used.
|- style="vertical-align:top;"
| '''native_name''' || optional || Name or names in the local language, if different from 'name', and if not English. This parameter may be used for the name in the de facto local language (e.g. German for [[Munich]]). Per the [[Template talk:Infobox settlement/Archive 32#RFC on usage of native name parameter for First Nations placenames|2023 RfC]], it may also be used for names used by First Nations/[[Indigenous peoples]], '''regardless''' of whether they are the dominant ethnic group in the location.
|- style="vertical-align:top;"
| '''native_name_lang''' || optional || Use [[List of ISO 639-1 codes|ISO 639-1 code]], e.g. "fr" for French. If there is more than one dominant name, in different languages, enter those names using {{tl|lang}}, instead.
|- style="vertical-align:top;"
| '''other_name''' || optional || For places with other commonly used names like Bombay or Saigon
|- style="vertical-align:top;"
| '''type''' || optional || Any type can be entered, such as City, Town, Village, Hamlet, Municipality, Reservation, etc. If set, will be displayed under the names. Might also be used as a label for total population/area (defaulting to ''City''), if needed to distinguish from ''Urban'', ''Rural'' or ''Metro'' (if urban, rural or metro figures are not present, the label is ''Total'' unless '''total_type''' is set).
|- style="vertical-align:top;"
| '''official_name''' || optional || The official name in English. Avoid using '''official_name''' if it leads to redundancy with '''name''' and '''type'''. Use '''official_name''' if the official name is unusual or cannot be simply deduced from the name and settlement type.
|- style="vertical-align:top;"
| '''short_description''' || optional || Set to <code>no</code> to suppress the Short description generated by the infobox.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Transliteration(s)
|- style="vertical-align:top;"
| '''translit_lang1''' || optional || Will place the "entry" before the word "transliteration(s)". Can be used to specify a particular language like in [[Dêlêg]] or one may just enter "Other", like in [[Gaza City|Gaza]]'s article.
|- style="vertical-align:top;"
| '''translit_lang1_type'''<br />'''translit_lang1_type1'''<br />to<br />'''translit_lang1_type6''' || optional ||
|- style="vertical-align:top;"
| '''translit_lang1_info'''<br />'''translit_lang1_info1'''<br />to<br />'''translit_lang1_info6''' || optional ||
|- style="vertical-align:top;"
| '''translit_lang2''' || optional || Will place a second transliteration. See [[Dêlêg]]
|- style="vertical-align:top;"
| '''translit_lang2_type'''<br />'''translit_lang2_type1'''<br />to<br />'''translit_lang2_type6''' || optional ||
|- style="vertical-align:top;"
| '''translit_lang2_info'''<br />'''translit_lang2_info1'''<br />to<br />'''translit_lang2_info6''' || optional ||
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Images, nickname, motto===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Image
|- style="vertical-align:top;"
| '''image''' || optional || Primary image representing the settlement. Commonly a photo of the settlement’s skyline. For large urban areas, the <nowiki>{{multiple image}}</nowiki> template is often used in place of a single image to create a collage of the settlement's skyline and several notable landmarks.
|- style="vertical-align:top;"
| '''image_size''' || optional || Can be used to tweak the size of the image up or down. This can be helpful if an editor wants to make the infobox wider. If used, '''px''' must be specified; default size is 250px. Note [[WP:IMGSIZELEAD]] recommends that images should be no wider than <code>upright=1.35</code> -equivalent to 300px
|- style="vertical-align:top;"
| '''alt''' || optional || [[Alt text]] for the image, used by visually impaired readers who cannot see the image. See [[WP:ALT]].
|- style="vertical-align:top;"
| '''caption''' || optional || Will place a caption under the image (if present)
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Flag image
|- style="vertical-align:top;"
| '''image_flag''' || optional || Used for a flag.
|- style="vertical-align:top;"
| '''flag_size''' || optional || Can be used to tweak the size of the image_flag up or down from 100px as desired. If used, '''px''' must be specified; default size is 100px.
|- style="vertical-align:top;"
| '''flag_alt''' || optional || Alt text for the flag.
|- style="vertical-align:top;"
| '''flag_border''' || optional || Set to 'no' to remove the border from the flag
|- style="vertical-align:top;"
| '''flag_link''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Seal image
|- style="vertical-align:top;"
| '''image_seal''' || optional || If the place has an official seal.
|- style="vertical-align:top;"
| '''seal_size''' || optional || If used, '''px''' must be specified; default size is 100px.
|- style="vertical-align:top;"
| '''seal_alt''' || optional || Alt text for the seal.
|- style="vertical-align:top;"
| '''seal_link'''<br />'''seal_type''' || optional ||
|- style="vertical-align:top;"
| '''seal_class''' || optional || CSS class for the seal image. Parameter {{para|seal_class|skin-invert}} can be used for dark mode support if the seal image is monochrome.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Coat of arms image
|- style="vertical-align:top;"
| '''image_shield''' || optional || Can be used for a place with a coat of arms.
|- style="vertical-align:top;"
| '''shield_size''' || optional || If used, '''px''' must be specified; default size is 100px.
|- style="vertical-align:top;"
| '''shield_alt''' || optional || Alt text for the shield.
|- style="vertical-align:top;"
| '''shield_link''' || optional || Can be used if a wiki article if known but is not automatically linked by the template. See [[Coquitlam, British Columbia]]'s infobox for an example.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Logo or emblem image
|- style="vertical-align:top;"
| '''image_blank_emblem''' || optional || Can be used if a place has an official logo, crest, emblem, etc.
|- style="vertical-align:top;"
| '''blank_emblem_type''' || optional || Caption beneath "image_blank_emblem" to specify what type of emblem it is.
|- style="vertical-align:top;"
| '''blank_emblem_size''' || optional || If used, '''px''' must be specified; default size is 100px.
|- style="vertical-align:top;"
| '''blank_emblem_alt''' || optional || Alt text for blank emblem.
|- style="vertical-align:top;"
| '''blank_emblem_link''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Nickname, motto
|- style="vertical-align:top;"
| '''etymology''' || optional || origin of name
|- style="vertical-align:top;"
| '''nickname''' || optional || well-known nickname
|- style="vertical-align:top;"
| '''nicknames''' || optional || if more than one well-known nickname, use this
|- style="vertical-align:top;"
| '''motto''' || optional || Will place the motto under the nicknames
|- style="vertical-align:top;"
| '''mottoes''' || optional || if more than one motto, use this
|- style="vertical-align:top;"
| '''anthem''' || optional || Will place the anthem (song) under the nicknames
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Maps, coordinates===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Map images
|- style="vertical-align:top;"
| '''image_map''' || optional ||
|- style="vertical-align:top;"
| '''map_size''' || optional || If used, '''px''' must be specified; default is 250px.
|- style="vertical-align:top;"
| '''map_alt''' || optional || Alt text for map.
|- style="vertical-align:top;"
| '''map_caption''' || optional ||
|- style="vertical-align:top;"
| '''image_map1''' || optional || A secondary map image. The field '''image_map''' must be filled in first. Example see: [[Bloomsburg, Pennsylvania]].
|- style="vertical-align:top;"
| '''map_size1''' || optional || If used, '''px''' must be specified; default is 250px.
|- style="vertical-align:top;"
| '''map_alt1''' || optional || Alt text for secondary map.
|- style="vertical-align:top;"
| '''map_caption1''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Pushpin map(s), coordinates
|- style="vertical-align:top;"
| '''pushpin_map''' || optional || The name of a location map as per [[Template:Location map]] (e.g. ''Indonesia'' or ''Russia''). The coordinate fields (from {{para|coordinates}}) position a pushpin coordinate marker and label on the map '''automatically'''. Example: [[Padang, Indonesia]]. To show multiple pushpin maps, provide a list of maps separated by #, e.g., ''California#USA''
|- style="vertical-align:top;"
| '''pushpin_map_size''' || optional || Must be entered as only a number—'''do not use px'''. The default value is 250.<br />''Equivalent to <code>width</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_alt''' || optional || Alt text for pushpin map; used by [[screen reader]]s, see [[WP:ALT]].<br />''Equivalent to <code>alt</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_caption''' || optional || Fill out if a different caption from ''map_caption'' is desired.<br />''Equivalent to <code>caption</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_label''' || optional || The text of the label to display next to the identifying mark; a [[Wiki markup|wikilink]] can be used. If not specified, the label will be the text assigned to the ''name'' or ''official_name'' parameters (if {{para|pushpin_label_position|none}}, no label is displayed).<br />''Equivalent to <code>label</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_label_position''' || optional || The position of the label on the pushpin map relative to the pushpin coordinate marker. Valid options are {left, right, top, bottom, none}. If this field is not specified, the default value is ''right''.<br/>''Equivalent to <code>position</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_relief''' || optional || Set this to <code>y</code> or any non-blank value to use an alternative relief map provided by the selected location map (if a relief map is available). <br/>''Equivalent to <code>relief</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''mapframe''' || optional || Add a {{tl|infobox mapframe}} map. See the documentation below in [[#Mapframe maps]] for more details on usage.
|- style="vertical-align:top;"
| '''coordinates''' || optional || Latitude and longitude. Use {{tl|Coord}}. See the documentation for {{tl|Coord}} for more details on usage.
|- style="vertical-align:top;"
| '''coor_pinpoint''' || optional || If needed, to specify more exactly where (or what) coordinates are given (e.g. ''Town Hall'') or a specific place in a larger area (e.g. a city in a county). Example: In the article [[Masovian Voivodeship]], <code>coor_pinpoint=Warsaw</code> specifies [[Warsaw]].
|- style="vertical-align:top;"
| '''coordinates_footnotes''' || optional || Reference(s) for coordinates, placed within <code><nowiki><ref> </ref></nowiki></code> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''grid_name'''<br />'''grid_position''' || optional || Name of a regional grid system and position on the regional grid
|}
====Mapframe maps====
{{Infobox mapframe/doc/parameters
| onByDefault = yes, unless any of the other map parameters are present: {{para|pushpin_map}}, {{para|image_map}}, {{para|image_map1}}
| mapframe-frame-width = 250
| mapframe-length_km = {{para|length_km}}
| mapframe-length_mi = {{para|length_mi}}
| mapframe-width_km = {{para|width_km}}
| mapframe-width_mi = {{para|width_mi}}
| mapframe-area_km2 = {{para|area_total_km2}}
| mapframe-area_ha = {{para|area_total_ha}}
| mapframe-area_acre = {{para|area_total_acre}}
| mapframe-area_sq_mi = {{para|area_total_sq_mi}}
| mapframe-type = city
| mapframe-population = {{para|population_metro}} or {{para|population_total}}
| mapframe-marker = town
| mapframe-caption = Interactive map of {{para|name}} or {{para|official_name}} or {{tl|PAGENAMEBASE}}
}}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Location, established, seat, subdivisions, government, leaders===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Location
|- style="vertical-align:top;"
| {{anchor|subdivision_type}}'''subdivision_type''' || optional || almost always <code><nowiki>Country</nowiki></code>
|- style="vertical-align:top;"
| '''subdivision_name''' || optional || Depends on the subdivision_type — use the name in text form, sample: <code>United States</code>. Per [[MOS:INFOBOXFLAG]], flag icons or flag templates may be used in this field
|- style="vertical-align:top;"
| '''subdivision_type1'''<br />to<br />'''subdivision_type6''' || optional || Can be State/Province, region, county. These labels are for subdivisions ''above'' the level of the settlement described in the article. For subdivisions ''below'' or ''within'' the place described in the article, use {{para|parts_type}}.
|- style="vertical-align:top;"
| '''subdivision_name1'''<br />to<br />'''subdivision_name6''' || optional || Use the name in text form, sample: <code>Florida</code> or <code><nowiki>[[Florida]]</nowiki></code>. Per [[MOS:INFOBOXFLAG]], settlements "may have flags of the country and first-level administrative subdivision in infoboxes". Flag icons or flag templates is permitted for subdivision_name1 (which is usually state or province); flag icons or flag templates should '''not''' be used in subdivision_name2-6.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Established
|- style="vertical-align:top;"
| '''established_title''' || optional || Example: Founded
|- style="vertical-align:top;"
| '''established_date''' || optional || Requires established_title=
|- style="vertical-align:top;"
| '''established_title1''' || optional || Example: Incorporated (town) <br/>[Note that "established_title1" is distinct from "established_title"; you can think of "established_title" as behaving like "established_title0".]
|- style="vertical-align:top;"
| '''established_date1''' || optional || [See note for "established_title1".] Requires established_title1=
|- style="vertical-align:top;"
| '''established_title2''' || optional || Example: Incorporated (city)
|- style="vertical-align:top;"
| '''established_date2''' || optional || Requires established_title2=
|- style="vertical-align:top;"
| '''established_title3''' || optional ||
|- style="vertical-align:top;"
| '''established_date3''' || optional || Requires established_title3=
|- style="vertical-align:top;"
| '''established_title4''' || optional ||
|- style="vertical-align:top;"
| '''established_date4''' || optional || Requires established_title4=
|- style="vertical-align:top;"
| '''established_title5''' || optional ||
|- style="vertical-align:top;"
| '''established_date5''' || optional || Requires established_title5=
|- style="vertical-align:top;"
| '''established_title6''' || optional ||
|- style="vertical-align:top;"
| '''established_date6''' || optional || Requires established_title6=
|- style="vertical-align:top;"
| '''established_title7''' || optional ||
|- style="vertical-align:top;"
| '''established_date7''' || optional || Requires established_title7=
|- style="vertical-align:top;"
| '''extinct_title''' || optional || For when a settlement ceases to exist
|- style="vertical-align:top;"
| '''extinct_date''' || optional || Requires extinct_title=
|- style="vertical-align:top;"
| '''founder''' || optional || Who the settlement was founded by
|- style="vertical-align:top;"
| '''named_for''' || optional || The source of the name of the settlement (a person, a place, et cetera)
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Seat of government
|- style="vertical-align:top;"
| '''seat_type''' || optional || The label for the seat of government (defaults to ''Seat'').
|- style="vertical-align:top;"
| '''seat''' || optional || The seat of government.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Smaller parts (e.g. boroughs of a city)
|- style="vertical-align:top;"
| '''parts_type''' || optional || The label for the smaller subdivisions (defaults to ''Boroughs'').
|- style="vertical-align:top;"
| '''parts_style''' || optional || Set to ''list'' to display as a collapsible list, ''coll'' as a collapsed list, or ''para'' to use paragraph style. Default is ''list'' for up to 5 items, otherwise ''coll''.
|- style="vertical-align:top;"
| '''parts''' || optional || Text or header of the list of smaller subdivisions.
|- style="vertical-align:top;"
| '''p1'''<br />'''p2'''<br />to<br />'''p50''' || optional || The smaller subdivisions to be listed. Example: [[Warsaw]]
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Government type, leaders
|- style="vertical-align:top;"
| '''government_footnotes''' || optional || Reference(s) for government, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''government_type''' || optional || Examples: [[Mayor–council government]], [[Council–manager government]], [[City commission government]], ...
|- style="vertical-align:top;"
| '''governing_body''' || optional || Name of the place's governing body
|- style="vertical-align:top;"
| '''leader_party''' || optional || Political party of the place's leader
|- style="vertical-align:top;"
| '''leader_title''' || optional || First title of the place's leader, e.g. Mayor
|- style="vertical-align:top;"
| '''leader_name''' || optional || Name of the place's leader
|- style="vertical-align:top;"
| '''leader_title1'''<br />to<br />'''leader_title4''' || optional ||
|- style="vertical-align:top;"
| '''leader_name1'''<br />to<br />'''leader_name4''' || optional || For long lists use {{tl|Collapsible list}}. See [[Halifax Regional Municipality|Halifax]] for an example.
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Geographic information===
|- style="vertical-align:top;"
| colspan=3 | These fields have '''dual automatic unit conversion''' meaning that if only metric values are entered, the imperial values will be automatically converted and vice versa. If an editor wishes to over-ride the automatic conversion, e.g. if the source gives both metric and imperial or if a range of values is needed, they should enter both values in their respective fields. All values must be entered in a '''raw format: no commas, spaces, or unit symbols'''. The template will format them automatically.
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Display settings
|- style="vertical-align:top;"
| '''total_type''' || optional || Specifies what "total" area and population figure refer to, e.g. ''Greater London''. This overrides other labels for total population/area. To make the total area and population display on the same line as the words "Area" and "Population", with no "Total" or similar label, set the value of this parameter to '''&nbsp;'''.
|- style="vertical-align:top;"
| '''unit_pref''' || optional || To change the unit order to ''imperial (metric)'', enter '''imperial'''. The default display style is ''metric (imperial)''. However, the template will swap the order automatically if the '''subdivision_name''' equals some variation of the US or the UK.<br />For the Middle East, a unit preference of [[dunam]] can be entered (only affects total area). <br />
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Area
|- style="vertical-align:top;"
| '''area_footnotes''' || optional || Reference(s) for area, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''dunam_link''' || optional || If dunams are used, the default is to link the word ''dunams'' in the total area section. This can be changed by setting <code>dunam_link</code> to another measure (e.g. <code>dunam_link=water</code>). Linking can also be turned off by setting the parameter to something else (e.g. <code>dunam_link=none</code> or <code>dunam_link=off</code>).
|- style="vertical-align:top;"
| '''area_total_km2''' || optional || Total area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_total_sq_mi is empty.
|- style="vertical-align:top;"
| '''area_total_ha''' || optional || Total area in hectares—symbol: ha. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display acres if area_total_acre is empty.
|- style="vertical-align:top;"
| '''area_total_sq_mi''' || optional || Total area in square miles—symbol: sq mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_total_km2 is empty.
|- style="vertical-align:top;"
| '''area_total_acre''' || optional || Total area in acres. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display hectares if area_total_ha is empty.
|- style="vertical-align:top;"
| '''area_total_dunam''' || optional || Total area in dunams, which is wiki-linked. Used in middle eastern places like Israel, Gaza, and the West Bank. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers or hectares and square miles or acreds if area_total_km2, area_total_ha, area_total_sq_mi, and area_total_acre are empty. Examples: [[Gaza City|Gaza]] and [[Ramallah]]
|- style="vertical-align:top;"
| '''area_land_km2''' || optional || Land area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_land_sq_mi is empty.
|- style="vertical-align:top;"
| '''area_land_sq_mi''' || optional || Land area in square miles—symbol: sq mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_land_km2 is empty.
|- style="vertical-align:top;"
| '''area_land_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_land_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_land_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_water_km2''' || optional || Water area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_water_sq_mi is empty.
|- style="vertical-align:top;"
| '''area_water_sq_mi''' || optional || Water area in square miles—symbol: sq mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_water_km2 is empty.
|- style="vertical-align:top;"
| '''area_water_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_water_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_water_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_water_percent''' || optional || percent of water without the "%"
|- style="vertical-align:top;"
| '''area_urban_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_urban_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_urban_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_urban_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_urban_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_rural_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_rural_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_rural_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_rural_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_rural_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_metro_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_metro_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_metro_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_metro_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_metro_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_rank''' || optional || The settlement's area, as ranked within its parent sub-division
|- style="vertical-align:top;"
| '''area_blank1_title''' || optional || Example see London
|- style="vertical-align:top;"
| '''area_blank1_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_blank1_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_blank1_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_blank1_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_blank1_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_blank2_title''' || optional ||
|- style="vertical-align:top;"
| '''area_blank2_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_blank2_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_blank2_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_blank2_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_blank2_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_note''' || optional || A place for additional information such as the name of the source.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Dimensions
|- style="vertical-align:top;"
| '''dimensions_footnotes''' || optional || Reference(s) for dimensions, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''length_km''' || optional || Raw number entered in kilometers. Will automatically convert to display length in miles if length_mi is empty.
|- style="vertical-align:top;"
| '''length_mi''' || optional || Raw number entered in miles. Will automatically convert to display length in kilometers if length_km is empty.
|- style="vertical-align:top;"
| '''width_km''' || optional || Raw number entered in kilometers. Will automatically convert to display width in miles if length_mi is empty.
|- style="vertical-align:top;"
| '''width_mi''' || optional || Raw number entered in miles. Will automatically convert to display width in kilometers if length_km is empty.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Elevation
|- style="vertical-align:top;"
| '''elevation_footnotes''' || optional || Reference(s) for elevation, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''elevation_m''' || optional || Raw number entered in meters. Will automatically convert to display elevation in feet if elevation_ft is empty. However, if a range in elevation (i.e. 5–50 m ) is desired, use the "max" and "min" fields below
|- style="vertical-align:top;"
| '''elevation_ft''' || optional || Raw number, entered in feet. Will automatically convert to display the average elevation in meters if '''elevation_m''' field is empty. However, if a range in elevation (e.g. 50–500 ft ) is desired, use the "max" and "min" fields below
|- style="vertical-align:top;"
| '''elevation_max_footnotes'''<br />'''elevation_min_footnotes''' || optional || Same as above, but for the "max" and "min" elevations. See [[City of Leeds]].
|- style="vertical-align:top;"
| '''elevation_max_m'''<br />'''elevation_max_ft'''<br />'''elevation_max_rank'''<br />'''elevation_min_m'''<br />'''elevation_min_ft'''<br />'''elevation_min_rank''' || optional || Used to give highest & lowest elevations and rank, instead of just a single value. Example: [[Halifax Regional Municipality]].
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Population, demographics===
|- style="vertical-align:top;"
| colspan=3 | The density fields have '''dual automatic unit conversion''' meaning that if only metric values are entered, the imperial values will be automatically converted and vice versa. If an editor wishes to over-ride the automatic conversion, e.g. if the source gives both metric and imperial or if a range of values is needed, they can enter both values in their respective fields. '''To calculate density with respect to the total area automatically, type ''auto'' in place of any density value.'''
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Population
|- style="vertical-align:top;"
| '''population_total''' || optional || Actual population (see below for estimates) preferably consisting of digits only (without any commas)
|- style="vertical-align:top;"
| '''population_as_of''' || optional || The year for the population total (usually a census year)
|- style="vertical-align:top;"
| '''population_footnotes''' || optional || Reference(s) for population, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_density_km2''' || optional || Set to {{code|auto}} to auto generate based on {{para|population_total}} and {{para|area_total_km2}}
|- style="vertical-align:top;"
| '''population_density_sq_mi''' || optional || Set to {{code|auto}} to auto generate based on {{para|population_total}} and {{para|area_total_sq_mi}}
|- style="vertical-align:top;"
| '''population_est''' || optional || Population estimate
|- style="vertical-align:top;"
| '''pop_est_as_of''' || optional || The year or month & year of the population estimate
|- style="vertical-align:top;"
| '''pop_est_footnotes''' || optional || Reference(s) for population estimate, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_urban''' || optional ||
|- style="vertical-align:top;"
| '''population_urban_footnotes''' || optional || Reference(s) for urban population, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_density_urban_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_urban_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_rural''' || optional ||
|- style="vertical-align:top;"
| '''population_rural_footnotes''' || optional || Reference(s) for rural population, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_density_rural_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_rural_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_metro''' || optional ||
|- style="vertical-align:top;"
| '''population_metro_footnotes''' || optional || Reference(s) for metro population, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_density_metro_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_metro_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_rank''' || optional || The settlement's population, as ranked within its parent sub-division
|- style="vertical-align:top;"
| '''population_density_rank''' || optional || The settlement's population density, as ranked within its parent sub-division
|- style="vertical-align:top;"
| '''population_blank1_title''' || optional || Can be used for estimates. Example: [[Windsor, Ontario]]
|- style="vertical-align:top;"
| '''population_blank1''' || optional || The population value for blank1_title
|- style="vertical-align:top;"
| '''population_density_blank1_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_blank1_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_blank2_title''' || optional ||
|- style="vertical-align:top;"
| '''population_blank2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_blank2_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_blank2_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_demonym''' || optional || A demonym or gentilic is a word that denotes the members of a people or the inhabitants of a place. For example, a citizen in [[Liverpool]] is known as a [[Liverpudlian]].
|- style="vertical-align:top;"
| '''population_demonyms''' || optional || If more than one demonym, use this
|- style="vertical-align:top;"
| '''population_note''' || optional || A place for additional information such as the name of the source. See [[Windsor, Ontario]] for example.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Demographics (section 1)
|- style="vertical-align:top;"
| '''demographics_type1''' || optional || Section Header. For example: Ethnicity
|- style="vertical-align:top;"
| '''demographics1_footnotes''' || optional || Reference(s) for demographics section 1, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''demographics1_title1'''<br />to<br />'''demographics1_title7''' || optional || Titles related to demographics_type1. For example: White, Black, Hispanic...
|- style="vertical-align:top;"
| '''demographics1_info1'''<br />to<br />'''demographics1_info7''' || optional || Information related to the "titles". For example: 50%, 25%, 10%...
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Demographics (section 2)
|- style="vertical-align:top;"
| '''demographics_type2''' || optional || A second section header. For example: Languages
|- style="vertical-align:top;"
| '''demographics2_footnotes''' || optional || Reference(s) for demographics section 2, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''demographics2_title1'''<br />to<br />'''demographics2_title10''' || optional || Titles related to demographics_type2. For example: English, French, Arabic...
|- style="vertical-align:top;"
| '''demographics2_info1'''<br />to<br />'''demographics2_info10''' || optional || Information related to the "titles" for type2. For example: 50%, 25%, 10%...
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Other information===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Time zone(s)
|- style="vertical-align:top;"
| '''time_zone1''' || optional ||
|- style="vertical-align:top;"
| '''utc_offset1''' || optional || Plain text, e.g. "+05:00" or "−08:00". Auto-linked, so do not include references or additional text.
|- style="vertical-align:top;"
| '''time_zone1_DST''' || optional ||
|- style="vertical-align:top;"
| '''utc_offset1_DST''' || optional ||
|- style="vertical-align:top;"
| '''time_zone2''' || optional || A second time zone field for larger areas. Up to five time zones may be included.
|- style="vertical-align:top;"
| '''utc_offset2''' || optional ||
|- style="vertical-align:top;"
| '''time_zone2_DST''' || optional ||
|- style="vertical-align:top;"
| '''utc_offset2_DST''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Postal code(s) & area code
|- style="vertical-align:top;"
| '''postal_code_type''' || optional ||
|- style="vertical-align:top;"
| '''postal_code''' || optional ||
|- style="vertical-align:top;"
| '''postal2_code_type''' || optional ||
|- style="vertical-align:top;"
| '''postal2_code''' || optional ||
|- style="vertical-align:top;"
| '''area_code_type''' || optional || If left blank/not used template will default to "[[Telephone numbering plan|Area code(s)]]"
|- style="vertical-align:top;"
| '''area_code''' || optional || Refers to the telephone dialing code for the settlement, ''not'' a geographic area code.
|- style="vertical-align:top;"
| '''area_codes''' || optional || If more than one area code, use this
|- style="vertical-align:top;"
| '''geocode''' || optional || See [[Geocode]]
|- style="vertical-align:top;"
| '''iso_code''' || optional || See [[ISO 3166]]
|- style="vertical-align:top;"
| '''registration_plate_type''' || optional || If left blank/not used template will default to "[[Vehicle registration plate|Vehicle registration]]"
|- style="vertical-align:top;"
| '''registration_plate''' || optional || See [[Vehicle registration plate]]
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Custom fields (section 1)
|- style="vertical-align:top;"
| '''custom_label_sec1''' || optional || Fields used to display other information. The name is displayed in bold on the left side of the infobox.
|- style="vertical-align:top;"
| '''custom_data_sec1''' || optional || The information associated with the ''blank_name'' heading. The info is displayed on right side of infobox, in the same row as the name. For an example, see: [[Warsaw]]
|- style="vertical-align:top;"
| '''custom_label1_sec1'''<br />to<br />'''custom_label7_sec1''' || optional || Up to 7 additional fields (8 total) can be displayed in this section
|- style="vertical-align:top;"
| '''custom_data1_sec1'''<br />to<br />'''custom_data7_sec1''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Custom fields (section 2)
|- style="vertical-align:top;"
| '''custom_label_sec2''' || optional || For a second section of custom fields
|- style="vertical-align:top;"
| '''custom_data_sec2''' || optional || Example: [[Beijing]]
|- style="vertical-align:top;"
| '''custom_label1_sec2'''<br />to<br />'''custom_label7_sec2''' || optional || Up to 7 additional fields (8 total) can be displayed in this section
|- style="vertical-align:top;"
| '''custom_data1_sec2'''<br />to<br />'''custom_data7_sec2''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Website, footnotes
|- style="vertical-align:top;"
| '''website''' || optional || External link to official website, use {{Tl|Official URL}} if Property P856 "official website" exists on Wikidata, or <nowiki>{{URL|example.com}}</nowiki>
|- style="vertical-align:top;"
| '''module''' || optional || To embed infoboxes at the bottom of the infobox
|- style="vertical-align:top;"
| '''footnotes''' || optional || Text to be displayed at the bottom of the infobox
|}
<!-- End of parameter name/description table -->
<section end=parameters />
==Examples==
;Example 1:
<!-- NOTE: This differs from the actual Chicago infobox in order to provide examples. -->
{{Infobox settlement
| name = Chicago
| type = [[City (Illinois)|City]]
| image = Chicago montage.jpg
| image_size = 275px <!--default is 250px-->
| caption = Clockwise from top: [[Downtown Chicago]], the [[Chicago Theatre]], the [[Chicago 'L']], [[Navy Pier]], [[Millennium Park]], the [[Field Museum]], and the [[Willis Tower|Willis (formerly Sears) Tower]]
| image_flag = Flag of Chicago, Illinois.svg
| image_seal =
| etymology = {{langx|mia|shikaakwa}} ("wild onion" or "wild garlic")
| nickname = [[Origin of Chicago's "Windy City" nickname|The Windy City]], The Second City, Chi-Town, Chi-City, Hog Butcher for the World, City of the Big Shoulders, The City That Works, and others found at [[List of nicknames for Chicago]]
| motto = {{langx|la|Urbs in Horto}} (City in a Garden), Make Big Plans (Make No Small Plans), I Will
| image_map = US-IL-Chicago.png
| map_caption = Location in the [[Chicago metropolitan area]] and Illinois
| pushpin_map = USA
| pushpin_caption = Location in the United States
| mapframe = yes
| mapframe-zoom = 8
| mapframe-stroke-width = 1
| mapframe-shape-fill = #0096ff
| mapframe-marker = building-alt1
| mapframe-wikidata = yes
| mapframe-id = Q1297
| coordinates = {{coord|41|50|15|N|87|40|55|W}}
| coordinates_footnotes = <ref name="USCB Gazetteer 2010"/>
| subdivision_type = Country
| subdivision_name = United States
| subdivision_type1 = State
| subdivision_name1 = [[Illinois]]
| subdivision_type2 = [[List of counties in Illinois|Counties]]
| subdivision_name2 = [[Cook County, Illinois|Cook]], [[DuPage County, Illinois|DuPage]]
| established_title = Settled
| established_date = 1770s
| established_title2 = [[Municipal corporation|Incorporated]]
| established_date2 = March 4, 1837
| founder =
| named_for = {{langx|mia|shikaakwa}}<br /> ("Wild onion")
| government_type = [[Mayor–council government|Mayor–council]]
| leader_title = [[Mayor of Chicago|Mayor]]
| leader_name = [[Rahm Emanuel]]
| leader_party = [[Democratic Party (United States)|D]]
| leader_title1 = [[City council|Council]]
| leader_name1 = [[Chicago City Council]]
| unit_pref = Imperial
| area_footnotes = <ref name="USCB Gazetteer 2010">{{cite web | url = https://www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt | title = 2010 United States Census Gazetteer for Places: January 1, 2010 | format = text | work = 2010 United States Census | publisher = [[United States Census Bureau]] | date = April 2010 | access-date = August 1, 2012}}</ref>
| area_total_sq_mi = 234.114
| area_land_sq_mi = 227.635
| area_water_sq_mi = 6.479
| area_water_percent = 3
| area_urban_sq_mi = 2123
| area_metro_sq_mi = 10874
| elevation_footnotes = <ref name="GNIS"/>
| elevation_ft = 594
| elevation_m = 181
| population_footnotes = <ref name="USCB PopEstCities 2011">{{cite web | url = https://www.census.gov/popest/data/cities/totals/2011/tables/SUB-EST2011-01.csv | title = Annual Estimates of the Resident Population for Incorporated Places Over 50,000, Ranked by July 1, 2011 Population | format = [[comma-separated values|CSV]] | work = 2011 Population Estimates | publisher = [[United States Census Bureau]], Population Division | date = June 2012 | access-date = August 1, 2012}}</ref><ref name="USCB Metro 2010">{{cite web | url=https://www.census.gov/prod/cen2010/briefs/c2010br-01.pdf | title = Population Change for the Ten Most Populous and Fastest Growing Metropolitan Statiscal Areas: 2000 to 2010 | date = March 2011 | publisher = [[U.S. Census Bureau]] | page = 6 |access-date = April 12, 2011}}</ref>
| population_as_of = [[2010 United States census|2010]]
| population_total = 2695598
| pop_est_footnotes =
| pop_est_as_of = 2011
| population_est = 2707120
| population_rank = [[List of United States cities by population|3rd US]]
| population_density_sq_mi = 11,892.4<!-- 2011 population_est / area_land_sq_mi -->
| population_urban = 8711000
| population_density_urban_sq_mi = auto
| population_metro = 9461105
| population_density_metro_sq_mi = auto
| population_demonym = Chicagoan
| time_zone = [[Central Standard Time|CST]]
| utc_offset = −06:00
| time_zone_DST = [[Central Daylight Time|CDT]]
| utc_offset_DST = −05:00
| area_code_type = [[North American Numbering Plan|Area codes]]
| area_codes = [[Area code 312|312]], [[Area code 773|773]], [[Area code 872|872]]
| custom_label_sec1 = [[Federal Information Processing Standards|FIPS]] code
| custom_data_sec1 = {{FIPS|17|14000}}
| custom_label1_sec1 = [[Geographic Names Information System|GNIS]] feature ID
| custom_data1_sec1 = {{GNIS 4|423587}}, {{GNIS 4|428803}}
| website = {{URL|www.cityofchicago.org}}
| footnotes = <ref name="GNIS">{{Cite gnis|428803|City of Chicago|April 12, 2011}}</ref>
}}
<syntaxhighlight lang="wikitext" style="overflow:auto; white-space: pre-wrap;">
<!-- NOTE: This differs from the actual Chicago infobox in order to provide examples. -->
{{Infobox settlement
| name = Chicago
| type = [[City (Illinois)|City]]
| image = Chicago montage.jpg
| image_size = 275px <!--default is 250px-->
| caption = Clockwise from top: [[Downtown Chicago]], the [[Chicago Theatre]], the [[Chicago 'L']], [[Navy Pier]], [[Millennium Park]], the [[Field Museum]], and the [[Willis Tower|Willis (formerly Sears) Tower]]
| image_flag = Flag of Chicago, Illinois.svg
| image_seal =
| etymology = {{langx|mia|shikaakwa}} ("wild onion" or "wild garlic")
| nickname = [[Origin of Chicago's "Windy City" nickname|The Windy City]], The Second City, Chi-Town, Chi-City, Hog Butcher for the World, City of the Big Shoulders, The City That Works, and others found at [[List of nicknames for Chicago]]
| motto = {{langx|la|Urbs in Horto}} (City in a Garden), Make Big Plans (Make No Small Plans), I Will
| image_map = US-IL-Chicago.png
| map_caption = Location in the [[Chicago metropolitan area]] and Illinois
| pushpin_map = USA
| pushpin_caption = Location in the United States
| mapframe = yes
| mapframe-zoom = 8
| mapframe-stroke-width = 1
| mapframe-shape-fill = #0096ff
| mapframe-marker = building-alt1
| coordinates = {{coord|41|50|15|N|87|40|55|W}}
| coordinates_footnotes = <ref name="USCB Gazetteer 2010"/>
| subdivision_type = Country
| subdivision_name = United States
| subdivision_type1 = State
| subdivision_name1 = [[Illinois]]
| subdivision_type2 = [[List of counties in Illinois|Counties]]
| subdivision_name2 = [[Cook County, Illinois|Cook]], [[DuPage County, Illinois|DuPage]]
| established_title = Settled
| established_date = 1770s
| established_title2 = [[Municipal corporation|Incorporated]]
| established_date2 = March 4, 1837
| founder =
| named_for = {{langx|mia|shikaakwa}}<br /> ("Wild onion")
| government_type = [[Mayor–council government|Mayor–council]]
| leader_title = [[Mayor of Chicago|Mayor]]
| leader_name = [[Rahm Emanuel]]
| leader_party = [[Democratic Party (United States)|D]]
| leader_title1 = [[City council|Council]]
| leader_name1 = [[Chicago City Council]]
| unit_pref = Imperial
| area_footnotes = <ref name="USCB Gazetteer 2010">{{cite web | url = https://www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt | title = 2010 United States Census Gazetteer for Places: January 1, 2010 | format = text | work = 2010 United States Census | publisher = [[United States Census Bureau]] | date = April 2010 | access-date = August 1, 2012}}</ref>
| area_total_sq_mi = 234.114
| area_land_sq_mi = 227.635
| area_water_sq_mi = 6.479
| area_water_percent = 3
| area_urban_sq_mi = 2123
| area_metro_sq_mi = 10874
| elevation_footnotes = <ref name="GNIS"/>
| elevation_ft = 594
| elevation_m = 181
| population_footnotes = <ref name="USCB PopEstCities 2011">{{cite web | url = https://www.census.gov/popest/data/cities/totals/2011/tables/SUB-EST2011-01.csv | title = Annual Estimates of the Resident Population for Incorporated Places Over 50,000, Ranked by July 1, 2011 Population | format = [[comma-separated values|CSV]] | work = 2011 Population Estimates | publisher = [[United States Census Bureau]], Population Division | date = June 2012 | access-date = August 1, 2012}}</ref><ref name="USCB Metro 2010">{{cite web | url=https://www.census.gov/prod/cen2010/briefs/c2010br-01.pdf | title = Population Change for the Ten Most Populous and Fastest Growing Metropolitan Statiscal Areas: 2000 to 2010 | date = March 2011 | publisher = [[U.S. Census Bureau]] | page = 6 |access-date = April 12, 2011}}</ref>
| population_as_of = [[2010 United States census|2010]]
| population_total = 2695598
| pop_est_footnotes =
| pop_est_as_of = 2011
| population_est = 2707120
| population_rank = [[List of United States cities by population|3rd US]]
| population_density_sq_mi = 11,892.4<!-- 2011 population_est / area_land_sq_mi -->
| population_urban = 8711000
| population_density_urban_sq_mi = auto
| population_metro = 9461105
| population_density_metro_sq_mi = auto
| population_demonym = Chicagoan
| time_zone = [[Central Standard Time|CST]]
| utc_offset = −06:00
| time_zone_DST = [[Central Daylight Time|CDT]]
| utc_offset_DST = −05:00
| area_code_type = [[North American Numbering Plan|Area codes]]
| area_codes = [[Area code 312|312]], [[Area code 773|773]], [[Area code 872|872]]
| custom_label_sec1 = [[Federal Information Processing Standards|FIPS]] code
| custom_data_sec1 = {{FIPS|17|14000}}
| custom_label1_sec1 = [[Geographic Names Information System|GNIS]] feature ID
| custom_data1_sec1 = {{GNIS 4|423587}}, {{GNIS 4|428803}}
| website = {{URL|www.cityofchicago.org}}
| footnotes = <ref name="GNIS">{{Cite gnis|428803|City of Chicago|April 12, 2011}}</ref>
}}
</syntaxhighlight>
'''References'''
{{reflist}}
{{clear}}
----
;Example 2:
{{Infobox settlement
| name = Detroit
| type = [[City (Michigan)|City]]
| image = Detroit Montage.jpg
| image_size = 290px
| caption = Images from top to bottom, left to right: [[Downtown Detroit]] skyline, [[Spirit of Detroit]], [[Greektown Historic District|Greektown]], [[Ambassador Bridge]], [[Michigan Soldiers' and Sailors' Monument]], [[Fox Theatre (Detroit)|Fox Theatre]], and [[Comerica Park]].
| image_flag = Flag of Detroit.svg
| image_seal = Seal of Detroit.svg
| etymology = {{langx|fr|détroit}} ([[strait]])
| nickname = The Motor City, Motown, Renaissance City, The D, Hockeytown, The Automotive Capital of the World, Rock City, The 313
| motto = ''Speramus Meliora; Resurget Cineribus''<br />([[Latin]]: We Hope For Better Things; It Shall Rise From the Ashes)
| image_map = Wayne County Michigan Incorporated and Unincorporated areas Detroit highlighted.svg
| map_size = 250x200px
| map_caption = Location within [[Wayne County, Michigan|Wayne County]] and the state of [[Michigan]]
| pushpin_map = USA
| pushpin_caption = Location within the [[contiguous United States]]
| mapframe = yes
| mapframe-stroke-width = 1
| mapframe-marker = city
| mapframe-zoom = 9
| mapframe-wikidata = yes
| mapframe-id = Q12439
| coordinates = {{coord|42|19|53|N|83|2|45|W}}
| coordinates_footnotes =
| subdivision_type = Country
| subdivision_name = United States
| subdivision_type1 = State
| subdivision_name1 = [[Michigan]]
| subdivision_type2 = [[List of counties in Michigan|County]]
| subdivision_name2 = [[Wayne County, Michigan|Wayne]]
| established_title = Founded
| established_date = 1701
| established_title2 = Incorporated
| established_date2 = 1806
| government_footnotes = <!-- for references: use<ref> tags -->
| government_type = [[Mayor–council government|Mayor–council]]
| leader_title = [[List of mayors of Detroit|Mayor]]
| leader_name = [[Mike Duggan]]
| leader_party = [[Democratic Party (United States)|D]]
| leader_title1 = [[Detroit City Council|City Council]]
| leader_name1 = {{collapsible list|bullets=yes
| title = Members
| 1 = [[Charles Pugh]] – Council President
| 2 = [[Gary Brown (Detroit politician)|Gary Brown]] – Council President Pro-Tem
| 3 = [[JoAnn Watson]]
| 4 = [[Kenneth Cockrel, Jr.]]
| 5 = [[Saunteel Jenkins]]
| 6 = [[Andre Spivey]]
| 7 = [[James Tate (Detroit politician)|James Tate]]
| 8 = [[Brenda Jones (Detroit politician)|Brenda Jones]]
| 9 = [[Kwame Kenyatta]]
}}
| unit_pref = Imperial
| area_footnotes =
| area_total_sq_mi = 142.87
| area_total_km2 = 370.03
| area_land_sq_mi = 138.75
| area_land_km2 = 359.36
| area_water_sq_mi = 4.12
| area_water_km2 = 10.67
| area_urban_sq_mi = 1295
| area_metro_sq_mi = 3913
| elevation_footnotes =
| elevation_ft = 600
| population_footnotes =
| population_as_of = 2011
| population_total = 706585
| population_rank = [[List of United States cities by population|18th in U.S.]]
| population_urban = 3863924
| population_metro = 4285832 (US: [[List of United States metropolitan statistical areas|13th]])
| population_blank1_title = [[Combined statistical area|CSA]]
| population_blank1 = 5207434 (US: [[List of United States combined statistical areas|11th]])
| population_density_sq_mi = {{#expr:713777/138.8 round 0}}
| population_demonym = Detroiter
| population_note =
| time_zone = [[Eastern Time Zone (North America)|EST]]
| utc_offset = −5
| time_zone_DST = [[Eastern Daylight Time|EDT]]
| utc_offset_DST = −4
| postal_code_type =
| postal_code =
| area_code = [[Area code 313|313]]
| custom_label_sec1 = [[Federal Information Processing Standards|FIPS code]]
| custom_data_sec1 = {{FIPS|26|22000}}
| custom_label1_sec1 = [[Geographic Names Information System|GNIS]] feature ID
| custom_data1_sec1 = {{GNIS 4|1617959}}, {{GNIS 4|1626181}}
| website = [http://www.detroitmi.gov/ DetroitMI.gov]
| footnotes =
}}
<syntaxhighlight lang="wikitext" style="overflow:auto; white-space: pre-wrap;">
{{Infobox settlement
| name = Detroit
| type = [[City (Michigan)|City]]
| image = Detroit Montage.jpg
| image_size = 290px
| caption = Images from top to bottom, left to right: [[Downtown Detroit]] skyline, [[Spirit of Detroit]], [[Greektown Historic District|Greektown]], [[Ambassador Bridge]], [[Michigan Soldiers' and Sailors' Monument]], [[Fox Theatre (Detroit)|Fox Theatre]], and [[Comerica Park]].
| image_flag = Flag of Detroit, Michigan.svg
| image_seal = Seal of Detroit, Michigan.svg
| etymology = {{langx|fr|détroit}} ([[strait]])
| nickname = The Motor City, Motown, Renaissance City, The D, Hockeytown, The Automotive Capital of the World, Rock City, The 313
| motto = ''Speramus Meliora; Resurget Cineribus''<br />([[Latin]]: We Hope For Better Things; It Shall Rise From the Ashes)
| image_map = Wayne County Michigan Incorporated and Unincorporated areas Detroit highlighted.svg
| map_size = 250x200px
| map_caption = Location within [[Wayne County, Michigan|Wayne County]] and the state of [[Michigan]]
| pushpin_map = USA
| pushpin_caption = Location within the [[contiguous United States]]
| mapframe = yes
| mapframe-stroke-width = 1
| mapframe-marker = city
| mapframe-zoom = 9
| coordinates = {{coord|42|19|53|N|83|2|45|W}}
| coordinates_footnotes =
| subdivision_type = Country
| subdivision_name = United States
| subdivision_type1 = State
| subdivision_name1 = Michigan
| subdivision_type2 = [[List of counties in Michigan|County]]
| subdivision_name2 = [[Wayne County, Michigan|Wayne]]
| established_title = Founded
| established_date = 1701
| established_title2 = Incorporated
| established_date2 = 1806
| government_footnotes = <!-- for references: use<ref> tags -->
| government_type = [[Mayor-council government|Mayor-Council]]
| leader_title = [[List of mayors of Detroit|Mayor]]
| leader_name = [[Mike Duggan]]
| leader_party = [[Democratic Party (United States)|D]]
| leader_title1 = [[Detroit City Council|City Council]]
| leader_name1 = {{collapsible list|bullets=yes
| title = Members
| 1 = [[Charles Pugh]] – Council President
| 2 = [[Gary Brown (Detroit politician)|Gary Brown]] – Council President Pro-Tem
| 3 = [[JoAnn Watson]]
| 4 = [[Kenneth Cockrel, Jr.]]
| 5 = [[Saunteel Jenkins]]
| 6 = [[Andre Spivey]]
| 7 = [[James Tate (Detroit politician)|James Tate]]
| 8 = [[Brenda Jones (Detroit politician)|Brenda Jones]]
| 9 = [[Kwame Kenyatta]]
}}
| unit_pref = Imperial
| area_footnotes =
| area_total_sq_mi = 142.87
| area_total_km2 = 370.03
| area_land_sq_mi = 138.75
| area_land_km2 = 359.36
| area_water_sq_mi = 4.12
| area_water_km2 = 10.67
| area_urban_sq_mi = 1295
| area_metro_sq_mi = 3913
| elevation_footnotes =
| elevation_ft = 600
| population_footnotes =
| population_as_of = 2011
| population_total = 706585
| population_rank = [[List of United States cities by population|18th in U.S.]]
| population_urban = 3863924
| population_metro = 4285832 (US: [[List of United States metropolitan statistical areas|13th]])
| population_blank1_title = [[Combined statistical area|CSA]]
| population_blank1 = 5207434 (US: [[List of United States combined statistical areas|11th]])
| population_density_sq_mi = {{#expr:713777/138.8 round 0}}
| population_demonym = Detroiter
| population_note =
| time_zone = [[Eastern Time Zone (North America)|EST]]
| utc_offset = −5
| time_zone_DST = [[Eastern Daylight Time|EDT]]
| utc_offset_DST = −4
| postal_code_type =
| postal_code =
| area_code = [[Area code 313|313]]
| custom_label_sec1 = [[Federal Information Processing Standards|FIPS code]]
| custom_data_sec1 = {{FIPS|26|22000}}
| custom_label1_sec1 = [[Geographic Names Information System|GNIS]] feature ID
| custom_data1_sec1 = {{GNIS 4|1617959}}, {{GNIS 4|1626181}}
| website = [http://www.detroitmi.gov/ DetroitMI.gov]
| footnotes =
}}
</syntaxhighlight>
{{clear}}
==Supporting templates==
The following is a list of sub-templates used by Infobox settlement. See the [{{fullurl:Special:PrefixIndex|prefix=Infobox+settlement%2F&namespace=10&hideredirects=1}} current list of all sub-templates] for documentation, sandboxes, testcases, etc.
* {{tl|Infobox settlement/areadisp}}
* {{tl|Infobox settlement/densdisp}}
* {{tl|Infobox settlement/lengthdisp}}
* {{tl|Infobox settlement/link}}
==Microformat==
{{UF-hcard-geo}}
== TemplateData ==
{{TemplateData header}}
{{collapse top|title=TemplateData}}
<templatedata>
{
"description": "Infobox for human settlements (cities, towns, villages, communities) as well as other administrative districts, counties, provinces, etc.",
"format": "block",
"params": {
"name": {
"label": "Common name",
"description": "This is the usual name in English. If it's not specified, the infobox will use the 'official_name' as a title unless this too is missing, in which case the page name will be used.",
"type": "string",
"suggested": true
},
"native_name": {
"label": "Native name",
"description": "This will display under the name/official name.",
"type": "string",
"example": "Distrito Federal de México"
},
"native_name_lang": {
"label": "Native name language",
"description": "Use ISO 639-1 code, e.g. 'fr' for French. If there is more than one native name in different languages, enter those names using {{lang}} instead.",
"type": "string",
"example": "zh"
},
"other_name": {
"label": "Other name",
"description": "For places with other commonly used names like Bombay or Saigon.",
"type": "string"
},
"type": {
"label": "Type of settlement",
"description": "Any type can be entered, such as 'City', 'Town', 'Village', 'Hamlet', 'Municipality', 'Reservation', etc. If set, will be displayed under the names, provided either 'name' or 'official_name' is filled in. Might also be used as a label for total population/area (defaulting to 'City'), if needed to distinguish from 'Urban', 'Rural' or 'Metro' (if urban, rural or metro figures are not present, the label is 'Total' unless 'total_type' is set).",
"type": "string"
},
"official_name": {
"label": "Official name",
"description": "The official name in English, if different from 'name'.",
"type": "string",
"suggested": true
},
"translit_lang1": {
"label": "Transliteration from language 1",
"description": "Will place the entry before the word 'transliteration(s)'. Can be used to specify a particular language, like in Dêlêg, or one may just enter 'Other', like in Gaza's article.",
"type": "string"
},
"translit_lang1_type": {
"label": "Transliteration type for language 1",
"type": "line",
"example": "[[Hanyu pinyin]]",
"description": "The type of transliteration used for the first language."
},
"translit_lang1_info": {
"label": "Transliteration language 1 info",
"description": "Parameters 'translit_lang2_info1' ... 'translit_lang2_info6' are also available, but not documented here.",
"type": "string"
},
"translit_lang2": {
"label": "Transliteration language 2",
"description": "Will place a second transliteration. See Dêlêg.",
"type": "string"
},
"image": {
"label": "Image",
"description": "Primary image representing the settlement. Commonly a photo of the settlement’s skyline.",
"type": "wiki-file-name"
},
"image_size": {},
"alt": {
"label": "Image alt text",
"description": "Alt (hover) text for the image, used by visually impaired readers who cannot see the image.",
"type": "string"
},
"caption": {
"label": "Image caption",
"description": "Will place a caption under 'image' (if present).",
"type": "content"
},
"image_flag": {
"label": "Flag image",
"description": "Used for a flag.",
"type": "wiki-file-name"
},
"flag_size": {
"label": "Flag size",
"description": "Can be used to tweak the size of 'image_flag' up or down from 100px as desired. If used, 'px' must be specified; default size is 100px.",
"type": "string"
},
"flag_alt": {
"label": "Flag alt text",
"description": "Alt text for the flag.",
"type": "string"
},
"flag_border": {
"label": "Flag border?",
"description": "Set to 'no' to remove the border from the flag.",
"type": "boolean",
"example": "no"
},
"flag_link": {
"label": "Flag link",
"type": "string",
"description": "Link to the flag."
},
"image_seal": {
"label": "Official seal image",
"description": "An image of an official seal, if the place has one.",
"type": "wiki-file-name"
},
"seal_size": {
"label": "Seal size",
"description": "If used, 'px' must be specified; default size is 100px.",
"type": "string"
},
"seal_alt": {
"label": "Seal alt text",
"description": "Alt (hover) text for the seal.",
"type": "string"
},
"seal_link": {
"label": "Seal link",
"type": "string",
"description": "Link to the seal."
},
"seal_class": {
"label": "Seal class",
"description": "CSS class for the seal image",
"type": "line",
"suggestedvalues": [
"skin-invert"
]
},
"image_shield": {
"label": "Coat of arms/shield image",
"description": "Can be used for a place with a coat of arms.",
"type": "wiki-file-name"
},
"shield_size": {
"label": "Shield size",
"description": "If used, 'px' must be specified; default size is 100px.",
"type": "string",
"example": "200px"
},
"shield_alt": {
"label": "Shield alt text",
"description": "Alternate text for the shield.",
"type": "string"
},
"shield_link": {
"label": "Shield link",
"description": "Can be used if a wiki article if known but is not automatically linked by the template. See Coquitlam, British Columbia's infobox for an example.",
"type": "string"
},
"image_blank_emblem": {
"label": "Blank emblem image",
"description": "Can be used if a place has an official logo, crest, emblem, etc.",
"type": "wiki-file-name"
},
"blank_emblem_type": {
"label": "Blank emblem type",
"description": "Caption beneath 'image_blank_emblem' to specify what type of emblem it is.",
"type": "string",
"example": "Logo"
},
"blank_emblem_size": {
"label": "Blank emblem size",
"description": "If used, 'px' must be specified; default size is 100px.",
"type": "string",
"example": "200px"
},
"blank_emblem_alt": {
"label": "Blank emblem alt text",
"description": "Alt text for blank emblem.",
"type": "string"
},
"blank_emblem_link": {
"label": "Blank emblem link",
"type": "string",
"description": "A link to the emblem of custom type."
},
"nickname": {
"label": "Nickname",
"description": "Well-known nickname(s).",
"type": "string",
"example": "Sin City"
},
"motto": {
"label": "Motto",
"description": "Will place the motto under the nicknames.",
"type": "string"
},
"anthem": {
"label": "Anthem",
"description": "Will place the anthem (song) under the nicknames.",
"type": "string",
"example": "[[Hatikvah]]"
},
"image_map": {
"label": "Map image",
"description": "A map of the region, or a map with the region highlighted within a parent region.",
"type": "wiki-file-name"
},
"map_size": {
"label": "Map size",
"description": "If used, 'px' must be specified; default is 250px.",
"type": "string"
},
"map_alt": {
"label": "Map alt text",
"description": "Alternate (hover) text for the map.",
"type": "string"
},
"map_caption": {
"label": "Map caption",
"type": "content",
"description": "Caption for the map displayed."
},
"image_map1": {
"label": "Map 2 image",
"description": "A secondary map image. The field 'image_map' must be filled in first. For an example, see [[Bloomsburg, Pennsylvania]].",
"example": "File:Columbia County Pennsylvania Incorporated and Unincorporated areas Bloomsburg Highlighted.svg",
"type": "wiki-file-name"
},
"map_size1": {
"label": "Map 2 size",
"description": "If used, 'px' must be specified; default is 250px.",
"type": "string",
"example": "300px"
},
"map_alt1": {
"label": "Map 2 alt text",
"description": "Alt (hover) text for the second map.",
"type": "string"
},
"map_caption1": {
"label": "Map 2 caption",
"type": "content",
"description": "Caption of the second map."
},
"pushpin_map": {
"label": "Pushpin map",
"description": "The name of a location map (e.g. 'Indonesia' or 'Russia'). The coordinates information (from the coordinates parameter) positions a pushpin coordinate marker and label on the map automatically. For an example, see Padang, Indonesia.",
"type": "string",
"example": "Indonesia"
},
"pushpin_map_size": {
"label": "Pushpin map size",
"description": "Must be entered as only a number—do not use 'px'. The default value is 250.",
"type": "number",
"example": "200"
},
"pushpin_alt": {
"label": "Pushpin map alt text",
"description": "Alt (hover) text for the pushpin map.",
"type": "string"
},
"pushpin_caption": {
"label": "Pushpin map caption",
"description": "Fill out if a different caption from 'map_caption' is desired.",
"type": "string",
"example": "Map showing Bloomsburg in Pennsylvania"
},
"pushpin_label": {
"label": "Pushpin label",
"type": "line",
"example": "Bloomsburg",
"description": "Label of the pushpin."
},
"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', and 'none'. If this field is not specified, the default value is 'right'.",
"type": "string",
"example": "left",
"default": "right"
},
"pushpin_relief": {
"label": "Pushpin relief",
"description": "Set this to 'y' or any non-blank value to use an alternative relief map provided by the selected location map (if a relief map is available).",
"type": "string",
"example": "y"
},
"coordinates": {
"label": "Coordinates",
"description": "Latitude and longitude. Use {{Coord}}. See the documentation for {{Coord}} for more details on usage.",
"type": "wiki-template-name",
"example": "{{coord|41|50|15|N|87|40|55|W}}"
},
"coor_pinpoint": {
"label": "Coordinate pinpoint",
"description": "If needed, to specify more exactly where (or what) coordinates are given (e.g. 'Town Hall') or a specific place in a larger area (e.g. a city in a county). Example: Masovian Voivodeship.",
"type": "string"
},
"coordinates_footnotes": {
"label": "Coordinates footnotes",
"description": "Reference(s) for coordinates. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"subdivision_type": {
"label": "Subdivision type 1",
"description": "Almost always 'Country'.",
"type": "string",
"example": "Country",
"suggestedvalues": [
"Country"
]
},
"subdivision_name": {
"label": "Subdivision name 1",
"description": "Depends on 'subdivision_type'. Use the name in text form, e.g., 'United States'. Per MOS:INFOBOXFLAG, flag icons or flag templates may be used in this field.",
"type": "string"
},
"subdivision_type1": {
"label": "Subdivision type 2",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type2": {
"label": "Subdivision type 3",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type3": {
"label": "Subdivision type 4",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type4": {
"label": "Subdivision type 5",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type5": {
"label": "Subdivision type 6",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type6": {
"label": "Subdivision type 7",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_name1": {
"label": "Subdivision name 2",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Connecticut]]"
},
"subdivision_name2": {
"label": "Subdivision name 3",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Florida]]"
},
"subdivision_name3": {
"label": "Subdivision name 4",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Utah]]"
},
"subdivision_name4": {
"label": "Subdivision name 5",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[California]]"
},
"subdivision_name5": {
"label": "Subdivision name 6",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Vermont]]"
},
"subdivision_name6": {
"label": "Subdivision name 7",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Wyoming]]"
},
"established_title": {
"label": "First establishment event",
"description": "Title of the first establishment event.",
"type": "string",
"example": "First settled"
},
"established_date": {
"label": "First establishment date",
"type": "date",
"description": "Date of the first establishment event."
},
"established_title1": {
"label": "Second establishment event",
"description": "Title of the second establishment event.",
"type": "string",
"example": "Incorporated as a town"
},
"established_date1": {
"label": "Second establishment date",
"type": "date",
"description": "Date of the second establishment event."
},
"established_title2": {
"label": "Third establishment event",
"description": "Title of the third establishment event.",
"type": "string",
"example": "Incorporated as a city"
},
"established_date2": {
"label": "Third establishment date",
"type": "date",
"description": "Date of the third establishment event."
},
"established_title3": {
"label": "Fourth establishment event",
"type": "string",
"description": "Title of the fourth establishment event.",
"example": "Incorporated as a county"
},
"established_date3": {
"label": "Fourth establishment date",
"type": "date",
"description": "Date of the fourth establishment event."
},
"extinct_title": {
"label": "Extinction event title",
"description": "For when a settlement ceases to exist.",
"type": "string",
"example": "[[Sack of Rome]]"
},
"extinct_date": {
"label": "Extinction date",
"type": "string",
"description": "Date the settlement ceased to exist."
},
"founder": {
"label": "Founder",
"description": "Who the settlement was founded by.",
"type": "string"
},
"named_for": {
"label": "Named for",
"description": "The source of the name of the settlement (a person, a place, et cetera).",
"type": "string",
"example": "[[Ho Chi Minh]]"
},
"seat_type": {
"label": "Seat of government type",
"description": "The label for the seat of government (defaults to 'Seat').",
"type": "string",
"default": "Seat"
},
"seat": {
"label": "Seat of government",
"description": "The seat of government.",
"type": "string",
"example": "[[White House]]"
},
"parts_type": {
"label": "Type of smaller subdivisions",
"description": "The label for the smaller subdivisions (defaults to 'Boroughs').",
"type": "string",
"default": "Boroughs"
},
"parts_style": {
"label": "Parts style",
"description": "Set to 'list' to display as a collapsible list, 'coll' as a collapsed list, or 'para' to use paragraph style. Default is 'list' for up to 5 items, otherwise 'coll'.",
"type": "string",
"example": "list"
},
"parts": {
"label": "Smaller subdivisions",
"description": "Text or header of the list of smaller subdivisions.",
"type": "string"
},
"p1": {
"label": "Smaller subdivision 1",
"description": "The smaller subdivisions to be listed. Parameters 'p1' to 'p50' can also be used.",
"type": "string"
},
"government_footnotes": {
"label": "Government footnotes",
"description": "Reference(s) for government. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "content"
},
"government_type": {
"label": "Government type",
"description": "The place's type of government.",
"type": "string",
"example": "[[Mayor–council government]]"
},
"governing_body": {
"label": "Governing body",
"description": "Name of the place's governing body.",
"type": "wiki-page-name",
"example": "Legislative Council of Hong Kong"
},
"leader_party": {
"label": "Leader political party",
"description": "Political party of the place's leader.",
"type": "string"
},
"leader_title": {
"label": "Leader title",
"description": "First title of the place's leader, e.g. 'Mayor'.",
"type": "string",
"example": "[[Governor (United States)|Governor]]"
},
"leader_name": {
"label": "Leader's name",
"description": "Name of the place's leader.",
"type": "string",
"example": "[[Jay Inslee]]"
},
"leader_title1": {
"label": "Leader title 1",
"description": "First title of the place's leader, e.g. 'Mayor'.",
"type": "string",
"example": "Mayor"
},
"leader_name1": {
"label": "Leader name 1",
"description": "Additional names for leaders. Parameters 'leader_name1' .. 'leader_name4' are available. For long lists, use {{Collapsible list}}.",
"type": "string"
},
"total_type": {
"label": "Total type",
"description": "Specifies what total area and population figure refer to, e.g. 'Greater London'. This overrides other labels for total population/area. To make the total area and population display on the same line as the words ''Area'' and ''Population'', with no ''Total'' or similar label, set the value of this parameter to ' '.",
"type": "string"
},
"unit_pref": {
"label": "Unit preference",
"description": "To change the unit order to 'imperial (metric)', enter 'imperial'. The default display style is 'metric (imperial)'. However, the template will swap the order automatically if the 'subdivision_name' equals some variation of the US or the UK. For the Middle East, a unit preference of dunam can be entered (only affects total area). All values must be entered in a raw format (no commas, spaces, or unit symbols). The template will format them automatically.",
"type": "string",
"example": "imperial"
},
"area_footnotes": {
"label": "Area footnotes",
"description": "Reference(s) for area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"dunam_link": {
"label": "Link dunams?",
"description": "If dunams are used, the default is to link the word ''dunams'' in the total area section. This can be changed by setting 'dunam_link' to another measure (e.g. 'dunam_link=water'). Linking can also be turned off by setting the parameter to something else (e.g., 'dunam_link=none' or 'dunam_link=off').",
"type": "boolean",
"example": "none"
},
"area_total_km2": {
"label": "Total area (km2)",
"description": "Total area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_total_sq_mi' is empty.",
"type": "number"
},
"area_total_sq_mi": {
"label": "Total area (sq. mi)",
"description": "Total area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_total_km2' is empty.",
"type": "number"
},
"area_total_ha": {
"label": "Total area (hectares)",
"description": "Total area in hectares (symbol: ha). Value must be entered in raw format (no commas or spaces). Auto-converted to display acres if 'area_total_acre' is empty.",
"type": "number"
},
"area_total_acre": {
"label": "Total area (acres)",
"description": "Total area in acres. Value must be entered in raw format (no commas or spaces). Auto-converted to display hectares if 'area_total_ha' is empty.",
"type": "number"
},
"area_total_dunam": {
"label": "Total area (dunams)",
"description": "Total area in dunams, which is wikilinked. Used in Middle Eastern places like Israel, Gaza, and the West Bank. Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers or hectares and square miles or acres if 'area_total_km2', 'area_total_ha', 'area_total_sq_mi', and 'area_total_acre' are empty. Examples: Gaza and Ramallah.",
"type": "number"
},
"area_land_km2": {
"label": "Land area (sq. km)",
"description": "Land area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_land_sq_mi' is empty.",
"type": "number"
},
"area_land_sq_mi": {
"label": "Land area (sq. mi)",
"description": "Land area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_land_km2' is empty.",
"type": "number"
},
"area_land_ha": {
"label": "Land area (hectares)",
"description": "The place's land area in hectares.",
"type": "number"
},
"area_land_dunam": {
"label": "Land area (dunams)",
"description": "The place's land area in dunams.",
"type": "number"
},
"area_land_acre": {
"label": "Land area (acres)",
"description": "The place's land area in acres.",
"type": "number"
},
"area_water_km2": {
"label": "Water area (sq. km)",
"description": "Water area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_water_sq_mi' is empty.",
"type": "number"
},
"area_water_sq_mi": {
"label": "Water area (sq. mi)",
"description": "Water area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_water_km2' is empty.",
"type": "number"
},
"area_water_ha": {
"label": "Water area (hectares)",
"description": "The place's water area in hectares.",
"type": "number"
},
"area_water_dunam": {
"label": "Water area (dunams)",
"description": "The place's water area in dunams.",
"type": "number"
},
"area_water_acre": {
"label": "Water area (acres)",
"description": "The place's water area in acres.",
"type": "number"
},
"area_water_percent": {
"label": "Percent water area",
"description": "Percent of water without the %.",
"type": "number",
"example": "21"
},
"area_urban_km2": {
"label": "Urban area (sq. km)",
"type": "number",
"description": "Area of the place's urban area in square kilometers."
},
"area_urban_sq_mi": {
"label": "Urban area (sq. mi)",
"type": "number",
"description": "Area of the place's urban area in square miles."
},
"area_urban_ha": {
"label": "Urban area (hectares)",
"description": "Area of the place's urban area in hectares.",
"type": "number"
},
"area_urban_dunam": {
"label": "Urban area (dunams)",
"description": "Area of the place's urban area in dunams.",
"type": "number"
},
"area_urban_acre": {
"label": "Urban area (acres)",
"description": "Area of the place's urban area in acres.",
"type": "number"
},
"area_urban_footnotes": {
"label": "Urban area footnotes",
"description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"area_rural_km2": {
"label": "Rural area (sq. km)",
"type": "number",
"description": "Area of the place's rural area in square kilometers."
},
"area_rural_sq_mi": {
"label": "Rural area (sq. mi)",
"type": "number",
"description": "Area of the place's rural area in square miles."
},
"area_rural_ha": {
"label": "Rural area (hectares)",
"description": "Area of the place's rural area in hectares.",
"type": "number"
},
"area_rural_dunam": {
"label": "Rural area (dunams)",
"description": "Area of the place's rural area in dunams.",
"type": "number"
},
"area_rural_acre": {
"label": "Rural area (acres)",
"description": "Area of the place's rural area in acres.",
"type": "number"
},
"area_rural_footnotes": {
"label": "Rural area footnotes",
"description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"area_metro_km2": {
"label": "Metropolitan area (sq. km)",
"type": "number",
"description": "Area of the place's metropolitan area in square kilometers."
},
"area_metro_sq_mi": {
"label": "Metropolitan area (sq. mi)",
"type": "number",
"description": "Area of the place's metropolitan area in square miles."
},
"area_metro_ha": {
"label": "Metropolitan area (hectares)",
"description": "Area of the place's metropolitan area in hectares.",
"type": "number"
},
"area_metro_dunam": {
"label": "Metropolitan area (dunams)",
"description": "Area of the place's metropolitan area in dunams.",
"type": "number"
},
"area_metro_acre": {
"label": "Metropolitan area (acres)",
"description": "Area of the place's metropolitan area in acres.",
"type": "number"
},
"area_metro_footnotes": {
"label": "Metropolitan area footnotes",
"description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"area_rank": {
"label": "Area rank",
"description": "The settlement's area, as ranked within its parent sub-division.",
"type": "string"
},
"area_blank1_title": {
"label": "First blank area section title",
"description": "Title of the place's first custom area section.",
"type": "string",
"example": "see [[London]]"
},
"area_blank1_km2": {
"label": "Area blank 1 (sq. km)",
"type": "number",
"description": "Area of the place's first blank area section in square kilometers."
},
"area_blank1_sq_mi": {
"label": "Area blank 1 (sq. mi)",
"type": "number",
"description": "Area of the place's first blank area section in square miles."
},
"area_blank1_ha": {
"label": "Area blank 1 (hectares)",
"description": "Area of the place's first blank area section in hectares.",
"type": "number"
},
"area_blank1_dunam": {
"label": "Area blank 1 (dunams)",
"description": "Area of the place's first blank area section in dunams.",
"type": "number"
},
"area_blank1_acre": {
"label": "Area blank 1 (acres)",
"description": "Area of the place's first blank area section in acres.",
"type": "number"
},
"area_blank2_title": {
"label": "Second blank area section title",
"type": "string",
"description": "Title of the place's second custom area section."
},
"area_blank2_km2": {
"label": "Area blank 2 (sq. km)",
"type": "number",
"description": "Area of the place's second blank area section in square kilometers."
},
"area_blank2_sq_mi": {
"label": "Area blank 2 (sq. mi)",
"type": "number",
"description": "Area of the place's second blank area section in square miles."
},
"area_blank2_ha": {
"label": "Area blank 2 (hectares)",
"description": "Area of the place's third blank area section in hectares.",
"type": "number"
},
"area_blank2_dunam": {
"label": "Area blank 2 (dunams)",
"description": "Area of the place's third blank area section in dunams.",
"type": "number"
},
"area_blank2_acre": {
"label": "Area blank 2 (acres)",
"description": "Area of the place's third blank area section in acres.",
"type": "number"
},
"area_note": {
"label": "Area footnotes",
"description": "A place for additional information such as the name of the source.",
"type": "content",
"example": "<ref name=\"CenPopGazetteer2016\">{{cite web|title=2016 U.S. Gazetteer Files|url=https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2016_Gazetteer/2016_gaz_place_42.txt|publisher=United States Census Bureau|access-date=August 13, 2017}}</ref>"
},
"dimensions_footnotes": {
"label": "Dimensions footnotes",
"description": "Reference(s) for dimensions. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "content"
},
"length_km": {
"label": "Length in km",
"description": "Raw number entered in kilometers. Will automatically convert to display length in miles if 'length_mi' is empty.",
"type": "number"
},
"length_mi": {
"label": "Length in miles",
"description": "Raw number entered in miles. Will automatically convert to display length in kilometers if 'length_km' is empty.",
"type": "number"
},
"width_km": {
"label": "Width in kilometers",
"description": "Raw number entered in kilometers. Will automatically convert to display width in miles if 'length_mi' is empty.",
"type": "number"
},
"width_mi": {
"label": "Width in miles",
"description": "Raw number entered in miles. Will automatically convert to display width in kilometers if 'length_km' is empty.",
"type": "number"
},
"elevation_m": {
"label": "Elevation in meters",
"description": "Raw number entered in meters. Will automatically convert to display elevation in feet if 'elevation_ft' is empty. However, if a range in elevation (i.e. 5–50 m) is desired, use the 'max' and 'min' fields below.",
"type": "number"
},
"elevation_ft": {
"label": "Elevation in feet",
"description": "Raw number, entered in feet. Will automatically convert to display the average elevation in meters if 'elevation_m' field is empty. However, if a range in elevation (i.e. 50–500 ft) is desired, use the 'max' and 'min' fields below.",
"type": "number"
},
"elevation_footnotes": {
"label": "Elevation footnotes",
"description": "Reference(s) for elevation. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"elevation_min_point": {
"type": "line",
"label": "Point of min elevation",
"description": "The name of the point of lowest elevation in the place.",
"example": "[[Death Valley]]"
},
"elevation_min_m": {
"label": "Minimum elevation (m)",
"type": "number",
"description": "The minimum elevation in meters."
},
"elevation_min_ft": {
"label": "Minimum elevation (ft)",
"type": "number",
"description": "The minimum elevation in feet."
},
"elevation_min_rank": {
"type": "line",
"label": "Minimum elevation rank",
"description": "The point of minimum elevation's rank in the parent region.",
"example": "1st"
},
"elevation_min_footnotes": {
"label": "Min elevation footnotes",
"type": "content",
"description": "Footnotes or citations for the minimum elevation."
},
"elevation_max_point": {
"type": "line",
"label": "Point of max elevation",
"description": "The name of the point of highest elevation in the place.",
"example": "[[Mount Everest]]"
},
"elevation_max_m": {
"label": "Maximum elevation (m)",
"type": "number",
"description": "The maximum elevation in meters."
},
"elevation_max_ft": {
"label": "Maximum elevation (ft)",
"type": "number",
"description": "The maximum elevation in feet."
},
"elevation_max_rank": {
"type": "line",
"label": "Maximum elevation rank",
"description": "The point of maximum elevation's rank in the parent region.",
"example": "2nd"
},
"elevation_max_footnotes": {
"label": "Max elevation footnotes",
"type": "content",
"description": "Footnotes or citations for the maximum elevation."
},
"population_total": {
"label": "Population total",
"description": "Actual population (see below for estimates) preferably consisting of digits only (without any commas).",
"type": "number"
},
"population_as_of": {
"label": "Population total figure's year",
"description": "The year for the population total (usually a census year).",
"type": "number"
},
"population_footnotes": {
"label": "Population footnotes",
"description": "Reference(s) for population; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "content"
},
"population_density_km2": {
"label": "Population density (per square km)",
"type": "string",
"description": "The place's population density per square kilometer.",
"example": "auto"
},
"population_density_sq_mi": {
"label": "Population density (per square mi)",
"type": "string",
"description": "The place's population density per square mile.",
"example": "auto"
},
"population_est": {
"label": "Population estimate",
"description": "Population estimate, e.g. for growth projections 4 years after a census.",
"type": "number",
"example": "331000000"
},
"pop_est_as_of": {
"label": "Population estimate figure as of",
"description": "The year, or the month and year, of the population estimate.",
"type": "date"
},
"pop_est_footnotes": {
"label": "Population estimate footnotes",
"description": "Reference(s) for population estimate; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "content",
"example": "<ref name=\"USCensusEst2016\"/>"
},
"population_urban": {
"label": "Urban population",
"type": "number",
"description": "The place's urban population."
},
"population_urban_footnotes": {
"label": "Urban population footnotes",
"description": "Reference(s) for urban population; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "content"
},
"population_density_urban_km2": {
"label": "Urban population density (per square km)",
"type": "string",
"description": "The place's urban population density per square kilometer.",
"example": "auto"
},
"population_density_urban_sq_mi": {
"label": "Urban population density (per square mi)",
"type": "string",
"description": "The place's urban population density per square mile.",
"example": "auto"
},
"population_rural": {
"label": "Rural population",
"type": "number",
"description": "The place's rural population."
},
"population_rural_footnotes": {
"label": "Rural population footnotes",
"description": "Reference(s) for rural population; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "content"
},
"population_density_rural_km2": {
"label": "Rural population density per sq. km",
"type": "line",
"description": "The place's rural population density per square kilometer.",
"example": "auto"
},
"population_density_rural_sq_mi": {
"label": "Rural population density per sq. mi",
"type": "line",
"description": "The place's rural population density per square mile.",
"example": "auto"
},
"population_metro": {
"label": "Metropolitan area population",
"type": "number",
"description": "Population of the place's metropolitan area."
},
"population_metro_footnotes": {
"label": "Metropolitan area population footnotes",
"description": "Reference(s) for metro population; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "string"
},
"population_density_metro_km2": {
"label": "Metropolitan population density per sq. km",
"type": "number",
"description": "The place's metropolitan area's population density per square kilometer.",
"example": "auto"
},
"population_density_metro_sq_mi": {
"label": "Metropolitan population density per sq. mi",
"type": "number",
"description": "The place's metropolitan area's population density per square mile.",
"example": "auto"
},
"population_rank": {
"label": "Population rank",
"description": "The settlement's population, as ranked within its parent sub-division.",
"type": "string"
},
"population_density_rank": {
"label": "Population density rank",
"description": "The settlement's population density, as ranked within its parent sub-division.",
"type": "string"
},
"population_blank1_title": {
"label": "Custom population type 1 title",
"description": "Can be used for estimates. For an example, see Windsor, Ontario.",
"type": "string",
"example": "See: [[Windsor, Ontario]]"
},
"population_blank1": {
"label": "Custom population type 1",
"description": "The population value for 'blank1_title'.",
"type": "string"
},
"population_density_blank1_km2": {
"label": "Custom population type 1 density per sq. km",
"type": "string",
"description": "Population density per square kilometer, according to the 1st custom population type."
},
"population_density_blank1_sq_mi": {
"label": "Custom population type 1 density per sq. mi",
"type": "string",
"description": "Population density per square mile, according to the 1st custom population type."
},
"population_blank2_title": {
"label": "Custom population type 2 title",
"description": "Can be used for estimates. For an example, see Windsor, Ontario.",
"type": "string",
"example": "See: [[Windsor, Ontario]]"
},
"population_blank2": {
"label": "Custom population type 2",
"description": "The population value for 'blank2_title'.",
"type": "string"
},
"population_density_blank2_km2": {
"label": "Custom population type 2 density per sq. km",
"type": "string",
"description": "Population density per square kilometer, according to the 2nd custom population type."
},
"population_density_blank2_sq_mi": {
"label": "Custom population type 2 density per sq. mi",
"type": "string",
"description": "Population density per square mile, according to the 2nd custom population type."
},
"population_demonym": {
"label": "Demonym",
"description": "A demonym or gentilic is a word that denotes the members of a people or the inhabitants of a place. For example, a citizen in Liverpool is known as a Liverpudlian.",
"type": "line",
"example": "Liverpudlian"
},
"population_note": {
"label": "Population note",
"description": "A place for additional information such as the name of the source. See Windsor, Ontario, for an example.",
"type": "content"
},
"demographics_type1": {
"label": "Demographics type 1",
"description": "A sub-section header.",
"type": "string",
"example": "Ethnicities"
},
"demographics1_footnotes": {
"label": "Demographics section 1 footnotes",
"description": "Reference(s) for demographics section 1. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "content"
},
"demographics1_title1": {
"label": "Demographics section 1 title 1",
"description": "Titles related to demographics_type1. For example: 'White', 'Black', 'Hispanic'... Additional rows 'demographics1_title1' to 'demographics1_title5' are also available.",
"type": "string"
},
"demographics_type2": {
"label": "Demographics type 2",
"description": "A second sub-section header.",
"type": "line",
"example": "Languages"
},
"demographics2_footnotes": {
"label": "Demographics section 2 footnotes",
"description": "Reference(s) for demographics section 2. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"demographics2_title1": {
"label": "Demographics section 2 title 1",
"description": "Titles related to 'demographics_type1'. For example: 'English', 'French', 'Arabic'... Additional rows 'demographics2_title2' to 'demographics1_title5' are also available.",
"type": "string"
},
"demographics2_info1": {
"label": "Demographics section 2 info 1",
"description": "Information related to the titles. For example: '50%', '25%', '10%'... Additional rows 'demographics2_info2' to 'demographics2_info5' are also available.",
"type": "content"
},
"time_zone1": {
"label": "Time zone 1",
"type": "string",
"description": "The place's primary time-zone. Use 'time_zone' or 'time_zone1', but not both.",
"example": "[[Eastern Standard Time]]",
"aliases": [
"time_zone"
]
},
"utc_offset": {
"label": "UTC offset",
"type": "string",
"description": "The place's time-zone's offset from UTC.",
"example": "+8"
},
"time_zone_DST": {
"label": "Time zone during DST",
"type": "string",
"description": "The place's time-zone during daylight savings time, if applicable.",
"example": "[[Eastern Daylight Time]]"
},
"utc_offset_DST": {
"label": "UTC offset during DST",
"type": "string",
"description": "The place's time-zone's UTC offset during daylight savings time, if applicable.",
"example": "+9"
},
"utc_offset1": {
"label": "UTC offset 1",
"type": "string",
"description": "The place's primary time-zone's offset from UTC.",
"example": "−5"
},
"time_zone1_DST": {
"label": "Time zone 1 (during DST)",
"type": "string",
"description": "The place's primary time-zone during daylight savings time, if applicable.",
"example": "[[Eastern Daylight Time]]"
},
"utc_offset1_DST": {
"label": "UTC offset 1 (during DST)",
"type": "string",
"description": "The place's primary time-zone's UTC offset during daylight savings time, if applicable.",
"example": "−6"
},
"time_zone2": {
"label": "Time zone 2",
"description": "A second time zone field for larger areas such as a province.",
"type": "string",
"example": "[[Central Standard Time]]"
},
"utc_offset2": {
"label": "UTC offset 2",
"type": "string",
"description": "The place's secondary time-zone's offset from UTC.",
"example": "−6"
},
"time_zone2_DST": {
"label": "Time zone 2 during DST",
"type": "string",
"description": "The place's secondary time-zone during daylight savings time, if applicable.",
"example": "[[Central Daylight Time]]"
},
"utc_offset2_DST": {
"label": "UTC offset 2 during DST",
"type": "string",
"description": "The place's secondary time-zone's offset from UTC during daylight savings time, if applicable.",
"example": "−7"
},
"postal_code_type": {
"label": "Postal code type",
"description": "Label used for postal code info, e.g. 'ZIP Code'. Defaults to 'Postal code'.",
"example": "[[Postal code of China|Postal code]]",
"type": "string"
},
"postal_code": {
"label": "Postal code",
"description": "The place's postal code/zip code.",
"type": "string",
"example": "90210"
},
"postal2_code_type": {
"label": "Postal code 2 type",
"type": "string",
"description": "If applicable, the place's second postal code type."
},
"postal2_code": {
"label": "Postal code 2",
"type": "string",
"description": "A second postal code of the place, if applicable.",
"example": "90007"
},
"area_code": {
"label": "Area code",
"description": "The regions' telephone area code.",
"type": "string",
"aliases": [
"area_codes"
]
},
"area_code_type": {
"label": "Area code type",
"description": "If left blank/not used, template will default to 'Area code(s)'.",
"type": "string"
},
"geocode": {
"label": "Geocode",
"description": "See [[Geocode]].",
"type": "string"
},
"iso_code": {
"label": "ISO 3166 code",
"description": "See ISO 3166.",
"type": "string"
},
"registration_plate": {
"label": "Registration/license plate info",
"description": "See Vehicle registration plate.",
"type": "string"
},
"custom_label1_sec1": {
"label": "Custom 1 label section 1",
"description": "Up to 7 additional fields 'custom_label1_sec1' ... 'custom_label7_sec1' can be specified.",
"type": "string"
},
"custom_data1_sec1": {
"label": "Custom 1 data section 1",
"description": "Up to 7 additional fields 'custom_data1_sec1' ... 'custom_data7_sec1' can be specified.",
"type": "content"
},
"custom_label1_sec2": {
"label": "Custom 1 label section 2",
"description": "Up to 7 additional fields 'custom_label1_sec2' ... 'custom_label7_sec2' can be specified.",
"type": "string"
},
"custom_data1_sec2": {
"label": "Custom 1 label section 2",
"description": "Up to 7 additional fields 'custom_data1_sec2' ... 'custom_data7_sec2' can be specified.",
"type": "content"
},
"website": {
"label": "Official website in English",
"description": "External link to official website. Use the {{URL}} template, thus: {{URL|example.com}}.",
"type": "string"
},
"footnotes": {
"label": "Footnotes",
"description": "Text to be displayed at the bottom of the infobox.",
"type": "content"
},
"translit_lang1_info1": {
"label": "Language 1 first transcription ",
"description": "Transcription of type 1 in the first other language.",
"example": "{{langx|zh|森美兰}}",
"type": "line"
},
"translit_lang1_type1": {
"label": "Language 1 first transcription type",
"description": "Type of transcription used in the first language's first transcription.",
"example": "[[Chinese Language|Chinese]]",
"type": "line"
},
"translit_lang1_info2": {
"label": "Language 1 second transcription ",
"description": "Transcription of type 1 in the first other language.",
"example": "{{langx|ta|நெகிரி செம்பிலான்}}",
"type": "line"
},
"translit_lang1_type2": {
"label": "Language 1 second transcription type",
"description": "Type of transcription used in the first language's first transcription.",
"example": "[[Tamil Language|Tamil]]",
"type": "line"
},
"demographics1_info1": {
"label": "Demographics section 1 info 1",
"description": "Information related to the titles. For example: '50%', '25%', '10%'... Additional rows 'demographics1_info1' to 'demographics1_info5' are also available.",
"type": "content"
},
"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": [
"coordinates"
],
"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": {
"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": {},
"embed": {},
"translit_lang1_type3": {},
"translit_lang1_type4": {},
"translit_lang1_info3": {},
"translit_lang1_type5": {},
"translit_lang1_info4": {},
"translit_lang1_type6": {},
"translit_lang1_info5": {},
"translit_lang1_info6": {},
"translit_lang2_type1": {},
"translit_lang2_type": {},
"translit_lang2_info": {},
"translit_lang2_type2": {},
"translit_lang2_info1": {},
"translit_lang2_type3": {},
"translit_lang2_info2": {},
"translit_lang2_type4": {},
"translit_lang2_info3": {},
"translit_lang2_type5": {},
"translit_lang2_info4": {},
"translit_lang2_type6": {},
"translit_lang2_info5": {},
"translit_lang2_info6": {},
"pushpin_map_narrow": {},
"seal_type": {},
"etymology": {},
"nicknames": {},
"nickname_link": {},
"mottoes": {},
"motto_link": {},
"anthem_link": {},
"grid_position": {},
"coor_type": {},
"grid_name": {},
"established_title4": {},
"established_date4": {},
"established_title5": {},
"established_date5": {},
"established_title6": {},
"established_date6": {},
"established_title7": {},
"established_date7": {},
"seat1_type": {},
"seat1": {},
"seat2_type": {},
"seat2": {},
"p2": {},
"p3": {},
"p4": {},
"p5": {},
"p6": {},
"p7": {},
"p8": {},
"p9": {},
"p10": {},
"p11": {},
"p12": {},
"p13": {},
"p14": {},
"p15": {},
"p16": {},
"p17": {},
"p18": {},
"p19": {},
"p20": {},
"p21": {},
"p22": {},
"p23": {},
"p24": {},
"p25": {},
"p26": {},
"p27": {},
"p28": {},
"p29": {},
"p30": {},
"p31": {},
"p32": {},
"p33": {},
"p34": {},
"p35": {},
"p36": {},
"p37": {},
"p38": {},
"p39": {},
"p40": {},
"p41": {},
"p42": {},
"p43": {},
"p44": {},
"p45": {},
"p46": {},
"p47": {},
"p48": {},
"p49": {},
"p50": {},
"leader_name2": {},
"leader_name3": {},
"leader_name4": {},
"leader_title2": {},
"leader_title3": {},
"leader_title4": {},
"government_blank1_title": {},
"government_blank1": {},
"government_blank2_title": {},
"government_blank2": {},
"government_blank3_title": {},
"government_blank3": {},
"government_blank4_title": {},
"government_blank4": {},
"government_blank5_title": {},
"government_blank5": {},
"government_blank6_title": {},
"government_blank6": {},
"elevation_link": {},
"elevation_point": {},
"population_blank1_footnotes": {},
"population_blank2_footnotes": {},
"population_demonyms": {},
"demographics1_title2": {},
"demographics1_info2": {},
"demographics1_title3": {},
"demographics1_info3": {},
"demographics1_title4": {},
"demographics1_info4": {},
"demographics1_title5": {},
"demographics1_info5": {},
"demographics1_title6": {},
"demographics1_info6": {},
"demographics1_title7": {},
"demographics1_info7": {},
"demographics1_title8": {},
"demographics1_info8": {},
"demographics1_title9": {},
"demographics1_info9": {},
"demographics1_title10": {},
"demographics1_info10": {},
"demographics2_title2": {},
"demographics2_info2": {},
"demographics2_title3": {},
"demographics2_info3": {},
"demographics2_title4": {},
"demographics2_info4": {},
"demographics2_title5": {},
"demographics2_info5": {},
"demographics2_title6": {},
"demographics2_info6": {},
"demographics2_title7": {},
"demographics2_info7": {},
"demographics2_title8": {},
"demographics2_info8": {},
"demographics2_title9": {},
"demographics2_info9": {},
"demographics2_title10": {},
"demographics2_info10": {},
"time_zone1_location": {},
"time_zone_link": {},
"time_zone2_location": {},
"time_zone3_location": {},
"utc_offset3": {},
"time_zone3": {},
"utc_offset3_DST": {},
"time_zone3_DST": {},
"time_zone4_location": {},
"utc_offset4": {},
"time_zone4": {},
"utc_offset4_DST": {},
"time_zone4_DST": {},
"time_zone5_location": {},
"utc_offset5": {},
"time_zone5": {},
"utc_offset5_DST": {},
"time_zone5_DST": {},
"registration_plate_type": {
"label": "Registration/license plate type",
"description": "The place's registration/license plate type",
"type": "content"
},
"code1_name": {},
"code1_info": {},
"code2_name": {},
"code2_info": {},
"blank1_info": {},
"custom_label2_sec1": {},
"custom_data2_sec1": {},
"custom_label3_sec1": {},
"custom_data3_sec1": {},
"custom_label4_sec1": {},
"custom_data4_sec1": {},
"custom_label5_sec1": {},
"custom_data5_sec1": {},
"custom_label6_sec1": {},
"custom_data6_sec1": {},
"custom_label7_sec1": {},
"custom_data7_sec1": {},
"custom_label2_sec2": {},
"custom_data2_sec2": {},
"custom_label3_sec2": {},
"custom_data3_sec2": {},
"custom_label4_sec2": {},
"custom_data4_sec2": {},
"custom_label5_sec2": {},
"custom_data5_sec2": {},
"custom_label6_sec2": {},
"custom_data6_sec2": {},
"custom_label7_sec2": {},
"custom_data7_sec2": {},
"module": {},
"coordinates_wikidata": {},
"wikidata": {},
"image_upright": {},
"blank_emblem_upright": {},
"leader_title5": {},
"leader_name5": {},
"custom_label_sec1": {
"label": "Custom label section 1",
"description": "Fields used to display other information. The label is displayed in bold on the left side of the infobox.",
"type": "string"
},
"custom_data_sec1": {
"label": "Custom data section 1",
"description": "The information associated with the 'custom_label_sec1' heading. The info is displayed on the right side of the infobox in the same row as the name. For an example, see [[Warsaw]].",
"type": "content"
}
},
"paramOrder": [
"name",
"native_name",
"native_name_lang",
"other_name",
"type",
"official_name",
"translit_lang1",
"translit_lang1_type",
"translit_lang1_info",
"translit_lang2",
"image",
"image_size",
"image_upright",
"alt",
"caption",
"image_flag",
"flag_size",
"flag_alt",
"flag_border",
"flag_link",
"image_seal",
"seal_size",
"seal_alt",
"seal_link",
"seal_type",
"seal_class",
"image_shield",
"shield_size",
"shield_alt",
"shield_link",
"image_blank_emblem",
"blank_emblem_type",
"blank_emblem_size",
"blank_emblem_upright",
"blank_emblem_alt",
"blank_emblem_link",
"nickname",
"motto",
"anthem",
"image_map",
"map_size",
"map_alt",
"map_caption",
"image_map1",
"map_size1",
"map_alt1",
"map_caption1",
"pushpin_map",
"pushpin_map_size",
"pushpin_alt",
"pushpin_caption",
"pushpin_label",
"pushpin_label_position",
"pushpin_relief",
"mapframe",
"mapframe-caption",
"mapframe-custom",
"mapframe-id",
"mapframe-coordinates",
"mapframe-wikidata",
"mapframe-point",
"mapframe-shape",
"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",
"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-switcher",
"mapframe-line",
"coordinates",
"coor_pinpoint",
"coordinates_footnotes",
"subdivision_type",
"subdivision_name",
"subdivision_type1",
"subdivision_name1",
"subdivision_type2",
"subdivision_name2",
"subdivision_type3",
"subdivision_name3",
"subdivision_type4",
"subdivision_name4",
"subdivision_type5",
"subdivision_name5",
"subdivision_type6",
"subdivision_name6",
"established_title",
"established_date",
"established_title1",
"established_date1",
"established_title2",
"established_date2",
"established_title3",
"established_date3",
"established_title4",
"established_date4",
"established_title5",
"established_date5",
"established_title6",
"established_date6",
"established_title7",
"established_date7",
"extinct_title",
"extinct_date",
"founder",
"named_for",
"seat_type",
"seat",
"parts_type",
"parts_style",
"parts",
"government_footnotes",
"government_type",
"governing_body",
"leader_party",
"leader_title",
"leader_name",
"leader_title1",
"leader_name1",
"total_type",
"unit_pref",
"area_footnotes",
"dunam_link",
"area_total_km2",
"area_total_sq_mi",
"area_total_ha",
"area_total_acre",
"area_total_dunam",
"area_land_km2",
"area_land_sq_mi",
"area_land_ha",
"area_land_dunam",
"area_land_acre",
"area_water_km2",
"area_water_sq_mi",
"area_water_ha",
"area_water_dunam",
"area_water_acre",
"area_water_percent",
"area_urban_km2",
"area_urban_sq_mi",
"area_urban_ha",
"area_urban_dunam",
"area_urban_acre",
"area_urban_footnotes",
"area_rural_km2",
"area_rural_sq_mi",
"area_rural_ha",
"area_rural_dunam",
"area_rural_acre",
"area_rural_footnotes",
"area_metro_km2",
"area_metro_sq_mi",
"area_metro_ha",
"area_metro_dunam",
"area_metro_acre",
"area_metro_footnotes",
"area_rank",
"area_blank1_title",
"area_blank1_km2",
"area_blank1_sq_mi",
"area_blank1_ha",
"area_blank1_dunam",
"area_blank1_acre",
"area_blank2_title",
"area_blank2_km2",
"area_blank2_sq_mi",
"area_blank2_ha",
"area_blank2_dunam",
"area_blank2_acre",
"area_note",
"dimensions_footnotes",
"length_km",
"length_mi",
"width_km",
"width_mi",
"elevation_m",
"elevation_ft",
"elevation_footnotes",
"elevation_min_point",
"elevation_min_m",
"elevation_min_ft",
"elevation_min_rank",
"elevation_min_footnotes",
"elevation_max_point",
"elevation_max_m",
"elevation_max_ft",
"elevation_max_rank",
"elevation_max_footnotes",
"population_total",
"population_as_of",
"population_footnotes",
"population_density_km2",
"population_density_sq_mi",
"population_est",
"pop_est_as_of",
"pop_est_footnotes",
"population_urban",
"population_urban_footnotes",
"population_density_urban_km2",
"population_density_urban_sq_mi",
"population_rural",
"population_rural_footnotes",
"population_density_rural_km2",
"population_density_rural_sq_mi",
"population_metro",
"population_metro_footnotes",
"population_density_metro_km2",
"population_density_metro_sq_mi",
"population_rank",
"population_density_rank",
"population_blank1_title",
"population_blank1",
"population_density_blank1_km2",
"population_density_blank1_sq_mi",
"population_blank2_title",
"population_blank2",
"population_density_blank2_km2",
"population_density_blank2_sq_mi",
"population_demonym",
"population_note",
"demographics_type1",
"demographics1_footnotes",
"demographics1_title1",
"demographics_type2",
"demographics2_footnotes",
"demographics2_title1",
"demographics2_info1",
"time_zone1",
"utc_offset",
"time_zone_DST",
"utc_offset_DST",
"utc_offset1",
"time_zone1_DST",
"utc_offset1_DST",
"time_zone2",
"utc_offset2",
"time_zone2_DST",
"utc_offset2_DST",
"postal_code_type",
"postal_code",
"postal2_code_type",
"postal2_code",
"area_code",
"area_code_type",
"geocode",
"iso_code",
"registration_plate_type",
"registration_plate",
"custom_label_sec1",
"custom_data_sec1",
"custom_label1_sec1",
"custom_data1_sec1",
"custom_label1_sec2",
"custom_data1_sec2",
"website",
"footnotes",
"translit_lang1_info1",
"translit_lang1_type1",
"translit_lang1_info2",
"translit_lang1_type2",
"demographics1_info1",
"embed",
"translit_lang1_type3",
"translit_lang1_type4",
"translit_lang1_info3",
"translit_lang1_type5",
"translit_lang1_info4",
"translit_lang1_type6",
"translit_lang1_info5",
"translit_lang1_info6",
"translit_lang2_type1",
"translit_lang2_type",
"translit_lang2_info",
"translit_lang2_type2",
"translit_lang2_info1",
"translit_lang2_type3",
"translit_lang2_info2",
"translit_lang2_type4",
"translit_lang2_info3",
"translit_lang2_type5",
"translit_lang2_info4",
"translit_lang2_type6",
"translit_lang2_info5",
"translit_lang2_info6",
"pushpin_map_narrow",
"etymology",
"nicknames",
"nickname_link",
"mottoes",
"motto_link",
"anthem_link",
"grid_position",
"coor_type",
"grid_name",
"seat1_type",
"seat1",
"seat2_type",
"seat2",
"p1",
"p2",
"p3",
"p4",
"p5",
"p6",
"p7",
"p8",
"p9",
"p10",
"p11",
"p12",
"p13",
"p14",
"p15",
"p16",
"p17",
"p18",
"p19",
"p20",
"p21",
"p22",
"p23",
"p24",
"p25",
"p26",
"p27",
"p28",
"p29",
"p30",
"p31",
"p32",
"p33",
"p34",
"p35",
"p36",
"p37",
"p38",
"p39",
"p40",
"p41",
"p42",
"p43",
"p44",
"p45",
"p46",
"p47",
"p48",
"p49",
"p50",
"leader_name2",
"leader_name3",
"leader_name4",
"leader_name5",
"leader_title2",
"leader_title3",
"leader_title4",
"leader_title5",
"government_blank1_title",
"government_blank1",
"government_blank2_title",
"government_blank2",
"government_blank3_title",
"government_blank3",
"government_blank4_title",
"government_blank4",
"government_blank5_title",
"government_blank5",
"government_blank6_title",
"government_blank6",
"elevation_link",
"elevation_point",
"population_blank1_footnotes",
"population_blank2_footnotes",
"population_demonyms",
"demographics1_title2",
"demographics1_info2",
"demographics1_title3",
"demographics1_info3",
"demographics1_title4",
"demographics1_info4",
"demographics1_title5",
"demographics1_info5",
"demographics1_title6",
"demographics1_info6",
"demographics1_title7",
"demographics1_info7",
"demographics1_title8",
"demographics1_info8",
"demographics1_title9",
"demographics1_info9",
"demographics1_title10",
"demographics1_info10",
"demographics2_title2",
"demographics2_info2",
"demographics2_title3",
"demographics2_info3",
"demographics2_title4",
"demographics2_info4",
"demographics2_title5",
"demographics2_info5",
"demographics2_title6",
"demographics2_info6",
"demographics2_title7",
"demographics2_info7",
"demographics2_title8",
"demographics2_info8",
"demographics2_title9",
"demographics2_info9",
"demographics2_title10",
"demographics2_info10",
"time_zone1_location",
"time_zone_link",
"time_zone2_location",
"time_zone3_location",
"utc_offset3",
"time_zone3",
"utc_offset3_DST",
"time_zone3_DST",
"time_zone4_location",
"utc_offset4",
"time_zone4",
"utc_offset4_DST",
"time_zone4_DST",
"time_zone5_location",
"utc_offset5",
"time_zone5",
"utc_offset5_DST",
"time_zone5_DST",
"code1_name",
"code1_info",
"code2_name",
"code2_info",
"blank1_info",
"custom_label2_sec1",
"custom_data2_sec1",
"custom_label3_sec1",
"custom_data3_sec1",
"custom_label4_sec1",
"custom_data4_sec1",
"custom_label5_sec1",
"custom_data5_sec1",
"custom_label6_sec1",
"custom_data6_sec1",
"custom_label7_sec1",
"custom_data7_sec1",
"custom_label2_sec2",
"custom_data2_sec2",
"custom_label3_sec2",
"custom_data3_sec2",
"custom_label4_sec2",
"custom_data4_sec2",
"custom_label5_sec2",
"custom_data5_sec2",
"custom_label6_sec2",
"custom_data6_sec2",
"custom_label7_sec2",
"custom_data7_sec2",
"module",
"coordinates_wikidata",
"wikidata"
]
}
</templatedata>
{{collapse bottom}}
==Calls and redirects ==
At least {{PAGESINCATEGORY:Templates calling Infobox settlement}} other [[:Category:Templates calling Infobox settlement|templates call this one]].
[{{fullurl:Special:WhatLinksHere/Template:Infobox_settlement|namespace=10&hidetrans=1&hidelinks=1}} Several templates redirect here].
== Tracking categories ==
# {{clc|Pages using infobox settlement with unknown parameters}}
# {{clc|Pages using infobox settlement with conflicting parameters}}
# {{clc|Pages using infobox settlement with deprecated parameters}}
# {{clc|Pages using infobox settlement with bad settlement type}}
# {{clc|Pages using infobox settlement with bad density arguments}}
# {{clc|Pages using infobox settlement with image map1 but not image map}}
# {{clc|Pages using infobox settlement with missing country}}
# {{clc|Pages using infobox settlement with no map}}
# {{clc|Pages using infobox settlement with no coordinates}}
# {{clc|Pages using infobox settlement with possible area code list}}
# {{clc|Pages using infobox settlement with possible demonym list}}
# {{clc|Pages using infobox settlement with possible motto list}}
# {{clc|Pages using infobox settlement with possible nickname list}}
# {{clc|Pages using infobox settlement with the wikidata parameter}}
# {{clc|Templates calling Infobox settlement}}
==See also==
*[[Help:Coordinates]]
*[[Help:Elevation]]
*[[Help:GNIS data for U.S. infoboxes]]
*{{tl|Infobox too long}}
<includeonly>{{Sandbox other||
<!--Categories below this line, please; interwikis at Wikidata-->
[[Category:Place infobox templates|Settlement]]
[[Category:Embeddable templates]]
[[Category:Infobox templates using Wikidata]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
jpgv5vyrao9ru2g9w8dv21brm0pdd5m
21884
21883
2026-09-18T15:05:30Z
Keresturec
18
1 измена увезена из [[:en:Template:Infobox_settlement/doc]]: Importing from the English wikipedia
21883
wikitext
text/x-wiki
{{Documentation subpage}}
<!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])-->
{{Auto short description}}
{{High-use}}
{{Lua|Module:Infobox|Module:InfoboxImage|Module:Coordinates|Module:Check for unknown parameters|Module:Check for conflicting parameters|Module:Settlement short description|Module:Wikidata}}
{{Uses TemplateStyles|Template:Infobox settlement/styles.css}}
{{Uses Wikidata|P41|P94|P158|P625|P856}}
This template should be used to produce an [[WP:Infobox|Infobox]] for human settlements (cities, towns, villages, communities) as well as other administrative districts, counties, provinces, et cetera—in fact, any subdivision below the level of a country, for which {{tl|Infobox country}} should be used. Parameters are described in the table below. For questions, see the [[Template talk:Infobox settlement|talk page]]. For a US city guideline, see [[WP:USCITIES]].
The template is aliased or used as a sub-template for several infobox front-end templates.
==Usage==
* '''Important''': Please enter all numeric values in a raw, unformatted fashion. References and {{tl|citation needed}} tags are to be included in their respective section footnotes field. Numeric values that are not "raw" may create an "Expression error". Raw values will be automatically formatted by the template. If you find a raw value is not formatted in your usage of the template, please post a notice on the discussion page for this template.
* An expression error may also occur when any coordinate parameter has a value, but one or more coordinate parameters are blank or invalid.
* To specify CSS class "X" should be applied to an image, append to the filename: <code><nowiki>{{!}}class=X</nowiki></code>
Basic blank template, ready to cut and paste. See the next section for a copy of the template with all parameters and comments. See the table below that for a full description of each parameter.
===Using metric units===
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox settlement
|name =
|native_name = <!-- Settlement name in the dominant local language(s), if different from the English name -->
|native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead -->
|type =
|image =
|image_size =
|alt =
|caption =
|image_flag =
|flag_alt =
|image_seal =
|seal_alt =
|image_shield =
|shield_alt =
|etymology =
|nickname =
|motto =
|image_map =
|map_alt =
|map_caption =
|pushpin_map =
|pushpin_alt =
|pushpin_caption =
|pushpin_map_size =
|pushpin_label_position =
|mapframe = <!-- "yes" to show an interactive map -->
|coordinates = <!-- {{coord|latitude|longitude|type:city|display=inline,title}} -->
|coor_pinpoint =
|coordinates_footnotes =
|subdivision_type = Country
|subdivision_name =
|subdivision_type1 =
|subdivision_name1 =
|subdivision_type2 =
|subdivision_name2 =
|subdivision_type3 =
|subdivision_name3 =
|established_title =
|established_date =
|founder =
|seat_type =
|seat =
|government_footnotes =
|government_type =
|governing_body =
|leader_party =
|leader_title =
|leader_name =
|leader_title1 =
|leader_name1 =
|leader_title2 =
|leader_name2 =
|leader_title3 =
|leader_name3 =
|leader_title4 =
|leader_name4 =
|unit_pref = Metric
<!-- ALL fields with measurements have automatic unit conversion -->
<!-- for references: use <ref> tags -->
|area_footnotes =
|area_urban_footnotes = <!-- <ref> </ref> -->
|area_rural_footnotes = <!-- <ref> </ref> -->
|area_metro_footnotes = <!-- <ref> </ref> -->
|area_note =
|area_water_percent =
|area_rank =
|area_blank1_title =
|area_blank2_title =
<!-- square kilometers -->
|area_total_km2 =
|area_land_km2 =
|area_water_km2 =
|area_urban_km2 =
|area_rural_km2 =
|area_metro_km2 =
|area_blank1_km2 =
|area_blank2_km2 =
<!-- hectares -->
|area_total_ha =
|area_land_ha =
|area_water_ha =
|area_urban_ha =
|area_rural_ha =
|area_metro_ha =
|area_blank1_ha =
|area_blank2_ha =
|length_km =
|width_km =
|dimensions_footnotes =
|elevation_footnotes =
|elevation_m =
|population_footnotes =
|population_as_of =
|population_total =
|population_density_km2 = auto
|population_note =
|population_demonym =
|time_zone1 =
|utc_offset1 =
|time_zone1_DST =
|utc_offset1_DST =
|postal_code_type =
|postal_code =
|area_code_type =
|area_code =
|area_codes = <!-- for multiple area codes -->
|iso_code =
|website = <!-- {{Official URL}} -->
|module =
|footnotes =
}}
</syntaxhighlight>
===Using non-metric units===
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox settlement
|name =
|native_name =
|native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead -->
|type =
|image =
|image_size =
|alt =
|caption =
|image_flag =
|flag_alt =
|image_seal =
|seal_alt =
|image_shield =
|shield_alt =
|etymology =
|nickname =
|motto =
|image_map =
|map_alt =
|map_caption =
|pushpin_map =
|pushpin_alt =
|pushpin_caption =
|pushpin_label_position =
|mapframe = <!-- "yes" to show an interactive map -->
|coordinates = <!-- {{coord|latitude|longitude|type:city|display=inline,title}} -->
|coor_pinpoint =
|coordinates_footnotes =
|subdivision_type = Country
|subdivision_name =
|subdivision_type1 =
|subdivision_name1 =
|subdivision_type2 =
|subdivision_name2 =
|subdivision_type3 =
|subdivision_name3 =
|established_title =
|established_date =
|founder =
|seat_type =
|seat =
|government_footnotes =
|leader_party =
|leader_title =
|leader_name =
|unit_pref = Imperial
<!-- ALL fields with measurements have automatic unit conversion -->
<!-- for references: use <ref> tags -->
|area_footnotes =
|area_urban_footnotes = <!-- <ref> </ref> -->
|area_rural_footnotes = <!-- <ref> </ref> -->
|area_metro_footnotes = <!-- <ref> </ref> -->
|area_note =
|area_water_percent =
|area_rank =
|area_blank1_title =
|area_blank2_title =
<!-- square miles -->
|area_total_sq_mi =
|area_land_sq_mi =
|area_water_sq_mi =
|area_urban_sq_mi =
|area_rural_sq_mi =
|area_metro_sq_mi =
|area_blank1_sq_mi =
|area_blank2_sq_mi =
<!-- acres -->
|area_total_acre =
|area_land_acre =
|area_water_acre =
|area_urban_acre =
|area_rural_acre =
|area_metro_acre =
|area_blank1_acre =
|area_blank2_acre =
|length_mi =
|width_mi =
|dimensions_footnotes =
|elevation_footnotes =
|elevation_ft =
|population_footnotes =
|population_as_of =
|population_total =
|population_density_sq_mi = auto
|population_note =
|population_demonym =
|time_zone1 =
|utc_offset1 =
|time_zone1_DST =
|utc_offset1_DST =
|postal_code_type =
|postal_code =
|area_code_type =
|area_code =
|iso_code =
|website = <!-- {{Official URL}} -->
|module =
|footnotes =
}}
</syntaxhighlight>
===Short version===
<syntaxhighlight lang="wikitext" style="overflow:auto">
{{Infobox settlement
|name =
|native_name =
|native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead -->
|type =
|image =
|image_size =
|alt =
|caption =
|etymology =
|nickname =
|coordinates = <!-- {{Coord}} -->
|population_total =
|subdivision_type = Country
|subdivision_name =
|subdivision_type1 =
|subdivision_name1 =
|subdivision_type2 =
|subdivision_name2 =
|website = <!-- {{Official URL}} -->
}}
</syntaxhighlight>
===Complete empty syntax, with comments===
This copy of the template lists all parameters except for some of the repeating numbered parameters which are noted in the comments. Comments here should be brief; see the table below for full descriptions of each parameter.
<syntaxhighlight lang="wikitext" style="overflow:auto;">
{{Infobox settlement
| name = <!-- at least one of the first two fields must be filled in -->
| native_name = <!-- if different from the English name -->
| native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead -->
| other_name =
| type = <!-- such as Town, Village, City, Borough etc. -->
| official_name = <!-- avoid if redundant with e.g. `type` of `name` -->
<!-- transliteration(s) -->
| translit_lang1 =
| translit_lang1_type =
| translit_lang1_info =
| translit_lang1_type1 =
| translit_lang1_info1 =
| translit_lang1_type2 =
| translit_lang1_info2 = <!-- etc., up to translit_lang1_type6 / translit_lang1_info6 -->
| translit_lang2 =
| translit_lang2_type =
| translit_lang2_info =
| translit_lang2_type1 =
| translit_lang2_info1 =
| translit_lang2_type2 =
| translit_lang2_info2 = <!-- etc., up to translit_lang2_type6 / translit_lang2_info6 -->
<!-- images, nickname, motto -->
| image =
| image_size =
| alt =
| caption =
| image_flag =
| flag_size =
| flag_alt =
| flag_border =
| flag_link =
| image_seal =
| seal_size =
| seal_alt =
| seal_link =
| seal_type =
| seal_class =
| image_shield =
| shield_size =
| shield_alt =
| shield_link =
| image_blank_emblem =
| blank_emblem_type =
| blank_emblem_size =
| blank_emblem_alt =
| blank_emblem_link =
| etymology =
| nickname =
| nicknames =
| motto =
| mottoes =
| anthem =
<!-- maps and coordinates -->
| image_map =
| map_size =
| map_alt =
| map_caption =
| image_map1 =
| map_size1 =
| map_alt1 =
| map_caption1 =
| pushpin_map = <!-- name of a location map as per Template:Location_map -->
| pushpin_map_size =
| pushpin_alt =
| pushpin_caption =
| pushpin_label = <!-- only necessary if "name" or "official_name" are too long -->
| pushpin_label_position = <!-- position of the pushpin label: left, right, top, bottom, none -->
| pushpin_relief =
| mapframe = <!-- "yes" to show an interactive map -->
| coordinates = <!-- {{Coord}} -->
| coor_pinpoint = <!-- to specify exact location of coordinates (was coor_type) -->
| coordinates_footnotes = <!-- for references: use <ref> tags -->
| grid_name = <!-- name of a regional grid system -->
| grid_position = <!-- position on the regional grid system -->
<!-- location -->
| subdivision_type = Country
| subdivision_name = <!-- the name of the country -->
| subdivision_type1 =
| subdivision_name1 =
| subdivision_type2 =
| subdivision_name2 = <!-- etc., subdivision_type6 / subdivision_name6 -->
<!-- established -->
| established_title = <!-- Founded -->
| established_date = <!-- requires established_title= -->
| established_title1 = <!-- Incorporated (town) -->
| established_date1 = <!-- requires established_title1= -->
| established_title2 = <!-- Incorporated (city) -->
| established_date2 = <!-- requires established_title2= -->
| established_title3 =
| established_date3 = <!-- requires established_title3= -->
| established_title4 =
| established_date4 = <!-- requires established_title4= -->
| established_title5 =
| established_date5 = <!-- requires established_title5= -->
| established_title6 =
| established_date6 = <!-- requires established_title6= -->
| established_title7 =
| established_date7 = <!-- requires established_title7= -->
| extinct_title =
| extinct_date = <!-- requires extinct_title= -->
| founder =
| named_for =
<!-- seat, smaller parts -->
| seat_type = <!-- defaults to: Seat -->
| seat =
| seat1_type = <!-- defaults to: Former seat -->
| seat1 =
| parts_type = <!-- defaults to: Boroughs -->
| parts_style = <!-- list, coll (collapsed list), para (paragraph format) -->
| parts = <!-- parts text, or header for parts list -->
| p1 =
| p2 = <!-- etc., up to p50: for separate parts to be listed-->
<!-- government type, leaders -->
| government_footnotes = <!-- for references: use <ref> tags -->
| government_type =
| governing_body =
| leader_party =
| leader_title =
| leader_name = <!-- add &nbsp; (no-break space) to disable automatic links -->
| leader_title1 =
| leader_name1 = <!-- etc., up to leader_title4 / leader_name4 -->
<!-- display settings -->
| total_type = <!-- to set a non-standard label for total area and population rows -->
| unit_pref = <!-- enter: Imperial, to display imperial before metric -->
<!-- area -->
| area_footnotes = <!-- for references: use <ref> tags -->
| dunam_link = <!-- If dunams are used, this specifies which dunam to link. -->
| area_total_km2 = <!-- ALL fields with measurements have automatic unit conversion -->
| area_total_sq_mi = <!-- see table @ Template:Infobox settlement for details -->
| area_total_ha =
| area_total_acre =
| area_total_dunam = <!-- used in Middle East articles only -->
| area_land_km2 =
| area_land_sq_mi =
| area_land_ha =
| area_land_acre =
| area_land_dunam = <!-- used in Middle East articles only -->
| area_water_km2 =
| area_water_sq_mi =
| area_water_ha =
| area_water_acre =
| area_water_dunam = <!-- used in Middle East articles only -->
| area_water_percent =
| area_urban_footnotes = <!-- for references: use <ref> tags -->
| area_urban_km2 =
| area_urban_sq_mi =
| area_urban_ha =
| area_urban_acre =
| area_urban_dunam = <!-- used in Middle East articles only -->
| area_rural_footnotes = <!-- for references: use <ref> tags -->
| area_rural_km2 =
| area_rural_sq_mi =
| area_rural_ha =
| area_rural_acre =
| area_rural_dunam = <!-- used in Middle East articles only -->
| area_metro_footnotes = <!-- for references: use <ref> tags -->
| area_metro_km2 =
| area_metro_sq_mi =
| area_metro_ha =
| area_metro_acre =
| area_metro_dunam = <!-- used in Middle East articles only -->
| area_rank =
| area_blank1_title =
| area_blank1_km2 =
| area_blank1_sq_mi =
| area_blank1_ha =
| area_blank1_acre =
| area_blank1_dunam = <!-- used in Middle East articles only -->
| area_blank2_title =
| area_blank2_km2 =
| area_blank2_sq_mi =
| area_blank2_ha =
| area_blank2_acre =
| area_blank2_dunam = <!-- used in Middle East articles only -->
| area_note =
<!-- dimensions -->
| dimensions_footnotes = <!-- for references: use <ref> tags -->
| length_km =
| length_mi =
| width_km =
| width_mi =
<!-- elevation -->
| elevation_footnotes = <!-- for references: use <ref> tags -->
| elevation_m =
| elevation_ft =
| elevation_point = <!-- for denoting the measurement point -->
| elevation_max_footnotes = <!-- for references: use <ref> tags -->
| elevation_max_m =
| elevation_max_ft =
| elevation_max_point = <!-- for denoting the measurement point -->
| elevation_max_rank =
| elevation_min_footnotes = <!-- for references: use <ref> tags -->
| elevation_min_m =
| elevation_min_ft =
| elevation_min_point = <!-- for denoting the measurement point -->
| elevation_min_rank =
<!-- population -->
| population_footnotes = <!-- for references: use <ref> tags -->
| population_as_of =
| population_total =
| pop_est_footnotes =
| pop_est_as_of =
| population_est =
| population_rank =
| population_density_km2 = <!-- for automatic calculation of any density field, use: auto -->
| population_density_sq_mi =
| population_urban_footnotes =
| population_urban =
| population_density_urban_km2 =
| population_density_urban_sq_mi =
| population_rural_footnotes =
| population_rural =
| population_density_rural_km2 =
| population_density_rural_sq_mi =
| population_metro_footnotes =
| population_metro =
| population_density_metro_km2 =
| population_density_metro_sq_mi =
| population_density_rank =
| population_blank1_title =
| population_blank1 =
| population_density_blank1_km2 =
| population_density_blank1_sq_mi =
| population_blank2_title =
| population_blank2 =
| population_density_blank2_km2 =
| population_density_blank2_sq_mi =
| population_demonym = <!-- demonym, e.g. Liverpudlian for someone from Liverpool -->
| population_demonyms =
| population_note =
<!-- demographics (section 1) -->
| demographics_type1 =
| demographics1_footnotes = <!-- for references: use <ref> tags -->
| demographics1_title1 =
| demographics1_info1 = <!-- etc., up to demographics1_title7 / demographics1_info7 -->
<!-- demographics (section 2) -->
| demographics_type2 =
| demographics2_footnotes = <!-- for references: use <ref> tags -->
| demographics2_title1 =
| demographics2_info1 = <!-- etc., up to demographics2_title10 / demographics2_info10 -->
<!-- time zone(s) -->
| time_zone_link =
| time_zone1_location =
| time_zone1 =
| utc_offset1 =
| time_zone1_DST =
| utc_offset1_DST =
| time_zone2_location =
| time_zone2 =
| utc_offset2 =
| time_zone2_DST =
| utc_offset2_DST =
| time_zone3_location =
| time_zone3 =
| utc_offset3 =
| time_zone3_DST =
| utc_offset3_DST =
| time_zone4_location =
| time_zone4 =
| utc_offset4 =
| time_zone4_DST =
| utc_offset4_DST =
| time_zone5_location =
| time_zone5 =
| utc_offset5 =
| time_zone5_DST =
| utc_offset5_DST =
<!-- postal codes, area code -->
| postal_code_type = <!-- enter ZIP Code, Postcode, Post code, Postal code... -->
| postal_code =
| postal2_code_type = <!-- enter ZIP Code, Postcode, Post code, Postal code... -->
| postal2_code =
| area_code_type = <!-- defaults to: Area code(s) -->
| area_code =
| area_codes =
| geocode =
| iso_code =
| registration_plate_type =
| registration_plate =
| code1_name =
| code1_info =
| code2_name =
| code2_info =
<!-- custom fields (section 1) -->
| custom_label_sec1 =
| custom_data_sec1 =
| custom_label1_sec1 =
| custom_data1_sec1 =
| custom_label2_sec1 =
| custom_data2_sec1 = <!-- etc., up to custom_label7_sec1 / custom_data7_sec1 -->
<!-- custom fields (section 2) -->
| custom_label_sec2 =
| custom_data_sec2 =
| custom_label1_sec2 =
| custom_data1_sec2 =
| custom_label2_sec2 =
| custom_data2_sec2 = <!-- etc., up to custom_label7_sec2 / custom_data7_sec2 -->
<!-- website, footnotes -->
| website = <!-- {{Official URL}} -->
| module =
| footnotes =
}}
</syntaxhighlight>
<section begin=parameters /> <!-- Used to transclude this on wrapper templates via {{#section:Template:Infobox settlement/doc|parameters}} -->
==Parameter names and descriptions==
{| class="wikitable"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Name and transliteration===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
| '''name''' || optional || This is the usual name in English. If it's not specified, the infobox will use the '''official_name''' as a title unless this too is missing, in which case the page name will be used.
|- style="vertical-align:top;"
| '''native_name''' || optional || Name or names in the local language, if different from 'name', and if not English. This parameter may be used for the name in the de facto local language (e.g. German for [[Munich]]). Per the [[Template talk:Infobox settlement/Archive 32#RFC on usage of native name parameter for First Nations placenames|2023 RfC]], it may also be used for names used by First Nations/[[Indigenous peoples]], '''regardless''' of whether they are the dominant ethnic group in the location.
|- style="vertical-align:top;"
| '''native_name_lang''' || optional || Use [[List of ISO 639-1 codes|ISO 639-1 code]], e.g. "fr" for French. If there is more than one dominant name, in different languages, enter those names using {{tl|lang}}, instead.
|- style="vertical-align:top;"
| '''other_name''' || optional || For places with other commonly used names like Bombay or Saigon
|- style="vertical-align:top;"
| '''type''' || optional || Any type can be entered, such as City, Town, Village, Hamlet, Municipality, Reservation, etc. If set, will be displayed under the names. Might also be used as a label for total population/area (defaulting to ''City''), if needed to distinguish from ''Urban'', ''Rural'' or ''Metro'' (if urban, rural or metro figures are not present, the label is ''Total'' unless '''total_type''' is set).
|- style="vertical-align:top;"
| '''official_name''' || optional || The official name in English. Avoid using '''official_name''' if it leads to redundancy with '''name''' and '''type'''. Use '''official_name''' if the official name is unusual or cannot be simply deduced from the name and settlement type.
|- style="vertical-align:top;"
| '''short_description''' || optional || Set to <code>no</code> to suppress the Short description generated by the infobox.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Transliteration(s)
|- style="vertical-align:top;"
| '''translit_lang1''' || optional || Will place the "entry" before the word "transliteration(s)". Can be used to specify a particular language like in [[Dêlêg]] or one may just enter "Other", like in [[Gaza City|Gaza]]'s article.
|- style="vertical-align:top;"
| '''translit_lang1_type'''<br />'''translit_lang1_type1'''<br />to<br />'''translit_lang1_type6''' || optional ||
|- style="vertical-align:top;"
| '''translit_lang1_info'''<br />'''translit_lang1_info1'''<br />to<br />'''translit_lang1_info6''' || optional ||
|- style="vertical-align:top;"
| '''translit_lang2''' || optional || Will place a second transliteration. See [[Dêlêg]]
|- style="vertical-align:top;"
| '''translit_lang2_type'''<br />'''translit_lang2_type1'''<br />to<br />'''translit_lang2_type6''' || optional ||
|- style="vertical-align:top;"
| '''translit_lang2_info'''<br />'''translit_lang2_info1'''<br />to<br />'''translit_lang2_info6''' || optional ||
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Images, nickname, motto===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Image
|- style="vertical-align:top;"
| '''image''' || optional || Primary image representing the settlement. Commonly a photo of the settlement’s skyline. For large urban areas, the <nowiki>{{multiple image}}</nowiki> template is often used in place of a single image to create a collage of the settlement's skyline and several notable landmarks.
|- style="vertical-align:top;"
| '''image_size''' || optional || Can be used to tweak the size of the image up or down. This can be helpful if an editor wants to make the infobox wider. If used, '''px''' must be specified; default size is 250px. Note [[WP:IMGSIZELEAD]] recommends that images should be no wider than <code>upright=1.35</code> -equivalent to 300px
|- style="vertical-align:top;"
| '''alt''' || optional || [[Alt text]] for the image, used by visually impaired readers who cannot see the image. See [[WP:ALT]].
|- style="vertical-align:top;"
| '''caption''' || optional || Will place a caption under the image (if present)
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Flag image
|- style="vertical-align:top;"
| '''image_flag''' || optional || Used for a flag.
|- style="vertical-align:top;"
| '''flag_size''' || optional || Can be used to tweak the size of the image_flag up or down from 100px as desired. If used, '''px''' must be specified; default size is 100px.
|- style="vertical-align:top;"
| '''flag_alt''' || optional || Alt text for the flag.
|- style="vertical-align:top;"
| '''flag_border''' || optional || Set to 'no' to remove the border from the flag
|- style="vertical-align:top;"
| '''flag_link''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Seal image
|- style="vertical-align:top;"
| '''image_seal''' || optional || If the place has an official seal.
|- style="vertical-align:top;"
| '''seal_size''' || optional || If used, '''px''' must be specified; default size is 100px.
|- style="vertical-align:top;"
| '''seal_alt''' || optional || Alt text for the seal.
|- style="vertical-align:top;"
| '''seal_link'''<br />'''seal_type''' || optional ||
|- style="vertical-align:top;"
| '''seal_class''' || optional || CSS class for the seal image. Parameter {{para|seal_class|skin-invert}} can be used for dark mode support if the seal image is monochrome.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Coat of arms image
|- style="vertical-align:top;"
| '''image_shield''' || optional || Can be used for a place with a coat of arms.
|- style="vertical-align:top;"
| '''shield_size''' || optional || If used, '''px''' must be specified; default size is 100px.
|- style="vertical-align:top;"
| '''shield_alt''' || optional || Alt text for the shield.
|- style="vertical-align:top;"
| '''shield_link''' || optional || Can be used if a wiki article if known but is not automatically linked by the template. See [[Coquitlam, British Columbia]]'s infobox for an example.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Logo or emblem image
|- style="vertical-align:top;"
| '''image_blank_emblem''' || optional || Can be used if a place has an official logo, crest, emblem, etc.
|- style="vertical-align:top;"
| '''blank_emblem_type''' || optional || Caption beneath "image_blank_emblem" to specify what type of emblem it is.
|- style="vertical-align:top;"
| '''blank_emblem_size''' || optional || If used, '''px''' must be specified; default size is 100px.
|- style="vertical-align:top;"
| '''blank_emblem_alt''' || optional || Alt text for blank emblem.
|- style="vertical-align:top;"
| '''blank_emblem_link''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Nickname, motto
|- style="vertical-align:top;"
| '''etymology''' || optional || origin of name
|- style="vertical-align:top;"
| '''nickname''' || optional || well-known nickname
|- style="vertical-align:top;"
| '''nicknames''' || optional || if more than one well-known nickname, use this
|- style="vertical-align:top;"
| '''motto''' || optional || Will place the motto under the nicknames
|- style="vertical-align:top;"
| '''mottoes''' || optional || if more than one motto, use this
|- style="vertical-align:top;"
| '''anthem''' || optional || Will place the anthem (song) under the nicknames
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Maps, coordinates===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Map images
|- style="vertical-align:top;"
| '''image_map''' || optional ||
|- style="vertical-align:top;"
| '''map_size''' || optional || If used, '''px''' must be specified; default is 250px.
|- style="vertical-align:top;"
| '''map_alt''' || optional || Alt text for map.
|- style="vertical-align:top;"
| '''map_caption''' || optional ||
|- style="vertical-align:top;"
| '''image_map1''' || optional || A secondary map image. The field '''image_map''' must be filled in first. Example see: [[Bloomsburg, Pennsylvania]].
|- style="vertical-align:top;"
| '''map_size1''' || optional || If used, '''px''' must be specified; default is 250px.
|- style="vertical-align:top;"
| '''map_alt1''' || optional || Alt text for secondary map.
|- style="vertical-align:top;"
| '''map_caption1''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Pushpin map(s), coordinates
|- style="vertical-align:top;"
| '''pushpin_map''' || optional || The name of a location map as per [[Template:Location map]] (e.g. ''Indonesia'' or ''Russia''). The coordinate fields (from {{para|coordinates}}) position a pushpin coordinate marker and label on the map '''automatically'''. Example: [[Padang, Indonesia]]. To show multiple pushpin maps, provide a list of maps separated by #, e.g., ''California#USA''
|- style="vertical-align:top;"
| '''pushpin_map_size''' || optional || Must be entered as only a number—'''do not use px'''. The default value is 250.<br />''Equivalent to <code>width</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_alt''' || optional || Alt text for pushpin map; used by [[screen reader]]s, see [[WP:ALT]].<br />''Equivalent to <code>alt</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_caption''' || optional || Fill out if a different caption from ''map_caption'' is desired.<br />''Equivalent to <code>caption</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_label''' || optional || The text of the label to display next to the identifying mark; a [[Wiki markup|wikilink]] can be used. If not specified, the label will be the text assigned to the ''name'' or ''official_name'' parameters (if {{para|pushpin_label_position|none}}, no label is displayed).<br />''Equivalent to <code>label</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_label_position''' || optional || The position of the label on the pushpin map relative to the pushpin coordinate marker. Valid options are {left, right, top, bottom, none}. If this field is not specified, the default value is ''right''.<br/>''Equivalent to <code>position</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''pushpin_relief''' || optional || Set this to <code>y</code> or any non-blank value to use an alternative relief map provided by the selected location map (if a relief map is available). <br/>''Equivalent to <code>relief</code> parameter in [[Template:Location map]].''
|- style="vertical-align:top;"
| '''mapframe''' || optional || Add a {{tl|infobox mapframe}} map. See the documentation below in [[#Mapframe maps]] for more details on usage.
|- style="vertical-align:top;"
| '''coordinates''' || optional || Latitude and longitude. Use {{tl|Coord}}. See the documentation for {{tl|Coord}} for more details on usage.
|- style="vertical-align:top;"
| '''coor_pinpoint''' || optional || If needed, to specify more exactly where (or what) coordinates are given (e.g. ''Town Hall'') or a specific place in a larger area (e.g. a city in a county). Example: In the article [[Masovian Voivodeship]], <code>coor_pinpoint=Warsaw</code> specifies [[Warsaw]].
|- style="vertical-align:top;"
| '''coordinates_footnotes''' || optional || Reference(s) for coordinates, placed within <code><nowiki><ref> </ref></nowiki></code> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''grid_name'''<br />'''grid_position''' || optional || Name of a regional grid system and position on the regional grid
|}
====Mapframe maps====
{{Infobox mapframe/doc/parameters
| onByDefault = yes, unless any of the other map parameters are present: {{para|pushpin_map}}, {{para|image_map}}, {{para|image_map1}}
| mapframe-frame-width = 250
| mapframe-length_km = {{para|length_km}}
| mapframe-length_mi = {{para|length_mi}}
| mapframe-width_km = {{para|width_km}}
| mapframe-width_mi = {{para|width_mi}}
| mapframe-area_km2 = {{para|area_total_km2}}
| mapframe-area_ha = {{para|area_total_ha}}
| mapframe-area_acre = {{para|area_total_acre}}
| mapframe-area_sq_mi = {{para|area_total_sq_mi}}
| mapframe-type = city
| mapframe-population = {{para|population_metro}} or {{para|population_total}}
| mapframe-marker = town
| mapframe-caption = Interactive map of {{para|name}} or {{para|official_name}} or {{tl|PAGENAMEBASE}}
}}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Location, established, seat, subdivisions, government, leaders===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Location
|- style="vertical-align:top;"
| {{anchor|subdivision_type}}'''subdivision_type''' || optional || almost always <code><nowiki>Country</nowiki></code>
|- style="vertical-align:top;"
| '''subdivision_name''' || optional || Depends on the subdivision_type — use the name in text form, sample: <code>United States</code>. Per [[MOS:INFOBOXFLAG]], flag icons or flag templates may be used in this field
|- style="vertical-align:top;"
| '''subdivision_type1'''<br />to<br />'''subdivision_type6''' || optional || Can be State/Province, region, county. These labels are for subdivisions ''above'' the level of the settlement described in the article. For subdivisions ''below'' or ''within'' the place described in the article, use {{para|parts_type}}.
|- style="vertical-align:top;"
| '''subdivision_name1'''<br />to<br />'''subdivision_name6''' || optional || Use the name in text form, sample: <code>Florida</code> or <code><nowiki>[[Florida]]</nowiki></code>. Per [[MOS:INFOBOXFLAG]], settlements "may have flags of the country and first-level administrative subdivision in infoboxes". Flag icons or flag templates is permitted for subdivision_name1 (which is usually state or province); flag icons or flag templates should '''not''' be used in subdivision_name2-6.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Established
|- style="vertical-align:top;"
| '''established_title''' || optional || Example: Founded
|- style="vertical-align:top;"
| '''established_date''' || optional || Requires established_title=
|- style="vertical-align:top;"
| '''established_title1''' || optional || Example: Incorporated (town) <br/>[Note that "established_title1" is distinct from "established_title"; you can think of "established_title" as behaving like "established_title0".]
|- style="vertical-align:top;"
| '''established_date1''' || optional || [See note for "established_title1".] Requires established_title1=
|- style="vertical-align:top;"
| '''established_title2''' || optional || Example: Incorporated (city)
|- style="vertical-align:top;"
| '''established_date2''' || optional || Requires established_title2=
|- style="vertical-align:top;"
| '''established_title3''' || optional ||
|- style="vertical-align:top;"
| '''established_date3''' || optional || Requires established_title3=
|- style="vertical-align:top;"
| '''established_title4''' || optional ||
|- style="vertical-align:top;"
| '''established_date4''' || optional || Requires established_title4=
|- style="vertical-align:top;"
| '''established_title5''' || optional ||
|- style="vertical-align:top;"
| '''established_date5''' || optional || Requires established_title5=
|- style="vertical-align:top;"
| '''established_title6''' || optional ||
|- style="vertical-align:top;"
| '''established_date6''' || optional || Requires established_title6=
|- style="vertical-align:top;"
| '''established_title7''' || optional ||
|- style="vertical-align:top;"
| '''established_date7''' || optional || Requires established_title7=
|- style="vertical-align:top;"
| '''extinct_title''' || optional || For when a settlement ceases to exist
|- style="vertical-align:top;"
| '''extinct_date''' || optional || Requires extinct_title=
|- style="vertical-align:top;"
| '''founder''' || optional || Who the settlement was founded by
|- style="vertical-align:top;"
| '''named_for''' || optional || The source of the name of the settlement (a person, a place, et cetera)
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Seat of government
|- style="vertical-align:top;"
| '''seat_type''' || optional || The label for the seat of government (defaults to ''Seat'').
|- style="vertical-align:top;"
| '''seat''' || optional || The seat of government.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Smaller parts (e.g. boroughs of a city)
|- style="vertical-align:top;"
| '''parts_type''' || optional || The label for the smaller subdivisions (defaults to ''Boroughs'').
|- style="vertical-align:top;"
| '''parts_style''' || optional || Set to ''list'' to display as a collapsible list, ''coll'' as a collapsed list, or ''para'' to use paragraph style. Default is ''list'' for up to 5 items, otherwise ''coll''.
|- style="vertical-align:top;"
| '''parts''' || optional || Text or header of the list of smaller subdivisions.
|- style="vertical-align:top;"
| '''p1'''<br />'''p2'''<br />to<br />'''p50''' || optional || The smaller subdivisions to be listed. Example: [[Warsaw]]
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Government type, leaders
|- style="vertical-align:top;"
| '''government_footnotes''' || optional || Reference(s) for government, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''government_type''' || optional || Examples: [[Mayor–council government]], [[Council–manager government]], [[City commission government]], ...
|- style="vertical-align:top;"
| '''governing_body''' || optional || Name of the place's governing body
|- style="vertical-align:top;"
| '''leader_party''' || optional || Political party of the place's leader
|- style="vertical-align:top;"
| '''leader_title''' || optional || First title of the place's leader, e.g. Mayor
|- style="vertical-align:top;"
| '''leader_name''' || optional || Name of the place's leader
|- style="vertical-align:top;"
| '''leader_title1'''<br />to<br />'''leader_title4''' || optional ||
|- style="vertical-align:top;"
| '''leader_name1'''<br />to<br />'''leader_name4''' || optional || For long lists use {{tl|Collapsible list}}. See [[Halifax Regional Municipality|Halifax]] for an example.
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Geographic information===
|- style="vertical-align:top;"
| colspan=3 | These fields have '''dual automatic unit conversion''' meaning that if only metric values are entered, the imperial values will be automatically converted and vice versa. If an editor wishes to over-ride the automatic conversion, e.g. if the source gives both metric and imperial or if a range of values is needed, they should enter both values in their respective fields. All values must be entered in a '''raw format: no commas, spaces, or unit symbols'''. The template will format them automatically.
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Display settings
|- style="vertical-align:top;"
| '''total_type''' || optional || Specifies what "total" area and population figure refer to, e.g. ''Greater London''. This overrides other labels for total population/area. To make the total area and population display on the same line as the words "Area" and "Population", with no "Total" or similar label, set the value of this parameter to '''&nbsp;'''.
|- style="vertical-align:top;"
| '''unit_pref''' || optional || To change the unit order to ''imperial (metric)'', enter '''imperial'''. The default display style is ''metric (imperial)''. However, the template will swap the order automatically if the '''subdivision_name''' equals some variation of the US or the UK.<br />For the Middle East, a unit preference of [[dunam]] can be entered (only affects total area). <br />
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Area
|- style="vertical-align:top;"
| '''area_footnotes''' || optional || Reference(s) for area, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''dunam_link''' || optional || If dunams are used, the default is to link the word ''dunams'' in the total area section. This can be changed by setting <code>dunam_link</code> to another measure (e.g. <code>dunam_link=water</code>). Linking can also be turned off by setting the parameter to something else (e.g. <code>dunam_link=none</code> or <code>dunam_link=off</code>).
|- style="vertical-align:top;"
| '''area_total_km2''' || optional || Total area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_total_sq_mi is empty.
|- style="vertical-align:top;"
| '''area_total_ha''' || optional || Total area in hectares—symbol: ha. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display acres if area_total_acre is empty.
|- style="vertical-align:top;"
| '''area_total_sq_mi''' || optional || Total area in square miles—symbol: sq mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_total_km2 is empty.
|- style="vertical-align:top;"
| '''area_total_acre''' || optional || Total area in acres. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display hectares if area_total_ha is empty.
|- style="vertical-align:top;"
| '''area_total_dunam''' || optional || Total area in dunams, which is wiki-linked. Used in middle eastern places like Israel, Gaza, and the West Bank. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers or hectares and square miles or acreds if area_total_km2, area_total_ha, area_total_sq_mi, and area_total_acre are empty. Examples: [[Gaza City|Gaza]] and [[Ramallah]]
|- style="vertical-align:top;"
| '''area_land_km2''' || optional || Land area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_land_sq_mi is empty.
|- style="vertical-align:top;"
| '''area_land_sq_mi''' || optional || Land area in square miles—symbol: sq mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_land_km2 is empty.
|- style="vertical-align:top;"
| '''area_land_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_land_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_land_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_water_km2''' || optional || Water area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_water_sq_mi is empty.
|- style="vertical-align:top;"
| '''area_water_sq_mi''' || optional || Water area in square miles—symbol: sq mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_water_km2 is empty.
|- style="vertical-align:top;"
| '''area_water_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_water_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_water_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_water_percent''' || optional || percent of water without the "%"
|- style="vertical-align:top;"
| '''area_urban_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_urban_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_urban_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_urban_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_urban_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_rural_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_rural_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_rural_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_rural_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_rural_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_metro_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_metro_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_metro_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_metro_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_metro_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_rank''' || optional || The settlement's area, as ranked within its parent sub-division
|- style="vertical-align:top;"
| '''area_blank1_title''' || optional || Example see London
|- style="vertical-align:top;"
| '''area_blank1_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_blank1_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_blank1_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_blank1_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_blank1_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_blank2_title''' || optional ||
|- style="vertical-align:top;"
| '''area_blank2_km2''' || optional ||
|- style="vertical-align:top;"
| '''area_blank2_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''area_blank2_ha''' || optional || similar to <code>area_total_ha</code>
|- style="vertical-align:top;"
| '''area_blank2_dunam''' || optional || similar to <code>area_total_dunam</code>
|- style="vertical-align:top;"
| '''area_blank2_acre''' || optional || similar to <code>area_total_acre</code>
|- style="vertical-align:top;"
| '''area_note''' || optional || A place for additional information such as the name of the source.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Dimensions
|- style="vertical-align:top;"
| '''dimensions_footnotes''' || optional || Reference(s) for dimensions, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''length_km''' || optional || Raw number entered in kilometers. Will automatically convert to display length in miles if length_mi is empty.
|- style="vertical-align:top;"
| '''length_mi''' || optional || Raw number entered in miles. Will automatically convert to display length in kilometers if length_km is empty.
|- style="vertical-align:top;"
| '''width_km''' || optional || Raw number entered in kilometers. Will automatically convert to display width in miles if length_mi is empty.
|- style="vertical-align:top;"
| '''width_mi''' || optional || Raw number entered in miles. Will automatically convert to display width in kilometers if length_km is empty.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Elevation
|- style="vertical-align:top;"
| '''elevation_footnotes''' || optional || Reference(s) for elevation, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''elevation_m''' || optional || Raw number entered in meters. Will automatically convert to display elevation in feet if elevation_ft is empty. However, if a range in elevation (i.e. 5–50 m ) is desired, use the "max" and "min" fields below
|- style="vertical-align:top;"
| '''elevation_ft''' || optional || Raw number, entered in feet. Will automatically convert to display the average elevation in meters if '''elevation_m''' field is empty. However, if a range in elevation (e.g. 50–500 ft ) is desired, use the "max" and "min" fields below
|- style="vertical-align:top;"
| '''elevation_max_footnotes'''<br />'''elevation_min_footnotes''' || optional || Same as above, but for the "max" and "min" elevations. See [[City of Leeds]].
|- style="vertical-align:top;"
| '''elevation_max_m'''<br />'''elevation_max_ft'''<br />'''elevation_max_rank'''<br />'''elevation_min_m'''<br />'''elevation_min_ft'''<br />'''elevation_min_rank''' || optional || Used to give highest & lowest elevations and rank, instead of just a single value. Example: [[Halifax Regional Municipality]].
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Population, demographics===
|- style="vertical-align:top;"
| colspan=3 | The density fields have '''dual automatic unit conversion''' meaning that if only metric values are entered, the imperial values will be automatically converted and vice versa. If an editor wishes to over-ride the automatic conversion, e.g. if the source gives both metric and imperial or if a range of values is needed, they can enter both values in their respective fields. '''To calculate density with respect to the total area automatically, type ''auto'' in place of any density value.'''
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Population
|- style="vertical-align:top;"
| '''population_total''' || optional || Actual population (see below for estimates) preferably consisting of digits only (without any commas)
|- style="vertical-align:top;"
| '''population_as_of''' || optional || The year for the population total (usually a census year)
|- style="vertical-align:top;"
| '''population_footnotes''' || optional || Reference(s) for population, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_density_km2''' || optional || Set to {{code|auto}} to auto generate based on {{para|population_total}} and {{para|area_total_km2}}
|- style="vertical-align:top;"
| '''population_density_sq_mi''' || optional || Set to {{code|auto}} to auto generate based on {{para|population_total}} and {{para|area_total_sq_mi}}
|- style="vertical-align:top;"
| '''population_est''' || optional || Population estimate
|- style="vertical-align:top;"
| '''pop_est_as_of''' || optional || The year or month & year of the population estimate
|- style="vertical-align:top;"
| '''pop_est_footnotes''' || optional || Reference(s) for population estimate, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_urban''' || optional ||
|- style="vertical-align:top;"
| '''population_urban_footnotes''' || optional || Reference(s) for urban population, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_density_urban_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_urban_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_rural''' || optional ||
|- style="vertical-align:top;"
| '''population_rural_footnotes''' || optional || Reference(s) for rural population, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_density_rural_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_rural_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_metro''' || optional ||
|- style="vertical-align:top;"
| '''population_metro_footnotes''' || optional || Reference(s) for metro population, placed within <nowiki><ref> </ref></nowiki> tags
|- style="vertical-align:top;"
| '''population_density_metro_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_metro_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_rank''' || optional || The settlement's population, as ranked within its parent sub-division
|- style="vertical-align:top;"
| '''population_density_rank''' || optional || The settlement's population density, as ranked within its parent sub-division
|- style="vertical-align:top;"
| '''population_blank1_title''' || optional || Can be used for estimates. Example: [[Windsor, Ontario]]
|- style="vertical-align:top;"
| '''population_blank1''' || optional || The population value for blank1_title
|- style="vertical-align:top;"
| '''population_density_blank1_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_blank1_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_blank2_title''' || optional ||
|- style="vertical-align:top;"
| '''population_blank2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_blank2_km2''' || optional ||
|- style="vertical-align:top;"
| '''population_density_blank2_sq_mi''' || optional ||
|- style="vertical-align:top;"
| '''population_demonym''' || optional || A demonym or gentilic is a word that denotes the members of a people or the inhabitants of a place. For example, a citizen in [[Liverpool]] is known as a [[Liverpudlian]].
|- style="vertical-align:top;"
| '''population_demonyms''' || optional || If more than one demonym, use this
|- style="vertical-align:top;"
| '''population_note''' || optional || A place for additional information such as the name of the source. See [[Windsor, Ontario]] for example.
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Demographics (section 1)
|- style="vertical-align:top;"
| '''demographics_type1''' || optional || Section Header. For example: Ethnicity
|- style="vertical-align:top;"
| '''demographics1_footnotes''' || optional || Reference(s) for demographics section 1, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''demographics1_title1'''<br />to<br />'''demographics1_title7''' || optional || Titles related to demographics_type1. For example: White, Black, Hispanic...
|- style="vertical-align:top;"
| '''demographics1_info1'''<br />to<br />'''demographics1_info7''' || optional || Information related to the "titles". For example: 50%, 25%, 10%...
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Demographics (section 2)
|- style="vertical-align:top;"
| '''demographics_type2''' || optional || A second section header. For example: Languages
|- style="vertical-align:top;"
| '''demographics2_footnotes''' || optional || Reference(s) for demographics section 2, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}}
|- style="vertical-align:top;"
| '''demographics2_title1'''<br />to<br />'''demographics2_title10''' || optional || Titles related to demographics_type2. For example: English, French, Arabic...
|- style="vertical-align:top;"
| '''demographics2_info1'''<br />to<br />'''demographics2_info10''' || optional || Information related to the "titles" for type2. For example: 50%, 25%, 10%...
|}
{| class="wikitable"
|- style="vertical-align:top;"
| colspan=3 style="color:inherit; background: orange; text-align: center;" |
===Other information===
|- style="color: black; background: whitesmoke;"
! Parameter name !! Usage !! Description
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Time zone(s)
|- style="vertical-align:top;"
| '''time_zone1''' || optional ||
|- style="vertical-align:top;"
| '''utc_offset1''' || optional || Plain text, e.g. "+05:00" or "−08:00". Auto-linked, so do not include references or additional text.
|- style="vertical-align:top;"
| '''time_zone1_DST''' || optional ||
|- style="vertical-align:top;"
| '''utc_offset1_DST''' || optional ||
|- style="vertical-align:top;"
| '''time_zone2''' || optional || A second time zone field for larger areas. Up to five time zones may be included.
|- style="vertical-align:top;"
| '''utc_offset2''' || optional ||
|- style="vertical-align:top;"
| '''time_zone2_DST''' || optional ||
|- style="vertical-align:top;"
| '''utc_offset2_DST''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Postal code(s) & area code
|- style="vertical-align:top;"
| '''postal_code_type''' || optional ||
|- style="vertical-align:top;"
| '''postal_code''' || optional ||
|- style="vertical-align:top;"
| '''postal2_code_type''' || optional ||
|- style="vertical-align:top;"
| '''postal2_code''' || optional ||
|- style="vertical-align:top;"
| '''area_code_type''' || optional || If left blank/not used template will default to "[[Telephone numbering plan|Area code(s)]]"
|- style="vertical-align:top;"
| '''area_code''' || optional || Refers to the telephone dialing code for the settlement, ''not'' a geographic area code.
|- style="vertical-align:top;"
| '''area_codes''' || optional || If more than one area code, use this
|- style="vertical-align:top;"
| '''geocode''' || optional || See [[Geocode]]
|- style="vertical-align:top;"
| '''iso_code''' || optional || See [[ISO 3166]]
|- style="vertical-align:top;"
| '''registration_plate_type''' || optional || If left blank/not used template will default to "[[Vehicle registration plate|Vehicle registration]]"
|- style="vertical-align:top;"
| '''registration_plate''' || optional || See [[Vehicle registration plate]]
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Custom fields (section 1)
|- style="vertical-align:top;"
| '''custom_label_sec1''' || optional || Fields used to display other information. The name is displayed in bold on the left side of the infobox.
|- style="vertical-align:top;"
| '''custom_data_sec1''' || optional || The information associated with the ''blank_name'' heading. The info is displayed on right side of infobox, in the same row as the name. For an example, see: [[Warsaw]]
|- style="vertical-align:top;"
| '''custom_label1_sec1'''<br />to<br />'''custom_label7_sec1''' || optional || Up to 7 additional fields (8 total) can be displayed in this section
|- style="vertical-align:top;"
| '''custom_data1_sec1'''<br />to<br />'''custom_data7_sec1''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Custom fields (section 2)
|- style="vertical-align:top;"
| '''custom_label_sec2''' || optional || For a second section of custom fields
|- style="vertical-align:top;"
| '''custom_data_sec2''' || optional || Example: [[Beijing]]
|- style="vertical-align:top;"
| '''custom_label1_sec2'''<br />to<br />'''custom_label7_sec2''' || optional || Up to 7 additional fields (8 total) can be displayed in this section
|- style="vertical-align:top;"
| '''custom_data1_sec2'''<br />to<br />'''custom_data7_sec2''' || optional ||
|- style="vertical-align:top;"
! colspan=3 style="color:black; background: #ddd;" | Website, footnotes
|- style="vertical-align:top;"
| '''website''' || optional || External link to official website, use {{Tl|Official URL}} if Property P856 "official website" exists on Wikidata, or <nowiki>{{URL|example.com}}</nowiki>
|- style="vertical-align:top;"
| '''module''' || optional || To embed infoboxes at the bottom of the infobox
|- style="vertical-align:top;"
| '''footnotes''' || optional || Text to be displayed at the bottom of the infobox
|}
<!-- End of parameter name/description table -->
<section end=parameters />
==Examples==
;Example 1:
<!-- NOTE: This differs from the actual Chicago infobox in order to provide examples. -->
{{Infobox settlement
| name = Chicago
| type = [[City (Illinois)|City]]
| image = Chicago montage.jpg
| image_size = 275px <!--default is 250px-->
| caption = Clockwise from top: [[Downtown Chicago]], the [[Chicago Theatre]], the [[Chicago 'L']], [[Navy Pier]], [[Millennium Park]], the [[Field Museum]], and the [[Willis Tower|Willis (formerly Sears) Tower]]
| image_flag = Flag of Chicago, Illinois.svg
| image_seal =
| etymology = {{langx|mia|shikaakwa}} ("wild onion" or "wild garlic")
| nickname = [[Origin of Chicago's "Windy City" nickname|The Windy City]], The Second City, Chi-Town, Chi-City, Hog Butcher for the World, City of the Big Shoulders, The City That Works, and others found at [[List of nicknames for Chicago]]
| motto = {{langx|la|Urbs in Horto}} (City in a Garden), Make Big Plans (Make No Small Plans), I Will
| image_map = US-IL-Chicago.png
| map_caption = Location in the [[Chicago metropolitan area]] and Illinois
| pushpin_map = USA
| pushpin_caption = Location in the United States
| mapframe = yes
| mapframe-zoom = 8
| mapframe-stroke-width = 1
| mapframe-shape-fill = #0096ff
| mapframe-marker = building-alt1
| mapframe-wikidata = yes
| mapframe-id = Q1297
| coordinates = {{coord|41|50|15|N|87|40|55|W}}
| coordinates_footnotes = <ref name="USCB Gazetteer 2010"/>
| subdivision_type = Country
| subdivision_name = United States
| subdivision_type1 = State
| subdivision_name1 = [[Illinois]]
| subdivision_type2 = [[List of counties in Illinois|Counties]]
| subdivision_name2 = [[Cook County, Illinois|Cook]], [[DuPage County, Illinois|DuPage]]
| established_title = Settled
| established_date = 1770s
| established_title2 = [[Municipal corporation|Incorporated]]
| established_date2 = March 4, 1837
| founder =
| named_for = {{langx|mia|shikaakwa}}<br /> ("Wild onion")
| government_type = [[Mayor–council government|Mayor–council]]
| leader_title = [[Mayor of Chicago|Mayor]]
| leader_name = [[Rahm Emanuel]]
| leader_party = [[Democratic Party (United States)|D]]
| leader_title1 = [[City council|Council]]
| leader_name1 = [[Chicago City Council]]
| unit_pref = Imperial
| area_footnotes = <ref name="USCB Gazetteer 2010">{{cite web | url = https://www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt | title = 2010 United States Census Gazetteer for Places: January 1, 2010 | format = text | work = 2010 United States Census | publisher = [[United States Census Bureau]] | date = April 2010 | access-date = August 1, 2012}}</ref>
| area_total_sq_mi = 234.114
| area_land_sq_mi = 227.635
| area_water_sq_mi = 6.479
| area_water_percent = 3
| area_urban_sq_mi = 2123
| area_metro_sq_mi = 10874
| elevation_footnotes = <ref name="GNIS"/>
| elevation_ft = 594
| elevation_m = 181
| population_footnotes = <ref name="USCB PopEstCities 2011">{{cite web | url = https://www.census.gov/popest/data/cities/totals/2011/tables/SUB-EST2011-01.csv | title = Annual Estimates of the Resident Population for Incorporated Places Over 50,000, Ranked by July 1, 2011 Population | format = [[comma-separated values|CSV]] | work = 2011 Population Estimates | publisher = [[United States Census Bureau]], Population Division | date = June 2012 | access-date = August 1, 2012}}</ref><ref name="USCB Metro 2010">{{cite web | url=https://www.census.gov/prod/cen2010/briefs/c2010br-01.pdf | title = Population Change for the Ten Most Populous and Fastest Growing Metropolitan Statiscal Areas: 2000 to 2010 | date = March 2011 | publisher = [[U.S. Census Bureau]] | page = 6 |access-date = April 12, 2011}}</ref>
| population_as_of = [[2010 United States census|2010]]
| population_total = 2695598
| pop_est_footnotes =
| pop_est_as_of = 2011
| population_est = 2707120
| population_rank = [[List of United States cities by population|3rd US]]
| population_density_sq_mi = 11,892.4<!-- 2011 population_est / area_land_sq_mi -->
| population_urban = 8711000
| population_density_urban_sq_mi = auto
| population_metro = 9461105
| population_density_metro_sq_mi = auto
| population_demonym = Chicagoan
| time_zone = [[Central Standard Time|CST]]
| utc_offset = −06:00
| time_zone_DST = [[Central Daylight Time|CDT]]
| utc_offset_DST = −05:00
| area_code_type = [[North American Numbering Plan|Area codes]]
| area_codes = [[Area code 312|312]], [[Area code 773|773]], [[Area code 872|872]]
| custom_label_sec1 = [[Federal Information Processing Standards|FIPS]] code
| custom_data_sec1 = {{FIPS|17|14000}}
| custom_label1_sec1 = [[Geographic Names Information System|GNIS]] feature ID
| custom_data1_sec1 = {{GNIS 4|423587}}, {{GNIS 4|428803}}
| website = {{URL|www.cityofchicago.org}}
| footnotes = <ref name="GNIS">{{Cite gnis|428803|City of Chicago|April 12, 2011}}</ref>
}}
<syntaxhighlight lang="wikitext" style="overflow:auto; white-space: pre-wrap;">
<!-- NOTE: This differs from the actual Chicago infobox in order to provide examples. -->
{{Infobox settlement
| name = Chicago
| type = [[City (Illinois)|City]]
| image = Chicago montage.jpg
| image_size = 275px <!--default is 250px-->
| caption = Clockwise from top: [[Downtown Chicago]], the [[Chicago Theatre]], the [[Chicago 'L']], [[Navy Pier]], [[Millennium Park]], the [[Field Museum]], and the [[Willis Tower|Willis (formerly Sears) Tower]]
| image_flag = Flag of Chicago, Illinois.svg
| image_seal =
| etymology = {{langx|mia|shikaakwa}} ("wild onion" or "wild garlic")
| nickname = [[Origin of Chicago's "Windy City" nickname|The Windy City]], The Second City, Chi-Town, Chi-City, Hog Butcher for the World, City of the Big Shoulders, The City That Works, and others found at [[List of nicknames for Chicago]]
| motto = {{langx|la|Urbs in Horto}} (City in a Garden), Make Big Plans (Make No Small Plans), I Will
| image_map = US-IL-Chicago.png
| map_caption = Location in the [[Chicago metropolitan area]] and Illinois
| pushpin_map = USA
| pushpin_caption = Location in the United States
| mapframe = yes
| mapframe-zoom = 8
| mapframe-stroke-width = 1
| mapframe-shape-fill = #0096ff
| mapframe-marker = building-alt1
| coordinates = {{coord|41|50|15|N|87|40|55|W}}
| coordinates_footnotes = <ref name="USCB Gazetteer 2010"/>
| subdivision_type = Country
| subdivision_name = United States
| subdivision_type1 = State
| subdivision_name1 = [[Illinois]]
| subdivision_type2 = [[List of counties in Illinois|Counties]]
| subdivision_name2 = [[Cook County, Illinois|Cook]], [[DuPage County, Illinois|DuPage]]
| established_title = Settled
| established_date = 1770s
| established_title2 = [[Municipal corporation|Incorporated]]
| established_date2 = March 4, 1837
| founder =
| named_for = {{langx|mia|shikaakwa}}<br /> ("Wild onion")
| government_type = [[Mayor–council government|Mayor–council]]
| leader_title = [[Mayor of Chicago|Mayor]]
| leader_name = [[Rahm Emanuel]]
| leader_party = [[Democratic Party (United States)|D]]
| leader_title1 = [[City council|Council]]
| leader_name1 = [[Chicago City Council]]
| unit_pref = Imperial
| area_footnotes = <ref name="USCB Gazetteer 2010">{{cite web | url = https://www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt | title = 2010 United States Census Gazetteer for Places: January 1, 2010 | format = text | work = 2010 United States Census | publisher = [[United States Census Bureau]] | date = April 2010 | access-date = August 1, 2012}}</ref>
| area_total_sq_mi = 234.114
| area_land_sq_mi = 227.635
| area_water_sq_mi = 6.479
| area_water_percent = 3
| area_urban_sq_mi = 2123
| area_metro_sq_mi = 10874
| elevation_footnotes = <ref name="GNIS"/>
| elevation_ft = 594
| elevation_m = 181
| population_footnotes = <ref name="USCB PopEstCities 2011">{{cite web | url = https://www.census.gov/popest/data/cities/totals/2011/tables/SUB-EST2011-01.csv | title = Annual Estimates of the Resident Population for Incorporated Places Over 50,000, Ranked by July 1, 2011 Population | format = [[comma-separated values|CSV]] | work = 2011 Population Estimates | publisher = [[United States Census Bureau]], Population Division | date = June 2012 | access-date = August 1, 2012}}</ref><ref name="USCB Metro 2010">{{cite web | url=https://www.census.gov/prod/cen2010/briefs/c2010br-01.pdf | title = Population Change for the Ten Most Populous and Fastest Growing Metropolitan Statiscal Areas: 2000 to 2010 | date = March 2011 | publisher = [[U.S. Census Bureau]] | page = 6 |access-date = April 12, 2011}}</ref>
| population_as_of = [[2010 United States census|2010]]
| population_total = 2695598
| pop_est_footnotes =
| pop_est_as_of = 2011
| population_est = 2707120
| population_rank = [[List of United States cities by population|3rd US]]
| population_density_sq_mi = 11,892.4<!-- 2011 population_est / area_land_sq_mi -->
| population_urban = 8711000
| population_density_urban_sq_mi = auto
| population_metro = 9461105
| population_density_metro_sq_mi = auto
| population_demonym = Chicagoan
| time_zone = [[Central Standard Time|CST]]
| utc_offset = −06:00
| time_zone_DST = [[Central Daylight Time|CDT]]
| utc_offset_DST = −05:00
| area_code_type = [[North American Numbering Plan|Area codes]]
| area_codes = [[Area code 312|312]], [[Area code 773|773]], [[Area code 872|872]]
| custom_label_sec1 = [[Federal Information Processing Standards|FIPS]] code
| custom_data_sec1 = {{FIPS|17|14000}}
| custom_label1_sec1 = [[Geographic Names Information System|GNIS]] feature ID
| custom_data1_sec1 = {{GNIS 4|423587}}, {{GNIS 4|428803}}
| website = {{URL|www.cityofchicago.org}}
| footnotes = <ref name="GNIS">{{Cite gnis|428803|City of Chicago|April 12, 2011}}</ref>
}}
</syntaxhighlight>
'''References'''
{{reflist}}
{{clear}}
----
;Example 2:
{{Infobox settlement
| name = Detroit
| type = [[City (Michigan)|City]]
| image = Detroit Montage.jpg
| image_size = 290px
| caption = Images from top to bottom, left to right: [[Downtown Detroit]] skyline, [[Spirit of Detroit]], [[Greektown Historic District|Greektown]], [[Ambassador Bridge]], [[Michigan Soldiers' and Sailors' Monument]], [[Fox Theatre (Detroit)|Fox Theatre]], and [[Comerica Park]].
| image_flag = Flag of Detroit.svg
| image_seal = Seal of Detroit.svg
| etymology = {{langx|fr|détroit}} ([[strait]])
| nickname = The Motor City, Motown, Renaissance City, The D, Hockeytown, The Automotive Capital of the World, Rock City, The 313
| motto = ''Speramus Meliora; Resurget Cineribus''<br />([[Latin]]: We Hope For Better Things; It Shall Rise From the Ashes)
| image_map = Wayne County Michigan Incorporated and Unincorporated areas Detroit highlighted.svg
| map_size = 250x200px
| map_caption = Location within [[Wayne County, Michigan|Wayne County]] and the state of [[Michigan]]
| pushpin_map = USA
| pushpin_caption = Location within the [[contiguous United States]]
| mapframe = yes
| mapframe-stroke-width = 1
| mapframe-marker = city
| mapframe-zoom = 9
| mapframe-wikidata = yes
| mapframe-id = Q12439
| coordinates = {{coord|42|19|53|N|83|2|45|W}}
| coordinates_footnotes =
| subdivision_type = Country
| subdivision_name = United States
| subdivision_type1 = State
| subdivision_name1 = [[Michigan]]
| subdivision_type2 = [[List of counties in Michigan|County]]
| subdivision_name2 = [[Wayne County, Michigan|Wayne]]
| established_title = Founded
| established_date = 1701
| established_title2 = Incorporated
| established_date2 = 1806
| government_footnotes = <!-- for references: use<ref> tags -->
| government_type = [[Mayor–council government|Mayor–council]]
| leader_title = [[List of mayors of Detroit|Mayor]]
| leader_name = [[Mike Duggan]]
| leader_party = [[Democratic Party (United States)|D]]
| leader_title1 = [[Detroit City Council|City Council]]
| leader_name1 = {{collapsible list|bullets=yes
| title = Members
| 1 = [[Charles Pugh]] – Council President
| 2 = [[Gary Brown (Detroit politician)|Gary Brown]] – Council President Pro-Tem
| 3 = [[JoAnn Watson]]
| 4 = [[Kenneth Cockrel, Jr.]]
| 5 = [[Saunteel Jenkins]]
| 6 = [[Andre Spivey]]
| 7 = [[James Tate (Detroit politician)|James Tate]]
| 8 = [[Brenda Jones (Detroit politician)|Brenda Jones]]
| 9 = [[Kwame Kenyatta]]
}}
| unit_pref = Imperial
| area_footnotes =
| area_total_sq_mi = 142.87
| area_total_km2 = 370.03
| area_land_sq_mi = 138.75
| area_land_km2 = 359.36
| area_water_sq_mi = 4.12
| area_water_km2 = 10.67
| area_urban_sq_mi = 1295
| area_metro_sq_mi = 3913
| elevation_footnotes =
| elevation_ft = 600
| population_footnotes =
| population_as_of = 2011
| population_total = 706585
| population_rank = [[List of United States cities by population|18th in U.S.]]
| population_urban = 3863924
| population_metro = 4285832 (US: [[List of United States metropolitan statistical areas|13th]])
| population_blank1_title = [[Combined statistical area|CSA]]
| population_blank1 = 5207434 (US: [[List of United States combined statistical areas|11th]])
| population_density_sq_mi = {{#expr:713777/138.8 round 0}}
| population_demonym = Detroiter
| population_note =
| time_zone = [[Eastern Time Zone (North America)|EST]]
| utc_offset = −5
| time_zone_DST = [[Eastern Daylight Time|EDT]]
| utc_offset_DST = −4
| postal_code_type =
| postal_code =
| area_code = [[Area code 313|313]]
| custom_label_sec1 = [[Federal Information Processing Standards|FIPS code]]
| custom_data_sec1 = {{FIPS|26|22000}}
| custom_label1_sec1 = [[Geographic Names Information System|GNIS]] feature ID
| custom_data1_sec1 = {{GNIS 4|1617959}}, {{GNIS 4|1626181}}
| website = [http://www.detroitmi.gov/ DetroitMI.gov]
| footnotes =
}}
<syntaxhighlight lang="wikitext" style="overflow:auto; white-space: pre-wrap;">
{{Infobox settlement
| name = Detroit
| type = [[City (Michigan)|City]]
| image = Detroit Montage.jpg
| image_size = 290px
| caption = Images from top to bottom, left to right: [[Downtown Detroit]] skyline, [[Spirit of Detroit]], [[Greektown Historic District|Greektown]], [[Ambassador Bridge]], [[Michigan Soldiers' and Sailors' Monument]], [[Fox Theatre (Detroit)|Fox Theatre]], and [[Comerica Park]].
| image_flag = Flag of Detroit, Michigan.svg
| image_seal = Seal of Detroit, Michigan.svg
| etymology = {{langx|fr|détroit}} ([[strait]])
| nickname = The Motor City, Motown, Renaissance City, The D, Hockeytown, The Automotive Capital of the World, Rock City, The 313
| motto = ''Speramus Meliora; Resurget Cineribus''<br />([[Latin]]: We Hope For Better Things; It Shall Rise From the Ashes)
| image_map = Wayne County Michigan Incorporated and Unincorporated areas Detroit highlighted.svg
| map_size = 250x200px
| map_caption = Location within [[Wayne County, Michigan|Wayne County]] and the state of [[Michigan]]
| pushpin_map = USA
| pushpin_caption = Location within the [[contiguous United States]]
| mapframe = yes
| mapframe-stroke-width = 1
| mapframe-marker = city
| mapframe-zoom = 9
| coordinates = {{coord|42|19|53|N|83|2|45|W}}
| coordinates_footnotes =
| subdivision_type = Country
| subdivision_name = United States
| subdivision_type1 = State
| subdivision_name1 = Michigan
| subdivision_type2 = [[List of counties in Michigan|County]]
| subdivision_name2 = [[Wayne County, Michigan|Wayne]]
| established_title = Founded
| established_date = 1701
| established_title2 = Incorporated
| established_date2 = 1806
| government_footnotes = <!-- for references: use<ref> tags -->
| government_type = [[Mayor-council government|Mayor-Council]]
| leader_title = [[List of mayors of Detroit|Mayor]]
| leader_name = [[Mike Duggan]]
| leader_party = [[Democratic Party (United States)|D]]
| leader_title1 = [[Detroit City Council|City Council]]
| leader_name1 = {{collapsible list|bullets=yes
| title = Members
| 1 = [[Charles Pugh]] – Council President
| 2 = [[Gary Brown (Detroit politician)|Gary Brown]] – Council President Pro-Tem
| 3 = [[JoAnn Watson]]
| 4 = [[Kenneth Cockrel, Jr.]]
| 5 = [[Saunteel Jenkins]]
| 6 = [[Andre Spivey]]
| 7 = [[James Tate (Detroit politician)|James Tate]]
| 8 = [[Brenda Jones (Detroit politician)|Brenda Jones]]
| 9 = [[Kwame Kenyatta]]
}}
| unit_pref = Imperial
| area_footnotes =
| area_total_sq_mi = 142.87
| area_total_km2 = 370.03
| area_land_sq_mi = 138.75
| area_land_km2 = 359.36
| area_water_sq_mi = 4.12
| area_water_km2 = 10.67
| area_urban_sq_mi = 1295
| area_metro_sq_mi = 3913
| elevation_footnotes =
| elevation_ft = 600
| population_footnotes =
| population_as_of = 2011
| population_total = 706585
| population_rank = [[List of United States cities by population|18th in U.S.]]
| population_urban = 3863924
| population_metro = 4285832 (US: [[List of United States metropolitan statistical areas|13th]])
| population_blank1_title = [[Combined statistical area|CSA]]
| population_blank1 = 5207434 (US: [[List of United States combined statistical areas|11th]])
| population_density_sq_mi = {{#expr:713777/138.8 round 0}}
| population_demonym = Detroiter
| population_note =
| time_zone = [[Eastern Time Zone (North America)|EST]]
| utc_offset = −5
| time_zone_DST = [[Eastern Daylight Time|EDT]]
| utc_offset_DST = −4
| postal_code_type =
| postal_code =
| area_code = [[Area code 313|313]]
| custom_label_sec1 = [[Federal Information Processing Standards|FIPS code]]
| custom_data_sec1 = {{FIPS|26|22000}}
| custom_label1_sec1 = [[Geographic Names Information System|GNIS]] feature ID
| custom_data1_sec1 = {{GNIS 4|1617959}}, {{GNIS 4|1626181}}
| website = [http://www.detroitmi.gov/ DetroitMI.gov]
| footnotes =
}}
</syntaxhighlight>
{{clear}}
==Supporting templates==
The following is a list of sub-templates used by Infobox settlement. See the [{{fullurl:Special:PrefixIndex|prefix=Infobox+settlement%2F&namespace=10&hideredirects=1}} current list of all sub-templates] for documentation, sandboxes, testcases, etc.
* {{tl|Infobox settlement/areadisp}}
* {{tl|Infobox settlement/densdisp}}
* {{tl|Infobox settlement/lengthdisp}}
* {{tl|Infobox settlement/link}}
==Microformat==
{{UF-hcard-geo}}
== TemplateData ==
{{TemplateData header}}
{{collapse top|title=TemplateData}}
<templatedata>
{
"description": "Infobox for human settlements (cities, towns, villages, communities) as well as other administrative districts, counties, provinces, etc.",
"format": "block",
"params": {
"name": {
"label": "Common name",
"description": "This is the usual name in English. If it's not specified, the infobox will use the 'official_name' as a title unless this too is missing, in which case the page name will be used.",
"type": "string",
"suggested": true
},
"native_name": {
"label": "Native name",
"description": "This will display under the name/official name.",
"type": "string",
"example": "Distrito Federal de México"
},
"native_name_lang": {
"label": "Native name language",
"description": "Use ISO 639-1 code, e.g. 'fr' for French. If there is more than one native name in different languages, enter those names using {{lang}} instead.",
"type": "string",
"example": "zh"
},
"other_name": {
"label": "Other name",
"description": "For places with other commonly used names like Bombay or Saigon.",
"type": "string"
},
"type": {
"label": "Type of settlement",
"description": "Any type can be entered, such as 'City', 'Town', 'Village', 'Hamlet', 'Municipality', 'Reservation', etc. If set, will be displayed under the names, provided either 'name' or 'official_name' is filled in. Might also be used as a label for total population/area (defaulting to 'City'), if needed to distinguish from 'Urban', 'Rural' or 'Metro' (if urban, rural or metro figures are not present, the label is 'Total' unless 'total_type' is set).",
"type": "string"
},
"official_name": {
"label": "Official name",
"description": "The official name in English, if different from 'name'.",
"type": "string",
"suggested": true
},
"translit_lang1": {
"label": "Transliteration from language 1",
"description": "Will place the entry before the word 'transliteration(s)'. Can be used to specify a particular language, like in Dêlêg, or one may just enter 'Other', like in Gaza's article.",
"type": "string"
},
"translit_lang1_type": {
"label": "Transliteration type for language 1",
"type": "line",
"example": "[[Hanyu pinyin]]",
"description": "The type of transliteration used for the first language."
},
"translit_lang1_info": {
"label": "Transliteration language 1 info",
"description": "Parameters 'translit_lang2_info1' ... 'translit_lang2_info6' are also available, but not documented here.",
"type": "string"
},
"translit_lang2": {
"label": "Transliteration language 2",
"description": "Will place a second transliteration. See Dêlêg.",
"type": "string"
},
"image": {
"label": "Image",
"description": "Primary image representing the settlement. Commonly a photo of the settlement’s skyline.",
"type": "wiki-file-name"
},
"image_size": {},
"alt": {
"label": "Image alt text",
"description": "Alt (hover) text for the image, used by visually impaired readers who cannot see the image.",
"type": "string"
},
"caption": {
"label": "Image caption",
"description": "Will place a caption under 'image' (if present).",
"type": "content"
},
"image_flag": {
"label": "Flag image",
"description": "Used for a flag.",
"type": "wiki-file-name"
},
"flag_size": {
"label": "Flag size",
"description": "Can be used to tweak the size of 'image_flag' up or down from 100px as desired. If used, 'px' must be specified; default size is 100px.",
"type": "string"
},
"flag_alt": {
"label": "Flag alt text",
"description": "Alt text for the flag.",
"type": "string"
},
"flag_border": {
"label": "Flag border?",
"description": "Set to 'no' to remove the border from the flag.",
"type": "boolean",
"example": "no"
},
"flag_link": {
"label": "Flag link",
"type": "string",
"description": "Link to the flag."
},
"image_seal": {
"label": "Official seal image",
"description": "An image of an official seal, if the place has one.",
"type": "wiki-file-name"
},
"seal_size": {
"label": "Seal size",
"description": "If used, 'px' must be specified; default size is 100px.",
"type": "string"
},
"seal_alt": {
"label": "Seal alt text",
"description": "Alt (hover) text for the seal.",
"type": "string"
},
"seal_link": {
"label": "Seal link",
"type": "string",
"description": "Link to the seal."
},
"seal_class": {
"label": "Seal class",
"description": "CSS class for the seal image",
"type": "line",
"suggestedvalues": [
"skin-invert"
]
},
"image_shield": {
"label": "Coat of arms/shield image",
"description": "Can be used for a place with a coat of arms.",
"type": "wiki-file-name"
},
"shield_size": {
"label": "Shield size",
"description": "If used, 'px' must be specified; default size is 100px.",
"type": "string",
"example": "200px"
},
"shield_alt": {
"label": "Shield alt text",
"description": "Alternate text for the shield.",
"type": "string"
},
"shield_link": {
"label": "Shield link",
"description": "Can be used if a wiki article if known but is not automatically linked by the template. See Coquitlam, British Columbia's infobox for an example.",
"type": "string"
},
"image_blank_emblem": {
"label": "Blank emblem image",
"description": "Can be used if a place has an official logo, crest, emblem, etc.",
"type": "wiki-file-name"
},
"blank_emblem_type": {
"label": "Blank emblem type",
"description": "Caption beneath 'image_blank_emblem' to specify what type of emblem it is.",
"type": "string",
"example": "Logo"
},
"blank_emblem_size": {
"label": "Blank emblem size",
"description": "If used, 'px' must be specified; default size is 100px.",
"type": "string",
"example": "200px"
},
"blank_emblem_alt": {
"label": "Blank emblem alt text",
"description": "Alt text for blank emblem.",
"type": "string"
},
"blank_emblem_link": {
"label": "Blank emblem link",
"type": "string",
"description": "A link to the emblem of custom type."
},
"nickname": {
"label": "Nickname",
"description": "Well-known nickname(s).",
"type": "string",
"example": "Sin City"
},
"motto": {
"label": "Motto",
"description": "Will place the motto under the nicknames.",
"type": "string"
},
"anthem": {
"label": "Anthem",
"description": "Will place the anthem (song) under the nicknames.",
"type": "string",
"example": "[[Hatikvah]]"
},
"image_map": {
"label": "Map image",
"description": "A map of the region, or a map with the region highlighted within a parent region.",
"type": "wiki-file-name"
},
"map_size": {
"label": "Map size",
"description": "If used, 'px' must be specified; default is 250px.",
"type": "string"
},
"map_alt": {
"label": "Map alt text",
"description": "Alternate (hover) text for the map.",
"type": "string"
},
"map_caption": {
"label": "Map caption",
"type": "content",
"description": "Caption for the map displayed."
},
"image_map1": {
"label": "Map 2 image",
"description": "A secondary map image. The field 'image_map' must be filled in first. For an example, see [[Bloomsburg, Pennsylvania]].",
"example": "File:Columbia County Pennsylvania Incorporated and Unincorporated areas Bloomsburg Highlighted.svg",
"type": "wiki-file-name"
},
"map_size1": {
"label": "Map 2 size",
"description": "If used, 'px' must be specified; default is 250px.",
"type": "string",
"example": "300px"
},
"map_alt1": {
"label": "Map 2 alt text",
"description": "Alt (hover) text for the second map.",
"type": "string"
},
"map_caption1": {
"label": "Map 2 caption",
"type": "content",
"description": "Caption of the second map."
},
"pushpin_map": {
"label": "Pushpin map",
"description": "The name of a location map (e.g. 'Indonesia' or 'Russia'). The coordinates information (from the coordinates parameter) positions a pushpin coordinate marker and label on the map automatically. For an example, see Padang, Indonesia.",
"type": "string",
"example": "Indonesia"
},
"pushpin_map_size": {
"label": "Pushpin map size",
"description": "Must be entered as only a number—do not use 'px'. The default value is 250.",
"type": "number",
"example": "200"
},
"pushpin_alt": {
"label": "Pushpin map alt text",
"description": "Alt (hover) text for the pushpin map.",
"type": "string"
},
"pushpin_caption": {
"label": "Pushpin map caption",
"description": "Fill out if a different caption from 'map_caption' is desired.",
"type": "string",
"example": "Map showing Bloomsburg in Pennsylvania"
},
"pushpin_label": {
"label": "Pushpin label",
"type": "line",
"example": "Bloomsburg",
"description": "Label of the pushpin."
},
"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', and 'none'. If this field is not specified, the default value is 'right'.",
"type": "string",
"example": "left",
"default": "right"
},
"pushpin_relief": {
"label": "Pushpin relief",
"description": "Set this to 'y' or any non-blank value to use an alternative relief map provided by the selected location map (if a relief map is available).",
"type": "string",
"example": "y"
},
"coordinates": {
"label": "Coordinates",
"description": "Latitude and longitude. Use {{Coord}}. See the documentation for {{Coord}} for more details on usage.",
"type": "wiki-template-name",
"example": "{{coord|41|50|15|N|87|40|55|W}}"
},
"coor_pinpoint": {
"label": "Coordinate pinpoint",
"description": "If needed, to specify more exactly where (or what) coordinates are given (e.g. 'Town Hall') or a specific place in a larger area (e.g. a city in a county). Example: Masovian Voivodeship.",
"type": "string"
},
"coordinates_footnotes": {
"label": "Coordinates footnotes",
"description": "Reference(s) for coordinates. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"subdivision_type": {
"label": "Subdivision type 1",
"description": "Almost always 'Country'.",
"type": "string",
"example": "Country",
"suggestedvalues": [
"Country"
]
},
"subdivision_name": {
"label": "Subdivision name 1",
"description": "Depends on 'subdivision_type'. Use the name in text form, e.g., 'United States'. Per MOS:INFOBOXFLAG, flag icons or flag templates may be used in this field.",
"type": "string"
},
"subdivision_type1": {
"label": "Subdivision type 2",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type2": {
"label": "Subdivision type 3",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type3": {
"label": "Subdivision type 4",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type4": {
"label": "Subdivision type 5",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type5": {
"label": "Subdivision type 6",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_type6": {
"label": "Subdivision type 7",
"description": "Additional subdivisions; can be state/province, region, or county.",
"type": "string"
},
"subdivision_name1": {
"label": "Subdivision name 2",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Connecticut]]"
},
"subdivision_name2": {
"label": "Subdivision name 3",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Florida]]"
},
"subdivision_name3": {
"label": "Subdivision name 4",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Utah]]"
},
"subdivision_name4": {
"label": "Subdivision name 5",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[California]]"
},
"subdivision_name5": {
"label": "Subdivision name 6",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Vermont]]"
},
"subdivision_name6": {
"label": "Subdivision name 7",
"description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.",
"type": "string",
"example": "[[Wyoming]]"
},
"established_title": {
"label": "First establishment event",
"description": "Title of the first establishment event.",
"type": "string",
"example": "First settled"
},
"established_date": {
"label": "First establishment date",
"type": "date",
"description": "Date of the first establishment event."
},
"established_title1": {
"label": "Second establishment event",
"description": "Title of the second establishment event.",
"type": "string",
"example": "Incorporated as a town"
},
"established_date1": {
"label": "Second establishment date",
"type": "date",
"description": "Date of the second establishment event."
},
"established_title2": {
"label": "Third establishment event",
"description": "Title of the third establishment event.",
"type": "string",
"example": "Incorporated as a city"
},
"established_date2": {
"label": "Third establishment date",
"type": "date",
"description": "Date of the third establishment event."
},
"established_title3": {
"label": "Fourth establishment event",
"type": "string",
"description": "Title of the fourth establishment event.",
"example": "Incorporated as a county"
},
"established_date3": {
"label": "Fourth establishment date",
"type": "date",
"description": "Date of the fourth establishment event."
},
"extinct_title": {
"label": "Extinction event title",
"description": "For when a settlement ceases to exist.",
"type": "string",
"example": "[[Sack of Rome]]"
},
"extinct_date": {
"label": "Extinction date",
"type": "string",
"description": "Date the settlement ceased to exist."
},
"founder": {
"label": "Founder",
"description": "Who the settlement was founded by.",
"type": "string"
},
"named_for": {
"label": "Named for",
"description": "The source of the name of the settlement (a person, a place, et cetera).",
"type": "string",
"example": "[[Ho Chi Minh]]"
},
"seat_type": {
"label": "Seat of government type",
"description": "The label for the seat of government (defaults to 'Seat').",
"type": "string",
"default": "Seat"
},
"seat": {
"label": "Seat of government",
"description": "The seat of government.",
"type": "string",
"example": "[[White House]]"
},
"parts_type": {
"label": "Type of smaller subdivisions",
"description": "The label for the smaller subdivisions (defaults to 'Boroughs').",
"type": "string",
"default": "Boroughs"
},
"parts_style": {
"label": "Parts style",
"description": "Set to 'list' to display as a collapsible list, 'coll' as a collapsed list, or 'para' to use paragraph style. Default is 'list' for up to 5 items, otherwise 'coll'.",
"type": "string",
"example": "list"
},
"parts": {
"label": "Smaller subdivisions",
"description": "Text or header of the list of smaller subdivisions.",
"type": "string"
},
"p1": {
"label": "Smaller subdivision 1",
"description": "The smaller subdivisions to be listed. Parameters 'p1' to 'p50' can also be used.",
"type": "string"
},
"government_footnotes": {
"label": "Government footnotes",
"description": "Reference(s) for government. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "content"
},
"government_type": {
"label": "Government type",
"description": "The place's type of government.",
"type": "string",
"example": "[[Mayor–council government]]"
},
"governing_body": {
"label": "Governing body",
"description": "Name of the place's governing body.",
"type": "wiki-page-name",
"example": "Legislative Council of Hong Kong"
},
"leader_party": {
"label": "Leader political party",
"description": "Political party of the place's leader.",
"type": "string"
},
"leader_title": {
"label": "Leader title",
"description": "First title of the place's leader, e.g. 'Mayor'.",
"type": "string",
"example": "[[Governor (United States)|Governor]]"
},
"leader_name": {
"label": "Leader's name",
"description": "Name of the place's leader.",
"type": "string",
"example": "[[Jay Inslee]]"
},
"leader_title1": {
"label": "Leader title 1",
"description": "First title of the place's leader, e.g. 'Mayor'.",
"type": "string",
"example": "Mayor"
},
"leader_name1": {
"label": "Leader name 1",
"description": "Additional names for leaders. Parameters 'leader_name1' .. 'leader_name4' are available. For long lists, use {{Collapsible list}}.",
"type": "string"
},
"total_type": {
"label": "Total type",
"description": "Specifies what total area and population figure refer to, e.g. 'Greater London'. This overrides other labels for total population/area. To make the total area and population display on the same line as the words ''Area'' and ''Population'', with no ''Total'' or similar label, set the value of this parameter to ' '.",
"type": "string"
},
"unit_pref": {
"label": "Unit preference",
"description": "To change the unit order to 'imperial (metric)', enter 'imperial'. The default display style is 'metric (imperial)'. However, the template will swap the order automatically if the 'subdivision_name' equals some variation of the US or the UK. For the Middle East, a unit preference of dunam can be entered (only affects total area). All values must be entered in a raw format (no commas, spaces, or unit symbols). The template will format them automatically.",
"type": "string",
"example": "imperial"
},
"area_footnotes": {
"label": "Area footnotes",
"description": "Reference(s) for area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"dunam_link": {
"label": "Link dunams?",
"description": "If dunams are used, the default is to link the word ''dunams'' in the total area section. This can be changed by setting 'dunam_link' to another measure (e.g. 'dunam_link=water'). Linking can also be turned off by setting the parameter to something else (e.g., 'dunam_link=none' or 'dunam_link=off').",
"type": "boolean",
"example": "none"
},
"area_total_km2": {
"label": "Total area (km2)",
"description": "Total area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_total_sq_mi' is empty.",
"type": "number"
},
"area_total_sq_mi": {
"label": "Total area (sq. mi)",
"description": "Total area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_total_km2' is empty.",
"type": "number"
},
"area_total_ha": {
"label": "Total area (hectares)",
"description": "Total area in hectares (symbol: ha). Value must be entered in raw format (no commas or spaces). Auto-converted to display acres if 'area_total_acre' is empty.",
"type": "number"
},
"area_total_acre": {
"label": "Total area (acres)",
"description": "Total area in acres. Value must be entered in raw format (no commas or spaces). Auto-converted to display hectares if 'area_total_ha' is empty.",
"type": "number"
},
"area_total_dunam": {
"label": "Total area (dunams)",
"description": "Total area in dunams, which is wikilinked. Used in Middle Eastern places like Israel, Gaza, and the West Bank. Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers or hectares and square miles or acres if 'area_total_km2', 'area_total_ha', 'area_total_sq_mi', and 'area_total_acre' are empty. Examples: Gaza and Ramallah.",
"type": "number"
},
"area_land_km2": {
"label": "Land area (sq. km)",
"description": "Land area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_land_sq_mi' is empty.",
"type": "number"
},
"area_land_sq_mi": {
"label": "Land area (sq. mi)",
"description": "Land area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_land_km2' is empty.",
"type": "number"
},
"area_land_ha": {
"label": "Land area (hectares)",
"description": "The place's land area in hectares.",
"type": "number"
},
"area_land_dunam": {
"label": "Land area (dunams)",
"description": "The place's land area in dunams.",
"type": "number"
},
"area_land_acre": {
"label": "Land area (acres)",
"description": "The place's land area in acres.",
"type": "number"
},
"area_water_km2": {
"label": "Water area (sq. km)",
"description": "Water area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_water_sq_mi' is empty.",
"type": "number"
},
"area_water_sq_mi": {
"label": "Water area (sq. mi)",
"description": "Water area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_water_km2' is empty.",
"type": "number"
},
"area_water_ha": {
"label": "Water area (hectares)",
"description": "The place's water area in hectares.",
"type": "number"
},
"area_water_dunam": {
"label": "Water area (dunams)",
"description": "The place's water area in dunams.",
"type": "number"
},
"area_water_acre": {
"label": "Water area (acres)",
"description": "The place's water area in acres.",
"type": "number"
},
"area_water_percent": {
"label": "Percent water area",
"description": "Percent of water without the %.",
"type": "number",
"example": "21"
},
"area_urban_km2": {
"label": "Urban area (sq. km)",
"type": "number",
"description": "Area of the place's urban area in square kilometers."
},
"area_urban_sq_mi": {
"label": "Urban area (sq. mi)",
"type": "number",
"description": "Area of the place's urban area in square miles."
},
"area_urban_ha": {
"label": "Urban area (hectares)",
"description": "Area of the place's urban area in hectares.",
"type": "number"
},
"area_urban_dunam": {
"label": "Urban area (dunams)",
"description": "Area of the place's urban area in dunams.",
"type": "number"
},
"area_urban_acre": {
"label": "Urban area (acres)",
"description": "Area of the place's urban area in acres.",
"type": "number"
},
"area_urban_footnotes": {
"label": "Urban area footnotes",
"description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"area_rural_km2": {
"label": "Rural area (sq. km)",
"type": "number",
"description": "Area of the place's rural area in square kilometers."
},
"area_rural_sq_mi": {
"label": "Rural area (sq. mi)",
"type": "number",
"description": "Area of the place's rural area in square miles."
},
"area_rural_ha": {
"label": "Rural area (hectares)",
"description": "Area of the place's rural area in hectares.",
"type": "number"
},
"area_rural_dunam": {
"label": "Rural area (dunams)",
"description": "Area of the place's rural area in dunams.",
"type": "number"
},
"area_rural_acre": {
"label": "Rural area (acres)",
"description": "Area of the place's rural area in acres.",
"type": "number"
},
"area_rural_footnotes": {
"label": "Rural area footnotes",
"description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"area_metro_km2": {
"label": "Metropolitan area (sq. km)",
"type": "number",
"description": "Area of the place's metropolitan area in square kilometers."
},
"area_metro_sq_mi": {
"label": "Metropolitan area (sq. mi)",
"type": "number",
"description": "Area of the place's metropolitan area in square miles."
},
"area_metro_ha": {
"label": "Metropolitan area (hectares)",
"description": "Area of the place's metropolitan area in hectares.",
"type": "number"
},
"area_metro_dunam": {
"label": "Metropolitan area (dunams)",
"description": "Area of the place's metropolitan area in dunams.",
"type": "number"
},
"area_metro_acre": {
"label": "Metropolitan area (acres)",
"description": "Area of the place's metropolitan area in acres.",
"type": "number"
},
"area_metro_footnotes": {
"label": "Metropolitan area footnotes",
"description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"area_rank": {
"label": "Area rank",
"description": "The settlement's area, as ranked within its parent sub-division.",
"type": "string"
},
"area_blank1_title": {
"label": "First blank area section title",
"description": "Title of the place's first custom area section.",
"type": "string",
"example": "see [[London]]"
},
"area_blank1_km2": {
"label": "Area blank 1 (sq. km)",
"type": "number",
"description": "Area of the place's first blank area section in square kilometers."
},
"area_blank1_sq_mi": {
"label": "Area blank 1 (sq. mi)",
"type": "number",
"description": "Area of the place's first blank area section in square miles."
},
"area_blank1_ha": {
"label": "Area blank 1 (hectares)",
"description": "Area of the place's first blank area section in hectares.",
"type": "number"
},
"area_blank1_dunam": {
"label": "Area blank 1 (dunams)",
"description": "Area of the place's first blank area section in dunams.",
"type": "number"
},
"area_blank1_acre": {
"label": "Area blank 1 (acres)",
"description": "Area of the place's first blank area section in acres.",
"type": "number"
},
"area_blank2_title": {
"label": "Second blank area section title",
"type": "string",
"description": "Title of the place's second custom area section."
},
"area_blank2_km2": {
"label": "Area blank 2 (sq. km)",
"type": "number",
"description": "Area of the place's second blank area section in square kilometers."
},
"area_blank2_sq_mi": {
"label": "Area blank 2 (sq. mi)",
"type": "number",
"description": "Area of the place's second blank area section in square miles."
},
"area_blank2_ha": {
"label": "Area blank 2 (hectares)",
"description": "Area of the place's third blank area section in hectares.",
"type": "number"
},
"area_blank2_dunam": {
"label": "Area blank 2 (dunams)",
"description": "Area of the place's third blank area section in dunams.",
"type": "number"
},
"area_blank2_acre": {
"label": "Area blank 2 (acres)",
"description": "Area of the place's third blank area section in acres.",
"type": "number"
},
"area_note": {
"label": "Area footnotes",
"description": "A place for additional information such as the name of the source.",
"type": "content",
"example": "<ref name=\"CenPopGazetteer2016\">{{cite web|title=2016 U.S. Gazetteer Files|url=https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2016_Gazetteer/2016_gaz_place_42.txt|publisher=United States Census Bureau|access-date=August 13, 2017}}</ref>"
},
"dimensions_footnotes": {
"label": "Dimensions footnotes",
"description": "Reference(s) for dimensions. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "content"
},
"length_km": {
"label": "Length in km",
"description": "Raw number entered in kilometers. Will automatically convert to display length in miles if 'length_mi' is empty.",
"type": "number"
},
"length_mi": {
"label": "Length in miles",
"description": "Raw number entered in miles. Will automatically convert to display length in kilometers if 'length_km' is empty.",
"type": "number"
},
"width_km": {
"label": "Width in kilometers",
"description": "Raw number entered in kilometers. Will automatically convert to display width in miles if 'length_mi' is empty.",
"type": "number"
},
"width_mi": {
"label": "Width in miles",
"description": "Raw number entered in miles. Will automatically convert to display width in kilometers if 'length_km' is empty.",
"type": "number"
},
"elevation_m": {
"label": "Elevation in meters",
"description": "Raw number entered in meters. Will automatically convert to display elevation in feet if 'elevation_ft' is empty. However, if a range in elevation (i.e. 5–50 m) is desired, use the 'max' and 'min' fields below.",
"type": "number"
},
"elevation_ft": {
"label": "Elevation in feet",
"description": "Raw number, entered in feet. Will automatically convert to display the average elevation in meters if 'elevation_m' field is empty. However, if a range in elevation (i.e. 50–500 ft) is desired, use the 'max' and 'min' fields below.",
"type": "number"
},
"elevation_footnotes": {
"label": "Elevation footnotes",
"description": "Reference(s) for elevation. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"elevation_min_point": {
"type": "line",
"label": "Point of min elevation",
"description": "The name of the point of lowest elevation in the place.",
"example": "[[Death Valley]]"
},
"elevation_min_m": {
"label": "Minimum elevation (m)",
"type": "number",
"description": "The minimum elevation in meters."
},
"elevation_min_ft": {
"label": "Minimum elevation (ft)",
"type": "number",
"description": "The minimum elevation in feet."
},
"elevation_min_rank": {
"type": "line",
"label": "Minimum elevation rank",
"description": "The point of minimum elevation's rank in the parent region.",
"example": "1st"
},
"elevation_min_footnotes": {
"label": "Min elevation footnotes",
"type": "content",
"description": "Footnotes or citations for the minimum elevation."
},
"elevation_max_point": {
"type": "line",
"label": "Point of max elevation",
"description": "The name of the point of highest elevation in the place.",
"example": "[[Mount Everest]]"
},
"elevation_max_m": {
"label": "Maximum elevation (m)",
"type": "number",
"description": "The maximum elevation in meters."
},
"elevation_max_ft": {
"label": "Maximum elevation (ft)",
"type": "number",
"description": "The maximum elevation in feet."
},
"elevation_max_rank": {
"type": "line",
"label": "Maximum elevation rank",
"description": "The point of maximum elevation's rank in the parent region.",
"example": "2nd"
},
"elevation_max_footnotes": {
"label": "Max elevation footnotes",
"type": "content",
"description": "Footnotes or citations for the maximum elevation."
},
"population_total": {
"label": "Population total",
"description": "Actual population (see below for estimates) preferably consisting of digits only (without any commas).",
"type": "number"
},
"population_as_of": {
"label": "Population total figure's year",
"description": "The year for the population total (usually a census year).",
"type": "number"
},
"population_footnotes": {
"label": "Population footnotes",
"description": "Reference(s) for population; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "content"
},
"population_density_km2": {
"label": "Population density (per square km)",
"type": "string",
"description": "The place's population density per square kilometer.",
"example": "auto"
},
"population_density_sq_mi": {
"label": "Population density (per square mi)",
"type": "string",
"description": "The place's population density per square mile.",
"example": "auto"
},
"population_est": {
"label": "Population estimate",
"description": "Population estimate, e.g. for growth projections 4 years after a census.",
"type": "number",
"example": "331000000"
},
"pop_est_as_of": {
"label": "Population estimate figure as of",
"description": "The year, or the month and year, of the population estimate.",
"type": "date"
},
"pop_est_footnotes": {
"label": "Population estimate footnotes",
"description": "Reference(s) for population estimate; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "content",
"example": "<ref name=\"USCensusEst2016\"/>"
},
"population_urban": {
"label": "Urban population",
"type": "number",
"description": "The place's urban population."
},
"population_urban_footnotes": {
"label": "Urban population footnotes",
"description": "Reference(s) for urban population; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "content"
},
"population_density_urban_km2": {
"label": "Urban population density (per square km)",
"type": "string",
"description": "The place's urban population density per square kilometer.",
"example": "auto"
},
"population_density_urban_sq_mi": {
"label": "Urban population density (per square mi)",
"type": "string",
"description": "The place's urban population density per square mile.",
"example": "auto"
},
"population_rural": {
"label": "Rural population",
"type": "number",
"description": "The place's rural population."
},
"population_rural_footnotes": {
"label": "Rural population footnotes",
"description": "Reference(s) for rural population; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "content"
},
"population_density_rural_km2": {
"label": "Rural population density per sq. km",
"type": "line",
"description": "The place's rural population density per square kilometer.",
"example": "auto"
},
"population_density_rural_sq_mi": {
"label": "Rural population density per sq. mi",
"type": "line",
"description": "The place's rural population density per square mile.",
"example": "auto"
},
"population_metro": {
"label": "Metropolitan area population",
"type": "number",
"description": "Population of the place's metropolitan area."
},
"population_metro_footnotes": {
"label": "Metropolitan area population footnotes",
"description": "Reference(s) for metro population; placed within <nowiki><ref> </ref></nowiki> tags.",
"type": "string"
},
"population_density_metro_km2": {
"label": "Metropolitan population density per sq. km",
"type": "number",
"description": "The place's metropolitan area's population density per square kilometer.",
"example": "auto"
},
"population_density_metro_sq_mi": {
"label": "Metropolitan population density per sq. mi",
"type": "number",
"description": "The place's metropolitan area's population density per square mile.",
"example": "auto"
},
"population_rank": {
"label": "Population rank",
"description": "The settlement's population, as ranked within its parent sub-division.",
"type": "string"
},
"population_density_rank": {
"label": "Population density rank",
"description": "The settlement's population density, as ranked within its parent sub-division.",
"type": "string"
},
"population_blank1_title": {
"label": "Custom population type 1 title",
"description": "Can be used for estimates. For an example, see Windsor, Ontario.",
"type": "string",
"example": "See: [[Windsor, Ontario]]"
},
"population_blank1": {
"label": "Custom population type 1",
"description": "The population value for 'blank1_title'.",
"type": "string"
},
"population_density_blank1_km2": {
"label": "Custom population type 1 density per sq. km",
"type": "string",
"description": "Population density per square kilometer, according to the 1st custom population type."
},
"population_density_blank1_sq_mi": {
"label": "Custom population type 1 density per sq. mi",
"type": "string",
"description": "Population density per square mile, according to the 1st custom population type."
},
"population_blank2_title": {
"label": "Custom population type 2 title",
"description": "Can be used for estimates. For an example, see Windsor, Ontario.",
"type": "string",
"example": "See: [[Windsor, Ontario]]"
},
"population_blank2": {
"label": "Custom population type 2",
"description": "The population value for 'blank2_title'.",
"type": "string"
},
"population_density_blank2_km2": {
"label": "Custom population type 2 density per sq. km",
"type": "string",
"description": "Population density per square kilometer, according to the 2nd custom population type."
},
"population_density_blank2_sq_mi": {
"label": "Custom population type 2 density per sq. mi",
"type": "string",
"description": "Population density per square mile, according to the 2nd custom population type."
},
"population_demonym": {
"label": "Demonym",
"description": "A demonym or gentilic is a word that denotes the members of a people or the inhabitants of a place. For example, a citizen in Liverpool is known as a Liverpudlian.",
"type": "line",
"example": "Liverpudlian"
},
"population_note": {
"label": "Population note",
"description": "A place for additional information such as the name of the source. See Windsor, Ontario, for an example.",
"type": "content"
},
"demographics_type1": {
"label": "Demographics type 1",
"description": "A sub-section header.",
"type": "string",
"example": "Ethnicities"
},
"demographics1_footnotes": {
"label": "Demographics section 1 footnotes",
"description": "Reference(s) for demographics section 1. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "content"
},
"demographics1_title1": {
"label": "Demographics section 1 title 1",
"description": "Titles related to demographics_type1. For example: 'White', 'Black', 'Hispanic'... Additional rows 'demographics1_title1' to 'demographics1_title5' are also available.",
"type": "string"
},
"demographics_type2": {
"label": "Demographics type 2",
"description": "A second sub-section header.",
"type": "line",
"example": "Languages"
},
"demographics2_footnotes": {
"label": "Demographics section 2 footnotes",
"description": "Reference(s) for demographics section 2. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.",
"type": "string"
},
"demographics2_title1": {
"label": "Demographics section 2 title 1",
"description": "Titles related to 'demographics_type1'. For example: 'English', 'French', 'Arabic'... Additional rows 'demographics2_title2' to 'demographics1_title5' are also available.",
"type": "string"
},
"demographics2_info1": {
"label": "Demographics section 2 info 1",
"description": "Information related to the titles. For example: '50%', '25%', '10%'... Additional rows 'demographics2_info2' to 'demographics2_info5' are also available.",
"type": "content"
},
"time_zone1": {
"label": "Time zone 1",
"type": "string",
"description": "The place's primary time-zone. Use 'time_zone' or 'time_zone1', but not both.",
"example": "[[Eastern Standard Time]]",
"aliases": [
"time_zone"
]
},
"utc_offset": {
"label": "UTC offset",
"type": "string",
"description": "The place's time-zone's offset from UTC.",
"example": "+8"
},
"time_zone_DST": {
"label": "Time zone during DST",
"type": "string",
"description": "The place's time-zone during daylight savings time, if applicable.",
"example": "[[Eastern Daylight Time]]"
},
"utc_offset_DST": {
"label": "UTC offset during DST",
"type": "string",
"description": "The place's time-zone's UTC offset during daylight savings time, if applicable.",
"example": "+9"
},
"utc_offset1": {
"label": "UTC offset 1",
"type": "string",
"description": "The place's primary time-zone's offset from UTC.",
"example": "−5"
},
"time_zone1_DST": {
"label": "Time zone 1 (during DST)",
"type": "string",
"description": "The place's primary time-zone during daylight savings time, if applicable.",
"example": "[[Eastern Daylight Time]]"
},
"utc_offset1_DST": {
"label": "UTC offset 1 (during DST)",
"type": "string",
"description": "The place's primary time-zone's UTC offset during daylight savings time, if applicable.",
"example": "−6"
},
"time_zone2": {
"label": "Time zone 2",
"description": "A second time zone field for larger areas such as a province.",
"type": "string",
"example": "[[Central Standard Time]]"
},
"utc_offset2": {
"label": "UTC offset 2",
"type": "string",
"description": "The place's secondary time-zone's offset from UTC.",
"example": "−6"
},
"time_zone2_DST": {
"label": "Time zone 2 during DST",
"type": "string",
"description": "The place's secondary time-zone during daylight savings time, if applicable.",
"example": "[[Central Daylight Time]]"
},
"utc_offset2_DST": {
"label": "UTC offset 2 during DST",
"type": "string",
"description": "The place's secondary time-zone's offset from UTC during daylight savings time, if applicable.",
"example": "−7"
},
"postal_code_type": {
"label": "Postal code type",
"description": "Label used for postal code info, e.g. 'ZIP Code'. Defaults to 'Postal code'.",
"example": "[[Postal code of China|Postal code]]",
"type": "string"
},
"postal_code": {
"label": "Postal code",
"description": "The place's postal code/zip code.",
"type": "string",
"example": "90210"
},
"postal2_code_type": {
"label": "Postal code 2 type",
"type": "string",
"description": "If applicable, the place's second postal code type."
},
"postal2_code": {
"label": "Postal code 2",
"type": "string",
"description": "A second postal code of the place, if applicable.",
"example": "90007"
},
"area_code": {
"label": "Area code",
"description": "The regions' telephone area code.",
"type": "string",
"aliases": [
"area_codes"
]
},
"area_code_type": {
"label": "Area code type",
"description": "If left blank/not used, template will default to 'Area code(s)'.",
"type": "string"
},
"geocode": {
"label": "Geocode",
"description": "See [[Geocode]].",
"type": "string"
},
"iso_code": {
"label": "ISO 3166 code",
"description": "See ISO 3166.",
"type": "string"
},
"registration_plate": {
"label": "Registration/license plate info",
"description": "See Vehicle registration plate.",
"type": "string"
},
"custom_label1_sec1": {
"label": "Custom 1 label section 1",
"description": "Up to 7 additional fields 'custom_label1_sec1' ... 'custom_label7_sec1' can be specified.",
"type": "string"
},
"custom_data1_sec1": {
"label": "Custom 1 data section 1",
"description": "Up to 7 additional fields 'custom_data1_sec1' ... 'custom_data7_sec1' can be specified.",
"type": "content"
},
"custom_label1_sec2": {
"label": "Custom 1 label section 2",
"description": "Up to 7 additional fields 'custom_label1_sec2' ... 'custom_label7_sec2' can be specified.",
"type": "string"
},
"custom_data1_sec2": {
"label": "Custom 1 label section 2",
"description": "Up to 7 additional fields 'custom_data1_sec2' ... 'custom_data7_sec2' can be specified.",
"type": "content"
},
"website": {
"label": "Official website in English",
"description": "External link to official website. Use the {{URL}} template, thus: {{URL|example.com}}.",
"type": "string"
},
"footnotes": {
"label": "Footnotes",
"description": "Text to be displayed at the bottom of the infobox.",
"type": "content"
},
"translit_lang1_info1": {
"label": "Language 1 first transcription ",
"description": "Transcription of type 1 in the first other language.",
"example": "{{langx|zh|森美兰}}",
"type": "line"
},
"translit_lang1_type1": {
"label": "Language 1 first transcription type",
"description": "Type of transcription used in the first language's first transcription.",
"example": "[[Chinese Language|Chinese]]",
"type": "line"
},
"translit_lang1_info2": {
"label": "Language 1 second transcription ",
"description": "Transcription of type 1 in the first other language.",
"example": "{{langx|ta|நெகிரி செம்பிலான்}}",
"type": "line"
},
"translit_lang1_type2": {
"label": "Language 1 second transcription type",
"description": "Type of transcription used in the first language's first transcription.",
"example": "[[Tamil Language|Tamil]]",
"type": "line"
},
"demographics1_info1": {
"label": "Demographics section 1 info 1",
"description": "Information related to the titles. For example: '50%', '25%', '10%'... Additional rows 'demographics1_info1' to 'demographics1_info5' are also available.",
"type": "content"
},
"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": [
"coordinates"
],
"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": {
"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": {},
"embed": {},
"translit_lang1_type3": {},
"translit_lang1_type4": {},
"translit_lang1_info3": {},
"translit_lang1_type5": {},
"translit_lang1_info4": {},
"translit_lang1_type6": {},
"translit_lang1_info5": {},
"translit_lang1_info6": {},
"translit_lang2_type1": {},
"translit_lang2_type": {},
"translit_lang2_info": {},
"translit_lang2_type2": {},
"translit_lang2_info1": {},
"translit_lang2_type3": {},
"translit_lang2_info2": {},
"translit_lang2_type4": {},
"translit_lang2_info3": {},
"translit_lang2_type5": {},
"translit_lang2_info4": {},
"translit_lang2_type6": {},
"translit_lang2_info5": {},
"translit_lang2_info6": {},
"pushpin_map_narrow": {},
"seal_type": {},
"etymology": {},
"nicknames": {},
"nickname_link": {},
"mottoes": {},
"motto_link": {},
"anthem_link": {},
"grid_position": {},
"coor_type": {},
"grid_name": {},
"established_title4": {},
"established_date4": {},
"established_title5": {},
"established_date5": {},
"established_title6": {},
"established_date6": {},
"established_title7": {},
"established_date7": {},
"seat1_type": {},
"seat1": {},
"seat2_type": {},
"seat2": {},
"p2": {},
"p3": {},
"p4": {},
"p5": {},
"p6": {},
"p7": {},
"p8": {},
"p9": {},
"p10": {},
"p11": {},
"p12": {},
"p13": {},
"p14": {},
"p15": {},
"p16": {},
"p17": {},
"p18": {},
"p19": {},
"p20": {},
"p21": {},
"p22": {},
"p23": {},
"p24": {},
"p25": {},
"p26": {},
"p27": {},
"p28": {},
"p29": {},
"p30": {},
"p31": {},
"p32": {},
"p33": {},
"p34": {},
"p35": {},
"p36": {},
"p37": {},
"p38": {},
"p39": {},
"p40": {},
"p41": {},
"p42": {},
"p43": {},
"p44": {},
"p45": {},
"p46": {},
"p47": {},
"p48": {},
"p49": {},
"p50": {},
"leader_name2": {},
"leader_name3": {},
"leader_name4": {},
"leader_title2": {},
"leader_title3": {},
"leader_title4": {},
"government_blank1_title": {},
"government_blank1": {},
"government_blank2_title": {},
"government_blank2": {},
"government_blank3_title": {},
"government_blank3": {},
"government_blank4_title": {},
"government_blank4": {},
"government_blank5_title": {},
"government_blank5": {},
"government_blank6_title": {},
"government_blank6": {},
"elevation_link": {},
"elevation_point": {},
"population_blank1_footnotes": {},
"population_blank2_footnotes": {},
"population_demonyms": {},
"demographics1_title2": {},
"demographics1_info2": {},
"demographics1_title3": {},
"demographics1_info3": {},
"demographics1_title4": {},
"demographics1_info4": {},
"demographics1_title5": {},
"demographics1_info5": {},
"demographics1_title6": {},
"demographics1_info6": {},
"demographics1_title7": {},
"demographics1_info7": {},
"demographics1_title8": {},
"demographics1_info8": {},
"demographics1_title9": {},
"demographics1_info9": {},
"demographics1_title10": {},
"demographics1_info10": {},
"demographics2_title2": {},
"demographics2_info2": {},
"demographics2_title3": {},
"demographics2_info3": {},
"demographics2_title4": {},
"demographics2_info4": {},
"demographics2_title5": {},
"demographics2_info5": {},
"demographics2_title6": {},
"demographics2_info6": {},
"demographics2_title7": {},
"demographics2_info7": {},
"demographics2_title8": {},
"demographics2_info8": {},
"demographics2_title9": {},
"demographics2_info9": {},
"demographics2_title10": {},
"demographics2_info10": {},
"time_zone1_location": {},
"time_zone_link": {},
"time_zone2_location": {},
"time_zone3_location": {},
"utc_offset3": {},
"time_zone3": {},
"utc_offset3_DST": {},
"time_zone3_DST": {},
"time_zone4_location": {},
"utc_offset4": {},
"time_zone4": {},
"utc_offset4_DST": {},
"time_zone4_DST": {},
"time_zone5_location": {},
"utc_offset5": {},
"time_zone5": {},
"utc_offset5_DST": {},
"time_zone5_DST": {},
"registration_plate_type": {
"label": "Registration/license plate type",
"description": "The place's registration/license plate type",
"type": "content"
},
"code1_name": {},
"code1_info": {},
"code2_name": {},
"code2_info": {},
"blank1_info": {},
"custom_label2_sec1": {},
"custom_data2_sec1": {},
"custom_label3_sec1": {},
"custom_data3_sec1": {},
"custom_label4_sec1": {},
"custom_data4_sec1": {},
"custom_label5_sec1": {},
"custom_data5_sec1": {},
"custom_label6_sec1": {},
"custom_data6_sec1": {},
"custom_label7_sec1": {},
"custom_data7_sec1": {},
"custom_label2_sec2": {},
"custom_data2_sec2": {},
"custom_label3_sec2": {},
"custom_data3_sec2": {},
"custom_label4_sec2": {},
"custom_data4_sec2": {},
"custom_label5_sec2": {},
"custom_data5_sec2": {},
"custom_label6_sec2": {},
"custom_data6_sec2": {},
"custom_label7_sec2": {},
"custom_data7_sec2": {},
"module": {},
"coordinates_wikidata": {},
"wikidata": {},
"image_upright": {},
"blank_emblem_upright": {},
"leader_title5": {},
"leader_name5": {},
"custom_label_sec1": {
"label": "Custom label section 1",
"description": "Fields used to display other information. The label is displayed in bold on the left side of the infobox.",
"type": "string"
},
"custom_data_sec1": {
"label": "Custom data section 1",
"description": "The information associated with the 'custom_label_sec1' heading. The info is displayed on the right side of the infobox in the same row as the name. For an example, see [[Warsaw]].",
"type": "content"
}
},
"paramOrder": [
"name",
"native_name",
"native_name_lang",
"other_name",
"type",
"official_name",
"translit_lang1",
"translit_lang1_type",
"translit_lang1_info",
"translit_lang2",
"image",
"image_size",
"image_upright",
"alt",
"caption",
"image_flag",
"flag_size",
"flag_alt",
"flag_border",
"flag_link",
"image_seal",
"seal_size",
"seal_alt",
"seal_link",
"seal_type",
"seal_class",
"image_shield",
"shield_size",
"shield_alt",
"shield_link",
"image_blank_emblem",
"blank_emblem_type",
"blank_emblem_size",
"blank_emblem_upright",
"blank_emblem_alt",
"blank_emblem_link",
"nickname",
"motto",
"anthem",
"image_map",
"map_size",
"map_alt",
"map_caption",
"image_map1",
"map_size1",
"map_alt1",
"map_caption1",
"pushpin_map",
"pushpin_map_size",
"pushpin_alt",
"pushpin_caption",
"pushpin_label",
"pushpin_label_position",
"pushpin_relief",
"mapframe",
"mapframe-caption",
"mapframe-custom",
"mapframe-id",
"mapframe-coordinates",
"mapframe-wikidata",
"mapframe-point",
"mapframe-shape",
"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",
"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-switcher",
"mapframe-line",
"coordinates",
"coor_pinpoint",
"coordinates_footnotes",
"subdivision_type",
"subdivision_name",
"subdivision_type1",
"subdivision_name1",
"subdivision_type2",
"subdivision_name2",
"subdivision_type3",
"subdivision_name3",
"subdivision_type4",
"subdivision_name4",
"subdivision_type5",
"subdivision_name5",
"subdivision_type6",
"subdivision_name6",
"established_title",
"established_date",
"established_title1",
"established_date1",
"established_title2",
"established_date2",
"established_title3",
"established_date3",
"established_title4",
"established_date4",
"established_title5",
"established_date5",
"established_title6",
"established_date6",
"established_title7",
"established_date7",
"extinct_title",
"extinct_date",
"founder",
"named_for",
"seat_type",
"seat",
"parts_type",
"parts_style",
"parts",
"government_footnotes",
"government_type",
"governing_body",
"leader_party",
"leader_title",
"leader_name",
"leader_title1",
"leader_name1",
"total_type",
"unit_pref",
"area_footnotes",
"dunam_link",
"area_total_km2",
"area_total_sq_mi",
"area_total_ha",
"area_total_acre",
"area_total_dunam",
"area_land_km2",
"area_land_sq_mi",
"area_land_ha",
"area_land_dunam",
"area_land_acre",
"area_water_km2",
"area_water_sq_mi",
"area_water_ha",
"area_water_dunam",
"area_water_acre",
"area_water_percent",
"area_urban_km2",
"area_urban_sq_mi",
"area_urban_ha",
"area_urban_dunam",
"area_urban_acre",
"area_urban_footnotes",
"area_rural_km2",
"area_rural_sq_mi",
"area_rural_ha",
"area_rural_dunam",
"area_rural_acre",
"area_rural_footnotes",
"area_metro_km2",
"area_metro_sq_mi",
"area_metro_ha",
"area_metro_dunam",
"area_metro_acre",
"area_metro_footnotes",
"area_rank",
"area_blank1_title",
"area_blank1_km2",
"area_blank1_sq_mi",
"area_blank1_ha",
"area_blank1_dunam",
"area_blank1_acre",
"area_blank2_title",
"area_blank2_km2",
"area_blank2_sq_mi",
"area_blank2_ha",
"area_blank2_dunam",
"area_blank2_acre",
"area_note",
"dimensions_footnotes",
"length_km",
"length_mi",
"width_km",
"width_mi",
"elevation_m",
"elevation_ft",
"elevation_footnotes",
"elevation_min_point",
"elevation_min_m",
"elevation_min_ft",
"elevation_min_rank",
"elevation_min_footnotes",
"elevation_max_point",
"elevation_max_m",
"elevation_max_ft",
"elevation_max_rank",
"elevation_max_footnotes",
"population_total",
"population_as_of",
"population_footnotes",
"population_density_km2",
"population_density_sq_mi",
"population_est",
"pop_est_as_of",
"pop_est_footnotes",
"population_urban",
"population_urban_footnotes",
"population_density_urban_km2",
"population_density_urban_sq_mi",
"population_rural",
"population_rural_footnotes",
"population_density_rural_km2",
"population_density_rural_sq_mi",
"population_metro",
"population_metro_footnotes",
"population_density_metro_km2",
"population_density_metro_sq_mi",
"population_rank",
"population_density_rank",
"population_blank1_title",
"population_blank1",
"population_density_blank1_km2",
"population_density_blank1_sq_mi",
"population_blank2_title",
"population_blank2",
"population_density_blank2_km2",
"population_density_blank2_sq_mi",
"population_demonym",
"population_note",
"demographics_type1",
"demographics1_footnotes",
"demographics1_title1",
"demographics_type2",
"demographics2_footnotes",
"demographics2_title1",
"demographics2_info1",
"time_zone1",
"utc_offset",
"time_zone_DST",
"utc_offset_DST",
"utc_offset1",
"time_zone1_DST",
"utc_offset1_DST",
"time_zone2",
"utc_offset2",
"time_zone2_DST",
"utc_offset2_DST",
"postal_code_type",
"postal_code",
"postal2_code_type",
"postal2_code",
"area_code",
"area_code_type",
"geocode",
"iso_code",
"registration_plate_type",
"registration_plate",
"custom_label_sec1",
"custom_data_sec1",
"custom_label1_sec1",
"custom_data1_sec1",
"custom_label1_sec2",
"custom_data1_sec2",
"website",
"footnotes",
"translit_lang1_info1",
"translit_lang1_type1",
"translit_lang1_info2",
"translit_lang1_type2",
"demographics1_info1",
"embed",
"translit_lang1_type3",
"translit_lang1_type4",
"translit_lang1_info3",
"translit_lang1_type5",
"translit_lang1_info4",
"translit_lang1_type6",
"translit_lang1_info5",
"translit_lang1_info6",
"translit_lang2_type1",
"translit_lang2_type",
"translit_lang2_info",
"translit_lang2_type2",
"translit_lang2_info1",
"translit_lang2_type3",
"translit_lang2_info2",
"translit_lang2_type4",
"translit_lang2_info3",
"translit_lang2_type5",
"translit_lang2_info4",
"translit_lang2_type6",
"translit_lang2_info5",
"translit_lang2_info6",
"pushpin_map_narrow",
"etymology",
"nicknames",
"nickname_link",
"mottoes",
"motto_link",
"anthem_link",
"grid_position",
"coor_type",
"grid_name",
"seat1_type",
"seat1",
"seat2_type",
"seat2",
"p1",
"p2",
"p3",
"p4",
"p5",
"p6",
"p7",
"p8",
"p9",
"p10",
"p11",
"p12",
"p13",
"p14",
"p15",
"p16",
"p17",
"p18",
"p19",
"p20",
"p21",
"p22",
"p23",
"p24",
"p25",
"p26",
"p27",
"p28",
"p29",
"p30",
"p31",
"p32",
"p33",
"p34",
"p35",
"p36",
"p37",
"p38",
"p39",
"p40",
"p41",
"p42",
"p43",
"p44",
"p45",
"p46",
"p47",
"p48",
"p49",
"p50",
"leader_name2",
"leader_name3",
"leader_name4",
"leader_name5",
"leader_title2",
"leader_title3",
"leader_title4",
"leader_title5",
"government_blank1_title",
"government_blank1",
"government_blank2_title",
"government_blank2",
"government_blank3_title",
"government_blank3",
"government_blank4_title",
"government_blank4",
"government_blank5_title",
"government_blank5",
"government_blank6_title",
"government_blank6",
"elevation_link",
"elevation_point",
"population_blank1_footnotes",
"population_blank2_footnotes",
"population_demonyms",
"demographics1_title2",
"demographics1_info2",
"demographics1_title3",
"demographics1_info3",
"demographics1_title4",
"demographics1_info4",
"demographics1_title5",
"demographics1_info5",
"demographics1_title6",
"demographics1_info6",
"demographics1_title7",
"demographics1_info7",
"demographics1_title8",
"demographics1_info8",
"demographics1_title9",
"demographics1_info9",
"demographics1_title10",
"demographics1_info10",
"demographics2_title2",
"demographics2_info2",
"demographics2_title3",
"demographics2_info3",
"demographics2_title4",
"demographics2_info4",
"demographics2_title5",
"demographics2_info5",
"demographics2_title6",
"demographics2_info6",
"demographics2_title7",
"demographics2_info7",
"demographics2_title8",
"demographics2_info8",
"demographics2_title9",
"demographics2_info9",
"demographics2_title10",
"demographics2_info10",
"time_zone1_location",
"time_zone_link",
"time_zone2_location",
"time_zone3_location",
"utc_offset3",
"time_zone3",
"utc_offset3_DST",
"time_zone3_DST",
"time_zone4_location",
"utc_offset4",
"time_zone4",
"utc_offset4_DST",
"time_zone4_DST",
"time_zone5_location",
"utc_offset5",
"time_zone5",
"utc_offset5_DST",
"time_zone5_DST",
"code1_name",
"code1_info",
"code2_name",
"code2_info",
"blank1_info",
"custom_label2_sec1",
"custom_data2_sec1",
"custom_label3_sec1",
"custom_data3_sec1",
"custom_label4_sec1",
"custom_data4_sec1",
"custom_label5_sec1",
"custom_data5_sec1",
"custom_label6_sec1",
"custom_data6_sec1",
"custom_label7_sec1",
"custom_data7_sec1",
"custom_label2_sec2",
"custom_data2_sec2",
"custom_label3_sec2",
"custom_data3_sec2",
"custom_label4_sec2",
"custom_data4_sec2",
"custom_label5_sec2",
"custom_data5_sec2",
"custom_label6_sec2",
"custom_data6_sec2",
"custom_label7_sec2",
"custom_data7_sec2",
"module",
"coordinates_wikidata",
"wikidata"
]
}
</templatedata>
{{collapse bottom}}
==Calls and redirects ==
At least {{PAGESINCATEGORY:Templates calling Infobox settlement}} other [[:Category:Templates calling Infobox settlement|templates call this one]].
[{{fullurl:Special:WhatLinksHere/Template:Infobox_settlement|namespace=10&hidetrans=1&hidelinks=1}} Several templates redirect here].
== Tracking categories ==
# {{clc|Pages using infobox settlement with unknown parameters}}
# {{clc|Pages using infobox settlement with conflicting parameters}}
# {{clc|Pages using infobox settlement with deprecated parameters}}
# {{clc|Pages using infobox settlement with bad settlement type}}
# {{clc|Pages using infobox settlement with bad density arguments}}
# {{clc|Pages using infobox settlement with image map1 but not image map}}
# {{clc|Pages using infobox settlement with missing country}}
# {{clc|Pages using infobox settlement with no map}}
# {{clc|Pages using infobox settlement with no coordinates}}
# {{clc|Pages using infobox settlement with possible area code list}}
# {{clc|Pages using infobox settlement with possible demonym list}}
# {{clc|Pages using infobox settlement with possible motto list}}
# {{clc|Pages using infobox settlement with possible nickname list}}
# {{clc|Pages using infobox settlement with the wikidata parameter}}
# {{clc|Templates calling Infobox settlement}}
==See also==
*[[Help:Coordinates]]
*[[Help:Elevation]]
*[[Help:GNIS data for U.S. infoboxes]]
*{{tl|Infobox too long}}
<includeonly>{{Sandbox other||
<!--Categories below this line, please; interwikis at Wikidata-->
[[Category:Place infobox templates|Settlement]]
[[Category:Embeddable templates]]
[[Category:Infobox templates using Wikidata]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
jpgv5vyrao9ru2g9w8dv21brm0pdd5m
Шаблон:Fix comma category
10
3688
21885
2022-12-08T20:50:50Z
Pppery
88
Doc to subpage
21885
wikitext
text/x-wiki
{{#invoke:String|replace|{{{1}}}|%[%[Category:(.-)from (.-) 2,(.-)%]%]|[[Category:%1 from %2 2%3]]|plain=false}}<noinclude>{{documentation}}</noinclude>
m9tezz247zwbvel8aa1xrexdvqx5g08
21886
21885
2026-09-18T15:05:31Z
Keresturec
18
1 измена увезена из [[:en:Template:Fix_comma_category]]: Importing from the English wikipedia
21885
wikitext
text/x-wiki
{{#invoke:String|replace|{{{1}}}|%[%[Category:(.-)from (.-) 2,(.-)%]%]|[[Category:%1 from %2 2%3]]|plain=false}}<noinclude>{{documentation}}</noinclude>
m9tezz247zwbvel8aa1xrexdvqx5g08
Модул:ConvertIB
828
3689
21889
2026-07-11T19:22:17Z
Hike395
2761
handle sigfig for cases like 0.0029 (should be 2)
21889
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
21890
21889
2026-09-18T15:05:31Z
Keresturec
18
1 измена увезена из [[:en:Module:ConvertIB]]: Importing from the English wikipedia
21889
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
Модул:Lang/langx
828
3690
21893
2024-11-15T19:17:00Z
Trappist the monk
2745
21893
Scribunto
text/plain
--[[--------------------------< R T L _ T >--------------------------------------------------------------------
table of language tags that render text right-to-left
Data in this table scraped from {{lang-xx}} templates that set |rtl=yes
keys (tags) in this table must be lowercase.
TODO: in the long run, do we need this table? Can't {{langx}} apply dir="rtl" attribute automatically?
]]
local rtl_t = {
----------< I S O 6 3 9 - 1 >----------
['ae'] = true,
['ar'] = true,
['fa'] = true,
['he'] = true,
['ku'] = true,
['ps'] = true,
['sd'] = true,
['ur'] = true,
['yi'] = true,
----------< I S O 6 3 9 - 2 , - 3 >----------
['acm'] = true,
['aeb'] = true,
['aec'] = true,
['afb'] = true,
['aii'] = true,
['aij'] = true,
['aiq'] = true,
['ajp'] = true,
['amw'] = true,
['apc'] = true,
['arb'] = true,
['arc'] = true,
['arq'] = true,
['ary'] = true,
['arz'] = true,
['ayn'] = true,
['bal'] = true,
['bdz'] = true,
['bej'] = true,
['bgn'] = true,
['bqi'] = true,
['brh'] = true,
['bsk'] = true,
['ckb'] = true,
['cld'] = true,
['deh'] = true,
['gay'] = true,
['gbz'] = true,
['glk'] = true,
['hac'] = true,
['haz'] = true,
['hbo'] = true,
['hnd'] = true,
['hno'] = true,
['jog'] = true,
['jrb'] = true,
['jye'] = true,
['khw'] = true,
['kls'] = true,
['kvx'] = true,
['lrc'] = true,
['lss'] = true,
['luz'] = true,
['mey'] = true,
['mid'] = true,
['mki'] = true,
['mnj'] = true,
['mwr'] = true,
['myz'] = true,
['mzb'] = true,
['mzn'] = true,
['nlm'] = true,
['nqo'] = true,
['oru'] = true,
['ota'] = true,
['otk'] = true,
['pal'] = true,
['pes'] = true,
['prs'] = true,
['prx'] = true,
['rif'] = true,
['rys'] = true,
['sbn'] = true,
['scl'] = true,
['sgh'] = true,
['siz'] = true,
['skr'] = true,
['sqo'] = true,
['sqr'] = true,
['srh'] = true,
['syc'] = true,
['syr'] = true,
['tru'] = true,
['ttt'] = true,
['wbl'] = true,
['wne'] = true,
['xaa'] = true,
['xdm'] = true,
['xhe'] = true,
['xqa'] = true,
['ydg'] = true,
}
--[[--------------------------< S C R I P T _ T >--------------------------------------------------------------
table of language tags that use script subtags
Data in this table scraped from {{lang-xx}} templates that set |script=<script tag>
keys (tags) in this table must be lowercase.
]]
local script_t = {
----------< I S O 6 3 9 - 1 >----------
['ce'] = 'Cyrl',
['ff'] = 'Latn',
['sh'] = 'Latn',
----------< I S O 6 3 9 - 2 , - 3 >----------
['bft'] = 'Aran',
['brx'] = 'Deva',
['bsk'] = 'Aran',
['chr'] = 'Cher',
['dgo'] = 'Deva',
['dng'] = 'Cyrl',
['dyu'] = 'Latn',
['ess'] = 'Latn',
['evn'] = 'Cyrl',
['sat'] = 'Olck',
['shn'] = 'Mymr',
}
--[[--------------------------< S I Z E _ T >------------------------------------------------------------------
table of language tags that use |size=
Data in this table scraped from {{lang-xx}} templates that set |size=<size>
keys (tags) in this table must be lowercase.
]]
local size_t = {
['bft'] = '125%',
}
--[[--------------------------< L I N K _ T >------------------------------------------------------------------
table of language tags that use |link=
Data in this table scraped from {{lang-xx}} templates that set |link=
keys (tags) in this table must be lowercase.
]]
local link_t = {
['en'] = 'no',
}
--[[--------------------------< U N S U P P O R T E D _ T >----------------------------------------------------
these are language tags from {{lang-??}} templates that should not be converted to {{langx}} during the transition
from {{lang-??}} to {{langx|??}}.
this table used to add a category when {{langx}} templates are encountered with these language tags.
initial contents of this table copied from Wikipedia:Templates_for_discussion/Log/2024_September_27/lang-%3F%3F_templates#excluded_templates
2024-11-15: now that the conversion of the {{lang-??}} templates is complete, and User:Monkbot/task 20 has
completed its work, and now that Module:Lang detects unsupported parameters, those valid IETF tags listed here
can be stricken so that valid use of those tags with {{langx|<tag>|...}} can be allowed.
]]
local unsupported_t = {
['bcs'] = true, -- bcs is IANA Kohumono language not Bosnian/Croatian/Serbian grouped under tag sh
['crh3'] = true, -- being deleted; convert to something like {{lang-sr-latn-cyrl}}?
['est-sea'] = true, -- {{Language with name}} wrapper; convert to private use tag: et-x-seto?
['fra-frc'] = true, -- {{Language with name}} wrapper; convert to private use tag: fr-x-frainc?
['grc-gre'] = true, -- currently (2024-11-15) being discussed for deletion
['my-name-mlcts'] = true, -- wrapper around {{lang-my-Mymr}} to render a {{lang-??}}-like result
['sq-definite'] = true, -- definiteness is a linguistic construct
['su-fonts'] = true, -- styling
['uniturk'] = true, -- a writing system
['1ca'] = true, -- uses {{lang}} and trk-Arab-TR; add that tag to ~/data for Old Anatolian Turkish?
-- ['ast-leo'] = true, -- deleted; use ast-es
-- ['lmo-cr'] = true, -- deleted; use lmo-x-cremish
-- ['lmo-it'] = true, -- deleted; use lmo-x-berg
-- ['pun'] = true, -- deleted; was a template dab
-- ['sa2'] = true, -- deleted; use {{lang}}
-- ['bcs-latn-cyrl'] = true, -- {{lang-x2}} template wrappers; these tags not valid
-- ['cnr-cyrl-latn'] = true,
-- ['cnr-latn-cyrl'] = true,
-- ['sh-cyrl-latn'] = true,
-- ['sh-latn-cyrl'] = true,
-- ['sr-cyrl-latn'] = true,
-- ['sr-latn-cyrl'] = true,
-- ['uz-cyrl-latn'] = true,
-- ['uz-latn-cyrl'] = true,
-- ['cnr-cyrl'] = true, -- valid IETF tags; no reason to prevent their use with {{langx}}
-- ['cnr-latn'] = true,
-- ['hmd'] = true,
-- ['ka'] = true,
-- ['ku-arab'] = true,
-- ['mnc'] = true,
-- ['my-mymr'] = true,
-- ['rus'] = true, -- sort of valid IETF tag; should be promoted to 'ru'
-- ['sh-cyrl'] = true,
-- ['sh-latn'] = true,
-- ['sr'] = true, -- per Template_talk:Lang#tracking_sr_usage_with_issues; discussion died nothing being done
-- ['sr-cyrl'] = true,
-- ['sr-latn'] = true,
-- ['uz-latn'] = true,
-- ['zh'] = true,
-- Moldovan Cyrillic -- now a redirect to Lang-ro-Cyrl
-- ['vi-chunom'] = true, -- now a redirect to {{Chunom}}
-- ['vi-hantu'] = true, -- now a redirect to {{Chuhan}}
}
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return {
link_t = link_t,
rtl_t = rtl_t,
script_t = script_t,
size_t = size_t,
unsupported_t = unsupported_t,
}
gwqe7k12n9zu6mivhd6gqfmpab6pi7r
21894
21893
2026-09-18T15:05:31Z
Keresturec
18
1 измена увезена из [[:en:Module:Lang/langx]]: Importing from the English wikipedia
21893
Scribunto
text/plain
--[[--------------------------< R T L _ T >--------------------------------------------------------------------
table of language tags that render text right-to-left
Data in this table scraped from {{lang-xx}} templates that set |rtl=yes
keys (tags) in this table must be lowercase.
TODO: in the long run, do we need this table? Can't {{langx}} apply dir="rtl" attribute automatically?
]]
local rtl_t = {
----------< I S O 6 3 9 - 1 >----------
['ae'] = true,
['ar'] = true,
['fa'] = true,
['he'] = true,
['ku'] = true,
['ps'] = true,
['sd'] = true,
['ur'] = true,
['yi'] = true,
----------< I S O 6 3 9 - 2 , - 3 >----------
['acm'] = true,
['aeb'] = true,
['aec'] = true,
['afb'] = true,
['aii'] = true,
['aij'] = true,
['aiq'] = true,
['ajp'] = true,
['amw'] = true,
['apc'] = true,
['arb'] = true,
['arc'] = true,
['arq'] = true,
['ary'] = true,
['arz'] = true,
['ayn'] = true,
['bal'] = true,
['bdz'] = true,
['bej'] = true,
['bgn'] = true,
['bqi'] = true,
['brh'] = true,
['bsk'] = true,
['ckb'] = true,
['cld'] = true,
['deh'] = true,
['gay'] = true,
['gbz'] = true,
['glk'] = true,
['hac'] = true,
['haz'] = true,
['hbo'] = true,
['hnd'] = true,
['hno'] = true,
['jog'] = true,
['jrb'] = true,
['jye'] = true,
['khw'] = true,
['kls'] = true,
['kvx'] = true,
['lrc'] = true,
['lss'] = true,
['luz'] = true,
['mey'] = true,
['mid'] = true,
['mki'] = true,
['mnj'] = true,
['mwr'] = true,
['myz'] = true,
['mzb'] = true,
['mzn'] = true,
['nlm'] = true,
['nqo'] = true,
['oru'] = true,
['ota'] = true,
['otk'] = true,
['pal'] = true,
['pes'] = true,
['prs'] = true,
['prx'] = true,
['rif'] = true,
['rys'] = true,
['sbn'] = true,
['scl'] = true,
['sgh'] = true,
['siz'] = true,
['skr'] = true,
['sqo'] = true,
['sqr'] = true,
['srh'] = true,
['syc'] = true,
['syr'] = true,
['tru'] = true,
['ttt'] = true,
['wbl'] = true,
['wne'] = true,
['xaa'] = true,
['xdm'] = true,
['xhe'] = true,
['xqa'] = true,
['ydg'] = true,
}
--[[--------------------------< S C R I P T _ T >--------------------------------------------------------------
table of language tags that use script subtags
Data in this table scraped from {{lang-xx}} templates that set |script=<script tag>
keys (tags) in this table must be lowercase.
]]
local script_t = {
----------< I S O 6 3 9 - 1 >----------
['ce'] = 'Cyrl',
['ff'] = 'Latn',
['sh'] = 'Latn',
----------< I S O 6 3 9 - 2 , - 3 >----------
['bft'] = 'Aran',
['brx'] = 'Deva',
['bsk'] = 'Aran',
['chr'] = 'Cher',
['dgo'] = 'Deva',
['dng'] = 'Cyrl',
['dyu'] = 'Latn',
['ess'] = 'Latn',
['evn'] = 'Cyrl',
['sat'] = 'Olck',
['shn'] = 'Mymr',
}
--[[--------------------------< S I Z E _ T >------------------------------------------------------------------
table of language tags that use |size=
Data in this table scraped from {{lang-xx}} templates that set |size=<size>
keys (tags) in this table must be lowercase.
]]
local size_t = {
['bft'] = '125%',
}
--[[--------------------------< L I N K _ T >------------------------------------------------------------------
table of language tags that use |link=
Data in this table scraped from {{lang-xx}} templates that set |link=
keys (tags) in this table must be lowercase.
]]
local link_t = {
['en'] = 'no',
}
--[[--------------------------< U N S U P P O R T E D _ T >----------------------------------------------------
these are language tags from {{lang-??}} templates that should not be converted to {{langx}} during the transition
from {{lang-??}} to {{langx|??}}.
this table used to add a category when {{langx}} templates are encountered with these language tags.
initial contents of this table copied from Wikipedia:Templates_for_discussion/Log/2024_September_27/lang-%3F%3F_templates#excluded_templates
2024-11-15: now that the conversion of the {{lang-??}} templates is complete, and User:Monkbot/task 20 has
completed its work, and now that Module:Lang detects unsupported parameters, those valid IETF tags listed here
can be stricken so that valid use of those tags with {{langx|<tag>|...}} can be allowed.
]]
local unsupported_t = {
['bcs'] = true, -- bcs is IANA Kohumono language not Bosnian/Croatian/Serbian grouped under tag sh
['crh3'] = true, -- being deleted; convert to something like {{lang-sr-latn-cyrl}}?
['est-sea'] = true, -- {{Language with name}} wrapper; convert to private use tag: et-x-seto?
['fra-frc'] = true, -- {{Language with name}} wrapper; convert to private use tag: fr-x-frainc?
['grc-gre'] = true, -- currently (2024-11-15) being discussed for deletion
['my-name-mlcts'] = true, -- wrapper around {{lang-my-Mymr}} to render a {{lang-??}}-like result
['sq-definite'] = true, -- definiteness is a linguistic construct
['su-fonts'] = true, -- styling
['uniturk'] = true, -- a writing system
['1ca'] = true, -- uses {{lang}} and trk-Arab-TR; add that tag to ~/data for Old Anatolian Turkish?
-- ['ast-leo'] = true, -- deleted; use ast-es
-- ['lmo-cr'] = true, -- deleted; use lmo-x-cremish
-- ['lmo-it'] = true, -- deleted; use lmo-x-berg
-- ['pun'] = true, -- deleted; was a template dab
-- ['sa2'] = true, -- deleted; use {{lang}}
-- ['bcs-latn-cyrl'] = true, -- {{lang-x2}} template wrappers; these tags not valid
-- ['cnr-cyrl-latn'] = true,
-- ['cnr-latn-cyrl'] = true,
-- ['sh-cyrl-latn'] = true,
-- ['sh-latn-cyrl'] = true,
-- ['sr-cyrl-latn'] = true,
-- ['sr-latn-cyrl'] = true,
-- ['uz-cyrl-latn'] = true,
-- ['uz-latn-cyrl'] = true,
-- ['cnr-cyrl'] = true, -- valid IETF tags; no reason to prevent their use with {{langx}}
-- ['cnr-latn'] = true,
-- ['hmd'] = true,
-- ['ka'] = true,
-- ['ku-arab'] = true,
-- ['mnc'] = true,
-- ['my-mymr'] = true,
-- ['rus'] = true, -- sort of valid IETF tag; should be promoted to 'ru'
-- ['sh-cyrl'] = true,
-- ['sh-latn'] = true,
-- ['sr'] = true, -- per Template_talk:Lang#tracking_sr_usage_with_issues; discussion died nothing being done
-- ['sr-cyrl'] = true,
-- ['sr-latn'] = true,
-- ['uz-latn'] = true,
-- ['zh'] = true,
-- Moldovan Cyrillic -- now a redirect to Lang-ro-Cyrl
-- ['vi-chunom'] = true, -- now a redirect to {{Chunom}}
-- ['vi-hantu'] = true, -- now a redirect to {{Chuhan}}
}
--[[--------------------------< E X P O R T S >----------------------------------------------------------------
]]
return {
link_t = link_t,
rtl_t = rtl_t,
script_t = script_t,
size_t = size_t,
unsupported_t = unsupported_t,
}
gwqe7k12n9zu6mivhd6gqfmpab6pi7r
Модул:ConvertIB/data
828
3691
21895
2025-09-24T18:01:03Z
MusikBot II
2764
Protected "[[Module:ConvertIB/data]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 20995 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
21895
Scribunto
text/plain
-- Units accepted by {{convert}} that come in groups (e.g., "5 ft 6 in")
local multiple =
{'mich', 'michlk', 'michainlk', 'miyd', 'miydftin', 'mift', 'ydftin', 'ydft',
'ftin', 'footin', 'handin', 'lboz', 'stlb', 'stlboz', 'stlb'}
-- Convert unit list to hash
local multTable = {}
for _, v in ipairs(multiple) do
multTable[v] = true
end
local impPref = {'imperial', 'english', 'uk', 'us', 'u.s.', 'us customary', 'u.s. customary', 'standard'}
local impPrefTable = {}
for _, v in ipairs(impPref) do
impPrefTable[v] = true
end
return {multiple=multTable, impPref=impPrefTable}
gkdhxrqte6nbgc1n2gmvcckgwn7onz3
21896
21895
2026-09-18T15:05:31Z
Keresturec
18
1 измена увезена из [[:en:Module:ConvertIB/data]]: Importing from the English wikipedia
21895
Scribunto
text/plain
-- Units accepted by {{convert}} that come in groups (e.g., "5 ft 6 in")
local multiple =
{'mich', 'michlk', 'michainlk', 'miyd', 'miydftin', 'mift', 'ydftin', 'ydft',
'ftin', 'footin', 'handin', 'lboz', 'stlb', 'stlboz', 'stlb'}
-- Convert unit list to hash
local multTable = {}
for _, v in ipairs(multiple) do
multTable[v] = true
end
local impPref = {'imperial', 'english', 'uk', 'us', 'u.s.', 'us customary', 'u.s. customary', 'standard'}
local impPrefTable = {}
for _, v in ipairs(impPref) do
impPrefTable[v] = true
end
return {multiple=multTable, impPref=impPrefTable}
gkdhxrqte6nbgc1n2gmvcckgwn7onz3
Модул:Settlement short description
828
3692
21897
2022-02-12T16:43:02Z
Jonesey95
2757
Undid revision 1071438822 by [[Special:Contributions/Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]). false positive?
21897
Scribunto
text/plain
--generates auto short description for use in infobox settlement
local p = {}
p.categories = ""
local plain = require('Module:Plain text')._main
local getArgs = require('Module:Arguments').getArgs
local tableTools = require ('Module:TableTools')
function p.reverseTable (init)
init[1], init[3] = init[3], init[1]
return init
end
function p.assign (args, argname, num)
local val
local var = {}
for i = 0,num do
--handle initial "subdivision_foo" without number
if i == 0 then
val = ""
else
val = tostring(i)
end
var[i+1] = p.validate(plain(args[argname..val]))
end
return var
end
--Display short description using {{short description}}
function p.shortdesc(text, frame)
return frame:expandTemplate{title = 'Short description', args = {text, 'noreplace'}}
end
function p.category (cattype)
local category = string.format('[[Category:Pages using infobox settlement with bad %s]]', cattype)
if category then p.categories = p.categories..category end --categorize
end
--sanity and other checks
function p.validate (parameter, cat)
if not parameter then return nil end
parameter = parameter:gsub('%b()', '') --remove things in brackets as extraneous information
:gsub('%s+', ' ') --fix possible extra spaces from previous cleanup
:gsub('^%s+', '') --trim spaces from beginning
:gsub('%s+$', '') --trim spaces from end
if parameter:match("[,;]") or not parameter:match("%a") then --must have some letters, ignore if multiple types/subdivisions
if cat then p.category (cat) end
return nil
end
if (parameter == "") then return nil end
return parameter
end
--removes redundancy like "England, United Kingdom" and fixes issues like "Foo in United States" (to "Foo in the United States")
--also used in Module:Type in location
function p.cleanupLoc (location)
if location == "" then return nil end
local replacements = {
["England, United Kingdom"] = "England",
["Scotland, United Kingdom"] = "Scotland",
["Wales, United Kingdom"] = "Wales",
["New York City, New York, United States"] = "New York City",
["^United States$"] = "the United States",
["London, United Kingdom"] = "London, England"
}
for i, v in pairs(replacements) do
location = location:gsub(i, v) --series of replacements
end
return location
end
function p.main(frame)
local categories = ""
local subdivision_types = {}
local subdivision_names = {}
local args = getArgs (frame, {parentOnly = true})
local settlement_type = p.validate(plain(args.settlement_type or args.type), "settlement type") or "Place"
local short_description = plain(args.short_description)
subdivision_types = p.assign(args, "subdivision_type", 2)
subdivision_names = p.assign(args, "subdivision_name", 2)
if short_description then
if (short_description == 'no') then
return
else
local language = mw.language.getContentLanguage()
return p.shortdesc(language:ucfirst(short_description), frame)
end
end
if not(subdivision_names[3] and
(string.find(settlement_type, '[nN]eighbo[u]?rhood') or string.find(settlement_type, '[sS]uburb'))) then
subdivision_names[3] = nil --display the third subdivision_type only if suburb or neighborhood
end
--if say "Voivodeship" is found within the subdivision_type, then specially handle
--by adding Voivodeship to the end if not already present
for x, y in ipairs (subdivision_types) do
local special_types = {
"Voivodeship"
}
for i, j in ipairs(special_types) do
if subdivision_names[x] and string.find(y, j, 1, true)
and not string.find(subdivision_names[x], j, 1, true) then
subdivision_names[x] = subdivision_names[x].." "..j
end
end
end
for x, y in ipairs (subdivision_names) do
if y then
if string.find(settlement_type, y, 1, true) then --if the subdivision is found within the settlement type
subdivision_names[x] = nil --don't display redundancy
p.category ("settlement type")
end
if y == mw.title.getCurrentTitle().text then --if the title is the same as one of the subdivision_names
subdivision_names[x] = nil --don't display redundancy
end
end
end
local location = table.concat(tableTools.compressSparseArray(p.reverseTable(subdivision_names)), ', ')
location = p.cleanupLoc (location)
if location then location = " in " .. location else location = "" end
local language = mw.language.getContentLanguage()
return p.shortdesc(language:ucfirst(settlement_type..location), frame)..p.categories
end
return p
sdmmtzi7bcwz6i491hq96btdkaj2hrz
21898
21897
2026-09-18T15:13:38Z
Amire80
9
1 измена увезена из [[:en:Module:Settlement_short_description]]: importing from the English Wikipedia
21897
Scribunto
text/plain
--generates auto short description for use in infobox settlement
local p = {}
p.categories = ""
local plain = require('Module:Plain text')._main
local getArgs = require('Module:Arguments').getArgs
local tableTools = require ('Module:TableTools')
function p.reverseTable (init)
init[1], init[3] = init[3], init[1]
return init
end
function p.assign (args, argname, num)
local val
local var = {}
for i = 0,num do
--handle initial "subdivision_foo" without number
if i == 0 then
val = ""
else
val = tostring(i)
end
var[i+1] = p.validate(plain(args[argname..val]))
end
return var
end
--Display short description using {{short description}}
function p.shortdesc(text, frame)
return frame:expandTemplate{title = 'Short description', args = {text, 'noreplace'}}
end
function p.category (cattype)
local category = string.format('[[Category:Pages using infobox settlement with bad %s]]', cattype)
if category then p.categories = p.categories..category end --categorize
end
--sanity and other checks
function p.validate (parameter, cat)
if not parameter then return nil end
parameter = parameter:gsub('%b()', '') --remove things in brackets as extraneous information
:gsub('%s+', ' ') --fix possible extra spaces from previous cleanup
:gsub('^%s+', '') --trim spaces from beginning
:gsub('%s+$', '') --trim spaces from end
if parameter:match("[,;]") or not parameter:match("%a") then --must have some letters, ignore if multiple types/subdivisions
if cat then p.category (cat) end
return nil
end
if (parameter == "") then return nil end
return parameter
end
--removes redundancy like "England, United Kingdom" and fixes issues like "Foo in United States" (to "Foo in the United States")
--also used in Module:Type in location
function p.cleanupLoc (location)
if location == "" then return nil end
local replacements = {
["England, United Kingdom"] = "England",
["Scotland, United Kingdom"] = "Scotland",
["Wales, United Kingdom"] = "Wales",
["New York City, New York, United States"] = "New York City",
["^United States$"] = "the United States",
["London, United Kingdom"] = "London, England"
}
for i, v in pairs(replacements) do
location = location:gsub(i, v) --series of replacements
end
return location
end
function p.main(frame)
local categories = ""
local subdivision_types = {}
local subdivision_names = {}
local args = getArgs (frame, {parentOnly = true})
local settlement_type = p.validate(plain(args.settlement_type or args.type), "settlement type") or "Place"
local short_description = plain(args.short_description)
subdivision_types = p.assign(args, "subdivision_type", 2)
subdivision_names = p.assign(args, "subdivision_name", 2)
if short_description then
if (short_description == 'no') then
return
else
local language = mw.language.getContentLanguage()
return p.shortdesc(language:ucfirst(short_description), frame)
end
end
if not(subdivision_names[3] and
(string.find(settlement_type, '[nN]eighbo[u]?rhood') or string.find(settlement_type, '[sS]uburb'))) then
subdivision_names[3] = nil --display the third subdivision_type only if suburb or neighborhood
end
--if say "Voivodeship" is found within the subdivision_type, then specially handle
--by adding Voivodeship to the end if not already present
for x, y in ipairs (subdivision_types) do
local special_types = {
"Voivodeship"
}
for i, j in ipairs(special_types) do
if subdivision_names[x] and string.find(y, j, 1, true)
and not string.find(subdivision_names[x], j, 1, true) then
subdivision_names[x] = subdivision_names[x].." "..j
end
end
end
for x, y in ipairs (subdivision_names) do
if y then
if string.find(settlement_type, y, 1, true) then --if the subdivision is found within the settlement type
subdivision_names[x] = nil --don't display redundancy
p.category ("settlement type")
end
if y == mw.title.getCurrentTitle().text then --if the title is the same as one of the subdivision_names
subdivision_names[x] = nil --don't display redundancy
end
end
end
local location = table.concat(tableTools.compressSparseArray(p.reverseTable(subdivision_names)), ', ')
location = p.cleanupLoc (location)
if location then location = " in " .. location else location = "" end
local language = mw.language.getContentLanguage()
return p.shortdesc(language:ucfirst(settlement_type..location), frame)..p.categories
end
return p
sdmmtzi7bcwz6i491hq96btdkaj2hrz
Модул:Plain text
828
3693
21899
2024-12-24T01:02:36Z
Dpleibovitz
2804
Fixed the stripping of + signs
21899
Scribunto
text/plain
--converts text with wikilinks to plain text, e.g "[[foo|gah]] is [[bar]]" to "gah is bar"
--removes anything enclosed in tags that isn't nested, mediawiki strip markers (references etc), files, italic and bold markup
require[[strict]]
local p = {}
function p.main(frame)
local text = frame.args[1]
local encode = require('Module:yesno')(frame.args.encode)
return p._main(text, encode)
end
function p._main(text, encode)
if not text then return end
text = mw.text.killMarkers(text)
:gsub(' ', ' ') --replace nbsp spaces with regular spaces
:gsub('<br ?/?>', ', ') --replace br with commas
:gsub('<span.->(.-)</span>', '%1') --remove spans while keeping text inside
:gsub('<i.->(.-)</i>', '%1') --remove italics while keeping text inside
:gsub('<b.->(.-)</b>', '%1') --remove bold while keeping text inside
:gsub('<em.->(.-)</em>', '%1') --remove emphasis while keeping text inside
:gsub('<strong.->(.-)</strong>', '%1') --remove strong while keeping text inside
:gsub('<sub.->(.-)</sub>', '%1') --remove subscript markup; retain contents
:gsub('<sup.->(.-)</sup>', '%1') --remove superscript markup; retain contents
:gsub('<u.->(.-)</u>', '%1') --remove underline markup; retain contents
:gsub('<.->.-<.->', '') --strip out remaining tags and the text inside
:gsub('<.->', '') --remove any other tag markup
:gsub('%[%[%s*[Ff][Ii][Ll][Ee]%s*:.-%]%]', '') --strip out files
:gsub('%[%[%s*[Ii][Mm][Aa][Gg][Ee]%s*:.-%]%]', '') --strip out use of image:
:gsub('%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:.-%]%]', '') --strip out categories
:gsub('%[%[[^%]]-|', '') --strip out piped link text
:gsub('([^%[])%[[^%[%]][^%]]-%s', '%1') --strip out external link text
:gsub('^%[[^%[%]][^%]]-%s', '') --strip out external link text
:gsub('[%[%]]', '') --then strip out remaining [ and ]
:gsub("'''''", "") --strip out bold italic markup
:gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes
:gsub('%-%-%-%-+', '') --remove ---- lines
:gsub("^%s+", "") --strip leading
:gsub("%s+$", "") --and trailing spaces
:gsub("%s+", " ") --strip redundant spaces
if encode then
return mw.text.encode(text)
else
return text
end
end
return p
hoter5uo4etb5wdwstjvk8cajoqttvl
21900
21899
2026-09-18T15:13:38Z
Amire80
9
1 измена увезена из [[:en:Module:Plain_text]]: importing from the English Wikipedia
21899
Scribunto
text/plain
--converts text with wikilinks to plain text, e.g "[[foo|gah]] is [[bar]]" to "gah is bar"
--removes anything enclosed in tags that isn't nested, mediawiki strip markers (references etc), files, italic and bold markup
require[[strict]]
local p = {}
function p.main(frame)
local text = frame.args[1]
local encode = require('Module:yesno')(frame.args.encode)
return p._main(text, encode)
end
function p._main(text, encode)
if not text then return end
text = mw.text.killMarkers(text)
:gsub(' ', ' ') --replace nbsp spaces with regular spaces
:gsub('<br ?/?>', ', ') --replace br with commas
:gsub('<span.->(.-)</span>', '%1') --remove spans while keeping text inside
:gsub('<i.->(.-)</i>', '%1') --remove italics while keeping text inside
:gsub('<b.->(.-)</b>', '%1') --remove bold while keeping text inside
:gsub('<em.->(.-)</em>', '%1') --remove emphasis while keeping text inside
:gsub('<strong.->(.-)</strong>', '%1') --remove strong while keeping text inside
:gsub('<sub.->(.-)</sub>', '%1') --remove subscript markup; retain contents
:gsub('<sup.->(.-)</sup>', '%1') --remove superscript markup; retain contents
:gsub('<u.->(.-)</u>', '%1') --remove underline markup; retain contents
:gsub('<.->.-<.->', '') --strip out remaining tags and the text inside
:gsub('<.->', '') --remove any other tag markup
:gsub('%[%[%s*[Ff][Ii][Ll][Ee]%s*:.-%]%]', '') --strip out files
:gsub('%[%[%s*[Ii][Mm][Aa][Gg][Ee]%s*:.-%]%]', '') --strip out use of image:
:gsub('%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:.-%]%]', '') --strip out categories
:gsub('%[%[[^%]]-|', '') --strip out piped link text
:gsub('([^%[])%[[^%[%]][^%]]-%s', '%1') --strip out external link text
:gsub('^%[[^%[%]][^%]]-%s', '') --strip out external link text
:gsub('[%[%]]', '') --then strip out remaining [ and ]
:gsub("'''''", "") --strip out bold italic markup
:gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes
:gsub('%-%-%-%-+', '') --remove ---- lines
:gsub("^%s+", "") --strip leading
:gsub("%s+$", "") --and trailing spaces
:gsub("%s+", " ") --strip redundant spaces
if encode then
return mw.text.encode(text)
else
return text
end
end
return p
hoter5uo4etb5wdwstjvk8cajoqttvl
Модул:Transclusion count/data/S
828
3694
21901
2026-09-13T05:11:20Z
Ahechtbot
2779
[[Wikipedia:BOT|Bot]]: Updated page.
21901
Scribunto
text/plain
return {
["S"] = 4300,
["S-aca"] = 6700,
["S-ach"] = 17000,
["S-aft"] = 230000,
["S-aft/check"] = 231000,
["S-aft/filter"] = 231000,
["S-bef"] = 235000,
["S-bef/check"] = 235000,
["S-bef/filter"] = 235000,
["S-break"] = 6600,
["S-bus"] = 2100,
["S-civ"] = 2900,
["S-dip"] = 6000,
["S-end"] = 262000,
["S-gov"] = 8600,
["S-hon"] = 4000,
["S-hou"] = 9800,
["S-inc"] = 13000,
["S-legal"] = 9900,
["S-line_label"] = 2000,
["S-mil"] = 13000,
["S-new"] = 17000,
["S-non"] = 11000,
["S-npo"] = 4200,
["S-off"] = 43000,
["S-par"] = 52000,
["S-par/en"] = 3300,
["S-par/gb"] = 3300,
["S-par/uk"] = 12000,
["S-par/us-hs"] = 12000,
["S-par/us-sen"] = 2100,
["S-ppo"] = 15000,
["S-prec"] = 3200,
["S-reg"] = 22000,
["S-rel"] = 19000,
["S-roy"] = 2800,
["S-sports"] = 12000,
["S-start"] = 254000,
["S-ttl"] = 242000,
["S-ttl/check"] = 242000,
["S-vac"] = 7800,
["SAU"] = 2100,
["SCO"] = 3800,
["SDcat"] = 6820000,
["SECOND"] = 2300,
["SGP"] = 2900,
["SIA"] = 2500,
["SLL"] = 2000,
["SLO"] = 4900,
["SMS"] = 6900,
["SMU"] = 2500,
["SPI_archive_notice"] = 85000,
["SPIarchive_notice"] = 82000,
["SPIcat"] = 3800,
["SPIclose"] = 3300,
["SPIpriorcases"] = 78000,
["SR/Olympics_profile"] = 2200,
["SRB"] = 4400,
["SS"] = 22000,
["SSPa"] = 2600,
["STN"] = 11000,
["SUBJECTSPACE_formatted"] = 45000,
["SUI"] = 9600,
["SVG"] = 2600,
["SVG-Logo"] = 26000,
["SVG-Res"] = 24000,
["SVG-logo"] = 14000,
["SVK"] = 8800,
["SVN"] = 5900,
["SWE"] = 14000,
["Salts_by_element"] = 2200,
["Sandbox_other"] = 476000,
["Saturday"] = 2800,
["Saved_book"] = 52000,
["Sc"] = 2900,
["Scholia"] = 3700,
["School_block"] = 13000,
["School_disambiguation"] = 3500,
["Schoolblock"] = 6900,
["Schooldis"] = 2700,
["Schoolip"] = 12000,
["Scientist_icon"] = 16000,
["Scientist_icon2"] = 16000,
["Sclass"] = 34000,
["Sclass2"] = 11000,
["Screen_reader-only"] = 108000,
["Screen_reader-only/styles.css"] = 149000,
["Script"] = 7600,
["Script/Arabic"] = 4000,
["Script/Hebrew"] = 4900,
["Script/Nastaliq"] = 15000,
["Script/doc/id-unk"] = 3200,
["Script/doc/id-unk/core"] = 3200,
["Script/doc/id-unk/is-iso-alpha4"] = 3200,
["Script/doc/id-unk/name-to-alpha4"] = 3200,
["Script/styles.css"] = 3400,
["Script/styles_arabic.css"] = 4000,
["Script/styles_hebrew.css"] = 4900,
["Sdash"] = 4000,
["Search_box"] = 74000,
["Search_link"] = 27000,
["Section_link"] = 167000,
["Section_sizes"] = 4400,
["See"] = 8900,
["See_also"] = 218000,
["Seealso"] = 8000,
["Seiner_Majestät_Schiff"] = 6900,
["Seiner_Majestät_Unterseeboot"] = 2500,
["Select_skin"] = 5500,
["Selected"] = 2000,
["Selected_article"] = 2500,
["Selected_picture"] = 2400,
["Self"] = 45000,
["Self-published_inline"] = 4700,
["Self-published_source"] = 6100,
["Self-reference"] = 2200,
["Self-reference_tool"] = 8200,
["Semi-protected_indefinitely"] = 4800,
["Sent_off"] = 17000,
["Sentoff"] = 6300,
["Separated_entries"] = 2900,
["Sequence"] = 4100,
["Series_overview"] = 10000,
["Serif"] = 5000,
["Set_category"] = 38000,
["Set_index_article"] = 6400,
["Sets_taxobox_colour"] = 3400,
["Sfn"] = 211000,
["SfnRef"] = 165000,
["Sfn_whitelist"] = 2600,
["Sfnm"] = 6000,
["Sfnp"] = 24000,
["Sfnref"] = 19000,
["Sfrac"] = 5100,
["Sfrac/styles.css"] = 5200,
["SharedIPEDU"] = 3300,
["Shared_IP"] = 10000,
["Shared_IP_corp"] = 4100,
["Shared_IP_edu"] = 186000,
["Shared_IP_gov"] = 2300,
["Sharedip"] = 3000,
["Sharedipedu"] = 3800,
["Sherdog"] = 2700,
["Ship"] = 42000,
["Ship_index"] = 7600,
["Shipboxflag"] = 21000,
["Shipboxflag/core"] = 21000,
["Shipwrecks_navbox_footer"] = 11000,
["Shipwrecks_navbox_footer/link"] = 11000,
["Short_description"] = 6960000,
["Short_description/lowercasecheck"] = 6960000,
["Shortcut"] = 22000,
["Should_be_SVG"] = 8000,
["Shy"] = 2200,
["Sic"] = 39000,
["Side_box"] = 1250000,
["Sidebar"] = 320000,
["Sidebar_games_events"] = 43000,
["Sidebar_person"] = 4900,
["Sidebar_person/styles.css"] = 6300,
["Sidebar_with_collapsible_lists"] = 83000,
["Sigfig"] = 4000,
["Significant_figures"] = 5600,
["Significant_figures/rnd"] = 5200,
["Signpost-subscription"] = 2100,
["Signpost-subscription/styles.css"] = 2100,
["Signpost/item"] = 49000,
["Signpost/item/core"] = 49000,
["Signpost/snippet-nopic"] = 3400,
["Signpost/snippet/styles.css"] = 3700,
["Sildb_prim"] = 2200,
["Silver02"] = 18000,
["Silver2"] = 46000,
["Silver_medal"] = 6700,
["Silver_medal_icon"] = 60000,
["Similar_names"] = 3400,
["Single+double"] = 11000,
["Single+space"] = 17000,
["Single-innings_cricket_match"] = 4100,
["Single_chart"] = 43000,
["Single_namespace"] = 339000,
["Single_source"] = 3000,
["Singlechart"] = 12000,
["Singles"] = 49000,
["Sister-inline"] = 224000,
["Sister-inline/styles.css"] = 224000,
["Sister_project"] = 1130000,
["Sister_project/styles.css"] = 1130000,
["Sister_project_links"] = 14000,
["Skip_to_talk"] = 12000,
["Skip_to_talk/styles.css"] = 12000,
["Sky"] = 3300,
["Sky/styles.css"] = 3300,
["Slink"] = 66000,
["Slovak_municipality"] = 3000,
["Slovak_municipality/geo"] = 2800,
["Small"] = 653000,
["Small_Solar_System_bodies"] = 3600,
["Smallcaps"] = 22000,
["Smallcaps/styles.css"] = 23000,
["Smalldiv"] = 44000,
["Smaller"] = 79000,
["Smiley"] = 54000,
["Snd"] = 614000,
["Snds"] = 6500,
["Soccer_icon"] = 124000,
["Soccer_icon2"] = 124000,
["Soccer_icon4"] = 3500,
["Soccerbase"] = 13000,
["Soccerbase_season"] = 8100,
["Soccerway"] = 84000,
["Sock"] = 56000,
["Sock_list"] = 11000,
["Sockcat"] = 2000,
["Sockmaster"] = 10000,
["Sockpuppet"] = 287000,
["Sockpuppet/altmaster"] = 3700,
["Sockpuppet/categorise"] = 287000,
["SockpuppetCheckuser"] = 5500,
["Sockpuppet_category"] = 52000,
["Sockpuppet_category/confirmed"] = 28000,
["Sockpuppet_category/suspected"] = 24000,
["Sockpuppetcheckuser"] = 3600,
["Sockpuppeteer"] = 29000,
["Soft_hyphen"] = 2300,
["Soft_redirect"] = 6500,
["Soft_redirect_protection"] = 10000,
["Softredirect"] = 3300,
["Solar_luminosity"] = 5200,
["Solar_mass"] = 6600,
["Solar_radius"] = 5300,
["Soldier_icon"] = 3900,
["Soldier_icon2"] = 3900,
["Songs_category"] = 9600,
["Songs_category/core"] = 9600,
["Sort"] = 122000,
["Sort_under"] = 2200,
["Sort_under/styles.css"] = 2200,
["Sortname"] = 64000,
["Source-attribution"] = 9200,
["Source_assess"] = 2700,
["Source_assess_table"] = 2700,
["Source_attribution"] = 39000,
["Source_check"] = 927000,
["Sourcecheck"] = 927000,
["Sources"] = 3600,
["Sources_exist"] = 4300,
["South_America_topic"] = 2700,
["Sp"] = 165000,
["Space"] = 130000,
["Space+apostrophe+s"] = 27000,
["Space+double"] = 7300,
["Space+single"] = 15000,
["Spaced_en_dash"] = 648000,
["Spaced_en_dash_space"] = 6600,
["Spaced_ndash"] = 22000,
["Spaces"] = 736000,
["Spain_metadata_Wikidata"] = 7400,
["Spamlink"] = 14000,
["Species_Latin_name_abbreviation_disambiguation"] = 2400,
["Species_list"] = 25000,
["Speciesbox"] = 394000,
["Speciesbox/checkgenus"] = 392000,
["Speciesbox/getGenus"] = 395000,
["Speciesbox/getSpecies"] = 394000,
["Speciesbox/name"] = 394000,
["Speciesbox/parameterCheck"] = 394000,
["Speciesbox/trim"] = 394000,
["Specieslist"] = 9300,
["Split_article"] = 4200,
["Spnd"] = 4800,
["Spoken_Wikipedia"] = 2200,
["Sport_icon"] = 16000,
["Sport_icon2"] = 17000,
["SportsYearCatUSstate"] = 6700,
["Sports_club_or_team_people_category_header"] = 14000,
["Sports_club_or_team_people_category_header/category1"] = 14000,
["Sports_club_or_team_people_category_header/club_name"] = 14000,
["Sports_links"] = 81000,
["Sports_reference"] = 5100,
["Squad_maintenance"] = 3800,
["Sronly"] = 49000,
["Srt"] = 7300,
["Stack"] = 30000,
["Stack/styles.css"] = 42000,
["Stack_begin"] = 12000,
["Stack_end"] = 12000,
["StaleIP"] = 3600,
["StandardEbooks"] = 2500,
["Standings_table_end"] = 64000,
["Standings_table_entry"] = 25000,
["Standings_table_entry/record"] = 64000,
["Standings_table_start"] = 64000,
["Standings_table_start/colheader"] = 64000,
["Standings_table_start/colspan"] = 64000,
["Standings_table_start/styles.css"] = 64000,
["Starbox_astrometry"] = 5700,
["Starbox_begin"] = 5800,
["Starbox_catalog"] = 5700,
["Starbox_character"] = 5700,
["Starbox_detail"] = 5600,
["Starbox_end"] = 5800,
["Starbox_image"] = 4100,
["Starbox_observe"] = 5800,
["Starbox_reference"] = 5700,
["Start-Class"] = 18000,
["Start-date"] = 2300,
["Start_and_end_dates"] = 3700,
["Start_box"] = 5500,
["Start_date"] = 549000,
["Start_date_and_age"] = 188000,
["Start_date_and_years_ago"] = 4000,
["Start_date_text"] = 3900,
["Start_of_course_timeline"] = 5800,
["Start_of_course_week"] = 6000,
["Start_tab"] = 6700,
["Startflatlist"] = 163000,
["Startplainlist"] = 2300,
["Static_IP"] = 5000,
["Static_row_numbers"] = 2900,
["Static_row_numbers/styles.css"] = 2900,
["Station"] = 22000,
["Station_link"] = 19000,
["Stdinchicite"] = 10000,
["Steady"] = 20000,
["Sticky_header"] = 9700,
["Sticky_header/styles.css"] = 27000,
["Stl"] = 17000,
["Stn"] = 11000,
["Stn_art_lnk"] = 2200,
["Stnlnk"] = 35000,
["Stop"] = 2000,
["Store_norske_leksikon"] = 2500,
["Storm_colour"] = 5800,
["Storm_name"] = 2400,
["Storm_path"] = 2200,
["Stortingetbio"] = 2100,
["StoryTeleplay"] = 3200,
["Str_count"] = 166000,
["Str_endswith"] = 236000,
["Str_find"] = 283000,
["Str_index"] = 15000,
["Str_left"] = 316000,
["Str_len"] = 168000,
["Str_letter"] = 184000,
["Str_letter/trim"] = 21000,
["Str_number"] = 7200,
["Str_number/trim"] = 226000,
["Str_rep"] = 299000,
["Str_right"] = 7200,
["Str_startswith"] = 2900,
["Str_trim"] = 4200,
["Str_≠_len"] = 48000,
["Str_≤_len"] = 2900,
["Str_≥_len"] = 105000,
["Strfind_short"] = 5400,
["Strike"] = 2300,
["Strikethrough"] = 20000,
["String_split"] = 5400,
["Strip_tags"] = 41000,
["Strong"] = 216000,
["Structurae"] = 2100,
["Stub-Class"] = 18000,
["Stub_Category"] = 14000,
["Stub_category"] = 21000,
["Stub_documentation"] = 42000,
["Student_editor"] = 27000,
["Student_sandbox"] = 4300,
["Student_table_row"] = 7200,
["Students_table"] = 7200,
["Su"] = 4800,
["Su-census1989"] = 4600,
["Sub"] = 4600,
["Subinfobox_bodystyle"] = 75000,
["Subject_bar"] = 21000,
["Suboff"] = 7500,
["Subon"] = 7600,
["Subpage_other"] = 411000,
["Subscription_required"] = 35000,
["Subsidebar_bodystyle"] = 6400,
["Subst_only"] = 5500,
["Substituted_comment"] = 19000,
["Succession_box"] = 119000,
["Succession_box/check"] = 119000,
["Succession_links"] = 218000,
["Summer_Olympics_by_year_category_navigation"] = 2600,
["Summer_Olympics_by_year_category_navigation/core"] = 2600,
["Sunday"] = 2800,
["Sup"] = 95000,
["Suppress_categories"] = 6600,
["Surname"] = 81000,
["Swiss_metadata_Wikidata"] = 2900,
["Swiss_populations"] = 2400,
["Swiss_populations_NC"] = 3000,
["Swiss_populations_YM"] = 2300,
["Swiss_populations_ref"] = 2400,
["Switcher"] = 8500,
["Sz"] = 2500,
["Module:SDcat"] = 6820000,
["Module:SPI_archive_notice"] = 39000,
["Module:SST"] = 13000,
["Module:SST/hosts"] = 13000,
["Module:SST/registry"] = 275000,
["Module:SST/shards/sets/COLLEDGE_SHIPS_RN"] = 3000,
["Module:SST/shards/sets/TALBERT_BARRINGTON_ATLAS"] = 2100,
["Module:Science_redirect"] = 323000,
["Module:Science_redirect/conf"] = 323000,
["Module:Section_link"] = 167000,
["Module:Section_sizes"] = 5900,
["Module:See_also_if_exists"] = 95000,
["Module:Self"] = 45000,
["Module:Self/license_migration_data.json"] = 23000,
["Module:Self/styles.css"] = 45000,
["Module:Separated_entries"] = 2840000,
["Module:Series_overview"] = 10000,
["Module:Settlement_Wikidata"] = 52000,
["Module:Settlement_short_description"] = 729000,
["Module:Shortcut"] = 29000,
["Module:Shortcut/config"] = 29000,
["Module:Shortcut/styles.css"] = 29000,
["Module:Side_box"] = 1290000,
["Module:Side_box/styles.css"] = 1280000,
["Module:Sidebar"] = 435000,
["Module:Sidebar/configuration"] = 435000,
["Module:Sidebar/styles.css"] = 442000,
["Module:Sidebar_games_events"] = 43000,
["Module:Sidebar_games_events/styles.css"] = 43000,
["Module:Singles"] = 49000,
["Module:Sister_project_links"] = 22000,
["Module:Sister_project_links/bar/styles.css"] = 7300,
["Module:Sister_project_links/config"] = 22000,
["Module:Sister_project_links/styles.css"] = 14000,
["Module:Sister_project_logo"] = 1360000,
["Module:Sister_project_logo/data"] = 1360000,
["Module:Slovak_municipality"] = 3000,
["Module:Sock_list"] = 11000,
["Module:Sort"] = 156000,
["Module:Sort_title"] = 40000,
["Module:Sortkey"] = 105000,
["Module:Split_article"] = 4200,
["Module:Spoken_Wikipedia"] = 2200,
["Module:Spoken_Wikipedia/configuration"] = 2200,
["Module:Spoken_Wikipedia/styles.css"] = 2200,
["Module:Sports_career"] = 21000,
["Module:Sports_color"] = 79000,
["Module:Sports_color/baseball"] = 36000,
["Module:Sports_color/basketball"] = 19000,
["Module:Sports_color/ice_hockey"] = 3400,
["Module:Sports_color/international_football"] = 43000,
["Module:Sports_rbr_table"] = 15000,
["Module:Sports_rbr_table/styles.css"] = 15000,
["Module:Sports_reference"] = 5100,
["Module:Sports_results"] = 19000,
["Module:Sports_results/styles.css"] = 11000,
["Module:Sports_table"] = 74000,
["Module:Sports_table/Volleyball"] = 2500,
["Module:Sports_table/WDL"] = 64000,
["Module:Sports_table/WDL_OT"] = 4000,
["Module:Sports_table/WL"] = 5600,
["Module:Sports_table/WL_OT"] = 3100,
["Module:Sports_table/argcheck"] = 74000,
["Module:Sports_table/styles.css"] = 74000,
["Module:Sports_table/sub"] = 74000,
["Module:Sports_table/totalscheck"] = 53000,
["Module:Stock_tickers/NYSE"] = 2000,
["Module:Storm_categories"] = 5900,
["Module:Storm_categories/categories"] = 5900,
["Module:Storm_categories/colors"] = 5900,
["Module:Storm_categories/icons"] = 5900,
["Module:String"] = 14200000,
["Module:String2"] = 2090000,
["Module:Su"] = 14000,
["Module:Subject_bar"] = 21000,
["Module:Suppress_categories"] = 6600,
["Module:Switcher"] = 8500,
}
b1jzbel4r50rsfcdoivyfp75ikuquob
21902
21901
2026-09-18T15:13:39Z
Amire80
9
1 измена увезена из [[:en:Module:Transclusion_count/data/S]]: importing from the English Wikipedia
21901
Scribunto
text/plain
return {
["S"] = 4300,
["S-aca"] = 6700,
["S-ach"] = 17000,
["S-aft"] = 230000,
["S-aft/check"] = 231000,
["S-aft/filter"] = 231000,
["S-bef"] = 235000,
["S-bef/check"] = 235000,
["S-bef/filter"] = 235000,
["S-break"] = 6600,
["S-bus"] = 2100,
["S-civ"] = 2900,
["S-dip"] = 6000,
["S-end"] = 262000,
["S-gov"] = 8600,
["S-hon"] = 4000,
["S-hou"] = 9800,
["S-inc"] = 13000,
["S-legal"] = 9900,
["S-line_label"] = 2000,
["S-mil"] = 13000,
["S-new"] = 17000,
["S-non"] = 11000,
["S-npo"] = 4200,
["S-off"] = 43000,
["S-par"] = 52000,
["S-par/en"] = 3300,
["S-par/gb"] = 3300,
["S-par/uk"] = 12000,
["S-par/us-hs"] = 12000,
["S-par/us-sen"] = 2100,
["S-ppo"] = 15000,
["S-prec"] = 3200,
["S-reg"] = 22000,
["S-rel"] = 19000,
["S-roy"] = 2800,
["S-sports"] = 12000,
["S-start"] = 254000,
["S-ttl"] = 242000,
["S-ttl/check"] = 242000,
["S-vac"] = 7800,
["SAU"] = 2100,
["SCO"] = 3800,
["SDcat"] = 6820000,
["SECOND"] = 2300,
["SGP"] = 2900,
["SIA"] = 2500,
["SLL"] = 2000,
["SLO"] = 4900,
["SMS"] = 6900,
["SMU"] = 2500,
["SPI_archive_notice"] = 85000,
["SPIarchive_notice"] = 82000,
["SPIcat"] = 3800,
["SPIclose"] = 3300,
["SPIpriorcases"] = 78000,
["SR/Olympics_profile"] = 2200,
["SRB"] = 4400,
["SS"] = 22000,
["SSPa"] = 2600,
["STN"] = 11000,
["SUBJECTSPACE_formatted"] = 45000,
["SUI"] = 9600,
["SVG"] = 2600,
["SVG-Logo"] = 26000,
["SVG-Res"] = 24000,
["SVG-logo"] = 14000,
["SVK"] = 8800,
["SVN"] = 5900,
["SWE"] = 14000,
["Salts_by_element"] = 2200,
["Sandbox_other"] = 476000,
["Saturday"] = 2800,
["Saved_book"] = 52000,
["Sc"] = 2900,
["Scholia"] = 3700,
["School_block"] = 13000,
["School_disambiguation"] = 3500,
["Schoolblock"] = 6900,
["Schooldis"] = 2700,
["Schoolip"] = 12000,
["Scientist_icon"] = 16000,
["Scientist_icon2"] = 16000,
["Sclass"] = 34000,
["Sclass2"] = 11000,
["Screen_reader-only"] = 108000,
["Screen_reader-only/styles.css"] = 149000,
["Script"] = 7600,
["Script/Arabic"] = 4000,
["Script/Hebrew"] = 4900,
["Script/Nastaliq"] = 15000,
["Script/doc/id-unk"] = 3200,
["Script/doc/id-unk/core"] = 3200,
["Script/doc/id-unk/is-iso-alpha4"] = 3200,
["Script/doc/id-unk/name-to-alpha4"] = 3200,
["Script/styles.css"] = 3400,
["Script/styles_arabic.css"] = 4000,
["Script/styles_hebrew.css"] = 4900,
["Sdash"] = 4000,
["Search_box"] = 74000,
["Search_link"] = 27000,
["Section_link"] = 167000,
["Section_sizes"] = 4400,
["See"] = 8900,
["See_also"] = 218000,
["Seealso"] = 8000,
["Seiner_Majestät_Schiff"] = 6900,
["Seiner_Majestät_Unterseeboot"] = 2500,
["Select_skin"] = 5500,
["Selected"] = 2000,
["Selected_article"] = 2500,
["Selected_picture"] = 2400,
["Self"] = 45000,
["Self-published_inline"] = 4700,
["Self-published_source"] = 6100,
["Self-reference"] = 2200,
["Self-reference_tool"] = 8200,
["Semi-protected_indefinitely"] = 4800,
["Sent_off"] = 17000,
["Sentoff"] = 6300,
["Separated_entries"] = 2900,
["Sequence"] = 4100,
["Series_overview"] = 10000,
["Serif"] = 5000,
["Set_category"] = 38000,
["Set_index_article"] = 6400,
["Sets_taxobox_colour"] = 3400,
["Sfn"] = 211000,
["SfnRef"] = 165000,
["Sfn_whitelist"] = 2600,
["Sfnm"] = 6000,
["Sfnp"] = 24000,
["Sfnref"] = 19000,
["Sfrac"] = 5100,
["Sfrac/styles.css"] = 5200,
["SharedIPEDU"] = 3300,
["Shared_IP"] = 10000,
["Shared_IP_corp"] = 4100,
["Shared_IP_edu"] = 186000,
["Shared_IP_gov"] = 2300,
["Sharedip"] = 3000,
["Sharedipedu"] = 3800,
["Sherdog"] = 2700,
["Ship"] = 42000,
["Ship_index"] = 7600,
["Shipboxflag"] = 21000,
["Shipboxflag/core"] = 21000,
["Shipwrecks_navbox_footer"] = 11000,
["Shipwrecks_navbox_footer/link"] = 11000,
["Short_description"] = 6960000,
["Short_description/lowercasecheck"] = 6960000,
["Shortcut"] = 22000,
["Should_be_SVG"] = 8000,
["Shy"] = 2200,
["Sic"] = 39000,
["Side_box"] = 1250000,
["Sidebar"] = 320000,
["Sidebar_games_events"] = 43000,
["Sidebar_person"] = 4900,
["Sidebar_person/styles.css"] = 6300,
["Sidebar_with_collapsible_lists"] = 83000,
["Sigfig"] = 4000,
["Significant_figures"] = 5600,
["Significant_figures/rnd"] = 5200,
["Signpost-subscription"] = 2100,
["Signpost-subscription/styles.css"] = 2100,
["Signpost/item"] = 49000,
["Signpost/item/core"] = 49000,
["Signpost/snippet-nopic"] = 3400,
["Signpost/snippet/styles.css"] = 3700,
["Sildb_prim"] = 2200,
["Silver02"] = 18000,
["Silver2"] = 46000,
["Silver_medal"] = 6700,
["Silver_medal_icon"] = 60000,
["Similar_names"] = 3400,
["Single+double"] = 11000,
["Single+space"] = 17000,
["Single-innings_cricket_match"] = 4100,
["Single_chart"] = 43000,
["Single_namespace"] = 339000,
["Single_source"] = 3000,
["Singlechart"] = 12000,
["Singles"] = 49000,
["Sister-inline"] = 224000,
["Sister-inline/styles.css"] = 224000,
["Sister_project"] = 1130000,
["Sister_project/styles.css"] = 1130000,
["Sister_project_links"] = 14000,
["Skip_to_talk"] = 12000,
["Skip_to_talk/styles.css"] = 12000,
["Sky"] = 3300,
["Sky/styles.css"] = 3300,
["Slink"] = 66000,
["Slovak_municipality"] = 3000,
["Slovak_municipality/geo"] = 2800,
["Small"] = 653000,
["Small_Solar_System_bodies"] = 3600,
["Smallcaps"] = 22000,
["Smallcaps/styles.css"] = 23000,
["Smalldiv"] = 44000,
["Smaller"] = 79000,
["Smiley"] = 54000,
["Snd"] = 614000,
["Snds"] = 6500,
["Soccer_icon"] = 124000,
["Soccer_icon2"] = 124000,
["Soccer_icon4"] = 3500,
["Soccerbase"] = 13000,
["Soccerbase_season"] = 8100,
["Soccerway"] = 84000,
["Sock"] = 56000,
["Sock_list"] = 11000,
["Sockcat"] = 2000,
["Sockmaster"] = 10000,
["Sockpuppet"] = 287000,
["Sockpuppet/altmaster"] = 3700,
["Sockpuppet/categorise"] = 287000,
["SockpuppetCheckuser"] = 5500,
["Sockpuppet_category"] = 52000,
["Sockpuppet_category/confirmed"] = 28000,
["Sockpuppet_category/suspected"] = 24000,
["Sockpuppetcheckuser"] = 3600,
["Sockpuppeteer"] = 29000,
["Soft_hyphen"] = 2300,
["Soft_redirect"] = 6500,
["Soft_redirect_protection"] = 10000,
["Softredirect"] = 3300,
["Solar_luminosity"] = 5200,
["Solar_mass"] = 6600,
["Solar_radius"] = 5300,
["Soldier_icon"] = 3900,
["Soldier_icon2"] = 3900,
["Songs_category"] = 9600,
["Songs_category/core"] = 9600,
["Sort"] = 122000,
["Sort_under"] = 2200,
["Sort_under/styles.css"] = 2200,
["Sortname"] = 64000,
["Source-attribution"] = 9200,
["Source_assess"] = 2700,
["Source_assess_table"] = 2700,
["Source_attribution"] = 39000,
["Source_check"] = 927000,
["Sourcecheck"] = 927000,
["Sources"] = 3600,
["Sources_exist"] = 4300,
["South_America_topic"] = 2700,
["Sp"] = 165000,
["Space"] = 130000,
["Space+apostrophe+s"] = 27000,
["Space+double"] = 7300,
["Space+single"] = 15000,
["Spaced_en_dash"] = 648000,
["Spaced_en_dash_space"] = 6600,
["Spaced_ndash"] = 22000,
["Spaces"] = 736000,
["Spain_metadata_Wikidata"] = 7400,
["Spamlink"] = 14000,
["Species_Latin_name_abbreviation_disambiguation"] = 2400,
["Species_list"] = 25000,
["Speciesbox"] = 394000,
["Speciesbox/checkgenus"] = 392000,
["Speciesbox/getGenus"] = 395000,
["Speciesbox/getSpecies"] = 394000,
["Speciesbox/name"] = 394000,
["Speciesbox/parameterCheck"] = 394000,
["Speciesbox/trim"] = 394000,
["Specieslist"] = 9300,
["Split_article"] = 4200,
["Spnd"] = 4800,
["Spoken_Wikipedia"] = 2200,
["Sport_icon"] = 16000,
["Sport_icon2"] = 17000,
["SportsYearCatUSstate"] = 6700,
["Sports_club_or_team_people_category_header"] = 14000,
["Sports_club_or_team_people_category_header/category1"] = 14000,
["Sports_club_or_team_people_category_header/club_name"] = 14000,
["Sports_links"] = 81000,
["Sports_reference"] = 5100,
["Squad_maintenance"] = 3800,
["Sronly"] = 49000,
["Srt"] = 7300,
["Stack"] = 30000,
["Stack/styles.css"] = 42000,
["Stack_begin"] = 12000,
["Stack_end"] = 12000,
["StaleIP"] = 3600,
["StandardEbooks"] = 2500,
["Standings_table_end"] = 64000,
["Standings_table_entry"] = 25000,
["Standings_table_entry/record"] = 64000,
["Standings_table_start"] = 64000,
["Standings_table_start/colheader"] = 64000,
["Standings_table_start/colspan"] = 64000,
["Standings_table_start/styles.css"] = 64000,
["Starbox_astrometry"] = 5700,
["Starbox_begin"] = 5800,
["Starbox_catalog"] = 5700,
["Starbox_character"] = 5700,
["Starbox_detail"] = 5600,
["Starbox_end"] = 5800,
["Starbox_image"] = 4100,
["Starbox_observe"] = 5800,
["Starbox_reference"] = 5700,
["Start-Class"] = 18000,
["Start-date"] = 2300,
["Start_and_end_dates"] = 3700,
["Start_box"] = 5500,
["Start_date"] = 549000,
["Start_date_and_age"] = 188000,
["Start_date_and_years_ago"] = 4000,
["Start_date_text"] = 3900,
["Start_of_course_timeline"] = 5800,
["Start_of_course_week"] = 6000,
["Start_tab"] = 6700,
["Startflatlist"] = 163000,
["Startplainlist"] = 2300,
["Static_IP"] = 5000,
["Static_row_numbers"] = 2900,
["Static_row_numbers/styles.css"] = 2900,
["Station"] = 22000,
["Station_link"] = 19000,
["Stdinchicite"] = 10000,
["Steady"] = 20000,
["Sticky_header"] = 9700,
["Sticky_header/styles.css"] = 27000,
["Stl"] = 17000,
["Stn"] = 11000,
["Stn_art_lnk"] = 2200,
["Stnlnk"] = 35000,
["Stop"] = 2000,
["Store_norske_leksikon"] = 2500,
["Storm_colour"] = 5800,
["Storm_name"] = 2400,
["Storm_path"] = 2200,
["Stortingetbio"] = 2100,
["StoryTeleplay"] = 3200,
["Str_count"] = 166000,
["Str_endswith"] = 236000,
["Str_find"] = 283000,
["Str_index"] = 15000,
["Str_left"] = 316000,
["Str_len"] = 168000,
["Str_letter"] = 184000,
["Str_letter/trim"] = 21000,
["Str_number"] = 7200,
["Str_number/trim"] = 226000,
["Str_rep"] = 299000,
["Str_right"] = 7200,
["Str_startswith"] = 2900,
["Str_trim"] = 4200,
["Str_≠_len"] = 48000,
["Str_≤_len"] = 2900,
["Str_≥_len"] = 105000,
["Strfind_short"] = 5400,
["Strike"] = 2300,
["Strikethrough"] = 20000,
["String_split"] = 5400,
["Strip_tags"] = 41000,
["Strong"] = 216000,
["Structurae"] = 2100,
["Stub-Class"] = 18000,
["Stub_Category"] = 14000,
["Stub_category"] = 21000,
["Stub_documentation"] = 42000,
["Student_editor"] = 27000,
["Student_sandbox"] = 4300,
["Student_table_row"] = 7200,
["Students_table"] = 7200,
["Su"] = 4800,
["Su-census1989"] = 4600,
["Sub"] = 4600,
["Subinfobox_bodystyle"] = 75000,
["Subject_bar"] = 21000,
["Suboff"] = 7500,
["Subon"] = 7600,
["Subpage_other"] = 411000,
["Subscription_required"] = 35000,
["Subsidebar_bodystyle"] = 6400,
["Subst_only"] = 5500,
["Substituted_comment"] = 19000,
["Succession_box"] = 119000,
["Succession_box/check"] = 119000,
["Succession_links"] = 218000,
["Summer_Olympics_by_year_category_navigation"] = 2600,
["Summer_Olympics_by_year_category_navigation/core"] = 2600,
["Sunday"] = 2800,
["Sup"] = 95000,
["Suppress_categories"] = 6600,
["Surname"] = 81000,
["Swiss_metadata_Wikidata"] = 2900,
["Swiss_populations"] = 2400,
["Swiss_populations_NC"] = 3000,
["Swiss_populations_YM"] = 2300,
["Swiss_populations_ref"] = 2400,
["Switcher"] = 8500,
["Sz"] = 2500,
["Module:SDcat"] = 6820000,
["Module:SPI_archive_notice"] = 39000,
["Module:SST"] = 13000,
["Module:SST/hosts"] = 13000,
["Module:SST/registry"] = 275000,
["Module:SST/shards/sets/COLLEDGE_SHIPS_RN"] = 3000,
["Module:SST/shards/sets/TALBERT_BARRINGTON_ATLAS"] = 2100,
["Module:Science_redirect"] = 323000,
["Module:Science_redirect/conf"] = 323000,
["Module:Section_link"] = 167000,
["Module:Section_sizes"] = 5900,
["Module:See_also_if_exists"] = 95000,
["Module:Self"] = 45000,
["Module:Self/license_migration_data.json"] = 23000,
["Module:Self/styles.css"] = 45000,
["Module:Separated_entries"] = 2840000,
["Module:Series_overview"] = 10000,
["Module:Settlement_Wikidata"] = 52000,
["Module:Settlement_short_description"] = 729000,
["Module:Shortcut"] = 29000,
["Module:Shortcut/config"] = 29000,
["Module:Shortcut/styles.css"] = 29000,
["Module:Side_box"] = 1290000,
["Module:Side_box/styles.css"] = 1280000,
["Module:Sidebar"] = 435000,
["Module:Sidebar/configuration"] = 435000,
["Module:Sidebar/styles.css"] = 442000,
["Module:Sidebar_games_events"] = 43000,
["Module:Sidebar_games_events/styles.css"] = 43000,
["Module:Singles"] = 49000,
["Module:Sister_project_links"] = 22000,
["Module:Sister_project_links/bar/styles.css"] = 7300,
["Module:Sister_project_links/config"] = 22000,
["Module:Sister_project_links/styles.css"] = 14000,
["Module:Sister_project_logo"] = 1360000,
["Module:Sister_project_logo/data"] = 1360000,
["Module:Slovak_municipality"] = 3000,
["Module:Sock_list"] = 11000,
["Module:Sort"] = 156000,
["Module:Sort_title"] = 40000,
["Module:Sortkey"] = 105000,
["Module:Split_article"] = 4200,
["Module:Spoken_Wikipedia"] = 2200,
["Module:Spoken_Wikipedia/configuration"] = 2200,
["Module:Spoken_Wikipedia/styles.css"] = 2200,
["Module:Sports_career"] = 21000,
["Module:Sports_color"] = 79000,
["Module:Sports_color/baseball"] = 36000,
["Module:Sports_color/basketball"] = 19000,
["Module:Sports_color/ice_hockey"] = 3400,
["Module:Sports_color/international_football"] = 43000,
["Module:Sports_rbr_table"] = 15000,
["Module:Sports_rbr_table/styles.css"] = 15000,
["Module:Sports_reference"] = 5100,
["Module:Sports_results"] = 19000,
["Module:Sports_results/styles.css"] = 11000,
["Module:Sports_table"] = 74000,
["Module:Sports_table/Volleyball"] = 2500,
["Module:Sports_table/WDL"] = 64000,
["Module:Sports_table/WDL_OT"] = 4000,
["Module:Sports_table/WL"] = 5600,
["Module:Sports_table/WL_OT"] = 3100,
["Module:Sports_table/argcheck"] = 74000,
["Module:Sports_table/styles.css"] = 74000,
["Module:Sports_table/sub"] = 74000,
["Module:Sports_table/totalscheck"] = 53000,
["Module:Stock_tickers/NYSE"] = 2000,
["Module:Storm_categories"] = 5900,
["Module:Storm_categories/categories"] = 5900,
["Module:Storm_categories/colors"] = 5900,
["Module:Storm_categories/icons"] = 5900,
["Module:String"] = 14200000,
["Module:String2"] = 2090000,
["Module:Su"] = 14000,
["Module:Subject_bar"] = 21000,
["Module:Suppress_categories"] = 6600,
["Module:Switcher"] = 8500,
}
b1jzbel4r50rsfcdoivyfp75ikuquob
Модул:Settlement short description/doc
828
3695
21903
2022-11-11T01:42:49Z
Paine Ellsworth
2766
fix High-use template in sandbox display
21903
wikitext
text/x-wiki
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use|demo=Module:{{ROOTPAGENAME}}}}
{{Lua|Module:Arguments|Module:Plain text|Module:TableTools}}
== Usage ==
Used in [[Template:Infobox settlement]] to generate [[Wikipedia:Short description|short descriptions]].
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Modules that create a short description]]
}}</includeonly>
7btt7vp708uop4hzjgxn1jrva1equ5t
21904
21903
2026-09-18T15:13:39Z
Amire80
9
1 измена увезена из [[:en:Module:Settlement_short_description/doc]]: importing from the English Wikipedia
21903
wikitext
text/x-wiki
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use|demo=Module:{{ROOTPAGENAME}}}}
{{Lua|Module:Arguments|Module:Plain text|Module:TableTools}}
== Usage ==
Used in [[Template:Infobox settlement]] to generate [[Wikipedia:Short description|short descriptions]].
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Modules that create a short description]]
}}</includeonly>
7btt7vp708uop4hzjgxn1jrva1equ5t
Шаблон:Short description
10
3696
21905
2026-02-04T19:08:44Z
Fayenatic london
2805
edit requested on talk page by [[user:GhostInTheMachine]]
21905
wikitext
text/x-wiki
{{#ifeq:{{lc:{{{1|}}}}}|none|{{SHORTDESC:|{{{2|}}}}}<nowiki/><!--Prevents whitespace issues when used with adjacent newlines-->|<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">{{{1|}}}{{SHORTDESC:{{{1|}}}|{{{2|}}}}}</div>}}<includeonly>{{#ifeq:{{{pagetype}}}|Disambiguation pages||{{#ifeq:{{pagetype |defaultns = all |user=exclude}}|exclude||{{#ifeq:{{#switch: {{NAMESPACENUMBER}} | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 100 | 101 | 118 | 119 | 828 | 829 | = exclude|#default=}}|exclude||[[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with short description]]}}}}}}</includeonly><!-- Start tracking
-->{{#invoke:Check for unknown parameters|check|unknown={{Main other|[[Category:Pages using short description with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Short description]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | pagetype | bot |plural }}<!--
-->{{#ifexpr: {{#invoke:String|len|{{{1|}}}}}>100 | [[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with long short description]]}}<!--
--><includeonly>{{#if:{{{1|}}}||[[Category:Pages with empty short description]]}}</includeonly><!--
-->{{Short description/lowercasecheck|{{{1|}}}}}<!--
-->{{Main other |{{SDcat |sd={{{1|}}} }} }}<noinclude>
{{Documentation}}
</noinclude>
kneamzwadjt95irj9gnv7bocpjuw4uz
21906
21905
2026-09-18T15:14:49Z
Amire80
9
1 измена увезена из [[:en:Template:Short_description]]: importing from the English Wikipedia
21905
wikitext
text/x-wiki
{{#ifeq:{{lc:{{{1|}}}}}|none|{{SHORTDESC:|{{{2|}}}}}<nowiki/><!--Prevents whitespace issues when used with adjacent newlines-->|<div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">{{{1|}}}{{SHORTDESC:{{{1|}}}|{{{2|}}}}}</div>}}<includeonly>{{#ifeq:{{{pagetype}}}|Disambiguation pages||{{#ifeq:{{pagetype |defaultns = all |user=exclude}}|exclude||{{#ifeq:{{#switch: {{NAMESPACENUMBER}} | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 100 | 101 | 118 | 119 | 828 | 829 | = exclude|#default=}}|exclude||[[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with short description]]}}}}}}</includeonly><!-- Start tracking
-->{{#invoke:Check for unknown parameters|check|unknown={{Main other|[[Category:Pages using short description with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Short description]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | pagetype | bot |plural }}<!--
-->{{#ifexpr: {{#invoke:String|len|{{{1|}}}}}>100 | [[Category:{{{pagetype|{{pagetype |defaultns = extended |plural=y}}}}} with long short description]]}}<!--
--><includeonly>{{#if:{{{1|}}}||[[Category:Pages with empty short description]]}}</includeonly><!--
-->{{Short description/lowercasecheck|{{{1|}}}}}<!--
-->{{Main other |{{SDcat |sd={{{1|}}} }} }}<noinclude>
{{Documentation}}
</noinclude>
kneamzwadjt95irj9gnv7bocpjuw4uz
Шаблон:Mbox
10
3697
21907
2022-12-18T05:46:16Z
TadejM
2806
21907
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
</noinclude>
aqsrswx233se5jbjaza2b2hrk7pgx53
21908
21907
2026-09-18T15:14:49Z
Amire80
9
1 измена увезена из [[:en:Template:Mbox]]: importing from the English Wikipedia
21907
wikitext
text/x-wiki
{{#invoke:Message box|mbox}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! -->
</noinclude>
aqsrswx233se5jbjaza2b2hrk7pgx53
Шаблон:FULLROOTPAGENAME
10
3698
21909
2022-01-02T08:54:02Z
Dinoguy1000
784
fix "|=foo" bug
21909
wikitext
text/x-wiki
{{ safesubst:<noinclude/>#if: {{ safesubst:<noinclude/>Ns has subpages | {{ safesubst:<noinclude/>#if:{{{1|}}}|{{ safesubst:<noinclude/>NAMESPACE:{{{1}}}}}|{{ safesubst:<noinclude/>NAMESPACE}}}} }}
| {{ safesubst:<noinclude/>#titleparts:{{ safesubst:<noinclude/>#if:{{{1|}}}|{{{1}}}|{{ safesubst:<noinclude/>FULLPAGENAME}}}}|1}}
| {{ safesubst:<noinclude/>#if:{{{1|}}}|{{{1}}}|{{ safesubst:<noinclude/>FULLPAGENAME}}}}
}}<noinclude>
{{documentation}}
</noinclude>
tk494gglkhfogc40do2k58d4bbttx9o
21910
21909
2026-09-18T15:14:49Z
Amire80
9
1 измена увезена из [[:en:Template:FULLROOTPAGENAME]]: importing from the English Wikipedia
21909
wikitext
text/x-wiki
{{ safesubst:<noinclude/>#if: {{ safesubst:<noinclude/>Ns has subpages | {{ safesubst:<noinclude/>#if:{{{1|}}}|{{ safesubst:<noinclude/>NAMESPACE:{{{1}}}}}|{{ safesubst:<noinclude/>NAMESPACE}}}} }}
| {{ safesubst:<noinclude/>#titleparts:{{ safesubst:<noinclude/>#if:{{{1|}}}|{{{1}}}|{{ safesubst:<noinclude/>FULLPAGENAME}}}}|1}}
| {{ safesubst:<noinclude/>#if:{{{1|}}}|{{{1}}}|{{ safesubst:<noinclude/>FULLPAGENAME}}}}
}}<noinclude>
{{documentation}}
</noinclude>
tk494gglkhfogc40do2k58d4bbttx9o
Шаблон:Ns has subpages
10
3699
21911
2022-03-02T10:43:18Z
Trialpears
2807
Changed protection settings for "[[Template:Ns has subpages]]": [[WP:High-risk templates|Highly visible template]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
21911
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:Ns has subpages|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
0pg457y46td6p53rdt8tyc76jeg9pa8
21912
21911
2026-09-18T15:14:49Z
Amire80
9
1 измена увезена из [[:en:Template:Ns_has_subpages]]: importing from the English Wikipedia
21911
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:Ns has subpages|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
</noinclude>
0pg457y46td6p53rdt8tyc76jeg9pa8
Модул:Ns has subpages
828
3700
21913
2024-02-17T04:01:43Z
Pppery
88
Changed protection settings for "[[Module:Ns has subpages]]": Per template ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
21913
Scribunto
text/plain
-- This module implements [[Template:Ns has subpages]].
-- While the template is fairly simple, this information is made available to
-- Lua directly, so using a module means that we don't have to update the
-- template as new namespaces are added.
local p = {}
function p._main(ns, frame)
-- Get the current namespace if we were not passed one.
if not ns then
ns = mw.title.getCurrentTitle().namespace
end
-- Look up the namespace table from mw.site.namespaces. This should work
-- for a majority of cases.
local nsTable = mw.site.namespaces[ns]
-- Try using string matching to get the namespace from page names.
-- Do a quick and dirty bad title check to try and make sure we do the same
-- thing as {{NAMESPACE}} in most cases.
if not nsTable and type(ns) == 'string' and not ns:find('[<>|%[%]{}]') then
local nsStripped = ns:gsub('^[_%s]*:', '')
nsStripped = nsStripped:gsub(':.*$', '')
nsTable = mw.site.namespaces[nsStripped]
end
-- If we still have no match then try the {{NAMESPACE}} parser function,
-- which should catch the remainder of cases. Don't use a mw.title object,
-- as this would increment the expensive function count for each new page
-- tested.
if not nsTable then
frame = frame or mw.getCurrentFrame()
local nsProcessed = frame:callParserFunction('NAMESPACE', ns)
nsTable = nsProcessed and mw.site.namespaces[nsProcessed]
end
return nsTable and nsTable.hasSubpages
end
function p.main(frame)
local ns = frame:getParent().args[1]
if ns then
ns = ns:match('^%s*(.-)%s*$') -- trim whitespace
ns = tonumber(ns) or ns
end
local hasSubpages = p._main(ns, frame)
return hasSubpages and 'yes' or ''
end
return p
qb0b1z2vff7kifnw21v205d791esbiz
21914
21913
2026-09-18T15:14:49Z
Amire80
9
1 измена увезена из [[:en:Module:Ns_has_subpages]]: importing from the English Wikipedia
21913
Scribunto
text/plain
-- This module implements [[Template:Ns has subpages]].
-- While the template is fairly simple, this information is made available to
-- Lua directly, so using a module means that we don't have to update the
-- template as new namespaces are added.
local p = {}
function p._main(ns, frame)
-- Get the current namespace if we were not passed one.
if not ns then
ns = mw.title.getCurrentTitle().namespace
end
-- Look up the namespace table from mw.site.namespaces. This should work
-- for a majority of cases.
local nsTable = mw.site.namespaces[ns]
-- Try using string matching to get the namespace from page names.
-- Do a quick and dirty bad title check to try and make sure we do the same
-- thing as {{NAMESPACE}} in most cases.
if not nsTable and type(ns) == 'string' and not ns:find('[<>|%[%]{}]') then
local nsStripped = ns:gsub('^[_%s]*:', '')
nsStripped = nsStripped:gsub(':.*$', '')
nsTable = mw.site.namespaces[nsStripped]
end
-- If we still have no match then try the {{NAMESPACE}} parser function,
-- which should catch the remainder of cases. Don't use a mw.title object,
-- as this would increment the expensive function count for each new page
-- tested.
if not nsTable then
frame = frame or mw.getCurrentFrame()
local nsProcessed = frame:callParserFunction('NAMESPACE', ns)
nsTable = nsProcessed and mw.site.namespaces[nsProcessed]
end
return nsTable and nsTable.hasSubpages
end
function p.main(frame)
local ns = frame:getParent().args[1]
if ns then
ns = ns:match('^%s*(.-)%s*$') -- trim whitespace
ns = tonumber(ns) or ns
end
local hasSubpages = p._main(ns, frame)
return hasSubpages and 'yes' or ''
end
return p
qb0b1z2vff7kifnw21v205d791esbiz
Шаблон:Short description/lowercasecheck
10
3701
21915
2022-02-12T16:35:05Z
ToBeFree
2808
Changed protection settings for "[[Template:Short description/lowercasecheck]]": 4 million transclusions, through [[Template:Short description]] ([[WP:HRT]]) ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
21915
wikitext
text/x-wiki
{{#ifeq:<!--test first character for lower-case letter-->{{#invoke:string|find|1={{{1|}}}|2=^%l|plain=false}}|1
|<!-- first character is a lower case letter; test against whitelist
-->{{#switch: {{First word|{{{1|}}}}}<!--begin whitelist-->
|c. <!--for circa-->
|gTLD
|iMac
|iOS
|iOS,
|iPad
|iPhone
|iTunes
|macOS
|none
|pH
|pH-dependent=<!-- end whitelist; short description starts with an allowed lower-case string; whitelist matched; do nothing -->
|#default=<!-- apply category to track lower-case short descriptions -->{{main other|[[Category:Pages with lower-case short description|{{trim|{{{1|}}}}}]]}}{{Testcases other|{{red|CATEGORY APPLIED}}}}<!-- end whitelist test -->}}
|<!-- short description does not start with lower-case letter; do nothing; end lower-case test -->
}}<noinclude>
{{documentation}}
</noinclude>
i1e9w8d3rdcgxtws9nvbvfopq7y0nnk
21916
21915
2026-09-18T15:14:50Z
Amire80
9
1 измена увезена из [[:en:Template:Short_description/lowercasecheck]]: importing from the English Wikipedia
21915
wikitext
text/x-wiki
{{#ifeq:<!--test first character for lower-case letter-->{{#invoke:string|find|1={{{1|}}}|2=^%l|plain=false}}|1
|<!-- first character is a lower case letter; test against whitelist
-->{{#switch: {{First word|{{{1|}}}}}<!--begin whitelist-->
|c. <!--for circa-->
|gTLD
|iMac
|iOS
|iOS,
|iPad
|iPhone
|iTunes
|macOS
|none
|pH
|pH-dependent=<!-- end whitelist; short description starts with an allowed lower-case string; whitelist matched; do nothing -->
|#default=<!-- apply category to track lower-case short descriptions -->{{main other|[[Category:Pages with lower-case short description|{{trim|{{{1|}}}}}]]}}{{Testcases other|{{red|CATEGORY APPLIED}}}}<!-- end whitelist test -->}}
|<!-- short description does not start with lower-case letter; do nothing; end lower-case test -->
}}<noinclude>
{{documentation}}
</noinclude>
i1e9w8d3rdcgxtws9nvbvfopq7y0nnk
Шаблон:Tlx
10
3702
21917
2020-11-20T18:53:35Z
Primefac
2755
Primefac moved page [[Template:Tlx]] to [[Template:Template link expanded]] over redirect: expand name, make it more obvious
21917
wikitext
text/x-wiki
#REDIRECT [[Template:Template link expanded]]
{{Redirect category shell|
{{R from move}}
}}
3q8x11tutc2rrxvxoewmgkhc3iqdc08
21918
21917
2026-09-18T15:14:50Z
Amire80
9
1 измена увезена из [[:en:Template:Tlx]]: importing from the English Wikipedia
21917
wikitext
text/x-wiki
#REDIRECT [[Template:Template link expanded]]
{{Redirect category shell|
{{R from move}}
}}
3q8x11tutc2rrxvxoewmgkhc3iqdc08
Шаблон:Em
10
3703
21923
2020-08-09T23:17:35Z
Bsherr
2770
/* top */as found, replacing [[Template:Tld]] with [[Template:Tlc]] or adding/updating category placement comments, plus general and typo fixes
21923
wikitext
text/x-wiki
<em {{#if:{{{role|}}}|role="{{{role}}}"}} {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} {{#if:{{{title|}}}|title="{{{title}}}"}}>{{{1}}}</em><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
qihth5vbfna026aqh87kteifb1nb5ot
21924
21923
2026-09-18T15:14:50Z
Amire80
9
1 измена увезена из [[:en:Template:Em]]: importing from the English Wikipedia
21923
wikitext
text/x-wiki
<em {{#if:{{{role|}}}|role="{{{role}}}"}} {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} {{#if:{{{title|}}}|title="{{{title}}}"}}>{{{1}}}</em><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage, interwikis to Wikidata, not here -->
</noinclude>
qihth5vbfna026aqh87kteifb1nb5ot
Шаблон:Strong
10
3704
21925
2017-09-16T03:10:40Z
Matt Fitzpatrick
2809
added role parameter and attribute
21925
wikitext
text/x-wiki
<strong {{#if:{{{role|}}}|role="{{{role}}}"}} {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} {{#if:{{{title|}}}|title="{{{title}}}"}}>{{{1}}}</strong><noinclude>
{{documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
jhbv1h6fd9kjc1d4eovhzvnxrpqq09r
21926
21925
2026-09-18T15:14:50Z
Amire80
9
1 измена увезена из [[:en:Template:Strong]]: importing from the English Wikipedia
21925
wikitext
text/x-wiki
<strong {{#if:{{{role|}}}|role="{{{role}}}"}} {{#if:{{{class|}}}|class="{{{class}}}"}} {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} {{#if:{{{title|}}}|title="{{{title}}}"}}>{{{1}}}</strong><noinclude>
{{documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
jhbv1h6fd9kjc1d4eovhzvnxrpqq09r
Шаблон:Crossref
10
3705
21927
2017-10-09T12:24:30Z
Xezbeth
2810
Protected "[[Template:Crossref]]": [[Wikipedia:High-risk templates|Highly visible]] template redirect ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
21927
wikitext
text/x-wiki
#REDIRECT [[Template:Crossreference]]
{{Rcat shell|
{{R from template shortcut}}
}}
pq7z0nmw7a74xqvemqbunajs03rcg15
21928
21927
2026-09-18T15:14:51Z
Amire80
9
1 измена увезена из [[:en:Template:Crossref]]: importing from the English Wikipedia
21927
wikitext
text/x-wiki
#REDIRECT [[Template:Crossreference]]
{{Rcat shell|
{{R from template shortcut}}
}}
pq7z0nmw7a74xqvemqbunajs03rcg15
Шаблон:Crossreference
10
3706
21929
2023-12-19T21:40:27Z
SMcCandlish
2811
shorthand param
21929
wikitext
text/x-wiki
<templatestyles src="Crossreference/styles.css" />{{Hatnote inline
|1={{{1|{{{text|{{{content|<noinclude>sample content</noinclude>}}}}}}}}}
|extraclasses=crossreference {{{class|{{{extraclasses|}}}}}}
|selfref={{#if:{{{selfref|{{{printworthy|{{{unprintworthy|{{{pw|}}}}}}}}}}}}||yes}}
|inline={{{inline|true}}}
}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
ho663c75ic1fu9q2smav2x9kahcjcza
21930
21929
2026-09-18T15:14:51Z
Amire80
9
1 измена увезена из [[:en:Template:Crossreference]]: importing from the English Wikipedia
21929
wikitext
text/x-wiki
<templatestyles src="Crossreference/styles.css" />{{Hatnote inline
|1={{{1|{{{text|{{{content|<noinclude>sample content</noinclude>}}}}}}}}}
|extraclasses=crossreference {{{class|{{{extraclasses|}}}}}}
|selfref={{#if:{{{selfref|{{{printworthy|{{{unprintworthy|{{{pw|}}}}}}}}}}}}||yes}}
|inline={{{inline|true}}}
}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
ho663c75ic1fu9q2smav2x9kahcjcza
Шаблон:Crossreference/styles.css
10
3707
21931
2021-07-12T06:50:43Z
SMcCandlish
2811
Nope, that had no effect at all.
21931
sanitized-css
text/css
/* {{pp-template}} */
/* This snippet just undoes the default "padding-left: 1.6em;" imposed by
div.hatnote, when Template:Crossreference is used in block (div) mode.
Ignore the dumb CSS editor's "Element (div.crossreference) is overqualified"
warning. It is wrong. We do not want to apply any CSS intended for block
mode when it is not in block mode. While it's unlikely our "padding-left: 0;"
does anything wrong in inline (span) mode, we can't guarantee it forever. */
div.crossreference {
padding-left: 0;
}
kddwe1vcst9bvvucx3arwpa9ji2yirb
21932
21931
2026-09-18T15:14:51Z
Amire80
9
1 измена увезена из [[:en:Template:Crossreference/styles.css]]: importing from the English Wikipedia
21931
sanitized-css
text/css
/* {{pp-template}} */
/* This snippet just undoes the default "padding-left: 1.6em;" imposed by
div.hatnote, when Template:Crossreference is used in block (div) mode.
Ignore the dumb CSS editor's "Element (div.crossreference) is overqualified"
warning. It is wrong. We do not want to apply any CSS intended for block
mode when it is not in block mode. While it's unlikely our "padding-left: 0;"
does anything wrong in inline (span) mode, we can't guarantee it forever. */
div.crossreference {
padding-left: 0;
}
kddwe1vcst9bvvucx3arwpa9ji2yirb
Шаблон:Hatnote inline
10
3708
21933
2023-12-21T20:47:46Z
Ahecht
2748
Directly invoke [[Module:Hatnote inline]] to reduce [[WP:PEIS]]
21933
wikitext
text/x-wiki
{{#invoke:Hatnote inline|hatnoteInline
|1={{{1|{{{text|{{{content}}}}}}}}}
|extraclasses={{{class|{{{extraclasses|}}}}}}
|selfref={{#if:{{{printworthy|{{{selfref|}}}}}}||yes}}
|category={{{category|}}}
|inline={{{inline|true}}}
}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
60twimipmlv9hqvxiolnamlh9ovhgmb
21934
21933
2026-09-18T15:14:51Z
Amire80
9
1 измена увезена из [[:en:Template:Hatnote_inline]]: importing from the English Wikipedia
21933
wikitext
text/x-wiki
{{#invoke:Hatnote inline|hatnoteInline
|1={{{1|{{{text|{{{content}}}}}}}}}
|extraclasses={{{class|{{{extraclasses|}}}}}}
|selfref={{#if:{{{printworthy|{{{selfref|}}}}}}||yes}}
|category={{{category|}}}
|inline={{{inline|true}}}
}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
60twimipmlv9hqvxiolnamlh9ovhgmb
Модул:Hatnote inline
828
3709
21935
2023-12-21T20:46:48Z
Ahecht
2748
frame:newChild{title="Module:Hatnote inline", args = args}
21935
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote-inline --
-- --
-- This module produces hatnote-style links, and links to related articles, --
-- but inside a <span>, instead of the <div> used by Module:Hatnote. It --
-- implements the {{hatnote-inline}} meta-template. --
--------------------------------------------------------------------------------
local mHatnote = require('Module:Hatnote')
local mArguments = require('Module:Arguments')
local yesno = require('Module:Yesno')
local p = {}
function p.hatnoteInline (frame)
local args = mArguments.getArgs(frame)
local hatnote = mHatnote.hatnote(frame:newChild{title="Module:Hatnote inline", args = args})
if args.inline == nil or yesno(args.inline, true) then
local subs = {
['<div'] = '<span',
['</div>$'] = '</span>'
}
for k, v in pairs(subs) do hatnote = string.gsub(hatnote, k, v, 1) end
end
return hatnote
end
p.hatnote = p.hatnoteInline --alias
return p
p7yh41tydxeqcjqyxr61ov9598ekdz3
21936
21935
2026-09-18T15:14:51Z
Amire80
9
1 измена увезена из [[:en:Module:Hatnote_inline]]: importing from the English Wikipedia
21935
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Hatnote-inline --
-- --
-- This module produces hatnote-style links, and links to related articles, --
-- but inside a <span>, instead of the <div> used by Module:Hatnote. It --
-- implements the {{hatnote-inline}} meta-template. --
--------------------------------------------------------------------------------
local mHatnote = require('Module:Hatnote')
local mArguments = require('Module:Arguments')
local yesno = require('Module:Yesno')
local p = {}
function p.hatnoteInline (frame)
local args = mArguments.getArgs(frame)
local hatnote = mHatnote.hatnote(frame:newChild{title="Module:Hatnote inline", args = args})
if args.inline == nil or yesno(args.inline, true) then
local subs = {
['<div'] = '<span',
['</div>$'] = '</span>'
}
for k, v in pairs(subs) do hatnote = string.gsub(hatnote, k, v, 1) end
end
return hatnote
end
p.hatnote = p.hatnoteInline --alias
return p
p7yh41tydxeqcjqyxr61ov9598ekdz3
Шаблон:Q
10
3710
21937
2025-08-30T11:34:00Z
Paine Ellsworth
2766
per edit request on talk page - add [[WP:RCAT|rcat template]]
21937
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata entity link]]
{{Redirect category shell|
{{R from move}}
{{R mentioned in hatnote}}
{{R from template shortcut}}
}}
[[Category:Wikidata templates]]
pjowgct37yrpgryiaw2acnzw8auqr5w
21938
21937
2026-09-18T15:14:51Z
Amire80
9
1 измена увезена из [[:en:Template:Q]]: importing from the English Wikipedia
21937
wikitext
text/x-wiki
#REDIRECT [[Template:Wikidata entity link]]
{{Redirect category shell|
{{R from move}}
{{R mentioned in hatnote}}
{{R from template shortcut}}
}}
[[Category:Wikidata templates]]
pjowgct37yrpgryiaw2acnzw8auqr5w
Шаблон:Category link
10
3711
21939
2026-03-28T17:08:14Z
HouseBlaster
38
handle different namespace prefixes correctly
21939
wikitext
text/x-wiki
{{Category link/core|1={{#ifeq:{{NAMESPACE:{{{1}}} }}|Category|{{PAGENAME:{{{1}}} }}|{{{1}}} }}|2={{{2|Category:{{#ifeq:{{NAMESPACE:{{{1}}} }}|Category|{{PAGENAME:{{{1}}} }}|{{{1}}} }}}}}|count={{{count|no}}}|page_count={{PAGESINCAT:{{PAGENAME:{{{1}}}}}|{{UC:{{{count_type|ALL}}}}}|R}}|backlog={{{backlog|{{formatnum:{{NUMBEROFPAGES}}|R}}}}}}}<noinclude>
{{Documentation}}
</noinclude>
shagm99jmb6xamiwd9dlpct8cch8cvp
21940
21939
2026-09-18T15:14:51Z
Amire80
9
1 измена увезена из [[:en:Template:Category_link]]: importing from the English Wikipedia
21939
wikitext
text/x-wiki
{{Category link/core|1={{#ifeq:{{NAMESPACE:{{{1}}} }}|Category|{{PAGENAME:{{{1}}} }}|{{{1}}} }}|2={{{2|Category:{{#ifeq:{{NAMESPACE:{{{1}}} }}|Category|{{PAGENAME:{{{1}}} }}|{{{1}}} }}}}}|count={{{count|no}}}|page_count={{PAGESINCAT:{{PAGENAME:{{{1}}}}}|{{UC:{{{count_type|ALL}}}}}|R}}|backlog={{{backlog|{{formatnum:{{NUMBEROFPAGES}}|R}}}}}}}<noinclude>
{{Documentation}}
</noinclude>
shagm99jmb6xamiwd9dlpct8cch8cvp
Шаблон:Cl
10
3712
21941
2019-04-24T04:30:48Z
JJMC89
2754
actual template is in the category
21941
wikitext
text/x-wiki
#REDIRECT [[Template:Category link]]
{{R from move}}
sxb6uqb5pxx7i9ck11lxcop05gxni7w
21942
21941
2026-09-18T15:14:51Z
Amire80
9
1 измена увезена из [[:en:Template:Cl]]: importing from the English Wikipedia
21941
wikitext
text/x-wiki
#REDIRECT [[Template:Category link]]
{{R from move}}
sxb6uqb5pxx7i9ck11lxcop05gxni7w
Шаблон:Em dash
10
3713
21943
2017-07-25T12:32:42Z
WOSlinker
2753
21943
wikitext
text/x-wiki
—<noinclude>{{Documentation}}</noinclude>
23joqzm2jd36f43xgqngjduru7rp4ip
21944
21943
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:Em_dash]]: importing from the English Wikipedia
21943
wikitext
text/x-wiki
—<noinclude>{{Documentation}}</noinclude>
23joqzm2jd36f43xgqngjduru7rp4ip
Шаблон:Warning
10
3714
21945
2026-01-08T01:42:46Z
HouseBlaster
38
+{{[[TM:Editnotice EXPECTUNUSEDTEMPLATE|Editnotice EXPECTUNUSEDTEMPLATE]]}}
21945
wikitext
text/x-wiki
{{Mbox
| name = Warning
| demospace = {{{demospace|}}}
| style = {{#if:{{{style|}}} |{{{style}}} }}
| subst = <includeonly>{{subst:substcheck}}</includeonly>
| type = content
| image = {{#if:{{{image|}}}| [[File:{{{image}}}|{{{imagesize|40px}}}|Warning]] }}
| small = {{{small|}}}
| smallimage = {{#if:{{{image|}}}| [[File:{{{image}}}|30px|Warning]]}}
| imageright = {{#if:{{{imageright|}}} |{{{imageright}}} |{{#if:{{{shortcut|{{{shortcut1|}}}}}} |{{Ombox/shortcut|{{{shortcut|{{{shortcut1|}}}}}}|{{{shortcut2|}}}|{{{shortcut3|}}}|{{{shortcut4|}}}|{{{shortcut5|}}}}}}} }}
| textstyle = {{{textstyle|text-align: {{#if:{{{center|}}}|center|{{{align|left}}}}};}}}
| text = {{#if:{{{header|{{{heading|{{{title|}}}}}}}}} |<div style="{{{headstyle|text-align: {{#if:{{{center|}}}|center|left}};}}}">'''{{{header|{{{heading|{{{title|}}}}}}}}}'''</div>}}<!--
-->{{{text|{{{content|{{{reason|{{{1}}}}}}}}}}}}
}}{{Editnotice EXPECTUNUSEDTEMPLATE}}<noinclude>
<!-- Add categories to the /doc subpage; interwikis go to Wikidata. -->
{{Documentation}}
</noinclude>
qlfgcdm78oom27fkyum3vvodkp2mpjk
21946
21945
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:Warning]]: importing from the English Wikipedia
21945
wikitext
text/x-wiki
{{Mbox
| name = Warning
| demospace = {{{demospace|}}}
| style = {{#if:{{{style|}}} |{{{style}}} }}
| subst = <includeonly>{{subst:substcheck}}</includeonly>
| type = content
| image = {{#if:{{{image|}}}| [[File:{{{image}}}|{{{imagesize|40px}}}|Warning]] }}
| small = {{{small|}}}
| smallimage = {{#if:{{{image|}}}| [[File:{{{image}}}|30px|Warning]]}}
| imageright = {{#if:{{{imageright|}}} |{{{imageright}}} |{{#if:{{{shortcut|{{{shortcut1|}}}}}} |{{Ombox/shortcut|{{{shortcut|{{{shortcut1|}}}}}}|{{{shortcut2|}}}|{{{shortcut3|}}}|{{{shortcut4|}}}|{{{shortcut5|}}}}}}} }}
| textstyle = {{{textstyle|text-align: {{#if:{{{center|}}}|center|{{{align|left}}}}};}}}
| text = {{#if:{{{header|{{{heading|{{{title|}}}}}}}}} |<div style="{{{headstyle|text-align: {{#if:{{{center|}}}|center|left}};}}}">'''{{{header|{{{heading|{{{title|}}}}}}}}}'''</div>}}<!--
-->{{{text|{{{content|{{{reason|{{{1}}}}}}}}}}}}
}}{{Editnotice EXPECTUNUSEDTEMPLATE}}<noinclude>
<!-- Add categories to the /doc subpage; interwikis go to Wikidata. -->
{{Documentation}}
</noinclude>
qlfgcdm78oom27fkyum3vvodkp2mpjk
Шаблон:--
10
3715
21947
2016-10-21T12:17:19Z
Alexiaya
2812
Added [[WP:RCAT|rcat]]
21947
wikitext
text/x-wiki
#REDIRECT [[Template:Em dash]]
{{Redirect category shell|
{{R from move}}
{{R from template shortcut}}
}}
l9yjx74q2pdl354h2y9hs7ru5q5henk
21948
21947
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:--]]: importing from the English Wikipedia
21947
wikitext
text/x-wiki
#REDIRECT [[Template:Em dash]]
{{Redirect category shell|
{{R from move}}
{{R from template shortcut}}
}}
l9yjx74q2pdl354h2y9hs7ru5q5henk
Шаблон:Template link code
10
3716
21949
2020-11-21T12:06:22Z
Primefac
2755
update
21949
wikitext
text/x-wiki
<includeonly>{{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}}</includeonly><noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlc}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
0i49ncdivj3996big2nh593ty7aspr8
21950
21949
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:Template_link_code]]: importing from the English Wikipedia
21949
wikitext
text/x-wiki
<includeonly>{{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}}</includeonly><noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tlc}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
0i49ncdivj3996big2nh593ty7aspr8
Шаблон:Tnull
10
3717
21951
2020-11-20T18:16:50Z
Primefac
2755
Primefac moved page [[Template:Tnull]] to [[Template:Template link null]]: more obvious template name to match family
21951
wikitext
text/x-wiki
#REDIRECT [[Template:Template link null]]
{{Redirect category shell|
{{R from move}}
}}
kt9s20clzg7m0tnu0exwyoibis3zf5q
21952
21951
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:Tnull]]: importing from the English Wikipedia
21951
wikitext
text/x-wiki
#REDIRECT [[Template:Template link null]]
{{Redirect category shell|
{{R from move}}
}}
kt9s20clzg7m0tnu0exwyoibis3zf5q
Шаблон:Template link null
10
3718
21953
2020-11-21T12:06:41Z
Primefac
2755
update
21953
wikitext
text/x-wiki
<includeonly>{{#Invoke:Template link general|main|nolink=yes|code=yes}}</includeonly><noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tnull}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
3wh5704zk7xm5kpqgoz7ybfwwx3479n
21954
21953
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:Template_link_null]]: importing from the English Wikipedia
21953
wikitext
text/x-wiki
<includeonly>{{#Invoke:Template link general|main|nolink=yes|code=yes}}</includeonly><noinclude>
{{Documentation|1=Template:Tlg/doc
|content = {{tlg/doc|tnull}}
}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>
3wh5704zk7xm5kpqgoz7ybfwwx3479n
Шаблон:Tld
10
3719
21955
2020-11-20T18:52:18Z
Primefac
2755
avoid redir
21955
wikitext
text/x-wiki
#REDIRECT [[Template:Template link code]]
m8isvw3phvjr9rfkupy4uef5yqajks7
21956
21955
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:Tld]]: importing from the English Wikipedia
21955
wikitext
text/x-wiki
#REDIRECT [[Template:Template link code]]
m8isvw3phvjr9rfkupy4uef5yqajks7
Шаблон:Param
10
3720
21957
2026-04-12T13:41:20Z
FaviFake
2813
FaviFake moved page [[Template:Param]] to [[Template:Source parameter]]: "Param" is ambiguous and not immediately clear, especially when compared to [[TM:Para]]. "Source parameter" is explicit, distinct from the other template name, and aligns with standard technical terminology, making it easier to understand and use correctly.
21957
wikitext
text/x-wiki
#REDIRECT [[Template:Source parameter]]
{{Redirect category shell|
{{R from move}}
}}
nvhj3e84i8mvgqpd4vp6kgc68uo6d0e
21958
21957
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:Param]]: importing from the English Wikipedia
21957
wikitext
text/x-wiki
#REDIRECT [[Template:Source parameter]]
{{Redirect category shell|
{{R from move}}
}}
nvhj3e84i8mvgqpd4vp6kgc68uo6d0e
Шаблон:Cascade-protected template
10
3721
21959
2026-01-15T13:09:33Z
Anomie
2795
Undid 3 revisions from [[Special:Diff/1330133841|1330133841]] until [[Special:Diff/1331352231|1331352231]] - Revert recent inaccurate edits and excess verbosity. Most templates are not directly cascade-protected, only transcluded into cascade-protected pages, because direct cascade-protection will have unwanted side effects.
21959
wikitext
text/x-wiki
{{mbox
| type = protection
| image = [[File:Cascade-protection-shackle.svg|40x40px|link=|alt=]]
| text = This {{{page|template}}} can only be edited by [[Wikipedia:Administrators|administrators]] because it is [[Help:Transclusion|transcluded]] onto one or more [[Wikipedia:Protection policy#Cascading protection|cascade-protected]] pages.
}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->
</noinclude>
mr3z6jtx488tvpg265fnq0gt90c2811
21960
21959
2026-09-18T15:14:52Z
Amire80
9
1 измена увезена из [[:en:Template:Cascade-protected_template]]: importing from the English Wikipedia
21959
wikitext
text/x-wiki
{{mbox
| type = protection
| image = [[File:Cascade-protection-shackle.svg|40x40px|link=|alt=]]
| text = This {{{page|template}}} can only be edited by [[Wikipedia:Administrators|administrators]] because it is [[Help:Transclusion|transcluded]] onto one or more [[Wikipedia:Protection policy#Cascading protection|cascade-protected]] pages.
}}<noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! -->
</noinclude>
mr3z6jtx488tvpg265fnq0gt90c2811
Шаблон:Nowiki2
10
3722
21961
2025-07-30T02:19:23Z
Uzume
1174
"LuaCall"->"Lua call"
21961
wikitext
text/x-wiki
{{#if: {{{tag|}}}
| {{#if: {{{style|}}}
| <{{{tag}}} style="{{{style}}}">
| <{{{tag}}}>
}}
}}{{#invoke:Lua call | call | mw.text.nowiki |\{{{1|}}}<!-- -->}}{{#if: {{{tag|}}}
| </{{{tag}}}>
}}<noinclude>
{{Documentation}}
</noinclude>
pa4iwca3w1pq12cjb7ahi764mh5qg5a
21962
21961
2026-09-18T15:14:53Z
Amire80
9
1 измена увезена из [[:en:Template:Nowiki2]]: importing from the English Wikipedia
21961
wikitext
text/x-wiki
{{#if: {{{tag|}}}
| {{#if: {{{style|}}}
| <{{{tag}}} style="{{{style}}}">
| <{{{tag}}}>
}}
}}{{#invoke:Lua call | call | mw.text.nowiki |\{{{1|}}}<!-- -->}}{{#if: {{{tag|}}}
| </{{{tag}}}>
}}<noinclude>
{{Documentation}}
</noinclude>
pa4iwca3w1pq12cjb7ahi764mh5qg5a
Шаблон:High risk
10
3723
21963
2021-01-19T20:55:25Z
Elli
2814
Added {{[[:Template:R avoided double redirect|R avoided double redirect]]}} tag to redirect
21963
wikitext
text/x-wiki
#REDIRECT [[Template:High-use]]
{{Redirect category shell|
{{R avoided double redirect|1=Template:High-risk}}
{{R from alternative hyphenation|'''{{-r|Template:High-risk}}'''}}{{R from template shortcut}}
}}
o2nnf6h6ihhns1175l4i91aui0dkvns
21964
21963
2026-09-18T15:14:53Z
Amire80
9
1 измена увезена из [[:en:Template:High_risk]]: importing from the English Wikipedia
21963
wikitext
text/x-wiki
#REDIRECT [[Template:High-use]]
{{Redirect category shell|
{{R avoided double redirect|1=Template:High-risk}}
{{R from alternative hyphenation|'''{{-r|Template:High-risk}}'''}}{{R from template shortcut}}
}}
o2nnf6h6ihhns1175l4i91aui0dkvns
Шаблон:Short description/test
10
3724
21965
2026-08-21T01:27:15Z
HMSLavender
2815
Reverted edits by [[Special:Contributions/~2026-45616-97|~2026-45616-97]] ([[User talk:~2026-45616-97|talk]]): vandalism ([[WP:AntiVandal|AV]])
21965
wikitext
text/x-wiki
<span class="shortdescription nomobile noexcerpt noprint">{{nowiki2|1={{#invoke:WikidataIB|getDescription|{{{1|}}}|qid={{{qid|}}}}}}}</span><noinclude>
{{documentation}}</noinclude>
fw3wk9ljkigbklyqi6a53yoybj28jge
21966
21965
2026-09-18T15:14:53Z
Amire80
9
1 измена увезена из [[:en:Template:Short_description/test]]: importing from the English Wikipedia
21965
wikitext
text/x-wiki
<span class="shortdescription nomobile noexcerpt noprint">{{nowiki2|1={{#invoke:WikidataIB|getDescription|{{{1|}}}|qid={{{qid|}}}}}}}</span><noinclude>
{{documentation}}</noinclude>
fw3wk9ljkigbklyqi6a53yoybj28jge
Шаблон:Short description/doc
10
3725
21967
2026-06-10T08:43:18Z
GhostInTheMachine
2816
/* Redirects */ Shortcut now targets the WP article
21967
wikitext
text/x-wiki
<noinclude>
{{pp|small=yes}}
</noinclude>
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High risk}}
{{cascade-protected template}}
{{Warning|{{strong|Please do not use redirects or shortcuts for this template}}, as they cause problems with the [[Wikipedia:Shortdesc helper|short description editing gadget]] and other maintenance tools.}}
{{Lua|Module:Check for unknown parameters|Module:String|Module:SDcat}}
'''[[Template:Short description]]''' is used to add a [[Wikipedia:Short description|short description]] (which can be edited from within Wikipedia) to a Wikipedia page. These descriptions may appear in Wikipedia searches and elsewhere, and [[WP:SDPURPOSE|help users identify the desired article]].
== Usage ==
{{tld|Short description|''Write your short description here''}}
This should be limited to about 40 characters, as explained at [[WP:SDFORMAT]], along with the other guidance at [[WP:SDCONTENT]].
If the page's title is sufficiently descriptive that a [[WP:SDNONE|short description is not needed]], use the following:
{{tld|Short description|none}}
== Parameters ==
{{TemplateData header|noheader=1}}
<templatedata>
{
"description": {
"en": "Creates a short description for a Wikipedia page, which is displayed in search results and other locations.",
"es": "Crea una breve descripción, para un artículo de Wikipedia, que se utiliza en el Editor Visual para proporcionar contexto en los wikilinks (wikienlaces)."
},
"params": {
"1": {
"label": {
"en": "Description",
"es": "Descripción"
},
"description": {
"en": "The short description of the article or 'none'. It should be limited to about 40 characters.",
"es": "La descripción corta del artículo"
},
"example": {
"en": "Endangered species of South American fish",
"es": "La enciclopedia en línea que cualquiera puede editar"
},
"required": true,
"type": "content"
},
"2": {
"label": {
"en": "No replace?",
"es": "2"
},
"description": {
"en": "Should be unused or 'noreplace'. Templates with noreplace will not replace a short description defined by an earlier template. Mainly for use within transcluded templates.",
"es": "Se anula una descripción corta si se transcluye. Debe estar sin usar o con 'noreplace' (que significar no reemplazar)."
},
"example": {
"es": "noreplace"
},
"required": false,
"type": "string",
"autovalue": "noreplace",
"suggestedvalues": [
"noreplace"
]
},
"pagetype": {
"type": "string",
"description": {
"en": "The type of page. This puts it in the appropriate category - Things with short description. Normally unneeded, since handled through namespace detection.",
"es": "El tipo de página. La coloca en la categoría apropiada - Cosas con descripción corta"
},
"example": "Redirect, Disambiguation page",
"required": false
}
},
"format": "{{_|_ = _}}\n"
}
</templatedata>
== About writing good short descriptions ==
This page is about the short description {{em|template}}; it does not provide guidelines for writing a good short description. If you plan to use this template, you should make sure you read and follow the detailed guidance at [[WP:HOWTOSD]]. General information can be found at [[Wikipedia:Short description]].
== Template information ==
Eventually all articles should have a short description:
* by directly using this template, in which case the short description will be unique to the article
* transcluded in another template, such as a disambiguation template, where a generic short description is adequate for a large class of pages
* where the short description is assembled from data in an infobox
Automatically generated descriptions within templates should set the second parameter as {{code|noreplace}} so they do not override any short descriptions specifically added to the transcluding article.
Short descriptions are not normally needed for non-article pages, such as redirects, but can be added if useful.
If the article title alone is sufficient to ensure reliable identification of the desired article, a null value of {{tnull|Short description|none}} may be used.
Short descriptions do not necessarily serve the same function as the Wikidata description for an item and they do not have to be the same, but some overlap is expected in many cases. Some Wikidata descriptions may be unsuitable, and if imported must be checked for relevance, accuracy and fitness for purpose. Responsibility for such imports lies with the importer. {{crossref|(See also [[d:Help:Description|Wikidata:Help:Description]].)}}
=== Example ===
At [[Oxygen therapy]], add the following at the very top of the article, above everything else:
* {{tld|Short description|Use of oxygen as medical treatment}}
== Testing ==
For testing purposes, the display of this template can be enabled by adding a line to your [[Special:MyPage/common.css]]:
* <syntaxhighlight lang="CSS" inline>.shortdescription { display:block !important; }</syntaxhighlight>
This can be easily removed or disabled when testing is finished.
If you want to {{em|always}} see short descriptions, you may prefer a more utilitarian layout, such as:
<syntaxhighlight lang="CSS">
.shortdescription {
display:block !important;
white-space: pre-wrap;
}
.shortdescription::before {
content: "\A[Short description:\0020";
}
.shortdescription::after {
content: "]\A";
}
</syntaxhighlight>
There is a test version of this template available as [[Template:Short description/test]] which displays its text by default.
* {{tld|Short description/test}} displays the short description if supplied
* {{tld|Short description/test}} displays nothing if <code>none</code> is supplied
* {{tld|Short description/test}} displays the description from Wikidata if <code>wikidata</code> is supplied.
Taking {{Q|Q1096878}} as an example:
* <code><nowiki>{{short description/test|Underwater diving where breathing is from equipment independent of the surface}}</nowiki></code> → {{short description/test|Underwater diving where breathing is from equipment independent of the surface }}
* <code><nowiki>{{short description/test|none}}</nowiki></code> → {{short description/test|none}}
* <code><nowiki>{{short description/test|wikidata}}</nowiki></code> → {{short description/test|wikidata|qid=Q1096878}}
===Pagetype parameter===
If {{param|Pagetype}} is '''not''' set, then this template adds the article to a category based on the namespace:
* {{clc|Articles with short description}}
* {{clc|Redirects with short description}} {{--}} for redirects in any namespace
If {{param|Pagetype}} '''is''' set, then this template adds the article to a category matching the parameter. For example:
* {{cl|Redirects with short description}} {{--}} {{code|pagetype {{=}} Redirect }}
== <span class="anchor" id="Aliases"></span><span class="anchor" id="No-aliases"></span>Redirects ==
While there are currently <span class="plainlinks">[{{fullurl:Special:WhatLinksHere/Template:Short_description|hidetrans=1&hidelinks=1&limit=500}} redirects to this template]</span>, {{Strong|they must not be used}}, for the reasons below:
* Other templates and gadgets attempt to extract short descriptions from pages by explicitly searching for the {{tl|Short description}} template.
* For example, {{tl|Annotated link}} searches for the template in its uppercase "Short description" and lowercase form "short description"; either form is acceptable.
* Infoboxes often check the article for an existing short description template before setting thier own short description.
See the related [[Wikipedia:Redirects for discussion/Log/2021 July 20#Aliases for Short description template|2021 RfD]].
{{Strong|Do not}} start the template with a space: {{code|<nowiki> {{ Short description...</nowiki>}} or use an underscore: {{code|<nowiki> {{Short_description...</nowiki>}}. While these do create a valid short description, they will prevent searches for the {{code|<nowiki>{{Short description...</nowiki>}} text.
==Tracking categories==
* {{clc|Templates that generate short descriptions}}
* {{clc|Modules that create a short description}}
* {{clc|Short description matches Wikidata}}
* {{clc|Short description is different from Wikidata}}
* {{clc|Short description with empty Wikidata description}}
== Maintenance categories ==
* {{clc|Pages using short description with unknown parameters}}
* {{clc|Articles with long short description}}
* {{clc|Pages with lower-case short description}}
== See also ==
* {{tlx|Auto short description}}
* {{tlx|Annotated link}}
* {{tlx|laal}} – displays an article's pagelinks alongside its short description
* [[Module:Is infobox in lead]]
* [[Wikipedia:Short descriptions]] – background information
* [[Wikipedia:WikiProject Short descriptions]] – project to add Short descriptions to all articles
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Short description templates]]
[[Category:Templates that add a tracking category]]
[[Category:Templates that generate short descriptions]]
}}</includeonly>
q0wsv8zocauyqgghxvjy5bahuxqtfpz
21968
21967
2026-09-18T15:14:53Z
Amire80
9
1 измена увезена из [[:en:Template:Short_description/doc]]: importing from the English Wikipedia
21967
wikitext
text/x-wiki
<noinclude>
{{pp|small=yes}}
</noinclude>
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High risk}}
{{cascade-protected template}}
{{Warning|{{strong|Please do not use redirects or shortcuts for this template}}, as they cause problems with the [[Wikipedia:Shortdesc helper|short description editing gadget]] and other maintenance tools.}}
{{Lua|Module:Check for unknown parameters|Module:String|Module:SDcat}}
'''[[Template:Short description]]''' is used to add a [[Wikipedia:Short description|short description]] (which can be edited from within Wikipedia) to a Wikipedia page. These descriptions may appear in Wikipedia searches and elsewhere, and [[WP:SDPURPOSE|help users identify the desired article]].
== Usage ==
{{tld|Short description|''Write your short description here''}}
This should be limited to about 40 characters, as explained at [[WP:SDFORMAT]], along with the other guidance at [[WP:SDCONTENT]].
If the page's title is sufficiently descriptive that a [[WP:SDNONE|short description is not needed]], use the following:
{{tld|Short description|none}}
== Parameters ==
{{TemplateData header|noheader=1}}
<templatedata>
{
"description": {
"en": "Creates a short description for a Wikipedia page, which is displayed in search results and other locations.",
"es": "Crea una breve descripción, para un artículo de Wikipedia, que se utiliza en el Editor Visual para proporcionar contexto en los wikilinks (wikienlaces)."
},
"params": {
"1": {
"label": {
"en": "Description",
"es": "Descripción"
},
"description": {
"en": "The short description of the article or 'none'. It should be limited to about 40 characters.",
"es": "La descripción corta del artículo"
},
"example": {
"en": "Endangered species of South American fish",
"es": "La enciclopedia en línea que cualquiera puede editar"
},
"required": true,
"type": "content"
},
"2": {
"label": {
"en": "No replace?",
"es": "2"
},
"description": {
"en": "Should be unused or 'noreplace'. Templates with noreplace will not replace a short description defined by an earlier template. Mainly for use within transcluded templates.",
"es": "Se anula una descripción corta si se transcluye. Debe estar sin usar o con 'noreplace' (que significar no reemplazar)."
},
"example": {
"es": "noreplace"
},
"required": false,
"type": "string",
"autovalue": "noreplace",
"suggestedvalues": [
"noreplace"
]
},
"pagetype": {
"type": "string",
"description": {
"en": "The type of page. This puts it in the appropriate category - Things with short description. Normally unneeded, since handled through namespace detection.",
"es": "El tipo de página. La coloca en la categoría apropiada - Cosas con descripción corta"
},
"example": "Redirect, Disambiguation page",
"required": false
}
},
"format": "{{_|_ = _}}\n"
}
</templatedata>
== About writing good short descriptions ==
This page is about the short description {{em|template}}; it does not provide guidelines for writing a good short description. If you plan to use this template, you should make sure you read and follow the detailed guidance at [[WP:HOWTOSD]]. General information can be found at [[Wikipedia:Short description]].
== Template information ==
Eventually all articles should have a short description:
* by directly using this template, in which case the short description will be unique to the article
* transcluded in another template, such as a disambiguation template, where a generic short description is adequate for a large class of pages
* where the short description is assembled from data in an infobox
Automatically generated descriptions within templates should set the second parameter as {{code|noreplace}} so they do not override any short descriptions specifically added to the transcluding article.
Short descriptions are not normally needed for non-article pages, such as redirects, but can be added if useful.
If the article title alone is sufficient to ensure reliable identification of the desired article, a null value of {{tnull|Short description|none}} may be used.
Short descriptions do not necessarily serve the same function as the Wikidata description for an item and they do not have to be the same, but some overlap is expected in many cases. Some Wikidata descriptions may be unsuitable, and if imported must be checked for relevance, accuracy and fitness for purpose. Responsibility for such imports lies with the importer. {{crossref|(See also [[d:Help:Description|Wikidata:Help:Description]].)}}
=== Example ===
At [[Oxygen therapy]], add the following at the very top of the article, above everything else:
* {{tld|Short description|Use of oxygen as medical treatment}}
== Testing ==
For testing purposes, the display of this template can be enabled by adding a line to your [[Special:MyPage/common.css]]:
* <syntaxhighlight lang="CSS" inline>.shortdescription { display:block !important; }</syntaxhighlight>
This can be easily removed or disabled when testing is finished.
If you want to {{em|always}} see short descriptions, you may prefer a more utilitarian layout, such as:
<syntaxhighlight lang="CSS">
.shortdescription {
display:block !important;
white-space: pre-wrap;
}
.shortdescription::before {
content: "\A[Short description:\0020";
}
.shortdescription::after {
content: "]\A";
}
</syntaxhighlight>
There is a test version of this template available as [[Template:Short description/test]] which displays its text by default.
* {{tld|Short description/test}} displays the short description if supplied
* {{tld|Short description/test}} displays nothing if <code>none</code> is supplied
* {{tld|Short description/test}} displays the description from Wikidata if <code>wikidata</code> is supplied.
Taking {{Q|Q1096878}} as an example:
* <code><nowiki>{{short description/test|Underwater diving where breathing is from equipment independent of the surface}}</nowiki></code> → {{short description/test|Underwater diving where breathing is from equipment independent of the surface }}
* <code><nowiki>{{short description/test|none}}</nowiki></code> → {{short description/test|none}}
* <code><nowiki>{{short description/test|wikidata}}</nowiki></code> → {{short description/test|wikidata|qid=Q1096878}}
===Pagetype parameter===
If {{param|Pagetype}} is '''not''' set, then this template adds the article to a category based on the namespace:
* {{clc|Articles with short description}}
* {{clc|Redirects with short description}} {{--}} for redirects in any namespace
If {{param|Pagetype}} '''is''' set, then this template adds the article to a category matching the parameter. For example:
* {{cl|Redirects with short description}} {{--}} {{code|pagetype {{=}} Redirect }}
== <span class="anchor" id="Aliases"></span><span class="anchor" id="No-aliases"></span>Redirects ==
While there are currently <span class="plainlinks">[{{fullurl:Special:WhatLinksHere/Template:Short_description|hidetrans=1&hidelinks=1&limit=500}} redirects to this template]</span>, {{Strong|they must not be used}}, for the reasons below:
* Other templates and gadgets attempt to extract short descriptions from pages by explicitly searching for the {{tl|Short description}} template.
* For example, {{tl|Annotated link}} searches for the template in its uppercase "Short description" and lowercase form "short description"; either form is acceptable.
* Infoboxes often check the article for an existing short description template before setting thier own short description.
See the related [[Wikipedia:Redirects for discussion/Log/2021 July 20#Aliases for Short description template|2021 RfD]].
{{Strong|Do not}} start the template with a space: {{code|<nowiki> {{ Short description...</nowiki>}} or use an underscore: {{code|<nowiki> {{Short_description...</nowiki>}}. While these do create a valid short description, they will prevent searches for the {{code|<nowiki>{{Short description...</nowiki>}} text.
==Tracking categories==
* {{clc|Templates that generate short descriptions}}
* {{clc|Modules that create a short description}}
* {{clc|Short description matches Wikidata}}
* {{clc|Short description is different from Wikidata}}
* {{clc|Short description with empty Wikidata description}}
== Maintenance categories ==
* {{clc|Pages using short description with unknown parameters}}
* {{clc|Articles with long short description}}
* {{clc|Pages with lower-case short description}}
== See also ==
* {{tlx|Auto short description}}
* {{tlx|Annotated link}}
* {{tlx|laal}} – displays an article's pagelinks alongside its short description
* [[Module:Is infobox in lead]]
* [[Wikipedia:Short descriptions]] – background information
* [[Wikipedia:WikiProject Short descriptions]] – project to add Short descriptions to all articles
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Short description templates]]
[[Category:Templates that add a tracking category]]
[[Category:Templates that generate short descriptions]]
}}</includeonly>
q0wsv8zocauyqgghxvjy5bahuxqtfpz
Шаблон:Category link/core
10
3726
21969
2024-07-22T17:59:58Z
MusikBot II
2764
Changed protection settings for "[[Template:Category link/core]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 322812 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
21969
wikitext
text/x-wiki
[[:Category:{{{1}}}|{{{2}}}]]{{#if:{{Yesno|1={{{count|no}}}}}| <small style="{{#ifexpr:{{{page_count}}}>={{{backlog}}}|font-weight: bold; color: #DD0000;}}">( {{formatnum:{{{page_count}}}}} )</small>}}<noinclude>
{{Documentation|Template:Category link/doc}}
</noinclude>
77gpt1bl3z1t1b6sim8w905lwpmzfkw
21970
21969
2026-09-18T15:14:53Z
Amire80
9
1 измена увезена из [[:en:Template:Category_link/core]]: importing from the English Wikipedia
21969
wikitext
text/x-wiki
[[:Category:{{{1}}}|{{{2}}}]]{{#if:{{Yesno|1={{{count|no}}}}}| <small style="{{#ifexpr:{{{page_count}}}>={{{backlog}}}|font-weight: bold; color: #DD0000;}}">( {{formatnum:{{{page_count}}}}} )</small>}}<noinclude>
{{Documentation|Template:Category link/doc}}
</noinclude>
77gpt1bl3z1t1b6sim8w905lwpmzfkw
Модул:Lua call
828
3727
21971
2025-07-30T04:17:19Z
Uzume
1174
strict
21971
Scribunto
text/plain
require[[strict]]
local p={}
function p.main(frame)
local parent = frame.getParent(frame) or {}
local explist = {}
local fnname, varlist
local vars = {}
for k, v in pairs(_G) do
vars[k] = v -- transfer every global directly to our variable table
end
for k, v in pairs(parent.args or {}) do
vars[k] = tonumber(v) or v -- transfer every parameter directly to our variable table
end
for k, v in pairs(frame.args or {}) do
vars[k] = tonumber(v) or v -- transfer every parameter directly to our variable table
end
--- Alas Scribunto does NOT implement coroutines, according to
--- https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#string.format
--- this will not stop us from trying to implement one single lousy function call
if vars[1] then
fnname, varlist = mw.ustring.match(vars[1], "^%s*(%a[^%s%(]*)%(([^%)]*)%)%s*$")
end
if varlist then
local expn = 0
repeat
expn = expn + 1
explist[expn] = vars[mw.ustring.match(varlist, "([^%,]+)")]
varlist = mw.ustring.match(varlist, "[^%,]+,(.*)$")
until not varlist
end
local scopetab = vars
while mw.ustring.match(fnname, "%.") do
local scopekey
scopekey, fnname = mw.ustring.match(fnname, "^(%a[^%.]*)%.(.*)$")
scopetab = scopetab[scopekey]
end
local fn = scopetab[fnname]
if type(fn) ~= "function" then --XXX: What about callable tables?
return tostring(fn)
else
local output = {fn(unpack(explist))}
return output[vars.reserved_return or 1]
end
end
local function tonumberOrString(v)
return tonumber(v) or v:gsub("^\\", "", 1)
end
local function callWithTonumberOrStringOnPairs(f, ...)
local args = {}
for _, v in ... do
table.insert(args, tonumberOrString(v))
end
return (f(unpack(args)))
end
--[[
------------------------------------------------------------------------------------
-- ipairsAtOffset
-- This is an iterator for arrays. It can be used like ipairs, but with
-- specified i as first index to iterate. i is an offset from 1
--
------------------------------------------------------------------------------------
--]]
local function ipairsAtOffset(t, i)
local f, s, i0 = ipairs(t)
return f, s, i0+i
end
local function get(s)
local G = _G; for _ in mw.text.gsplit(
mw.text.trim(s, '%s'), '%s*%.%s*'
) do
G = G[_]
end
return G
end
--[[
------------------------------------------------------------------------------------
-- call
--
-- This function is usually useful for debugging template parameters.
-- Prefix parameter with backslash (\) to force interpreting parameter as string.
-- The leading backslash will be removed before passed to Lua function.
--
-- Example:
-- {{#invoke:Lua call|call|mw.log|a|1|2|3}} will return results of mw.log('a', 1, 2, 3)
-- {{#invoke:Lua call|call|mw.logObject|\a|321|\321| \321 }} will return results of mw.logObject('a', 321, '321', ' \\321 ')
--
-- This example show the debugging to see which Unicode characters are allowed in template parameters,
-- {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0061}}}} return 97
-- {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0000}}}} return 65533
-- {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0001}}}} return 65533
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0002}}}}}} return 0xfffd
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x007e}}}}}} return 0x007e
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x007f}}}}}} return 0x007f
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0080}}}}}} return 0x0080
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x00a0}}}}}} return 0x00a0
--
------------------------------------------------------------------------------------
--]]
function p.call(frame)
return callWithTonumberOrStringOnPairs(get(frame.args[1]),
ipairsAtOffset(frame.args, 1)
)
end
--local TableTools = require('Module:TableTools')
--[[
------------------------------------------------------------------------------------
-- get
--
-- Example:
-- {{#invoke:Lua call|get| math.pi }} will return value of math.pi
-- {{#invoke:Lua call|get|math|pi}} will return value of math.pi
-- {{#invoke:Lua call|get| math |pi}} will return value of _G[' math '].pi
-- {{#invoke:Lua call|get|_G| math.pi }} will return value of _G[' math.pi ']
-- {{#invoke:Lua call|get|obj.a.5.c}} will return value of obj.a['5'].c
-- {{#invoke:Lua call|get|obj|a|5|c}} will return value of obj.a[5].c
--
------------------------------------------------------------------------------------
--]]
function p.get(frame)
-- #frame.args always return 0, regardless of number of unnamed
-- template parameters, so check manually instead
if frame.args[2] == nil then
-- not do tonumber() for this args style,
-- always treat it as string,
-- so 'obj.1' will mean obj['1'] rather obj[1]
return get(frame.args[1])
else
local G = _G
for _, v in ipairs(frame.args) do
G = G[tonumberOrString(v)]
end
return G
end
end
--[[
------------------------------------------------------------------------------------
-- invoke
--
-- This function is used by Template:Invoke
--
------------------------------------------------------------------------------------
--]]
function p.invoke(frame)
local pframe, usedpargs = frame:getParent(), {}
-- get module and function names from parent args if not provided
local pfargs = setmetatable({frame.args[1], frame.args[2]}, {__index = table})
if not pfargs[1] then
pfargs[1], usedpargs[1] = pframe.args[1], true
if not pfargs[2] then
pfargs[2], usedpargs[2] = pframe.args[2], true
end
elseif not pfargs[2] then
pfargs[2], usedpargs[1] = pframe.args[1], true
end
-- repack sequential args
for i, v in ipairs(pframe.args) do
if not usedpargs[i] then
pfargs:insert(v)
usedpargs[i] = true
end
end
-- copy other args
for k, v in pairs(pframe.args) do
if not pfargs[k] and not usedpargs[k] then
pfargs[k], usedpargs[k] = v, true
end
end
-- #invoke off parent frame so the new frame has the same parent
return pframe:callParserFunction{name = '#invoke', args = pfargs}
end
return p
5ghedutku9genociz4xes1m4p1hp80q
21972
21971
2026-09-18T15:14:53Z
Amire80
9
1 измена увезена из [[:en:Module:Lua_call]]: importing from the English Wikipedia
21971
Scribunto
text/plain
require[[strict]]
local p={}
function p.main(frame)
local parent = frame.getParent(frame) or {}
local explist = {}
local fnname, varlist
local vars = {}
for k, v in pairs(_G) do
vars[k] = v -- transfer every global directly to our variable table
end
for k, v in pairs(parent.args or {}) do
vars[k] = tonumber(v) or v -- transfer every parameter directly to our variable table
end
for k, v in pairs(frame.args or {}) do
vars[k] = tonumber(v) or v -- transfer every parameter directly to our variable table
end
--- Alas Scribunto does NOT implement coroutines, according to
--- https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#string.format
--- this will not stop us from trying to implement one single lousy function call
if vars[1] then
fnname, varlist = mw.ustring.match(vars[1], "^%s*(%a[^%s%(]*)%(([^%)]*)%)%s*$")
end
if varlist then
local expn = 0
repeat
expn = expn + 1
explist[expn] = vars[mw.ustring.match(varlist, "([^%,]+)")]
varlist = mw.ustring.match(varlist, "[^%,]+,(.*)$")
until not varlist
end
local scopetab = vars
while mw.ustring.match(fnname, "%.") do
local scopekey
scopekey, fnname = mw.ustring.match(fnname, "^(%a[^%.]*)%.(.*)$")
scopetab = scopetab[scopekey]
end
local fn = scopetab[fnname]
if type(fn) ~= "function" then --XXX: What about callable tables?
return tostring(fn)
else
local output = {fn(unpack(explist))}
return output[vars.reserved_return or 1]
end
end
local function tonumberOrString(v)
return tonumber(v) or v:gsub("^\\", "", 1)
end
local function callWithTonumberOrStringOnPairs(f, ...)
local args = {}
for _, v in ... do
table.insert(args, tonumberOrString(v))
end
return (f(unpack(args)))
end
--[[
------------------------------------------------------------------------------------
-- ipairsAtOffset
-- This is an iterator for arrays. It can be used like ipairs, but with
-- specified i as first index to iterate. i is an offset from 1
--
------------------------------------------------------------------------------------
--]]
local function ipairsAtOffset(t, i)
local f, s, i0 = ipairs(t)
return f, s, i0+i
end
local function get(s)
local G = _G; for _ in mw.text.gsplit(
mw.text.trim(s, '%s'), '%s*%.%s*'
) do
G = G[_]
end
return G
end
--[[
------------------------------------------------------------------------------------
-- call
--
-- This function is usually useful for debugging template parameters.
-- Prefix parameter with backslash (\) to force interpreting parameter as string.
-- The leading backslash will be removed before passed to Lua function.
--
-- Example:
-- {{#invoke:Lua call|call|mw.log|a|1|2|3}} will return results of mw.log('a', 1, 2, 3)
-- {{#invoke:Lua call|call|mw.logObject|\a|321|\321| \321 }} will return results of mw.logObject('a', 321, '321', ' \\321 ')
--
-- This example show the debugging to see which Unicode characters are allowed in template parameters,
-- {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0061}}}} return 97
-- {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0000}}}} return 65533
-- {{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0001}}}} return 65533
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0002}}}}}} return 0xfffd
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x007e}}}}}} return 0x007e
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x007f}}}}}} return 0x007f
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x0080}}}}}} return 0x0080
-- {{#invoke:Lua call|call|string.format|0x%04x|{{#invoke:Lua call|call|mw.ustring.codepoint|{{#invoke:Lua call|call|mw.ustring.char|0x00a0}}}}}} return 0x00a0
--
------------------------------------------------------------------------------------
--]]
function p.call(frame)
return callWithTonumberOrStringOnPairs(get(frame.args[1]),
ipairsAtOffset(frame.args, 1)
)
end
--local TableTools = require('Module:TableTools')
--[[
------------------------------------------------------------------------------------
-- get
--
-- Example:
-- {{#invoke:Lua call|get| math.pi }} will return value of math.pi
-- {{#invoke:Lua call|get|math|pi}} will return value of math.pi
-- {{#invoke:Lua call|get| math |pi}} will return value of _G[' math '].pi
-- {{#invoke:Lua call|get|_G| math.pi }} will return value of _G[' math.pi ']
-- {{#invoke:Lua call|get|obj.a.5.c}} will return value of obj.a['5'].c
-- {{#invoke:Lua call|get|obj|a|5|c}} will return value of obj.a[5].c
--
------------------------------------------------------------------------------------
--]]
function p.get(frame)
-- #frame.args always return 0, regardless of number of unnamed
-- template parameters, so check manually instead
if frame.args[2] == nil then
-- not do tonumber() for this args style,
-- always treat it as string,
-- so 'obj.1' will mean obj['1'] rather obj[1]
return get(frame.args[1])
else
local G = _G
for _, v in ipairs(frame.args) do
G = G[tonumberOrString(v)]
end
return G
end
end
--[[
------------------------------------------------------------------------------------
-- invoke
--
-- This function is used by Template:Invoke
--
------------------------------------------------------------------------------------
--]]
function p.invoke(frame)
local pframe, usedpargs = frame:getParent(), {}
-- get module and function names from parent args if not provided
local pfargs = setmetatable({frame.args[1], frame.args[2]}, {__index = table})
if not pfargs[1] then
pfargs[1], usedpargs[1] = pframe.args[1], true
if not pfargs[2] then
pfargs[2], usedpargs[2] = pframe.args[2], true
end
elseif not pfargs[2] then
pfargs[2], usedpargs[1] = pframe.args[1], true
end
-- repack sequential args
for i, v in ipairs(pframe.args) do
if not usedpargs[i] then
pfargs:insert(v)
usedpargs[i] = true
end
end
-- copy other args
for k, v in pairs(pframe.args) do
if not pfargs[k] and not usedpargs[k] then
pfargs[k], usedpargs[k] = v, true
end
end
-- #invoke off parent frame so the new frame has the same parent
return pframe:callParserFunction{name = '#invoke', args = pfargs}
end
return p
5ghedutku9genociz4xes1m4p1hp80q
Шаблон:Editnotice EXPECTUNUSEDTEMPLATE
10
3728
21973
2026-01-08T04:44:45Z
HouseBlaster
38
protection padlock provided by [[TM:documentation]]
21973
wikitext
text/x-wiki
{{#ifeq:Template:Editnotices|{{FULLROOTPAGENAME}}|__EXPECTUNUSEDTEMPLATE__}}<noinclude>{{documentation}}</noinclude>
1zwqf3zeqxnh21v7kbtjaygvxm2lqko
21974
21973
2026-09-18T15:14:53Z
Amire80
9
1 измена увезена из [[:en:Template:Editnotice_EXPECTUNUSEDTEMPLATE]]: importing from the English Wikipedia
21973
wikitext
text/x-wiki
{{#ifeq:Template:Editnotices|{{FULLROOTPAGENAME}}|__EXPECTUNUSEDTEMPLATE__}}<noinclude>{{documentation}}</noinclude>
1zwqf3zeqxnh21v7kbtjaygvxm2lqko
Шаблон:Source parameter
10
3729
21975
2026-04-12T13:41:20Z
FaviFake
2813
FaviFake moved page [[Template:Param]] to [[Template:Source parameter]]: "Param" is ambiguous and not immediately clear, especially when compared to [[TM:Para]]. "Source parameter" is explicit, distinct from the other template name, and aligns with standard technical terminology, making it easier to understand and use correctly.
21975
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#ifeq:{{SAFESUBST:<noinclude />Yesno|{{{nested|no}}}}}|yes||<{{{tag|code}}}>}}{{{{{{1<noinclude>|foo</noinclude>}}}{{SAFESUBST:<noinclude />#ifeq:{{{2}}}|{{{2|}}} ||}}{{{2|}}}}}}{{SAFESUBST:<noinclude />#ifeq:{{SAFESUBST:<noinclude />Yesno|{{{nested|no}}}}}|yes||</{{{tag|code}}}>}}<noinclude>
{{Documentation}}
<!--
PLEASE ADD CATEGORIES AND INTERWIKIS
TO THE /doc SUBPAGE, THANKS
-->
</noinclude>
k2oxzdhjfcbt88hy90njp6u20ucxx42
21976
21975
2026-09-18T15:14:53Z
Amire80
9
1 измена увезена из [[:en:Template:Source_parameter]]: importing from the English Wikipedia
21975
wikitext
text/x-wiki
{{SAFESUBST:<noinclude />#ifeq:{{SAFESUBST:<noinclude />Yesno|{{{nested|no}}}}}|yes||<{{{tag|code}}}>}}{{{{{{1<noinclude>|foo</noinclude>}}}{{SAFESUBST:<noinclude />#ifeq:{{{2}}}|{{{2|}}} ||}}{{{2|}}}}}}{{SAFESUBST:<noinclude />#ifeq:{{SAFESUBST:<noinclude />Yesno|{{{nested|no}}}}}|yes||</{{{tag|code}}}>}}<noinclude>
{{Documentation}}
<!--
PLEASE ADD CATEGORIES AND INTERWIKIS
TO THE /doc SUBPAGE, THANKS
-->
</noinclude>
k2oxzdhjfcbt88hy90njp6u20ucxx42
Шаблон:SDcat
10
3730
21977
2024-02-17T03:58:17Z
Pppery
88
Changed protection settings for "[[Template:SDcat]]": Per [[Template:Short description]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
21977
wikitext
text/x-wiki
<includeonly>{{#invoke:SDcat |setCat}}</includeonly><noinclude>
{{documentation}}
</noinclude>
gejktck2ca8vfelabmrprhfecoxzlpi
21978
21977
2026-09-18T15:16:15Z
Amire80
9
1 измена увезена из [[:en:Template:SDcat]]: importing from the English Wikipedia
21977
wikitext
text/x-wiki
<includeonly>{{#invoke:SDcat |setCat}}</includeonly><noinclude>
{{documentation}}
</noinclude>
gejktck2ca8vfelabmrprhfecoxzlpi
Шаблон:SDcat/doc
10
3731
21979
2025-04-05T21:24:07Z
Musiconeologist
2817
Shouldn't be in both
21979
wikitext
text/x-wiki
{{Documentation subpage}}
{{High risk}}
{{cascade-protected template}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{lua|Module:SDcat}}
This template is merely a wrapper for [[Module:SDcat]], which adds tracking categories to articles depending on whether their [[WP:short description|short description]] matches the associated description field on Wikidata. Complete documentation is available at [[Module:SDcat]].
== Usage ==
<code><nowiki>{{SDcat |sd={{{shortdescription|}}} }}</nowiki></code>
=== For testing ===
<code><nowiki>{{SDcat |sd=short description |qid=Wikidata entity ID |lp=link prefix (usually ":") }}</nowiki></code>
<includeonly>{{sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Short description templates]]
}}</includeonly>
avffmp78ajpwlsz0jgpqkb4yseqvkbf
21980
21979
2026-09-18T15:16:15Z
Amire80
9
1 измена увезена из [[:en:Template:SDcat/doc]]: importing from the English Wikipedia
21979
wikitext
text/x-wiki
{{Documentation subpage}}
{{High risk}}
{{cascade-protected template}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{lua|Module:SDcat}}
This template is merely a wrapper for [[Module:SDcat]], which adds tracking categories to articles depending on whether their [[WP:short description|short description]] matches the associated description field on Wikidata. Complete documentation is available at [[Module:SDcat]].
== Usage ==
<code><nowiki>{{SDcat |sd={{{shortdescription|}}} }}</nowiki></code>
=== For testing ===
<code><nowiki>{{SDcat |sd=short description |qid=Wikidata entity ID |lp=link prefix (usually ":") }}</nowiki></code>
<includeonly>{{sandbox other||
<!-- Categories below this line; interwikis at Wikidata -->
[[Category:Short description templates]]
}}</includeonly>
avffmp78ajpwlsz0jgpqkb4yseqvkbf
Модул:SDcat
828
3732
21981
2024-02-17T03:57:52Z
Pppery
88
Changed protection settings for "[[Module:SDcat]]": Per main ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
21981
Scribunto
text/plain
--[[
SDcat
Module to check whether local short description matches that on Wikidata
--]]
local p = {}
-------------------------------------------------------------------------------
--[[
setCat has the qid of a Wikidata entity passed as |qid=
(it defaults to the associated qid of the current article if omitted)
and the local short description passed as |sd=
It returns a category if there is an associated Wikidata entity.
It returns one of the following tracking categories, as appropriate:
* Category:Short description matches Wikidata (case-insensitive)
* Category:Short description is different from Wikidata
* Category:Short description with empty Wikidata description
For testing purposes, a link prefix |lp= may be set to ":" to make the categories visible.
--]]
-- function exported for use in other modules
-- (local short description, Wikidata entity-ID, link prefix)
p._setCat = function(sdesc, itemID, lp)
if not mw.wikibase then return nil end
if itemID == "" then itemID = nil end
-- Wikidata description field
local wdesc = (mw.wikibase.getDescription(itemID) or ""):lower()
if wdesc == "" then
return "[[" .. lp .. "Category:Short description with empty Wikidata description]]"
elseif wdesc == sdesc then
return "[[" .. lp .. "Category:Short description matches Wikidata]]"
else
return "[[" .. lp .. "Category:Short description is different from Wikidata]]"
end
end
-- function exported for call from #invoke
p.setCat = function(frame)
local args
if frame.args.sd then
args = frame.args
else
args = frame:getParent().args
end
-- local short description
local sdesc = mw.text.trim(args.sd or ""):lower()
-- Wikidata entity-ID
local itemID = mw.text.trim(args.qid or "")
-- link prefix, strip quotes
local lp = mw.text.trim(args.lp or ""):gsub('"', '')
return p._setCat(sdesc, itemID, lp)
end
return p
cml06m2kvz7og9bi5f1xe6ylhi3d9a0
21982
21981
2026-09-18T15:18:07Z
Amire80
9
1 измена увезена из [[:en:Module:SDcat]]: importing from the English Wikipedia
21981
Scribunto
text/plain
--[[
SDcat
Module to check whether local short description matches that on Wikidata
--]]
local p = {}
-------------------------------------------------------------------------------
--[[
setCat has the qid of a Wikidata entity passed as |qid=
(it defaults to the associated qid of the current article if omitted)
and the local short description passed as |sd=
It returns a category if there is an associated Wikidata entity.
It returns one of the following tracking categories, as appropriate:
* Category:Short description matches Wikidata (case-insensitive)
* Category:Short description is different from Wikidata
* Category:Short description with empty Wikidata description
For testing purposes, a link prefix |lp= may be set to ":" to make the categories visible.
--]]
-- function exported for use in other modules
-- (local short description, Wikidata entity-ID, link prefix)
p._setCat = function(sdesc, itemID, lp)
if not mw.wikibase then return nil end
if itemID == "" then itemID = nil end
-- Wikidata description field
local wdesc = (mw.wikibase.getDescription(itemID) or ""):lower()
if wdesc == "" then
return "[[" .. lp .. "Category:Short description with empty Wikidata description]]"
elseif wdesc == sdesc then
return "[[" .. lp .. "Category:Short description matches Wikidata]]"
else
return "[[" .. lp .. "Category:Short description is different from Wikidata]]"
end
end
-- function exported for call from #invoke
p.setCat = function(frame)
local args
if frame.args.sd then
args = frame.args
else
args = frame:getParent().args
end
-- local short description
local sdesc = mw.text.trim(args.sd or ""):lower()
-- Wikidata entity-ID
local itemID = mw.text.trim(args.qid or "")
-- link prefix, strip quotes
local lp = mw.text.trim(args.lp or ""):gsub('"', '')
return p._setCat(sdesc, itemID, lp)
end
return p
cml06m2kvz7og9bi5f1xe6ylhi3d9a0
Модул:SDcat/doc
828
3733
21983
2024-10-19T02:27:52Z
2600 etc
2818
21983
wikitext
text/x-wiki
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High risk}}
{{cascade-protected template|page=module}}
Module to check whether local short description matches that on Wikidata
setCat has the qid of a Wikidata entity passed as |qid=
(it defaults to the associated qid of the current article if omitted)
and the local short description passed as |sd=
It returns a category if there is an associated Wikidata entity.
It returns one of the following tracking categories, as appropriate:
* Category:Short description matches Wikidata (case-insensitive)
* Category:Short description is different from Wikidata
* Category:Short description with empty Wikidata description
For testing purposes, a link prefix |lp= may be set to ":" to make the categories visible.
== Usage ==
; From within a template
: <code><nowiki>{{SDcat |sd={{{shortdescription|}}} }}</nowiki></code>
: or
: <code><nowiki>{{#invoke:SDcat |setCat |sd={{{shortdescription|}}} }}</nowiki></code>
[[Template:SDcat]] is a wrapper for this module.
; From another module
: <code>sdcat = require("Module:SDcat")._setCat</code>
: <code>local tracking_cat = sdcat(shortdesc, itemID)</code>
=== For testing ===
<code><nowiki>{{#invoke:SDcat |setCat |qid={{get QID|Douglas Adams}}|sd=English author and humorist (1952–2001) |lp=":"}}</nowiki></code>
A few examples of tests are at [[Module talk:SDcat]]
<includeonly>{{Sandbox other||
[[Category:Short description related modules]]
}}</includeonly>
<noinclude>
[[Category:Module documentation pages]]
</noinclude>
3atvyuhmh3cggbtw5r1jit13d0he65n
21984
21983
2026-09-18T15:18:07Z
Amire80
9
1 измена увезена из [[:en:Module:SDcat/doc]]: importing from the English Wikipedia
21983
wikitext
text/x-wiki
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High risk}}
{{cascade-protected template|page=module}}
Module to check whether local short description matches that on Wikidata
setCat has the qid of a Wikidata entity passed as |qid=
(it defaults to the associated qid of the current article if omitted)
and the local short description passed as |sd=
It returns a category if there is an associated Wikidata entity.
It returns one of the following tracking categories, as appropriate:
* Category:Short description matches Wikidata (case-insensitive)
* Category:Short description is different from Wikidata
* Category:Short description with empty Wikidata description
For testing purposes, a link prefix |lp= may be set to ":" to make the categories visible.
== Usage ==
; From within a template
: <code><nowiki>{{SDcat |sd={{{shortdescription|}}} }}</nowiki></code>
: or
: <code><nowiki>{{#invoke:SDcat |setCat |sd={{{shortdescription|}}} }}</nowiki></code>
[[Template:SDcat]] is a wrapper for this module.
; From another module
: <code>sdcat = require("Module:SDcat")._setCat</code>
: <code>local tracking_cat = sdcat(shortdesc, itemID)</code>
=== For testing ===
<code><nowiki>{{#invoke:SDcat |setCat |qid={{get QID|Douglas Adams}}|sd=English author and humorist (1952–2001) |lp=":"}}</nowiki></code>
A few examples of tests are at [[Module talk:SDcat]]
<includeonly>{{Sandbox other||
[[Category:Short description related modules]]
}}</includeonly>
<noinclude>
[[Category:Module documentation pages]]
</noinclude>
3atvyuhmh3cggbtw5r1jit13d0he65n
Шаблон:Pagetype
10
3734
21985
2014-07-09T08:29:38Z
Callanecc
2819
Changed protection level of Template:Pagetype: [[WP:High-risk templates|Highly visible template]]: With more than 5.5 million transclusions and cascade protections this should be full protected as well ([Edit=Allow only administrators] (indefinite) [Move=
21985
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:pagetype|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
lljnsh3xa96oyrio8us1qbonct9sq7b
21986
21985
2026-09-18T15:20:10Z
Amire80
9
1 измена увезена из [[:en:Template:Pagetype]]: importing from the English Wikipedia
21985
wikitext
text/x-wiki
{{<includeonly>safesubst:</includeonly>#invoke:pagetype|main}}<noinclude>
{{documentation}}
<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>
lljnsh3xa96oyrio8us1qbonct9sq7b
Модул:Pagetype
828
3735
21987
2024-05-21T17:35:20Z
MSGJ
2752
fix for files and interface messages which do exist but are not stored locally
21987
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- This meta-module which automatically detects namespaces, and allows --
-- for a great deal of customisation. It can easily be ported to other --
-- wikis by changing the values in the [[Module:Pagetype/config]]. --
-- --
--------------------------------------------------------------------------------
-- Load config.
local cfg = mw.loadData('Module:Pagetype/config')
-- Load required modules.
local yesno = require('Module:Yesno')
local p = {}
-- Look up a namespace argument in the args table.
local function lookUpNamespaceArg(args, key)
local arg = args[key]
-- Convert "yes", "1" etc. to true, "no", "0" etc. to false, and leave
-- other values the same.
return yesno(arg, arg)
end
-- Append multiple values to an array
local function appendMultiple(target, source)
for _, value in ipairs(source) do
table.insert(target, value)
end
end
-- Get argument keys for a title's namespace
local function getNamespaceArgKeys(title)
local nsInfo = mw.site.namespaces[title.namespace]
local customAliases = cfg.customNamespaceAliases[title.namespace] or {}
local keys = {}
if nsInfo.name ~= '' then
table.insert(keys, nsInfo.name)
end
if nsInfo.canonicalName ~= nsInfo.name and nsInfo.canonicalName ~= '' then
table.insert(keys, nsInfo.canonicalName)
end
appendMultiple(keys, nsInfo.aliases)
appendMultiple(keys, customAliases)
return keys
end
-- Get the argument for a title's namespace, if it was specified in the args table.
local function getNamespaceArg(title, args)
if title.isTalkPage then
return lookUpNamespaceArg(args, cfg.talk)
end
for _, key in ipairs(getNamespaceArgKeys(title)) do
local arg = lookUpNamespaceArg(args, mw.ustring.lower(key))
if arg ~= nil then
return arg
end
end
return nil
end
-- Look up a page type specific to the title's namespace
local function getExplicitPageType(title)
if title.isTalkPage then
return cfg.talkDefault
else
return cfg.pagetypes[title.namespace]
end
end
-- Get a default page type that is not specific to the title's namespace
local function getDefaultPageType(args)
local other = lookUpNamespaceArg(args, cfg.other)
if type(other) == 'string' then
return other
else
return cfg.otherDefault
end
end
local function detectRedirects(title, args)
local redirect = lookUpNamespaceArg(args, cfg.redirect)
if redirect == false then
-- Don't detect redirects if they have been specifically disallowed.
return nil
end
-- Allow custom values for redirects.
if not title.isRedirect then
return nil
elseif type(redirect) == 'string' then
return redirect
else
return cfg.redirectDefault
end
end
local function capitalize(pageType)
local first = mw.ustring.sub(pageType, 1, 1)
local rest = mw.ustring.sub(pageType, 2)
return mw.ustring.upper(first) .. rest
end
local function pluralize(pageType)
if cfg.irregularPlurals[pageType] then
return cfg.irregularPlurals[pageType]
else
return pageType .. cfg.plural -- often 's'
end
end
local function parseContent(title, args, optionsList)
if title.namespace==828 and title.subpageText~='doc' -- don't detect modules
or not title.exists -- can't check unless page exists
then
return nil
end
local content = title:getContent()
if content == nil then
return nil
end
local templates -- lazily evaluated
for _, options in next, optionsList do
local list, parameter, default, articleOnly = unpack(options, 1, 4)
if not articleOnly or title.namespace==0 then -- only check for templates if we should...
local out = lookUpNamespaceArg(args, parameter)
if type(out) == "string" or (out ~= false and default) then -- ...and if we actually have anything to say about them
if not templates then
templates = {} -- do our delayed evaluation now that we are required to
content = require('Module:Wikitext Parsing').PrepareText(content) -- disregard templates which do not have any affect
for template in string.gmatch(content, "{{%s*([^|}]-)%s*[|}]") do
templates[#templates+1] = capitalize(template)
end
end
local wantedTemplates = mw.loadData('Module:Pagetype/' .. list)
local templateFound = false
for _, template in next, templates do
if wantedTemplates[template] then
templateFound = true
break
end
end
if templateFound then
if type(out)=='string' then
return out
elseif out ~= false and default then
return default
end
end
end
end
end
end
-- Find pages which do not exist
local function nonExistent(title, args)
local arg = lookUpNamespaceArg(args, cfg.ne)
if arg == false then
return nil
end
local exists = false
if title.exists then -- not an article if it does not exist
exists = true
elseif title.namespace==8 and mw.message.new(title.text):exists() then
exists = true
elseif title.namespace==6 and title.fileExists then
exists = true
end
if not exists then
if type(arg) == 'string' then
return arg
else
return cfg.naDefault
end
end
end
-- Get page types for mainspaces pages with an explicit class specified
local function getMainNamespaceClassPageType(title, args)
local class = args[1]
if type(class) == 'string' then -- Put in lower case so e.g. "na" and "NA" will both match
class = mw.ustring.lower(class)
end
local arg = lookUpNamespaceArg(args, cfg.na)
if arg == false then -- don't check for this class if it is specifically disallowed
return nil
end
if cfg.naAliases[class] then
if type(arg) == 'string' then
return arg
else
return cfg.naDefault
end
else
return nil
end
end
-- Get page type specified by an explicit namespace argument.
local function getNamespaceArgPageType(title, args)
local namespaceArg = getNamespaceArg(title, args)
if namespaceArg == true then
-- Namespace has been explicitly enabled, so return the default for
-- this namespace
return getExplicitPageType(title)
elseif namespaceArg == false then
-- Namespace has been explicitly disabled
return getDefaultPageType(args)
elseif namespaceArg then
-- This namespaces uses custom text
return namespaceArg
else
return nil
end
end
-- Get page type not specified or detected by other means
local function getOtherPageType(title, args)
-- Whether the title is in the set of default active namespaces which are looked up in cfg.pagetypes.
local isInDefaultActiveNamespace = false
local defaultNamespacesKey = args[cfg.defaultns]
if defaultNamespacesKey == cfg.defaultnsAll then
isInDefaultActiveNamespace = true
else
local defaultNamespaces
if defaultNamespacesKey == cfg.defaultnsExtended then
defaultNamespaces = cfg.extendedNamespaces
elseif defaultNamespacesKey == cfg.defaultnsNone then
defaultNamespaces = {}
else
defaultNamespaces = cfg.defaultNamespaces
end
isInDefaultActiveNamespace = defaultNamespaces[title.namespace]
end
if isInDefaultActiveNamespace then
return getExplicitPageType(title)
else
return getDefaultPageType(args)
end
end
function p._main(args)
local title
if args.page then
title = mw.title.new(args.page)
else
title = mw.title.getCurrentTitle()
end
if title and not yesno(args.talk, true) and args[cfg.defaultns] ~= cfg.defaultnsAll then
title = title.subjectPageTitle
end
local pageType = detectRedirects(title, args)
or nonExistent(title, args)
or parseContent(title, args, {
{'softredirect', cfg.softRedirect, cfg.softRedirectDefault},
{'setindex', cfg.sia, cfg.siaDefault, true},
{'disambiguation', cfg.dab, cfg.dabDefault, true},
{'rfd', cfg.rfd, cfg.rfdDefault},
})
or (title.namespace == 0 and getMainNamespaceClassPageType(title, args))
or getNamespaceArgPageType(title, args)
or getOtherPageType(title, args)
if yesno(args.plural, false) then
pageType = pluralize(pageType)
end
if yesno(args.caps, false) then
pageType = capitalize(pageType)
end
return pageType
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame)
return p._main(args)
end
return p
nqu0kvn2uc9jqptetkmoluzmahcxzzp
21988
21987
2026-09-18T15:20:10Z
Amire80
9
1 измена увезена из [[:en:Module:Pagetype]]: importing from the English Wikipedia
21987
Scribunto
text/plain
--------------------------------------------------------------------------------
-- --
-- This meta-module which automatically detects namespaces, and allows --
-- for a great deal of customisation. It can easily be ported to other --
-- wikis by changing the values in the [[Module:Pagetype/config]]. --
-- --
--------------------------------------------------------------------------------
-- Load config.
local cfg = mw.loadData('Module:Pagetype/config')
-- Load required modules.
local yesno = require('Module:Yesno')
local p = {}
-- Look up a namespace argument in the args table.
local function lookUpNamespaceArg(args, key)
local arg = args[key]
-- Convert "yes", "1" etc. to true, "no", "0" etc. to false, and leave
-- other values the same.
return yesno(arg, arg)
end
-- Append multiple values to an array
local function appendMultiple(target, source)
for _, value in ipairs(source) do
table.insert(target, value)
end
end
-- Get argument keys for a title's namespace
local function getNamespaceArgKeys(title)
local nsInfo = mw.site.namespaces[title.namespace]
local customAliases = cfg.customNamespaceAliases[title.namespace] or {}
local keys = {}
if nsInfo.name ~= '' then
table.insert(keys, nsInfo.name)
end
if nsInfo.canonicalName ~= nsInfo.name and nsInfo.canonicalName ~= '' then
table.insert(keys, nsInfo.canonicalName)
end
appendMultiple(keys, nsInfo.aliases)
appendMultiple(keys, customAliases)
return keys
end
-- Get the argument for a title's namespace, if it was specified in the args table.
local function getNamespaceArg(title, args)
if title.isTalkPage then
return lookUpNamespaceArg(args, cfg.talk)
end
for _, key in ipairs(getNamespaceArgKeys(title)) do
local arg = lookUpNamespaceArg(args, mw.ustring.lower(key))
if arg ~= nil then
return arg
end
end
return nil
end
-- Look up a page type specific to the title's namespace
local function getExplicitPageType(title)
if title.isTalkPage then
return cfg.talkDefault
else
return cfg.pagetypes[title.namespace]
end
end
-- Get a default page type that is not specific to the title's namespace
local function getDefaultPageType(args)
local other = lookUpNamespaceArg(args, cfg.other)
if type(other) == 'string' then
return other
else
return cfg.otherDefault
end
end
local function detectRedirects(title, args)
local redirect = lookUpNamespaceArg(args, cfg.redirect)
if redirect == false then
-- Don't detect redirects if they have been specifically disallowed.
return nil
end
-- Allow custom values for redirects.
if not title.isRedirect then
return nil
elseif type(redirect) == 'string' then
return redirect
else
return cfg.redirectDefault
end
end
local function capitalize(pageType)
local first = mw.ustring.sub(pageType, 1, 1)
local rest = mw.ustring.sub(pageType, 2)
return mw.ustring.upper(first) .. rest
end
local function pluralize(pageType)
if cfg.irregularPlurals[pageType] then
return cfg.irregularPlurals[pageType]
else
return pageType .. cfg.plural -- often 's'
end
end
local function parseContent(title, args, optionsList)
if title.namespace==828 and title.subpageText~='doc' -- don't detect modules
or not title.exists -- can't check unless page exists
then
return nil
end
local content = title:getContent()
if content == nil then
return nil
end
local templates -- lazily evaluated
for _, options in next, optionsList do
local list, parameter, default, articleOnly = unpack(options, 1, 4)
if not articleOnly or title.namespace==0 then -- only check for templates if we should...
local out = lookUpNamespaceArg(args, parameter)
if type(out) == "string" or (out ~= false and default) then -- ...and if we actually have anything to say about them
if not templates then
templates = {} -- do our delayed evaluation now that we are required to
content = require('Module:Wikitext Parsing').PrepareText(content) -- disregard templates which do not have any affect
for template in string.gmatch(content, "{{%s*([^|}]-)%s*[|}]") do
templates[#templates+1] = capitalize(template)
end
end
local wantedTemplates = mw.loadData('Module:Pagetype/' .. list)
local templateFound = false
for _, template in next, templates do
if wantedTemplates[template] then
templateFound = true
break
end
end
if templateFound then
if type(out)=='string' then
return out
elseif out ~= false and default then
return default
end
end
end
end
end
end
-- Find pages which do not exist
local function nonExistent(title, args)
local arg = lookUpNamespaceArg(args, cfg.ne)
if arg == false then
return nil
end
local exists = false
if title.exists then -- not an article if it does not exist
exists = true
elseif title.namespace==8 and mw.message.new(title.text):exists() then
exists = true
elseif title.namespace==6 and title.fileExists then
exists = true
end
if not exists then
if type(arg) == 'string' then
return arg
else
return cfg.naDefault
end
end
end
-- Get page types for mainspaces pages with an explicit class specified
local function getMainNamespaceClassPageType(title, args)
local class = args[1]
if type(class) == 'string' then -- Put in lower case so e.g. "na" and "NA" will both match
class = mw.ustring.lower(class)
end
local arg = lookUpNamespaceArg(args, cfg.na)
if arg == false then -- don't check for this class if it is specifically disallowed
return nil
end
if cfg.naAliases[class] then
if type(arg) == 'string' then
return arg
else
return cfg.naDefault
end
else
return nil
end
end
-- Get page type specified by an explicit namespace argument.
local function getNamespaceArgPageType(title, args)
local namespaceArg = getNamespaceArg(title, args)
if namespaceArg == true then
-- Namespace has been explicitly enabled, so return the default for
-- this namespace
return getExplicitPageType(title)
elseif namespaceArg == false then
-- Namespace has been explicitly disabled
return getDefaultPageType(args)
elseif namespaceArg then
-- This namespaces uses custom text
return namespaceArg
else
return nil
end
end
-- Get page type not specified or detected by other means
local function getOtherPageType(title, args)
-- Whether the title is in the set of default active namespaces which are looked up in cfg.pagetypes.
local isInDefaultActiveNamespace = false
local defaultNamespacesKey = args[cfg.defaultns]
if defaultNamespacesKey == cfg.defaultnsAll then
isInDefaultActiveNamespace = true
else
local defaultNamespaces
if defaultNamespacesKey == cfg.defaultnsExtended then
defaultNamespaces = cfg.extendedNamespaces
elseif defaultNamespacesKey == cfg.defaultnsNone then
defaultNamespaces = {}
else
defaultNamespaces = cfg.defaultNamespaces
end
isInDefaultActiveNamespace = defaultNamespaces[title.namespace]
end
if isInDefaultActiveNamespace then
return getExplicitPageType(title)
else
return getDefaultPageType(args)
end
end
function p._main(args)
local title
if args.page then
title = mw.title.new(args.page)
else
title = mw.title.getCurrentTitle()
end
if title and not yesno(args.talk, true) and args[cfg.defaultns] ~= cfg.defaultnsAll then
title = title.subjectPageTitle
end
local pageType = detectRedirects(title, args)
or nonExistent(title, args)
or parseContent(title, args, {
{'softredirect', cfg.softRedirect, cfg.softRedirectDefault},
{'setindex', cfg.sia, cfg.siaDefault, true},
{'disambiguation', cfg.dab, cfg.dabDefault, true},
{'rfd', cfg.rfd, cfg.rfdDefault},
})
or (title.namespace == 0 and getMainNamespaceClassPageType(title, args))
or getNamespaceArgPageType(title, args)
or getOtherPageType(title, args)
if yesno(args.plural, false) then
pageType = pluralize(pageType)
end
if yesno(args.caps, false) then
pageType = capitalize(pageType)
end
return pageType
end
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame)
return p._main(args)
end
return p
nqu0kvn2uc9jqptetkmoluzmahcxzzp
Модул:Pagetype/config
828
3736
21989
2026-04-25T00:17:56Z
Anomie
2795
+ MOS and Event namespaces
21989
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Pagetype configuration data --
-- This page holds localisation and configuration data for Module:Pagetype. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
-- This table holds the default page types for each namespace. Keys to this
-- table should be integers that can be used as keys to mw.site.namespaces.
cfg.pagetypes = {
[0] = 'article', -- Main namespace
[2] = 'user page',
[4] = 'project page',
[6] = 'file',
[8] = 'interface page', -- MediaWiki namespace
[10] = 'template',
[12] = 'help page',
[14] = 'category',
[100] = 'portal',
[118] = 'draft',
[126] = 'MOS page',
[710] = 'Timed Text page',
[828] = 'module',
[1728] = 'event page',
[2300] = 'gadget',
[2302] = 'gadget definition',
[-1] = 'special page',
[-2] = 'file', -- Media namespace
}
-- This table holds the namespaces to be looked up from cfg.pagetypes by
-- default.
cfg.defaultNamespaces = {
[0] = true, -- main
[6] = true, -- file
[10] = true, -- template
[14] = true, -- category
[828] = true, -- module
}
-- This table holds the namespaces to be looked up from cfg.pagetypes if
-- cfg.defaultnsExtended is set.
cfg.extendedNamespaces = {
[0] = true, -- main
[2] = true, -- user
[4] = true, -- project
[6] = true, -- file
[8] = true, -- mediawiki
[10] = true, -- template
[12] = true, -- help
[14] = true, -- category
[100] = true, -- portal
[118] = true, -- draft
[828] = true, -- module
}
-- This table holds custom aliases for each namespace.
cfg.customNamespaceAliases = {
[0] = {'main'},
}
-- The parameter name to set which default namespace values to be looked up from
-- cfg.pagetypes.
cfg.defaultns = 'defaultns'
-- The value of cfg.defaultns to set all namespaces, including talk.
cfg.defaultnsAll = 'all'
-- The value of cfg.defaultns to set the namespaces listed in
-- cfg.extendedNamespaces
cfg.defaultnsExtended = 'extended'
-- The value of cfg.defaultns to set no default namespaces.
cfg.defaultnsNone = 'none'
-- The parameter name to use for talk pages.
cfg.talk = 'talk'
-- The default value for talk pages.
cfg.talkDefault = 'talk page'
-- The parameter name to use for disambiguation pages page.
cfg.dab = 'dab'
-- The parameter name to use for non-existent pages.
cfg.ne = 'nonexistent'
cfg.neDefault = 'page'
cfg.softRedirect = 'soft_redirect'
cfg.softRedirectDefault = 'redirect'
cfg.sia = 'sia'
cfg.siaDefault = 'article'
cfg.rfd = 'redirect'
cfg.rfdDefault = 'redirect'
-- This table holds the different possible aliases for disambiguation-class
-- pages. These should be lower-case.
cfg.dabAliases = {
['disambiguation'] = true,
['disambig'] = true,
['disamb'] = true,
['dab'] = true,
}
-- The default value for disambiguation pages.
cfg.dabDefault = 'page'
-- The parameter name to use for N/A-class page.
cfg.na = 'na'
-- This table holds the different possible aliases for N/A-class pages. These
-- should be lower-case.
cfg.naAliases = {
['na'] = true,
['n/a'] = true,
}
-- The default value for N/A-class pages.
cfg.naDefault = 'page'
-- The parameter name to use for redirects.
cfg.redirect = 'redirect'
-- The default value to use for redirects.
cfg.redirectDefault = 'redirect'
-- The parameter name for undefined namespaces.
cfg.other = 'other'
-- The value used if the module detects an undefined namespace.
cfg.otherDefault = 'page'
-- The usual suffix denoting a plural.
cfg.plural = 's'
-- This table holds plurals not formed by a simple suffix.
cfg.irregularPlurals = {
["category"] = "categories"
}
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line
dbot8rq8sjl2bypo7kiymiyo4gxz08i
21990
21989
2026-09-18T15:20:10Z
Amire80
9
1 измена увезена из [[:en:Module:Pagetype/config]]: importing from the English Wikipedia
21989
Scribunto
text/plain
--------------------------------------------------------------------------------
-- Module:Pagetype configuration data --
-- This page holds localisation and configuration data for Module:Pagetype. --
--------------------------------------------------------------------------------
local cfg = {} -- Don't edit this line.
--------------------------------------------------------------------------------
-- Start configuration data --
--------------------------------------------------------------------------------
-- This table holds the default page types for each namespace. Keys to this
-- table should be integers that can be used as keys to mw.site.namespaces.
cfg.pagetypes = {
[0] = 'article', -- Main namespace
[2] = 'user page',
[4] = 'project page',
[6] = 'file',
[8] = 'interface page', -- MediaWiki namespace
[10] = 'template',
[12] = 'help page',
[14] = 'category',
[100] = 'portal',
[118] = 'draft',
[126] = 'MOS page',
[710] = 'Timed Text page',
[828] = 'module',
[1728] = 'event page',
[2300] = 'gadget',
[2302] = 'gadget definition',
[-1] = 'special page',
[-2] = 'file', -- Media namespace
}
-- This table holds the namespaces to be looked up from cfg.pagetypes by
-- default.
cfg.defaultNamespaces = {
[0] = true, -- main
[6] = true, -- file
[10] = true, -- template
[14] = true, -- category
[828] = true, -- module
}
-- This table holds the namespaces to be looked up from cfg.pagetypes if
-- cfg.defaultnsExtended is set.
cfg.extendedNamespaces = {
[0] = true, -- main
[2] = true, -- user
[4] = true, -- project
[6] = true, -- file
[8] = true, -- mediawiki
[10] = true, -- template
[12] = true, -- help
[14] = true, -- category
[100] = true, -- portal
[118] = true, -- draft
[828] = true, -- module
}
-- This table holds custom aliases for each namespace.
cfg.customNamespaceAliases = {
[0] = {'main'},
}
-- The parameter name to set which default namespace values to be looked up from
-- cfg.pagetypes.
cfg.defaultns = 'defaultns'
-- The value of cfg.defaultns to set all namespaces, including talk.
cfg.defaultnsAll = 'all'
-- The value of cfg.defaultns to set the namespaces listed in
-- cfg.extendedNamespaces
cfg.defaultnsExtended = 'extended'
-- The value of cfg.defaultns to set no default namespaces.
cfg.defaultnsNone = 'none'
-- The parameter name to use for talk pages.
cfg.talk = 'talk'
-- The default value for talk pages.
cfg.talkDefault = 'talk page'
-- The parameter name to use for disambiguation pages page.
cfg.dab = 'dab'
-- The parameter name to use for non-existent pages.
cfg.ne = 'nonexistent'
cfg.neDefault = 'page'
cfg.softRedirect = 'soft_redirect'
cfg.softRedirectDefault = 'redirect'
cfg.sia = 'sia'
cfg.siaDefault = 'article'
cfg.rfd = 'redirect'
cfg.rfdDefault = 'redirect'
-- This table holds the different possible aliases for disambiguation-class
-- pages. These should be lower-case.
cfg.dabAliases = {
['disambiguation'] = true,
['disambig'] = true,
['disamb'] = true,
['dab'] = true,
}
-- The default value for disambiguation pages.
cfg.dabDefault = 'page'
-- The parameter name to use for N/A-class page.
cfg.na = 'na'
-- This table holds the different possible aliases for N/A-class pages. These
-- should be lower-case.
cfg.naAliases = {
['na'] = true,
['n/a'] = true,
}
-- The default value for N/A-class pages.
cfg.naDefault = 'page'
-- The parameter name to use for redirects.
cfg.redirect = 'redirect'
-- The default value to use for redirects.
cfg.redirectDefault = 'redirect'
-- The parameter name for undefined namespaces.
cfg.other = 'other'
-- The value used if the module detects an undefined namespace.
cfg.otherDefault = 'page'
-- The usual suffix denoting a plural.
cfg.plural = 's'
-- This table holds plurals not formed by a simple suffix.
cfg.irregularPlurals = {
["category"] = "categories"
}
--------------------------------------------------------------------------------
-- End configuration data --
--------------------------------------------------------------------------------
return cfg -- Don't edit this line
dbot8rq8sjl2bypo7kiymiyo4gxz08i
Шаблон:Str number/trim
10
3737
21991
2024-01-16T16:33:34Z
Xaosflux
146
Changed protection settings for "[[Template:Str number/trim]]": [[WP:High-risk templates|High-risk template or module]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
21991
wikitext
text/x-wiki
{{#invoke:String|match|s={{{1}}}|^%d*|ignore_errors=true}}<noinclude>
{{Documentation}}</noinclude>
6uvyf0id6y3oxzmtxrw3akau6ajubki
21992
21991
2026-09-18T15:20:10Z
Amire80
9
1 измена увезена из [[:en:Template:Str_number/trim]]: importing from the English Wikipedia
21991
wikitext
text/x-wiki
{{#invoke:String|match|s={{{1}}}|^%d*|ignore_errors=true}}<noinclude>
{{Documentation}}</noinclude>
6uvyf0id6y3oxzmtxrw3akau6ajubki
Шаблон:Tick
10
3738
21993
2023-06-27T05:39:15Z
Jonesey95
2757
Fix [[Special:LintErrors|Linter]] errors. (bogus image options). strip trailing "px" off size parameter if present
21993
wikitext
text/x-wiki
[[{{ safesubst:<noinclude/>#switch:{{ safesubst:<noinclude/>lc:{{{color|{{{colour|}}}}}} }}
|green |grn |gn =File:Yes check.svg
|lightgreen |lgreen |lgrn |lgn =File:Light green check.svg
|red |rd |r =File:Red check.svg
|darkred |dkred |drd |dr =File:Check-188-25-49-red.svg
|pink |pnk |pk =File:Pink check.svg
|orange |or |o =File:Check.svg
|yellow |yel |y =File:Yellow check.svg
|black |blk |k =File:Black check.svg
|blue |blu |u =File:Check-blue.svg
|lightblue |lblue |lblu |lb =File:Cornflower blue check.svg
|cyan |cy |c =File:B-check.svg
|purple |pur |pu =File:Purple check.svg
|grey |gray |gry |gy =File:SemiTransBlack v.svg
|brown |brn |bn =File:Brown check.svg
<!--default--> |File:Yes check.svg
}}|{{ safesubst:<noinclude/>#if:{{{1|}}}|{{Str number/trim|{{{1}}}}}|20}}px|link=|alt={{#if:{{{alt|}}}|{{{alt}}}|check}}]]<span style="display:none">Y</span><!--template:tick--><noinclude>
{{documentation}}
</noinclude>
4y5n5eof1r959mn4xf1un5kmer0dn4j
21994
21993
2026-09-18T15:20:10Z
Amire80
9
1 измена увезена из [[:en:Template:Tick]]: importing from the English Wikipedia
21993
wikitext
text/x-wiki
[[{{ safesubst:<noinclude/>#switch:{{ safesubst:<noinclude/>lc:{{{color|{{{colour|}}}}}} }}
|green |grn |gn =File:Yes check.svg
|lightgreen |lgreen |lgrn |lgn =File:Light green check.svg
|red |rd |r =File:Red check.svg
|darkred |dkred |drd |dr =File:Check-188-25-49-red.svg
|pink |pnk |pk =File:Pink check.svg
|orange |or |o =File:Check.svg
|yellow |yel |y =File:Yellow check.svg
|black |blk |k =File:Black check.svg
|blue |blu |u =File:Check-blue.svg
|lightblue |lblue |lblu |lb =File:Cornflower blue check.svg
|cyan |cy |c =File:B-check.svg
|purple |pur |pu =File:Purple check.svg
|grey |gray |gry |gy =File:SemiTransBlack v.svg
|brown |brn |bn =File:Brown check.svg
<!--default--> |File:Yes check.svg
}}|{{ safesubst:<noinclude/>#if:{{{1|}}}|{{Str number/trim|{{{1}}}}}|20}}px|link=|alt={{#if:{{{alt|}}}|{{{alt}}}|check}}]]<span style="display:none">Y</span><!--template:tick--><noinclude>
{{documentation}}
</noinclude>
4y5n5eof1r959mn4xf1un5kmer0dn4j
Шаблон:Cross
10
3739
21995
2026-07-03T03:08:44Z
Paine Ellsworth
2766
add [[WP:RCAT|rcat template]]s
21995
wikitext
text/x-wiki
#REDIRECT [[Template:Xmark]]
{{Redirect category shell|
{{R with Wikidata item}}
{{R from move}}
{{R from alternative name}}
{{R from template shortcut}}
}}
pzx1ocemkeqxqshel014w7dtfhp17vz
21996
21995
2026-09-18T15:20:10Z
Amire80
9
1 измена увезена из [[:en:Template:Cross]]: importing from the English Wikipedia
21995
wikitext
text/x-wiki
#REDIRECT [[Template:Xmark]]
{{Redirect category shell|
{{R with Wikidata item}}
{{R from move}}
{{R from alternative name}}
{{R from template shortcut}}
}}
pzx1ocemkeqxqshel014w7dtfhp17vz
Шаблон:Xmark
10
3740
21997
2026-08-15T14:49:09Z
Paine Ellsworth
2766
per edit request on talk page - include light brown
21997
wikitext
text/x-wiki
[[{{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}lc:{{{color|{{{colour|}}}}}} }}
|red |rd |r =File:X mark.svg
|darkred |dkred |drd |dr =File:Dark red x.svg
|orange |or |o =File:Orange x.svg
|yellow |yel |y =File:Dark yellow x.svg
|lightbrown |lbr |lb =File:Light brown x.svg
|black |blk |k =File:Black x.svg
|grey |gray |gry |gy =File:SemiTransBlack x.svg
<!--default--> |File:X mark.svg
}}|{{Str number/trim|{{ {{{|safesubst:}}}#if:{{{1|}}}|{{{1}}}|20}}}}px|link=|alt=X mark]]<span style="display:none">N</span><!--template:Xmark--><noinclude>
{{documentation}}
</noinclude>
qf2x6lw33ss2o1dll4p07cpm84wxnk9
21998
21997
2026-09-18T15:20:11Z
Amire80
9
1 измена увезена из [[:en:Template:Xmark]]: importing from the English Wikipedia
21997
wikitext
text/x-wiki
[[{{ {{{|safesubst:}}}#switch:{{ {{{|safesubst:}}}lc:{{{color|{{{colour|}}}}}} }}
|red |rd |r =File:X mark.svg
|darkred |dkred |drd |dr =File:Dark red x.svg
|orange |or |o =File:Orange x.svg
|yellow |yel |y =File:Dark yellow x.svg
|lightbrown |lbr |lb =File:Light brown x.svg
|black |blk |k =File:Black x.svg
|grey |gray |gry |gy =File:SemiTransBlack x.svg
<!--default--> |File:X mark.svg
}}|{{Str number/trim|{{ {{{|safesubst:}}}#if:{{{1|}}}|{{{1}}}|20}}}}px|link=|alt=X mark]]<span style="display:none">N</span><!--template:Xmark--><noinclude>
{{documentation}}
</noinclude>
qf2x6lw33ss2o1dll4p07cpm84wxnk9
United Kingdom
0
3741
21999
2026-09-18T09:27:14Z
Moxy
2820
/* See also */ trim
21999
wikitext
text/x-wiki
{{Short description|Country in northwestern Europe}}
{{Hatnote|"UK" redirects here. For other uses, see [[UK (disambiguation)]] and [[United Kingdom (disambiguation)]]. Not to be confused with [[England]] or [[Great Britain]].}}
{{pp-sock|small=yes}}
{{pp-move|small=yes}}
{{Use British English|date=April 2012}}
{{Use dmy dates|date=September 2026}}
{{Infobox country
| common_name = United Kingdom
| linking_name = the United Kingdom<!--Note: "the" required here as this entry used to create wikilinks-->
| conventional_long_name = United Kingdom of Great Britain and Northern Ireland
| image_flag = Flag of the United Kingdom (1-2).svg
| flag_type = [[Union Jack|Flag]]
| alt_flag = A flag composed of a red cross edged in white and superimposed on a red saltire, also edged in white, superimposed on a white saltire on a blue background
| image_coat =
| other_symbol = [[File:Coat of arms of the United Kingdom (2022, both variants).svg|250px]]<br />Used in relation to [[Scotland]] (right) and elsewhere (left)
| other_symbol_type = [[Coat of arms of the United Kingdom|Coat of arms]]:
| national_anthem = "[[God Save the King]]"{{Efn|"God Save the King" is the [[national anthem]] by custom, not statute, and there is no authorised version. Typically only the first verse is usually sung, although the second verse is also often sung as well at state and public events.<ref>{{Cite web |title=National Anthem |url=https://www.royal.uk/encyclopedia/national-anthem |access-date=10 April 2024 |website=The Royal Family |archive-date=20 May 2024 |archive-url=https://web.archive.org/web/20240520130352/https://www.royal.uk/encyclopedia/national-anthem |url-status=live}}</ref> The words ''King, he, him, his'', used at present, are replaced by ''Queen, she, her'' when the monarch is female.}}<br /><div style="display:inline-block;margin-top:0.4em;">[[File:United States Navy Band - God Save the Queen.ogg|God Save the King / Queen <!-- Do not change file name due to computer error without ensuring that the file is playable. -->]]</div>
| image_map = {{Switcher|[[File:Europe-UK (orthographic projection).svg|upright=1.15|frameless]]|Show globe|[[File:Europe-UK.svg|upright=1.15|frameless]]|Show map of Europe|[[File:United Kingdom (+overseas territories and crown dependencies) in the World (+Antarctica claims).svg|upright=1.15|frameless]]|Show [[British Overseas Territories]] and [[Crown Dependencies]]|[[File:Territorial waters - United Kingdom.svg|upright=1.15|frameless]]|Show [[Exclusive economic zone of the United Kingdom|their exclusive economic zones]]|default=1}}
| map_caption =
| capital = [[London]]
| coordinates = {{Coord|51|30|N|0|7|W|type:city(9,100,000)_region:GB-LND}}
| largest_city = capital
| languages_type = [[National language]]
| languages = [[English language|English]] <!--Note: Just English, don't add "British English".-->
| languages2_type = Regional and minority languages{{Efn|Scots, Ulster Scots, Welsh, Cornish, Scottish Gaelic and Irish are classed as [[Regional language|regional]] or [[Minority language|minority]] languages under the [[Council of Europe]]'s [[European Charter for Regional or Minority Languages]].<ref name="reglang">{{Cite web |title=List of declarations made with respect to treaty No. 148 |url=http://conventions.coe.int/treaty/Commun/ListeDeclarations.asp?CL=ENG&NT=148&VL=1 |access-date=12 December 2013 |publisher=[[Council of Europe]] |archive-date=12 December 2013 |archive-url=https://web.archive.org/web/20131212175720/http://conventions.coe.int/treaty/Commun/ListeDeclarations.asp?CL=ENG&NT=148&VL=1 |url-status=dead}}</ref> These include defined obligations to promote those languages.<ref>{{Cite web |title=Welsh language on GOV.UK – Content design: planning, writing and managing content – Guidance |url=https://www.gov.uk/guidance/content-design/welsh-language-on-gov-uk |access-date=3 August 2018 |website=gov.uk |archive-date=4 August 2018 |archive-url=https://web.archive.org/web/20180804014121/https://www.gov.uk/guidance/content-design/welsh-language-on-gov-uk |url-status=live |postscript=;}} {{Cite news |title=Welsh language scheme |work=GOV.UK |url=https://www.gov.uk/government/organisations/department-for-transport/about/welsh-language-scheme |access-date=3 August 2018 |archive-date=4 August 2018 |archive-url=https://web.archive.org/web/20180804014119/https://www.gov.uk/government/organisations/department-for-transport/about/welsh-language-scheme |url-status=live |postscript=;}} {{Cite news |title=Welsh language scheme |work=GOV.UK |url=https://www.gov.uk/government/organisations/home-office/about/welsh-language-scheme |access-date=3 August 2018 |archive-date=2 August 2018 |archive-url=https://web.archive.org/web/20180802010917/https://www.gov.uk/government/organisations/home-office/about/welsh-language-scheme |url-status=live}}</ref> See also [[Languages of the United Kingdom]]. Welsh has limited ''[[de jure]]'' official status in Wales, as well as in the provision of national government services provided for Wales.}}
| languages2 = {{Hlist
<!--Anglic-->
| [[Scots language|Scots]]
| [[Ulster Scots dialects|Ulster Scots]]
<!--Brittonic-->
| [[Welsh language|Welsh]]
| [[Cornish language|Cornish]]
<!--Goidelic-->
| [[Scottish Gaelic]]<!--Keep "Scottish Gaelic"; people will find "Gaelic" confusing, as the Irish language is also commonly called "Gaelic"-->
| [[Irish language|Irish]]
<!--BANZSL-->
| [[British Sign Language]]
}}
| ethnic_groups = {{unbulleted list
| 83.1% [[White people in the United Kingdom|White]]
| 8.6% [[British Asian|Asian]]
| 3.7% [[Black British|Black]]
| 2.7% [[Mixed (United Kingdom ethnicity category)|Mixed]]
| 2.0% [[Ethnic groups in the United Kingdom|other]]
}}
| ethnic_groups_year = 2021
| ethnic_groups_ref = {{Efn|name=UK-wide2021|Whereas the censuses of England and Wales and of Northern Ireland went ahead as planned in 2021, the census in Scotland was postponed until 2022. The Office for National Statistics reports that these UK-wide statistics "have been created to provide an image of how UK census data may have looked if the most recent UK censuses had been conducted with an aligned date of 21 March 2021".}}<ref name=Ethnicity2021>{{cite web|url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/censusbasedstatisticsuk2021|title=Table 06: UK06 - Ethnic group by sex by age, United Kingdom|work=Census-based statistics UK: 2021|publisher=Office for National Statistics|date=27 June 2025|access-date=28 March 2026}}</ref>
| religion = {{unbulleted list
| 46.6% [[Religion in the United Kingdom#Christianity|Christianity]]
| 37.6% [[Irreligion in the United Kingdom|no religion]]
| 6.0% [[Islam in the United Kingdom|Islam]]
| 1.6% [[Hinduism in the United Kingdom|Hinduism]]
| 2.2% [[Religion in the United Kingdom|other]]
| 5.9% not stated
}}
| religion_year = 2021
| religion_ref = {{Efn|name=UK-wide2021}}<ref name=Religion2021>{{cite web|url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/censusbasedstatisticsuk2021|title=Table 07: UK07 - Religion by sex by age, United Kingdom|work=Census-based statistics UK: 2021|publisher=Office for National Statistics|date=27 June 2025|access-date=28 March 2026}}</ref>
| demonym = {{hlist |[[British people|British]] |Briton |Brit (colloquial) }}
| government_type = Unitary [[Westminster parliamentary system|parliamentary constitutional monarchy]]{{Efn|Although the United Kingdom has traditionally been seen as a [[unitary state]], an alternative description of the UK as a "union state", put forward by, amongst others, [[Vernon Bogdanor]],<ref>{{Cite book |last=Bradbury |first=Jonathan |url=https://books.google.com/books?id=c3QWEAAAQBAJ&q=%2522union+state%2522+UK+unitary&pg=PA19 |title=Constitutional Policy and Territorial Politics in the UK: Volume 1: Union and Devolution 1997–2012 |date=2021 |publisher=Policy Press |isbn=978-1-5292-0588-6 |pages=19–20 |access-date=3 October 2021 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002204328/https://books.google.com/books?id=c3QWEAAAQBAJ&q=%2522union+state%2522+UK+unitary&pg=PA19#v=onepage&q=%2522union%20state%2522%20UK%20unitary&f=false |url-status=live}}</ref> has become increasingly influential since the adoption of devolution in the 1990s.<ref>{{Cite book |last=Leith |first=Murray Stewart |url=https://books.google.com/books?id=PeBvAAAAQBAJ&q=Uk+%2522unitary+state%2522&pg=PA39 |title=Political Discourse and National Identity in Scotland |date=2012 |publisher=Edinburgh University Press |isbn=978-0-7486-8862-3 |page=39 |access-date=3 October 2021 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002204223/https://books.google.com/books?id=PeBvAAAAQBAJ&q=Uk+%2522unitary+state%2522&pg=PA39#v=onepage&q=Uk%20%2522unitary%20state%2522&f=false |url-status=live}}</ref> A union state is considered to differ from a unitary state in that while it maintains a central authority it also recognises the authority of historic rights and infrastructures of its component parts.<ref>{{Cite book |last1=Gagnon |first1=Alain-G. |url=https://books.google.com/books?id=g0ahE2fTxS0C&q=%2522union+state%2522+UK+unitary&pg=PA47 |title=Multinational Democracies |last2=Tully |first2=James |date=2001 |publisher=Cambridge University Press |isbn=978-0-521-80473-8 |page=47 |access-date=3 October 2021 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002204329/https://books.google.com/books?id=g0ahE2fTxS0C&q=%2522union+state%2522+UK+unitary&pg=PA47#v=onepage&q=%2522union%20state%2522%20UK%20unitary&f=false |url-status=live |postscript=;}} {{Cite book |last=Bogdanor |first=Vernon |title=Constitutional Reform in the United Kingdom: Practice and Principles |date=1998 |publisher=Hart Publishing |isbn=978-1-901362-84-8 |editor-last=Beatson |editor-first=Jack |location=Oxford |page=18 |chapter=Devolution: the Constitutional Aspects |chapter-url=https://books.google.com/books?id=YEEgDsCYmbQC&q=%2522union+state%2522+UK+unitary&pg=PA18}}</ref>}}
| leader_title1 = [[Monarchy of the United Kingdom|Monarch]]
| leader_name1 = [[Charles III]]
| leader_title2 = [[Prime Minister of the United Kingdom|Prime Minister]]
| leader_name2 = [[Andy Burnham]]
| legislature = [[Parliament of the United Kingdom|Parliament]]
| upper_house = [[House of Lords]]
| lower_house = [[House of Commons of the United Kingdom|House of Commons]]
| sovereignty_type = [[Formation of the United Kingdom of Great Britain and Northern Ireland|Formation]]
| established_event1 = [[Laws in Wales Acts 1535 and 1542|Laws in Wales Acts]]
| established_date1 = 1535 and 1542
| established_event2 = [[Union of the Crowns]]
| established_date2 = 24 March 1603
| established_event3 = [[Treaty of Union]]
| established_date3 = 22 July 1706
| established_event4 = [[Acts of Union 1707|Acts of Union of England and Scotland]]
| established_date4 = 1 May 1707
| established_event5 = [[Acts of Union 1800|Acts of Union of Great Britain and Ireland]]
| established_date5 = 1 January 1801
| established_event6 = [[Irish Free State Constitution Act 1922|Irish Free State Constitution Act]]
| established_date6 = 6 December 1922
| area_label = Total{{efn|name=ONSArea|[[Office for National Statistics|ONS]] Standard Area Measurement, 'area to mean high water'. Excludes the [[Crown Dependencies]] and [[British Overseas Territories]].}}
| area_km2 = 244376
| area_footnote = <ref name="ONS Standard Area Measurement">{{cite web |url=https://geoportal.statistics.gov.uk/datasets/ons::standard-area-measurements-for-administrative-areas-december-2023-in-the-uk/about |title=Standard Area Measurements for Administrative Areas (December 2023) in the UK |author=<!--Not stated--> |date=31 May 2024 |website=[[ONS Open Geography Portal|Open Geography Portal]] |publisher=Office for National Statistics |access-date=7 June 2024 |archive-date=7 June 2024 |archive-url=https://web.archive.org/web/20240607052407/https://geoportal.statistics.gov.uk/datasets/ons::standard-area-measurements-for-administrative-areas-december-2023-in-the-uk/about |url-status=live}}</ref>
| area_rank = 78th
| area_sq_mi = auto
| area_label2 = Land{{efn|name=ONSLandArea|[[Office for National Statistics|ONS]] Standard Area Measurement, "area to mean high water excluding inland water". Excludes the [[Crown Dependencies]] and [[British Overseas Territories]].}}
| area_data2 = {{convert|{{UK subdivision area|GSS=K02000001}}|km2|sqmi|abbr=on}}<ref name="ONS mid-year pop est" />
| percent_water =
| population_estimate = {{IncreaseNeutral}} {{UK subdivision population|GSS=K02000001}}<ref name="ONS mid-year pop est">{{UK subdivision statistics citation}}</ref>
| population_estimate_year = {{UK subdivision statistics year}}
| population_estimate_rank = 20th
| population_census = {{IncreaseNeutral}} 66,912,637{{Efn|name=UK-wide2021}}<ref name=Ethnicity2021/>
| population_census_year = 2021
| population_census_rank =
| population_density_km2 = {{UK subdivision density|GSS=K02000001}}
| population_density_sq_mi = auto
| population_density_rank = 48th
| pop_den_footnote = <ref name="ONS mid-year pop est" />
| GDP_PPP = {{increase}} $4.721 trillion<ref name="IMFWEO.UK">{{cite web |url=https://data.imf.org/en/Data-Explorer?datasetUrn=IMF.RES:WEO(9.0.0) |title=World Economic Outlook Database (April 2026 Edition) |publisher=[[International Monetary Fund]] |website=www.imf.org |date=14 April 2026 |access-date=18 April 2026}}</ref>
| GDP_PPP_year = 2026
| GDP_PPP_rank = 10th
| GDP_PPP_per_capita = {{increase}} $67,585<ref name="IMFWEO.UK" />
| GDP_PPP_per_capita_rank = 33rd
| GDP_nominal = {{increase}} $4.265 trillion<ref name="IMFWEO.UK" />
| GDP_nominal_year = 2026
| GDP_nominal_rank = 5th
| GDP_nominal_per_capita = {{increase}} $61,056<ref name="IMFWEO.UK" />
| GDP_nominal_per_capita_rank = 21st
| Gini = 35.4
| Gini_year = 2021
| Gini_change = decrease
| Gini_ref = <ref>{{Cite web |title=Income inequality |url=https://data.oecd.org/inequality/income-inequality.htm |access-date=12 February 2024 |website=OECD Data |publisher=[[OECD]] |archive-date=1 July 2022 |archive-url=https://web.archive.org/web/20220701171540/https://data.oecd.org/inequality/income-inequality.htm |url-status=live}}</ref>
| HDI = 0.946<!--number only-->
| HDI_year = 2023<!-- Please use the year to which the data refers, not the publication year.-->
| HDI_change = increase<!--increase/decrease/steady-->
| HDI_ref = <ref name="UNHDR">{{Cite web |date=6 May 2025 |title=Human Development Report 2025 |url=https://hdr.undp.org/system/files/documents/global-report-document/hdr2025reporten.pdf |url-status=live |archive-url=https://web.archive.org/web/20250506051232/https://hdr.undp.org/system/files/documents/global-report-document/hdr2025reporten.pdf |archive-date=6 May 2025 |access-date=6 May 2025 |publisher=[[United Nations Development Programme]] |language=en}}</ref>
| HDI_rank = 13th
| currency = [[Pound sterling|Sterling]]<!--The currency is simply called 'sterling' (see its article); originally, the penny (not the pound) was the primary unit. Internationally it is known as 'pound sterling' so the familiar unit is mentioned.-->{{Efn|Commonly also known as the "pound" (the name of [[pound (currency)|its base unit]]) or "pound sterling". Some of the devolved countries, [[Crown Dependency|Crown Dependencies]] and [[British Overseas Territory|British Overseas Territories]] issue their own sterling banknotes or currencies, or use another nation's currency. See [[List of British currencies]].}} ([[£]])
| currency_code = GBP
| utc_offset = +0
| time_zone = [[Greenwich Mean Time|GMT]]
| utc_offset_DST = +1
| time_zone_DST = [[British Summer Time|BST]]{{Efn|Also observed by the [[Crown Dependencies]]. For further information, see [[Time in the United Kingdom]].}}
| DST_note =
| date_format = {{Abbr|dd|day}}/{{Abbr|mm|month}}/{{Abbr|yyyy|year}} ([[Anno Domini|AD]]){{efn|The UK Government uses the [[ISO 8601]] format, {{Abbr|yyyy|year}}-{{Abbr|mm|month}}-{{Abbr|dd|day}}, for machine-readable dates and times.<ref>{{cite web |title=Formatting dates and times in data |url=https://www.gov.uk/government/publications/open-standards-for-government/date-times-and-time-stamps-standard |date=9 August 2022 |website=[[gov.uk]] |publisher=[[Government of the United Kingdom|HM Government]] |access-date=1 June 2024 |archive-date=9 May 2024 |archive-url=https://web.archive.org/web/20240509092813/https://www.gov.uk/government/publications/open-standards-for-government/date-times-and-time-stamps-standard |url-status=live}}</ref> See [[Date and time notation in the United Kingdom]].}}
| calling_code = [[Telephone numbers in the United Kingdom|+44]]{{Efn|Excludes most overseas territories. See [[Telephone numbers in the United Kingdom#Telephone numbers in Overseas Territories]].}}
| cctld = [[.uk]]{{Efn|The [[.gb]] domain is also reserved for the UK, but has been little used.}}
}}
The '''United Kingdom of Great Britain and Northern Ireland''', commonly known as the '''United Kingdom''' ('''UK''') or '''Britain''',<!--DO NOT CHANGE ORDER OF INTRO WITHOUT CONSENSUS-->{{Efn|Usage is mixed. ''[[The Guardian]]''<ref>{{Cite news |date=23 April 2021 |title=Guardian style guide: U |url=https://www.theguardian.com/guardian-style-guide-u |access-date=29 December 2025 |work=The Guardian |language=en-GB |issn=0261-3077}}</ref> and ''[[The Daily Telegraph|The Telegraph]]''<ref>{{Cite news |date=25 July 2025 |title=Places |url=https://www.telegraph.co.uk/style-book/places/ |access-date=29 December 2025 |work=The Telegraph |language=en-GB |issn=0307-1235 |archive-date=17 November 2025 |archive-url=https://web.archive.org/web/20251117111222/https://www.telegraph.co.uk/style-book/places/ |url-status=live }}</ref> use ''Britain'' as a synonym for the United Kingdom. The British [[Cabinet Office]]'s [[Government Digital Service]] style guide<ref>{{Cite web |title=Style guide - A to Z - Guidance - GOV.UK |url=https://www.gov.uk/guidance/style-guide/a-to-z#great-britain |access-date=2 January 2026 |website=www.gov.uk |language=en |archive-date=22 November 2024 |archive-url=https://web.archive.org/web/20241122222025/https://www.gov.uk/guidance/style-guide/a-to-z#great-britain |url-status=live }}</ref> for use on [[gov.uk]] recommends: "Use UK and United Kingdom in preference to Britain and British (UK business, UK foreign policy, ambassador and high commissioner). But British embassy, not UK embassy."}} is a country<!-- The term "country" was chosen as a result of a 2022 Request for Comment. Discuss potential changes on the talk page first. --> in [[northwestern Europe]], off the coast of [[European mainland|the continental mainland]]. It comprises [[England]], [[Scotland]], [[Wales]] and [[Northern Ireland]],{{efn|The [[Isle of Man]], [[Bailiwick of Guernsey|Guernsey]] and [[Jersey]] are [[Crown Dependencies]] and not part of the UK.}} with a population of over 69 million in 2024. The UK includes the island of [[Great Britain]], the north-eastern part of the island of [[Ireland]], and most of [[List of islands of the United Kingdom|the smaller islands]] within the [[British Isles]], covering {{Convert|244376|km2|sqmi|order=flip}}.{{efn|name=ONSArea}} It shares [[Republic of Ireland–United Kingdom border|a land border]] with the [[Republic of Ireland]] and is surrounded by the [[Atlantic Ocean]], the [[North Sea]], the [[English Channel]], the [[Celtic Sea]] and the [[Irish Sea]], while maintaining sovereignty over the [[Crown Dependencies]] and the [[British Overseas Territories]]. The capital and largest city of England and the UK is [[London]]; [[Edinburgh]], [[Cardiff]] and [[Belfast]] are the national capitals of Scotland, Wales and Northern Ireland, respectively.
The British Isles have been continuously inhabited since the [[Neolithic]]. In AD 43 the [[Roman conquest of Britain]] began. The [[end of Roman rule in Britain|Roman departure]] between 383 and 410 was followed by [[Anglo-Saxon settlement of Britain|Anglo-Saxon settlement]] beginning around 450. In 1066 the [[Norman Conquest|Normans conquered England]]. Over the 17th century the role of the [[British monarchy]] was reduced, particularly as a result of the [[English Civil War]]. In 1707 the Kingdom of England and the [[Kingdom of Scotland]] united under the [[Treaty of Union]] to create the [[Kingdom of Great Britain]]. The [[Acts of Union 1800]] incorporated the [[Kingdom of Ireland]] to create the [[United Kingdom of Great Britain and Ireland]] in 1801. Most of Ireland [[Partition of Ireland|seceded]] from the UK in 1922 as the [[Irish Free State]], and the [[Royal and Parliamentary Titles Act 1927]] created the present United Kingdom.
The UK [[History of industrialisation#Industrial Revolution in Europe|became the first industrialised country]] and was the world's [[foremost power]] for the majority of the 19th and early 20th centuries, particularly during the ''[[Pax Britannica]]'' between 1815 and 1914. The [[British Empire]] was the leading [[economic power]] for most of the 19th century, a position supported by [[British Agricultural Revolution|its agricultural prosperity]], its role as a dominant [[trading nation]], a massive industrial capacity, [[List of British innovations and discoveries in the 19th century|significant technological achievements]], and the rise of [[19th-century London]] as the world's principal financial centre. At its height in the 1920s, the empire encompassed around a quarter of the world's landmass and population, and was the [[List of largest empires#Empires at their greatest extent|largest in history]]. However, [[History of the United Kingdom during the First World War|its involvement in the First World War]] and [[Military history of the United Kingdom during World War II|in the Second World War]] damaged [[Economy of the British Empire|Britain's economic power]], and a global wave of [[decolonisation]] led to the independence of most British colonies.
The UK is a [[constitutional monarchy]] and [[parliamentary democracy]]{{Efn|The United Kingdom does not have a codified constitution but an unwritten one formed of Acts of Parliament, court judgments, traditions, and conventions.<ref>{{Citation |title=What is the UK Constitution? |date=9 August 2018 |url=https://www.ucl.ac.uk/constitution-unit/what-uk-constitution/what-uk-constitution |publisher=The Constitution Unit of UCL |access-date=6 February 2020 |archive-date=7 November 2018 |archive-url=https://web.archive.org/web/20181107060057/http://www.ucl.ac.uk/constitution-unit/whatis/uk-constitution |url-status=live}}</ref>}} with three distinct jurisdictions: [[English law|England and Wales]], [[Scots law|Scotland]], and [[Law of Northern Ireland|Northern Ireland]]. Scotland, Wales and Northern Ireland have their own governments and parliaments which control various [[Devolution in the United Kingdom|devolved]] matters. A [[developed country]] with [[Economy of the United Kingdom|an advanced economy]], the UK ranks amongst the [[List of countries by GDP (nominal)|largest economies by nominal GDP]] and is one of the world's [[List of countries by exports|largest exporters]] and [[List of countries by imports|importers]]. As a [[nuclear state]] with one of the [[List of countries by military expenditures|highest defence budgets]], the UK maintains [[British Armed Forces|one of the strongest militaries in Europe]]. [[Culture of the United Kingdom|British culture]] is globally influential, notably in the [[Anglosphere]] and [[Commonwealth of Nations|the Commonwealth]]; [[Anglicisation|its soft power influence]] is observable in the legal and political systems of many [[List of countries that have gained independence from the United Kingdom|former colonies]], and in its exports [[English-speaking world|of language]], [[British literature|literature]], [[Theatre of the United Kingdom|theatre]], [[Cinema of the United Kingdom|cinema]], [[Music of the United Kingdom|music]], [[Mass media in the United Kingdom|media]], [[Art of the United Kingdom|art]] and [[Sport in the United Kingdom|sport]]. A [[great power]], the UK is part of [[Foreign relations of the United Kingdom#International organisations|numerous international organisations]].
== Etymology and terminology ==
{{Anchor|Etymology}}<!--linked-->
{{See also|Britain (place name)|Terminology of the British Isles}}
The [[Acts of Union 1707]] declared that the [[Kingdom of England]] and the [[Kingdom of Scotland]] were "United into One Kingdom by the Name of Great Britain".{{Efn|Compare to section 1 of both of the 1800 [[Acts of Union (1800)|Acts of Union]] which reads: "the kingdoms of Great Britain and Ireland shall{{spaces}}... be united into one kingdom, by the name of the United Kingdom of Great Britain and Ireland".}}<ref name="Acts of Union 1707">{{Cite web |title=The Treaty (act) of the Union of Parliament 1706 |url=http://www.scotshistoryonline.co.uk/union.html |archive-url=https://web.archive.org/web/20190527074630/http://www.scotshistoryonline.co.uk/union.html |archive-date=27 May 2019 |access-date=23 August 2011 |publisher=Scots History Online |postscript=;}} {{Cite book |last1=Barnett, Hilaire |url=https://books.google.com/books?id=LYc1tSYonrQC&pg=PA165 |title=Constitutional & Administrative Law |last2=Jago, Robert |publisher=Routledge |year=2011 |isbn=978-0-415-56301-7 |edition=8th |location=Abingdon |page=165 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328140722/https://books.google.com/books?id=LYc1tSYonrQC&pg=PA165 |url-status=live}}</ref> The term "United Kingdom" has occasionally been used for the former [[Kingdom of Great Britain]], although its official name from 1707 to 1800 was simply "Great Britain".<ref>"After the political union of England and Scotland in 1707, the nation's official name became 'Great Britain{{'"}}, ''The American Pageant, Volume 1'', Cengage Learning (2012); "From 1707 until 1801 ''Great Britain'' was the official designation of the kingdoms of England and Scotland". ''The Standard Reference Work: For the Home, School and Library, Volume 3'', Harold Melvin Stanford (1921); "In 1707, on the union with Scotland, 'Great Britain' became the official name of the British Kingdom, and so continued until the union with Ireland in 1801". ''United States Congressional serial set, Issue 10; Issue 3265'' (1895); {{Cite web |last=Gascoigne, Bamber |author-link=Bamber Gascoigne |title=History of Great Britain (from 1707) |url=http://www.historyworld.net/wrldhis/PlainTextHistories.asp?historyid=ab07 |access-date=18 July 2011 |publisher=History World |archive-date=27 May 2019 |archive-url=https://web.archive.org/web/20190527205230/http://www.historyworld.net/wrldhis/PlainTextHistories.asp?historyid=ab07 |url-status=live}}</ref> The [[Acts of Union 1800]] formed the [[United Kingdom of Great Britain and Ireland]]. Following the [[partition of Ireland]] and the independence of the [[Irish Free State]] in 1922, which left [[Northern Ireland]] as the only part of the island of Ireland within the United Kingdom, the name was changed in 1927 to the "United Kingdom of Great Britain and Northern Ireland".<ref>{{Cite book |last=Cottrell, P. |url=https://archive.org/details/irishcivilwar00cott_573 |title=The Irish Civil War 1922–23 |year=2008 |isbn=978-1-84603-270-7 |page=[https://archive.org/details/irishcivilwar00cott_573/page/n85 85] |publisher=Bloomsbury USA |url-access=limited}}</ref>
Although the United Kingdom is a sovereign country, England, Scotland, Wales and Northern Ireland are widely referred to as [[Countries of the United Kingdom|countries]].<ref>{{Citation |last1=S. Dunn |title=An Alphabetical Listing of Word, Name and Place in Northern Ireland and the Living Language of Conflict |year=2000 |place=[[Lewiston, New York]] |publisher=[[Edwin Mellen Press]] |quote=One specific problem – in both general and particular senses – is to know what to call Northern Ireland itself: in the general sense, it is not a country, or a province, or a state – although some refer to it contemptuously as a statelet: the least controversial word appears to be jurisdiction, but this might change. |last2=H. Dawson |postscript=;}} {{Cite web |date=15 December 2011 |title=Changes in the list of subdivision names and code elements |url=http://www.iso.org/iso/iso_3166-2_newsletter_ii-3_2011-12-13.pdf |access-date=28 May 2012 |website=ISO 3166-2 |publisher=International Organization for Standardization |archive-date=19 September 2016 |archive-url=https://web.archive.org/web/20160919073956/http://www.iso.org/iso/iso_3166-2_newsletter_ii-3_2011-12-13.pdf |url-status=live}}</ref> The UK Prime Minister's website has used the phrase "countries within a country" to describe it.<ref name="page823">{{Cite web |date=10 January 2003 |title=Countries within a country |url=http://www.number10.gov.uk/Page823 |archive-url=http://webarchive.nationalarchives.gov.uk/20080909013512/http://www.number10.gov.uk/Page823 |archive-date=9 September 2008 |access-date=8 March 2015 |publisher=Prime Minister's Office}}</ref> Some statistical summaries, such as those for the twelve [[NUTS of the United Kingdom|NUTS 1 regions]], refer to Scotland, Wales and Northern Ireland as "regions".<ref>{{Cite web |title=Statistical bulletin: Regional Labour Market Statistics |url=http://www.ons.gov.uk/ons/dcp171778_346117.xml |archive-url=https://web.archive.org/web/20141224045523/http://www.ons.gov.uk/ons/dcp171778_346117.xml |archive-date=24 December 2014 |access-date=5 March 2014 |postscript=;}} {{Cite web |title=13.4% Fall In Earnings Value During Recession |url=http://www.gmb.org.uk/newsroom/fall-in-earnings-value-during-recession |archive-url=https://web.archive.org/web/20140103194604/http://www.gmb.org.uk/newsroom/fall-in-earnings-value-during-recession |archive-date=3 January 2014 |access-date=5 March 2014}}</ref> Northern Ireland is also referred to as a "province".<ref>{{Cite book |last1=Dunn, Seamus |title=An Alphabetical Listing of Word, Name and Place in Northern Ireland and the Living Language of Conflict |last2=Dawson, Helen |publisher=[[Edwin Mellen Press]] |year=2000 |isbn=978-0-7734-7711-7 |location=[[Lewiston, New York]] |postscript=;}} {{Cite book |last=Murphy, Dervla |title=[[A Place Apart (Murphy book)|A Place Apart]] |publisher=Penguin |year=1979 |isbn=978-0-14-005030-1 |location=London}}</ref> With regard to Northern Ireland, the descriptive name used "can be controversial, with the choice often revealing one's political preferences".<ref>{{Cite book |last1=Whyte |first1=John |title=Interpreting Northern Ireland |last2=FitzGerald |first2=Garret |publisher=Clarendon Press |year=1991 |isbn=978-0-19-827380-6 |location=Oxford |author-link=John Henry Whyte |author-link2=Garret FitzGerald}}</ref>
The term "Great Britain" conventionally refers to the island of Great Britain, or politically to England, Scotland and Wales in combination.<ref>{{Cite news |date=19 December 2008 |title=Guardian Unlimited Style Guide |publisher=Guardian News and Media Limited |location=London |url=https://www.theguardian.com/styleguide/page/0,,184840,00.html |access-date=23 August 2011 |postscript=;}} {{Cite news |date=19 August 2002 |title=BBC style guide (Great Britain) |work=BBC News |url=http://news.bbc.co.uk/1/hi/programmes/radio_newsroom/1099593.stm#g |access-date=23 August 2011 |archive-date=15 February 2009 |archive-url=https://web.archive.org/web/20090215074832/http://news.bbc.co.uk/1/hi/programmes/radio_newsroom/1099593.stm#g |url-status=live |postscript=;}} {{Cite web |title=Key facts about the United Kingdom |url=http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_10012517 |archive-url=http://webarchive.nationalarchives.gov.uk/20121015000000/http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_10012517 |archive-date=15 October 2012 |access-date=8 March 2015 |website=Government, citizens and rights |publisher=HM Government}}</ref> It is sometimes used as a loose synonym for the United Kingdom as a whole.<ref>[[New Oxford American Dictionary]]: "Great Britain: England, Wales, and Scotland considered as a unit. The name is also often used loosely to refer to the United Kingdom."</ref> The word ''England'' is occasionally used incorrectly to refer to the United Kingdom as a whole, a mistake principally made by people from outside the UK.<ref>"When people say England, they sometimes mean Great Britain, sometimes the United Kingdom, sometimes the British Isles — but never England." — {{Citation |last=George Mikes |title=How To Be An Alien |year=1946 |publisher=Penguin}} {{ISBN|978-0-582-41686-4|postscript=;}} {{Cite web |title=England OR United Kingdom (UK)? {{!}} Vocabulary {{!}} EnglishClub |url=https://www.englishclub.com/vocabulary/cw-uk-england.htm |access-date=16 October 2022 |website=englishclub.com |archive-date=16 October 2022 |archive-url=https://web.archive.org/web/20221016192638/https://www.englishclub.com/vocabulary/cw-uk-england.htm |url-status=live}}</ref>
The term "Britain" is used as a synonym for [[Great Britain]],<ref>{{Cite web |title=Britain Meaning in the Cambridge English Dictionary |url=https://dictionary.cambridge.org/dictionary/english/britain |website=dictionary.cambridge.org |access-date=19 June 2018 |archive-date=20 June 2018 |archive-url=https://web.archive.org/web/20180620024348/https://dictionary.cambridge.org/dictionary/english/britain |url-status=live |postscript=;}} {{Cite web |title=Definition of Britain in English by Oxford Dictionaries |url=https://en.oxforddictionaries.com/definition/britain |archive-url=https://web.archive.org/web/20160926204707/https://en.oxforddictionaries.com/definition/britain |archive-date=26 September 2016 |website=Oxford Dictionaries – English}}</ref><ref name="Britain-Col">{{Cite web |title=Britain definition and meaning |url=https://www.collinsdictionary.com/dictionary/english/britain |website=collinsdictionary.com |publisher=Collins English Dictionary |access-date=19 June 2018 |archive-date=20 June 2018 |archive-url=https://web.archive.org/web/20180620024837/https://www.collinsdictionary.com/dictionary/english/britain |url-status=live}}</ref> but also sometimes for the United Kingdom.<ref>{{Cite web |title=Britain – Definition for English-Language Learners |url=http://learnersdictionary.com/definition/Britain |website=learnersdictionary.com |publisher=Merriam-Webster's Learner's Dictionary |access-date=19 June 2018 |archive-date=20 June 2018 |archive-url=https://web.archive.org/web/20180620024648/http://learnersdictionary.com/definition/Britain |url-status=live}}</ref><ref name="Britain-Col" /> Usage is mixed: the [[style guide]] of the [[Government of the United Kingdom|UK Government]] prefers the term "UK" rather than "Britain" or "British" (except when referring to embassies{{Efn|"UK" embassies became "British" embassies in 1961.<ref>{{Cite news |date=21 October 1961 |title='Cold U.K.' Becomes British |work=[[The Times]] |page=8}}</ref>}}),<ref>{{Cite web |date=21 November 2024 |orig-date=23 February 2016 |title=Style guide: A to Z |url=https://www.gov.uk/guidance/style-guide/a-to-z |url-status=live |archive-url=https://web.archive.org/web/20241122222025/https://www.gov.uk/guidance/style-guide/a-to-z |archive-date=22 November 2024 |publisher=UK Government}}</ref> while other government documents acknowledge that both terms refer to the United Kingdom and that elsewhere "British government" is used at least as frequently as "United Kingdom government".<ref name="PCGN-uk-guide">{{Cite web |last=Permanent Committee on Geographical Names |title=Toponymic guidelines for the United Kingdom |url=https://www.gov.uk/government/publications/toponymic-guidelines |website=gov.uk |date=17 May 2023 |publisher=UK Government |access-date=17 June 2018 |archive-date=17 June 2018 |archive-url=https://web.archive.org/web/20180617165832/https://www.gov.uk/government/publications/toponymic-guidelines |url-status=live}}</ref> The UK [[Permanent Committee on Geographical Names for British Official Use|Permanent Committee on Geographical Names]] recognises "United Kingdom", "UK" and "U.K." as shortened and abbreviated geopolitical terms for the United Kingdom of Great Britain and Northern Ireland in its toponymic guidelines; it does not list "Britain" but notes that "it is only the one specific nominal term 'Great Britain' which invariably excludes Northern Ireland".<ref name="PCGN-uk-guide" /> The [[BBC]] historically preferred to use "Britain" as shorthand only for Great Britain, though the present style guide does not take a position except that "Great Britain" excludes Northern Ireland.<ref>{{Cite web |title=BBC News style guide – Names |url=https://www.bbc.co.uk/academy/en/articles/art20130702112133537 |archive-url=https://web.archive.org/web/20191110082858/https://www.bbc.co.uk/academy/en/articles/art20130702112133537 |archive-date=10 November 2019 |access-date=9 November 2019 |website=BBC Academy |publisher=BBC |postscript=;}} {{Cite web |title=Alphabetical checklist |url=https://www.bbc.co.uk/academy/journalism/news-style-guide/article/art20130702112133551 |archive-url=https://web.archive.org/web/20180326162901/http://www.bbc.co.uk/academy/journalism/news-style-guide/article/art20130702112133551 |archive-date=26 March 2018 |access-date=17 June 2018 |website=BBC News |publisher=BBC}}</ref>
The adjective "British" is commonly used to refer to matters relating to the United Kingdom and is used in law to refer to United Kingdom citizenship and [[British nationality law|nationality]].<ref>{{Cite book |last1=Bradley, Anthony Wilfred |url=https://books.google.com/books?id=HT_GS2zgN5QC&pg=PA36 |title=Constitutional and administrative law |last2=Ewing, Keith D. |publisher=Pearson Longman |year=2007 |isbn=978-1-4058-1207-8 |edition=14th |volume=1 |location=Harlow |page=36 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328140723/https://books.google.com/books?id=HT_GS2zgN5QC&pg=PA36 |url-status=live}}</ref>{{Efn|Historically, the term ''British'' was used to refer to members and institutions within the British Empire and later Commonwealth and was not limited to the geographical British Isles. The UK Government adopted the term for its exclusive use only in 1961, but in recognition of its wider usage first sought the prior consent of Australia, Canada and New Zealand.<ref>{{Cite book |last1=Curran |first1=James |title=The Unknown Nation: Australia after Empire |last2=Ward |first2=Stuart |date=2010 |publisher=Melbourne University Publishing |isbn=978-0-522-85645-3 |location=Carlton, Vic |pages=26–7}}</ref><ref>{{Cite book |last=Ward |first=Stuart |title=Untied kingdom: A Global History of the End of Britain |date=2023 |publisher=Cambridge University Press |isbn=978-1-107-14599-3 |at=Chapter 1}}</ref>}} People of the United Kingdom use several different terms to describe their national identity and may identify themselves as being [[British people|British]], [[English people|English]], [[Scottish people|Scottish]], [[Welsh people|Welsh]], [[People of Northern Ireland|Northern Irish]] or [[Irish people|Irish]];<ref>{{Cite web |year=2010 |title=Which of these best describes the way you think of yourself? |url=http://www.ark.ac.uk/nilt/2010/Community_Relations/NINATID.html |access-date=1 July 2010 |website=Northern Ireland Life and Times Survey 2010 |publisher=ARK – Access Research Knowledge |archive-date=23 September 2015 |archive-url=https://web.archive.org/web/20150923175111/http://www.ark.ac.uk/nilt/2010/Community_Relations/NINATID.html |url-status=live}}</ref> or as having a combination of different national identities.<ref>{{Cite web |title=Ethnicity and National Identity in England and Wales |url=https://www.ons.gov.uk/peoplepopulationandcommunity/culturalidentity/ethnicity/articles/ethnicityandnationalidentityinenglandandwales/2012-12-11 |access-date=25 June 2020 |website=Office for National Statistics |archive-date=21 January 2022 |archive-url=https://web.archive.org/web/20220121012603/https://www.ons.gov.uk/peoplepopulationandcommunity/culturalidentity/ethnicity/articles/ethnicityandnationalidentityinenglandandwales/2012-12-11 |url-status=live |postscript=;}} {{Cite book |last=Schrijver, Frans |url=https://books.google.com/books?id=u8gZklxHTMUC&pg=PA275 |title=Regionalism after regionalisation: Spain, France and the United Kingdom |publisher=Amsterdam University Press |year=2006 |isbn=978-90-5629-428-1 |pages=275–277 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328140905/https://books.google.com/books?id=u8gZklxHTMUC&pg=PA275#v=onepage&q&f=false |url-status=live}}</ref>
== History ==
{{Main|Formation of the United Kingdom of Great Britain and Northern Ireland|History of the British Isles}}
{{Further|History of the constitution of the United Kingdom|Timeline of British history}}
=== Prior to the Treaty of Union ===
{{Main|History of England|History of Wales|History of Scotland|History of Ireland}}
{{further|Kingdom of England|Kingdom of Scotland}}
[[File:Stonehenge2007 07 30.jpg|thumb|[[Stonehenge]] in [[Wiltshire]] is a ring of stones, each about {{Cvt|13|ft|0|order=flip}} high, {{Cvt|7|ft|0|order=flip}} wide and 25 [[tonne]]s, erected 2400–2200 BC.]]
Settlement by [[Cro-Magnon]]s of what is now the United Kingdom occurred in waves beginning by about 30,000 years ago.<ref>[http://news.bbc.co.uk/1/hi/wales/south_west/7069001.stm "Ancient skeleton was 'even older'] {{Webarchive|url=https://web.archive.org/web/20210213081240/http://news.bbc.co.uk/2/hi/uk_news/wales/south_west/7069001.stm |date=13 February 2021}}". [[BBC News]]. 30 October 2007. Retrieved 27 April 2011.</ref> The island has been continuously inhabited since the last retreat of ice around 11,500 years ago.<ref>{{Cite web |date=9 February 2018 |title=A 12,000-year story - revealing the history of settlers in Britain from the end of the Ice Age to the present day {{!}} University of Oxford |url=https://www.ox.ac.uk/news/2018-02-09-12000-year-story-revealing-history-settlers-britain-end-ice-age-present-day |access-date=6 July 2025 |website=ox.ac.uk |language=en }}{{Dead link|date=May 2026 |bot=InternetArchiveBot }}</ref> By the end of the [[Prehistoric Britain|region's prehistoric period]], the population is thought to have belonged largely to a culture termed [[Insular Celts|Insular Celtic]], comprising [[Britons (historical)|Brittonic Britain]] and [[Gaelic Ireland]].<ref>{{Cite book |last=Koch, John T. |url=https://archive.org/details/celticculturehis00koch_128 |title=Celtic culture: A historical encyclopedia |publisher=ABC-CLIO |year=2006 |isbn=978-1-85109-440-0 |location=Santa Barbara, CA |page=[https://archive.org/details/celticculturehis00koch_128/page/n1016 973] |url-access=limited}}</ref>
The [[Roman conquest of Britain|Roman conquest]], beginning in AD 43, and the 400-year [[Roman Britain|rule of southern Britain]], was followed by an invasion by [[Germanic peoples|Germanic]] [[Anglo-Saxon]] settlers, reducing the Brittonic area mainly [[Wales#Post-Roman era|to what was to become Wales]], [[Cornwall]] and, until the latter stages of the Anglo-Saxon settlement, the [[Hen Ogledd]] (northern England and parts of southern Scotland).<ref>{{Cite book |title=[[Encyclopaedia of Wales|The Welsh Academy Encyclopaedia of Wales]] |publisher=University of Wales Press |year=2008 |isbn=978-0-7083-1953-6 |editor-last=Davies |editor-first=John |editor-link=John Davies (historian) |location=Cardiff |page=915 |editor-last2=Jenkins |editor-first2=Nigel |editor-link2=Nigel Jenkins |editor-last3=Baines |editor-first3=Menna |editor-last4=Lynch |editor-first4=Peredur I. |editor-link4=Peredur Lynch}}</ref> Most of the [[Anglo-Saxon England|region settled by the Anglo-Saxons]] became unified as the Kingdom of England in the 10th century.<ref>{{Cite magazine |title=Short Athelstan biography |url=https://www.bbc.co.uk/history/historic_figures/athelstan.shtml |magazine=BBC History |access-date=9 April 2013 |archive-date=13 February 2007 |archive-url=https://web.archive.org/web/20070213191353/http://www.bbc.co.uk/history/historic_figures/athelstan.shtml |url-status=live}}</ref> [[Dál Riata|Gaelic speakers in north-west Britain]] (with connections to the north-east of Ireland and traditionally supposed to have migrated from there in the 5th century)<ref>{{Cite book |last=Mackie, J.D. |url=https://archive.org/details/historyofscotlan00mack_0/page/18 |title=A History of Scotland |publisher=Penguin |year=1991 |isbn=978-0-14-013649-4 |location=London |pages=[https://archive.org/details/historyofscotlan00mack_0/page/18 18–19] |author-link=J.D. Mackie |postscript=;}} {{Cite book |last=Campbell |first=Ewan |title=Saints and Sea-kings: The First Kingdom of the Scots |publisher=Canongate |year=1999 |isbn=978-0-86241-874-8 |location=Edinburgh |pages=8–15}}</ref> united with the [[Picts]] to create the [[Kingdom of Scotland]] in the 9th century.<ref>{{Cite book |last=Haigh |first=Christopher |url=https://archive.org/details/cambridgehistori0000unse_a9n8/page/30 |title=The Cambridge Historical Encyclopedia of Great Britain and Ireland |publisher=Cambridge University Press |year=1990 |isbn=978-0-521-39552-6 |page=[https://archive.org/details/cambridgehistori0000unse_a9n8/page/30 30]}}</ref>
[[File:Roman Baths in Bath Spa, England - July 2006.jpg|alt=Photograph of the Baths showing a rectangular area of greenish water surrounded by yellow stone buildings with pillars. In the background is the tower of the abbey.|thumb|The [[Roman Baths (Bath)|Roman Baths]] in [[Bath, Somerset]], are a well-preserved ''[[thermae]]'' from [[Roman Britain]].]]
In 1066, the [[Normans]] invaded England from northern France. After [[Norman conquest of England|conquering England]] they seized [[Norman invasion of Wales|large parts of Wales]], [[Norman invasion of Ireland|conquered much of Ireland]] and were invited to settle in Scotland, bringing to each country [[feudalism]] on the Northern French model and [[Norman-French]] culture.<ref>{{Cite book |last=Ganshof, F.L. |url=https://archive.org/details/feudalism0000gans_j4b5 |title=Feudalism |publisher=University of Toronto |year=1996 |isbn=978-0-8020-7158-3 |page=165 |url-access=registration}}</ref> The [[Anglo-Normans|Anglo-Norman]] [[ruling class]] greatly influenced, but eventually assimilated with, the local cultures.<ref>{{Cite book |last=Chibnall, Marjorie |url=https://books.google.com/books?id=qJl5Jm-IndUC&pg=PA115 |title=The Debate on the Norman Conquest |publisher=Manchester University Press |year=1999 |isbn=978-0-7190-4913-2 |pages=115–122 |author-link=Marjorie Chibnall |access-date=20 March 2023 |archive-date=26 March 2023 |archive-url=https://web.archive.org/web/20230326164802/https://books.google.com/books?id=qJl5Jm-IndUC&pg=PA115 |url-status=live}}</ref> Subsequent [[House of Plantagenet|medieval English kings]] completed the [[conquest of Wales]] and tried unsuccessfully [[Wars of Scottish Independence|to annex Scotland]]. Asserting its independence in the 1320 [[Declaration of Arbroath]], Scotland maintained its independence thereafter, albeit in [[Anglo-Scottish Wars|near-constant conflict with England]].<ref>{{Cite web |date=3 June 2023 |title=The Declaration of Arbroath |url=https://www.nms.ac.uk/past-exhibitions/the-declaration-of-arbroath |access-date=6 July 2025 |website=NMS |language=en}}</ref>
In 1215, [[Magna Carta]] was the first document to state that no government was above the law and that citizens have rights protecting them.<ref>{{Cite web |title=Magna Carta |url=https://www.parliament.uk/about/living-heritage/evolutionofparliament/originsofparliament/birthofparliament/overview/magnacarta/ |access-date=27 May 2024 |publisher=parliament.uk}} {{Cite web |title=The contents of Magna Carta |url=https://www.parliament.uk/about/living-heritage/evolutionofparliament/originsofparliament/birthofparliament/overview/magnacarta/magnacartaclauses/ |access-date=27 May 2024 |publisher=parliament.uk |archive-date=28 August 2022 |archive-url=https://web.archive.org/web/20220828101448/https://www.parliament.uk/about/living-heritage/evolutionofparliament/originsofparliament/birthofparliament/overview/magnacarta/magnacartaclauses/ |url-status=live}} {{Cite web |title=Magna Carta Key Facts |url=https://www.britannica.com/summary/Magna-Carta-Key-Facts |access-date=27 May 2024 |publisher=Britannica |archive-date=27 May 2024 |archive-url=https://web.archive.org/web/20240527191804/https://www.britannica.com/summary/Magna-Carta-Key-Facts |url-status=live}}</ref>
The English monarchs, through inheritance of [[Angevin Empire|substantial territories in France]] and claims to the French crown, were also heavily involved in conflicts in France, most notably the [[Hundred Years' War]], while the [[List of Scottish monarchs|Kings of Scots]] were in [[Auld Alliance|an alliance with the French]] during this period.<ref>Keen, Maurice. [https://www.bbc.co.uk/history/british/middle_ages/hundred_years_war_01.shtml "The Hundred Years' War"] {{Webarchive|url=https://web.archive.org/web/20131214092949/http://www.bbc.co.uk/history/british/middle_ages/hundred_years_war_01.shtml |date=14 December 2013 }}. BBC History.</ref> [[Early modern Britain]] saw religious conflict resulting from the [[Reformation]] and the introduction of [[Protestant]] state churches in each country.<ref>[https://www.britannica.com/EBchecked/topic/479892/Protestantism/41558/The-Reformation-in-England-and-Scotland The Reformation in England and Scotland] {{Webarchive|url=https://web.archive.org/web/20150515015218/https://www.britannica.com/EBchecked/topic/479892/Protestantism/41558/The-Reformation-in-England-and-Scotland |date=15 May 2015 }} and [https://www.britannica.com/EBchecked/topic/293754/Ireland/22978/The-Reformation-period Ireland: The Reformation Period & Ireland under Elizabeth I] {{Webarchive|url=https://web.archive.org/web/20150521133445/http://www.britannica.com/EBchecked/topic/293754/Ireland/22978/The-Reformation-period |date=21 May 2015 }}, Encyclopædia Britannica Online.</ref> The [[English Reformation]] ushered in political, constitutional, social and cultural change in the 16th century and [[State religion|established]] the [[Church of England]]. It defined a national identity for England and slowly, but profoundly, changed people's religious beliefs.<ref>{{Cite web |title=English Reformation c1527-1590 |url=https://www.nationalarchives.gov.uk/education/resources/the-english-reformation-c1527-1590/ |access-date=20 January 2023 |website=The National Archives |archive-date=2 December 2022 |archive-url=https://web.archive.org/web/20221202002512/https://www.nationalarchives.gov.uk/education/resources/the-english-reformation-c1527-1590/ |url-status=live}}</ref> Wales was [[Laws in Wales Acts 1535 and 1542|fully incorporated into the Kingdom of England]],<ref>{{Cite magazine |date=5 November 2009 |title=British History in Depth – Wales under the Tudors |url=https://www.bbc.co.uk/history/british/tudors/wales_tudors_01.shtml |magazine=BBC History |access-date=21 September 2010 |archive-date=7 February 2012 |archive-url=https://web.archive.org/web/20120207145836/http://www.bbc.co.uk/history/british/tudors/wales_tudors_01.shtml |url-status=live}}</ref> and Ireland was constituted as a kingdom in personal union with the English crown.<ref>{{Cite book |last=Nicholls |first=Mark |url=https://archive.org/details/historyofmodernb0000nich |title=A history of the modern British Isles, 1529–1603: The two kingdoms |publisher=Blackwell |year=1999 |isbn=978-0-631-19334-0 |location=Oxford |pages=171–172 |url-access=registration}}</ref> During the [[Plantation of Ulster]] in the 17th century, the lands of the Catholic Gaelic nobility were confiscated by the Crown and granted to Protestant settlers from England and Scotland.<ref>{{Cite book |last=Canny |first=Nicholas P. |url=https://archive.org/details/makingirelandbri00cann |title=Making Ireland British, 1580–1650 |publisher=Oxford University Press |year=2003 |isbn=978-0-19-925905-2 |pages=189–200 |url-access=registration}}</ref>
[[File:Adam de Colone (c.1572-1651) - James VI and I (1566–1625), King of Scotland (1567–1625), King of England and Ireland (1603–1625) - PG 2172 - National Galleries of Scotland.jpg|thumb|right|[[James VI and I|James VI]], [[King of Scotland]], succeeded to the English and Irish thrones in 1603.]]
The [[Union of the Crowns]] occurred in 1603 when [[James VI of Scotland]] inherited the thrones of England and Ireland, subsequently moving his court from Edinburgh to London. Although unified under a single monarch, the three realms remained entirely separate political entities, preserving their respective parliaments, judicial systems, and established churches.<ref>Ross, D. (2002). ''[[iarchive:chronologyofscot0000ross|Chronology of Scottish History]]''. Glasgow: Geddes & Grosset. p. 56. {{ISBN|978-1-85534-380-1}}; Hearn, J. (2002). ''Claiming Scotland: National Identity and Liberal Culture''. Edinburgh University Press. p. 104. {{ISBN|978-1-902930-16-9}}.</ref>
In the mid-17th century, all three kingdoms [[Wars of the Three Kingdoms|were involved in a series of connected wars]] (including the [[English Civil War]]) which led to the temporary overthrow of the monarchy, with [[Execution of Charles I|the execution]] of [[Charles I of England|King Charles I]], and the establishment of the short-lived [[unitary republic]] of the [[Commonwealth of England]], Scotland and Ireland.<ref>{{Cite encyclopedia |title=English Civil Wars |encyclopedia=Encyclopædia Britannica |url=https://www.britannica.com/EBchecked/topic/187936/English-Civil-Wars |access-date=28 April 2013 |archive-date=2 May 2015 |archive-url=https://web.archive.org/web/20150502204708/https://www.britannica.com/EBchecked/topic/187936/English-Civil-Wars |url-status=live}}; {{Cite web |date=14 March 2010 |title=Scotland and the Commonwealth: 1651–1660 |url=http://www.archontology.org/nations/uk/scotland/01_laws.php |access-date=9 March 2015 |publisher=Archontology.org |archive-date=16 July 2012 |archive-url=https://web.archive.org/web/20120716194016/http://www.archontology.org/nations/uk/scotland/01_laws.php |url-status=live}}</ref>
Although the [[Restoration (1660)|monarchy was restored]], the [[Interregnum (1649–1660)|Interregnum]] along with the [[Glorious Revolution]] of 1688 and the subsequent [[Bill of Rights 1689]] in England and [[Claim of Right Act 1689]] in Scotland ensured that, unlike much of the rest of Europe, [[royal absolutism]] would not prevail, and a professed Catholic could never accede to the throne. The [[British constitution]] would develop on the basis of [[constitutional monarchy]] and the [[parliamentary system]].<ref>{{Cite book |last=Lodge |first=Richard |url=https://books.google.com/books?id=EBSpvBxGyqcC |title=The History of England – From the Restoration to the Death of William III (1660–1702) |publisher=Read Books |year=2007 |isbn=978-1-4067-0897-4 |page=8 |orig-date=1910 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328140723/https://books.google.com/books?id=EBSpvBxGyqcC |url-status=live}}</ref> With the founding of the [[Royal Society]] in 1660, science was greatly encouraged. During this period, particularly in England, the development of [[English navy|naval power]] and an interest in [[Age of Discovery|voyages of discovery]] led to the acquisition and settlement of overseas colonies, particularly in North America and the Caribbean.<ref>{{Cite web |title=Tudor Period and the Birth of a Regular Navy |url=http://www.royal-navy.org/lib/index.php?title=Tudor_Period_and_the_Birth_of_a_Regular_Navy_Part_Two |archive-url=https://web.archive.org/web/20111103013901/http://www.royal-navy.org/lib/index.php?title=Tudor_Period_and_the_Birth_of_a_Regular_Navy_Part_Two |archive-date=3 November 2011 |access-date=8 March 2015 |website=Royal Navy History |url-status=usurped |publisher=Institute of Naval History}}; {{Cite book |last=Canny |first=Nicholas |url=https://books.google.com/books?id=eQHSivGzEEMC |title=The Origins of Empire, The Oxford History of the British Empire Volume I |publisher=Oxford University Press |year=1998 |isbn=978-0-19-924676-2 |ref=refOHBEv1 |access-date=29 September 2020 |archive-date=11 January 2023 |archive-url=https://web.archive.org/web/20230111135256/https://books.google.com/books?id=eQHSivGzEEMC |url-status=live}}</ref>
Though previous attempts at uniting the two kingdoms within Great Britain in 1606, 1667 and 1689 had proved unsuccessful, the attempt initiated in 1705 led to the [[Treaty of Union]] of 1706 being agreed and ratified by both parliaments.
{{Clear left}}
=== Union of England and Scotland ===
{{Main|Treaty of Union|Kingdom of Great Britain}}
[[File:Articles of Union between England and Scotland 28 Jan 1707.png|thumb|right|170px|The [[Treaty of Union]] which unified the [[Kingdom of England]] and [[Kingdom of Scotland]] on 1 May 1707]]
On 1 May 1707 the Kingdom of Great Britain was formed, the result of the [[Acts of Union 1707]] between the [[Kingdom of England]] and [[Kingdom of Scotland]].<ref>{{Cite web |title=Articles of Union with Scotland 1707 |url=http://www.nationalarchives.gov.uk/pathways/citizenship/rise_parliament/docs/articles_union.htm |access-date=19 October 2008 |publisher=UK Parliament |archive-date=8 June 2012 |archive-url=https://web.archive.org/web/20120608152446/http://www.nationalarchives.gov.uk/pathways/citizenship/rise_parliament/docs/articles_union.htm |url-status=live}}; {{Cite web |title=Acts of Union 1707 |url=http://www.parliament.uk/about/living-heritage/evolutionofparliament/legislativescrutiny |access-date=6 January 2011 |publisher=UK Parliament |archive-date=27 December 2010 |archive-url=https://web.archive.org/web/20101227033859/http://www.parliament.uk/about/living-heritage/evolutionofparliament/legislativescrutiny/ |url-status=live}}; {{Cite web |title=Treaty (act) of Union 1706 |url=http://www.scotshistoryonline.co.uk/union.html |archive-url=https://web.archive.org/web/20190527074630/http://www.scotshistoryonline.co.uk/union.html |archive-date=27 May 2019 |access-date=3 February 2011 |publisher=Scottish History online}}</ref> In the 18th century cabinet government developed under [[Robert Walpole]], who is considered the ''[[de facto]]'' first [[Prime Minister of the United Kingdom|prime minister]] from 1721 to 1742. A series of [[Jacobite uprisings]] sought to remove the Protestant [[House of Hanover]] from the throne and restore the Catholic [[House of Stuart]]. In 1746, the Jacobites were defeated at the [[Battle of Culloden]], after which the [[Scottish Highlanders]] were forcibly assimilated into Scotland by revoking the feudal independence of [[Scottish clan chief|clan chiefs]]. The British colonies in North America that broke away in the [[American Revolutionary War|American War of Independence]] became the [[United States]]. British imperial ambition turned towards Asia, particularly to [[British Raj|India]].<ref>Library of Congress, [https://books.google.com/books?id=BQDgr_XvsHoC&pg=PA73 ''The Impact of the American Revolution Abroad''] {{Webarchive|url=https://web.archive.org/web/20240328140724/https://books.google.com/books?id=BQDgr_XvsHoC&pg=PA73 |date=28 March 2024 }}, p. 73.</ref>
British merchants played a leading part in the [[Atlantic slave trade]], mainly between 1662 and 1807 when British or British-colonial [[slave ships]] transported nearly 3.3 million slaves from Africa.<ref>{{Cite book |last=Morgan |first=Kenneth |url=https://books.google.com/books?id=SGcwgJz5rQMC&pg=PA12 |title=Slavery and the British Empire: From Africa to America |publisher=Oxford University Press, USA |year=2007 |isbn=978-0-19-156627-1 |page=12 |access-date=5 October 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141229/https://books.google.com/books?id=SGcwgJz5rQMC&pg=PA12#v=onepage&q&f=false |url-status=live}}</ref> The slaves were taken to [[Plantation economy|work on plantations]], principally [[History of the British West Indies|in the Caribbean]] but also [[British America|in North America]].<ref>{{Cite book |last=Morgan |first=Kenneth |url=https://books.google.com/books?id=SGcwgJz5rQMC&pg=PA15 |title=Slavery and the British Empire: From Africa to America |publisher=Oxford University Press, US |year=2007 |isbn=978-0-19-156627-1 |page=15 |access-date=5 October 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141229/https://books.google.com/books?id=SGcwgJz5rQMC&pg=PA15#v=onepage&q&f=false |url-status=live}}</ref> However, with pressure from the [[Abolitionism in the United Kingdom|abolitionist movement]], Parliament banned the trade in 1807, banned slavery in the British Empire in 1833, and Britain took a leading role in the movement to abolish slavery worldwide through the [[blockade of Africa]] and pressing other nations to end their trade with a series of treaties.<ref>[https://www.bbc.co.uk/devon/content/articles/2007/03/20/abolition_navy_feature.shtml Sailing against slavery] {{Webarchive|url=https://web.archive.org/web/20081103004954/https://www.bbc.co.uk/devon/content/articles/2007/03/20/abolition_navy_feature.shtml |date=3 November 2008 }}. BBC Devon. 2007.; {{Cite book |last=Lovejoy |first=Paul E. |url=https://archive.org/details/transformationsi0000love/page/290 |title=Transformations in Slavery: A History of Slavery in Africa |publisher=Cambridge University Press |year=2000 |isbn=978-0-521-78012-4 |edition=2nd |location=New York |page=[https://archive.org/details/transformationsi0000love/page/290 290]}}</ref>
=== United Kingdom of Great Britain and Ireland ===
{{Main|History of the United Kingdom|Acts of Union 1800|United Kingdom of Great Britain and Ireland}}
[[File:Victoria in her Coronation robes.jpg|upright|thumb|[[Queen Victoria|Victoria]] reigned as [[Monarchy of the United Kingdom|Queen of the United Kingdom]] and [[Empress of India]] during the 19th century.]]
In 1800, the parliaments of Great Britain and Ireland each passed an Act of Union, uniting the two kingdoms and creating the United Kingdom of Great Britain and Ireland on 1 January 1801.<ref>{{Cite web |title=The Act of Union |url=http://www.actofunion.ac.uk/actofunion.htm#act |archive-url=https://web.archive.org/web/20120415061235/http://www.actofunion.ac.uk/actofunion.htm#act |archive-date=15 April 2012 |access-date=15 May 2006 |publisher=Act of Union Virtual Library}}</ref>
After the defeat of France at the end of the [[French Revolutionary Wars]] and [[Napoleonic Wars]] (1792–1815), the United Kingdom emerged as the principal naval and imperial power (with London the [[List of largest cities throughout history|largest city in the world from about 1830]]).<ref>Tellier, L.-N. (2009). ''Urban World History: an Economic and Geographical Perspective''. Quebec: PUQ. p. 463. {{ISBN|978-2-7605-1588-8}}.</ref> [[History of the Royal Navy (after 1707)#Pax Britannica, 1815–1914|Unchallenged at sea]], British dominance was later described as the ''[[Pax Britannica]]'' ("British Peace"), a period of [[International relations of the Great Powers (1814–1919)|relative peace amongst the great powers]] (1815–1914) during which the British Empire became the global [[hegemon]]<ref>{{Cite book |last=Mathias |first=P. |title=The First Industrial Nation: the Economic History of Britain, 1700–1914 |publisher=Routledge |year=2001 |isbn=978-0-415-26672-7 |location=London}}; {{Cite book |last=Ferguson |first=Niall |url=https://archive.org/details/empire00nial |title=Empire: The rise and demise of the British world order and the lessons for global power |publisher=Basic Books |year=2004 |isbn=978-0-465-02328-8 |location=New York |url-access=registration}}</ref><ref>{{Cite encyclopedia |title=20th-century international relations |encyclopedia=[[Encyclopædia Britannica]] |url=https://www.britannica.com/topic/20th-century-international-relations-2085155 |access-date=6 May 2023 |last=McDougall |first=Walter A. |date=4 May 2023 |author-link=Walter A. McDougall |archive-url=https://web.archive.org/web/20190712124130/https://www.britannica.com/topic/20th-century-international-relations-2085155 |archive-date=12 July 2019 |url-status=live}}</ref> and adopted the role of [[global policeman]].<ref>Sondhaus, L. (2004). ''Navies in Modern World History''. London: Reaktion Books. p. 9. {{ISBN|978-1-86189-202-7}}.</ref><ref>{{Cite book |last=Porter |first=Andrew |url=https://books.google.com/books?id=oo3F2X8IDeEC |title=The Nineteenth Century, The Oxford History of the British Empire Volume III |publisher=Oxford University Press |year=1998 |isbn=978-0-19-924678-6 |page=332 |ref=refOHBEv3}}</ref> From 1853 to 1856, Britain took part in the [[Crimean War]], allied with the [[Ottoman Empire]] against [[Russian Empire|Tsarist Russia]].<ref>{{Cite journal |last=Benn |first=David Wedgwood |title=The Crimean War and its lessons for today |journal=[[International Affairs (journal)|International Affairs]] |volume=88 |issue=2 |date=March 2012 |pages=387–391 |jstor=41428613 |publisher=Oxford University Press |doi=10.1111/j.1468-2346.2012.01078.x}}</ref> Following the [[Indian Rebellion of 1857]] the British government led by [[Henry John Temple, 3rd Viscount Palmerston|Lord Palmerston]] assumed [[direct rule]] over [[British Raj|India]]. Alongside the formal control it exerted over its own colonies, British dominance of much of world trade meant that it [[Informal empire|effectively controlled]] the economies of regions such as [[East Asia]] and [[Latin America]].<ref>{{Cite book |last=Porter |first=Andrew |url=https://books.google.com/books?id=oo3F2X8IDeEC |title=The Nineteenth Century, The Oxford History of the British Empire Volume III |publisher=Oxford University Press |year=1998 |isbn=978-0-19-924678-6 |page=8 |ref=refOHBEv3}}; {{Cite book |last=Marshall |first=P.J. |url=https://books.google.com/books?id=S2EXN8JTwAEC |title=The Cambridge Illustrated History of the British Empire |publisher=Cambridge University Press |year=1996 |isbn=978-0-521-00254-7 |pages=156–157 |ref=refMarshall |access-date=29 September 2020 |archive-date=16 January 2023 |archive-url=https://web.archive.org/web/20230116094154/https://books.google.com/books?id=S2EXN8JTwAEC |url-status=live}}</ref>
Throughout the [[Victorian era]] (1837–1901), political attitudes favoured [[free trade]] and ''[[laissez-faire]]'' policies. Beginning with the [[Great Reform Act]] in 1832, Parliament gradually [[Reform Acts|widened the voting franchise]], with the [[Representation of the People Act 1884|1884 Reform Act]] championed by [[William Ewart Gladstone|William Gladstone]] granting [[suffrage]] to a majority of males for the first time. The British population increased at a dramatic rate, accompanied by rapid [[urbanisation]], causing significant social and economic stresses.<ref>{{Cite book |last=Tompson |first=Richard S. |url=https://books.google.com/books?id=H5kcJqmXk2oC&pg=PA63 |title=Great Britain: a reference guide from the Renaissance to the present |publisher=Facts on File |year=2003 |isbn=978-0-8160-4474-0 |location=New York |page=63}}</ref> By the late 19th century, [[Conservative Party (UK)|Conservative governments]] under [[Benjamin Disraeli]] and [[Robert Gascoyne-Cecil, 3rd Marquess of Salisbury|Lord Salisbury]] accelerated [[Scramble for Africa|imperial expansion in Africa]], sustained a foreign policy of "[[splendid isolation]]" from European alliances, and intensified strategic containment of the [[Russian Empire]] in [[Central Asia]], a competition known as the [[Great Game]].<ref>{{Cite journal |last=Fromkin |first=David |date=1980 |title=The Great Game in Asia |url=https://www.jstor.org/stable/20040512 |journal=Foreign Affairs |volume=58 |issue=4 |pages=936–951 |doi=10.2307/20040512 |jstor=20040512 |issn=0015-7120 |access-date=4 June 2023 |archive-date=12 April 2021 |archive-url=https://web.archive.org/web/20210412053528/https://www.jstor.org/stable/20040512 |url-status=live |url-access=subscription}}</ref> During this time, [[Canada]], [[Australia]] and [[New Zealand]] were granted self-governing [[dominion]] status.<ref>{{Cite book |last=Hosch, William L. |title=World War I: People, Politics, and Power |publisher=Britannica Educational Publishing |year=2009 |isbn=978-1-61530-048-8 |series=America at War |location=New York |page=21}}</ref> At the turn of the 20th century, Britain's industrial dominance became challenged by the [[German Empire]] and the [[United States]].<ref>{{Cite book |last=Zarembka |first=Paul |url=https://books.google.com/books?id=NSrwpggmHigC&pg=PP1 |title=Contradictions: Finance, Greed, and Labor Unequally Paid |date=2013 |publisher=Emerald Group Publishing |isbn=978-1-78190-670-5 |access-date=21 October 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141231/https://books.google.com/books?id=NSrwpggmHigC&pg=PP1#v=onepage&q&f=false |url-status=live}}</ref> The [[Edwardian era]] (1901–1910) saw [[Liberal welfare reforms|social reform]] and [[Irish Home Rule movement|home rule for Ireland]] become important domestic issues, while the [[Labour Party (UK)|Labour Party]] emerged from an alliance of [[Trade unions in the United Kingdom|trade unions]] and small socialist groups in 1900, and [[suffragettes]] campaigned for women's right to vote.<ref>Sophia A. Van Wingerden, ''The women's suffrage movement in Britain, 1866–1928'' (1999) ch 1.</ref>
=== World wars and partition of Ireland ===
{{Main|History of the United Kingdom during the First World War|Partition of Ireland|Interwar Britain|United Kingdom home front during the Second World War|Military history of the United Kingdom during World War II}}
[[File:Wreaths Are Laid at the Cenotaph, London During Remembrance Sunday Service MOD 45152052.jpg|thumb|Wreaths being laid during the [[Remembrance Sunday]] service at the [[The Cenotaph|Cenotaph]] in [[Whitehall]], London]]
[[File:Spitfire and Hurricane in the Battle of Britain Memorial Flight.jpg|thumb|A [[Supermarine Spitfire|Spitfire]] and a [[Hawker Hurricane|Hurricane]] as flown in the [[Battle of Britain]] during the [[Second World War]]]]
Britain was one of the principal [[Allies of World War I|Allies]] that defeated the [[Central Powers]] in the [[First World War]] (1914–1918). Alongside their French, Russian and (after 1917) American counterparts,<ref>Turner, John (1988). ''Britain and the First World War''. London: Unwin Hyman. pp. 22–35. {{ISBN|978-0-04-445109-9}}.</ref> British armed forces were engaged across much of the British Empire and in several regions of Europe, particularly on the [[Western Front (World War I)|Western Front]].<ref name="Westwell&Cove" /> The high fatalities of [[trench warfare]] caused the loss of much of a generation of men, with lasting social effects in the nation and a great disruption in the social order. Britain had suffered 2.5 million casualties and finished the war with a huge national debt.<ref name="Westwell&Cove">Westwell, I.; Cove, D. (eds) (2002). ''History of World War I, Volume 3''. London: Marshall Cavendish. pp. 698, 705. {{ISBN|978-0-7614-7231-5}}.</ref>
The consequences of the war persuaded the government to expand the right to vote in national and local elections to all adult men and most adult women with the [[Representation of the People Act 1918]].<ref name="Westwell&Cove" /> After the war Britain became a permanent member of the Executive Council of the [[League of Nations]] and received [[League of Nations mandate|a mandate]] over a number of former German and [[Ottoman Empire|Ottoman]] colonies. Under the leadership of [[David Lloyd George]], the British Empire reached its greatest extent, covering a fifth of the world's land surface and a quarter of its population.<ref>Turner, J. (1988). ''Britain and the First World War''. Abingdon: Routledge. p. 41. {{ISBN|978-0-04-445109-9}}.</ref>
By the mid-1920s, most of the British population could listen to [[BBC]] radio programmes.<ref>{{Cite web |date=15 June 2020 |title=100 years of radio since Marconi's big breakthrough |url=https://www.ofcom.org.uk/about-ofcom/latest/features-and-news/100-years-of-radio |access-date=17 November 2020 |website=Ofcom |archive-date=4 August 2020 |archive-url=https://web.archive.org/web/20200804031332/https://www.ofcom.org.uk/about-ofcom/latest/features-and-news/100-years-of-radio |url-status=live}}</ref><ref>{{Cite web |title=History of the BBC: The origins of BBC Local Radio |url=https://www.bbc.com/historyofthebbc/research/local-radio |access-date=18 September 2022 |website=[[BBC]] |last=Linfoot |first=Matthew |archive-date=20 September 2022 |archive-url=https://web.archive.org/web/20220920232207/https://www.bbc.com/historyofthebbc/research/local-radio/ |url-status=live}}</ref> Experimental [[Television in the United Kingdom|television]] broadcasts [[History of television#United Kingdom|began in 1929]] and the [[First day of BBC television|first scheduled BBC Television Service]] commenced in 1936.<ref>{{Cite web |title=History of the BBC: 1920s |url=https://www.bbc.com/historyofthebbc/timelines/1920s |access-date=18 September 2022 |website=[[BBC]] |archive-date=26 September 2022 |archive-url=https://web.archive.org/web/20220926064808/https://www.bbc.com/historyofthebbc/timelines/1920s |url-status=live}}</ref> The rise of [[Irish nationalism]], and disputes within Ireland over the terms of [[Irish Home Rule]], led eventually to the [[Partition of Ireland|partition of the island]] in 1921.<ref>[[SR&O 1921]]/533 of 3 May 1921.</ref> [[The Troubles in Ulster (1920–1922)|A period of conflict in what is now Northern Ireland]] occurred from June 1920 until June 1922. The [[Irish Free State]] became independent, initially with [[Dominion]] status in 1922, and [[Statute of Westminster 1931#Irish Free State|unambiguously independent in 1931]]. Northern Ireland remained part of the United Kingdom.<ref>{{Cite web |title=The Anglo-Irish Treaty, 6 December 1921 |url=http://cain.ulst.ac.uk/issues/politics/docs/ait1921.htm |access-date=15 May 2006 |website=CAIN Web Service |archive-date=14 May 2012 |archive-url=https://web.archive.org/web/20120514145108/http://cain.ulst.ac.uk/issues/politics/docs/ait1921.htm |url-status=live}}</ref> The [[1928 Equal Franchise Act]] gave women electoral equality with men in national elections. Strikes in the mid-1920s culminated in the [[General Strike of 1926]]. Still suffering from the long-term economic effects of the First World War, Britain was severely impacted by the [[Great Depression in the United Kingdom|Great Depression]] (1929–1932), which intensified hardship in old industrial areas in traditional sectors, led to mass unemployment peaking near 3 million, and precipitated widespread political instability and social unrest. [[National Government (1931)|A coalition government]] was formed in 1931.<ref>Rubinstein, W.D. (2004). ''Capitalism, Culture, and Decline in Britain, 1750–1990''. Abingdon: Routledge. p. 11. {{ISBN|978-0-415-03719-8}}.</ref>
Nonetheless, Britain was described as "a very wealthy country, formidable in arms, ruthless in pursuit of its interests and sitting at the heart of a global production system."<ref name="Edgerton2012">{{Cite book |last=Edgerton |first=David |date=2012 |title=Britain's War Machine |url=https://www.penguin.co.uk/books/55731/britain-s-war-machine/9780141026107.html |access-date=10 May 2020 |publisher=Penguin |postscript=none |archive-date=28 April 2020 |archive-url=https://web.archive.org/web/20200428080558/https://www.penguin.co.uk/books/55731/britain-s-war-machine/9780141026107.html |url-status=live}}; {{Cite web |title=Britain's War Machine: Weapons, Resources and Experts in the Second World War |url=https://reviews.history.ac.uk/review/1114 |access-date=10 May 2020 |website=[[Reviews in History]] |archive-date=12 June 2020 |archive-url=https://web.archive.org/web/20200612173058/https://reviews.history.ac.uk/review/1114 |url-status=live}}</ref> After [[Nazi Germany]]'s [[invasion of Poland]] in 1939, Britain entered the [[Second World War]]. Despite the defeat of its European allies in the first year, Britain and its empire continued the war against Germany.<ref name="Edgerton2012" />
In 1940, the [[Royal Air Force]] successfully defended British airspace by repelling the German ''[[Luftwaffe]]'' in the [[Battle of Britain]]. Urban areas suffered heavy bombing during [[the Blitz]]. The [[Grand Alliance (World War II)|Grand Alliance]] of Britain, the United States and the [[Soviet Union]] formed in 1941, leading the [[Allies of World War II|Allies]] against the [[Axis powers]]. There were eventual hard-fought victories in the [[Battle of the Atlantic]], the [[North Africa campaign]] and the [[Italian campaign (World War II)|Italian campaign]]. British forces played important roles in the [[Normandy landings]] of 1944 and the [[liberation of Europe]]. The British Army led the [[Burma campaign]] against Japan, and the [[British Pacific Fleet]] fought Japan at sea. [[British contribution to the Manhattan Project|British scientists contributed]] to the American [[Manhattan Project]], whose task was to build a [[nuclear weapon]].<ref>{{cite book |author=Septimus H. Paul |url=https://books.google.com/books?id=fSZpgW-N628C&pg=PA1 |title=Nuclear Rivals: Anglo-American Atomic Relations, 1941–1952 |publisher=Ohio State U.P. |year=2000 |isbn=978-0-8142-0852-6 |pages=1–5}}</ref>
=== Post-war 20th century ===
{{Main|Post-war Britain (1945–1979)|Social history of post-war Britain (1945–1979)}}
[[File:British Empire 1921.png|thumb|right|upright=1.4|The [[British Empire]] at its territorial peak in 1921]]
The United Kingdom was one of the [[Big Three (World War II)|Big Three]] powers (with the United States and the Soviet Union) who met to plan the [[Aftermath of World War II|post-war world]];<ref>{{Cite book |last1=Doenecke |first1=Justus D. |url=https://books.google.com/books?id=xdMF9rX6mX8C&pg=PA62 |title=Debating Franklin D. Roosevelt's foreign policies, 1933–1945 |last2=Stoler |first2=Mark A. |year=2005 |publisher=Rowman & Littlefield |isbn=978-0-8476-9416-7 |access-date=19 March 2016 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141231/https://books.google.com/books?id=xdMF9rX6mX8C&pg=PA62#v=onepage&q&f=false |url-status=live|author-link=Justus Drew Doenecke}}; {{Cite book |last=Kelly |first=Brian |url=https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=37681 |title=The Four Policemen and Postwar Planning, 1943–1945: The Collision of Realist and Idealist Perspectives |publisher=Indiana University of Pennsylvania |access-date=25 August 2015 |archive-date=22 October 2015 |archive-url=https://web.archive.org/web/20151022125442/https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=37681 |url-status=live}}</ref> it drafted the [[Declaration by United Nations]] with the United States and became one of the five permanent members of the [[United Nations Security Council]]. It worked closely with the United States to establish the [[International Monetary Fund]], the [[World Bank]] and [[NATO]].<ref>{{Cite web |date=22 July 2010 |title=The "Special Relationship" between Great Britain and the United States Began with FDR |work=Roosevelt Institute |url=http://rooseveltinstitute.org/special-relationship-between-great-britain-and-united-states-began-fdr |archive-url=https://web.archive.org/web/20180125021103/http://rooseveltinstitute.org/special-relationship-between-great-britain-and-united-states-began-fdr |archive-date=25 January 2018 |access-date=24 January 2018 |quote=and the joint efforts of both powers to create a new post-war strategic and economic order through the drafting of the Atlantic Charter; the establishment of the International Monetary Fund and the World Bank; and the creation of the United Nations.}}; {{Cite press release |title=Remarks by the President Obama and Prime Minister Cameron in Joint Press Conference |date=22 April 2016 |publisher=The White House |url=https://obamawhitehouse.archives.gov/the-press-office/2016/04/22/remarks-president-obama-and-prime-minister-cameron-joint-press |quote=That's what we built after World War II. The United States and the UK designed a set of institutions – whether it was the United Nations, or the Bretton Woods structure, IMF, World Bank, NATO, across the board. |access-date=24 January 2018 |archive-date=8 June 2021 |archive-url=https://web.archive.org/web/20210608110653/https://obamawhitehouse.archives.gov/the-press-office/2016/04/22/remarks-president-obama-and-prime-minister-cameron-joint-press |url-status=live}}</ref> The war left the UK severely weakened and financially dependent on the American [[Marshall Plan]],<ref>{{Cite news |date=28 December 2006 |title=Britain to make its final payment on World War II loan from U.S. |work=The New York Times |url=https://www.nytimes.com/2006/12/28/business/worldbusiness/28iht-nazi.4042453.html |access-date=25 August 2011 |archive-date=20 August 2017 |archive-url=https://web.archive.org/web/20170820022220/http://www.nytimes.com/2006/12/28/business/worldbusiness/28iht-nazi.4042453.html |url-status=live}}</ref> but it was spared the total war that devastated [[eastern Europe]].<ref>{{Cite news |last=Reynolds |first=David |date=17 April 2011 |title=Britain's War Machine by David Edgerton – review |work=The Guardian |location=London |url=https://www.theguardian.com/books/2011/apr/17/britains-war-machine-david-edgerton-review |access-date=10 May 2020 |archive-date=12 June 2020 |archive-url=https://web.archive.org/web/20200612130213/https://www.theguardian.com/books/2011/apr/17/britains-war-machine-david-edgerton-review |url-status=live}}</ref>
In the immediate post-war years the [[Labour Government 1945–1951|Labour government]] under [[Clement Attlee]] initiated a radical programme of reforms, which significantly affected British society [[Post-war consensus|in the following decades]].<ref>{{Cite book |last=Francis |first=Martin |title=Ideas and policies under Labour, 1945–1951: Building a new Britain |publisher=Manchester University Press |year=1997 |isbn=978-0-7190-4833-3 |pages=225–233}}</ref> Major industries and public utilities were [[nationalised]], a [[welfare state]] was established, and a comprehensive, publicly funded healthcare system, the [[National Health Service]], was created.<ref>{{Cite book |last=Lee |first=Stephen J. |url=https://archive.org/details/aspectsbritishpo00lees |title=Aspects of British political history, 1914–1995 |publisher=Routledge |year=1996 |isbn=978-0-415-13103-2 |location=London; New York |pages=[https://archive.org/details/aspectsbritishpo00lees/page/n183 173]–199 |url-access=limited}}</ref> The rise of nationalism in the colonies coincided with Britain's much-diminished economic position after [[History of the United Kingdom during the First World War|its involvement in the First World War]] and [[Military history of the United Kingdom during World War II|in the Second World War]], so that a policy of [[decolonisation]] was unavoidable.<ref>{{cite book |last=Brown |first=Judith |author-link=Judith M. Brown |url=https://books.google.com/books?id=CpSvK3An3hwC |title=The Twentieth Century, The Oxford History of the British Empire Volume IV |publisher=Oxford University Press |year=1998 |isbn=978-0-19-924679-3 |ref=refOHBEv4 |access-date=22 July 2009 |archive-url=https://web.archive.org/web/20140103114315/http://books.google.com/books?id=CpSvK3An3hwC |archive-date=3 January 2014 |url-status=live}} p. 319.</ref><ref>{{cite book |last=Louis |first=Wm. Roger |url=https://books.google.com/books?id=NQnpQNKeKKAC |title=Ends of British Imperialism: The Scramble for Empire, Suez and Decolonization |publisher=I.B. Tauris |year=2006 |isbn=978-1-84511-347-6 |ref=refLouis2006 |access-date=22 July 2009 |archive-url=https://web.archive.org/web/20170222045215/https://books.google.com/books?id=NQnpQNKeKKAC |archive-date=22 February 2017 |url-status=live}} p. 337.</ref><ref>{{cite book |last=Abernethy |first=David |url=https://books.google.com/books?id=ennqNS1EOuMC |title=The Dynamics of Global Dominance, European Overseas Empires 1415–1980 |publisher=Yale University Press |year=2000 |isbn=978-0-300-09314-8 |ref=refAbernethy2000 |access-date=22 July 2009 |archive-url=https://web.archive.org/web/20111214082531/http://books.google.com/books?id=ennqNS1EOuMC |archive-date=14 December 2011 |url-status=live}} p. 146.</ref> Independence was granted to India and Pakistan in 1947.<ref>{{Cite book |last=Larres |first=Klaus |url=https://books.google.com/books?id=7D66_9YOof4C&pg=PA118 |title=A companion to Europe since 1945 |publisher=Wiley-Blackwell |year=2009 |isbn=978-1-4051-0612-2 |location=Chichester |page=118 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141350/https://books.google.com/books?id=7D66_9YOof4C&pg=PA118 |url-status=live}}</ref> Over the next three decades, most colonies of the British Empire gained their independence, and many became members of the [[Commonwealth of Nations]].<ref>{{Cite web |date=19 March 2009 |title=Country List |url=http://www.thecommonwealth.org/Templates/System/YearbookHomePage.asp?NodeID=152099&load=countrylist |archive-url=https://web.archive.org/web/20130506071236/http://www.thecommonwealth.org/Templates/System/YearbookHomePage.asp?NodeID=152099&load=countrylist |archive-date=6 May 2013 |access-date=8 March 2015 |publisher=[[Commonwealth Secretariat]]}}</ref>
The UK was the third country to develop [[Nuclear weapons and the United Kingdom|a nuclear weapons arsenal]], with its first atomic bomb test, [[Operation Hurricane]], in 1952, although the post-war limitations of Britain's international role were illustrated by the [[Suez Crisis]] of 1956. As a result of a shortage of workers in the 1950s, the government [[Modern immigration to the United Kingdom|encouraged immigration]] from [[Commonwealth countries]]. In the following decades the UK became a more [[Multiracialism|multiracial]] and [[Multiculturalism|multicultural]] society.<ref>{{Cite book |last=Julios |first=Christina |url=https://books.google.com/books?id=s3RQ4dsFEkoC&pg=PA84 |title=Contemporary British identity: English language, migrants, and public discourse |publisher=Ashgate |year=2008 |isbn=978-0-7546-7158-9 |series=Studies in migration and diaspora |location=Aldershot |page=84 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141350/https://books.google.com/books?id=s3RQ4dsFEkoC&pg=PA84 |url-status=live}}</ref> Despite rising living standards in the late 1950s and 1960s, the United Kingdom's economic performance was less successful than many of its main competitors such as France, [[West Germany]] and Japan. In 1969, the United Kingdom was the first democratic nation to [[Representation of the People Act 1969|lower its voting age to 18]].<ref>{{Cite journal |last1=Loughran |first1=Thomas |last2=Mycock |first2=Andrew |last3=Tonge |first3=Jonathan |date=3 April 2021 |title=A coming of age: how and why the UK became the first democracy to allow votes for 18-year-olds |url=https://www.tandfonline.com/doi/full/10.1080/13619462.2021.1890589 |journal=Contemporary British History |volume=35 |issue=2 |pages=284–313 |doi=10.1080/13619462.2021.1890589 |issn=1361-9462 |s2cid=233956982 |access-date=24 May 2024 |archive-date=4 June 2023 |archive-url=https://web.archive.org/web/20230604093606/https://www.tandfonline.com/doi/full/10.1080/13619462.2021.1890589 |url-status=live |url-access=subscription}}</ref>
In the decades-long process of [[European integration]] the UK was a founding member of the [[Western European Union]], established with the [[London and Paris Conferences]] in 1954. In 1960 the UK was one of the seven founding members of the [[European Free Trade Association]] (EFTA), but in 1973 it left to join the [[European Communities]] (EC). In a [[1975 United Kingdom European Communities membership referendum|1975 referendum]] 67 per cent voted to stay in it.<ref>{{Cite news |title=1975: UK embraces Europe in referendum |work=BBC News |url=http://news.bbc.co.uk/onthisday/hi/dates/stories/june/6/newsid_2499000/2499297.stm |access-date=8 March 2015 |archive-date=20 June 2018 |archive-url=https://web.archive.org/web/20180620044520/http://news.bbc.co.uk/onthisday/hi/dates/stories/june/6/newsid_2499000/2499297.stm |url-status=live}}</ref> When the EC became the [[European Union]] (EU) in 1993, the UK was one of the 12 founding member states.
From the late 1960s, Northern Ireland experienced communal and [[paramilitary]] violence, sometimes affecting other parts of the UK, known as [[the Troubles]]. It is usually considered to have ended with the 1998 [[Belfast Agreement|Belfast "Good Friday" Agreement]].<ref>{{Cite book |last=Aughey |first=Arthur |url=https://archive.org/details/politicsnorthern00augh |title=The Politics of Northern Ireland: Beyond the Belfast Agreement |publisher=Routledge |year=2005 |isbn=978-0-415-32788-6 |location=London |page=[https://archive.org/details/politicsnorthern00augh/page/n15 7] |url-access=limited}}; "The troubles were over, but the killing continued. Some of the heirs to Ireland's violent traditions refused to give up their inheritance." {{Cite book |last=Holland |first=Jack |url=https://archive.org/details/hopeagainsthisto00holl/page/221 |title=Hope against History: The Course of Conflict in Northern Ireland |publisher=Henry Holt |year=1999 |isbn=978-0-8050-6087-4 |location=New York |page=[https://archive.org/details/hopeagainsthisto00holl/page/221 221]}}; Elliot, Marianne (2007). ''The Long Road to Peace in Northern Ireland: Peace Lectures from the Institute of Irish Studies at Liverpool University.'' University of Liverpool Institute of Irish Studies, Liverpool University Press. p. 2. {{ISBN|978-1-84631-065-2}}.</ref> Following a period of widespread economic slowdown and industrial strife in the 1970s, the [[Conservative Party (UK)|Conservative]] government of the 1980s led by [[Margaret Thatcher]] initiated a radical policy of [[monetarism]], [[deregulation]], particularly of the financial sector (for example, the [[Big Bang (financial markets)|Big Bang]] in 1986) and labour markets, the sale of state-owned companies (privatisation), and the withdrawal of subsidies to others.<ref>{{Cite book |last=Dorey |first=Peter |title=British politics since 1945 |publisher=Blackwell |year=1995 |isbn=978-0-631-19075-2 |series=Making contemporary Britain |location=Oxford |pages=164–223}}</ref>
In 1982, [[Argentina]] invaded the British territories of [[South Georgia and the South Sandwich Islands|South Georgia]] and the [[Falkland Islands]], leading to the 10-week [[Falklands War]] in which Argentine forces were defeated. The inhabitants of the islands strongly favour British sovereignty, expressed in a [[2013 Falkland Islands sovereignty referendum|2013 referendum]]. From 1984 the British economy was helped by the inflow of substantial [[North Sea oil]] revenues.<ref>{{Cite book |last1=Griffiths, Alan |url=http://vig.pearsoned.co.uk/catalog/uploads/Griffiths_C01.pdf |title=Applied Economics |last2=Wall, Stuart |publisher=Financial Times Press |year=2007 |isbn=978-0-273-70822-3 |edition=11th |location=Harlow |page=6 |access-date=26 December 2010 |archive-date=23 August 2009 |archive-url=https://web.archive.org/web/20090823124048/http://vig.pearsoned.co.uk/catalog/uploads/Griffiths_C01.pdf |url-status=dead}}</ref> Another British Overseas Territory, [[Gibraltar]],<ref>{{cite wikisource |title=Peace and Friendship Treaty of Utrecht between Spain and Great Britain}}</ref> is [[Port of Gibraltar|a key military base]]; a [[2002 Gibraltar sovereignty referendum|referendum in 2002]] on shared sovereignty with Spain was rejected.
By the late 20th century, major changes were made to the governance of the UK with the establishment of [[devolution|devolved]] administrations for Scotland, Wales and Northern Ireland.<ref>{{Cite journal |last=Keating |first=Michael |date=1 January 1998 |title=Reforging the Union: Devolution and Constitutional Change in the United Kingdom |journal=Publius: The Journal of Federalism |volume=28 |issue=1 |pages=217–234 |doi=10.1093/oxfordjournals.pubjof.a029948}}</ref> [[Human Rights Act 1998|The statutory incorporation]] followed acceptance of the [[European Convention on Human Rights]]. The UK remained a [[List of modern great powers#United Kingdom|great power]] with global diplomatic and military influence and a leading role in the United Nations and NATO.<ref name="David M. McCourt">{{Cite book |last=McCourt |first=David |url=https://books.google.com/books?id=lwpOnwEACAAJ&q=Britain+and+World+Power+Since+1945:+Constructing+a+Nation%27s+Role+in+International+Politics |title=Britain and World Power Since 1945: Constructing a Nation's Role in International Politics |publisher=[[University of Michigan Press]] |year=2014 |isbn=978-0-472-07221-7 |access-date=21 October 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141741/https://books.google.com/books?id=lwpOnwEACAAJ&q=Britain+and+World+Power+Since+1945:+Constructing+a+Nation%27s+Role+in+International+Politics |url-status=live}}</ref>
=== 21st century ===
{{Main|Political history of the United Kingdom (1979–present)|Social history of the United Kingdom (1979–present)}}
[[File:Johnson signed Brexit Withdrawal Agreement.jpg|thumb|Prime Minister [[Boris Johnson]] signs the [[Brexit withdrawal agreement]] in 2020, formally [[Brexit|withdrawing the UK]] from the [[European Union]] (EU).]]
The United Kingdom broadly supported the United States' approach to the "[[war on terror]]" in the early 21st century.<ref>{{Cite news |last=McSmith |first=Andy |date=5 July 2016 |title=The inside story of how Tony Blair led Britain to war in Iraq |work=Independent |location=London |url=https://www.independent.co.uk/news/uk/politics/chilcot-report-iraq-war-inquiry-tony-blair-george-bush-us-uk-what-happened-a7119761.html |access-date=17 February 2022 |archive-date=4 July 2016 |archive-url=https://web.archive.org/web/20160704200931/https://www.independent.co.uk/news/uk/politics/chilcot-report-iraq-war-inquiry-tony-blair-george-bush-us-uk-what-happened-a7119761.html |url-status=live}}</ref> British troops fought in the [[War in Afghanistan (2001–2021)|war in Afghanistan]], but controversy surrounded Britain's [[Iraq War|military deployment in Iraq]], which saw the [[15 February 2003 anti-war protests|largest protest in British history]] in opposition to the government led by [[Tony Blair]].<ref>{{Cite news |last=Adams |first=Tim |date=11 February 2023 |title='A beautiful outpouring of rage': did Britain's biggest ever protest change the world? |work=The Observer |location=London |url=https://www.theguardian.com/uk-news/2023/feb/11/slugs-iraq-war-london-protest-2003-legacy |access-date=5 June 2023 |archive-date=6 April 2023 |archive-url=https://web.archive.org/web/20230406052000/https://www.theguardian.com/uk-news/2023/feb/11/slugs-iraq-war-london-protest-2003-legacy |url-status=live}}</ref>
The [[Great Recession]] (2007–2010) severely affected the British economy,<ref name="Latest UK GDP data">{{cite web |date=20 December 2013 |title=Quarterly National Accounts – National accounts aggregates (ABMI Gross Domestic Product: chained volume measures: Seasonally adjusted £m, constant prices) |url=http://www.ons.gov.uk/ons/datasets-and-tables/data-selector.html?cdid=ABMI&dataset=qna&table-id=A2 |publisher=Office for National Statistics |access-date=28 July 2023 |archive-date=29 September 2015 |archive-url=https://web.archive.org/web/20150929150429/http://www.ons.gov.uk/ons/datasets-and-tables/data-selector.html?cdid=ABMI&dataset=qna&table-id=A2 |url-status=live}}</ref> and was followed by a period of weak growth and stagnation.<ref>{{Cite web |last=Harari |first=Daniel |date=16 July 2024 |title=Low growth: The economy's biggest challenge |url=https://commonslibrary.parliament.uk/low-growth-the-economys-biggest-challenge/#:~: |access-date=16 April 2025 |website=House of Commons Library}}</ref><ref>{{Cite news |last1=Rees |first1=Tom |last2=Atkinson |first2=Andrew |last3=Aldrick |first3=Philip |date=12 March 2023 |title=A Lost Decade Worse Than Japan's Threatens to Change UK Forever |url=https://www.bloomberg.com/news/articles/2023-03-12/a-lost-decade-worse-than-japan-s-threatens-to-change-uk-forever |access-date=16 April 2025 |work=[[Bloomberg News]] |archive-date=13 March 2023 |archive-url=https://web.archive.org/web/20230313051724/https://www.bloomberg.com/news/articles/2023-03-12/a-lost-decade-worse-than-japan-s-threatens-to-change-uk-forever |url-status=live }}</ref> The [[Cameron–Clegg coalition]] government of 2010 introduced [[United Kingdom government austerity programme|austerity measures]] intended to tackle the substantial public deficits.<ref>{{Cite news |date=7 November 2022 |title=What is austerity and where could 'eye-watering' cuts fall now? |work=BBC News |url=https://www.bbc.com/news/63304224 |access-date=28 July 2023 |archive-date=28 July 2023 |archive-url=https://web.archive.org/web/20230728105646/https://www.bbc.com/news/63304224 |url-status=live}}</ref> [[2014 Scottish independence referendum|A referendum]] on [[Scottish independence]] in 2014 resulted in the Scottish electorate voting by 55.3 to 44.7 per cent to remain part of the United Kingdom.<ref>{{Cite web |title=Scottish independence referendum – Results |url=https://www.bbc.co.uk/news/events/scotland-decides/results |access-date=18 February 2022 |website=BBC News |archive-date=18 September 2014 |archive-url=https://web.archive.org/web/20140918212409/https://www.bbc.co.uk/news/events/scotland-decides/results |url-status=live}}</ref>
In 2016, 51.9 per cent of voters in the UK [[2016 United Kingdom European Union membership referendum|voted to leave the European Union]] (EU).<ref>{{Cite news |date=24 June 2016 |title=In stunning decision, Britain votes to leave the E.U. |newspaper=[[The Washington Post]] |url=https://www.washingtonpost.com/world/britons-head-to-the-polls-for-historic-vote-on-eu/2016/06/23/0d466fb0-34a7-11e6-ab9d-1da2b0f24f93_story.html |access-date=24 June 2016 |first1=Griff |last1=Witte |first2=Karla |last2=Adam |first3=Dan |last3=Balz |archive-date=30 November 2022 |archive-url=https://web.archive.org/web/20221130215030/https://www.washingtonpost.com/world/britons-head-to-the-polls-for-historic-vote-on-eu/2016/06/23/0d466fb0-34a7-11e6-ab9d-1da2b0f24f93_story.html |url-status=live}}</ref> The [[Brexit|UK left the EU]] in 2020.<ref>{{Cite news |date=1 January 2021 |title=Brexit: New era for UK as it completes separation from European Union |work=BBC News |url=https://www.bbc.com/news/uk-politics-55502781 |access-date=18 February 2022 |archive-date=14 January 2021 |archive-url=https://web.archive.org/web/20210114212309/https://www.bbc.com/news/uk-politics-55502781 |url-status=live}}</ref> On 1 May 2021 the [[EU–UK Trade and Cooperation Agreement]], a free trade agreement between the UK and the EU, came into force.<ref name="commission.europa.eu">{{Cite web |title=The EU-UK Trade and Cooperation Agreement |url=https://commission.europa.eu/strategy-and-policy/relations-non-eu-countries/relations-united-kingdom/eu-uk-trade-and-cooperation-agreement_en |archive-url=https://web.archive.org/web/20230325155905/https://commission.europa.eu/strategy-and-policy/relations-non-eu-countries/relations-united-kingdom/eu-uk-trade-and-cooperation-agreement_en |archive-date=25 March 2023 |access-date=25 March 2023}}</ref><ref>{{Cite web |access-date=12 September 2025 |title=Free Trade Agreements EU-UK |url=https://rtais.wto.org/UI/PublicShowRTAIDCard.aspx?rtaid=1137}}</ref>
The [[COVID-19 pandemic in the United Kingdom|COVID-19 pandemic]] had a severe [[Economic impact of the COVID-19 pandemic in the United Kingdom|impact on the British economy]], caused major [[Impact of the COVID-19 pandemic on education in the United Kingdom|disruptions to education]] and had [[Social impact of the COVID-19 pandemic in the United Kingdom|far-reaching impacts on society and politics]] in 2020 and 2021.<ref name="GOVUK">{{cite web |url=https://coronavirus.data.gov.uk/ |title=Coronavirus (COVID-19) in the UK |website=[[gov.uk]] |publisher=Government of the United Kingdom |access-date=15 April 2020 |archive-url=https://web.archive.org/web/20210501022145/https://coronavirus.data.gov.uk/ |archive-date=1 May 2021}}</ref><ref>{{Cite web |title=Coronavirus and the impact on output in the UK economy: April 2020 |url=https://www.ons.gov.uk/economy/grossdomesticproductgdp/articles/coronavirusandtheimpactonoutputintheukeconomy/april2020 |access-date=2 August 2020 |publisher=Government of the United Kingdom |website=ons.gov.uk |archive-date=2 August 2020 |archive-url=https://web.archive.org/web/20200802031859/https://www.ons.gov.uk/economy/grossdomesticproductgdp/articles/coronavirusandtheimpactonoutputintheukeconomy/april2020 |url-status=live}}</ref><ref>{{Cite news |last=Walker |first=Andrew |date=10 June 2020 |title=Coronavirus: UK economy could be among worst hit of leading nations, says OECD |work=BBC News |url=https://www.bbc.com/news/business-52991913 |access-date=2 August 2020 |archive-date=18 August 2020 |archive-url=https://web.archive.org/web/20200818031423/https://www.bbc.com/news/business-52991913 |url-status=live}}</ref> The United Kingdom was the first country in the world to use an approved [[COVID-19 vaccine]]. Developing a [[Oxford–AstraZeneca COVID-19 vaccine|vaccine in the UK]] allowed the rollout to be amongst the fastest in the world.<ref>{{Cite web |title=Landmark moment as first NHS patient receives COVID-19 vaccination |url=https://www.england.nhs.uk/2020/12/landmark-moment-as-first-nhs-patient-receives-covid-19-vaccination/ |archive-url=https://web.archive.org/web/20230225194320/https://www.england.nhs.uk/2020/12/landmark-moment-as-first-nhs-patient-receives-covid-19-vaccination/ |archive-date=25 February 2023 |website=NHS |date=8 December 2020}}</ref><ref>{{Cite web |title=Oxford University/AstraZeneca COVID-19 vaccine approved |url=https://www.gov.uk/government/news/oxford-universityastrazeneca-covid-19-vaccine-approved |archive-url=https://web.archive.org/web/20230225194442/https://www.gov.uk/government/news/oxford-universityastrazeneca-covid-19-vaccine-approved |archive-date=25 February 2023 |website=UK Government}}</ref>
== Geography ==
{{Main|Geography of the United Kingdom|Fauna of Great Britain|Flora of Great Britain and Ireland}}
[[File:MODIS - Great Britain and Northern Ireland - 2012-06-04 during heat wave (cropped).jpg|thumb|upright|A satellite image of the United Kingdom excluding [[Shetland]]]]
The total area of the United Kingdom is approximately {{Convert|244376|km2|sqmi|order=flip}},{{efn|name=ONSArea}}<ref name="ONS Standard Area Measurement" /> with a land area of {{convert|242741|km2|sqmi|order=flip}}.<ref name="ONS Standard Area Measurement" /> It occupies the major part of the [[British Isles]]<ref>[[Oxford English Dictionary]]: "British Isles: a geographical term for the islands comprising Great Britain and Ireland with all their offshore islands including the Isle of Man and the Channel Islands."</ref> and includes the island of Great Britain, the north-eastern one-sixth of the island of Ireland and [[List of islands of the United Kingdom|some smaller surrounding islands]], meaning it comprises [[England]], [[Scotland]], [[Wales]] and [[Northern Ireland]].<ref name="ONS Geography Guide">{{cite web |url=https://geoportal.statistics.gov.uk/datasets/d1f39e20edb940d58307a54d6e1045cd/about |title=A Beginner's Guide to UK Geography (2023) |author=<!--Not stated--> |date=4 February 2025 |website=Open Geography Portal |publisher=Office for National Statistics |access-date=14 May 2025}}</ref>
Geographically, the United Kingdom lies between the [[North Atlantic Ocean]] and the [[North Sea]] with the southeast coast coming within {{Convert|35|km|mi|0|order=flip}} of the coast of northern France, from which it is separated by the [[English Channel]].<ref name="factbook">{{Cite web |title=United Kingdom |url=https://www.cia.gov/the-world-factbook/countries/united-kingdom |access-date=21 January 2007 |website=[[The World Factbook]] |publisher=Central Intelligence Agency |archive-date=9 January 2021 |archive-url=https://web.archive.org/web/20210109221834/https://www.cia.gov/the-world-factbook/countries/united-kingdom |url-status=dead}}</ref>
The nearby island polities of the [[Isle of Man]], [[Jersey]] and [[Guernsey]] are [[Crown Dependencies]], in union with the [[Monarchy of the United Kingdom|British monarch]], but do not strictly form part of the United Kingdom or any of its three jurisdictions or four countries, although the British government retains responsibility for their external affairs. The Isle of Man lies roughly midway between Great Britain and the [[Ireland|island of Ireland]] in the [[Irish Sea]], while the Channel Islands lie just off the northern French coast.
The [[Royal Observatory, Greenwich|Royal Greenwich Observatory]] in London was chosen as the defining point of the [[Prime Meridian]]<ref>{{Cite web |last=ROG Learning Team |date=23 August 2002 |title=The Prime Meridian at Greenwich |url=http://www.rmg.co.uk/explore/astronomy-and-time/astronomy-facts/history/the-prime-meridian-at-greenwich |archive-url=https://web.archive.org/web/20151107023957/http://www.rmg.co.uk/explore/astronomy-and-time/astronomy-facts/history/the-prime-meridian-at-greenwich |archive-date=7 November 2015 |access-date=11 September 2012 |website=Royal Museums Greenwich}}</ref> at the [[International Meridian Conference]] in 1884.<ref>{{Cite news |date=13 August 2015 |title=Greenwich Royal Observatory: How the Prime Meridian line is actually 100 metres away from where it was believed to be |work=Independent |location=London |url=https://www.independent.co.uk/news/science/greenwich-royal-observatory-how-the-prime-meridian-line-is-actually-100-metres-away-from-where-it-10452386.html |access-date=13 December 2018 |archive-date=23 March 2019 |archive-url=https://web.archive.org/web/20190323081414/https://www.independent.co.uk/news/science/greenwich-royal-observatory-how-the-prime-meridian-line-is-actually-100-metres-away-from-where-it-10452386.html |url-status=live}}</ref>
The UK lies between latitudes [[49th parallel north|49°]] and [[61st parallel north|61° N]], and longitudes [[9th meridian west|9° W]] and [[2nd meridian east|2° E]]. Northern Ireland shares a {{Convert|499|km|mi|0|adj=on|order=flip}} land boundary with the Republic of Ireland<ref name="factbook" /> and has a {{Convert|650|km|mi|0|adj=on|order=flip}} coastline.<ref name="NI coastline">{{Cite web |title=Northern Ireland Coastal and Marine Forum |url=https://library2.nics.gov.uk/pdf/dard/2014/EEUD.pdf |archive-url=https://web.archive.org/web/20241123094028/https://library2.nics.gov.uk/pdf/dard/2014/EEUD.pdf |archive-date=23 November 2024 |access-date=13 March 2025 |publisher=Northern Ireland Coastal and Marine Forum}}</ref> The length of coastline of Great Britain plus its principal islands is about {{Convert|31368|km|mi|0|order=flip}} long, with the coastline of the main island Great Britain being {{Convert|17820|km|mi|0|order=flip}} of that,<ref name="UK coastline">{{Cite web |last=Darkes |first=Giles |date=January 2008 |title=How long is the UK coastline? |url=http://www.cartography.org.uk/default.asp?contentID=749 |archive-url=https://web.archive.org/web/20120522042745/http://www.cartography.org.uk/default.asp?contentID=749 |archive-date=22 May 2012 |access-date=24 January 2015 |publisher=The [[British Cartographic Society]]}}</ref> though measurements can vary greatly due to the [[coastline paradox]].<ref>{{Cite web |last=Weiner |first=Sophie |date=3 March 2018 |title=Why it's Impossible to Accurately Measure a Coastline |url=https://www.popularmechanics.com/science/environment/a19068718/why-its-impossible-to-accurately-measure-a-coastline/ |access-date=29 June 2024 |website=Popular Mechanics |archive-date=29 June 2024 |archive-url=https://web.archive.org/web/20240629025825/https://www.popularmechanics.com/science/environment/a19068718/why-its-impossible-to-accurately-measure-a-coastline/ |url-status=live}}</ref> It is connected to continental Europe by the [[Channel Tunnel]], which at {{Convert|50|km|mi|0|order=flip}} ({{Convert|38|km|mi|0|order=flip}} underwater) is the longest underwater tunnel in the world.<ref>{{Cite web |title=The Channel Tunnel |url=http://www.eurotunnel.com/ukcP3Main/ukcCorporate/ukcTunnelInfrastructure/ukcInfrastructure |archive-url=https://web.archive.org/web/20101218114514/http://www.eurotunnel.com/ukcP3Main/ukcCorporate/ukcTunnelInfrastructure/ukcInfrastructure |archive-date=18 December 2010 |access-date=8 March 2015 |publisher=Eurotunnel}}</ref>
The UK contains four terrestrial [[ecoregion]]s: [[Celtic broadleaf forests]], [[English Lowlands beech forests]], [[North Atlantic moist mixed forests]], and [[Caledonian Forest|Caledonian conifer forests]].<ref>{{Cite journal |last1=Dinerstein |first1=Eric |last2=Olson |first2=David |last3=Joshi |first3=Anup |last4=Vynne |first4=Carly |last5=Burgess |first5=Neil D. |last6=Wikramanayake |first6=Eric |last7=Hahn |first7=Nathan |last8=Palminteri |first8=Suzanne |last9=Hedao |first9=Prashant |last10=Noss |first10=Reed |last11=Hansen |first11=Matt |last12=Locke |first12=Harvey |last13=Ellis |first13=Erle C |last14=Jones |first14=Benjamin |last15=Barber |first15=Charles Victor |display-authors=1 |year=2017 |title=An Ecoregion-Based Approach to Protecting Half the Terrestrial Realm |journal=BioScience |volume=67 |issue=6 |pages=534–545 |doi=10.1093/biosci/bix014 |issn=0006-3568 |pmc=5451287 |pmid=28608869 |doi-access=free |last16=Hayes |first16=Randy |last17=Kormos |first17=Cyril |last18=Martin |first18=Vance |last19=Crist |first19=Eileen |last20=Sechrest |first20=Wes |last21=Price |first21=Lori |last22=Baillie |first22=Jonathan E. M. |last23=Weeden |first23=Don |last24=Suckling |first24=Kierán |last25=Davis |first25=Crystal |last26=Sizer |first26=Nigel |last27=Moore |first27=Rebecca |last28=Thau |first28=David |last29=Birch |first29=Tanya |last30=Potapov |first30=Peter |last31=Turubanova |first31=Svetlana |last32=Tyukavina |first32=Alexandra |last33=de Souza |first33=Nadia |last34=Pintea |first34=Lilian |last35=Brito |first35=José C. |last36=Llewellyn |first36=Othman A. |last37=Miller |first37=Anthony G. |last38=Patzelt |first38=Annette |last39=Ghazanfar |first39=Shahina A. |last40=Timberlake |first40=Jonathan |last41=Klöser |first41=Heinz |last42=Shennan-Farpón |first42=Yara |last43=Kindt |first43=Roeland |last44=Lillesø |first44=Jens-Peter Barnekow |last45=van Breugel |first45=Paulo |last46=Graudal |first46=Lars |last47=Voge |first47=Maianna |last48=Al-Shammari |first48=Khalaf F. |last49=Saleem |first49=Muhammad}}</ref> The area of woodland in the UK was estimated to be 3.25 million hectares in 2023, which represents 13 per cent of its land area.<ref>{{Cite web |url=https://www.forestresearch.gov.uk/tools-and-resources/statistics/statistics-by-topic/woodland-statistics/ |title=Woodland Statistics, Key findings |work=Forest Research |access-date=8 July 2023 |archive-date=2 August 2023 |archive-url=https://web.archive.org/web/20230802030149/https://www.forestresearch.gov.uk/tools-and-resources/statistics/statistics-by-topic/woodland-statistics/ |url-status=live}}</ref>
=== Climate ===
{{Main|Climate of the United Kingdom|Climate change in the United Kingdom}}
{{Further|Climate of England|Climate of Scotland|Climate of Wales|Climate of Northern Ireland}}
Most of the United Kingdom has a temperate climate, with generally cool temperatures and plentiful rainfall all year round.<ref name="factbook" /> The temperature varies with the seasons rarely dropping below {{Convert|0|C|lk=on}} or rising above {{Convert|30|C}}.<ref>{{Cite web |title=Hottest day of each year from 1900 |url=https://www.trevorharley.com/hottest-day-of-each-year-from-1900.html |website=trevorharley.com |access-date=23 November 2019 |archive-date=16 June 2023 |archive-url=https://web.archive.org/web/20230616173152/https://www.trevorharley.com/hottest-day-of-each-year-from-1900.html |url-status=live}}; {{Cite web |title=Coldest day of each year from 1900 |url=https://www.trevorharley.com/coldest-days-of-each-year-from-1900.html |website=trevorharley.com |access-date=23 November 2019 |archive-date=9 July 2023 |archive-url=https://web.archive.org/web/20230709173537/https://www.trevorharley.com/coldest-days-of-each-year-from-1900.html |url-status=live}}</ref> Some parts, away from the coast, of upland England, Wales, Northern Ireland and most of Scotland, experience a [[subpolar oceanic climate]]. Higher elevations in Scotland experience a [[Subarctic climate|continental subarctic climate]] and the mountains experience a [[tundra climate]].<ref>{{Cite web |date=9 August 2016 |title=English: A map of Köppen climate types in the United Kingdom (SVG version) |url=https://commons.wikimedia.org/wiki/File:UK_K%C3%B6ppen.svg |access-date=23 November 2019 |archive-date=9 July 2023 |archive-url=https://web.archive.org/web/20230709202702/https://commons.wikimedia.org/wiki/File:UK_K%C3%B6ppen.svg |url-status=live}}</ref>
The prevailing wind is from the southwest and bears frequent spells of mild and wet weather from the Atlantic Ocean,<ref name="factbook" /> although the eastern parts are mostly sheltered from this wind. Since the majority of the rain falls over the western regions, the eastern parts are the driest. Atlantic currents, warmed by the [[Gulf Stream]], bring mild winters, especially in the west where winters are wet and even more so over high ground. Summers are warmest in the southeast of England and coolest in the north. Heavy snowfall can occur in winter and early spring on high ground, and occasionally settles to great depth away from the hills.<ref>{{Cite web |title=Atlantic Ocean Circulation (Gulf Stream) |url=http://ukclimateprojections.metoffice.gov.uk/23152 |access-date=8 March 2015 |website=UK Climate Projections |publisher=Met Office |archive-date=17 October 2018 |archive-url=https://web.archive.org/web/20181017162552/http://ukclimateprojections.metoffice.gov.uk/23152 |url-status=live}}</ref>
The average total annual sunshine in the United Kingdom was 1,339.7 hours between 1971 and 2000.<ref name="ukaverages">{{cite web |title=UK 1971–2000 averages |url=http://www.metoffice.gov.uk/climate/uk/averages/19712000/areal/uk.html |url-status=dead |archive-url=https://web.archive.org/web/20090705140124/http://www.metoffice.gov.uk/climate/uk/averages/19712000/areal/uk.html |archive-date=5 July 2009 |access-date=4 August 2007 |publisher=Met Office}}</ref> The hours of sunshine vary from 1,200 to about 1,580 hours per year.<ref name="met off climate series">{{Cite web |url=https://www.metoffice.gov.uk/research/climate/maps-and-data/uk-temperature-rainfall-and-sunshine-time-series |title=UK temperature, rainfall and sunshine time series |website=Met Office |access-date=31 December 2022 |archive-date=17 October 2019 |archive-url=https://web.archive.org/web/20191017203556/https://www.metoffice.gov.uk/research/climate/maps-and-data/uk-temperature-rainfall-and-sunshine-time-series |url-status=live}}</ref>
Climate change has serious impacts on the country. A third of food price rise in 2023 was attributed to it.<ref>{{cite web |last1=Smeeton |first1=George |title=Families hit by £605 food bill as extreme weather and energy crisis bites |url=https://eciu.net/media/press-releases/2023/families-hit-by-605-food-bill-as-extreme-weather-and-energy-crisis-bites |website=Energy & Climate Intelligence Unit |date=28 November 2023 |access-date=19 July 2024 |archive-date=16 July 2024 |archive-url=https://web.archive.org/web/20240716124143/https://eciu.net/media/press-releases/2023/families-hit-by-605-food-bill-as-extreme-weather-and-energy-crisis-bites |url-status=live}}</ref> In 2024 the United Kingdom ranked 5th out of 180 countries in the [[Environmental Performance Index]].<ref>{{Cite web |title=2024 Environmental Performance Index |url=https://epi.yale.edu/measure/2024/EPI |access-date=27 May 2025 |website=Environmental Performance Index |language=en |archive-date=10 July 2024 |archive-url=https://web.archive.org/web/20240710023935/https://epi.yale.edu/measure/2024/EPI |url-status=live }}</ref> A law has been passed that [[Greenhouse gas emissions by the United Kingdom|UK greenhouse gas emissions]] will be [[net zero]] by 2050.<ref>{{Cite web |title=UK net zero target |url=https://www.instituteforgovernment.org.uk/explainers/net-zero-target#:~:text=In%20June%202019%2C%20parliament%20passed,to%201990%20levels%20by%202050.&text=Prior%20to%20this%2C%20the%20UK,1990%20levels%2C%20also%20by%202050. |access-date=20 March 2024 |website=Institute for Government |date=20 April 2020|last=Shepheard|first=Marcus}}</ref>{{Update after|2050|01|01|category|reason=Hello from 2024! By the time you're reading this, that law will be a little older than 30 years old. Could you check if the UK ever ended up hitting that net zero GHG target?}}
=== Topography ===
[[File:uk topo en.jpg|thumb|right|The United Kingdom's topography]]
[[Geography of England|England]] accounts for 53 per cent of the UK, covering {{Convert|130395|km2|sqmi|order=flip|-1}}.<ref>{{Cite news |date=11 February 2010 |title=England – Profile |work=BBC News |url=http://news.bbc.co.uk/2/hi/europe/country_profiles/7327029.stm |access-date=9 October 2010 |archive-date=15 April 2018 |archive-url=https://web.archive.org/web/20180415064122/http://news.bbc.co.uk/1/hi/world/europe/country_profiles/7327029.stm |url-status=live}}</ref> Most of the country consists of lowland terrain,<ref name="Atlapedia">{{Cite web |last=Latimer Clarke Corporation Pty Ltd |title=United Kingdom – Atlapedia Online |url=http://www.atlapedia.com/online/countries/unitedki.htm |access-date=26 October 2010 |website=Atlapedia.com |archive-date=21 March 2012 |archive-url=https://web.archive.org/web/20120321191308/http://www.atlapedia.com/online/countries/unitedki.htm |url-status=live}}{{better source needed|date=July 2023}}</ref> with upland and mountainous terrain northwest of the [[Tees–Exe line]] which roughly divides the UK into [[lowland and upland]] areas. Lowland areas include [[Cornwall]], the [[New Forest]], the [[South Downs]] and the [[The Broads|Norfolk Broads]]. Upland areas include the [[Lake District]], the [[Pennines]], the [[Yorkshire Dales]], [[Exmoor]] and [[Dartmoor]]. The main rivers and estuaries are the [[River Thames|Thames]], [[River Severn|Severn]], and the [[Humber]]. England's highest mountain is [[Scafell Pike]], at {{Convert|978|m|ft|0}} in the Lake District; its largest island is the [[Isle of Wight]].
[[Geography of Scotland|Scotland]] accounts for 32 per cent of the UK, covering {{Convert|78772|km2|sqmi|order=flip|-1}}.<ref>{{Cite web |title=Scotland Facts |url=http://www.scotland.org/about/fact-file/index.html |archive-url=https://web.archive.org/web/20080621045248/http://www.scotland.org/about/fact-file/index.html |archive-date=21 June 2008 |access-date=16 July 2008 |publisher=Scotland Online Gateway}}</ref> This includes [[List of islands of Scotland|nearly 800 islands]],<ref>{{Cite news |last=Winter |first=Jon |date=1 June 2000 |title=The complete guide to the ... Scottish Islands |work=Independent |location=London |url=https://www.independent.co.uk/travel/uk/the-complete-guide-to-the--scottish-islands-633851.html |access-date=8 March 2015 |archive-date=2 April 2015 |archive-url=https://web.archive.org/web/20150402164423/http://www.independent.co.uk/travel/uk/the-complete-guide-to-the--scottish-islands-633851.html |url-status=live}}</ref> notably the [[Hebrides]], [[Orkney]] Islands and [[Shetland Islands]]. Scotland is the most mountainous constituent country of the UK. The [[Scottish Highlands|Highlands]] to the north and west are the more rugged region containing the majority of Scotland's mountainous land, including the [[Cairngorms]], [[Loch Lomond and The Trossachs]] and [[Ben Nevis]] which at {{Convert|1345|m|ft|0}}<ref>{{Cite web |date=18 March 2016 |title=Great Britain's tallest mountain is taller |work=Ordnance Survey Blog |url=https://www.ordnancesurvey.co.uk/blog/2016/03/britains-tallest-mountain-is-taller |access-date=9 September 2018 |publisher=Ordnance Survey |archive-date=9 September 2018 |archive-url=https://web.archive.org/web/20180909000504/https://www.ordnancesurvey.co.uk/blog/2016/03/britains-tallest-mountain-is-taller/ |url-status=live}}</ref> is the highest point in the British Isles.<ref>{{Cite web |title=Ben Nevis Weather |url=http://www.bennevisweather.co.uk/index.asp |archive-url=https://web.archive.org/web/20120510193022/http://www.bennevisweather.co.uk/index.asp |archive-date=10 May 2012 |access-date=26 October 2008 |publisher=Ben Nevis Weather}}</ref>
[[Geography of Wales|Wales]] accounts for less than 9 per cent of the UK, covering {{Convert|20779|km2|sqmi|order=flip|-1}}.<ref>{{Cite news |date=9 June 2010 |title=Profile: Wales |work=BBC News |url=http://news.bbc.co.uk/2/hi/europe/country_profiles/6233450.stm |access-date=7 November 2010 |archive-date=26 August 2018 |archive-url=https://web.archive.org/web/20180826085704/http://news.bbc.co.uk/2/hi/europe/country_profiles/6233450.stm |url-status=live}}</ref> It is mostly mountainous, though [[South Wales]] is less mountainous than [[North Wales|North]] and [[Mid Wales]]. The highest mountains in Wales are in [[Snowdonia]] and include [[Snowdon]] ({{Langx|cy|Yr Wyddfa}}) which, at {{Convert|1085|m|ft|0}}, is the highest peak in Wales.<ref name="Atlapedia" /> Wales has over {{Convert|1680|mi|0|abbr=off}} of coastline including the [[Pembrokeshire Coast]].<ref name="UK coastline" /> Several islands lie off the Welsh mainland, the largest of which is [[Anglesey]] (''Ynys Môn'').
[[Geography of Ireland|Northern Ireland]], separated from Great Britain by the [[Irish Sea]] and [[North Channel (Great Britain and Ireland)|North Channel]], has an area of {{Convert|14160|km2|sqmi|order=flip|-1}} and is mostly hilly. It includes [[Lough Neagh]] which, at {{Convert|388|km2|sqmi|order=flip|0}}, is the largest lake in the British Isles by area,<ref>{{Cite web |title=Geography of Northern Ireland |url=http://cain.ulst.ac.uk/ni/geog.htm |access-date=22 May 2006 |publisher=University of Ulster |archive-date=18 January 2012 |archive-url=https://web.archive.org/web/20120118133131/http://cain.ulst.ac.uk/ni/geog.htm |url-status=live}}</ref> [[Lough Erne]], which has over 150 islands, and the [[Giant's Causeway]], which is listed by [[UNESCO]] as a [[World Heritage Site]]. The highest peak in Northern Ireland is [[Slieve Donard]] in the [[Mourne Mountains]] at {{Convert|852|m|ft|0}}.<ref name="Atlapedia" />
== Government and politics ==
{{Main|Politics of the United Kingdom|Government of the United Kingdom|Monarchy of the United Kingdom}}
{{Further|Constitution of the United Kingdom}}{{Multiple image
| direction = horizontal
| align = right
| caption_align = center
| total_width = 320
| image1 = King Charles III (July 2023).jpg
| image2 = Prime Minister Andy Burnham portrait (cropped).jpg
| caption1 = {{nowrap|[[Charles III]]}}<br>[[Monarch of the United Kingdom|King]]
| caption2 = {{nowrap|[[Andy Burnham]]}}<br>{{nowrap|[[Prime Minister of the United Kingdom|Prime Minister]]}}
| alt1 =
| alt2 =
}}
The United Kingdom is a [[constitutional monarchy]] and a [[parliamentary democracy]]<ref>[http://www.royal.gov.uk/MonarchUK/HowtheMonarchyworks/Whatisconstitutionalmonarchy.aspx The British Monarchy, "What is constitutional monarchy?"] {{Webarchive|url=https://web.archive.org/web/20190604151257/http://www.royal.gov.uk/MonarchUK/HowtheMonarchyworks/Whatisconstitutionalmonarchy.aspx|date=4 June 2019}}. Retrieved 17 July 2013; [https://www.cia.gov/the-world-factbook/countries/united-kingdom/ "United Kingdom"] {{Webarchive|url=https://web.archive.org/web/20210109221834/https://www.cia.gov/the-world-factbook/countries/united-kingdom/|date=9 January 2021}} CIA ''The World Factbook''. Retrieved 17 July 2013</ref> operating under the [[Westminster system]], otherwise known as a "democratic parliamentary monarchy".<ref>{{Cite journal |last1=Stepan |first1=Alfred |last2=Linz |first2=Juan J. |last3=Minoves |first3=Juli F. |date=2014 |title=Democratic Parliamentary Monarchies |url=http://muse.jhu.edu/content/crossref/journals/journal_of_democracy/v025/25.2.stepan.html |journal=Journal of Democracy |volume=25 |issue=2 |pages=35–36 |doi=10.1353/jod.2014.0032 |issn=1086-3214 |s2cid=154555066 |url-access=subscription |archive-date=31 January 2026 |access-date=11 January 2023 |archive-url=https://web.archive.org/web/20260131155632/https://muse.jhu.edu/content/crossref/journals/journal_of_democracy/v025/25.2.stepan.html |url-status=live }}</ref> It is a [[Centralized government|centralised]], [[unitary state]]<ref>{{Cite web |last=Lewer |first=Andrew |date=5 May 2021 |title=The UK is one of the most centralised advanced democracies – it's time that changed |url=https://www.newstatesman.com/spotlight/2021/05/the-uk-is-one-of-the-most-centralised-advanced-democracies-its-time-that-changed |access-date=3 July 2023 |website=[[New Statesman]] |archive-date=3 July 2023 |archive-url=https://web.archive.org/web/20230703131907/https://www.newstatesman.com/spotlight/2021/05/the-uk-is-one-of-the-most-centralised-advanced-democracies-its-time-that-changed |url-status=live|author-link=Andrew Lewer}}</ref><ref>{{Cite web |title=Centralisation Nation: Britain's system of local government and its impact on the national economy |url=https://www.centreforcities.org/?post_type=publication&p=40951 |access-date=3 July 2023 |website=Centre for Cities |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141833/https://www.centreforcities.org/publication/centralisation-nation/ |url-status=live}}</ref> wherein the [[Parliament of the United Kingdom]] is [[Parliamentary sovereignty in the United Kingdom|sovereign]].<ref>{{Cite web |title=Parliamentary Sovereignty |url=https://www.parliament.uk/site-information/glossary/parliamentary-sovereignty |access-date=19 July 2021 |website=[[parliament.uk]] |archive-date=11 August 2021 |archive-url=https://web.archive.org/web/20210811195135/https://www.parliament.uk/site-information/glossary/parliamentary-sovereignty/ |url-status=live}}</ref> Parliament is made up of the elected [[House of Commons of the United Kingdom|House of Commons]], the appointed [[House of Lords]] and [[the Crown]] (as personified by [[Monarchy of the United Kingdom|the monarch]]).{{Efn|British [[sovereignty]] derives from the Crown, a [[corporation sole]] occupied by the monarch. It is therefore by and through the monarch that Parliament exercises supreme legislative authority over both the executive and judiciary. Distinguished Professor of [[Public Law]] Maurice Sunkin opined the Crown symbolically occupies "...what in other places would be a core element of a written constitution."<ref>{{Cite web |url=https://www.ibanet.org/Relationship-between-UK-Crown-and-law-in-focus-as-Carolean-era-begins |title=Relationship between UK Crown and law in focus as Carolean era begins |author=Polly Botsford |publisher=International Bar Association |publication-date=22 September 2022 |access-date=4 July 2023 |archive-date=6 May 2023 |archive-url=https://web.archive.org/web/20230506211218/https://www.ibanet.org/Relationship-between-UK-Crown-and-law-in-focus-as-Carolean-era-begins |url-status=live}}</ref> As a result of this state of constitutional affairs, the monarch is formally referred to as "[[Sovereign|the Sovereign]]" in legislation.<ref>{{Cite web |url=https://www.legislation.gov.uk/ukpga/1978/30/section/10 |title=Interpretation Act 1978 (c. 30, s. 10) |publisher=The National Archives |access-date=4 July 2023 |archive-date=30 July 2023 |archive-url=https://web.archive.org/web/20230730073659/https://www.legislation.gov.uk/ukpga/1978/30/section/10 |url-status=live}}</ref>}}<ref name="parliament.uk">{{Cite web |title=Parliament |url=https://www.parliament.uk/about/how/role |access-date=19 July 2021 |website=[[parliament.uk]] |archive-date=18 February 2026 |archive-url=https://web.archive.org/web/20260218150954/https://www.parliament.uk/about/how/role/ |url-status=live }}</ref> The main business of Parliament takes place in the two houses,<ref name="parliament.uk" /> but [[royal assent]] is required for a bill to become an [[Act of Parliament (UK)|act of Parliament]] (that is, [[statute law]]).<ref>{{Cite web |title=Royal Assent |url=https://www.parliament.uk/about/how/laws/passage-bill/lords/lrds-royal-assent |access-date=19 July 2021 |website=[[parliament.uk]] |archive-date=16 July 2021 |archive-url=https://web.archive.org/web/20210716022947/https://www.parliament.uk/about/how/laws/passage-bill/lords/lrds-royal-assent/ |url-status=live}}</ref> As a result of parliamentary sovereignty, the [[Constitution of the United Kingdom|British constitution]] is [[Uncodified constitution|uncodified]], consisting mostly of disparate written sources, including parliamentary [[statute]]s, judge-made [[case law]] and international treaties, together with [[British Constitution#Conventions|constitutional conventions]].<ref>{{Cite web |last=Carter, Sarah |title=A Guide To the UK Legal System |url=http://www.llrx.com/features/uk2.htm#UK%20Legal%20System |archive-url=https://web.archive.org/web/20120505115306/http://www.llrx.com/features/uk2.htm |archive-date=5 May 2012 |access-date=16 May 2006 |publisher=[[University of Kent]] at Canterbury}}</ref> Nevertheless, the [[Supreme Court of the United Kingdom|Supreme Court]] recognises a number of principles underlying the British constitution, such as parliamentary sovereignty, the [[rule of law]], [[democracy]] and upholding [[Internationalism (politics)|international law]].<ref>See ''[[R (Miller) v Prime Minister]]'' [2019] UKSC 41 (Parliamentary sovereignty), ''[[R (UNISON) v Lord Chancellor]]'' [2017] [http://www.bailii.org/uk/cases/UKSC/2017/51.html UKSC 51] {{Webarchive|url=https://web.archive.org/web/20230104095357/https://www.bailii.org/uk/cases/UKSC/2017/51.html|date=4 January 2023}}, [67] ff (rule of law), ''[[R (Animal Defenders International) v Secretary of State for Culture Media and Sport]]'' [2008] UKHL 15, [48] (democracy), ''[[R v Lyons]]'' [2002] [https://www.bailii.org/uk/cases/UKHL/2002/44.html UKHL 44] {{Webarchive|url=https://web.archive.org/web/20230122064021/https://www.bailii.org/uk/cases/UKHL/2002/44.html|date=22 January 2023}}, [27] (international law).</ref>
[[Charles III|King Charles III]] is the [[monarch]] and [[head of state]] of the United Kingdom and 14 other independent [[sovereign state]]s, referred to as "[[Commonwealth realm]]s". The monarch is formally vested with all executive authority as the personal embodiment of [[the Crown]] and is "fundamental to the law and working of government in the UK".<ref>{{Cite journal |url=https://kclpure.kcl.ac.uk/portal/en/publications/the-constitutional-role-and-working-of-the-monarchy-in-the-united |title=The Constitutional Role and Working of the Monarchy in the United Kingdom |author=Robert Blackburn |journal=Jahrbuch des Öffentlichen Rechts der Gegenwart |series=Neue Folge |year=2022 |volume=70 |pages=181–201 |editor=O. Lepsius |editor2=A. Nußberger |editor3=C. Schönberger |editor4=C. Waldhoff |editor5=C. Walter |name-list-style=amp |publisher=Mohr Siebeck |doi=10.1628/joer-2022-0009 |s2cid=257830288 |publication-date=2 June 2022 |access-date=19 June 2023 |archive-date=19 June 2023 |archive-url=https://web.archive.org/web/20230619174428/https://kclpure.kcl.ac.uk/portal/en/publications/the-constitutional-role-and-working-of-the-monarchy-in-the-united |url-status=live}}</ref> The disposition of such powers however, including those belonging to the [[Royal prerogative in the United Kingdom|royal prerogative]], is generally exercised only on the [[Advice (constitutional law)|advice]] of [[ministers of the Crown]] responsible to Parliament and thence to the electorate. Nevertheless, in the performance of official duties the monarch has "the right to be consulted, the right to encourage, and the right to warn".<ref>[[Walter Bagehot|Bagehot, Walter]] (1867). ''The English Constitution''. London: Chapman and Hall. p. 103.</ref> In addition the monarch has a number of [[Reserve power#United Kingdom|reserve powers]] at his disposal to uphold [[responsible government]] and prevent [[constitutional crisis|constitutional crises]].{{Efn|For instance, the monarch alone appoints the prime minister and confers [[Orders, decorations, and medals of the United Kingdom|state honours]] in the personal gift of the Crown. When necessary, the monarch may also refuse a [[dissolution of Parliament|dissolution]] or [[Prorogation in the United Kingdom|prorogation of Parliament]], withhold [[royal assent]] to [[Act of Parliament (UK)|primary legislation]], and prevent illegal use of the [[British Armed Forces]], amongst other reserve powers.<ref>{{Cite web |url=https://researchbriefings.files.parliament.uk/documents/CBP-8885/CBP-8885.pdf |title=The Crown and the Constitution |author=David Torrance |publisher=House of Commons Library |publication-date=11 January 2023 |access-date=19 June 2023 |pages=22 |archive-date=2 March 2023 |archive-url=https://web.archive.org/web/20230302033737/https://researchbriefings.files.parliament.uk/documents/CBP-8885/CBP-8885.pdf |url-status=live}}</ref>}}
The prime minister is the [[head of government]] in the United Kingdom.<ref>{{Cite web |title=The Government, Prime Minister and Cabinet |url=http://direct.gov.uk/en/Governmentcitizensandrights/UKgovernment/Centralgovernmentandthemonarchy/DG_073444 |archive-url=https://web.archive.org/web/20120921004951/http://www.direct.gov.uk/en/Governmentcitizensandrights/UKgovernment/Centralgovernmentandthemonarchy/DG_073444 |archive-date=21 September 2012 |access-date=9 March 2015 |website=Public services all in one place |publisher=[[Directgov]]}}</ref> Acting under the direction and supervision of a [[Cabinet of the United Kingdom|Cabinet]] of senior ministers selected and led by the prime minister, [[His Majesty's Government]] serves as the principal instrument for public policymaking, administers public services and, through the [[Privy Council of the United Kingdom|Privy Council]], promulgates [[statutory instrument (UK)|statutory instruments]] and tenders advice to the monarch.<ref>{{Cite web |url=https://www.instituteforgovernment.org.uk/explainer/cabinet |title=Cabinet |author=Tim Durrant |date=25 March 2020 |publisher=Institute for Government |publication-date=25 March 2020 |access-date=4 July 2023 |archive-date=4 July 2023 |archive-url=https://web.archive.org/web/20230704112925/https://www.instituteforgovernment.org.uk/explainer/cabinet |url-status=live}}</ref><ref>{{Cite web |url=https://www.parliament.uk/about/how/role/relations-with-other-institutions/parliament-government/ |title=Parliament and Government |publisher=UK Parliament |access-date=4 July 2023 |archive-date=4 July 2023 |archive-url=https://web.archive.org/web/20230704112925/https://www.parliament.uk/about/how/role/relations-with-other-institutions/parliament-government/ |url-status=live}}</ref><ref>{{Cite book |url=https://books.google.com/books?id=mN6SzMefot4C |title=The Monarchy and the Constitution, Chapter 3 – The Basic Constitutional Rules: Influence and the Prerogative |author=Vernon Bogdanor |year=1995 |publisher=Clarendon Press |isbn=978-0-19-829334-7 |publication-date=1995 |access-date=4 July 2023}}</ref> Nearly all prime ministers have served concurrently as [[First Lord of the Treasury]]<ref>{{Cite web |last1=Blick |first1=Andrew |last2=Jones |first2=George |date=1 January 2012 |title=The Institution of Prime Minister – History of government |url=https://history.blog.gov.uk/2012/01/01/the-institution-of-prime-minister |access-date=19 July 2021 |website=[[gov.uk]] |archive-date=21 July 2021 |archive-url=https://web.archive.org/web/20210721060401/https://history.blog.gov.uk/2012/01/01/the-institution-of-prime-minister/ |url-status=live}}</ref> and all prime ministers have continuously served as First Lord of the Treasury since 1905,<ref>{{Cite book |last=Brown |first=Jack |title=The Prime Ministers |publisher=[[Hodder & Stoughton]] |year=2020 |isbn=978-1-5293-1214-0 |editor-last=Dale |editor-first=Iain |page=303}}</ref> [[Minister for the Civil Service]] since 1968,<ref>{{Cite web |title=Minister for the Civil Service |url=https://www.gov.uk/government/ministers/minister-for-the-civil-service |access-date=19 July 2021 |website=[[gov.uk]] |archive-date=2 September 2017 |archive-url=https://web.archive.org/web/20170902233116/https://www.gov.uk/government/ministers/minister-for-the-civil-service |url-status=live}}</ref> and [[Minister for the Union]] since 2019.<ref>{{Cite news |last=Woodcock |first=Andrew |date=26 July 2021 |title=Boris Johnson accused of 'cynical rebranding' after appointing himself 'Minister for the Union' |work=[[The Independent|Independent]] |url=https://www.independent.co.uk/news/uk/politics/boris-johnson-minister-union-scotland-independence-referendum-snp-a9022356.html |access-date=19 July 2021 |archive-date=27 July 2019 |archive-url=https://web.archive.org/web/20190727080405/https://www.independent.co.uk/news/uk/politics/boris-johnson-minister-union-scotland-independence-referendum-snp-a9022356.html |url-status=live}}; {{Cite web |title=Minister for the Union |url=https://www.gov.uk/government/ministers/minister-for-the-union |access-date=19 July 2021 |website=[[gov.uk]] |archive-date=19 July 2020 |archive-url=https://web.archive.org/web/20200719053618/https://www.gov.uk/government/ministers/minister-for-the-union |url-status=live}}</ref> While appointed by the monarch, in modern times the prime minister is, by [[Constitutional conventions of the United Kingdom|convention]], an MP, the leader of the political party with the most seats in the House of Commons, and holds office by virtue of their ability to [[Confidence motions in the United Kingdom|command the confidence]] of the House of Commons.<ref>{{Cite web |date=October 2011 |title=The Cabinet Manual |url=https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/60641/cabinet-manual.pdf |access-date=19 July 2021 |website=[[gov.uk]] |pages=7, 21 |archive-date=15 April 2018 |archive-url=https://web.archive.org/web/20180415090557/https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/60641/cabinet-manual.pdf |url-status=live}}</ref><ref>{{Cite book |last=Norton |first=Philip |title=Governing Britain: Parliament, Ministers and Our Ambiguous Constitution |publisher=[[Manchester University Press]] |year=2020 |isbn=978-1-5261-4545-1 |page=130}}</ref> The prime minister as of 20 July 2026 is [[Andy Burnham]], the [[Leader of the Labour Party (UK)|leader of the Labour Party]].
Although not part of the United Kingdom, the three [[Crown Dependencies]] of [[Jersey]], [[Guernsey]] and the [[Isle of Man]], as well as the 14 [[British Overseas Territories]], are subject to the sovereignty of the British Crown.<ref>{{cite book |last=Palan |first=Rolen |editor-last1=Palan |editor-first1=Rolen |editor-last2=Halperin |editor-first2=Sandra |chapter=The second British Empire and the re-emergence of global finance |chapter-url=https://books.google.com/books?id=76QyCgAAQBAJ&dq=%22British+overseas+territories%22+%22crown+dependencies%22+UK+%22British+crown%22&pg=PA48 |title=Legacies of Empire: Imperial Roots of the Contemporary Global Order |year=2015 |publisher=Cambridge University Press |isbn=978-1-107-10946-9 |page=48 |access-date=13 April 2024 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002212946/https://books.google.com/books?id=76QyCgAAQBAJ&dq=%22British+overseas+territories%22+%22crown+dependencies%22+UK+%22British+crown%22&pg=PA48#v=onepage&q=%22British%20overseas%20territories%22%20%22crown%20dependencies%22%20UK%20%22British%20crown%22&f=false |url-status=live}}</ref>
[[Democratic backsliding]] was found by the 2026 [[V-Dem Institute#Democracy Report|V-Dem Democracy Report]] for the United Kingdom.<ref name="j496">{{cite web | title=Democracy Report 2026, Unraveling The Democratic Era? | url=https://v-dem.net/documents/75/V-Dem_Institute_Democracy_Report_2026_lowres.pdf | access-date=17 March 2026}}</ref>{{Relevance inline|date=August 2026|discuss=A country becoming a bit more or less democratic is not unusual and happens all the time. Such a development is not in itself notable, unless the change is disproportionately big, or the country slips under a certain threshold (e.g., being no longer classified as a liberal democracy, but as a hybrid regime). Is this the case here? If yes, then that should be more thoroughly explained. If no, then this sentence should probably be removed for not being notable enough for a high-level overview article of the UK.}}
===Elections===
{{Main|Elections in the United Kingdom}}
[[File:Houses of Parliament in 2022 (cropped).jpg|thumb|upright=1.25|alt=Large sand-coloured building of Gothic design beside brown river. The building has several large towers, including large clock tower.|The [[Palace of Westminster]] in London is the seat of both houses of the Parliament of the United Kingdom.]]
For [[General elections in the United Kingdom|general elections]] (elections to the House of Commons), the United Kingdom is divided into 650 [[United Kingdom constituencies|constituencies]], each of which is represented by one [[Member of Parliament (United Kingdom)|member of Parliament]] (MP) elected by the [[First-past-the-post voting|first-past-the-post]] system.<ref name="parliament.uk-2">{{Cite web |title=General elections |url=https://www.parliament.uk/about/how/elections-and-voting/general |access-date=19 July 2021 |website=[[parliament.uk]]}}</ref> MPs hold office for up to five years and must then stand for re-election if they wish to continue to be an MP.<ref name="parliament.uk-2" /> The [[Conservative Party (UK)|Conservative Party]], colloquially known as the Tory Party or the Tories, and the [[Labour Party (UK)|Labour Party]] have been the dominant political parties in the country since the 1920s, leading to the UK being described as a [[two-party system]]. However, since the 1920s other [[List of political parties in the United Kingdom|political parties]] have won seats in the House of Commons, although never more than the Conservatives or Labour.<ref>{{Cite web |last=Raymond |first=C |date=2016 |title=Why British Politics is Not a Two-Party System |url=https://pureadmin.qub.ac.uk/ws/portalfiles/portal/107735631/The_United_Kingdom_is_Not_a_Two_Party_System.pdf |website=Queen's University Belfast |access-date=3 July 2023 |archive-date=9 July 2023 |archive-url=https://web.archive.org/web/20230709172832/https://pureadmin.qub.ac.uk/ws/portalfiles/portal/107735631/The_United_Kingdom_is_Not_a_Two_Party_System.pdf |url-status=live}}</ref> The 2020s marked the erosion of the two-party system and the growth of a multi-party system.<ref>{{Cite web |date=8 May 2026 |title=Sir John Curtice: Election results show politics in the UK has fragmented |url=https://www.bbc.com/news/articles/ce8p4yn448vo |access-date=9 May 2026 |website=[[BBC News]] |language=en-GB}}</ref>
=== Administrative divisions ===
{{Main|Countries of the United Kingdom|Administrative geography of the United Kingdom|List of counties in the United Kingdom}}
[[File:United Kingdom labelled map7 vector.svg|thumb|upright=0.8|The four countries of the United Kingdom]]
The geographical division of the United Kingdom into counties or [[shire]]s began in England and Scotland in the [[early Middle Ages]], and was completed throughout Great Britain and Ireland by the [[early modern period]].<ref>Hackwood Frederick William: ''The Story of the Shire, Being the Lore, History and Evolution of English County Institutions'' (1851)</ref> Modern [[local government]] by elected councils, partly based on the ancient counties, was established by separate Acts of Parliament: in England and Wales [[Local Government Act 1888|in 1888]], Scotland [[Local Government (Scotland) Act 1889|in 1889]] and Ireland [[Local Government (Ireland) Act 1898|in 1898]], meaning there is no consistent system of administrative or geographic demarcation across the UK,<ref>{{Cite web |last=United Nations Economic and Social Council |author-link=United Nations Economic and Social Council |date=August 2007 |title=Ninth UN Conference on the standardization of Geographical Names |url=http://unstats.un.org/unsd/geoinfo/UNGEGN/docs/9th-uncsgn-docs/report%20of%209th%20uncsgn%20n0750902%20en.pdf |url-status=live |archive-url=https://web.archive.org/web/20091211213055/http://unstats.un.org/unsd/geoinfo/9th-UNCSGN-Docs/E-CONF-98-48-Add1.pdf |archive-date=11 December 2009 |access-date=21 October 2008 |publisher=UN Statistics Division}}</ref> and [[English law|England and Wales]], [[Scots law|Scotland]] and [[Law of Northern Ireland|Northern Ireland]] each have their own distinct jurisdictions.<ref>{{Cite book |last1=Dewart |first1=Megan |url=https://books.google.com/books?id=XW_EtwEACAAJ |title=The Scottish Legal System |date=2019 |publisher=[[Bloomsbury Academic]] |isbn=978-1-5265-0633-7 |location=London |page=57 |quote=The laws and legal institutions of Scotland and of England and Wales were not merged by the Union of 1707. Thus, they remain separate 'law areas', with separate court systems (as does Northern Ireland), and it is necessary to distinguish Scots law and English law (and Northern Irish law). |access-date=4 July 2023 |archive-url=https://web.archive.org/web/20230704040048/https://books.google.com/books?id=XW_EtwEACAAJ |archive-date=4 July 2023 |url-status=live}}; {{Cite web |title=The justice system and the constitution |url=https://www.judiciary.uk/about-the-judiciary/our-justice-system/jud-acc-ind/justice-sys-and-constitution/#:~:text=The%20United%20Kingdom%20has%20three,of%20Union%201707%20and%201800. |archive-url=https://web.archive.org/web/20230521180341/https://www.judiciary.uk/about-the-judiciary/our-justice-system/jud-acc-ind/justice-sys-and-constitution/ |archive-date=21 May 2023 |access-date=13 June 2023 |publisher=Courts and Tribunals Judiciary |quote=The United Kingdom has three separate legal systems; one each for England and Wales, Scotland and Northern Ireland. This reflects its historical origins and the fact that both Scotland and Ireland, and later Northern Ireland, retained their own legal systems and traditions under the Acts of Union 1707 and 1800.}}</ref> Until the 19th century there was little change to those arrangements, but there has since been a constant evolution of role and function.<ref>{{Cite book |last=Barlow |first=I.M. |title=Metropolitan Government |publisher=Routledge |year=1991 |isbn=978-0-415-02099-2 |location=London}}</ref>
[[Local government in England]] is complex, with the distribution of functions varying according to local arrangements. The upper-tier [[subdivisions of England]] are the nine [[Regions of England|regions]], used primarily for statistical purposes.<ref>{{Cite web |title=Welcome to the national site of the Government Office Network |url=http://www.gos.gov.uk/national |archive-url=https://web.archive.org/web/20090606073647/http://www.gos.gov.uk/national |archive-date=6 June 2009 |access-date=3 July 2008 |publisher=Government Offices}}</ref> One of the regions, [[Greater London Authority|Greater London]], has had a directly elected assembly and mayor since 2000 following popular support for the proposal in a [[1998 Greater London Authority referendum|1998 referendum]].<ref>{{Cite web |title=A short history of London government |url=http://www.london.gov.uk/london-life/city-government/history.jsp |archive-url=https://web.archive.org/web/20080421023053/http://www.london.gov.uk/london-life/city-government/history.jsp |archive-date=21 April 2008 |access-date=4 October 2008 |publisher=Greater London Authority}}</ref>
[[Local government in Scotland]] is divided into [[subdivisions of Scotland|32 council areas]] with a wide variation in size and population. The cities of [[Glasgow]], Edinburgh, [[Aberdeen]] and [[Dundee]] are separate council areas, as is the [[Politics of the Highland council area|Highland Council]], which includes a third of Scotland's area but only just over 200,000 people. Local councils are made up of elected councillors, of whom there are 1,223.<ref name="political-studies-association">{{Cite web |title=STV in Scotland: Local Government Elections 2007 |url=http://www.psa.ac.uk/2007/pps/Bennie.pdf |archive-url=https://web.archive.org/web/20110222124635/http://www.psa.ac.uk/2007/pps/Bennie.pdf |archive-date=22 February 2011 |access-date=2 August 2008 |publisher=Political Studies Association}}</ref>
[[Local government in Wales]] consists of 22 [[Unitary authority|unitary authorities]], each led by a leader and cabinet elected by the council itself. These include the cities of Cardiff, [[Swansea]] and [[Newport, Wales|Newport]], which are unitary authorities in their own right.<ref name="unitary">{{Cite web |year=2014 |title=Unitary authorities |url=http://gov.wales/topics/localgovernment/local-authorities/?lang=en |archive-url=https://web.archive.org/web/20150310210146/http://gov.wales/topics/localgovernment/local-authorities/?lang=en |archive-date=10 March 2015 |access-date=9 March 2015 |publisher=Welsh Government}}</ref> Elections are held every four years under the first-past-the-post system.<ref name="unitary" />
[[Local government in Northern Ireland]] since 2015 has been organised into 11 district councils, each elected by single transferable vote. Their powers are limited to services such as waste collection, dog control, and maintaining parks and cemeteries.<ref name="Devenport">{{Cite news |last=Devenport |first=Mark |date=18 November 2005 |title=NI local government set for shake-up |work=BBC News |url=http://news.bbc.co.uk/1/hi/northern_ireland/4449092.stm |access-date=15 November 2008 |archive-date=12 December 2008 |archive-url=https://web.archive.org/web/20081212221731/http://news.bbc.co.uk/1/hi/northern_ireland/4449092.stm |url-status=live}}</ref> This system was introduced after a 2008 decision by the executive to replace the previous structure of 26 districts which had been in place since 1973.<ref>{{Cite press release |title=Foster announces the future shape of local government |date=13 March 2008 |publisher=Northern Ireland Executive |url=http://www.northernireland.gov.uk/news/news-doe/news-doe-130308-foster-announces-the.htm |access-date=20 October 2008 |archive-url=https://web.archive.org/web/20080725002254/http://www.northernireland.gov.uk/news/news-doe/news-doe-130308-foster-announces-the.htm |archive-date=25 July 2008}}</ref>
=== Devolution ===
{{Main|Devolution in the United Kingdom}}
{{further|Devolved, reserved and excepted matters}}
[[File:Council of Nations and Regions (54059219744) (cropped).jpg|thumb|right|Prime Minister Keir Starmer meets with the first ministers of Scotland, Northern Ireland and Wales during the [[Council of Nations and Regions]] summit.]]
In the United Kingdom a process of devolution has transferred various powers from the UK Government to three of the four UK countries—Scotland, Northern Ireland and Wales—as well as to the regions of England, which since 1999 have their own governments and parliaments that control various devolved matters.<ref>{{Cite web |title=Devolution of powers to Scotland, Wales and Northern Ireland |url=https://www.gov.uk/devolution-of-powers-to-scotland-wales-and-northern-ireland#devolved-administrations |url-status=live |archive-url=https://web.archive.org/web/20130718065448/https://www.gov.uk/devolution-of-powers-to-scotland-wales-and-northern-ireland#devolved-administrations |archive-date=18 July 2013 |access-date=17 April 2013 |publisher=United Kingdom Government |quote=In a similar way to how the government is formed from members from the two Houses of Parliament, members of the devolved legislatures nominate ministers from amongst themselves to comprise executives, known as the devolved administrations...}}; {{Cite web |title=Country Overviews: United Kingdom |url=http://www.transport-research.info/web/countryprofiles/uk.cfm |archive-url=https://web.archive.org/web/20100404062853/http://www.transport-research.info/web/countryprofiles/uk.cfm |archive-date=4 April 2010 |access-date=28 March 2010 |url-status=usurped |publisher=Transport Research Knowledge Centre}}</ref> These powers vary and have been moved to the [[Scottish Government]], the [[Welsh Government]], the [[Northern Ireland Executive]] and (in England) to [[strategic authorities]]: the [[Greater London Authority]], [[Combined authorities and combined county authorities|combined authorities, and combined county authorities]].<ref>{{cite book |last1=Le Sueur |first1=Andrew |last2=Sunkin |first2=Maurice |last3=Murkens |first3=Jo Eric Khushal |title=Public Law: Text, Cases, and Materials |year=2023 |edition=5th |isbn=978-0-19-287061-2 |publisher=Oxford University Press |page=147 |url=https://books.google.com/books?id=6sLDEAAAQBAJ&dq=Le+sueur+Public+Law%C2%A0fifth+edition&pg=PR3 |access-date=13 April 2024 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002213048/https://books.google.com/books?id=6sLDEAAAQBAJ&dq=Le+sueur+Public+Law%C2%A0fifth+edition&pg=PR3#v=onepage&q=Le%20sueur%20Public%20Law%C2%A0fifth%20edition&f=false |url-status=live}}</ref> Amongst the devolved parliaments across the United Kingdom, the [[Scottish Parliament]] has the most extensive responsibilities for [[Devolved, reserved and excepted matters|devolved powers]], and has been described as "one of the most powerful devolved parliaments in the world".<ref>{{cite web |title=The progress of devolution - Erskine May - UK Parliament |url=https://erskinemay.parliament.uk/section/4537/the-progress-of-devolution |website=erskinemay.parliament.uk |access-date=1 March 2025}}</ref><ref>{{cite web |title=David Mundell speech: 20 years of Scottish devolution |url=https://www.gov.uk/government/news/david-mundell-speech-20-years-of-scottish-devolution |website=GOV.UK |access-date=1 March 2025}}</ref>
The United Kingdom has an [[uncodified constitution]] and constitutional matters are not amongst the powers that have been devolved. Under the doctrine of [[Parliamentary sovereignty in the United Kingdom|parliamentary sovereignty]], the UK Parliament could, in theory, therefore, abolish the Scottish Parliament, Senedd or Northern Ireland Assembly.<ref>{{Cite journal |last=Burrows |first=N. |year=1999 |title=Unfinished Business: The Scotland Act 1998 |journal=The Modern Law Review |volume=62 |issue=2 |pages=241–260 [p. 249] |doi=10.1111/1468-2230.00203 |quote=The UK Parliament is sovereign and the Scottish Parliament is subordinate. The White Paper had indicated that this was to be the approach taken in the legislation. The Scottish Parliament is not to be seen as a reflection of the settled will of the people of Scotland or of popular sovereignty but as a reflection of its subordination to a higher legal authority. Following the logic of this argument, the power of the Scottish Parliament to legislate can be withdrawn or overridden...}}; {{Cite journal |last=Elliot |first=M. |year=2004 |title=United Kingdom: Parliamentary sovereignty under pressure |journal=International Journal of Constitutional Law |volume=2 |issue=3 |pages=545–627, 553–554 |doi=10.1093/icon/2.3.545 |quote=Notwithstanding substantial differences among the schemes, an important common factor is that the UK Parliament has not renounced legislative sovereignty in relation to the three nations concerned. For example, the Scottish Parliament is empowered to enact primary legislation on all matters, save those in relation to which competence is explicitly denied ... but this power to legislate on what may be termed "devolved matters" is concurrent with the Westminster Parliament's general power to legislate for Scotland on any matter at all, including devolved matters ... In theory, therefore, Westminster may legislate on Scottish devolved matters whenever it chooses... |doi-access=free}}</ref> Though in the [[Scotland Act 2016]] and the [[Wales Act 2017]] it states that the Scottish Government and the Welsh Government "are a permanent part of the United Kingdom's constitutional arrangements".<ref>{{cite web |title=Scotland Act 2016 |url=https://www.legislation.gov.uk/ukpga/2016/11/part/1/crossheading/the-scottish-parliament-and-the-scottish-government#:~:text=(1)The%20Scottish%20Parliament%20and,the%20United%20Kingdom's%20constitutional%20arrangements. |website=Gov.uk |access-date=28 June 2024 |archive-date=28 June 2024 |archive-url=https://web.archive.org/web/20240628211304/https://www.legislation.gov.uk/ukpga/2016/11/part/1/crossheading/the-scottish-parliament-and-the-scottish-government#:~:text=(1)The%20Scottish%20Parliament%20and,the%20United%20Kingdom's%20constitutional%20arrangements. |url-status=live}}</ref><ref>{{cite web |title=Wales Act 2017 |url=https://www.legislation.gov.uk/ukpga/2017/4/section/1/enacted |access-date=13 July 2024 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002212916/https://www.legislation.gov.uk/ukpga/2017/4/section/1/enacted |url-status=live}}</ref>
In practice it would be politically difficult for the UK Parliament to abolish devolution to the Scottish Parliament and the Senedd because these institutions were created by referendums.<ref>{{Cite journal |last=Gamble |first=A. |year=2006 |title=The Constitutional Revolution in the United Kingdom |journal=Publius |volume=36 |issue=1 |pages=19–35 [p. 29] |doi=10.1093/publius/pjj011 |quote=The British parliament has the power to abolish the Scottish parliament and the Welsh assembly by a simple majority vote in both houses, but since both were sanctioned by referenda, it would be politically difficult to abolish them without the sanction of a further vote by the people. In this way, several of the constitutional measures introduced by the Blair government appear to be entrenched and not subject to a simple exercise of parliamentary sovereignty at Westminster.}}</ref> The political constraints placed upon the UK Parliament's power to interfere with devolution in Northern Ireland are greater still, because devolution in Northern Ireland rests upon an international agreement with the [[Government of Ireland]].<ref>{{Cite journal |last=Meehan |first=E. |year=1999 |title=The Belfast Agreement – Its Distinctiveness and Points of Cross-Fertilization in the UK's Devolution Programme |journal=Parliamentary Affairs |volume=52 |issue=1 |pages=19–31 [p. 23] |doi=10.1093/pa/52.1.19 |quote=[T]he distinctive involvement of two governments in the Northern Irish problem means that Northern Ireland's new arrangements rest upon an intergovernmental agreement. If this can be equated with a treaty, it could be argued that the forthcoming distribution of power between Westminster and Belfast has similarities with divisions specified in the written constitutions of federal states...Although the Agreement makes the general proviso that Westminster's 'powers to make legislation for Northern Ireland' remains 'unaffected', without an explicit categorical reference to reserved matters, it may be more difficult than in Scotland or Wales for devolved powers to be repatriated. The retraction of devolved powers would not merely entail consultation in Northern Ireland backed implicitly by the absolute power of parliamentary sovereignty but also the renegotiation of an intergovernmental agreement. |doi-access=free}}</ref> The UK Parliament restricts the three devolved parliaments' legislative powers in economic policy matters through [[United Kingdom Internal Market Act 2020|an act]] passed in 2020.<ref name="UKIM" />
==== England ====
Unlike Scotland, Northern Ireland and Wales, England does not have a separate devolved government or national parliament,<ref>{{cite web |title=English devolution |url=https://www.instituteforgovernment.org.uk/explainer/english-devolution#:~:text=After%201997%20Labour%20governments%20devolved,assembly%20were%20created%20in%202000. |publisher=Institute for Government |access-date=30 August 2024 |date=21 June 2024 |archive-date=30 August 2024 |archive-url=https://web.archive.org/web/20240830150949/https://www.instituteforgovernment.org.uk/explainer/english-devolution#:~:text=After%201997%20Labour%20governments%20devolved,assembly%20were%20created%20in%202000. |url-status=live}}</ref> rather a process of devolution of powers from the central government to local authorities has taken place, first in 1998.<ref>{{cite web |title=Devolution explained |url=https://www.local.gov.uk/topics/devolution/devolution-hub/devolution-explained |publisher=Local Government Association |access-date=30 August 2024 |archive-date=30 August 2024 |archive-url=https://web.archive.org/web/20240830152450/https://www.local.gov.uk/topics/devolution/devolution-hub/devolution-explained |url-status=live}}</ref> The [[Greater London Authority]] was set up following a [[1998 Greater London Authority referendum|referendum in 1998]]. Colloquially known as City Hall, it is the devolved regional government body for Greater London. It consists of two political branches: a directly elected [[Mayor of London]] and the [[London Assembly]], which serves as a check and balance on the Mayor.
A [[Combined authorities and combined county authorities|combined authority]] is a type of local government institution introduced in England outside Greater London by the [[Local Democracy, Economic Development and Construction Act 2009]]. CAs allow a group of local authorities to pool appropriate responsibility and receive certain devolved functions from central government in order to deliver transport and economic policy more effectively over a wider area.<ref>{{Cite web |date=6 March 2023 |title=English devolution |url=https://www.instituteforgovernment.org.uk/explainer/english-devolution |access-date=4 February 2024 |publisher=Institute for Government |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002212917/https://www.instituteforgovernment.org.uk/explainer/english-devolution |url-status=live}}</ref> A combined county authority is a similar type of local-government institution introduced in England outside Greater London by the [[Levelling-up and Regeneration Act 2023]], but may only be formed by upper-tier authorities: [[county council]]s and [[Unitary authority|unitary authorities]].<ref>{{Cite web |date=6 April 2023 |title=Combined County Authorities – key differences to Combined Authorities |url=https://www.localgovernmentlawyer.co.uk/governance/314-governance-a-risk-articles/53464-combined-county-authorities-key-differences-to-combined-authorities |access-date=4 February 2024 |website=Local Government Lawyer |archive-date=4 February 2024 |archive-url=https://web.archive.org/web/20240204170903/https://www.localgovernmentlawyer.co.uk/governance/314-governance-a-risk-articles/53464-combined-county-authorities-key-differences-to-combined-authorities |url-status=live}}</ref>
==== Scotland ====
{{main|Responsibilities of the Scottish Government}}
[[File:First Minister meets Prime Minister (53840421342).jpg|thumb|Prime Minister Keir Starmer meets with [[First Minister of Scotland]] [[John Swinney]], the head of the [[Scottish Government]], at [[Bute House]], Edinburgh.]]
Since 1999 Scotland has had a devolved national government and parliament with wide-ranging powers over any matter that has not been specifically [[Reserved and excepted matters|reserved]] to the UK Parliament.<ref name="Scottish Parliament">{{cite web |title=Devolved and Reserved Powers |url=https://www.parliament.scot/about/how-parliament-works/devolved-and-reserved-powers |website=parliament.scot |publisher=Scottish Parliament |access-date=28 December 2023 |archive-date=20 September 2023 |archive-url=https://web.archive.org/web/20230920053732/https://www.parliament.scot/about/how-parliament-works/devolved-and-reserved-powers |url-status=live}}</ref><ref>{{Cite news |date=8 April 1999 |title=Scotland's Parliament – powers and structures |work=BBC News |url=http://news.bbc.co.uk/1/hi/events/scotland_99/the_scottish_parliament/310036.stm |access-date=21 October 2008 |archive-date=18 February 2007 |archive-url=https://web.archive.org/web/20070218234816/http://news.bbc.co.uk/1/hi/events/scotland_99/the_scottish_parliament/310036.stm |url-status=live}}</ref> Scotland has the most devolved powers of any of the three devolved parliaments in the United Kingdom, with full legislative control over [[Education in Scotland|education]], [[Scots law|law and order]], [[Economy of Scotland|the economy]], [[Health in Scotland|healthcare]], [[Elections in Scotland|elections]], [[Crown Estate Scotland]], the [[Planning system in Scotland|planning system]] and [[Housing in Scotland|housing]].<ref>{{cite web |title=Devolved and Reserved Matters - Visit & Learn Scottish Parliament |url=http://www.parliament.scot/visitandlearn/Education/18642.aspx |archive-url=https://web.archive.org/web/20170722092046/http://www.parliament.scot/visitandlearn/Education/18642.aspx |url-status=dead |archive-date=22 July 2017 |access-date=1 March 2025 |date=22 July 2017}}</ref>
Additional powers were transferred to the Scottish Parliament via the [[Scotland Act 2012]] and the [[Scotland Act 2016]], such as [[Taxation in Scotland|some taxation powers]], including full control of [[Income tax in Scotland|income tax]] on income earned through employment, [[Land and Buildings Transaction Tax]], [[Scottish Landfill Tax|Landfill Tax]], Aggregates Levy, [[Air Departure Tax]] and [[Revenue Scotland]], as well as aspects of the [[Energy in Scotland|energy network]], including [[Renewable energy in Scotland|renewable energy]], energy efficiency and onshore [[Oil industry in Scotland|oil and gas licensing]].<ref name="Devolved Matters in Scotland">{{cite web |url=https://www.gov.scot/about/what-the-government-does/ |title=What the Scottish Government does |publisher=Scottish Government |access-date=8 August 2019 |archive-date=8 July 2019 |archive-url=https://web.archive.org/web/20190708045359/https://www.gov.scot/about/what-the-government-does/ |url-status=live}}</ref><ref name="Scottish Parliament" /> Their power over economic issues is significantly constrained by an [[United Kingdom Internal Market Act 2020|act of the UK Parliament]] passed in 2020.{{refn|name=UKIM|<ref name="Keating21">{{Cite journal |last=Keating |first=Michael |date=2 February 2021 |title=Taking back control? Brexit and the territorial constitution of the United Kingdom |journal=[[Journal of European Public Policy]] |location=Abingdon |publisher=[[Taylor & Francis]] |volume=28 |issue=4 |pages=6–7 |doi=10.1080/13501763.2021.1876156 |quote=The UK Internal Market Act gives ministers sweeping powers to enforce mutual recognition and non-discrimination across the four jurisdictions. Existing differences and some social and health matters are exempted but these are much less extensive than the exemptions permitted under the EU Internal Market provisions. Only after an amendment in the House of Lords, the Bill was amended to provide a weak and non-binding consent mechanism for amendments (equivalent to the Sewel Convention) to the list of exemptions. The result is that, while the devolved governments retain regulatory competences, these are undermined by the fact that goods and services originating in, or imported into, England can be marketed anywhere. |hdl-access=free |hdl=1814/70296 |s2cid=234066376}}</ref><ref name="KenMcEw21">{{Cite journal |last1=Kenny |first1=Michael |author-link=Michael Kenny (political scientist) |last2=McEwen |first2=Nicola |author-link2=Nicola McEwen |date=1 March 2021 |title=Intergovernmental Relations and the Crisis of the Union |journal=Political Insight |publisher=[[SAGE Publishing]] |volume=12 |issue=1 |pages=12–15 |doi=10.1177/20419058211000996 |quote=That phase of joint working was significantly damaged by the UK Internal Market Act, pushed through by the Johnson government in December 2020...the Act diminishes the authority of the devolved institutions, and was vehemently opposed by them. |doi-access=free |s2cid=232050477}}</ref><ref name="WolffeDevol">{{Cite journal |last=Wolffe |first=W James |author-link=James Wolffe |date=7 April 2021 |title=Devolution and the Statute Book |url=https://academic.oup.com/slr/advance-article/doi/10.1093/slr/hmab003/6213886 |journal=[[Statute Law Review]] |location=Oxford |publisher=[[Oxford University Press]] |doi=10.1093/slr/hmab003 |access-date=18 April 2021 |quote=the Internal Market Bill—a Bill that contains provisions which, if enacted, would significantly constrain, both legally and as a matter of practicality, the exercise by the devolved legislatures of their legislative competence; provisions that would be significantly more restrictive of the powers of the Scottish Parliament than either EU law or Articles 4 and 6 of the Acts of the Union...The UK Parliament passed the European Union (Withdrawal Agreement) Act 2020 and the Internal Market Act 2020 notwithstanding that, in each case, all three of the devolved legislatures had withheld consent. |archive-date=21 April 2021 |archive-url=https://web.archive.org/web/20210421145355/https://academic.oup.com/slr/advance-article/doi/10.1093/slr/hmab003/6213886 |url-status=live |url-access=subscription}}</ref><ref name="Wincott21">{{Cite journal |last1=Wincott |first1=Daniel |author-link=Daniel Wincott |last2=Murray |first2=C. R. G. |last3=Davies |first3=Gregory |date=17 May 2021 |title=The Anglo-British imaginary and the rebuilding of the UK's territorial constitution after Brexit: unitary state or union state? |journal=Territory, Politics, Governance |location=Abingdon/Brighton |publisher=[[Taylor & Francis]]; [[Regional Studies Association]] |volume=10 |issue=5 |pages=696–713 |doi=10.1080/21622671.2021.1921613 |quote=Taken as a whole, the Internal Market Act imposes greater restrictions upon the competences of the devolved institutions than the provisions of the EU Single Market which it replaced, in spite of pledges to use common frameworks to address these issues. [[David Hope, Baron Hope of Craighead|Lord Hope]], responsible for many of the leading judgments relating to the first two decades of devolution, regarded the legislation's terms as deliberately confrontational: 'this Parliament can do what it likes, but a different approach is essential if the union is to hold together'. |doi-access=free}}</ref><ref name="DouganMcEwen20">{{Cite report |url=https://www.centreonconstitutionalchange.ac.uk/publications/uk-and-internal-market-devolution-and-union |title=UK and the Internal Market, Devolution and the Union |last1=Dougan |first1=Michael |last2=Hayward |first2=Katy |date=2020 |publisher=[[University of Edinburgh]]; [[University of Aberdeen]] |pages=2–3 |last3=Hunt |first3=Jo |last4=McEwen |first4=Nicola |last5=McHarg |first5=Aileen |last6=Wincott |first6=Daniel |author-link=Michael Dougan |author-link2=Katy Hayward |access-date=16 October 2020 |author-link4=Nicola McEwen |author-link6=Daniel Wincott |department=Centre on Constitutional Change |archive-date=18 October 2020 |archive-url=https://web.archive.org/web/20201018185830/https://www.centreonconstitutionalchange.ac.uk/publications/uk-and-internal-market-devolution-and-union |url-status=live}}</ref><ref name="Dougan20Brief">{{Cite report |url=https://www.liverpool.ac.uk/media/livacuk/law/2-research/eull/UKIM,Briefing,Paper,-,Prof,Michael,Dougan,15,September,2020.pdf |title=Briefing Paper. United Kingdom Internal Market Bill: Implications for Devolution |last=Dougan |first=Michael |date=2020 |publisher=[[University of Liverpool]] |location=Liverpool |pages=4–5 |author-link=Michael Dougan |access-date=15 October 2020 |archive-date=26 October 2020 |archive-url=https://web.archive.org/web/20201026161836/https://www.liverpool.ac.uk/media/livacuk/law/2-research/eull/UKIM,Briefing,Paper,-,Prof,Michael,Dougan,15,September,2020.pdf |url-status=live}}</ref><ref name="DouHu22">{{cite journal |last1=Dougan |first1=Michael |last2=Hunt |first2=Jo |last3=McEwen |first3=Nicola |last4=McHarg |first4=Aileen |author-link1=Michael Dougan |author-link3=Nicola McEwen |title=Sleeping with an Elephant: Devolution and the United Kingdom Internal Market Act 2020 |journal=[[Law Quarterly Review]] |date=2022 |url=https://dro.dur.ac.uk/35167/ |location=London |publisher=[[Sweet & Maxwell]] |ssrn=4018581 |via=[[Durham University|Durham Research Online]] |access-date=4 March 2022 |quote=The Act has restrictive – and potentially damaging – consequences for the regulatory capacity of the devolved legislatures...This was not the first time since the Brexit referendum that the Convention had been set aside, but it was especially notable given that the primary purpose of the legislation was to constrain the capacity of the devolved institutions to use their regulatory autonomy...in practice, it constrains the ability of the devolved institutions to make effective regulatory choices for their territories in ways that do not apply to the choices made by the UK government and parliament for the English market. |issn=0023-933X |archive-date=2 August 2022 |archive-url=https://web.archive.org/web/20220802185022/https://dro.dur.ac.uk/35167/ |url-status=live}}</ref>}}
The [[Scottish Government]] is a [[Scottish National Party]] (SNP) [[minority government]],<ref>{{cite web |title=Humza Yousaf's precarious position puts the SNP – and Scotland – at a crossroads |url=https://www.instituteforgovernment.org.uk/comment/humza-yousaf-snp-scotland-crossroads |website=Institute for Government |access-date=26 April 2024 |date=26 April 2024 |archive-date=26 April 2024 |archive-url=https://web.archive.org/web/20240426221203/https://www.instituteforgovernment.org.uk/comment/humza-yousaf-snp-scotland-crossroads |url-status=live}}</ref> led by the [[First Minister of Scotland|first minister]], currently [[John Swinney]], the [[leader of the SNP]]. In 2014 the [[2014 Scottish independence referendum|Scottish independence referendum]] was held, with 55.3 per cent voting against independence from the United Kingdom and 44.7 per cent voting in favour, resulting in Scotland staying within the United Kingdom. [[Local government in Scotland]] is divided into [[subdivisions of Scotland|32 council areas]] with a wide variation in size and population. Local councils are made up of elected councillors, of whom there are 1,223.<ref name="political-studies-association" />
The Scottish Parliament is separate from the Scottish Government. It is made up of 129 elected [[members of the Scottish Parliament]] (MSPs). It is the law-making body of Scotland, and thus it scrutinises the work of the incumbent Scottish Government and considers any piece of proposed legislation through parliamentary debates, committees and parliamentary questions.<ref name="Devolved Matters in Scotland"/>
==== Wales ====
Since 1999 Wales has had a devolved national government and legislature, known as the [[Senedd]]. Elections to the Senedd used the [[additional member system]] until 2026 when the voting system was changed to [[closed list]] proportional representation. The number of elected members also increased from 60 to 96, representing 16 [[Senedd constituencies|six-member constituencies]]. The Senedd has more limited powers than those devolved to Scotland.<ref>{{Cite news |date=9 April 1999 |title=Structure and powers of the Assembly |work=BBC News |url=http://news.bbc.co.uk/1/hi/events/wales_99/the_welsh_assembly/309033.stm |access-date=21 October 2008 |archive-date=7 February 2004 |archive-url=https://web.archive.org/web/20040207162926/http://news.bbc.co.uk/1/hi/events/wales_99/the_welsh_assembly/309033.stm |url-status=live}}</ref> It can legislate on any matter not specifically reserved to the UK Parliament by [[Acts of Senedd Cymru]]. The [[Welsh Government]] is currently a [[Plaid Cymru]] minority government led by the [[First Minister of Wales|first minister]], [[Rhun ap Iorwerth]]. [[Local government in Wales]] consists of 22 unitary authorities, each led by a leader and cabinet elected by the council itself.
==== Northern Ireland ====
The devolved form of government in Northern Ireland is based on the 1998 [[Good Friday Agreement]], which brought to an end a 30-year period of [[Unionism in Ireland|unionist]]-[[Irish nationalism|nationalist]] communal conflict known as [[the Troubles]]. The Agreement was [[1998 Northern Ireland Good Friday Agreement referendum|confirmed by referendum]] and implemented later that year. It established [[power sharing]] arrangements for a devolved government and legislature, referred to as the [[Northern Ireland Executive]] and the [[Northern Ireland Assembly]] respectively.<ref>{{cite web |title=Good Friday Agreement: What is it? |url=https://www.bbc.co.uk/news/uk-northern-ireland-61968177 |website=BBC News |date=3 April 2023 |access-date=11 April 2024 |archive-date=15 May 2024 |archive-url=https://web.archive.org/web/20240515131233/https://www.bbc.co.uk/news/uk-northern-ireland-61968177 |url-status=live}}</ref> Elections to the Assembly use the [[single transferable vote]] system. The Executive and Assembly have powers similar to those devolved to Scotland.<ref>{{Cite web |date=8 May 2019 |title=Devolution of powers to Scotland, Wales and Northern Ireland |url=https://www.gov.uk/guidance/devolution-of-powers-to-scotland-wales-and-northern-ireland |access-date=11 June 2024 |website=GOV.UK |archive-date=7 March 2023 |archive-url=https://web.archive.org/web/20230307093336/https://www.gov.uk/guidance/devolution-of-powers-to-scotland-wales-and-northern-ireland |url-status=live}}</ref> The Executive is led by a [[diarchy]] representing [[Designated Unionist|unionist]] and [[Designated Nationalist|nationalist]] members of the Assembly.<ref name="northernireland1">{{Cite web |date=25 September 2015 |title=Your Executive |url=https://www.northernireland.gov.uk/topics/your-executive |publisher=Northern Ireland Executive |access-date=14 August 2016 |archive-date=21 August 2016 |archive-url=https://web.archive.org/web/20160821135048/https://www.northernireland.gov.uk/topics/your-executive |url-status=live}}</ref> The [[First Minister and Deputy First Minister of Northern Ireland|first minister and deputy first minister of Northern Ireland]] are the joint heads of government of Northern Ireland.<ref>{{Cite news |title=Stormont: Why were NI leaders given unequal job titles? |work=BBC News |date=15 May 2022 |url=https://www.bbc.co.uk/news/uk-northern-ireland-61393736 |access-date=2 February 2024 |archive-url=https://web.archive.org/web/20240202190001/https://www.bbc.com/news/uk-northern-ireland-61393736 |archive-date=2 February 2024}}</ref><ref>{{Cite web |title=Northern Ireland Executive: Ministerial Code |date=28 September 2015 |url=https://www.northernireland.gov.uk/topics/your-executive/ministerial-code |access-date=2 February 2024 |archive-url=https://web.archive.org/web/20240202191115/https://www.northernireland.gov.uk/topics/your-executive/ministerial-code |archive-date=2 February 2024}}</ref> [[Local government in Northern Ireland]] since 2015 has been divided between 11 councils with limited responsibilities.<ref name="Devenport" />
=== Foreign relations ===
{{Main|Foreign relations of the United Kingdom}}
[[File:Trump-Starmer bilateral 2025-02-27-16-07.jpg|thumb|right|UK prime minister Keir Starmer and US president [[Donald Trump]] shaking hands in a joint press conference in 2025. The UK and the US share a "[[Special Relationship]]".]]
The United Kingdom is [[Big Five (United Nations)|a permanent member]] of the [[United Nations Security Council]] and a member of [[NATO]], [[AUKUS]], the Commonwealth of Nations, the [[G7]], the [[G-20 major economies|G20]], the [[Organisation for Economic Co-operation and Development|OECD]], the [[World Trade Organization|WTO]], the [[Council of Europe]] and the [[Organization for Security and Co-operation in Europe|OSCE]].<ref>{{Cite web |last=May |first=Theresa |author-link=Theresa May |date=29 March 2017 |title=Prime Minister's letter to Donald Tusk triggering Article 50 |url=https://www.gov.uk/government/publications/prime-ministers-letter-to-donald-tusk-triggering-article-50/prime-ministers-letter-to-donald-tusk-triggering-article-50 |via=Gov.uk |access-date=19 June 2017 |archive-date=5 June 2017 |archive-url=https://web.archive.org/web/20170605184239/https://www.gov.uk/government/publications/prime-ministers-letter-to-donald-tusk-triggering-article-50/prime-ministers-letter-to-donald-tusk-triggering-article-50 |url-status=live}}</ref> It maintains the [[British Council]], an organisation specialising in international cultural and educational opportunities in over 100 countries. The UK remains a [[great power]] with considerable political, cultural, economic and military influence.<ref name="PaulWirtz2004">{{cite book |last1=Paul |first1=T.V. |url=https://books.google.com/books?id=9jy28vBqscQC&pg=PA59 |title=Balance of Power: Theory and Practice in the 21st century |last2=Wirtz |first2=James |last3=Fortmann |first3=Michel |date=2004 |publisher=Stanford University Press |isbn=978-0-8047-5017-2 |page=59}}</ref><ref>{{Cite news |date=10 May 2012 |title=United Kingdom country profile |url=https://www.bbc.com/news/world-europe-18023389 |access-date=6 July 2025 |work=BBC News |language=en-GB |archive-date=3 January 2023 |archive-url=https://web.archive.org/web/20230103160059/https://www.bbc.com/news/world-europe-18023389 |url-status=live }}</ref>
The United Kingdom is said to have a "[[Special Relationship]]" with the United States and a close partnership with France – the "[[Entente cordiale]]" – and shares nuclear weapons technology with both countries;<ref>{{Cite web |last=Swaine |first=Jon |date=13 January 2009 |title=Barack Obama presidency will strengthen special relationship, says Gordon Brown |url=https://www.telegraph.co.uk/news/worldnews/barackobama/4226246/Barack-Obama-presidency-will-strengthen-special-relationship-says-Gordon-Brown.html |url-access=subscription |access-date=30 May 2011 |website=[[The Daily Telegraph|The Telegraph]] |publication-place=[[London]] |archive-date=4 July 2020 |archive-url=https://web.archive.org/web/20200704192159/https://www.telegraph.co.uk/news/worldnews/barackobama/4226246/Barack-Obama-presidency-will-strengthen-special-relationship-says-Gordon-Brown.html |url-status=live}}</ref><ref>{{Cite book |last1=Kirchner |first1=Emil Joseph |title=Global Security Governance: Competing Perceptions of Security in the 21st century |last2=Sperling |first2=James |publisher=[[Routledge]] |year=2007 |isbn=978-0-415-39162-7 |edition=illustrated |location=London |page=100}}</ref> the [[Anglo-Portuguese Alliance]] is considered to be the oldest binding military alliance in the world. The UK is also closely linked with the Republic of Ireland; the two countries share a [[Common Travel Area]] and co-operate through the [[British-Irish Intergovernmental Conference]] and the [[British-Irish Council]]. Britain's global presence and influence is further amplified through its trading relations, foreign investments, [[official development assistance]] and military engagements.<ref>{{Cite web |last=The Committee Office, House of Commons |date=19 February 2009 |title=DFID's expenditure on development assistance |url=http://www.parliament.the-stationery-office.co.uk/pa/cm200809/cmselect/cmintdev/220/22007.htm |archive-url=https://web.archive.org/web/20130112222226/http://www.parliament.the-stationery-office.co.uk/pa/cm200809/cmselect/cmintdev/220/22007.htm |archive-date=12 January 2013 |access-date=28 April 2013 |publisher=UK Parliament}}</ref>
=== Military ===
{{Main|British Armed Forces|Military history of the United Kingdom}}
[[File:United Kingdom overseas military installations and operations.png|thumb|upright=1.4|
{{Legend|#0000FF|Overseas military installations of the United Kingdom, and locally raised units of the [[British Overseas Territories]]}}
{{Legend|#F0002B|Military interventions since 2000: [[British military intervention in the Sierra Leone Civil War|Palliser]] (Sierra Leone); [[Operation Herrick|Herrick]] (Afghanistan); [[Operation Enduring Freedom – Horn of Africa|Enduring Freedom]] (Horn of Africa); [[Operation Telic|Telic]] (Iraq); [[Operation Ellamy|Ellamy]] (Libya); and [[Operation Shader|Shader]] (Islamic State of Iraq and the Levant).}}]]
The British Armed Forces consist of three professional service branches: the [[Royal Navy]] and [[Royal Marines]] (forming the [[Naval Service (United Kingdom)|Naval Service]]), the [[British Army]] and the [[Royal Air Force]].<ref>{{Cite web |title=Ministry of Defence |url=http://www.mod.uk/DefenceInternet/Home |access-date=21 February 2012 |publisher=Ministry of Defence |archive-date=19 February 2012 |archive-url=https://web.archive.org/web/20120219194140/http://mod.uk/DefenceInternet/Home/ |url-status=live}}</ref> The armed forces of the United Kingdom are managed by the [[Ministry of Defence (United Kingdom)|Ministry of Defence]] and controlled by the [[Defence Council of the United Kingdom|Defence Council]], chaired by the [[Secretary of State for Defence]]. The [[Commander-in-Chief]] is the [[Monarchy of the United Kingdom|British monarch]], to whom members of the forces swear an oath of allegiance.<ref>{{Cite web |date=30 March 2012 |title=Speaker addresses Her Majesty Queen Elizabeth II |url=http://www.parliament.uk/business/news/2012/march/speaker-addresses-hm-the-queen |access-date=28 April 2013 |publisher=UK Parliament |archive-date=1 May 2013 |archive-url=https://web.archive.org/web/20130501221305/http://www.parliament.uk/business/news/2012/march/speaker-addresses-hm-the-queen/ |url-status=live}}</ref>
The armed forces are charged with protecting the United Kingdom and its overseas territories, promoting the UK's global security interests and supporting international peacekeeping efforts. They are active and regular participants in [[NATO]] (including the [[Allied Rapid Reaction Corps]]), the [[Five Power Defence Arrangements]], [[RIMPAC]] and other worldwide coalition operations. [[Overseas military bases of the United Kingdom|Overseas garrisons]] and facilities are maintained in [[RAF Ascension Island|Ascension Island]], [[Mina Salman|Bahrain]], [[Military of Belize|Belize]], [[Military Forces based in Brunei|Brunei]], [[British Army Training Unit Suffield|Canada]], [[British Forces Cyprus|Cyprus]], [[Diego Garcia]], the [[Military of the Falkland Islands|Falkland Islands]], [[British Forces Germany|Germany]], [[British Forces Gibraltar|Gibraltar]], [[British Army Training Unit Kenya|Kenya]], [[Oman]], [[Al Udeid Air Base|Qatar]] and [[Singapore]].<ref>{{Cite web |title=House of Commons Hansard |url=https://publications.parliament.uk/cgi-bin/newhtml_hl?DB=semukparl&STEMMER=en&WORDS=raf%20diego%20garcia&ALL=RAF&ANY=&PHRASE=%22Diego%20Garcia%20%22&CATEGORIES=&SIMPLE=&SPEAKER=&COLOUR=red&STYLE=s&ANCHOR=50221w33.html_spnew0&URL=/pa/cm200405/cmhansrd/vo050221/text/50221w33.htm#50221w33.html_spnew0 |archive-url=https://web.archive.org/web/20090309114107/http://www.publications.parliament.uk/cgi-bin/newhtml_hl?DB=semukparl&STEMMER=en&WORDS=raf%20diego%20garcia&ALL=RAF&ANY=&PHRASE=%22Diego%20Garcia%20%22&CATEGORIES=&SIMPLE=&SPEAKER=&COLOUR=red&STYLE=s&ANCHOR=50221w33.html_spnew0&URL=%2Fpa%2Fcm200405%2Fcmhansrd%2Fvo050221%2Ftext%2F50221w33.htm#50221w33.html_spnew0 |archive-date=9 March 2009 |access-date=23 October 2008 |publisher=UK Parliament}}; {{Cite web |title=House of Commons Hansard Written Answers for 17 Jun 2013 (pt 0002) |url=https://publications.parliament.uk/pa/cm201314/cmhansrd/cm130617/text/130617w0002.htm#13061746000236 |archive-url=https://web.archive.org/web/20150214025754/http://www.publications.parliament.uk/pa/cm201314/cmhansrd/cm130617/text/130617w0002.htm#13061746000236 |archive-date=14 February 2015 |access-date=4 March 2015 |publisher=Publications.parliament.uk}}</ref>
According to the [[Stockholm International Peace Research Institute]]<ref>{{Cite web |date=April 2026|title=Trends in Military Expenditure 2025|url=https://www.sipri.org/sites/default/files/2026-04/2604_milex_2025.pdf#page=2|access-date=31 May 2026|publisher=[[Stockholm International Peace Research Institute]]}}</ref> and the [[International Institute for Strategic Studies]],<ref>{{Cite web |title=The Military Balance 2026: Global defence spending|url=https://www.iiss.org/publications/the-military-balance/2026/the-military-balance-2026/global-defence-spending/|access-date=31 May 2026|website=IISS|language=en}}</ref> the UK had the world's [[List of countries by military expenditures|sixth- or fifth-highest military expenditures]] in 2025. Total defence spending in 2024 was estimated at 2.3 per cent of [[gross domestic product]].<ref>{{Cite web |title=Rishi Sunak vows to boost UK defence spending to 2.5% of GDP by 2030 |url=https://www.bbc.co.uk/news/uk-politics-68880171 |access-date=24 April 2024 |publisher=BBC News |date=24 April 2024 |archive-date=23 April 2024 |archive-url=https://web.archive.org/web/20240423233438/https://www.bbc.co.uk/news/uk-politics-68880171 |url-status=live}}</ref> Following the end of the [[Cold War]], defence policy has a stated assumption that "the most demanding operations" will be undertaken as part of a coalition.<ref>''UK 2005: The Official Yearbook of the United Kingdom of Great Britain and Northern Ireland''. Office for National Statistics. p. 89.</ref>
=== Law and criminal justice ===
<!-- Copyedit done to here -->
{{Main|Law of the United Kingdom|Crime in the United Kingdom}}
{{Further|English law|Northern Ireland law|Scots law}}
[[File:Middlesex Guildhall (cropped).jpg|thumb|The [[Supreme Court of the United Kingdom|Supreme Court]] is the final court of appeal for England, Wales and Northern Ireland, and for Scottish civil cases.]]
The United Kingdom does not have a single legal system as the [[Treaty of Union|1706 Treaty of Union]] provided for the continuation of Scotland's separate legal system.<ref name="Acts of Union 1707" /> The UK has three distinct [[Legal systems of the world|systems of law]]: English law, Northern Ireland law and Scots law. A new [[Supreme Court of the United Kingdom]] came into being in October 2009 to replace the [[judicial functions of the House of Lords|Appellate Committee of the House of Lords]].<ref>{{Cite news |date=1 October 2009 |title=UK Supreme Court judges sworn in |work=BBC News |url=http://news.bbc.co.uk/1/hi/uk/8283939.stm |access-date=6 October 2009 |archive-date=7 February 2020 |archive-url=https://web.archive.org/web/20200207160453/http://news.bbc.co.uk/1/hi/uk/8283939.stm |url-status=live}}; {{Cite web |date=July 2003 |title=Constitutional reform: A Supreme Court for the United Kingdom |url=http://www.dca.gov.uk/consult/supremecourt/supreme.pdf |archive-url=http://webarchive.nationalarchives.gov.uk/20090117132005/http://www.dca.gov.uk/consult/supremecourt/supreme.pdf |archive-date=17 January 2009 |access-date=13 May 2013 |publisher=Department for Constitutional Affairs}}</ref> The [[Judicial Committee of the Privy Council]], including the same members as the Supreme Court, is the highest court of appeal for several independent Commonwealth countries, the [[British Overseas Territories]] and the [[Crown Dependencies]].<ref>{{Cite web |title=Role of the JCPC |url=http://www.jcpc.uk/about/role-of-the-jcpc.html |access-date=28 April 2013 |publisher=Judicial Committee of the Privy Council |archive-date=14 January 2014 |archive-url=https://web.archive.org/web/20140114165910/http://www.jcpc.uk/about/role-of-the-jcpc.html |url-status=live}}</ref>
Both English law, which applies in England and Wales, and Northern Ireland law are based on [[common law]] (or [[case law]]) principles.<ref>{{Cite book |last=Bainham |first=Andrew |url=https://books.google.com/books?id=AF303DEl0MkC&pg=PA298 |title=The international survey of family law: 1996 |publisher=Martinus Nijhoff |year=1998 |isbn=978-90-411-0573-8 |location=The Hague |page=298 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141743/https://books.google.com/books?id=AF303DEl0MkC&pg=PA298#v=onepage&q&f=false |url-status=live}}</ref> It originated in England in the [[Middle Ages]] and is the basis for many legal systems around the world.<ref>{{Cite web |title=Common Law |url=https://www.britannica.com/topic/common-law |access-date=27 May 2024 |publisher=Britannica |date=19 May 2024 |archive-date=6 May 2021 |archive-url=https://web.archive.org/web/20210506134920/https://www.britannica.com/topic/common-law |url-status=live}}</ref> The [[courts of England and Wales]] are headed by the [[Senior Courts of England and Wales]], consisting of the [[Court of Appeal of England and Wales|Court of Appeal]], the [[High Court of Justice]] for civil cases and the [[Crown Court]] for criminal cases.<ref>{{Cite web |title=The Australian courts and comparative law |url=http://www.alpn.edu.au/node/66 |archive-url=https://web.archive.org/web/20130414202207/http://alpn.edu.au/node/66 |archive-date=14 April 2013 |access-date=9 March 2015 |publisher=Australian Law Postgraduate Network}}</ref> Scots law is a hybrid system based on common-law and [[Civil law (legal system)|civil-law]] principles. The chief courts are the [[Court of Session]], for civil cases,<ref>{{Cite web |title=Court of Session – Introduction |url=http://www.scotcourts.gov.uk/session/index.asp |archive-url=https://web.archive.org/web/20080731094308/http://www.scotcourts.gov.uk/session/index.asp |archive-date=31 July 2008 |access-date=8 March 2015 |publisher=Scottish Courts}}</ref> and the [[High Court of Justiciary]], for criminal cases.<ref>{{Cite web |title=High Court of Justiciary – Introduction |url=http://www.scotcourts.gov.uk/justiciary/index.asp |archive-url=https://web.archive.org/web/20080912204821/http://www.scotcourts.gov.uk/justiciary/index.asp |archive-date=12 September 2008 |access-date=9 March 2015 |publisher=Scottish Courts}}</ref> The Supreme Court of the United Kingdom serves as the highest court of appeal for civil cases under Scots law.<ref>{{Cite web |title=House of Lords – Practice Directions and Standing Orders Applicable to Civil Appeals |url=https://publications.parliament.uk/pa/ld199697/ldinfo/ld08judg/bluebook/bluebk03.htm |archive-url=https://web.archive.org/web/20131206120915/http://www.publications.parliament.uk/pa/ld199697/ldinfo/ld08judg/bluebook/bluebk03.htm |archive-date=6 December 2013 |access-date=8 March 2015 |publisher=UK Parliament}}</ref> The criminal justice system has been characterised by low [[conviction rate]]s and [[Justice delayed is justice denied|court delays]] for some crime types.<ref name="s576">{{cite journal | last1=Lovett | first1=Jo | last2=Hales | first2=Gavin | last3=Kelly | first3=Liz | last4=Khan | first4=Aneela | last5=Hardiman | first5=Margaret | last6=Trott | first6=Louise | title=What can We Learn from Police Data About Timeliness in Rape and Serious Sexual Offence Investigations in England and Wales? | journal=International Criminology | volume=2 | issue=3 | date=2022 | issn=2662-9976 | doi=10.1007/s43576-022-00069-8 | pages=286–298| pmc=9527390 }}</ref>
Crime in England and Wales increased between 1981 and 1995. Since that peak there has been an overall fall of 66% in recorded crime from 1995 to 2015,<ref>{{Cite web |url=http://www.ons.gov.uk/ons/dcp171778_419450.pdf |title=Crime in England and Wales, Year Ending June 2015 |publisher=Office for National Statistics |website=UK Government Web Archive |access-date=16 March 2023 |archive-date=16 March 2023 |archive-url=https://web.archive.org/web/20230316221317/https://webarchive.nationalarchives.gov.uk/ukgwa/20160105160709/http://www.ons.gov.uk/ons/dcp171778_419450.pdf |url-status=bot: unknown}}</ref> according to [[Crime statistics in the United Kingdom|UK crime statistics]].
[[United Kingdom labour law|UK labour laws]] establish employment rights including [[National Minimum Wage Act 1998|a minimum wage]], a minimum of 28 days annual holiday, parental leave, statutory sick pay and [[Pensions Act 2008|a pension]]. [[Same-sex marriage]] has been legal in England, Scotland, and Wales since 2014, and in [[Northern Ireland]] since 2020.<ref>{{cite web |last1=Wratten |first1=Marcus |title=Tom Allen to host vital new BBC show marking 10th anniversary of same-sex marriage |url=https://www.thepinknews.com/2023/07/03/tom-allen-bbc-my-big-gay-wedding-same-sex-marriage/ |website=PinkNews |date=3 July 2023 |access-date=2 September 2023 |archive-date=2 September 2023 |archive-url=https://web.archive.org/web/20230902195143/https://www.thepinknews.com/2023/07/03/tom-allen-bbc-my-big-gay-wedding-same-sex-marriage/ |url-status=live}}</ref> [[LGBT rights in the United Kingdom|LGBT equality]] in the United Kingdom is considered advanced by modern standards.<ref>{{Cite web |date=5 June 2023 |title=The 203 Worst (& Safest) Countries for LGBTQ+ Travel in 2023 |url=https://www.asherfergusson.com/lgbtq-travel-safety/ |access-date=20 August 2023 |website=Asher & Lyric |archive-date=10 September 2021 |archive-url=https://web.archive.org/web/20210910063408/https://www.asherfergusson.com/lgbtq-travel-safety/ |url-status=live}}</ref><ref>{{cite web |last1=R. Flores |first1=Andrew |title=Social Acceptance of LGBTI People in 175 Countries and Locations |url=https://williamsinstitute.law.ucla.edu/publications/global-acceptance-index-lgbt/ |website=Williams Institute |access-date=11 September 2023 |archive-date=13 September 2023 |archive-url=https://web.archive.org/web/20230913091254/https://williamsinstitute.law.ucla.edu/publications/global-acceptance-index-lgbt/ |url-status=live}}</ref>
Since leaving the [[European Union|EU]] most disputes under UK-EU agreements are addressed through consultation between the parties. If consultation fails to resolve the issue, either party can request [[arbitration]], typically at the [[Permanent Court of Arbitration|PCA]] in [[Peace Palace|The Hague]].<ref name="commission.europa.eu" /><ref>{{Cite web |title=Disputes under the Trade and Cooperation Agreement |date=November 2021 |url=https://www.instituteforgovernment.org.uk/explainer/disputes-trade-and-cooperation-agreement |access-date=26 January 2025 |publisher=Institute for Government}}</ref><ref>{{Cite web |title=Sandeel fishing ban to remain in place |date=2 May 2025 |url=https://www.bbc.co.uk/news/articles/ckgrwxxzxkjo |website=BBC |access-date=4 May 2025 |archive-url=https://web.archive.org/web/20250504203005/https://www.bbc.com/news/articles/ckgrwxxzxkjo |archive-date=4 May 2025}}</ref> The [[EU–UK Trade and Cooperation Agreement]] states that the UK and EU have to cooperate and negotiate with each other with 'full mutual respect and good faith', as defined by international law.<ref>{{Cite web |title=Good Faith in Public Law |date=20 January 2022 |url=https://www.law.ox.ac.uk/news/2022-01-20-good-faith-public-law |website=ox.ac.uk |access-date=13 May 2025 |archive-url=https://web.archive.org/web/20250513165454/https://www.law.ox.ac.uk/news/2022-01-20-good-faith-public-law |archive-date=13 May 2025}}</ref> Under the [[Windsor Framework]], [[Northern Ireland]] matters requiring interpretation of EU law go to the [[European Court of Justice|ECJ]], though the [[Stormont Brake]] can prevent new EU rules from taking effect.
== Economy ==
{{Main|Economy of the United Kingdom}}
{{Further|Economy of England|Economy of Scotland|Economy of Northern Ireland|Economy of Wales}}
[[File:Bank junction - 2020-09-20 (2).jpg|thumb|[[City of London]] skyline from at [[Bank Junction]]. [[London]] is Europe's largest financial centre.<ref>{{Cite web |last=Yanatma |first=Servet |date=16 March 2024 |title=Europe's top financial centres: Where's best to do business? |url=https://www.euronews.com/business/2024/03/16/europes-top-financial-centres-wheres-best-to-do-business |access-date=16 August 2025 |publisher=[[Euronews]] |quote=While the US dominates the upper end of the list, with New York taking the number one spot, London continues to lead in Europe.}}</ref>]]
The United Kingdom has a highly developed [[social market economy]].<ref>{{Cite journal |last1=Thane |first1=Pat |year=2019 |title=The Origins of the British Welfare State |journal=The Journal of Interdisciplinary History |volume=50 |issue=3 |pages=427–433 |doi=10.1162/jinh_a_01448 |s2cid=208223636 |doi-access=free}}</ref><ref name="ftms">{{cite web |last1=Griffiths |first1=Alan |last2=Wall |first2=Stuart |date=16 July 2011 |title=Applied Economics |url=http://www.ftms.edu.my/pdf/Download/UndergraduateStudent/BusinessEconomics/BC215001S%20-%20BE%20Key%20Text%20-%20Applied%20Economics.pdf |url-status=dead |archive-url=https://web.archive.org/web/20130620120524/http://www.ftms.edu.my/pdf/Download/UndergraduateStudent/BusinessEconomics/BC215001S%20-%20BE%20Key%20Text%20-%20Applied%20Economics.pdf |archive-date=20 June 2013 |access-date=25 September 2014}}</ref> With an estimated nominal [[gross domestic product]] (GDP) of £2.819 trillion in 2025,<ref name="IMFWEO.UK" /> it is the [[List of countries by GDP (nominal)|fifth-largest national economy]] in the world and the [[List of sovereign states in Europe by GDP (nominal)|second-largest]] in Europe. Its currency, the [[pound sterling]], is the [[Foreign exchange market#Most traded currencies by value|fourth-most-traded currency]] in the [[foreign exchange market]] and the world's fourth-largest [[reserve currency]], after the [[United States dollar]], the [[euro]] and the [[yen]].<ref>{{Cite web |title=World Currency Composition of Official Foreign Exchange Reserves |url=https://data.imf.org/regular.aspx?key=41175 |access-date=10 October 2021 |website=IMF Data |archive-date=12 May 2016 |archive-url=https://web.archive.org/web/20160512202858/https://data.imf.org/regular.aspx?key=41175 |url-status=live}}</ref> The pound sterling maintains its high nominal value through both its long history of stability and by never undergoing formal [[redenomination]]. Since 2022 the UK has been both the world's [[List of countries by exports|fourth-largest exporter]]<ref>{{Cite web |title=Exports of goods and services (BoP, current US$) |url=https://data.worldbank.org/indicator/BX.GSR.GNFS.CD?end=2024&most_recent_value_desc=true |access-date=22 September 2025 |website=[[World Bank]]}}</ref> and [[List of countries by imports|fourth-largest importer]]<ref>{{Cite web |title=Imports of goods and services (current US$) |url=https://data.worldbank.org/indicator/NE.IMP.GNFS.CD?most_recent_value_desc=true |access-date=22 September 2025 |website=[[World Bank]] |archive-date=13 September 2025 |archive-url=https://web.archive.org/web/20250913065521/https://data.worldbank.org/indicator/NE.IMP.GNFS.CD?most_recent_value_desc=true |url-status=live }}</ref> of goods and services. Despite having one of the highest levels of [[Income inequality in the United Kingdom|income inequality]] in the [[OECD]],<ref>{{Cite web |last1=Francis-Devine |first1=Brigid |title=House of Commons Research Briefing on Income inequality in the UK. |url=https://commonslibrary.parliament.uk/research-briefings/cbp-7484/ |url-status=live |archive-url=https://web.archive.org/web/20220210104536/https://commonslibrary.parliament.uk/research-briefings/cbp-7484/ |archive-date=10 February 2022 |access-date=1 July 2023 |website=UK Parliament}}</ref><ref>{{Cite web |title=Inequality – Income inequality – OECD Data |url=http://data.oecd.org/inequality/income-inequality.htm |archive-url=https://web.archive.org/web/20230629183322/https://data.oecd.org/inequality/income-inequality.htm |archive-date=29 June 2023 |access-date=3 July 2023 |website=theOECD}}</ref> the UK has a very high [[Human Development Index|HDI]] ranking, including when [[List of countries by inequality-adjusted Human Development Index|adjusted for inequality]]. As of 2025 the [[Unemployment in the United Kingdom|UK unemployment rate]] is 4.7%<ref>{{Cite web |last1=Labiak |first1=Mitchell |last2=Smith |first2=Oliver |date=17 July 2025 |title=UK jobs market weakens as unemployment rate rises |url=https://www.bbc.com/news/articles/cg754negn75o |access-date=25 September 2025 |website=www.bbc.com |language=en-GB |archive-date=15 September 2025 |archive-url=https://web.archive.org/web/20250915184829/https://www.bbc.com/news/articles/cg754negn75o |url-status=live }}</ref> and the annual [[List of countries by real GDP per capita growth|real GDP per head growth]] was 1.1%.<ref name="f919">{{cite web | title=GDP quarterly national accounts, UK | website=Office for National Statistics | date=2026 | url=https://www.ons.gov.uk/economy/grossdomesticproductgdp/bulletins/quarterlynationalaccounts/octobertodecember2025 | access-date=24 April 2026}}</ref>
[[HM Treasury]], led by the [[Chancellor of the Exchequer]], is responsible for developing and executing the government's [[public finance]] and [[economic policy]]. The [[Department for Business and Trade]] is responsible for business, international trade, and enterprise. The [[Bank of England]] is the UK's [[central bank]] and responsible for issuing notes and coins in the pound sterling. Banks in Scotland and Northern Ireland retain the right to issue their own notes, subject to retaining enough Bank of England notes in reserve to cover their issue.
=== Industries and services ===
[[File:Bank-of-England.jpg|thumb|The [[Bank of England]] is the [[central bank]] of the United Kingdom and the model on which most modern central banks have been based.]]
[[File:British Airways Concorde G-BOAC 03.jpg|thumb|[[Concorde]] was a [[Supersonic speed|supersonic]] airliner that reduced transatlantic flight time from 8 hours to 3.5 hours.<ref>{{Cite web |title=Celebrating Concorde |url=https://www.britishairways.com/en-gb/information/about-ba/history-and-heritage/celebrating-concorde |archive-url=https://web.archive.org/web/20230317103939/https://www.britishairways.com/en-gb/information/about-ba/history-and-heritage/celebrating-concorde |archive-date=17 March 2023 |access-date=30 March 2023}}</ref>]]
The [[Tertiary sector of the economy|service sector]] made up around 80 per cent of the UK's [[Gross value added|GVA]] in 2023.<ref>{{Cite web |last=Hutton |first=Georgina |date=3 October 2024 |title=Industries in the UK |url=https://commonslibrary.parliament.uk/research-briefings/cbp-8353/ |access-date=19 May 2025 |website=UK Parliament: House of Commons Library |archive-date=7 October 2021 |archive-url=https://web.archive.org/web/20211007134640/https://commonslibrary.parliament.uk/research-briefings/cbp-8353/ |url-status=live }}</ref> As of 2023 it is the world's [[List of countries by service exports|second-largest exporter of services]]<ref>{{Cite web |title=Service exports (BoP, current US$) |url=https://data.worldbank.org/indicator/BX.GSR.NFSV.CD?most_recent_value_desc=true&year_high_desc=false |access-date=19 May 2025 |website=World Bank Open Data |archive-date=17 March 2023 |archive-url=https://web.archive.org/web/20230317140633/https://data.worldbank.org/indicator/BX.GSR.NFSV.CD?most_recent_value_desc=true&year_high_desc=false |url-status=live }}</ref> and in 2024 was the world's largest net exporter of [[Financial services in the United Kingdom|financial services]].<ref>{{Cite web |date=15 January 2025 |title=UK leads world in financial services trade surplus |url=https://www.thecityuk.com/news/uk-leads-world-in-financial-services-trade-surplus/ |access-date=2 June 2025 |website=TheCityUK |language=en}}</ref> [[London]] is the world capital for foreign exchange trading, with a market share of 37.8 per cent in 2022 of the global turnover.<ref>{{Cite web |date=30 September 2025 |title=BIS Triennial Survey of Foreign Exchange and Over-The-Counter Interest Rate Derivatives Markets in April 2025 – UK Data |url=https://www.bankofengland.co.uk/news/2025/september/bis-triennial-survey-of-foreign-exchange-and-over-the-counter-interest-rate-derivatives-markets |access-date=7 December 2025 |publisher=Bank of England}}</ref> It is the largest urban economy in Europe<ref>{{Cite web |last=Florida |first=Richard |date=16 March 2017 |title=The Economic Power of Cities Compared to Nations |url=https://www.bloomberg.com/news/articles/2017-03-16/top-metros-have-more-economic-power-than-most-nations |url-status=live |archive-url=https://web.archive.org/web/20240308074221/https://www.bloomberg.com/news/articles/2017-03-16/top-metros-have-more-economic-power-than-most-nations |archive-date=8 March 2024 |access-date=22 February 2024 |website=Bloomberg}}</ref> and, alongside [[New York City|New York]], the city in the world most integrated with the [[World economy|global economy]].<ref>{{Cite web |title=World Cities 2024 |url=https://gawc.lboro.ac.uk/gawc-worlds/the-world-according-to-gawc/world-cities-2024/ |access-date=21 September 2025 |website=GaWC |language=en-US |archive-date=3 July 2025 |archive-url=https://web.archive.org/web/20250703071437/https://gawc.lboro.ac.uk/gawc-worlds/the-world-according-to-gawc/world-cities-2024/ |url-status=live }}</ref> London is also one of the world's leading financial centres, ranking second in the 2025 [[Global Financial Centres Index]].<ref name="www.longfinance.net">{{Cite web |title=GFCI 36 Rank - Long Finance |url=https://www.longfinance.net/programmes/financial-centre-futures/global-financial-centres-index/gfci-36-explore-the-data/gfci-36-rank/ |access-date=19 May 2025 |website=www.longfinance.net |archive-date=25 September 2024 |archive-url=https://web.archive.org/web/20240925155927/https://www.longfinance.net/programmes/financial-centre-futures/global-financial-centres-index/gfci-36-explore-the-data/gfci-36-rank/ |url-status=live }}</ref> [[Edinburgh]], the UK's second-largest financial centre, ranks 29th in the world in the same index.<ref name="www.longfinance.net" />
The [[Manufacturing in the United Kingdom|UK's manufacturing sector]] in 2024 was the world's [[List of countries by manufacturing output|10th-largest]] and Europe's fourth-largest by value output.<ref>{{Cite web |title=World Bank Open Data |url=https://data.worldbank.org/indicator/NV.IND.MANF.CD?most_recent_value_desc=true |access-date=5 August 2025 |website=World Bank Open Data |archive-date=7 January 2020 |archive-url=https://web.archive.org/web/20200107135049/https://data.worldbank.org/indicator/NV.IND.MANF.CD?most_recent_value_desc=true |url-status=live }}</ref> At the end of 2024 manufacturing in the United Kingdom accounted for 8 per cent of the workforce and 8.6 per cent of national economic output.<ref>{{Cite web |date=22 May 2025 |title=Manufacturing industries: Economic indicators |url=https://commonslibrary.parliament.uk/research-briefings/sn05206/ |access-date=1 June 2025 |website=House of Commons Library}}</ref> As reported in 2017 the [[East Midlands Manufacturing|East Midlands]] and [[West Midlands Manufacturing|West Midlands]] (at 12.6 and 11.8 per cent respectively) were the regions with the highest proportion of employees in manufacturing. [[London manufacturing|London's manufacturing sector]] had the lowest at 2.8 per cent.<ref>Hennik Research. [http://www.themanufacturer.com/wp-content/uploads/2017/01/Annual-Manufacturing-Report-2017-Final-Version.pdf ''Annual Manufacturing Report: 2017'' (Dec. 2016)] {{Webarchive|url=https://web.archive.org/web/20170131192050/http://www.themanufacturer.com/wp-content/uploads/2017/01/Annual-Manufacturing-Report-2017-Final-Version.pdf|date=31 January 2017}}</ref>
The [[Tourism in the United Kingdom|country's tourism sector]] is important to the British economy;<ref>{{Cite web |last1=Chan |first1=Kelvin |date=25 April 2023 |title=King Charles' coronation is bringing millions of tourists and a cash infusion to London but it probably won't save the British economy |url=https://fortune.com/2023/04/25/king-charles-coronation-tourists-money-london-british-economy/ |archive-url=https://web.archive.org/web/20230502144950/https://fortune.com/2023/04/25/king-charles-coronation-tourists-money-london-british-economy/ |archive-date=2 May 2023 |access-date=9 May 2023 |website=[[fortune.com]] |agency=The Associated Press}}</ref> The [[creative industries]] accounted for 5.9 per cent of the UK's GVA in 2019,<ref>{{Cite web |title=DCMS Economic Estimates 2019 (provisional): Gross Value Added |url=https://www.gov.uk/government/statistics/dcms-economic-estimates-2019-gross-value-added/dcms-economic-estimates-2019-provisional-gross-value-added |access-date=31 January 2023 |website=gov.uk |archive-date=31 January 2023 |archive-url=https://web.archive.org/web/20230131001226/https://www.gov.uk/government/statistics/dcms-economic-estimates-2019-gross-value-added/dcms-economic-estimates-2019-provisional-gross-value-added |url-status=live}}</ref> and contributed £111 billion to the UK economy in 2018.<ref>{{Cite web |year=2020 |title=UK's Creative Industries contributes almost £13 million to the UK economy every hour |url=https://www.gov.uk/government/news/uks-creative-industries-contributes-almost-13-million-to-the-uk-economy-every-hour |access-date=21 February 2023 |publisher=UK Government |archive-date=21 February 2023 |archive-url=https://web.archive.org/web/20230221131518/https://www.gov.uk/government/news/uks-creative-industries-contributes-almost-13-million-to-the-uk-economy-every-hour |url-status=live}}</ref> [[Lloyd's of London]], located in London, is the world's largest [[insurance]] and [[reinsurance]] market.<ref>{{Cite web |title=Lloyd's of London – value proposition |url=https://www.lloyds.com/about-lloyds/value-proposition-coverholder |archive-url=https://web.archive.org/web/20230227100951/https://www.lloyds.com/about-lloyds/value-proposition-coverholder |archive-date=27 February 2023 |website=Lloyd's of London}}</ref> [[WPP plc]] is one of the world's biggest advertising companies and also based in London.<ref>{{Cite web |title=Rankings 2025 - Creative 100 |url=https://www.warc.com/creative/rankings/creative-100 |website=WARC |access-date=12 June 2025 |archive-url=https://web.archive.org/web/20250612162216/https://www.warc.com/creative/rankings/creative-100 |archive-date=12 June 2025}}</ref> The UK is one of Europe's leading retail markets and its largest [[e-commerce]] market.<ref>{{Cite web |url=https://www.great.gov.uk/international/content/investment/sectors/retail/ |access-date=18 January 2024 |title=Retail |publisher=great.gov.uk |archive-date=18 January 2024 |archive-url=https://web.archive.org/web/20240118084416/https://www.great.gov.uk/international/content/investment/sectors/retail/ |url-status=live}}</ref> With [[Consumer spending|consumption expenditures]] of over US$2 trillion in 2023, it has the [[List of largest consumer markets|second-largest consumer market]] in Europe.<ref>{{Cite web |title=Households and NPISHs Final consumption expenditure (current US$) |url=https://data.worldbank.org/indicator/NE.CON.PRVT.CD?year_high_desc=true |access-date=17 August 2024 |website=World Bank Group |archive-date=12 June 2018 |archive-url=https://web.archive.org/web/20180612143614/https://data.worldbank.org/indicator/NE.CON.PRVT.CD?year_high_desc=true |url-status=live}}</ref> [[John Lewis Partnership|John Lewis]] is the UK's largest employee-owned business.<ref>{{Cite web |url=https://employeeownership.co.uk/resources/what-the-evidence-tells-us/ |access-date=18 January 2024 |title=Employee owned businesses - What the evidence tells us |archive-date=2 December 2023 |archive-url=https://web.archive.org/web/20231202155249/https://employeeownership.co.uk/resources/what-the-evidence-tells-us/ |url-status=live}}</ref>
The [[Automotive industry in the United Kingdom|British automotive industry]] generates £47 billion of exports (12 per cent of the UK's total exports of goods).<ref name="Auto Output 2025" /> In 2024 the UK produced 779,584 passenger vehicles and 125,649 commercial vehicles; 8 out of 10 cars produced in the UK are exported overseas.<ref name="Auto Output 2025">{{Cite web |date=15 May 2025 |title=SMMT Motor Industry Facts 2025 |url=https://www.smmt.co.uk/smmt-motor-industry-facts-2025/ |access-date=26 May 2025 |website=SMMT |archive-date=26 May 2025 |archive-url=https://web.archive.org/web/20250526074751/https://www.smmt.co.uk/smmt-motor-industry-facts-2025/ |url-status=live}}</ref> Britain is known for iconic cars like [[Mini Hatch|Mini]] and [[Jaguar Cars|Jaguar]],<ref>{{Cite web |date=19 November 2020 |title=Best British cars: Top 50 all-time greatest British-built cars revealed - page 2 |url=https://www.autoexpress.co.uk/best-cars-vans/351729/best-british-cars-top-50-all-time-greatest-british-built-cars-revealed/page-2 |access-date=9 March 2024 |website=Auto Express |archive-date=16 March 2024 |archive-url=https://web.archive.org/web/20240316184015/https://www.autoexpress.co.uk/best-cars-vans/351729/best-british-cars-top-50-all-time-greatest-british-built-cars-revealed/page-2 |url-status=live}}</ref> as well as luxury cars such as [[Rolls-Royce Motor Cars|Rolls-Royce]], [[Bentley]] and [[Range Rover]]. The UK is a major centre for engine manufacturing: 1.59 million engines were produced in 2024.<ref name="Auto Output 2025" /> It was the world's [[List of countries by engine exports|third-largest exporter of engines]] by value in 2023.<ref>{{Cite web |title=Combustion Engines |url=https://oec.world/en/profile/hs/combustion-engines |access-date=26 May 2025 |website=OEC - The Observatory of Economic Complexity |archive-date=26 May 2025 |archive-url=https://web.archive.org/web/20250526073421/https://oec.world/en/profile/hs/combustion-engines |url-status=live}}</ref> The [[Motorsport in the United Kingdom|UK motorsport]] industry has an annual turnover of around £10 billion.<ref>{{Cite web |year=2020 |title=UK motorsport industry in pole position for F1's 70th anniversary |url=https://www.gov.uk/government/news/uk-motorsport-industry-in-pole-position-for-f1s-70th-anniversary |access-date=19 February 2023 |publisher=UK Government |archive-date=19 February 2023 |archive-url=https://web.archive.org/web/20230219100712/https://www.gov.uk/government/news/uk-motorsport-industry-in-pole-position-for-f1s-70th-anniversary |url-status=live}}</ref> Seven of the eleven [[Formula One]] teams are based in the UK, with their technology being used in supercars and hypercars from [[McLaren Automotive|McLaren]], [[Aston Martin]] and [[Lotus Cars|Lotus]].{{Efn|Car brands here are classed as British based on several of the following criteria: historical heritage, cultural significance, design and engineering base, manufacturing location, headquarters location, UK registered company (even with overseas investors).}} The [[Aerospace industry in the United Kingdom|aerospace industry of the UK]] is the second-largest in the world<ref>{{cite web |title=United Kingdom - Country Commercial Guide: Aerospace and Defense |url=https://www.trade.gov/country-commercial-guides/united-kingdom-aerospace-and-defense |website=[[International Trade Administration]] |date=3 November 2023 |access-date=17 December 2024 |archive-date=12 June 2023 |archive-url=https://web.archive.org/web/20230612142750/https://www.trade.gov/country-commercial-guides/united-kingdom-aerospace-and-defense |url-status=live }}</ref> and has an annual turnover of around £30 billion.<ref>{{Cite news |last=Tovey |first=Alan |date=29 June 2016 |title=Britain's aerospace sector soars amid fears Brexit could clip its wings |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/business/2016/06/29/britains-aerospace-sector-soars-amid-fears-brexit-could-clip-its |url-status=live |url-access=subscription |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/business/2016/06/29/britains-aerospace-sector-soars-amid-fears-brexit-could-clip-its |archive-date=10 January 2022}}{{Cbignore}}</ref> The [[British space programme|UK space industry]] was worth £17.5 billion in 2020/21 and employed around 48,800 people.<ref>{{cite web |title=UK space sector income reaches £17.5 billion as jobs and services grow |url=https://www.ukspace.org/uk-space-sector-income-reaches-17-5-billion-as-jobs-and-services-grow/ |website=UKspace |date=27 March 2023}}</ref><ref>{{cite web |title=UK space sector income reaches £17.5 billion as jobs and services grow |url=https://www.gov.uk/government/news/uk-space-sector-income-reaches-175-billion-as-jobs-and-services-grow |website=gov.uk |date=29 March 2023 |access-date=10 August 2025}}</ref> The [[UK Space Agency]] has stated in 2023 that it is investing £1.6 billion in space-related projects.<ref>{{Cite web |url=https://www.gov.uk/government/news/new-funding-to-support-space-exploration-using-moon-resources-and-nuclear-power |title=New funding to support space exploration using Moon resources and nuclear power |access-date=11 March 2023 |archive-date=11 March 2023 |archive-url=https://web.archive.org/web/20230311195622/https://www.gov.uk/government/news/new-funding-to-support-space-exploration-using-moon-resources-and-nuclear-power}} <!-- (last checked 2023-03-11) --></ref>
The [[Agriculture in the United Kingdom|British agriculture industry]] is intensive, highly mechanised and efficient by European standards, producing approximately 60 per cent of the country's overall food requirements and 73 per cent of its indigenous food needs, utilising around 0.9 per cent of the labour force (292,000 workers).<ref>{{Cite web |title=UK Food Security Index 2024 |url=https://www.gov.uk/government/publications/uk-food-security-index-2024/uk-food-security-index-2024 |access-date=19 May 2024 |publisher=Department for the Environment Food & Rural Affairs |archive-date=18 May 2024 |archive-url=https://web.archive.org/web/20240518072412/https://www.gov.uk/government/publications/uk-food-security-index-2024/uk-food-security-index-2024 |url-status=live}};{{Cite web |title=Agricultural workforce in England at 1 June 2023 |url=https://www.gov.uk/government/statistics/agricultural-workforce-in-england-at-1-june/agricultural-workforce-in-england-at-1-june-2023 |access-date=19 May 2024 |publisher=Department for the Environment Food & Rural Affairs |archive-date=19 May 2024 |archive-url=https://web.archive.org/web/20240519211112/https://www.gov.uk/government/statistics/agricultural-workforce-in-england-at-1-june/agricultural-workforce-in-england-at-1-june-2023 |url-status=live}}</ref> Around two-thirds of production is devoted to [[livestock]] and one-third to [[arable crops]]. The UK retains a significant though much reduced fishing industry, with at least 49 per cent of UK fish sustainably caught in 2020.<ref>{{Cite web |url=https://jncc.gov.uk/our-work/ukbi-b2-sustainable-fisheries |title=Sustainable fisheries: fish stocks harvested within safe limits |website=JNCC |access-date=14 December 2024}}</ref> The UK marine natural capital assets were estimated to have a value of £211 billion in 2021.<ref>{{Cite web |title=Marine accounts, natural capital, UK: 2021 |date=6 April 2021 |url=https://www.ons.gov.uk/economy/environmentalaccounts/bulletins/marineaccountsnaturalcapitaluk/2021 |website=ONS |access-date=21 May 2025 |archive-url=https://web.archive.org/web/20250521071820/https://www.ons.gov.uk/economy/environmentalaccounts/bulletins/marineaccountsnaturalcapitaluk/2021 |archive-date=21 May 2025}}</ref> It is rich in a variety of other natural resources including coal, [[petroleum]], [[natural gas]], tin, limestone, iron ore, salt, clay, chalk, [[gypsum]], lead, and silica and has an abundance of arable land.<ref>{{Cite web |url=http://www.bgs.ac.uk/mineralsuk/mines/coal/home.html |title=Coal |website=BGS Minerals UK |access-date=7 July 2015 |archive-date=26 April 2009 |archive-url=https://web.archive.org/web/20090426141109/http://www.bgs.ac.uk/ |url-status=live}}</ref>
=== Science and technology ===
{{Main|Science and technology in the United Kingdom|Telecommunications in the United Kingdom}}
[[File:Cambridge Science Park Napp.jpg|thumb|The [[Cambridge Cluster]] is the most intensive research cluster for science and technology in the world.<ref>{{Cite book |last=WIPO |url=https://www.wipo.int/global_innovation_index/en/2022/index.html |title=Global Innovation Index 2022, 15th Edition |publisher=World Intellectual Property Organization |year=2022 |isbn=978-92-805-3432-0 |doi=10.34667/tind.46596 |access-date=16 November 2022 |archive-date=3 December 2022 |archive-url=https://web.archive.org/web/20221203061259/https://www.wipo.int/global_innovation_index/en/2022/index.html |url-status=live}}; {{Cite web |title=Global Innovation Index 2021 |url=https://www.wipo.int/global_innovation_index/en/2021 |access-date=5 March 2022 |website=[[World Intellectual Property Organization]] |publisher=[[United Nations]] |archive-date=5 March 2022 |archive-url=https://web.archive.org/web/20220305010458/https://www.wipo.int/global_innovation_index/en/2021/ |url-status=live}}; {{Cite web |title=Release of the Global Innovation Index 2020: Who Will Finance Innovation? |url=https://www.wipo.int/global_innovation_index/en/2020/index.html |access-date=2 September 2021 |website=World Intellectual Property Organization |archive-date=3 June 2021 |archive-url=https://web.archive.org/web/20210603121259/https://www.wipo.int/global_innovation_index/en/2020/index.html |url-status=live}}; {{Cite web |title=Global Innovation Index 2019 |url=https://www.wipo.int/global_innovation_index/en/2019/index.html |access-date=2 September 2021 |website=World Intellectual Property Organization |archive-date=2 September 2021 |archive-url=https://web.archive.org/web/20210902101818/https://www.wipo.int/global_innovation_index/en/2019/index.html |url-status=live}}; {{Cite web |title=RTD – Item |url=https://ec.europa.eu/newsroom/rtd/items/691898 |access-date=2 September 2021 |website=ec.europa.eu |archive-date=2 September 2021 |archive-url=https://web.archive.org/web/20210902140715/https://ec.europa.eu/newsroom/rtd/items/691898 |url-status=live}}</ref>]]
England and Scotland were leading centres of the [[Scientific Revolution]] from the 17th century.<ref>Gascoin, J. "A reappraisal of the role of the universities in the Scientific Revolution", in Lindberg, David C. and Westman, Robert S., eds (1990), ''Reappraisals of the Scientific Revolution''. Cambridge University Press. p. 248. {{ISBN|978-0-521-34804-1}}.</ref> The United Kingdom led the [[Industrial Revolution]] from the 18th century, and has continued to produce scientists and [[List of British engineers|engineers]] credited with [[List of British innovations and discoveries|important advances]].<ref>Reynolds, E.E.; Brasher, N.H. (1966). ''Britain in the Twentieth Century, 1900–1964''. Cambridge University Press. p. 336. {{OCLC|474197910}}</ref> Major theorists from the 17th and 18th centuries include [[Isaac Newton]], whose [[Newton's laws of motion|laws of motion]] and illumination of [[gravitation|gravity]] have been seen as a keystone of modern science;<ref>Burtt, E.A. (2003) 1924.[https://books.google.com/books?id=G9WBMa1Rz_kC&pg=PA207 ''The Metaphysical Foundations of Modern Science''] {{Webarchive|url=https://web.archive.org/web/20230326164803/https://books.google.com/books?id=G9WBMa1Rz_kC&pg=PA207 |date=26 March 2023 }}. Mineola, NY: Courier Dover. p. 207. {{ISBN|978-0-486-42551-1}}.</ref> from the 19th century [[Charles Darwin]], whose theory of [[evolution]] by [[natural selection]] was fundamental to the development of modern biology, and [[James Clerk Maxwell]], who formulated classical [[electromagnetic theory]]; and more recently [[Stephen Hawking]], who advanced major theories in the fields of [[cosmology]], [[quantum gravity]] and the investigation of [[black holes]].<ref>Hatt, C. (2006). [https://books.google.com/books?id=BVBvehqrAPQC ''Scientists and Their Discoveries''] {{Webarchive|url=https://web.archive.org/web/20230326164803/https://books.google.com/books?id=BVBvehqrAPQC |date=26 March 2023 }}. London: Evans Brothers. pp. 16, 30 and 46. {{ISBN|978-0-237-53195-9}}.</ref>
The [[Department for Science, Innovation and Technology]] (DSIT) is responsible for helping to develop and manage the UK's scientific, research, and technological outputs. Scientific research and development remains important in [[Universities in the United Kingdom|British universities]], with many establishing [[science park]]s to facilitate production and co-operation with industry.<ref>Castells, M.; Hall, P.; Hall, P.G. (2004). ''Technopoles of the World: the Making of Twenty-First-Century Industrial Complexes''. London: Routledge. pp. 98–100. {{ISBN|978-0-415-10015-1}}.</ref> In 2022, the UK produced [[List of countries by number of scientific and technical journal articles|6.0 per cent of the world's scientific research papers]] and had an 8.8 per cent share of scientific citations, the fourth and third highest among <abbr>G7</abbr> countries and Brazil, China, India, Russia, and South Korea. The UK ranked 1st among these countries for Field-Weighted Citation Impact.<ref>{{Cite web |title=International comparison of the UK research base, 2025 |url=https://www.gov.uk/government/publications/international-comparison-of-the-uk-research-base-2025/international-comparison-of-the-uk-research-base-2025 |access-date=7 December 2025 |website=GOV.UK |language=en}}</ref> Scientific journals produced in the UK include publications by the [[Royal Society]], ''[[Nature (journal)|Nature]]'', the ''[[BMJ|British Medical Journal]]'' and ''[[The Lancet]]''.<ref>{{Cite journal |last=McCook, Alison |year=2006 |title=Is peer review broken? |url=http://gaia.pge.utexas.edu/Good/Materials/scientist_02_28_2006.htm |journal=The Scientist |volume=20 |issue=2 |page=26 |archive-url=https://web.archive.org/web/20110816230933/http://gaia.pge.utexas.edu/Good/Materials/scientist_02_28_2006.htm |archive-date=16 August 2011 |access-date=22 June 2011}}</ref>
By 2024 the UK tech sector reached a value of US$1.2 trillion surpassing the combined values of the French and German sectors.<ref>{{Cite web |last=Greenberg |first=Elizabeth |date=14 January 2025 |title=UK Innovation Economy Worth a Combined $1.2 trillion |url=https://www.digit.fyi/uk-innovation-economy-worth-a-combined-1-2-trillion/ |access-date=26 May 2026 |publisher=Digit News |language=en |quote=Valued at $1.2 trillion collectively, the UK innovation ecosystem is worth more than the French and German ecosystems combined.}}</ref> Cambridge was named the number one university in the world for producing successful technology founders.<ref>{{Cite web |title=UK tech sector retains #1 spot in Europe and #3 in world as sector resilience brings continued growth |date=21 December 2022 |url=https://www.gov.uk/government/news/uk-tech-sector-retains-1-spot-in-europe-and-3-in-world-as-sector-resilience-brings-continued-growth |website=gov.uk |access-date=27 May 2025 |archive-url=https://web.archive.org/web/20250527173044/https://www.gov.uk/government/news/uk-tech-sector-retains-1-spot-in-europe-and-3-in-world-as-sector-resilience-brings-continued-growth |archive-date=27 May 2025}}</ref> The [[Artificial intelligence industry in the United Kingdom|UK's artificial intelligence industry]] is the largest in Europe by value<ref>{{Cite web |date=11 June 2024 |title=UK AI sector most valuable in Europe, new report reveals |url=https://www.holyrood.com/news/view,uk-ai-sector-most-valuable-in-europe-new-report-reveals |access-date=20 July 2025 |website=[[Holyrood (magazine)|Holyrood]] |language=en}}</ref> and the country ranked fifth globally in a 2026 report on artificial intelligence development by [[Stanford University]].<ref>{{Cite web |title=Which countries are leading in AI? {{!}} Stanford HAI |url=https://hai.stanford.edu/ai-index/global-vibrancy-tool |access-date=9 May 2026 |website=hai.stanford.edu |language=en}}</ref> The UK ranked 6th in the 2025 [[Global Innovation Index]].<ref>{{Cite web |title=GII Innovation Ecosystems & Data Explorer 2025 |url=https://www.wipo.int/gii-ranking/en/united-kingdom |access-date=16 October 2025 |website=WIPO}}</ref><ref>{{Cite book |last1=Dutta |first1=Soumitra |url=https://www.wipo.int/web-publications/global-innovation-index-2025/en/index.html |title=Global Innovation Index 2025: Innovation at a Crossroads |last2=Lanvin |first2=Bruno |publisher=[[World Intellectual Property Organization]] |year=2025 |isbn=978-92-805-3797-0 |page=19 |language=en |doi=10.34667/tind.58864 |access-date=17 October 2025}}</ref>
=== Transport ===
{{Main|Transport in the United Kingdom}}
{{further|Transport in England|Transport in Scotland|Transport in Wales|Transport in Northern Ireland}}
[[File:An LNER Azuma train on the East Coast Railway Line, geograph 6275180 by Walter Baxter.jpg|thumb|A high-speed [[East Coast Main Line]] train in [[Northumberland]], England]]
[[File:London City Airport Sunset.jpg|thumb|A plane taking off from [[London City Airport]]. [[Airports of London|London's airports]] make it the city with the [[List of busiest city airport systems by passenger traffic|busiest airport system]] in the world.]]
In the UK, all traffic [[Left- and right-hand traffic|drives on the left]], with distance and speed being measured in miles, yards and miles per hour (mph). All vehicles manufactured for use in the UK have the steering wheel situated on the right side of the vehicle. A radial road network totals {{Convert|29145|mi|km}} of main roads, {{Convert|2173|mi|km}} of motorways and {{Convert|213750|mi|km}} of paved roads.<ref name="factbook" /> The [[M25 motorway|M25]], encircling London, is the largest and busiest bypass in the world.<ref>{{Cite book |last=Moran |first=Joe |url=https://archive.org/details/readingeveryday00mora |title=Reading the Everyday |date=16 November 2005 |publisher=Routledge |isbn=978-1-134-37216-4 |page=[https://archive.org/details/readingeveryday00mora/page/n107 95] |url-access=limited}}</ref> In 2024 there were 41.7 million licensed vehicles in the UK.<ref>{{cite web |title=General facts and figures about roads and road use |url=https://www.racfoundation.org/motoring-faqs/mobility |access-date=31 May 2025 |archive-date=18 May 2025 |archive-url=https://web.archive.org/web/20250518191035/https://www.racfoundation.org/motoring-faqs/mobility}}</ref>
The UK has an extensive railway network of {{Convert|10072|mi|0|abbr=out}}. In Great Britain, the [[British Rail]] network [[privatisation of British Rail|was privatised]] between 1994 and 1997, followed by a rapid rise in passengers. [[Great British Railways]] is a planned state-owned public body that will oversee [[rail transport in Great Britain]]. The UK was ranked eighth amongst national European rail systems in the 2017 European Railway Performance Index assessing intensity of use, quality of service and safety.<ref>{{Cite web |last1=Sylvain Duranton |last2=Agnès Audier |last3=Joël Hazan |last4=Mads Peter Langhorn |last5=Vincent Gauche |date=18 April 2017 |title=The 2017 European Railway Performance Index |url=https://www.bcg.com/en-ch/publications/2017/transportation-travel-tourism-2017-european-railway-performance-index.aspx |publisher=Boston Consulting Group |access-date=4 February 2019 |archive-date=31 May 2020 |archive-url=https://web.archive.org/web/20200531104458/https://www.bcg.com/en-ch/publications/2017/transportation-travel-tourism-2017-european-railway-performance-index.aspx |url-status=live}}</ref>
A train runs directly from London to [[Paris]].<ref>{{Cite web |title=London to Paris Trains |url=https://www.eurostar.com/uk-en/train/london-to-paris |access-date=11 May 2024 |publisher=Eurostar |archive-url=https://web.archive.org/web/20240511114452/https://www.eurostar.com/uk-en/train/london-to-paris |archive-date=11 May 2024}}</ref> Called the [[Eurostar]], it travels through the [[Channel Tunnel]] under the [[English Channel]]. At 23.5 miles long, it is the world's longest undersea tunnel.<ref>{{Cite web |title=Channel Tunnel, Tunnel, Europe |url=https://www.britannica.com/topic/Channel-Tunnel |access-date=11 May 2024 |publisher=Britannica |date=10 May 2024}}</ref> There is also a car service through the tunnel to France called [[LeShuttle]]. The [[Elizabeth line]], a rail link running between [[East London|East]] and [[West London]], was named in honour of [[Queen Elizabeth II]] in 2016 and opened in 2022.<ref>{{Cite news |date=2 January 2012 |title=Crossrail's giant tunnelling machines unveiled |work=BBC News |url=https://www.bbc.co.uk/news/av/uk-16289051 |access-date=20 June 2018 |archive-date=10 April 2016 |archive-url=https://web.archive.org/web/20160410034914/http://www.bbc.co.uk/news/uk-16289051 |url-status=live}}; {{Cite news |last=Leftly |first=Mark |date=29 August 2010 |title=Crossrail delayed to save £1bn |work=Independent |location=London |url=https://www.independent.co.uk/news/business/news/crossrail-delayed-to-save-1631bn-2064629.html |access-date=22 August 2017 |archive-date=16 November 2020 |archive-url=https://web.archive.org/web/20201116062835/https://www.independent.co.uk/news/business/news/crossrail-delayed-to-save-1631bn-2064629.html |url-status=live}}</ref><ref>{{Cite web |title=Crossrail to become the Elizabeth line in honour of Her Majesty the Queen |url=https://tfl.gov.uk/info-for/media/press-releases/2016/february/crossrail-to-become-the-elizabeth-line-in-honour-of-her-majesty-the-queen |archive-url=https://web.archive.org/web/20230225110413/https://tfl.gov.uk/info-for/media/press-releases/2016/february/crossrail-to-become-the-elizabeth-line-in-honour-of-her-majesty-the-queen |archive-date=25 February 2023 |website=Transport for London}}</ref> Another major infrastructure project is [[High Speed 2]] (HS2), a high-speed railway under construction since 2019. It will link London with [[Birmingham]], with the potential to extend further north and capable of speeds of up to 225 mph.<ref>{{Cite web |title=What is HS2 |url=https://www.hs2.org.uk/what-is-hs2 |website=HS2 |access-date=22 June 2022 |archive-date=21 June 2022 |archive-url=https://web.archive.org/web/20220621190841/https://www.hs2.org.uk/what-is-hs2/ |url-status=live}}</ref><ref>{{Cite web |title=HS2 Trains |url=https://www.hs2.org.uk/building-hs2/trains/ |website=HS2 |access-date=24 February 2023 |archive-date=24 February 2023 |archive-url=https://web.archive.org/web/20230224183953/https://www.hs2.org.uk/building-hs2/trains/ |url-status=live}}</ref>
In 2023 there were 4 billion bus journeys in the UK, 1.8 billion of which were in London.<ref>{{Cite web |title=Transport Statistics Great Britain: 2023 Domestic Travel |date=19 December 2024 |url=https://www.gov.uk/government/statistics/transport-statistics-great-britain-2024/transport-statistics-great-britain-2023-domestic-travel |website=gov.uk |access-date=14 March 2025}}</ref> The red [[Double-decker bus|double-decker]] bus has entered popular culture as an internationally recognised icon of London and England.<ref>{{Cite web |title=Our Collection |url=http://www.icons.org.uk/theicons/index.html |access-date=16 August 2014 |publisher=icons.org.uk}}</ref> The [[London Buses|London bus network]] is extensive, with over 6,800 scheduled services every weekday carrying about 6 million passengers on over 700 different routes, making it one of the most extensive bus systems in the world and the largest in Europe.<ref>[http://www.tfl.gov.uk/corporate/modesoftransport/1548.aspx London Buses], Transport for London. Accessed 10 May 2007.</ref>
During 2024 [[List of airports in the United Kingdom and the British Crown Dependencies|British airports]] handled nearly 292.5 million passengers.<ref name="caastats">{{Cite web |title=Size of Reporting Airports 2024 |url=https://www.caa.co.uk/Documents/Download/11910/4d230d1f-dab6-4c1a-992a-431b9cca89a2/16918 |access-date=17 January 2025 |publisher=Civil Aviation Authority}}</ref> In that period the three largest airports were [[London Heathrow Airport]] (83.9 million passengers), [[Gatwick Airport]] (43.2 million passengers) and [[Manchester Airport]] (30.8 million passengers).<ref name="caastats" /> London Heathrow Airport, located {{Convert|15|mi|km|}} west of the capital, is the world's [[List of busiest airports by passenger traffic|second-busiest airport by international passenger traffic]] and has the most international passenger traffic of any airport in the world;<ref>{{Cite news |date=25 June 2008 |title=Heathrow 'needs a third runway' |work=BBC News |url=http://news.bbc.co.uk/1/hi/business/7472432.stm |access-date=17 October 2008}}; {{Cite press release |title=Statistics: Top 30 World airports |date=July 2008 |publisher=Airports Council International |url=http://www.aci.aero/aci/aci/file/Press%20Releases/2008/TOP30_International%20Passengers_2007.pdf |access-date=15 October 2008}}</ref> it is the hub for the UK flag carrier [[British Airways]], as well as [[Virgin Atlantic]].<ref>{{Cite news |date=29 October 2008 |title=BMI being taken over by Lufthansa |work=BBC News |url=http://news.bbc.co.uk/2/hi/7697261.stm |access-date=23 December 2009}}</ref> During 2023, 18.3 million passengers travelled internationally by rail and 18.1 million by sea.<ref>{{Cite web |title=Transport Statistics Great Britain: 2023 International Travel |date=19 December 2024 |url=https://www.gov.uk/government/statistics/transport-statistics-great-britain-2024/transport-statistics-great-britain-2023-international-travel |website=gov.uk |access-date=4 March 2025}}</ref>
=== Energy ===
{{Main|Energy in the United Kingdom}}
{{further|Energy in England|Energy in Scotland|Energy in Wales|Energy in Northern Ireland}}
In 2021 the UK was the world's [[List of countries by energy consumption and production|14th-largest consumer and 22nd-largest producer of energy]].<ref name="United Kingdom Energy Profile">{{Cite web |title=United Kingdom Energy Profile |url=https://www.eia.gov/international/overview/country/GBR |archive-url=https://web.archive.org/web/20230228165225/https://www.eia.gov/international/overview/country/GBR |archive-date=28 February 2023 |access-date=28 February 2023 |publisher=U.S. Energy Information Administration}}</ref> It is home to [[Big Six energy suppliers|many large energy companies]], including two of the six major oil and gas companies{{snd}}[[BP]] and [[Shell plc|Shell]].<ref>{{Cite news |last=Mason |first=Rowena |date=24 October 2009 |title=Let the battle begin over black gold |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/finance/newsbysector/energy/6424030/Let-the-battle-begin-over-black-gold.html |url-status=live |url-access=subscription |access-date=26 November 2010 |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/finance/newsbysector/energy/6424030/Let-the-battle-begin-over-black-gold.html |archive-date=10 January 2022}}{{Cbignore}}; {{Cite news |last=Heath |first=Michael |date=26 November 2010 |title=RBA Says Currency Containing Prices, Rate Level 'Appropriate' in Near Term |work=Bloomberg |location=New York |url=https://www.bloomberg.com/news/2010-11-25/rba-s-stevens-says-inflation-unlikely-to-fall-much-further.html |access-date=26 November 2010}}</ref>
[[File:Ardrossan's fan club. - panoramio.jpg|thumb|Wind turbines overlooking [[Ardrossan]] in Scotland. The UK is [[Wind power in the United Kingdom|a major producer of wind energy]] in Europe.<ref>{{Cite web |date=13 September 2023 |title='Success story': Which European countries are leading the way on wind? |url=https://www.euronews.com/green/2023/09/13/winds-of-change-which-european-countries-are-generating-the-most-energy-from-wind |access-date=15 August 2025 |website=[[Euronews]] |language=en}}</ref>]]
Renewable electricity sources provided 51 per cent of the electricity generated in the UK in 2024. [[Wind power in the United Kingdom|Wind power]] was the largest source of electricity in 2024, generating 30 per cent of the UK's total electricity.<ref name="2024 Energy">{{Cite report |title=Britain's Electricity Explained: 2024 Review |url=https://www.neso.energy/news/britains-electricity-explained-2024-review |archive-url=https://web.archive.org/web/20250126085830/https://www.neso.energy/news/britains-electricity-explained-2024-review |archive-date=26 January 2025 |access-date=26 January 2025 |publisher=NESO}}</ref> The UK has the largest offshore wind farm in the world, which is located off the coast of [[Yorkshire]].<ref>{{Cite report |date=14 June 2021 |title=Wind energy in the UK: June 2021 |work=UK Government |url=https://www.ons.gov.uk/economy/environmentalaccounts/articles/windenergyintheuk/june2021 |access-date=8 May 2023}}</ref>
In 2023 the UK had nine nuclear reactors generating about 15 per cent of the UK's electricity.<ref name="coal-ref">{{Cite web |title=Nuclear Power in the United Kingdom |url=https://world-nuclear.org/information-library/country-profiles/countries-t-z/united-kingdom.aspx |archive-url=https://web.archive.org/web/20230228175735/https://world-nuclear.org/information-library/country-profiles/countries-t-z/united-kingdom.aspx |archive-date=28 February 2023 |access-date=28 February 2023 |publisher=World Nuclear Association}}</ref> There are two reactors under construction and more planned.<ref>{{Cite web |date=April 2013 |title=Nuclear Power in the United Kingdom |url=http://www.world-nuclear.org/info/inf84.html |archive-url=https://web.archive.org/web/20130214061431/http://www.world-nuclear.org/info/inf84.html |archive-date=14 February 2013 |access-date=9 April 2013 |publisher=World Nuclear Association}}</ref><ref>{{Cite news |title=Nuclear energy: What you need to know |url=https://www.gov.uk/government/news/nuclear-energy-what-you-need-to-know |archive-url=https://web.archive.org/web/20230228181113/https://www.gov.uk/government/news/nuclear-energy-what-you-need-to-know |archive-date=28 February 2023 |access-date=28 February 2023 |publisher=UK Government}}</ref> In the late 1990s [[Nuclear power plants in the United Kingdom|nuclear power plants]] contributed around 25 per cent of the total annual electricity generation in the UK, but this has gradually declined as old plants have been shut down. The UK government is investing in [[small modular reactors]] that operate via [[nuclear fission]], as well as in research and development towards commercial [[fusion reactors]]. To that end the government entered into a partnership with the US in late 2023 to collaborate on fusion technology, with "a commercial grid-ready fusion reactor by 2040" stated as a goal.<ref>{{Cite news |title=UKAEA implementing the UK's fusion energy strategy |work=Open Access Government |date=7 March 2024 |url=https://www.openaccessgovernment.org/ukaea-implementing-the-uks-fusion-energy-strategy/174384/ |access-date=27 May 2024 |last1=Belderbos |first1=Harriet}};{{Cite magazine |title=UK nuclear fusion reactor sets new world record for energy output |url=https://www.newscientist.com/article/2415909-uk-nuclear-fusion-reactor-sets-new-world-record-for-energy-output/ |magazine=New Scientist |access-date=27 May 2024}}</ref>
At the end of 2023 it was estimated that there were 1.1 billion [[barrels of oil equivalent]] of "proven" and "probable" [[Oil and gas reserves and resource quantification|gas reserves]] and 2.3 billion boe of "proven" and "probable" [[North Sea oil|oil reserves]] offshore, reducing reliance on imports for energy security and transitioning to renewables.<ref>{{Cite report |title=UK Oil and Gas Reserves and Resources |url=https://www.nstauthority.co.uk/media/vtjkyqnf/uk-reserves-and-resources-report-as-at-end-2023.pdf |archive-url=https://web.archive.org/web/20250113172052/https://www.nstauthority.co.uk/media/vtjkyqnf/uk-reserves-and-resources-report-as-at-end-2023.pdf |archive-date=13 January 2025 |access-date=1 February 2025 |publisher=North Sea Transition Authority}}</ref> Emissions from UK gas production are roughly four times lower than imported [[liquefied natural gas]] (LNG), according to the [[North Sea Transition Authority|UK's oil and gas regulator]].<ref>{{Cite news |title=North Sea oil and gas claims fact-checked |work=BBC |date=22 January 2024 |url=https://www.bbc.co.uk/news/science-environment-67945281 |archive-url=https://web.archive.org/web/20250201182137/https://www.bbc.com/news/science-environment-67945281 |archive-date=1 February 2025 |access-date=1 February 2025}}</ref>
In September 2024 the last coal power station was closed, making [[coal]] no longer a power source in the UK.<ref name="2024 Energy" /> The UK currently has no [[fracking]] (hydraulic fracturing) for [[shale gas]] despite a large supply, due to environmental concerns.<ref>{{Cite news |title=UK's last fracking wells to be filled with cement despite dwindling gas stocks |date=29 January 2025 |url=https://www.cityam.com/uks-last-fracking-wells-to-be-filled-with-cement-despite-dwindling-gas-stocks/ |archive-url=https://web.archive.org/web/20250201182917/https://www.cityam.com/uks-last-fracking-wells-to-be-filled-with-cement-despite-dwindling-gas-stocks/ |archive-date=1 February 2025 |access-date=1 February 2025 |work=City AM}}</ref>
=== Water supply and sanitation ===
{{Main|Water supply and sanitation in the United Kingdom}}
Access to improved water supply and sanitation in the UK is universal. It was estimated that 96 per cent of households were connected to the sewer network in 2022.<ref>{{Cite web |url=https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/69582/pb6655-uk-sewage-treatment-020424.pdf |title=Sewage Treatment in the UK |publisher=DEFRA |website=assets.publishing.service.gov.uk |date=March 2022 |page=3 |id=PB 6655 |access-date=8 April 2023}}</ref> According to the [[Environment Agency]], total water abstraction for public water supply in the UK was 16,406 [[megalitre]]s per day in 2007.<ref>{{Cite web |title=Environment Agency |url=http://www.environment-agency.gov.uk/research/library/data/112185.aspx |archive-url=https://web.archive.org/web/20091125040346/http://www.environment-agency.gov.uk/research/library/data/112185.aspx |archive-date=25 November 2009}}</ref>
In England and Wales, water and sewerage services are provided by 10 private regional water and sewerage companies and 13 mostly smaller private "water only" companies. In Scotland, said services are provided by a single public company, [[Scottish Water]]. In Northern Ireland, they are also provided by a single public entity, [[Northern Ireland Water]].<ref>{{Cite web |title=About Us |url=https://www.niwater.com/about |access-date=29 August 2020 |publisher=niwater.com}}</ref>
== Demographics ==
{{Main|Demographics of the United Kingdom|British people}}
{{Further|Ceremonial counties of England|Subdivisions of Scotland|Subdivisions of Wales|Counties of Northern Ireland}}
[[File:Elderly British Couple.jpg|thumb|261x261px|An elderly British Couple. Approximately 24% of people in England and Wales are aged 60 years and over.<ref>{{Cite web |date=31 March 2023 |title=Age groups |url=https://www.ethnicity-facts-figures.service.gov.uk/uk-population-by-ethnicity/demographics/age-groups/latest/#main-facts-and-figures |access-date=16 August 2026 |website=www.ethnicity-facts-figures.service.gov.uk |language=en}}</ref>]]
Whereas the censuses of England and Wales and of Northern Ireland went ahead as planned in 2021, the census in Scotland was delayed until 2022 due to the COVID-19 pandemic. The Office for National Statistics has estimated that the total population of the United Kingdom recorded in the census would have been 66,912,637 had it been conducted in all parts of the UK on 21 March 2021.<ref name=Ethnicity2021/> The UK population is the [[List of European countries by population|fourth-largest]] in Europe and the [[List of countries by population|22nd-largest]] in the world. In 2012 and 2013 births contributed the most to population growth, while in 2014 and 2015 net international migration contributed more.<ref name="pop2015">{{Cite web |date=23 June 2016 |title=Population Estimates for UK, England and Wales, Scotland and Northern Ireland, Mid-2015 |url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/bulletins/annualmidyearpopulationestimates/latest |publisher=Office for National Statistics}}</ref> Between 2001 and 2011 the population increased at an average annual rate of 0.7 per cent.<ref name="2011census">{{Cite web |date=21 December 2022 |title=Population estimates for the UK, England, Wales, Scotland and Northern Ireland: mid-2021 |url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/bulletins/annualmidyearpopulationestimates/mid2021 |access-date=16 April 2025 |publisher=Office for National Statistics}}</ref> The [[2011 United Kingdom census|2011 census]] also showed that, over the previous 100 years, the proportion of the population aged 0–14 fell from 31 to 18 per cent, and the proportion of people aged 65 and over rose from 5 to 16 per cent.<ref name="2011census" /> In 2018 the [[median age]] of the UK population was 41.7 years.<ref name="factbook" /> The 2021 census put Scotland's population at 5.48 million, Wales's at 3.1 million and Northern Ireland's at 1.9 million.<ref name="2011census" />
<!-- Self-maintaining population table -->
{{UK population table}}
England's population in 2021 was 56 million, representing some 84 per cent of the UK total.<ref name="2011census" /> England is one of the [[List of countries and dependencies by population density|most-densely-populated countries]] in the world, with 434 people per square kilometre in mid-2021,<ref name="2011census" /> with a particular concentration in London, the capital,<ref>{{Cite news |date=10 May 2012 |title=United Kingdom country profile |url=https://www.bbc.co.uk/news/world-europe-18023389 |access-date=24 July 2026 |work=BBC News |language=en-GB}}</ref><ref>{{Cite web |title=United Kingdom - Country Profile {{!}} OpenFactBook World Factbook |url=https://openfactbook.org/countries/united-kingdom/ |access-date=24 July 2026 |website=openfactbook.org |language=en}}</ref> and the south-east.<ref>{{Cite news |last=Khan |first=Urmee |date=16 September 2008 |title=England is most crowded country in Europe |url=https://www.telegraph.co.uk/news/newstopics/politics/2967374/England-is-most-crowded-country-in-Europe.html |archive-url=https://web.archive.org/web/20080918221002/http://www.telegraph.co.uk/news/newstopics/politics/2967374/England-is-most-crowded-country-in-Europe.html |archive-date=18 September 2008 |access-date=5 September 2009 |work=The Telegraph |location=London}}</ref> [[London metropolitan area|London's wider metropolitan area]] is the largest in [[Western Europe]], with a population of 14.9 million in 2024.<ref>{{Cite web |title=Major Agglomerations |url=http://citypopulation.de/en/world/agglomerations |url-status=live |archive-url=https://web.archive.org/web/20231004094531/https://www.citypopulation.de/en/world/agglomerations/ |archive-date=4 October 2023 |access-date=16 October 2023}}</ref>
{| class="wikitable sortable" style="text-align:right;"
|+ Population of England by region ({{UK subdivision statistics year}})<ref name="ONS mid-year pop est" />
|-
! Rowspan=2 | Region
! Colspan=2 | Land area
! Colspan=2 | Population
! Rowspan=2 | Density<br />(/km<sup>2</sup>)
|-
! (km<sup>2</sup>)
! (%)
! People
! (%)
|-
| style="text-align:left;" | [[North East England|North East]]
| 8,581
| 6%
| 2,683,040
| 5%
| 313
|-
| style="text-align:left;" | [[North West England|North West]]
| 14,108
| 11%
| 7,516,113
| 13%
| 533
|-
| style="text-align:left;" | [[Yorkshire and the Humber]]
| 15,404
| 12%
| 5,541,262
| 10%
| 360
|-
| style="text-align:left;" | [[East Midlands]]
| 15,624
| 12%
| 4,934,939
| 9%
| 316
|-
| style="text-align:left;" | [[West Midlands (region)|West Midlands]]
| 12,998
| 10%
| 6,021,653
| 11%
| 463
|-
| style="text-align:left;" | [[East of England]]
| 19,116
| 15%
| 6,398,497
| 11%
| 335
|-
| style="text-align:left;" | [[Greater London]]
| 1,572
| 1%
| 8,866,180
| 15%
| 5,640
|-
| style="text-align:left;" | [[South East England|South East]]
| 19,072
| 15%
| 9,379,833
| 16%
| 492
|-
| style="text-align:left;" | [[South West England|South West]]
| 23,836
| 18%
| 5,764,881
| 10%
| 242
|-
! style="text-align:left;" | England
! style="text-align:right;" | 130,310
! style="text-align:right;" | 100%
! style="text-align:right;" | 57,106,398
! style="text-align:right;" | 100%
! style="text-align:right;" | 438
|}
In 2021 the [[total fertility rate]] across the UK was 1.53 children born per woman,<ref>{{Cite web |title=Vital statistics: population and health reference tables |url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/vitalstatisticspopulationandhealthreferencetables |access-date=6 March 2018 |website=Office for National Statistics}}</ref> which remains considerably below the [[Mid-20th century baby boom|baby boom]] peak of 2.95 children per woman in 1964,<ref>{{Cite news |last=Boseley |first=Sarah |date=14 July 2008 |title=The question: What's behind the baby boom? |url=https://www.theguardian.com/lifeandstyle/2008/jul/14/familyandrelationships.women |access-date=28 August 2009 |work=The Guardian |location=London |page=3}}</ref> or the high of 6.02 children born per woman in 1815<ref>{{Citation |last=Roser |first=Max |title=Total Fertility Rate around the world over the last centuries |date=2014 |work=[[Our World in Data]], [[Gapminder Foundation]] |url=https://ourworldindata.org/grapher/children-born-per-woman?year=1800&country=GBR |access-date=10 December 2019 |archive-url=https://web.archive.org/web/20190705121623/https://ourworldindata.org/grapher/children-born-per-woman?year=1800&country=GBR |archive-date=5 July 2019}}</ref> and below the replacement rate of 2.1. In 2011, 47.3 per cent of births in the UK were to unmarried women.<ref>[http://epp.eurostat.ec.europa.eu/tgm/table.do?tab=table&plugin=0&language=en&pcode=tps00018 Tables, Graphs and Maps Interface (TGM) table]. Eurostat (26 February 2013). Retrieved 12 July 2013.</ref> The [[Office for National Statistics]] reported in 2015 that amongst the UK population aged 16 and over, 1.7 per cent identify as gay, lesbian, or bisexual (2.0 per cent of males and 1.5 per cent of females); 4.5 per cent of respondents responded with "other", "I don't know", or did not respond.<ref>{{Cite web |date=5 October 2016 |title=Sexual identity, UK: 2015 – Experimental Official Statistics on sexual identity in the UK in 2015 by region, sex, age, marital status, ethnicity and NS-SEC |url=https://www.ons.gov.uk/peoplepopulationandcommunity/culturalidentity/sexuality/bulletins/sexualidentityuk/2015 |access-date=19 January 2017 |publisher=[[Office for National Statistics]]}}</ref> The number of [[transgender]] people in the UK was estimated to be between 65,000 and 300,000 by research between 2001 and 2008.<ref>{{Cite web |title=Research report 27: Trans research review |url=http://www.equalityhumanrights.com/about-us/our-work/key-projects/trans-inequalities-reviewed/introduction-to-the-review |url-status=dead |archive-url=https://web.archive.org/web/20150706020643/http://www.equalityhumanrights.com/about-us/our-work/key-projects/trans-inequalities-reviewed/introduction-to-the-review |archive-date=6 July 2015 |access-date=26 November 2021 |website=equalityhumanrights.com |page=v}}</ref>
{{Largest Urban Areas of the United Kingdom}}
=== Ethnicity ===
{{Main|Ethnic groups in the United Kingdom}}
Historically, indigenous British people were thought to be [[Genetic history of the British Isles|descended from ethnic groups]] that settled there before the 12th century: the [[Celts]], Romans, Anglo-Saxons, Norse and the [[Normans]]. [[Welsh people]] could be the oldest ethnic group in the UK.<ref>{{Cite news |date=19 June 2012 |title=Welsh people could be most ancient in UK, DNA suggests |url=https://www.bbc.co.uk/news/uk-wales-18489735 |access-date=28 April 2013 |work=BBC News}}</ref> The UK has a history of non-white immigration with [[Liverpool]] having the oldest black population in the country dating from at least the 1730s,<ref>{{Cite book |last=Winder |first=Robert |url=https://books.google.com/books?id=7ORcaQIgdcEC&q=combed&pg=PT94 |title=Bloody Foreigners: The Story of Immigration to Britain |date=2010 |publisher=Little, Brown Book |isbn=978-0-7481-2396-4}}; {{Cite book |last=Costello |first=Ray |title=Black Liverpool: The Early History of Britain's Oldest Black Community 1730–1918 |date=2001 |publisher=Picton Press |isbn=978-1-873245-07-1 |location=Liverpool}}</ref> in addition to having the oldest [[British Chinese|Chinese]] community in Europe dating from the 19th century.<ref>{{Cite web |title=Culture and Ethnicity Differences in Liverpool – Chinese Community |url=http://www.mersey-gateway.org/server.php?show=ConWebDoc.1369 |archive-url=https://web.archive.org/web/20090724204513/http://www.mersey-gateway.org/server.php?show=ConWebDoc.1369 |archive-date=24 July 2009 |access-date=9 March 2015 |publisher=Chambré Hardman Trust}}</ref>
In 2021, 83.1 per cent of the UK population was classified as white, 8.6 per cent as Asian or Asian British, 3.7 per cent as Black or Black British, 2.7 per cent as mixed ethnicity, and 2.0 per cent other.<ref name=Ethnicity2021/> Ethnic diversity varies significantly across the UK. In 2021, 46.2 per cent of London's population was from a non-white ethnic minority,<ref name=Regionaldiversity>{{cite news|url=https://www.ethnicity-facts-figures.service.gov.uk/uk-population-by-ethnicity/national-and-regional-populations/regional-ethnic-diversity/latest/|title=Regional ethnic diversity|publisher=Office for National Statistics|date=22 December 2022|access-date=28 March 2026}}</ref> compared less than 10 per cent in the South West and North East of England, Wales,<ref name=Regionaldiversity/> Scotland<ref>{{cite news|url=https://www.scotlandscensus.gov.uk/census-results/at-a-glance/ethnicity/|title=Ethnicity|publisher=National Records of Scotland|date=4 February 2025|access-date=28 March 2026}}</ref> and Northern Ireland.<ref>{{cite web|url=https://www.nisra.gov.uk/system/files/statistics/census-2021-ms-b01.xlsx|title=MS-B01: Ethnic group|publisher=Northern Ireland Statistics and Research Agency|date=30 November 2023|access-date=28 March 2026}}</ref>
=== Language ===
{{Main|Languages of the United Kingdom}}
The [[English language]] is the ''[[de facto]]'' official and most widely spoken language in the United Kingdom.<ref>{{Cite web |title=English language – Government, citizens and rights |url=http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_10012519 |archive-url=http://webarchive.nationalarchives.gov.uk/20121015000000/http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_10012519 |archive-date=15 October 2012 |access-date=23 August 2011 |website=[[Directgov]]}}</ref><ref>{{Cite journal |last=Mac Sithigh |first=Daithí |date=17 May 2018 |title=Official status of languages in the UK and Ireland |url=https://pureadmin.qub.ac.uk/ws/portalfiles/portal/141540053/Status_OA_Feb_2018.pdf |journal=Common Law World Review |publisher=Queen's University, Belfast |volume=47 |issue=1 |pages=77–102 |doi=10.1177/1473779518773642 |s2cid=219987922}}</ref> The UK promotes the language globally to build connections, understanding and trust between people in the UK and countries worldwide.<ref>British Council {{Cite web |title=British Council | the UK's international culture and education organisation |url=https://www.britishcouncil.org/ |url-status=live |archive-url=https://web.archive.org/web/20230201181104/https://www.britishcouncil.org/ |archive-date=1 February 2023 |access-date=5 December 2018}} (last checked 6 February 2023)</ref><ref>{{Cite web |title=About BBC Learning English |url=https://www.bbc.com/learningenglish/english/hygiene |url-status=live |archive-url=https://web.archive.org/web/20230204204233/https://www.bbc.com/learningenglish/english/hygiene |archive-date=4 February 2023 |access-date=9 February 2023 |website=BBC}}</ref>
In the UK, the English language is spoken with distinctive characteristics that collectively form what is known as [[British English]]. The variety of dialects and accents is often noted, with nearby regions frequently having highly distinct variations. [[Received Pronunciation]] is traditionally associated with educated speakers in southern England.<ref>{{Cite web |title=British English Pronunciations |url=https://www.oed.com/information/understanding-entries/pronunciation/british-english-pronunciations/?tl=true |archive-url=https://web.archive.org/web/20250605075115/https://www.oed.com/information/understanding-entries/pronunciation/british-english-pronunciations/?tl=true |archive-date=5 June 2025 |access-date=5 June 2025 |website=OED}}</ref> The main national dialects are [[Scottish English]], [[Welsh English]] and [[Northern Irish English]]. Distinctive regional varieties include
[[Brummie dialect|Brummie]], [[Cockney]], [[Geordie]], [[Manchester dialect|Mancunian]], [[Scouse]], [[West Country English|West Country]], [[Yorkshire dialect|Yorkshire]] and [[Multicultural London English|MLE]] (Multicultural London English).<ref>{{Cite web |title=10 British dialects you need to know |url=https://www.ef.com/wwen/blog/language/british-dialects-you-need-to-know/ |website=EF |access-date=5 June 2025}}</ref>
[[File:Bilingual welcome sign Newry.jpg|thumb|[[Bilingual sign]] ([[Irish language|Irish]] and [[English language|English]]) in [[Newry]], Northern Ireland]]Three indigenous [[Celtic languages]] are spoken in the UK: [[Welsh language|Welsh]], [[Irish language|Irish]] and [[Scottish Gaelic]]. [[Cornish language|Cornish]], which became extinct as a first language in the late-18th century, is being revived and has a small group of second-language speakers.<ref>{{Cite book |last1=Track |first1=Robert Lawrence |url=https://books.google.com/books?id=oLx9AgAAQBAJ&q=%E2%80%9Cthese+people+speak+the+dead+language+as+a+second+language%E2%80%9D&pg=PA63 |title=Language and Linguistics: The Key Concepts |last2=Stockwell, Peter |date=2007 |isbn=978-0-415-41358-9 |page=63 |publisher=Routledge |access-date=4 August 2019}}; {{Cite web |title=Framework Convention for the Protection of National Minorities, Strasbourg, 1.II.1995 |url=http://conventions.coe.int/Treaty/en/Treaties/Html/157.htm |access-date=9 March 2015 |publisher=Council of Europe |archive-date=22 February 2005 |archive-url=https://web.archive.org/web/20050222193410/http://conventions.coe.int/Treaty/EN/treaties/Html/157.htm |url-status=dead}}; {{Cite web |title=European Charter for Regional or Minority Languages, Strasbourg, 5.XI.1992 |url=http://conventions.coe.int/treaty/en/Treaties/Html/148.htm |access-date=9 March 2015 |publisher=Council of Europe |archive-date=26 February 2011 |archive-url=https://web.archive.org/web/20110226052008/http://conventions.coe.int/Treaty/EN/Treaties/HTML/148.htm |url-status=dead}}</ref><ref name="reglang" /> In the [[2021 United Kingdom census|2021 census]] the [[Welsh-speaking population]] of Wales aged three or older was 538,300 (17.8 per cent).<ref>{{Cite web |date=6 December 2022 |title=Welsh language in Wales (Census 2021) |url=https://gov.wales/welsh-language-wales-census-2021-html |access-date=6 December 2022 |website=gov.wales}}</ref> In addition it is estimated that about 200,000 Welsh-speakers live in England.<ref>{{Cite web |last=Wynn Thomas |first=Peter |date=March 2007 |title=Welsh today |url=https://www.bbc.co.uk/voices/multilingual/welsh.shtml |access-date=5 July 2011 |website=Voices |publisher=BBC}}</ref> In the 2021 census in Northern Ireland 12.4 per cent of people had some [[Irish language in Northern Ireland|Irish language]] ability and 10.4 per cent had some facility in the [[Ulster Scots dialect|Ulster-Scots]] language.<ref>{{Cite web |title=Census 2021: Main statistics for Northern Ireland |url=https://www.nisra.gov.uk/system/files/statistics/census-2021-main-statistics-for-northern-ireland-phase-1-statistical-bulletin-language.pdf |archive-url=https://web.archive.org/web/20240210110853/https://www.nisra.gov.uk/system/files/statistics/census-2021-main-statistics-for-northern-ireland-phase-1-statistical-bulletin-language.pdf |archive-date=10 February 2024 |access-date=10 February 2024}}</ref>
In 2001, over 92,000 people in Scotland, just under 2 per cent of the population, had some Gaelic language ability, including 72 per cent of those living in the [[Outer Hebrides]].<ref>{{Cite web |title=Scotland's Census 2001 – Gaelic Report |url=http://www.gro-scotland.gov.uk/press/news2005/scotlands-census-2001-gaelic-report.html |archive-url=https://web.archive.org/web/20130522110328/http://www.gro-scotland.gov.uk/press/news2005/scotlands-census-2001-gaelic-report.html |archive-date=22 May 2013 |access-date=28 April 2013 |publisher=General Register Office for Scotland}}</ref> The number of children being taught either Welsh or Scottish Gaelic is increasing.<ref>{{Cite news |date=12 February 2009 |title=Local UK languages 'taking off' |url=http://news.bbc.co.uk/1/hi/education/7885493.stm |work=BBC News}}</ref> [[Scots language|Scots]], a language descended from early northern [[Middle English]], has limited [[European Charter for Regional or Minority Languages|recognition]] alongside its regional variant, [[Ulster Scots dialects|Ulster Scots]] in Northern Ireland, without specific commitments to protection and promotion.<ref name="reglang" /><ref>{{Cite web |title=Language Data – Scots |url=http://www.eurolang.net/index.php?option=com_content&task=view&id=2449&Itemid=52&lang=en |archive-url=https://web.archive.org/web/20070623185445/http://eurolang.net/index.php?option=com_content&task=view&id=2449&Itemid=52&lang=en |archive-date=23 June 2007 |access-date=2 November 2008 |publisher=European Bureau for Lesser-Used Languages}}</ref> As of April 2020 there are around 151,000 users of [[British Sign Language]] (BSL), a [[sign language]] used by deaf people, in the UK.<ref>{{Cite news |last=Brown |first=Hannah |date=23 April 2020 |title='People are dying because of this': Calls for UK Gov to follow Scotland with sign language interpreter at Covid-19 briefing |url=https://www.scotsman.com/news/politics/people-are-dying-because-calls-uk-gov-follow-scotland-sign-language-interpreter-covid-19-briefing-2547989 |access-date=19 December 2021 |work=The Scotsman}}</ref>
In 2013, it was estimated that 95 per cent of the UK's population were [[monolingual]] English speakers.<ref name="BBC languages">{{Cite web |title=Languages across Europe: United Kingdom |url=https://www.bbc.co.uk/languages/european_languages/countries/uk.shtml |access-date=4 February 2013 |website=BBC}}</ref> In 2013, over 5 per cent of the population were estimated to speak languages brought to the UK as a result of immigration.<ref name="BBC languages" /> [[South Asian languages]] are the largest group, which includes [[Punjabi language|Punjabi]], [[Urdu]], [[Bengali language|Bengali]], [[Sylheti language|Sylheti]], [[Hindi]], [[Pahari-Pothwari]], [[Tamil language|Tamil]] and [[Gujarati language|Gujarati]].<ref>Carl Skutsch (2013). ''Encyclopedia of the World's Minorities''. pp.1261. Routledge. Retrieved 3 December 2020.</ref> In the 2011 census [[Polish language|Polish]] was the second-largest language spoken in England, with 546,000 speakers.<ref>{{Cite news |last=Booth |first=Robert |date=30 January 2013 |title=Polish becomes England's second language |url=https://www.theguardian.com/uk/2013/jan/30/polish-becomes-englands-second-language |access-date=4 February 2012 |work=The Guardian |location=London}}</ref> In 2019 some three-quarters of a million people spoke little or no English.<ref>{{Cite news |date=23 April 2019 |title=The teenagers who translate for their parents |url=https://www.bbc.co.uk/news/av/uk-47982494 |access-date=23 April 2019 |work=BBC News}}</ref>
=== Religion ===
{{Main|Religion in the United Kingdom|Freedom of religion in the United Kingdom}}
[[File:Westminster_Abbey_St_Peter.jpg|thumb|The [[Westminster Abbey]] in [[London]]. This was the [[Coronation of the British monarch|coronation]] site of 40 monarchs, 18 royal burials, and at least 16 royal weddings since 1100.]]
[[Christianity]] has dominated religious life in the United Kingdom for [[History of Christianity in Britain|more than 1,400 years]].<ref>Cannon, John, ed. (2nd edn., 2009). [https://books.google.com/books?id=TYnfhTq2M7EC&pg=PA144 ''A Dictionary of British History'']. Oxford University Press. p. 144. {{ISBN|978-0-19-955037-1}}.</ref> Although a majority of citizens still identify with Christianity in surveys, regular church attendance has fallen dramatically since the middle of the 20th century,<ref>Field, Clive D. (November 2009). [http://www.brin.ac.uk/wp-content/uploads/2011/12/development-of-religious-statistics.pdf "British religion in numbers"]. BRIN Discussion Series on Religious Statistics, Discussion Paper 001. Retrieved 7 March 2015.</ref> while immigration and demographic change have contributed to the growth of Islam and other faiths.<ref>Yilmaz, Ihsan (2005). [https://books.google.com/books?id=ryrD2YODzxUC&pg=PA291 ''Muslim Laws, Politics and Society in Modern Nation States: Dynamic Legal Pluralisms in England, Turkey, and Pakistan'']. Aldershot: Ashgate Publishing. pp. 55–56. {{ISBN|978-0-7546-4389-0}}.</ref> This has led some commentators to describe the UK as a multi-faith,<ref>Brown, Callum G. (2006). [https://books.google.com/books?id=ryrD2YODzxUC&pg=PA291 ''Religion and Society in Twentieth-Century Britain'']. Harlow: Pearson Education. p. 291. {{ISBN|978-0-582-47289-1}}.</ref> [[secularised]],<ref>Norris, Pippa; Inglehart, Ronald (2004). [https://books.google.com/books?id=dto-P2YfWJIC&pg=PA84 ''Sacred and Secular: Religion and Politics Worldwide'']. Cambridge University Press. p. 84. {{ISBN|978-0-521-83984-6}}.</ref> or [[post-Christian]] society.<ref>Fergusson, David (2004). [https://books.google.com/books?id=Owz4aBSEINgC&pg=PA94 ''Church, State and Civil Society'']. Cambridge University Press. p. 94. {{ISBN|978-0-521-52959-4}}.</ref>
In the 2021 census of England and Wales, 46.2 per cent of respondents reported that they were Christians, with the next largest faiths being [[Islam in the United Kingdom|Islam]] (6.5 per cent), [[Hinduism in the United Kingdom|Hinduism]] (1.7 per cent), [[Sikhism in the United Kingdom|Sikhism]] (0.9 per cent), [[Buddhism in the United Kingdom|Buddhism]] (0.5 per cent), [[Judaism in the United Kingdom|Judaism]] (0.5 per cent), and all other religions (0.6 per cent). Of the respondents, 37.2 per cent stated that they had [[Irreligion in the United Kingdom|no religion]] and a further 6.0 per cent did not answer the optional question.<ref>{{cite news|url=https://www.ons.gov.uk/peoplepopulationandcommunity/culturalidentity/religion/bulletins/religionenglandandwales/census2021|title=Religion, England and Wales: Census 2021|publisher=Office for National Statistics|first=Michael|last=Roskams|date=29 November 2022|access-date=28 March 2026}}</ref> In the census of Northern Ireland, 42.3 per cent of the population was recorded as Catholic, 37.7% as Protestant or other Christian, 1.3 per cent as belonging to other religions, 17.4 per cent as having no religion and 1.6 per cent did not state a religion.<ref>{{cite web|url=https://www.nisra.gov.uk/system/files/statistics/census-2021-ms-b19.xlsx|title=MS-B19: Religion|publisher=Northern Ireland Statistics and Research Agency|date=30 November 2023}}</ref> In Scotland's 2022 census, 51.1 per cent of the population stated that they had no religion, 20.4 per cent were recorded as Church of Scotland, 13.3 per cent as Catholic, 5.1 per cent as other Christian, 2.2 per cent as Muslim and 0.6 per cent as Hindu, with 1.2 per cent belonging to other religions and 6.2 per cent not stating a religion.<ref>{{cite web|url=https://www.scotlandscensus.gov.uk/2022-reports/scotland-s-census-2022-ethnic-group-national-identity-language-and-religion/|title=Scotland's Census 2022 - Ethnic group, national identity, language and religion|publisher=National Records of Scotland|date=21 May 2024|access-date=28 March 2026}}</ref>
A [[Tearfund]] survey in 2007 showed that one Briton in ten attends church weekly.<ref>{{Cite web |date=4 April 2007 |title=United Kingdom: New Report Finds Only One in 10 Attend Church |url=http://news.adventist.org/2007/04/uite-kigom-ew-report-fis-oly-oe-i-10-atte-church.html |archive-url=https://web.archive.org/web/20111213155625/http://news.adventist.org/2007/04/uite-kigom-ew-report-fis-oly-oe-i-10-atte-church.html |archive-date=13 December 2011 |access-date=9 March 2015 |website=News.adventist.org}}</ref> Between the 2001 and 2011 censuses there was a 12 per cent decrease in those who identified as Christian, while the percentage reporting no religious affiliation doubled. This contrasted with growth in the other main religious group categories, with the number of [[Muslims]] increasing the most to about 5 per cent.<ref>{{Cite news |last=Philby |first=Charlotte |date=12 December 2012 |title=Less religious and more ethnically diverse: Census reveals a picture of Britain today |url=https://www.independent.co.uk/news/uk/home-news/less-religious-and-more-ethnically-diverse-census-reveals-a-picture-of-britain-today-8406506.html |work=[[The Independent|Independent]] |location=London}}</ref>
The [[Church of England]] is the [[State religion|established church]] in England.<ref>{{Cite web |date=2004 |title=The History of the Church of England |url=http://www.cofe.anglican.org/about/history/ |url-status=dead |archive-url=https://web.archive.org/web/20100221212004/http://www.cofe.anglican.org/about/history |archive-date=21 February 2010 |access-date=23 November 2008 |website=The Church of England}}</ref> It retains [[Lords Spiritual|representation]] in the UK Parliament, and the British monarch is its [[Supreme Governor of the Church of England|Supreme Governor]].<ref>{{Cite web |title=Queen and Church of England |url=http://www.royalinsight.gov.uk/output/Page4708.asp |archive-url=https://web.archive.org/web/20061008203611/http://www.royalinsight.gov.uk/output/Page4708.asp |archive-date=8 October 2006 |access-date=5 June 2010 |publisher=British Monarchy Media Centre}}</ref> In [[religion in Scotland|Scotland]] the [[Church of Scotland]] is the [[national church]]. It is not subject to state control, and the British monarch is an ordinary member, required to swear an oath to "maintain and preserve the Protestant Religion and [[Presbyterian polity|Presbyterian Church Government]]" upon his or her accession.<ref>{{Cite web |title=Queen and the Church |url=http://www.royal.gov.uk/MonarchUK/QueenandChurch/History.aspx |url-status=live |archive-url=https://web.archive.org/web/20110605025533/http://www.royal.gov.uk/MonarchUK/QueenandChurch/History.aspx |archive-date=5 June 2011 |publisher=The British Monarchy (Official Website)}}</ref><ref name="reglang" /><ref>{{Cite web |date=22 February 2010 |title=Our structure |url=https://www.churchofscotland.org.uk/about-us/our-structure |url-status=live |archive-url=https://web.archive.org/web/20200125192732/https://www.churchofscotland.org.uk/about-us/our-structure |archive-date=25 January 2020 |website=churchofscotland.org.uk}}</ref> The [[Church in Wales]] was disestablished in 1920 and, because the [[Church of Ireland]] was disestablished in 1870 before the [[partition of Ireland]], there is no established church in Northern Ireland.<ref>Weller, Paul (2005). [https://books.google.com/books?id=tHc88PzAPLMC&pg=PA80 ''Time for a Change: Reconfiguring Religion, State, and Society'']. London: Continuum. pp. 79–80. {{ISBN|978-0-567-08487-3}}.</ref> Although there are no UK-wide data in the 2001 census on adherence to individual Christian denominations, it has been estimated that 62 per cent of Christians are Anglican, 13.5 per cent Catholic, 6 per cent Presbyterian, and 3.4 per cent Methodist, with smaller numbers of other denominations.<ref>Peach, Ceri, [https://books.google.com/books?id=i6ER_z8gcD4C "United Kingdom, a major transformation of the religious landscape"], in H. Knippenberg. ed. (2005). ''The Changing Religious Landscape of Europe''. Amsterdam: Het Spinhuis. pp. 44–58. {{ISBN|978-90-5589-248-8}}.</ref>
=== Migration ===
{{Main|Historical immigration to Great Britain|Modern immigration to the United Kingdom}}
{{See also|Foreign-born population of the United Kingdom}}
[[File:United Kingdom foreign born population by country of birth.png|thumb|upright=1.35|Estimated foreign-born population by country of birth from April 2007 to March 2008]]
[[File:British expats countrymap.svg|thumb|upright=1.35|Estimated number of British citizens living overseas by country in 2006:
{{legend|#002255|Greater than or equal to 1,000,000}}
{{legend|#003380|500,000 - 999,999}}
{{legend|#0044aa|100,000 - 499,999}}
{{legend|#0055d4|50,000 - 99,999}}
{{legend|#0066ff|10,000 - 49,999}}
{{legend|#2a7fff|5,000 - 9,999}}
{{legend|#5599ff|1,000 - 4,999}}
{{legend|#80b3ff|100 - 999}}
{{legend|#afc6e9|Less than 100 or no data}}
{{legend|#000000|UK}}
]]
Immigration is contributing to a rising population in the United Kingdom,<ref>{{Cite news |date=21 August 2008 |title=Immigration and births to non-British mothers pushes British population to record high |url=https://www.standard.co.uk/news/immigration-and-births-to-nonbritish-mothers-pushes-british-population-to-record-high-6816318.html |work=London Evening Standard}}</ref><ref name="bbc-23-05-2024">{{cite news |title=Migration: How many people come to the UK and how are the salary rules changing? |url=https://www.bbc.com/news/uk-48785695 |work=BBC News |date=23 May 2024}}</ref> with arrivals and UK-born children of migrants accounting for about half of the population increase between 1991 and 2001. According to statistics released in 2015, 27 per cent of UK live births in 2014 were to mothers born outside the UK.<ref>{{Cite web |date=15 July 2015 |title=Births in England and Wales: 2014 |url=http://www.ons.gov.uk/ons/rel/vsob1/birth-summary-tables--england-and-wales/2014/index.html |website=Office for National Statistics }}{{Dead link|date=May 2026 |bot=InternetArchiveBot }}</ref>
In 2013 approximately 208,000 foreign nationals were naturalised as British citizens, the highest number since 1962. This figure fell to around 125,800 in 2014. Between 2009 and 2013 the average number of British citizenships granted annually was 195,800. The most common origins of those naturalised in 2024 were Pakistani, Indian, [[Nigeria]]n, [[Philippines|Filipino]], [[Bangladesh]]i, Italian, Turkish, Romanian and Iranian. The number of grants of settlement, which confer [[Permanent residency|permanent residence]] in the UK but not [[British citizenship|citizenship]],<ref>{{Cite web |last=Blinder |first=Scott |date=11 June 2014 |title=Settlement in the UK |url=http://www.migrationobservatory.ox.ac.uk/briefings/settlement-uk |archive-url=https://web.archive.org/web/20150906232123/http://migrationobservatory.ox.ac.uk/briefings/settlement-uk |archive-date=6 September 2015 |access-date=1 August 2015 |publisher=The Migration Observatory, University of Oxford}}</ref> was approximately 154,700 in 2013, higher than the previous two years.<ref name="Blinder2015">{{Cite web |last=Blinder |first=Scott |date=27 March 2015 |title=Naturalisation as a British Citizen: Concepts and Trends |url=http://www.migrationobservatory.ox.ac.uk/sites/files/migobs/Briefing%20-%20Naturalisation%20as%20a%20British%20Citizen%20-%20Concepts%20and%20Trends_0.pdf |archive-url=https://web.archive.org/web/20150916052200/http://www.migrationobservatory.ox.ac.uk/sites/files/migobs/Briefing%20-%20Naturalisation%20as%20a%20British%20Citizen%20-%20Concepts%20and%20Trends_0.pdf |archive-date=16 September 2015 |access-date=1 August 2015 |publisher=The Migration Observatory, University of Oxford}}</ref> Long-term net migration (the number of people immigrating minus the number emigrating) reached a record of 860,000 in 2023, with immigration at 1.326 million and emigration at 466,000. In comparison, in 2024 net migration was estimated to be 431,000 with immigration at 948,000 and emigration at 517,000.<ref>{{Cite web |title=Long-term international migration, provisional: year ending December 2024 |date=22 May 2025 |url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/internationalmigration/bulletins/longterminternationalmigrationprovisional/yearendingdecember2024 |website=gov.uk |access-date=22 May 2025}}</ref>
[[British diaspora|Emigration]] was an important feature of British society in the 19th century. Between 1815 and 1930, around 11.4 million people emigrated from Britain and 7.3 million from Ireland.<ref>{{Cite book |last=Hammar |first=Tomas |url=https://www.cambridge.org/core/books/european-immigration-policy/10B639425685B0C101619FA11522C409 |title=European Immigration Policy: A Comparative Study |date=1985 |publisher=Cambridge University Press |isbn=978-0-521-12437-9 |series=Comparative Ethnic and Race Relations |location=Cambridge}}</ref><ref name="richards-2018">{{Cite book |last=Richards |first=Eric |url=https://www.jstor.org/stable/j.ctvnb7rj2 |title=The genesis of international mass migration: The British case, 1750-1900 |date=2018 |publisher=Manchester University Press |edition=1 |jstor=j.ctvnb7rj2}}</ref> Estimates show that by the end of the 20th century, some 300 million people of British and Irish descent were permanently settled around the globe.<ref name="richards-2018" /> In 2006 at least 5.5 million UK-born people lived abroad,<ref name="BritsAbroad">{{Cite web |last1=Sriskandarajah |first1=Dhananjayan |last2=Drew |first2=Catherine |date=11 December 2006 |title=Brits Abroad: Mapping the scale and nature of British emigration |url=http://www.ippr.org/publicationsandreports/publication.asp?id=509 |archive-url=https://web.archive.org/web/20070828011816/http://www.ippr.org/publicationsandreports/publication.asp?id=509 |archive-date=28 August 2007 |access-date=9 March 2015 |publisher=Institute for Public Policy Research}}</ref><ref>{{Cite news |title=Brits Abroad: world overview |url=http://news.bbc.co.uk/1/shared/spl/hi/in_depth/brits_abroad/html/default.stm |access-date=20 April 2007 |publisher=BBC}}; {{Cite news |last=Casciani |first=Dominic |date=11 December 2006 |title=5.5 m Britons 'opt to live abroad' |work=BBC News |url=http://news.bbc.co.uk/2/hi/uk_news/6210358.stm |access-date=20 April 2007}}</ref> mainly in Australia, Spain, the United States and Canada.<ref name="BritsAbroad" /><ref>{{Cite news |date=11 December 2006 |title=Brits Abroad: Country-by-country |url=http://news.bbc.co.uk/2/hi/uk_news/6161705.stm |work=BBC News}}</ref>
=== Education ===
{{Main|Education in the United Kingdom|Universities in the United Kingdom}}
{{Further|Education in England|Education in Scotland|Education in Wales|Education in Northern Ireland}}
Education in the United Kingdom is a [[Devolution|devolved]] matter, with each country having a separate education system. About 38 per cent of the United Kingdom population has a university or [[college degree]], the highest percentage in Europe and one of the highest in the world.<ref>{{Cite web |date=24 September 2012 |title=The Most Educated Countries in the World |url=https://finance.yahoo.com/news/the-most-educated-countries-in-the-world.html;_ylt=AlaWy8IcyeBaviKi7_.WJyhE6odG;_ylu=X3oDMTJrY2d2NGZyBG1pdANDeFMgRmluYW5jaWFsbHkgRml0IEFydGljbGUgQXJ0aWNsZSBCb2R5IFByb2QEcG9zAzMEc2VjA01lZGlhQXJ0aWNsZUJvZHlBc3NlbWJseQ--;_ylg=X3oDMTNjdGVoaXJqBGludGwDdXMEbGFuZwNlbi11cwRwc3RhaWQDY2IyOTRhMGEtYmY2OS0zYTdlLThlYTUtZWFlNTU3YWI1ZTc3BHBzdGNhdANleGNsdXNpdmVzfGZpbmFuY2lhbGx5Zml0BHB0A3N0b3J5cGFnZQ--;_ylv=3?page=1 |archive-url=https://web.archive.org/web/20160204213400/http://finance.yahoo.com/news/the-most-educated-countries-in-the-world.html%3B_ylt%3DAlaWy8IcyeBaviKi7_.WJyhE6odG%3B_ylu%3DX3oDMTJrY2d2NGZyBG1pdANDeFMgRmluYW5jaWFsbHkgRml0IEFydGljbGUgQXJ0aWNsZSBCb2R5IFByb2QEcG9zAzMEc2VjA01lZGlhQXJ0aWNsZUJvZHlBc3NlbWJseQ--%3B_ylg%3DX3oDMTNjdGVoaXJqBGludGwDdXMEbGFuZwNlbi11cwRwc3RhaWQDY2IyOTRhMGEtYmY2OS0zYTdlLThlYTUtZWFlNTU3YWI1ZTc3BHBzdGNhdANleGNsdXNpdmVzfGZpbmFuY2lhbGx5Zml0BHB0A3N0b3J5cGFnZQ--%3B_ylv%3D3?page=1 |archive-date=4 February 2016 |access-date=20 April 2016 |website=Yahoo Finance }}; {{Cite magazine |date=27 September 2012 |title=And the World's Most Educated Country Is... |url=https://newsfeed.time.com/2012/09/27/and-the-worlds-most-educated-country-is/ |magazine=Time |location=New York |access-date=20 April 2016 |archive-date=30 April 2018 |archive-url=https://web.archive.org/web/20180430040213/http://newsfeed.time.com/2012/09/27/and-the-worlds-most-educated-country-is/ |url-status=dead }}</ref> The UK is home to [[List of universities in the United Kingdom|many universities]], including the [[University of Oxford]] and [[University of Cambridge]], which often achieve first place on global rankings.<ref>{{Cite web |title=The Times Higher Education World University Rankings 2024 |date=25 September 2023 |url=https://www.timeshighereducation.com/world-university-rankings/2024/world-ranking |access-date=17 April 2024}}</ref><ref>{{Cite web |title=QS World University Rankings 2024 |url=https://www.topuniversities.com/university-rankings/world-university-rankings/2024 |access-date=17 April 2024}}</ref>
University education has varied [[Student loans and grants in the United Kingdom|tuition fees]] in different regions of the UK. England and Wales have a fixed maximum annual fee for all UK citizens, contingent on attaining a certain level of income. Only those who reach a certain salary threshold pay this fee through [[Taxation in the United Kingdom|general taxation]].<ref>{{Cite web |title=Repaying your student loan |url=https://www.gov.uk/repaying-your-student-loan/what-you-pay |website=gov.uk |access-date=21 June 2025}}</ref> Northern Ireland and Scotland have a reduced maximum fee or no fee for citizens where it is their home region. Some NHS courses have bursaries which pay the fee and in 2017 it was stated that each doctor gets subsidised by £230,000 during their training.<ref>{{Cite web |date=20 October 2014 |title=Undergraduate Tuition Fess and Student Loans |url=https://www.ucas.com/money-and-student-life/money/student-finance/undergraduate-tuition-fees-and-student-loans |access-date=24 February 2024 |website=UCAS}}</ref><ref>{{Cite web |title=More undergraduate medical education places |url=https://www.gov.uk/government/news/more-undergraduate-medical-education-places |access-date=24 February 2024 |website=gov.uk}}</ref>
In 2022 the [[Programme for International Student Assessment]] (PISA) ranked the overall knowledge and skills of British 15-year-olds as 14th in the world in reading, mathematics and science. The average British student scored 494, above the [[OECD]] average of 478.<ref>{{Cite web |title=PISA 2022 UK Results |url=https://www.oecd.org/publication/pisa-2022-results/country-notes/united-kingdom-9c15db47#chapter-d1e11 |access-date=24 February 2024 |website=OECD |date=4 December 2023}}</ref>
=== Health ===
{{Main|Health in the United Kingdom|Healthcare in the United Kingdom}}
{{Further|Healthcare in England|Healthcare in Scotland|Healthcare in Wales|Healthcare in Northern Ireland}}
[[File:QEUH.jpg|thumb|[[NHS Scotland]]'s [[Queen Elizabeth University Hospital]] in Glasgow, the largest hospital campus in Europe]]
The modern system of [[Universal service|universal]] [[Publicly funded health care|publicly funded healthcare]] in the United Kingdom has its origins in the establishment of the [[National Health Service]] (NHS), which began operating in 1948 as the primary healthcare provider in the United Kingdom.<ref>{{cite web |title=The foundation of the NHS |url=https://www.nationalarchives.gov.uk/explore-the-collection/stories/the-foundation-of-the-nhs/ |access-date=6 July 2026 |publisher=The National Archives}}</ref> The widespread popularity of the NHS has led to it being described as a "national religion".<ref>{{Cite news |last=Gill |first=Martha |date=9 July 2023 |title=To those who claim the NHS has turned into a British religion, I say: keep the faith |url=https://www.theguardian.com/commentisfree/2023/jul/09/nhs-british-religion-keep-faith-nhs-at-75 |access-date=16 July 2023 |work=The Observer}}</ref><ref>{{Cite web |date=14 April 2020 |title=Is the NHS our new national religion? – Religion Media Centre |url=https://religionmediacentre.org.uk/news/is-the-nhs-our-new-national-religion/ |access-date=16 July 2023 |website=religionmediacentre.org.uk}}</ref> Healthcare in the United Kingdom is a [[Devolution|devolved matter]] and each country has its own system of universal publicly funded healthcare ([[NHS in England]], [[NHS Scotland]], [[Health and Social Care in Northern Ireland]] and [[NHS Wales]]), although private healthcare is also available. Public healthcare is provided to all [[British nationality law|UK permanent residents]] and is mostly free at the point of need, being paid for from [[Taxation in the United Kingdom|general taxation]]. The [[World Health Organization]], in 2000, ranked the provision of healthcare in the United Kingdom as fifteenth-best in Europe and eighteenth in the world.<ref>{{Cite book |url=https://archive.org/details/worldhealthrepor00worl |title=The world health report 2000 – Health systems: improving performance |publisher=World Health Organization |date=2000 |isbn=978-92-4-156198-3 |editor-last=Haden |editor-first=Angela |location=Geneva |access-date=5 July 2011 |editor-last2=Campanini |editor-first2=Barbara}}; {{Cite web |last=World Health Organization |author-link=World Health Organization |title=Measuring overall health system performance for 191 countries |url=http://pages.stern.nyu.edu/~wgreene/Statistics/WHO-COMP-Study-30.pdf |access-date=5 July 2011 |publisher=New York University}}</ref>
Since 1979 expenditure on healthcare has increased significantly.<ref>{{Cite journal |last=Fisher |first=Peter |title=The NHS from Thatcher to Blair |url=http://www.healthp.org/node/71 |journal=NHS Consultants Association |archive-url=https://web.archive.org/web/20181120124807/http://www.healthp.org/node/71 |archive-date=20 November 2018 |access-date=19 December 2018 |quote=The Budget ... was even more generous to the NHS than had been expected amounting to an annual rise of 7.4 per cent above the rate of inflation for the next five years. This would take us to 9.4 per cent of GDP spent on health ie around EU average.}}</ref> The 2018 [[OECD]] data, which incorporates in health a chunk of what in the UK is classified as social care, has the UK spending £3,121 per person.<ref>{{Cite news |date=24 September 2019 |title=Swindells: They aren't 'your' patients |url=https://www.hsj.co.uk/policy-and-regulation/swindells-they-arent-your-patients/7025988.article? |access-date=19 November 2019 |publisher=Health Service Journal}}</ref> In 2017 the UK spent £2,989 per person on healthcare, near the median for members of the Organisation for Economic Co-operation and Development.<ref>{{Cite news |date=29 August 2019 |title=How does UK healthcare spending compare with other countries? |url=https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthcaresystem/articles/howdoesukhealthcarespendingcomparewithothercountries/2019-08-29 |access-date=5 October 2019 |publisher=Office of National Statistics}}</ref>
Regulatory bodies are organised on a UK-wide basis such as the [[General Medical Council]], the [[Nursing and Midwifery Council]] and non-governmental-based, such as the [[Medical royal college|Royal College]]s. Political and operational responsibility for healthcare lies with four national [[governments]]; healthcare in England is the responsibility of the UK Government; healthcare in Northern Ireland is the responsibility of the Northern Ireland Executive; healthcare in Scotland is the responsibility of the Scottish Government; and healthcare in Wales is the responsibility of the Welsh Government.<ref>{{Cite news |date=28 August 2008 |title='Huge contrasts' in devolved NHS |url=http://news.bbc.co.uk/1/hi/health/7586147.stm |work=BBC News}}; {{Cite news |last=Triggle |first=Nick |date=2 January 2008 |title=NHS now four different systems |work=BBC News |url=http://news.bbc.co.uk/1/hi/health/7149423.stm}}</ref>
== Culture ==
{{Main|Culture of the United Kingdom}}
{{Further|Culture of England|Culture of Scotland|Culture of Wales|Culture of Northern Ireland}}
The culture of the United Kingdom is influenced by the nation's island status, its history, and being a [[political union]] of four countries with each preserving distinctive traditions, customs and symbolism. British influence can be observed in the language, culture and [[Common law|legal systems]] of many of [[List of countries that have gained independence from the United Kingdom|its former colonies]], in particular the United States, Australia, Canada, New Zealand and Ireland, a common culture known as the Anglosphere.<ref>{{Cite book |last=Julian Go |title=Constitutionalism and political reconstruction |date=2007 |publisher=Brill |isbn=978-90-04-15174-1 |editor-last=Arjomand |editor-first=Saïd Amir |pages=92–94 |chapter=A Globalizing Constitutionalism?, Views from the Postcolony, 1945–2000 |chapter-url=https://books.google.com/books?id=kYmmnYKEvE0C&pg=PA94}}</ref>{{Sfn|Ferguson|2004|p=307}} Most of its former colonies are Commonwealth countries, bonded by a shared British inheritance.<ref>{{Cite web |title=The Commonwealth |url=https://www.mfat.govt.nz/en/peace-rights-and-security/the-commonwealth/ |access-date=8 January 2024 |website=[[New Zealand Ministry of Foreign Affairs and Trade]] |language=en-NZ}}</ref><ref>{{Cite web |title=Commonwealth of Nations |url=https://www.parliament.uk/about/living-heritage/evolutionofparliament/legislativescrutiny/parliament-and-empire/contemporary-context/ |access-date=22 February 2026 |publisher=UK Parliament |language=en}}</ref><ref>{{Cite book |last1=Mazrui |first1=Ali Al Amin |title=Anglo-African Commonwealth |last2=Taylor |first2=D. |last3=Bradley |first3=Kenneth |date=1967 |publisher=Pergamon |isbn=978-0-08-012253-3 |pages=40–41 |quote=...in the ultimate analysis, what could a New Zealander have in common with a Jamaican or a Zambian, if not the bonds of a shared British-ness?}}</ref> A global survey in 2024 ranked the UK third in the 'Most Influential Countries' rankings, behind the US and China.<ref>{{Cite web |title=Most Influential Countries |url=https://www.usnews.com/news/best-countries/most-influential-countries |access-date=22 September 2025 |website=[[U.S. News & World Report]]}}</ref>
=== Literature and drama ===
{{Main|British literature|Theatre of the United Kingdom}}
{{Further|Literature of England|Scottish literature|Welsh literature|Literature of Northern Ireland}}
{{multiple image
| align = right
| total_width = 320
| image1 = PG 1063Burns Naysmith.jpg
| alt1 = Robert Burns
| caption1 = [[Robert Burns]] (1759–1796)
| image2 = William Shakespeare by John Taylor, edited.jpg
| alt2 = William Shakespeare
| caption2 = [[William Shakespeare]] (1564–1616)
| footer = Burns and Shakespeare are considered the [[national poet]]s of Scotland and England respectively.
}}
British literature includes that associated with the United Kingdom, the [[Isle of Man]] and the [[Channel Islands]]. Most British literature is in English. In 2022, 669 million physical books were sold in the UK, the most ever.<ref>{{Cite web |title=UK publishing industry reports record-breaking year in 2022 |url=https://www.theguardian.com/books/2023/apr/17/uk-publishing-industry-reports-record-breaking-year-in-2022 |access-date=9 May 2024 |work=[[The Guardian]] |date=17 April 2023}}</ref> Britain is renowned for [[Literature for children|children's literature]]; writers include [[Daniel Defoe]], [[Rudyard Kipling]], [[Lewis Carroll]] and [[Beatrix Potter]], who also illustrated her own books. Other writers include [[A. A. Milne]], [[Enid Blyton]], [[J. R. R. Tolkien]], [[Roald Dahl]], [[Terry Pratchett]] and [[J. K. Rowling]], who wrote ''[[Harry Potter]]'', the [[List of best-selling book series|best-selling book series]] of all time.<ref>{{Cite web |title=Best-selling Book Series Of All Time |url=https://wordsrated.com/best-selling-book-series-of-all-time-statistics/ |access-date=18 May 2024 |publisher=Wordsrated |date=20 July 2023}}</ref>
The playwright and poet [[William Shakespeare]] is generally regarded as the greatest dramatist ever and the [[national poet]] of England.<ref>{{Cite web |title=William Shakespeare (English author) |url=https://www.britannica.com/EBchecked/topic/537853/William-Shakespeare |access-date=26 February 2006 |publisher=[[Encyclopædia Britannica]]}}; {{Cite encyclopedia |title=MSN Encarta Encyclopedia article on Shakespeare |url=http://encarta.msn.com/encyclopedia_761562101/Shakespeare.html |access-date=26 February 2006 |archive-url=https://web.archive.org/web/20060209154055/http://encarta.msn.com/encyclopedia_761562101/Shakespeare.html |archive-date=9 February 2006}}; {{Cite web |title=William Shakespeare |work=TheFreeDictionary.com |publisher=Columbia Electronic Encyclopedia |url=http://encyclopedia2.thefreedictionary.com/Shakespeare%2c+William |access-date=26 February 2006}}</ref> Theatre of United Kingdom plays an important part in British culture and has had a vibrant tradition of [[theatre]] since the Renaissance with roots going back to the Roman occupation. Other important figures in the literature of England are [[Geoffrey Chaucer]], known for ''[[The Canterbury Tales]]'', the poet [[William Wordsworth]], and other [[Romantic Poetry|Romantic poets]], also the novelists [[Charles Dickens]], [[H. G. Wells]], [[George Orwell]], [[Aldous Huxley]] and [[Ian Fleming]]. The 20th-century English crime writer [[Agatha Christie]] is the [[List of best-selling fiction authors|best-selling novelist]] in history.<ref>{{Cite news |date=19 December 2005 |title=Mystery of Christie's success is solved |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/news/uknews/1505799/Mystery-of-Christies-success-is-solved.html |url-status=live |url-access=subscription |access-date=14 November 2010 |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/news/uknews/1505799/Mystery-of-Christies-success-is-solved.html |archive-date=10 January 2022}}{{Cbignore}}</ref> Twelve of the top 25 of 100 novels by British writers chosen by a BBC poll of global critics were written by women; these included works by [[George Eliot]], [[Virginia Woolf]], [[Charlotte Brontë]], [[Emily Brontë]], [[Mary Shelley]], [[Jane Austen]], [[Doris Lessing]] and [[Zadie Smith]].<ref>{{Cite news |last=Ciabattari |first=Jane |date=December 2015 |title=The 25 greatest British novels |work=BBC Culture |url=https://www.bbc.com/culture/article/20151204-the-25-greatest-british-novels |access-date=29 December 2021}}</ref>
Scottish literature includes [[Arthur Conan Doyle]] (the creator of [[Sherlock Holmes]]), [[Walter Scott|Sir Walter Scott]], [[J. M. Barrie]], [[Robert Louis Stevenson]] (whose novel ''[[Treasure Island]]'' strongly influenced the portrayal of [[pirates in the arts and popular culture]]), and the poet [[Robert Burns]], who is considered the national poet of Scotland. More recently [[Hugh MacDiarmid]] and [[Neil M. Gunn]] contributed to the [[Scottish Renaissance]], with grimmer works from [[Ian Rankin]] and [[Iain Banks]]. Edinburgh was UNESCO's first worldwide [[City of Literature]].<ref>{{Cite web |year=2004 |title=Edinburgh, United Kingdom, UNESCO City of Literature |url=http://www.unesco.org/new/en/culture/themes/creativity/creative-industries/creative-cities-network/literature/edinburgh |archive-url=https://web.archive.org/web/20130528152834/http://www.unesco.org/new/en/culture/themes/creativity/creative-industries/creative-cities-network/literature/edinburgh |archive-date=28 May 2013 |url-status=dead |access-date=9 March 2015 |work=Unesco}}</ref>
Welsh literature includes Britain's oldest known poem, ''[[Y Gododdin]]'', most likely composed in the late 6th century. It was written in [[Cumbric language|Cumbric]] or [[Old Welsh]] and contains the earliest known reference to [[King Arthur]].<ref>{{Cite web |title=Early Welsh poetry |url=https://www.bbc.co.uk/wales/history/sites/themes/society/language_poetry.shtml |access-date=29 December 2010 |work=BBC Wales}}</ref> The [[Arthurian legend]] was further developed by [[Geoffrey of Monmouth]].<ref>{{Cite book |last=Lang, Andrew |url=https://books.google.com/books?id=dKJiPyyTevgC |title=History of English Literature from Beowulf to Swinburne |publisher=Wildside Press |year=2003 |isbn=978-0-8095-3229-2 |location=Holicong, PA |page=42 |orig-date=1913}}</ref> [[Dafydd ap Gwilym]] (''fl.'' 1320–1370) is widely regarded as one of the greatest European poets of his age.<ref>{{Cite web |year=2011 |title=Dafydd ap Gwilym |url=http://www.academi.org/dafydd-ap-gwilym-eng |archive-url=https://web.archive.org/web/20120324034938/http://www.literaturewales.org/dafydd-ap-gwilym-eng |archive-date=24 March 2012 |url-status=dead |access-date=3 January 2011 |website=[[Literature Wales|Academi.org]] |quote=Dafydd ap Gwilym is widely regarded as one of the greatest Welsh poets of all time, and amongst the leading European poets of the Middle Ages.}}</ref> [[Daniel Owen]] is credited as the first Welsh-language novelist, publishing ''[[Rhys Lewis (novel)|Rhys Lewis]]'' in 1885. The best-known of the [[Anglo-Welsh poetry|Anglo-Welsh poets]] are [[Dylan Thomas]] and [[R. S. Thomas]], the latter nominated for the [[Nobel Prize in Literature]] in 1996. Leading Welsh novelists of the twentieth century include [[Richard Llewellyn]] and [[Kate Roberts (author)|Kate Roberts]].<ref>{{Cite web |url=http://newsalerts.bbc.co.uk/1/low/wales/551486.stm |title=True birthplace of Wales's literary hero |archive-url=https://web.archive.org/web/20200316173733/http://newscdn.bbc.net.uk/2/hi/uk_news/wales/551486.stm |archive-date=16 March 2020 |url-status=dead |website=BBC News |date=5 December 1999 |access-date=28 April 2012}}</ref><ref>{{Cite web |title=Kate Roberts: Biography |url=https://www.bbc.co.uk/wales/northwest/halloffame/arts/kateroberts.shtml |url-status=dead |access-date=19 February 2017 |website=BBC Wales |archive-url=https://web.archive.org/web/20130308000646/https://www.bbc.co.uk/wales/northwest/halloffame/arts/kateroberts.shtml |archive-date=8 March 2013}}</ref>
Northern Ireland's most popular writer is [[C. S. Lewis]], who was born in Belfast and wrote ''[[The Chronicles of Narnia]]''.<ref>{{Cite web |title=The Chronicles of Narnia Book Series Statistics |url=https://wordsrated.com/the-chronicles-of-narnia-book-series-statistics/ |access-date=18 May 2024 |publisher=Wordsrated |date=19 July 2023}}</ref> Irish writers, living at a time when all of Ireland was part of the United Kingdom, include [[Oscar Wilde]],<ref>{{Cite book |last=Varty |first=Anne |title=A Preface to Oscar Wilde |date=2014 |publisher=Routledge |isbn=978-1-317-89231-1 |pages=[https://books.google.com/books?id=A9YFBAAAQBAJ&pg=PA231 231–232]}}; {{Cite encyclopedia |title=Oscar Wilde |encyclopedia=[[Encyclopedia.com]] |publisher=[[Cengage]] |url=https://www.encyclopedia.com/people/literature-and-arts/english-literature-19th-cent-biographies/oscar-wilde |access-date=10 December 2019}}</ref> [[Bram Stoker]] (who wrote ''[[Dracula]]'')<ref>{{Cite book |last=Moss |first=Joyce |url=https://archive.org/details/isbn_9780787637286 |title=British and Irish Literature and Its Times: The Victorian Era to the Present (1837–) |publisher=Gale Group |year=2001 |isbn=978-0-7876-3729-3 |page=[https://archive.org/details/isbn_9780787637286/page/107 107] |url-access=registration}}</ref> and [[George Bernard Shaw]].<ref>{{Cite book |last=Holroyd |first=Michael |url=https://archive.org/details/bernardshaw00holr/page/384 |title=Bernard Shaw, Volume 2: 1898–1918: The Pursuit of Power |publisher=Chatto & Windus |year=1989 |isbn=978-0-7011-3350-4 |page=[https://archive.org/details/bernardshaw00holr/page/384 384]}}; {{Cite web |title=G B Shaw |url=https://www.bl.uk/people/g-b-shaw |access-date=10 December 2019 |website=Discovering Literature: 20th century |publisher=[[British Library]] |archive-date=9 August 2020 |archive-url=https://web.archive.org/web/20200809155152/https://www.bl.uk/people/g-b-shaw |url-status=dead}}</ref> There have been many authors whose origins were from outside the United Kingdom but who moved to the UK, including [[Joseph Conrad]],<ref>{{Cite book |last=Middleton |first=Tim |url=https://books.google.com/books?id=Azd1f8NBpUoC&pg=PA159 |title=Joseph Conrad |publisher=Routledge |year=2006 |isbn=978-0-415-26851-6 |page=159}}</ref> [[T. S. Eliot]],<ref>{{Cite book |last=Cooper |first=John Xiros |url=https://books.google.com/books?id=XqmNjQzhwV4C&pg=PA111 |title=The Cambridge Introduction to T. S. Eliot |date=2006 |publisher=Cambridge University Press |isbn=978-1-139-45790-3 |page=111}}</ref> [[Kazuo Ishiguro]],<ref>{{Cite book |last=Sim |first=Wai-chew |url=https://books.google.com/books?id=WcKLAgAAQBAJ&pg=PT201 |title=Kazuo Ishiguro |date=2009 |publisher=Routledge |isbn=978-1-135-19867-1 |page=201}}</ref> Sir [[Salman Rushdie]]<ref>{{Cite web |title=Salman Rushdie |url=https://www.oxfordreference.com/view/10.1093/oi/authority.20110803100433765 |access-date=10 December 2019 |website=Oxford Reference |publisher=[[Oxford University Press]]}}</ref> and [[Ezra Pound]].<ref>{{Cite news |last=Campbell |first=James |date=17 May 2008 |title=Home from home |work=The Guardian |url=https://www.theguardian.com/books/2008/may/17/poetry3 |access-date=10 December 2019}}; {{Cite book |last=Nadel |first=Ira |url=https://books.google.com/books?id=ECiGDAAAQBAJ&pg=PA90 |title=Ezra Pound: A Literary Life |date=2004 |publisher=Palgrave Macmillan |isbn=978-0-230-37881-0 |page=90}}</ref>
=== Philosophy ===
{{Main|British philosophy}}
The United Kingdom is famous for "[[British Empiricism]]", a branch of the philosophy that states that only knowledge verified by experience is valid, and 'Scottish Philosophy', sometimes referred to as the '[[Scottish School of Common Sense]]'.<ref>{{Cite book |url=http://www.rrbltd.co.uk/bibliographies/scottish_v5_bibliog.pdf |title=A bibliography of Scottish common sense philosophy: Sources and origins |publisher=Thoemmes Press |year=2000 |editor-last=Fieser, James |location=Bristol |access-date=17 December 2010 |archive-date=9 April 2023 |archive-url=https://web.archive.org/web/20230409171906/https://www.rrbltd.co.uk/bibliographies/scottish_v5_bibliog.pdf |url-status=dead}}</ref> The most famous philosophers of British Empiricism are [[John Locke]], [[George Berkeley]]{{Efn|Berkeley is in fact Irish but was called a 'British empiricist' due to the territory of what is now known as the [[Republic of Ireland]] being in the UK at the time.}} and [[David Hume]]; while [[Dugald Stewart]], [[Thomas Reid]] and [[Sir William Hamilton, 9th Baronet|William Hamilton]] were major exponents of the Scottish "common sense" school. Two Britons are also notable for the ethical theory of [[utilitarianism]], a moral philosophy first used by [[Jeremy Bentham]] and later by [[John Stuart Mill]] in his short work ''[[Utilitarianism (book)|Utilitarianism]]''.<ref>{{Cite book |last=Palmer, Michael |url=https://books.google.com/books?id=s7y5MJOuN30C&pg=PA66 |title=Moral Problems in Medicine: A Practical Coursebook |publisher=Lutterworth Press |year=1999 |isbn=978-0-7188-2978-0 |location=Cambridge |page=66}}; {{Cite book |last=Scarre, Geoffrey |url=https://books.google.com/books?id=8A4xLnzfqYwC&pg=PA82 |title=Utilitarianism |publisher=Routledge |year=1995 |isbn=978-0-415-12197-2 |location=London |page=82}}</ref>
=== Media ===
{{Main|Media of the United Kingdom|Censorship in the United Kingdom}}
{{Further|Media of England|Media of Scotland|Media of Wales|Media of Northern Ireland}}
The [[BBC]], founded in 1922, is the United Kingdom's publicly funded radio, television and Internet broadcasting corporation, and is the oldest and largest broadcaster in the world.<ref name="MediaNewsline">{{Cite web |title=BBC: World's largest broadcaster & Most trusted media brand |url=http://www.medianewsline.com/news/151/ARTICLE/4930/2009-08-13.html |archive-url=https://web.archive.org/web/20101005004930/http://www.medianewsline.com/news/151/ARTICLE/4930/2009-08-13.html |archive-date=5 October 2010 |access-date=23 September 2010 |publisher=Media Newsline}}</ref><ref name="ProspectMag">{{Cite web |title=Digital license |url=http://www.prospectmagazine.co.uk/?p=64654 |archive-url=https://web.archive.org/web/20111107024637/http://www.prospectmagazine.co.uk/2009/07/digitallicense |archive-date=7 November 2011 |access-date=9 March 2015 |publisher=Prospect}}</ref><ref name="AboutBBC">{{Cite news |title=About the BBC – What is the BBC |work=BBC Online |url=https://www.bbc.co.uk/info/purpose/what.shtml |access-date=9 March 2015 |archive-url=https://web.archive.org/web/20100116202334/http://www.bbc.co.uk/info/purpose/what.shtml |archive-date=16 January 2010}}</ref> It operates television and radio stations across the UK and abroad and its domestic services are funded by the [[Television licensing in the United Kingdom|television licence]].<ref>{{Cite journal |date=13 August 2009 |title=BBC: World's largest broadcaster & Most trusted media brand |url=http://www.medianewsline.com/news/151/ARTICLE/4930/2009-08-13.html |journal=Media Newsline |archive-url=https://web.archive.org/web/20110510090842/http://www.medianewsline.com/news/151/ARTICLE/4930/2009-08-13.html |archive-date=10 May 2011 |access-date=19 June 2011}}; {{Cite web |date=April 2010 |title=TV Licence Fee: facts & figures |url=https://www.bbc.co.uk/pressoffice/keyfacts/stories/licencefee.shtml |url-status=live |archive-url=https://web.archive.org/web/20110427080539/http://www.bbc.co.uk/pressoffice/keyfacts/stories/licencefee.shtml |archive-date=27 April 2011 |publisher=BBC Press Office}}</ref> The [[BBC World Service]] is an [[International broadcasting|international broadcaster]] owned and operated by the BBC, and the world's largest.<ref>{{Cite web |title=Microsoft Word – The Work of the BBC World Service 2008–09 HC 334 FINAL.doc |url=https://publications.parliament.uk/pa/cm200910/cmselect/cmfaff/334/334.pdf |archive-url=https://web.archive.org/web/20201021001645/https://publications.parliament.uk/pa/cm200910/cmselect/cmfaff/334/334.pdf |archive-date=21 October 2020 |access-date=16 February 2011}}</ref> It broadcasts radio news, speech and discussions in more than 40 languages.<ref>{{Cite web |title=News in your language – BBC News |url=https://www.bbc.co.uk/ws/languages |website=BBC}}; {{Cite web |title=BBC World Service |url=https://www.facebook.com/pages/category/Media-News-Company/bbcworldservice/about |website=Facebook.com}}</ref>
Other major players in the UK media include [[ITV plc|ITV]], which operates 11 of the 15 regional television broadcasters that make up the [[ITV (TV network)|ITV Network]],<ref>{{Cite web |title=Publications & Policies: The History of ITV |url=http://www.itv.com/aboutitv/publications-policies |archive-url=https://web.archive.org/web/20110411224117/http://www.itv.com/aboutitv/publications-policies |archive-date=11 April 2011 |website=ITV.com}}</ref> and [[Sky UK|Sky]].<ref>{{Cite journal |title=Direct Broadcast Satellite Television |url=http://www.newscorp.com/operations/dbst.html |journal=News Corporation |archive-url=https://web.archive.org/web/20110604095622/http://www.newscorp.com/operations/dbst.html |archive-date=4 June 2011}}</ref> Newspapers produced in the United Kingdom include the ''[[Daily Mail]]'', ''[[The Guardian]]'', ''[[The Daily Telegraph|The Telegraph]]'', ''[[The Times]]'', and the ''[[Financial Times]]''.<ref>{{Cite news |date=10 October 2008 |title=ABCs: National daily newspaper circulation September 2008 |work=The Guardian |location=London |url=https://www.theguardian.com/media/table/2008/oct/10/abcs-pressandpublishing |access-date=17 October 2008}}</ref> Magazines and journals published in the United Kingdom that have achieved worldwide circulation include ''[[The Spectator]]'', ''[[The Economist]]'', ''[[New Statesman]]'' and ''[[Radio Times]]''.
[[File:Media City Footbridge and BBC Offices (geograph 2685261).jpg|thumb|[[MediaCityUK]] in [[Salford]], [[Greater Manchester]], is one of the largest media production facilities in Europe.]]London dominates the media sector in the UK: national newspapers and television and radio are largely based there, although [[MediaCityUK]] in Manchester is also a significant national media centre. Edinburgh and Glasgow, and Cardiff, are important centres of newspaper and broadcasting production in Scotland and Wales, respectively.<ref>William, D. (2010). [https://books.google.com/books?id=7yg45P35KDMC ''UK Cities: A Look at Life and Major Cities in England, Scotland, Wales and Northern Ireland'']. Eastbourne: Gardners Books. {{ISBN|978-9987-16-021-1}}, pp. 22, 46, 109 and 145.</ref> The UK publishing sector, including books, directories and databases, journals, magazines and business media, newspapers and news agencies, has a combined turnover of around £20 billion and employs 167,000 people.<ref>{{Cite web |title=Publishing |url=http://www.culture.gov.uk/what_we_do/creative_industries/3280.aspx |url-status=live |archive-url=https://web.archive.org/web/20110505104322/http://www.culture.gov.uk/what_we_do/creative_industries/3280.aspx |archive-date=5 May 2011 |publisher=Department of Culture, Media and Sport}}</ref> In 2015 the UK published 2,710 book titles per million inhabitants, more than any other country, with much of this exported to other [[Anglophone]] countries.<ref>{{Cite web |last=<!--Not stated--> |date=2016 |title=Annual Report 2015–2016 |url=https://www.internationalpublishers.org/images/reports/Annual_Report_2016/IPA_Annual_Report_2015-2016_interactive.pdf |access-date=14 January 2021 |website=internationalpublishers.org |publisher=International Publishers Association |page=16 |archive-date=31 August 2023 |archive-url=https://web.archive.org/web/20230831205753/https://www.internationalpublishers.org/images/reports/Annual_Report_2016/IPA_Annual_Report_2015-2016_interactive.pdf |url-status=dead}}</ref>
In 2010, 82.5 per cent of the UK population were Internet users, the [[List of countries by number of Internet users|highest proportion]] amongst the 20 countries with the largest total number of users in that year.<ref>{{Cite journal |title=Top 20 countries with the highest number of Internet users |url=http://www.internetworldstats.com/top20.htm |journal=Internet World Stats |archive-url=https://web.archive.org/web/20110610104435/http://www.internetworldstats.com/top20.htm |archive-date=10 June 2011 |access-date=19 June 2011}}</ref> The [[Video games in the United Kingdom|British video game industry]] is the largest in Europe, and since 2022 the UK has the [[List of video games markets by country|largest video game market]] in Europe by sales, surpassing [[Video games in Germany|Germany]].<ref>{{Cite web |last=Dring |first=Christopher |date=12 January 2023 |title=European console and PC game sales fall 7.1% in 2022 |url=https://www.gamesindustry.biz/european-console-and-pc-game-sales-fall-71-over-2021 |access-date=30 September 2023 |website=GamesIndustry.biz}}</ref> It is the world's third-largest producer of video games after [[Video games in Japan|Japan]] and the [[Video games in the United States|United States]].<ref>{{Cite web |title=About UK Video Games Industry |url=https://tiga.org/about-tiga-and-our-industry/about-uk-video-games-industry |access-date=6 June 2023 |website=TIGA}}</ref>
=== Visual art ===
{{Main|Art of the United Kingdom|Architecture of the United Kingdom}}
[[File:Angel of the North - 6150534524.jpg|thumb|The [[Angel of the North]] sculpture by [[Antony Gormley]] has become a symbol of [[Northern England]].]]
Major British artists include the [[Romanticism|Romantic]] artists [[William Blake]], [[John Constable]], [[Samuel Palmer]], and [[J. M. W. Turner]]; the [[portrait]] painters [[Joshua Reynolds|Sir Joshua Reynolds]] and [[Lucian Freud]]; the landscape artists [[Thomas Gainsborough]] and [[L. S. Lowry]]; the pioneer of the [[Arts and Crafts movement]] [[William Morris]]; the figurative painter [[Francis Bacon (artist)|Francis Bacon]]; the [[Pop artist]]s [[Peter Blake (artist)|Peter Blake]], [[Richard Hamilton (artist)|Richard Hamilton]] and [[David Hockney]]; the pioneers of [[conceptual art]] movement [[Art & Language]];<ref>{{Cite news |last=Tate |title=Art & Language – Art Term {{!}} Tate |work=Tate |url=https://www.tate.org.uk/art/art-terms/a/art-language |access-date=8 September 2018}}</ref> the collaborative duo [[Gilbert and George]]; the [[Abstract art|abstract]] artist [[Howard Hodgkin]]; and the sculptors [[Antony Gormley]], [[Anish Kapoor]] and [[Henry Moore]]. During the late 1980s and 1990s the [[Saatchi Gallery]] in London helped to bring to public attention a group of multi-genre artists who would become known as the "[[Young British Artists]]": [[Damien Hirst]], [[Chris Ofili]], [[Rachel Whiteread]], [[Tracey Emin]], [[Mark Wallinger]], [[Steve McQueen (director)|Steve McQueen]], [[Sam Taylor-Wood]] and the [[Jake and Dinos Chapman|Chapman Brothers]] are amongst the better-known members of this loosely affiliated movement.
The [[Royal Academy]] in London is a key organisation for the promotion of the visual arts in the United Kingdom. Major schools of art in the UK include: the six-school [[University of the Arts London]], which includes the [[Central Saint Martins College of Art and Design]] and [[Chelsea College of Art and Design]]; [[Goldsmiths, University of London]]; the [[Slade School of Fine Art]] (part of [[University College London]]); the [[Glasgow School of Art]]; the [[Royal College of Art]]; and [[The Ruskin School of Drawing and Fine Art]] (part of the University of Oxford). The [[Courtauld Institute of Art]] is a leading centre for the teaching of the [[history of art]]. Important art galleries in the United Kingdom include the [[National Gallery]], [[National Portrait Gallery (London)|National Portrait Gallery]], [[Tate Britain]], and [[Tate Modern]] (the most-visited modern art gallery in the world, with around 4.7 million visitors per year).<ref>{{Cite news |last=Bayley |first=Stephen |date=24 April 2010 |title=The startling success of Tate Modern |work=[[The Times]] |location=London |url=http://entertainment.timesonline.co.uk/tol/arts_and_entertainment/visual_arts/article7105032.ece |archive-url=https://web.archive.org/web/20110429173928/http://entertainment.timesonline.co.uk/tol/arts_and_entertainment/visual_arts/article7105032.ece |url-status=dead |archive-date=29 April 2011 |access-date=19 January 2011}} {{Subscription required}}</ref>
=== Music ===
{{Main|Music of the United Kingdom}}
{{Further|Music of England (disambiguation){{!}}Music of England|Music of Scotland|Music of Wales|Music of Northern Ireland}}
<!----Caution should be taken to ensure that the sections are not simply a listing of names or mini biographies of individuals accomplishments.---->
[[File:Royal Albert Hall, BBC Proms 2017.jpg|thumb|[[The Proms]] is a classical music festival, most closely associated with [[Henry Wood]] and held at the [[Royal Albert Hall]] in London, which regularly plays music by [[Edward Elgar]] and other British composers.]]
Various styles of music have become popular in the UK, including the [[folk music]] of [[Folk music of England|England]], [[Folk music of Scotland|Scotland]], [[Music of Wales#Folk music|Wales]] and [[Folk music of Northern Ireland|Northern Ireland]]. English folk features melodic ballads with strong lyrics and music for country dancing often using accordion and fiddles.<ref>{{Cite web |access-date=15 September 2025 |title=Songs of England |url=https://www.english-heritage.org.uk/visit/inspire-me/songs-of-england}}</ref> Scottish folk features bagpipes and fiddles playing traditional dance tunes with bouncy tempos.<ref>{{Cite web |access-date=15 September 2025 |title=The influence of traditional Scottish Music |url=https://www.visitscotland.com/things-to-do/events/music-festivals/traditional-folk}}</ref> Welsh folk has harps and vocal harmonies often sung in Welsh.<ref>{{Cite web |access-date=15 September 2025 |title=Celtic connections: the story of folk music in Wales |date=17 February 2020 |url=https://www.wales.com/culture-and-sport/music-and-performance/roots-and-shoots-welsh-folk-music}}</ref> Northern Irish folk blends fiddles with flutes merging Scottish and Irish influences.<ref>{{Cite web |access-date=15 September 2025 |title=Why you should experience traditional music in Ireland |url=https://www.ireland.com/en-us/magazine/music/traditional-music/}}</ref>
Historically, there has been [[Renaissance music]] from the [[Tudor period]], with [[Mass (music)|masses]], [[madrigal]]s and [[lute]] music by [[Thomas Tallis]], [[John Taverner]], [[William Byrd]], [[Orlando Gibbons]] and [[John Dowland]]. After the [[Stuart Restoration]], an English tradition of dramatic [[masque]]s, anthems and airs became established, led by [[Henry Purcell]], followed by [[Thomas Arne]] and others. [[George Frideric Handel]] composed the anthem ''[[Zadok the Priest]]'' for the [[coronation of George II]]; it became the traditional ceremonial music for anointing all future monarchs. Handel's many oratorios, such as his famous ''[[Messiah (Handel)|Messiah]]'', were written in English.<ref>{{Cite web |date=20 July 2009 |title=British Citizen by Act of Parliament: George Frideric Handel |url=http://www.parliament.uk/parliamentary_publications_and_archives/parliamentary_archives/handel_and_naturalisation.cfm |archive-url=https://web.archive.org/web/20100326164147/http://www.parliament.uk/parliamentary_publications_and_archives/parliamentary_archives/handel_and_naturalisation.cfm |archive-date=26 March 2010 |access-date=9 March 2015 |publisher=UK Parliament}}; {{Cite news |last=Andrews |first=John |date=14 April 2006 |title=Handel all'inglese |work=Playbill |location=New York |url=http://www.playbillarts.com/features/article/4236.html |access-date=11 September 2009 |archive-url=https://web.archive.org/web/20080516210558/http://www.playbillarts.com/features/article/4236.html |archive-date=16 May 2008}}</ref>
In the second half of the 19th century, [[Arthur Sullivan]] and his librettist [[W. S. Gilbert]] wrote their popular [[Savoy opera]]s, and [[Edward Elgar]] composed a wide range of music. Increasingly, composers became inspired by the English countryside and its [[folk music]], notably [[Gustav Holst]], [[Ralph Vaughan Williams]] and [[Benjamin Britten]], a pioneer of modern British opera. Amongst the many post-war composers, some of the most notable have made their own personal choice of musical identity: [[Peter Maxwell Davies]] (Orkney), [[Harrison Birtwistle]] (mythological), and [[John Tavener]] (religious).<ref>{{Cite Grove |title=Great Britain |first1=Nicholas |last1=Iemperley |date=2002 |url=https://doi.org/10.1093/gmo/9781561592630.article.O006236 |url-access=subscription}}; {{Cite Grove |title=England (i) |date=2001 |url=https://doi.org/10.1093/gmo/9781561592630.article.40044 |url-access=subscription |first1=Stephen |last1=Banfield |first2=Ian |last2=Russell}}; {{Cite Grove |title=Wales |date=2001 |first1=Geraint |last1=Lewis |first2=Lyn |last2=Davies |first3=Phyllis |last3=Kinney |url=https://doi.org/10.1093/gmo/9781561592630.article.41108 |url-access=subscription}}; {{Cite Grove |title=Scotland |first1=Kenneth |last1=Elliott |first2=Francis |last2=Collinson |first3=Peggy |last3=Duesenberry |url=https://doi.org/10.1093/gmo/9781561592630.article.40113 |url-access=subscription |date=2001}}; {{Cite Grove |title=Ireland |first1=Harry |last1=White |first2=Nicholas |last2=Carolan |url=https://doi.org/10.1093/gmo/9781561592630.article.13901 |url-access=subscription |date=2011}}; {{Cite web |title=British 20th century composers |url=https://www.bbc.co.uk/bitesize/guides/zdjw7p3/revision/1 |access-date=21 April 2022 |website=[[BBC]]}}</ref> Recent classical singers include [[Alfie Boe]], [[Bryn Terfel]], [[Katherine Jenkins]], [[Michael Ball]], [[Roderick Williams]], [[Russell Watson]] and [[Sarah Brightman]], while [[Nicola Benedetti]] and [[Nigel Kennedy]] are renowned for their violin ability.<ref>{{Cite web |date=21 June 2022 |title=30 of the greatest violinists on record |url=https://www.gramophone.co.uk/features/article/30-of-the-greatest-violinists-on-record |access-date=4 March 2024 |website=Gramophone}};{{Cite web |date=1 January 2020 |title=Katherine Jenkins has officially sold the most classical albums this century |url=https://www.classicfm.com/radio/shows-presenters/classic-fm-chart/katherine-jenkins-most-classical-albums/ |access-date=4 March 2024 |website=Classic FM}};{{Cite web |date=6 May 2023 |title=Who is Roderick Williams, the British baritone and composer at the King's coronation? |url=https://www.classicfm.com/discover-music/roderick-williams-composer-baritone-singing-roles/ |access-date=4 March 2024 |website=Classic FM}};{{Cite web |date=23 February 2024 |title=Michael Ball |url=https://www.eno.org/artists/michael-ball-2/ |access-date=4 March 2024 |website=English National Opera}};{{Cite web |title=Alfie Bow |url=https://www.classicfm.com/artists/alfie-boe/ |access-date=4 March 2024 |website=Classic FM}};{{Cite web |date=11 July 2023 |title=Sarah Brightman facts |url=https://www.smoothradio.com/news/music/sarah-brightman-age-husband-songs/ |access-date=4 March 2024 |website=Smooth Radio}}</ref>
According to ''[[The New Grove Dictionary of Music and Musicians]]'' the term "[[pop music]]" originated in Britain in the mid-1950s to describe [[rock and roll]]'s fusion with the "new youth music".<ref>R. Middleton, et al., [http://www.oxfordmusiconline.com/public/book/omo_gmo "Pop"], ''Grove music online'', retrieved 14 March 2010. {{Subscription required}} {{Webarchive|url=https://web.archive.org/web/20110113160329/http://www.oxfordmusiconline.com/public/book/omo_gmo|date=13 January 2011}}</ref> ''The Oxford Dictionary of Music'' states that artists such as [[the Beatles]] and [[the Rolling Stones]] drove pop music to the forefront of popular music in the early 1960s.<ref>"Pop", [http://www.oxfordmusiconline.com/public/book/omo_t237 ''The Oxford Dictionary of Music''], retrieved 9 March 2010.{{Subscription required}} {{Webarchive|url=https://web.archive.org/web/20171112170116/http://www.oxfordmusiconline.com/public/book/omo_t237|date=12 November 2017}}</ref> Birmingham became known as the birthplace of [[heavy metal music|heavy metal]], with the band [[Black Sabbath]] starting there in the 1960s.<ref>{{Cite news |title=Birmingham, England ... the unlikely birthplace of heavy metal |work=CNN |date=1 July 2011 |first1=Laura |last1=Allsop |url=http://www.cnn.com/2011/WORLD/europe/07/01/birmingham.home.of.metal/index.html |access-date=28 February 2022 |postscript=;}} {{Cite web |last=Bentley |first=David |date=4 June 2013 |title=Midlands rocks! How Birmingham's industrial heritage made it the birthplace of heavy metal |url=http://www.birminghampost.co.uk/whats-on/music/birmingham-birthplace-of-heavy-metal-4031445 |access-date=28 February 2022 |website=[[Birmingham Post]]}}</ref> In the following years, Britain took part in the development of [[rock music]], with British acts pioneering [[hard rock]],<ref>{{Cite web |title=The Rolling Stones {{!}} Biography & History |url=https://www.allmusic.com/artist/the-rolling-stones-mn0000894465/biography |access-date=22 July 2020 |website=AllMusic}}</ref> [[raga rock]], heavy metal,<ref>{{Cite book |last=Tom Larson |url=https://books.google.com/books?id=vGJ7XmA8rjIC&pg=PA183 |title=History of Rock and Roll |publisher=Kendall/Hunt Pub. |year=2004 |isbn=978-0-7872-9969-9 |pages=183–187}}</ref> [[space rock]], [[glam rock]],<ref>{{Cite encyclopedia |title=Glam Rock |url=http://encarta.msn.com/dictionary_561509274/glam_rock.html |access-date=21 December 2008 |archive-url=https://web.archive.org/web/20090828224412/http://encarta.msn.com/dictionary_561509274/glam_rock.html |archive-date=28 August 2009 |encyclopedia=[[Encarta]]}}</ref> [[Gothic rock]],<ref>{{Cite web |year=2004 |title=NME Originals: Goth |url=https://www.nme.com/originals/4 |archive-url=https://web.archive.org/web/20080126150121/http://www.nme.com/originals/4 |archive-date=26 January 2008 |access-date=30 September 2013 |website=[[NME]]}}</ref> [[psychedelic rock]]<ref>{{Cite web |title=Pop/Rock » Psychedelic/Garage |url=https://www.allmusic.com/subgenre/psychedelic-garage-ma0000002800 |access-date=6 August 2020 |publisher=[[AllMusic]]}}</ref> and [[punk rock]].<ref>{{cite magazine |author1=Charles M. Young |title=Rock is Sick and Living in London |url=https://www.rollingstone.com/feature/a-report-on-the-sex-pistols-119989/ |magazine=Rolling Stone |access-date=23 February 2026 |date=20 October 1977 |archive-url=https://web.archive.org/web/20250328094721/https://www.rollingstone.com/feature/a-report-on-the-sex-pistols-119989/ |archive-date=28 March 2025}}</ref> British acts also developed [[neo soul]] and created [[dubstep]].<ref>Henderson, Alex (1 August 2003). [https://web.archive.org/web/20101104165122/http://allmusic.com/explore/essay/british-soul-t2160 British Soul]. Allmusic. Retrieved 6 March 2011.; [http://www.allmusic.com/style/dubstep-ma0000004465 AllMusic – Dubstep] {{Webarchive|url=https://web.archive.org/web/20170923151236/http://www.allmusic.com/style/dubstep-ma0000004465|date=23 September 2017}} "Absorbed and transfigured elements of techno, drum'n' bass and dub"; {{Cite news |last=Goldman |first=Vivien |date=31 January 2012 |title=Local Groove Does Good: The Story Of Trip-Hop's Rise From Bristol |work=NPR |url=https://www.npr.org/sections/therecord/2012/01/31/142607358/local-groove-does-good-the-story-of-trip-hops-rise-from-bristol}}</ref> The UK has produced some of the most prominent English-speaking [[rappers]] along with the United States, including [[Stormzy]], [[Kano (rapper)|Kano]], [[Yxng Bane]], [[Ramz (rapper)|Ramz]], [[Little Simz]] and [[Skepta]].<ref>{{Cite magazine |title=5 U.K. Rappers Primed to Take Over America in 2018 |url=https://www.billboard.com/music/rb-hip-hop/uk-rappers-to-watch-2018-8097878/ |magazine=Billboard |access-date=18 June 2018}}</ref>
[[File:The SSE Hydro arena - geograph.org.uk - 6725739.jpg|thumb|right|The [[OVO Hydro]] in [[Glasgow]], Scotland, a 14,500-capacity arena consistently ranked within the top ten busiest venues worldwide<ref>{{cite web |title=OVO Hydro {{!}} SEC |url=https://www.sec.co.uk/organise-an-event/event-spaces/the-ovo-hydro |website=www.sec.co.uk |access-date=9 February 2026 |language=en}}</ref>]]
The Beatles have international sales of over 1 billion units and are the [[List of best-selling music artists|biggest-selling band]], in addition to being [[Cultural impact of the Beatles|widely regarded as the most influential band]] in the history of popular music.<ref name="Beatles sales">{{Cite web |title=1960–1969 |url=http://www.emimusic.com/about/history/1960-1969/# |archive-url=https://web.archive.org/web/20140425011032/http://www.emimusic.com/about/history/1960-1969 |archive-date=25 April 2014 |access-date=9 March 2015 |publisher=EMI Group}}</ref><ref name="McCartney">{{Cite magazine |date=8 June 1992 |title=Paul At Fifty |url=http://www.time.com/time/magazine/article/0,9171,975715-2,00.html |magazine=Time |location=New York |archive-url=https://web.archive.org/web/20090206120350/http://www.time.com/time/magazine/article/0,9171,975715-2,00.html |archive-date=6 February 2009}}</ref><ref name="Guinness">[https://books.google.com/books?id=rdU1xtIWJz0C Most Successful Group] ''[[The Guinness Book of Records]]'' 1999, p. 230. Retrieved 19 March 2011.</ref><ref>{{Cite news |date=25 November 2010 |title=Beatles a big hit with downloads |work=Belfast Telegraph |url=http://www.belfasttelegraph.co.uk/entertainment/music/news/beatles-a-big-hit-with-downloads-15013117.html |access-date=16 May 2011}}</ref> Other prominent British contributors to popular music over the last 50 years include the Rolling Stones, [[Pink Floyd]], [[Queen (band)|Queen]], [[Led Zeppelin]], the [[Bee Gees]] and [[Elton John]], all of whom have worldwide record sales of 200 million or more.<ref>{{Cite press release |title=British rock legends get their own music title for PlayStation3 and PlayStation2 |date=2 February 2009 |publisher=[[EMI]] |url=http://www.emimusic.com/news/2009/singstar®-queen-to-be-launched-by-sony-computer-entertainment-europe |access-date=9 March 2015 |archive-url=https://web.archive.org/web/20140423012539/http://www.emimusic.com/news/2009/singstar%C2%AE-queen-to-be-launched-by-sony-computer-entertainment-europe |archive-date=23 April 2014}}; {{Cite news |last=Khan |first=Urmee |date=17 July 2008 |title=Sir Elton John honoured in Ben and Jerry ice cream |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/news/newstopics/celebritynews/2305273/Sir-Elton-John-honoured-in-Ben-and-Jerry-ice-cream.html |archive-url=https://web.archive.org/web/20080730164432/http://www.telegraph.co.uk/news/newstopics/celebritynews/2305273/Sir-Elton-John-honoured-in-Ben-and-Jerry-ice-cream.html |archive-date=30 July 2008}}; {{Cite news |last=Alleyne |first=Richard |date=19 April 2008 |title=Rock group Led Zeppelin to reunite |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/news/uknews/1562875/Rock-group-Led-Zeppelin-to-reunite.html |url-status=live |url-access=subscription |access-date=31 March 2010 |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/news/uknews/1562875/Rock-group-Led-Zeppelin-to-reunite.html |archive-date=10 January 2022}}{{Cbignore}}; {{Cite news |date=11 July 2006 |title=Floyd 'true to Barrett's legacy' |work=BBC News |url=http://news.bbc.co.uk/1/hi/entertainment/5170644.stm}}; {{Cite news |last=Holton |first=Kate |date=17 January 2008 |title=Rolling Stones sign Universal album deal |work=Reuters |url=https://www.reuters.com/article/entertainmentNews/idUSL1767761020080117 |access-date=26 October 2008}}; {{Cite news |last=Walker |first=Tim |date=12 May 2008 |title=Jive talkin': Why Robin Gibb wants more respect for the Bee Gees |work=Independent |location=London |url=https://www.independent.co.uk/arts-entertainment/music/features/jive-talkin-why-robin-gibb-wants-more-respect-for-the-bee-gees-826116.html |access-date=26 October 2008 |archive-url=https://web.archive.org/web/20111013215157/http://www.independent.co.uk/arts-entertainment/music/features/jive-talkin-why-robin-gibb-wants-more-respect-for-the-bee-gees-826116.html |archive-date=13 October 2011}}</ref> The [[Brit Awards]] are the [[British Phonographic Industry|BPI]]'s annual music awards, and some of the British recipients of the [[Brit Award for Outstanding Contribution to Music|Outstanding Contribution to Music]] award include [[the Who]], [[David Bowie]], [[Eric Clapton]], [[Rod Stewart]], [[the Police]] and [[Fleetwood Mac]] (who are a British-American band).<ref>[https://www.theguardian.com/news/datablog/2012/feb/22/brit-awards-winners-list-2012 "Brit awards winners list 2012: every winner since 1977"]. ''The Guardian'' (London). Retrieved 28 February 2012.</ref> <!-- Please note that the following list of recent musicians and groups includes only those selling more than 30 million records. -->More recent UK music acts that have had international success include [[George Michael]], [[Oasis (band)|Oasis]], [[Spice Girls]], [[Radiohead]], [[Coldplay]], [[Arctic Monkeys]], [[Robbie Williams]], [[Amy Winehouse]], [[Susan Boyle]], [[Adele]], [[Ed Sheeran]], [[Lewis Capaldi]], [[One Direction]], [[Harry Styles]] and [[Dua Lipa]].<ref>{{Cite web |date=12 January 2020 |title=Harry Styles Has Weathered the Post-Boy Band Storm Better Than Most |url=https://consequence.net/2020/01/harry-styles-solo-career/ |access-date=15 September 2020 |website=Consequence of Sound}}; {{Cite magazine |date=16 July 2020 |title=10 Years of One Direction: The Story of the World's Biggest Boy Band, Told With the Fans Who Made It Happen |magazine=Billboard |url=https://www.billboard.com/music/pop/one-direction-ten-year-anniversary-fan-interviews-9419436/ |access-date=15 September 2020}}; {{Cite news |last=Corner, Lewis |date=16 February 2012 |title=Adele, Coldplay biggest-selling UK artists worldwide in 2011 |work=Digital Spy |url=http://www.digitalspy.co.uk/music/news/a366130/adele-coldplay-biggest-selling-uk-artists-worldwide-in-2011.html |access-date=22 March 2012}}; {{Cite web |title=Ed Sheeran's career journey: From street busker to global superstar |url=https://planetradio.co.uk/hits-radio/entertainment/celebrity/ed-sheeran-career-timeline/ |access-date=7 January 2023 |website=PlanetRadio.co.uk |last=Magliola |first=Anna Sky |date=30 November 2022}}; {{Cite web |url=https://open.spotify.com/artist/6M2wZ9GZgrQXHCFfjv46we |title=Dua Lipa, 77.5M Monthly listeners |date=6 May 2024 |publisher=Spotify}}</ref> As of 2024 the UK is the world's [[List of largest music markets|third-largest music market]] behind the US and Japan,<ref>{{Cite web |last=Paine |first=Andre |date=10 September 2024 |title=IFPI report reveals EU risks falling behind in global market - UK still among top music exporters |url=https://www.musicweek.com/labels/read/ifpi-report-reveals-eu-risks-falling-behind-in-global-market-uk-still-among-top-music-exporters/090424 |access-date=17 November 2025 |website=[[Music Week]] |language=en}}</ref> and in 2021 was the second-largest exporter of music behind the US.<ref>{{Cite news |last=Savage |first=Mark |date=16 June 2021 |title=British music exports reach a record high |url=https://www.bbc.com/news/entertainment-arts-57486272 |access-date=17 November 2025 |work=[[BBC]] |language=en-GB}}</ref>
Many British cities are known for their music. Acts from Liverpool have had 54 UK chart number 1 hit singles, more per capita than any other city worldwide.<ref>{{Cite news |last=Hughes |first=Mark |date=14 January 2008 |title=A tale of two cities of culture: Liverpool vs Stavanger |work=Independent |location=London |url=https://www.independent.co.uk/news/uk/this-britain/a-tale-of-two-cities-of-culture-liverpool-vs-stavanger-770076.html?r=RSS |access-date=2 August 2009 |archive-url=https://web.archive.org/web/20180618175425/https://www.independent.co.uk/news/uk/this-britain/a-tale-of-two-cities-of-culture-liverpool-vs-stavanger-770076.html?r=RSS |archive-date=18 June 2018}}</ref> Glasgow's contribution was recognised in 2008 when it was named a [[City of Music (UNESCO)|City of Music]] by [[UNESCO]].<ref>{{Cite news |date=20 August 2008 |title=Glasgow gets city of music honour |work=BBC News |url=http://news.bbc.co.uk/1/hi/scotland/glasgow_and_west/7570915.stm |access-date=2 August 2009}}</ref> Manchester played a role in the spread of dance music such as [[acid house]], and from the mid-1990s, [[Britpop]]. London and Bristol are closely associated with the origins of [[electronic music]] sub-genres such as [[drum and bass]] and [[trip hop]].<ref>{{Cite web |title=Out of the melting pot: The origins and evolution of drum'n'bass |url=https://www.redbull.com/gb-en/history-of-drum-and-bass-music |access-date=1 August 2021 |website=Red Bull |date=25 June 2020}}</ref>
UK dance music traces its roots back to the black British [[Sound system (Jamaican)|Sound System Culture]] and the [[New Age travellers|New Age Traveller]] movement of the 60s and 70s,<ref>{{Cite web |date=3 August 2023 |title=Parties, protest and police: the neglected histories of UK dance music |url=https://www.dazeddigital.com/music/article/60511/1/ed-gillet-new-book-party-lines-politics-history-uk-dance-music-clubbing |access-date=27 February 2024 |website=Dazed}}</ref> it also has influences from the [[House music|Chicago House]] and [[Detroit techno|Detroit Techno]] scenes. In the late 1980s, dance music exploded with [[Rave]] culture mainly [[Acid House]] tracks which were made mainstream with novelty records (such as Smart E's [[Sesame's Treet]] and the Prodigy's [[Charly (song)|Charly]])<ref>{{Cite web |date=20 January 2001 |title=Rave |url=https://www.oxfordmusiconline.com/search?q=rave |access-date=27 February 2024 |website=Oxford Music Online}}</ref> and the [[Balearic beat|Balearic sound]] brought back from the Ibiza club scene. This led on to genres such as [[UK Garage]], [[Speed Garage]], [[Drum and bass]], [[Jungle music|Jungle]], [[Trance music|Trance]], and [[Dubstep]]. Influential UK dance acts past and present include [[808 State]], [[Orbital (band)|Orbital]], [[the Prodigy]], [[Underworld (band)|Underworld]], [[Roni Size]], [[Leftfield]], [[Massive Attack]], [[Groove Armada]], [[Fatboy Slim]], [[Faithless]], [[Basement Jaxx]], [[Chemical Brothers]], [[Disclosure (band)|Disclosure]], [[Calvin Harris]], and [[Fred Again]].<ref>{{Cite web |title=Mixmag's Greatest Dance Act of all Time Revealed |date=19 January 2012 |url=http://www.mixmag.net/words/news/mixmags-greatest-dance-act-revealed |archive-date=14 April 2012 |archive-url=https://web.archive.org/web/20120414045620/http://www.mixmag.net/words/news/mixmags-greatest-dance-act-revealed}};{{Cite web |date=26 February 2024 |title=Fred Again: who is the DJ who has thousands queuing for a 'secret rave' at the Sydney Opera House? |url=https://www.theguardian.com/music/2024/feb/27/fred-again-dj-sydney-opera-house-secret-show-tickets-sell-out-profile-bio-details |access-date=27 February 2024 |website=The Guardian}}</ref> Other influential UK DJs include [[Judge Jules]], [[Pete Tong]], [[Carl Cox]], [[Paul Oakenfold]], [[John Digweed]] and [[Sasha (dj)|Sasha]].<ref>{{Cite web |title=Top 100 DJs Poll results 2003 |url=http://djmag.com/top100chart.asp |archive-date=7 December 2003 |archive-url=https://web.archive.org/web/20031207071739/http://djmag.com/top100chart.asp}}</ref>
=== Cinema ===
{{Main|Cinema of the United Kingdom|Independent cinema in the United Kingdom}}
The United Kingdom has had a considerable influence on the history of the cinema. The British directors [[Alfred Hitchcock]], whose film ''[[Vertigo (film)|Vertigo]]'' is considered by some critics as the [[List of films considered the best|best film of all time]],<ref>{{Cite news |date=2 August 2012 |title=Vertigo is named 'greatest film of all time' |work=BBC News |url=https://www.bbc.co.uk/news/entertainment-arts-19078948 |access-date=18 August 2012}}</ref> and [[David Lean]], who directed ''[[Lawrence of Arabia (film)|Lawrence of Arabia]]'', are amongst the most critically acclaimed directors ever.<ref>{{Cite web |title=The Directors' Top Ten Directors |url=http://www.bfi.org.uk/sightandsound/topten/poll/directors-directors.html |url-status=dead |archive-url=https://web.archive.org/web/20120517155218/http://www.bfi.org.uk/sightandsound/topten/poll/directors-directors.html |archive-date=17 May 2012 |publisher=British Film Institute}}</ref> Recent popular directors include [[Christopher Nolan]], [[Sam Mendes]], [[Steve McQueen (director)|Steve McQueen]], [[Richard Curtis]], [[Danny Boyle]], [[Tony Scott]] and [[Ridley Scott]].<ref>{{Cite web |title=The 24 Best British Directors of All Time |date=13 May 2023 |url=https://movieweb.com/best-british-directors-of-all-time/ |access-date=17 February 2024 |publisher=Movieweb}}</ref><ref>{{Cite web |title=Top 22 U.K. Film Directors |url=https://www.imdb.com/list/ls062383258/ |access-date=17 February 2024 |publisher=IMDb}}</ref><ref>{{Cite web |title=5 of the best ... Richard Curtis films |url=https://www.thetimes.com/culture/tv-radio/article/5-of-the-best-richard-curtis-films-tzxx9fv2h |work=The Times |access-date=4 June 2024 |date=17 April 2024}}</ref><ref>{{Cite web |title=The UK's top 50 film directors |date=23 May 2012 |url=https://www.televisual.com/news/the-uk-s-top-50-film-directors_bid-357/ |access-date=17 February 2024 |publisher=Televisual}}</ref> Many British actors have achieved international fame and critical success. Some of the most commercially successful films have been produced in the United Kingdom, including two of the [[List of highest-grossing film series|highest-grossing film franchises]] (''[[Harry Potter (film series)|Harry Potter]]'' and ''[[James Bond (film series)|James Bond]]'').<ref>{{Cite news |date=11 September 2007 |title=Harry Potter becomes highest-grossing film franchise |work=The Guardian |location=London |url=https://www.theguardian.com/film/2007/sep/11/jkjoannekathleenrowling |access-date=2 November 2010}}</ref>
2019 was a particularly good year for British films which grossed around £10.3 billion globally, accounting for 28.7 per cent of global box office revenue.<ref>{{Cite web |title=UK Film Industry Statistics 2023 |date=10 April 2023 |url=https://www.socialfilms.co.uk/blog/uk-film-industry-statistics |archive-url=https://web.archive.org/web/20240217211749/https://www.socialfilms.co.uk/blog/uk-film-industry-statistics |archive-date=17 February 2024 |access-date=17 February 2024}}</ref> UK box-office takings totalled £1.25 billion in 2019, with around 176 million admissions.<ref>{{Cite web |title=The UK box office in 2019 |url=https://www2.bfi.org.uk/sites/bfi.org.uk/files/downloads/bfi-uk-box-office-2019.pdf |archive-url=https://web.archive.org/web/20240217214846/https://www2.bfi.org.uk/sites/bfi.org.uk/files/downloads/bfi-uk-box-office-2019.pdf |archive-date=17 February 2024 |access-date=17 February 2024}}</ref> In 2023 UK film and television studio stage space stood at 6.9 million sq ft, with 1 million sq ft added in the past year with more in development.<ref>{{Cite web |title=UK Film and Television Studios Market Report |url=https://content.knightfrank.com/research/2439/documents/en/uk-film-and-television-studios-market-2023-10567.pdf |access-date=17 February 2024 |publisher=Knight Frank}}</ref> The annual [[British Academy Film Awards|BAFTA Film Awards]] are hosted by the [[British Academy of Film and Television Arts]].<ref>{{Cite news |date=26 February 2001 |title=Baftas fuel Oscars race |work=BBC News |url=http://news.bbc.co.uk/1/hi/entertainment/1190562.stm |access-date=14 February 2011}}</ref>
=== Cuisine ===
{{Main|British cuisine}}
{{Further|English cuisine|Scottish cuisine|Welsh cuisine|Northern Irish cuisine}}
[[File:Fish, chips and mushy peas.jpg|thumb|[[Fish and chips]], a traditional British dish, served with lemon, tartar sauce and mushy peas]]
British cuisine developed from influences reflective of its land, settlements, [[Immigration to the United Kingdom|arrivals of new settlers and immigrants]], trade and colonialism. The food of England has historically been characterised by simplicity of approach and a reliance on the high quality of natural produce.<ref>{{Cite book |last=Else |first=David |title=Inghilterra |publisher=EDT srl |date=2007 |isbn=978-88-6040-136-6 |page=76}}</ref> The traditional [[Sunday roast]] is one example, featuring a [[roasting|roast joint]] (usually of beef), lamb, chicken, or pork, often [[free range]] (and generally grass-fed, in the case of beef). Roasts are served with either roasted or boiled vegetables, [[Yorkshire pudding]] and [[gravy]]. Other traditional meals include [[meat pie]]s and [[stew]]s. A poll by [[YouGov]] in 2019 rated classic British food, with more than 80 per cent liking the Sunday roast, Yorkshire pudding, [[fish and chips]], [[crumpet]]s and the [[full English breakfast]].<ref>{{Cite web |url=https://yougov.co.uk/topics/consumer/articles-reports/2019/06/12/classic-british-cuisine-ranked-britons |date=11 June 2019 |title=Classic British cuisine ranked by Britons }}{{Dead link|date=May 2026 |bot=InternetArchiveBot }}</ref>
The UK is home to a large selection of [[fine dining]]. The nation hosts multiple restaurant guides such as ''[[The Good Food Guide]]'' and ''[[Harden's]]''. In 2025 there were 197 restaurants with a [[Michelin Star]]; [[List of Michelin 3-star restaurants in the United Kingdom|ten of which have received a three-star rating]].<ref>{{cite web |url=https://guide.michelin.com/en/gb/restaurants/all-starred |title=United Kingdom |publisher=Michelin Guide |access-date=12 May 2025}}</ref> Sweet foods are common within British cuisine, and there is a long list of [[List of British desserts|British desserts]]. Afternoon tea is a light afternoon meal served with tea in tea rooms and hotels around the United Kingdom, with the tradition dating back to around 1840.<ref>{{Cite web |title=The tea-rific history of Victorian afternoon tea |work=The British Museum |url=https://www.britishmuseum.org/blog/tea-rific-history-victorian-afternoon-tea |access-date=11 April 2023}}</ref> A poll from July 2024 revealed that 3 per cent of the UK population follow a [[vegan]] diet, 6 per cent are [[vegetarian]], and 13 per cent identify as [[flexitarian]] (following a mainly vegetarian diet).<ref>{{Cite web |title=Dietary choices of Brits (e.g. vegeterian, flexitarian, meat-eater etc) |url=https://yougov.co.uk/topics/society/trackers/dietery-choices-of-brits-eg-vegeterian-flexitarian-meat-eater-etc |access-date=26 November 2024 |date=8 July 2024 |website=YouGov.co.uk}}</ref> The British Empire facilitated knowledge of [[Indian cuisine]] with its "strong, penetrating spices and herbs". British cuisine has absorbed the cultural influence of those who have settled in Britain, producing hybrid dishes, such as [[chicken tikka masala]].<ref>{{Cite news |date=19 April 2001 |title=Robin Cook's chicken tikka masala speech |work=The Guardian |location=London |url=https://www.theguardian.com/world/2001/apr/19/race.britishidentity |access-date=7 September 2021}}; {{Cite news |last=BBC E-Cyclopedia |date=20 April 2001 |title=Chicken tikka masala: Spice and easy does it |publisher=BBC |url=http://news.bbc.co.uk/1/hi/special_report/1999/02/99/e-cyclopedia/1285804.stm |access-date=28 September 2007}}</ref>
The UK has many [[gastropub]]s and is the birthplace of many alcoholic drinks including several beer styles such as [[pale ale]], [[India pale ale]], [[bitter (beer)|bitter]], [[brown ale]], [[porter (beer)|porter]], and [[stout]]. The number of [[craft beer]]s and microbreweries has expanded rapidly in the last two decades.<ref>{{Cite web |title=A guide to British Beer |url=https://www.expatica.com/uk/lifestyle/food-drink/british-beer-469903/ |access-date=25 November 2024 |website=Expatica}}</ref> Other popular alcoholic drinks produced in the UK include [[Scotch whisky]], [[Wine from the United Kingdom|English wine]], [[gin]], [[perry]] and [[cider]].
=== Sport ===
{{Main|Sport in the United Kingdom|Great Britain at the Olympics}}
{{Further|Sport in England|Sport in Scotland|Sport in Wales|Sport in Northern Ireland}}
[[File:City vs United FA Cup final 2023.jpg|thumb|right|The [[2023 FA Cup final]] at [[Wembley Stadium]] between [[Manchester City]] and [[Manchester United]]]]
[[File:Old 18th tee lr.jpg|thumb|right|Golf originated from the [[Old Course at St Andrews]] in Scotland.]]
[[Association football]], [[tennis]], [[table tennis]], [[badminton]], [[rugby union]], [[rugby league]], [[rugby sevens]], [[golf]], [[boxing]], [[netball]], [[water polo]], [[field hockey]], [[English billiards|billiards]], [[darts]], [[Rowing (sport)|rowing]], [[rounders]] and [[cricket]] originated or were substantially developed in the UK, with the rules and codes of many modern sports invented and codified in the Victorian era.{{efn|In 2012, the president of the IOC, [[Jacques Rogge]], stated, "This great, sports-loving country is widely recognised as the birthplace of modern sport. It was here that the concepts of sportsmanship and fair play were first codified into clear rules and regulations. It was here that sport was included as an educational tool in the school curriculum."<ref>{{Cite web |url=http://www.olympic.org/Documents/Games_London_2012/London_2012_Opening_ceremony_Speech_Jacques_Rogge.pdf |title=Opening Ceremony of the Games of the XXX Olympiad |website=Olympic.org |access-date=30 November 2013 |date=27 July 2012 |archive-date=19 August 2013 |archive-url=https://web.archive.org/web/20130819135346/http://www.olympic.org/Documents/Games_London_2012/London_2012_Opening_ceremony_Speech_Jacques_Rogge.pdf |url-status=dead}}</ref><ref>{{Cite web |url=http://uk.reuters.com/article/uk-oly-preview-ad-idUKBRE86M0I720120723 |title=Unparalleled Sporting History |work=Reuters |access-date=30 November 2013 |last=Mehaffey |first=John |location=London |archive-date=25 May 2017 |archive-url=https://web.archive.org/web/20170525164121/http://uk.reuters.com/article/uk-oly-preview-ad-idUKBRE86M0I720120723 |url-status=dead}}</ref>}}
A poll in 2003 found that football is the most popular sport in the UK.<ref name="sports poll">{{Cite web |date=22 December 2003 |title=Rugby Union 'Britain's Second Most Popular Sport' |url=http://www.ipsos-mori.com/researchpublications/researcharchive/928/Rugby-Union-Britains-Second-Most-Popular-Sport.aspx |access-date=28 April 2013 |publisher=Ipsos-Mori}}</ref> England is recognised by [[FIFA]] as the birthplace of club football, and the [[Football Association]] is the oldest of its kind, with the [[Laws of the Game (association football)|rules of football]] first drafted in 1863 by [[Ebenezer Cobb Morley]].<ref>{{Cite news |last=Rudd |first=Alyson |date=7 April 2008 |title=The father of football deserves much more |work=The Times |location=London |url=http://www.timesonline.co.uk/tol/sport/football/article3694775.ece |url-access=subscription |access-date=29 January 2015 |archive-date=4 June 2011 |archive-url=https://web.archive.org/web/20110604183514/http://www.timesonline.co.uk/tol/sport/football/article3694775.ece |url-status=dead}}; {{Cite web |date=24 October 2007 |title=Sheffield FC: 150 years of history |url=https://www.fifa.com/worldfootball/clubfootball/news/newsid=621801.html |archive-url=https://web.archive.org/web/20071025033006/http://www.fifa.com/worldfootball/clubfootball/news/newsid=621801.html |archive-date=25 October 2007 |access-date=29 January 2015 |publisher=[[FIFA]]}}</ref> Each of the [[Home Nations]] (England, Scotland, Wales and Northern Ireland) has its own football association, national team and [[league system]], and each is individually a governing member of the [[International Football Association Board]] alongside FIFA. The English top division, the [[Premier League]], is the most watched football league in the world.<ref>{{Cite news |last=Ebner |first=Sarah |date=2 July 2013 |title=History and time are key to power of football, says Premier League chief |work=The Times |location=London |url=http://www.thetimes.co.uk/tto/public/ceo-summit/article3804923.ece |url-access=subscription |access-date=30 November 2013}}</ref> The first international football match was contested by [[England national football team|England]] and [[Scotland national football team|Scotland]] on 30 November 1872.<ref>{{Cite web |last=Mitchell, Paul |author-link=Paul Mitchell (broadcaster) |date=November 2005 |title=The first international football match |url=https://www.bbc.co.uk/scotland/sportscotland/asportingnation/article/0012/index.shtml |access-date=15 December 2013 |publisher=BBC Sport Scotland}}</ref> England, Scotland, [[Wales national football team|Wales]] and [[Northern Ireland national football team|Northern Ireland]] usually compete as separate countries in international competitions.<ref>{{Cite news |last=Harlow |first=Phil |date=5 August 2008 |title=Why is there no GB Olympics football team? |work=[[BBC Sport]] |url=http://news.bbc.co.uk/sport1/hi/olympics/football/7529807.stm |access-date=31 December 2010}}</ref>
In 2003 rugby union was ranked the second-most-popular sport in the UK.<ref name="sports poll" /> The sport was created in [[Rugby School]], Warwickshire, and the [[1871 England versus Scotland rugby union match|first rugby international]] took place on 27 March 1871 between [[England national rugby union team|England]] and [[Scotland national rugby union team|Scotland]].<ref>{{Cite web |url=https://www.bbc.co.uk/news/uk-england-coventry-warwickshire-25946757 |title=Six ways the town of Rugby helped change the world |work=BBC News |access-date=29 January 2015 |date=1 February 2014}}</ref><ref>{{Cite book |last1=Godwin |first1=Terry |last2=Rhys |first2=Chris |year=1981 |title=The Guinness Book of Rugby Facts & Feats |page=10 |publisher=Guinness Superlatives |isbn=978-0-85112-214-4}}</ref> England, Scotland, [[Wales national rugby union team|Wales]], [[Ireland national rugby union team|Ireland]], [[France national rugby union team|France]] and [[Italy national rugby union team|Italy]] compete in the [[Six Nations Championship]], the premier international rugby union tournament in the northern hemisphere. [[Sports governing bodies]] in [[Rugby union in England|England]], [[Rugby union in Scotland|Scotland]], [[Rugby union in Wales|Wales]] and [[Rugby union in Ireland|Ireland]] organise and regulate the game separately.<ref>{{Cite book |last1=Louw, Jaco |url=https://books.google.com/books?id=0-IiowvNomMC&pg=PA95 |title=The Girlfriends Guide to Rugby |last2=Nesbit, Derrick |publisher=South Publishers |year=2008 |isbn=978-0-620-39541-0 |location=Johannesburg}}</ref> Every four years the Home Nations make a combined team known as the [[British and Irish Lions]] which tours Australia, New Zealand and South Africa.
The United Kingdom hosted the [[Summer Olympic Games]] in [[1908 Summer Olympics|1908]], [[1948 Summer Olympics|1948]] and [[2012 Summer Olympics|2012]], with London acting as the host city on all three occasions. Birmingham hosted the [[2022 Commonwealth Games]], the seventh time a country of the United Kingdom hosted the [[Commonwealth Games]] (England, Scotland and Wales have each hosted the Commonwealth Games at least once).<ref>{{Cite news |title=The journey of India in Commonwealth Games in 2022 |work=The Times of India |url=https://timesofindia.indiatimes.com/readersblog/allaboutsports/the-journey-of-india-in-commonwealth-games-in-2022-44477/ |access-date=29 June 2023}}</ref>
=== Symbols ===
{{Main|Symbols of the United Kingdom, the Channel Islands and the Isle of Man|l1 = Symbols of the United Kingdom}}
[[File:Queen Elizabeth II Platinum Jubilee 2022 - Platinum Pageant (52123378222).jpg|thumb|Union Jack flags on [[The Mall, London|The Mall]], London]]
The [[flag of the United Kingdom]] is the [[Union Flag]], which is also referred to as the Union Jack.<ref>{{Cite web |title=Union Jack or Union Flag? |url=https://www.flaginstitute.org/wp/uk-flags/the-union-jack-or-the-union-flag |access-date=26 September 2022 |website=The Flag Institute}}</ref> It was created in 1606 by the superimposition of the [[flag of England]], representing [[Saint George]], on the [[flag of Scotland]], representing [[Saint Andrew]], and was updated in 1801 with the addition of [[Saint Patrick's Flag]].<ref>{{Cite web |title=college-of-arms.gov.uk |url=https://www.college-of-arms.gov.uk/resources/union-flag-approved-designs |access-date=14 January 2022 |publisher=The College of Arms}}</ref> Wales is not represented in the Union Flag, as Wales had been conquered and [[annexed]] to England prior to the formation of the United Kingdom. The possibility of redesigning the Union Flag to include representation of Wales was discussed in 2007.<ref>{{Cite news |date=27 November 2007 |title=Welsh dragon call for Union flag |work=BBC News |url=http://news.bbc.co.uk/1/hi/uk/7114248.stm |access-date=17 October 2008}}</ref> The [[national anthem]] of the United Kingdom is "[[God Save the King]]", with "King" replaced with "Queen" in the lyrics whenever the monarch is a woman.
[[National symbols of England|England]], [[National symbols of Wales|Wales]] and [[National symbols of Scotland|Scotland]] each have their own national symbols, including their national flags. [[National symbols of Northern Ireland|Northern Ireland]] also has symbols, [[National symbols of Ireland, the Republic of Ireland and Northern Ireland|many of which are shared]] with the [[Republic of Ireland]], but has no official flag<ref name="minahan">{{cite book |last=Minahan |first=James |url=https://books.google.com/books?id=jfrWCQAAQBAJ |title=The Complete Guide to National Symbols and Emblems |publisher=ABC-CLIO |year=2009 |isbn=9780313344978 |page=486 |quote=The official flag of the province is the Union Flag. There is no official national flag of Northern Ireland, following the Northern Ireland Constitution Act of 1973, nor any unofficial flag universally accepted in Northern Ireland. |access-date=23 September 2020 |archive-url=https://web.archive.org/web/20241203090220/https://books.google.com/books?id=jfrWCQAAQBAJ |archive-date=3 December 2024 |url-status=live}}</ref>. Beside [[the Lion and the Unicorn]] and the [[Welsh Dragon]] of heraldry, the [[bulldog]] is also used and commonly represented with the Union Flag.<ref>{{Cite book |last=Baker |first=Steve |title=Picturing the Beast |publisher=University of Illinois Press |year=2001 |isbn=978-0-252-07030-3 |page=52}}</ref> Great Britain, rather than the United Kingdom as a whole, also has [[national personification|personifications]] representing it, two of which are [[Britannia]]<ref>{{Cite web |title=Britannia on British Coins |url=http://www.24carat.co.uk/britanniaframe.html |access-date=25 June 2006 |publisher=Chard}}</ref><ref name="Collins">{{cite dictionary|url=https://www.collinsdictionary.com/dictionary/english/britannia|dictionary=Collins Dictionary|title=Britannia|accessdate=14 February 2021}}</ref> and [[John Bull]].<ref>{{Cite web |last=<!--Not stated--> |title=Who is John Bull |url=https://www.loc.gov/wiseguide/jan04/johnbull.html |access-date=11 January 2022 |publisher=The Library of Congress}}</ref>
== See also ==
{{Portal|United Kingdom|England|Northern Ireland|Scotland|Wales}}
* [[Outline of the United Kingdom]]
** [[Outline of England]]
** [[Outline of Northern Ireland]]
** [[Outline of Scotland]]
** [[Outline of Wales]]
* [[Historiography of the United Kingdom]]
== Notes ==
{{Notelist}}
== References ==
{{Reflist}}
== External links ==
{{Sister project links|auto=yes}}
* [https://www.bbc.co.uk/news/world-europe-18023389 United Kingdom] from [[BBC News]]
* [https://web.archive.org/web/20260118175542/https://www.cia.gov/the-world-factbook/countries/united-kingdom/ United Kingdom]. ''[[The World Factbook]]''. [[Central Intelligence Agency]].
* [https://web.archive.org/web/20090406224510/http://ucblibraries.colorado.edu/govpubs/for/british.htm United Kingdom] from ''UCB Libraries GovPubs'' (archived 6 April 2009)
* {{Wikiatlas|United Kingdom}}
* {{OSM relation|62149}}
* [http://www.ifs.du.edu/ifs/frm_CountryProfile.aspx?Country=GB Key Development Forecasts for the United Kingdom] from [[International Futures]]
=== Government ===
* [https://www.gov.uk/ Official website of HM Government]
* [https://www.royal.uk/ Official website of the British Monarchy]
* [https://www.gov.uk/government/organisations/prime-ministers-office-10-downing-street Official website of the British Prime Minister's Office]
=== Travel ===
* [http://www.visitbritain.com/en/ Official tourist guide to Britain]
<!-- Please discuss links on the talk page before adding them to this list – remember to read the WP:EL guideline.-->
{{United Kingdom topics}}
{{Navboxes
| list =
{{United Kingdom constituents and affiliations}}
{{British Isles}}
{{Sovereign states of Europe}}
{{Commonwealth realms}}
{{English official language clickable map}}
{{The Commonwealth}}
}}
{{Authority control}}
{{Coord|55|N|3|W|type:country_region:GB|display=title}}
[[Category:United Kingdom| ]]
[[Category:British Islands]]
[[Category:Countries in Europe]]
[[Category:Countries and territories where English is an official language]]
[[Category:G20 members]]
[[Category:Island countries]]
[[Category:Member states of NATO]]
[[Category:Member states of the Commonwealth of Nations]]
[[Category:Member states of the Council of Europe]]
[[Category:Member states of the United Nations]]
[[Category:OECD members]]
[[Category:States and territories established in 1707]]
[[Category:States and territories established in 1801]]
[[Category:States and territories established in 1922]]
rroytc0k94zjpuyz1nelpaugut572su
22000
21999
2026-09-18T15:20:18Z
Amire80
9
1 измена увезена из [[:en:United_Kingdom]]: importing from the English Wikipedia
21999
wikitext
text/x-wiki
{{Short description|Country in northwestern Europe}}
{{Hatnote|"UK" redirects here. For other uses, see [[UK (disambiguation)]] and [[United Kingdom (disambiguation)]]. Not to be confused with [[England]] or [[Great Britain]].}}
{{pp-sock|small=yes}}
{{pp-move|small=yes}}
{{Use British English|date=April 2012}}
{{Use dmy dates|date=September 2026}}
{{Infobox country
| common_name = United Kingdom
| linking_name = the United Kingdom<!--Note: "the" required here as this entry used to create wikilinks-->
| conventional_long_name = United Kingdom of Great Britain and Northern Ireland
| image_flag = Flag of the United Kingdom (1-2).svg
| flag_type = [[Union Jack|Flag]]
| alt_flag = A flag composed of a red cross edged in white and superimposed on a red saltire, also edged in white, superimposed on a white saltire on a blue background
| image_coat =
| other_symbol = [[File:Coat of arms of the United Kingdom (2022, both variants).svg|250px]]<br />Used in relation to [[Scotland]] (right) and elsewhere (left)
| other_symbol_type = [[Coat of arms of the United Kingdom|Coat of arms]]:
| national_anthem = "[[God Save the King]]"{{Efn|"God Save the King" is the [[national anthem]] by custom, not statute, and there is no authorised version. Typically only the first verse is usually sung, although the second verse is also often sung as well at state and public events.<ref>{{Cite web |title=National Anthem |url=https://www.royal.uk/encyclopedia/national-anthem |access-date=10 April 2024 |website=The Royal Family |archive-date=20 May 2024 |archive-url=https://web.archive.org/web/20240520130352/https://www.royal.uk/encyclopedia/national-anthem |url-status=live}}</ref> The words ''King, he, him, his'', used at present, are replaced by ''Queen, she, her'' when the monarch is female.}}<br /><div style="display:inline-block;margin-top:0.4em;">[[File:United States Navy Band - God Save the Queen.ogg|God Save the King / Queen <!-- Do not change file name due to computer error without ensuring that the file is playable. -->]]</div>
| image_map = {{Switcher|[[File:Europe-UK (orthographic projection).svg|upright=1.15|frameless]]|Show globe|[[File:Europe-UK.svg|upright=1.15|frameless]]|Show map of Europe|[[File:United Kingdom (+overseas territories and crown dependencies) in the World (+Antarctica claims).svg|upright=1.15|frameless]]|Show [[British Overseas Territories]] and [[Crown Dependencies]]|[[File:Territorial waters - United Kingdom.svg|upright=1.15|frameless]]|Show [[Exclusive economic zone of the United Kingdom|their exclusive economic zones]]|default=1}}
| map_caption =
| capital = [[London]]
| coordinates = {{Coord|51|30|N|0|7|W|type:city(9,100,000)_region:GB-LND}}
| largest_city = capital
| languages_type = [[National language]]
| languages = [[English language|English]] <!--Note: Just English, don't add "British English".-->
| languages2_type = Regional and minority languages{{Efn|Scots, Ulster Scots, Welsh, Cornish, Scottish Gaelic and Irish are classed as [[Regional language|regional]] or [[Minority language|minority]] languages under the [[Council of Europe]]'s [[European Charter for Regional or Minority Languages]].<ref name="reglang">{{Cite web |title=List of declarations made with respect to treaty No. 148 |url=http://conventions.coe.int/treaty/Commun/ListeDeclarations.asp?CL=ENG&NT=148&VL=1 |access-date=12 December 2013 |publisher=[[Council of Europe]] |archive-date=12 December 2013 |archive-url=https://web.archive.org/web/20131212175720/http://conventions.coe.int/treaty/Commun/ListeDeclarations.asp?CL=ENG&NT=148&VL=1 |url-status=dead}}</ref> These include defined obligations to promote those languages.<ref>{{Cite web |title=Welsh language on GOV.UK – Content design: planning, writing and managing content – Guidance |url=https://www.gov.uk/guidance/content-design/welsh-language-on-gov-uk |access-date=3 August 2018 |website=gov.uk |archive-date=4 August 2018 |archive-url=https://web.archive.org/web/20180804014121/https://www.gov.uk/guidance/content-design/welsh-language-on-gov-uk |url-status=live |postscript=;}} {{Cite news |title=Welsh language scheme |work=GOV.UK |url=https://www.gov.uk/government/organisations/department-for-transport/about/welsh-language-scheme |access-date=3 August 2018 |archive-date=4 August 2018 |archive-url=https://web.archive.org/web/20180804014119/https://www.gov.uk/government/organisations/department-for-transport/about/welsh-language-scheme |url-status=live |postscript=;}} {{Cite news |title=Welsh language scheme |work=GOV.UK |url=https://www.gov.uk/government/organisations/home-office/about/welsh-language-scheme |access-date=3 August 2018 |archive-date=2 August 2018 |archive-url=https://web.archive.org/web/20180802010917/https://www.gov.uk/government/organisations/home-office/about/welsh-language-scheme |url-status=live}}</ref> See also [[Languages of the United Kingdom]]. Welsh has limited ''[[de jure]]'' official status in Wales, as well as in the provision of national government services provided for Wales.}}
| languages2 = {{Hlist
<!--Anglic-->
| [[Scots language|Scots]]
| [[Ulster Scots dialects|Ulster Scots]]
<!--Brittonic-->
| [[Welsh language|Welsh]]
| [[Cornish language|Cornish]]
<!--Goidelic-->
| [[Scottish Gaelic]]<!--Keep "Scottish Gaelic"; people will find "Gaelic" confusing, as the Irish language is also commonly called "Gaelic"-->
| [[Irish language|Irish]]
<!--BANZSL-->
| [[British Sign Language]]
}}
| ethnic_groups = {{unbulleted list
| 83.1% [[White people in the United Kingdom|White]]
| 8.6% [[British Asian|Asian]]
| 3.7% [[Black British|Black]]
| 2.7% [[Mixed (United Kingdom ethnicity category)|Mixed]]
| 2.0% [[Ethnic groups in the United Kingdom|other]]
}}
| ethnic_groups_year = 2021
| ethnic_groups_ref = {{Efn|name=UK-wide2021|Whereas the censuses of England and Wales and of Northern Ireland went ahead as planned in 2021, the census in Scotland was postponed until 2022. The Office for National Statistics reports that these UK-wide statistics "have been created to provide an image of how UK census data may have looked if the most recent UK censuses had been conducted with an aligned date of 21 March 2021".}}<ref name=Ethnicity2021>{{cite web|url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/censusbasedstatisticsuk2021|title=Table 06: UK06 - Ethnic group by sex by age, United Kingdom|work=Census-based statistics UK: 2021|publisher=Office for National Statistics|date=27 June 2025|access-date=28 March 2026}}</ref>
| religion = {{unbulleted list
| 46.6% [[Religion in the United Kingdom#Christianity|Christianity]]
| 37.6% [[Irreligion in the United Kingdom|no religion]]
| 6.0% [[Islam in the United Kingdom|Islam]]
| 1.6% [[Hinduism in the United Kingdom|Hinduism]]
| 2.2% [[Religion in the United Kingdom|other]]
| 5.9% not stated
}}
| religion_year = 2021
| religion_ref = {{Efn|name=UK-wide2021}}<ref name=Religion2021>{{cite web|url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/censusbasedstatisticsuk2021|title=Table 07: UK07 - Religion by sex by age, United Kingdom|work=Census-based statistics UK: 2021|publisher=Office for National Statistics|date=27 June 2025|access-date=28 March 2026}}</ref>
| demonym = {{hlist |[[British people|British]] |Briton |Brit (colloquial) }}
| government_type = Unitary [[Westminster parliamentary system|parliamentary constitutional monarchy]]{{Efn|Although the United Kingdom has traditionally been seen as a [[unitary state]], an alternative description of the UK as a "union state", put forward by, amongst others, [[Vernon Bogdanor]],<ref>{{Cite book |last=Bradbury |first=Jonathan |url=https://books.google.com/books?id=c3QWEAAAQBAJ&q=%2522union+state%2522+UK+unitary&pg=PA19 |title=Constitutional Policy and Territorial Politics in the UK: Volume 1: Union and Devolution 1997–2012 |date=2021 |publisher=Policy Press |isbn=978-1-5292-0588-6 |pages=19–20 |access-date=3 October 2021 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002204328/https://books.google.com/books?id=c3QWEAAAQBAJ&q=%2522union+state%2522+UK+unitary&pg=PA19#v=onepage&q=%2522union%20state%2522%20UK%20unitary&f=false |url-status=live}}</ref> has become increasingly influential since the adoption of devolution in the 1990s.<ref>{{Cite book |last=Leith |first=Murray Stewart |url=https://books.google.com/books?id=PeBvAAAAQBAJ&q=Uk+%2522unitary+state%2522&pg=PA39 |title=Political Discourse and National Identity in Scotland |date=2012 |publisher=Edinburgh University Press |isbn=978-0-7486-8862-3 |page=39 |access-date=3 October 2021 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002204223/https://books.google.com/books?id=PeBvAAAAQBAJ&q=Uk+%2522unitary+state%2522&pg=PA39#v=onepage&q=Uk%20%2522unitary%20state%2522&f=false |url-status=live}}</ref> A union state is considered to differ from a unitary state in that while it maintains a central authority it also recognises the authority of historic rights and infrastructures of its component parts.<ref>{{Cite book |last1=Gagnon |first1=Alain-G. |url=https://books.google.com/books?id=g0ahE2fTxS0C&q=%2522union+state%2522+UK+unitary&pg=PA47 |title=Multinational Democracies |last2=Tully |first2=James |date=2001 |publisher=Cambridge University Press |isbn=978-0-521-80473-8 |page=47 |access-date=3 October 2021 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002204329/https://books.google.com/books?id=g0ahE2fTxS0C&q=%2522union+state%2522+UK+unitary&pg=PA47#v=onepage&q=%2522union%20state%2522%20UK%20unitary&f=false |url-status=live |postscript=;}} {{Cite book |last=Bogdanor |first=Vernon |title=Constitutional Reform in the United Kingdom: Practice and Principles |date=1998 |publisher=Hart Publishing |isbn=978-1-901362-84-8 |editor-last=Beatson |editor-first=Jack |location=Oxford |page=18 |chapter=Devolution: the Constitutional Aspects |chapter-url=https://books.google.com/books?id=YEEgDsCYmbQC&q=%2522union+state%2522+UK+unitary&pg=PA18}}</ref>}}
| leader_title1 = [[Monarchy of the United Kingdom|Monarch]]
| leader_name1 = [[Charles III]]
| leader_title2 = [[Prime Minister of the United Kingdom|Prime Minister]]
| leader_name2 = [[Andy Burnham]]
| legislature = [[Parliament of the United Kingdom|Parliament]]
| upper_house = [[House of Lords]]
| lower_house = [[House of Commons of the United Kingdom|House of Commons]]
| sovereignty_type = [[Formation of the United Kingdom of Great Britain and Northern Ireland|Formation]]
| established_event1 = [[Laws in Wales Acts 1535 and 1542|Laws in Wales Acts]]
| established_date1 = 1535 and 1542
| established_event2 = [[Union of the Crowns]]
| established_date2 = 24 March 1603
| established_event3 = [[Treaty of Union]]
| established_date3 = 22 July 1706
| established_event4 = [[Acts of Union 1707|Acts of Union of England and Scotland]]
| established_date4 = 1 May 1707
| established_event5 = [[Acts of Union 1800|Acts of Union of Great Britain and Ireland]]
| established_date5 = 1 January 1801
| established_event6 = [[Irish Free State Constitution Act 1922|Irish Free State Constitution Act]]
| established_date6 = 6 December 1922
| area_label = Total{{efn|name=ONSArea|[[Office for National Statistics|ONS]] Standard Area Measurement, 'area to mean high water'. Excludes the [[Crown Dependencies]] and [[British Overseas Territories]].}}
| area_km2 = 244376
| area_footnote = <ref name="ONS Standard Area Measurement">{{cite web |url=https://geoportal.statistics.gov.uk/datasets/ons::standard-area-measurements-for-administrative-areas-december-2023-in-the-uk/about |title=Standard Area Measurements for Administrative Areas (December 2023) in the UK |author=<!--Not stated--> |date=31 May 2024 |website=[[ONS Open Geography Portal|Open Geography Portal]] |publisher=Office for National Statistics |access-date=7 June 2024 |archive-date=7 June 2024 |archive-url=https://web.archive.org/web/20240607052407/https://geoportal.statistics.gov.uk/datasets/ons::standard-area-measurements-for-administrative-areas-december-2023-in-the-uk/about |url-status=live}}</ref>
| area_rank = 78th
| area_sq_mi = auto
| area_label2 = Land{{efn|name=ONSLandArea|[[Office for National Statistics|ONS]] Standard Area Measurement, "area to mean high water excluding inland water". Excludes the [[Crown Dependencies]] and [[British Overseas Territories]].}}
| area_data2 = {{convert|{{UK subdivision area|GSS=K02000001}}|km2|sqmi|abbr=on}}<ref name="ONS mid-year pop est" />
| percent_water =
| population_estimate = {{IncreaseNeutral}} {{UK subdivision population|GSS=K02000001}}<ref name="ONS mid-year pop est">{{UK subdivision statistics citation}}</ref>
| population_estimate_year = {{UK subdivision statistics year}}
| population_estimate_rank = 20th
| population_census = {{IncreaseNeutral}} 66,912,637{{Efn|name=UK-wide2021}}<ref name=Ethnicity2021/>
| population_census_year = 2021
| population_census_rank =
| population_density_km2 = {{UK subdivision density|GSS=K02000001}}
| population_density_sq_mi = auto
| population_density_rank = 48th
| pop_den_footnote = <ref name="ONS mid-year pop est" />
| GDP_PPP = {{increase}} $4.721 trillion<ref name="IMFWEO.UK">{{cite web |url=https://data.imf.org/en/Data-Explorer?datasetUrn=IMF.RES:WEO(9.0.0) |title=World Economic Outlook Database (April 2026 Edition) |publisher=[[International Monetary Fund]] |website=www.imf.org |date=14 April 2026 |access-date=18 April 2026}}</ref>
| GDP_PPP_year = 2026
| GDP_PPP_rank = 10th
| GDP_PPP_per_capita = {{increase}} $67,585<ref name="IMFWEO.UK" />
| GDP_PPP_per_capita_rank = 33rd
| GDP_nominal = {{increase}} $4.265 trillion<ref name="IMFWEO.UK" />
| GDP_nominal_year = 2026
| GDP_nominal_rank = 5th
| GDP_nominal_per_capita = {{increase}} $61,056<ref name="IMFWEO.UK" />
| GDP_nominal_per_capita_rank = 21st
| Gini = 35.4
| Gini_year = 2021
| Gini_change = decrease
| Gini_ref = <ref>{{Cite web |title=Income inequality |url=https://data.oecd.org/inequality/income-inequality.htm |access-date=12 February 2024 |website=OECD Data |publisher=[[OECD]] |archive-date=1 July 2022 |archive-url=https://web.archive.org/web/20220701171540/https://data.oecd.org/inequality/income-inequality.htm |url-status=live}}</ref>
| HDI = 0.946<!--number only-->
| HDI_year = 2023<!-- Please use the year to which the data refers, not the publication year.-->
| HDI_change = increase<!--increase/decrease/steady-->
| HDI_ref = <ref name="UNHDR">{{Cite web |date=6 May 2025 |title=Human Development Report 2025 |url=https://hdr.undp.org/system/files/documents/global-report-document/hdr2025reporten.pdf |url-status=live |archive-url=https://web.archive.org/web/20250506051232/https://hdr.undp.org/system/files/documents/global-report-document/hdr2025reporten.pdf |archive-date=6 May 2025 |access-date=6 May 2025 |publisher=[[United Nations Development Programme]] |language=en}}</ref>
| HDI_rank = 13th
| currency = [[Pound sterling|Sterling]]<!--The currency is simply called 'sterling' (see its article); originally, the penny (not the pound) was the primary unit. Internationally it is known as 'pound sterling' so the familiar unit is mentioned.-->{{Efn|Commonly also known as the "pound" (the name of [[pound (currency)|its base unit]]) or "pound sterling". Some of the devolved countries, [[Crown Dependency|Crown Dependencies]] and [[British Overseas Territory|British Overseas Territories]] issue their own sterling banknotes or currencies, or use another nation's currency. See [[List of British currencies]].}} ([[£]])
| currency_code = GBP
| utc_offset = +0
| time_zone = [[Greenwich Mean Time|GMT]]
| utc_offset_DST = +1
| time_zone_DST = [[British Summer Time|BST]]{{Efn|Also observed by the [[Crown Dependencies]]. For further information, see [[Time in the United Kingdom]].}}
| DST_note =
| date_format = {{Abbr|dd|day}}/{{Abbr|mm|month}}/{{Abbr|yyyy|year}} ([[Anno Domini|AD]]){{efn|The UK Government uses the [[ISO 8601]] format, {{Abbr|yyyy|year}}-{{Abbr|mm|month}}-{{Abbr|dd|day}}, for machine-readable dates and times.<ref>{{cite web |title=Formatting dates and times in data |url=https://www.gov.uk/government/publications/open-standards-for-government/date-times-and-time-stamps-standard |date=9 August 2022 |website=[[gov.uk]] |publisher=[[Government of the United Kingdom|HM Government]] |access-date=1 June 2024 |archive-date=9 May 2024 |archive-url=https://web.archive.org/web/20240509092813/https://www.gov.uk/government/publications/open-standards-for-government/date-times-and-time-stamps-standard |url-status=live}}</ref> See [[Date and time notation in the United Kingdom]].}}
| calling_code = [[Telephone numbers in the United Kingdom|+44]]{{Efn|Excludes most overseas territories. See [[Telephone numbers in the United Kingdom#Telephone numbers in Overseas Territories]].}}
| cctld = [[.uk]]{{Efn|The [[.gb]] domain is also reserved for the UK, but has been little used.}}
}}
The '''United Kingdom of Great Britain and Northern Ireland''', commonly known as the '''United Kingdom''' ('''UK''') or '''Britain''',<!--DO NOT CHANGE ORDER OF INTRO WITHOUT CONSENSUS-->{{Efn|Usage is mixed. ''[[The Guardian]]''<ref>{{Cite news |date=23 April 2021 |title=Guardian style guide: U |url=https://www.theguardian.com/guardian-style-guide-u |access-date=29 December 2025 |work=The Guardian |language=en-GB |issn=0261-3077}}</ref> and ''[[The Daily Telegraph|The Telegraph]]''<ref>{{Cite news |date=25 July 2025 |title=Places |url=https://www.telegraph.co.uk/style-book/places/ |access-date=29 December 2025 |work=The Telegraph |language=en-GB |issn=0307-1235 |archive-date=17 November 2025 |archive-url=https://web.archive.org/web/20251117111222/https://www.telegraph.co.uk/style-book/places/ |url-status=live }}</ref> use ''Britain'' as a synonym for the United Kingdom. The British [[Cabinet Office]]'s [[Government Digital Service]] style guide<ref>{{Cite web |title=Style guide - A to Z - Guidance - GOV.UK |url=https://www.gov.uk/guidance/style-guide/a-to-z#great-britain |access-date=2 January 2026 |website=www.gov.uk |language=en |archive-date=22 November 2024 |archive-url=https://web.archive.org/web/20241122222025/https://www.gov.uk/guidance/style-guide/a-to-z#great-britain |url-status=live }}</ref> for use on [[gov.uk]] recommends: "Use UK and United Kingdom in preference to Britain and British (UK business, UK foreign policy, ambassador and high commissioner). But British embassy, not UK embassy."}} is a country<!-- The term "country" was chosen as a result of a 2022 Request for Comment. Discuss potential changes on the talk page first. --> in [[northwestern Europe]], off the coast of [[European mainland|the continental mainland]]. It comprises [[England]], [[Scotland]], [[Wales]] and [[Northern Ireland]],{{efn|The [[Isle of Man]], [[Bailiwick of Guernsey|Guernsey]] and [[Jersey]] are [[Crown Dependencies]] and not part of the UK.}} with a population of over 69 million in 2024. The UK includes the island of [[Great Britain]], the north-eastern part of the island of [[Ireland]], and most of [[List of islands of the United Kingdom|the smaller islands]] within the [[British Isles]], covering {{Convert|244376|km2|sqmi|order=flip}}.{{efn|name=ONSArea}} It shares [[Republic of Ireland–United Kingdom border|a land border]] with the [[Republic of Ireland]] and is surrounded by the [[Atlantic Ocean]], the [[North Sea]], the [[English Channel]], the [[Celtic Sea]] and the [[Irish Sea]], while maintaining sovereignty over the [[Crown Dependencies]] and the [[British Overseas Territories]]. The capital and largest city of England and the UK is [[London]]; [[Edinburgh]], [[Cardiff]] and [[Belfast]] are the national capitals of Scotland, Wales and Northern Ireland, respectively.
The British Isles have been continuously inhabited since the [[Neolithic]]. In AD 43 the [[Roman conquest of Britain]] began. The [[end of Roman rule in Britain|Roman departure]] between 383 and 410 was followed by [[Anglo-Saxon settlement of Britain|Anglo-Saxon settlement]] beginning around 450. In 1066 the [[Norman Conquest|Normans conquered England]]. Over the 17th century the role of the [[British monarchy]] was reduced, particularly as a result of the [[English Civil War]]. In 1707 the Kingdom of England and the [[Kingdom of Scotland]] united under the [[Treaty of Union]] to create the [[Kingdom of Great Britain]]. The [[Acts of Union 1800]] incorporated the [[Kingdom of Ireland]] to create the [[United Kingdom of Great Britain and Ireland]] in 1801. Most of Ireland [[Partition of Ireland|seceded]] from the UK in 1922 as the [[Irish Free State]], and the [[Royal and Parliamentary Titles Act 1927]] created the present United Kingdom.
The UK [[History of industrialisation#Industrial Revolution in Europe|became the first industrialised country]] and was the world's [[foremost power]] for the majority of the 19th and early 20th centuries, particularly during the ''[[Pax Britannica]]'' between 1815 and 1914. The [[British Empire]] was the leading [[economic power]] for most of the 19th century, a position supported by [[British Agricultural Revolution|its agricultural prosperity]], its role as a dominant [[trading nation]], a massive industrial capacity, [[List of British innovations and discoveries in the 19th century|significant technological achievements]], and the rise of [[19th-century London]] as the world's principal financial centre. At its height in the 1920s, the empire encompassed around a quarter of the world's landmass and population, and was the [[List of largest empires#Empires at their greatest extent|largest in history]]. However, [[History of the United Kingdom during the First World War|its involvement in the First World War]] and [[Military history of the United Kingdom during World War II|in the Second World War]] damaged [[Economy of the British Empire|Britain's economic power]], and a global wave of [[decolonisation]] led to the independence of most British colonies.
The UK is a [[constitutional monarchy]] and [[parliamentary democracy]]{{Efn|The United Kingdom does not have a codified constitution but an unwritten one formed of Acts of Parliament, court judgments, traditions, and conventions.<ref>{{Citation |title=What is the UK Constitution? |date=9 August 2018 |url=https://www.ucl.ac.uk/constitution-unit/what-uk-constitution/what-uk-constitution |publisher=The Constitution Unit of UCL |access-date=6 February 2020 |archive-date=7 November 2018 |archive-url=https://web.archive.org/web/20181107060057/http://www.ucl.ac.uk/constitution-unit/whatis/uk-constitution |url-status=live}}</ref>}} with three distinct jurisdictions: [[English law|England and Wales]], [[Scots law|Scotland]], and [[Law of Northern Ireland|Northern Ireland]]. Scotland, Wales and Northern Ireland have their own governments and parliaments which control various [[Devolution in the United Kingdom|devolved]] matters. A [[developed country]] with [[Economy of the United Kingdom|an advanced economy]], the UK ranks amongst the [[List of countries by GDP (nominal)|largest economies by nominal GDP]] and is one of the world's [[List of countries by exports|largest exporters]] and [[List of countries by imports|importers]]. As a [[nuclear state]] with one of the [[List of countries by military expenditures|highest defence budgets]], the UK maintains [[British Armed Forces|one of the strongest militaries in Europe]]. [[Culture of the United Kingdom|British culture]] is globally influential, notably in the [[Anglosphere]] and [[Commonwealth of Nations|the Commonwealth]]; [[Anglicisation|its soft power influence]] is observable in the legal and political systems of many [[List of countries that have gained independence from the United Kingdom|former colonies]], and in its exports [[English-speaking world|of language]], [[British literature|literature]], [[Theatre of the United Kingdom|theatre]], [[Cinema of the United Kingdom|cinema]], [[Music of the United Kingdom|music]], [[Mass media in the United Kingdom|media]], [[Art of the United Kingdom|art]] and [[Sport in the United Kingdom|sport]]. A [[great power]], the UK is part of [[Foreign relations of the United Kingdom#International organisations|numerous international organisations]].
== Etymology and terminology ==
{{Anchor|Etymology}}<!--linked-->
{{See also|Britain (place name)|Terminology of the British Isles}}
The [[Acts of Union 1707]] declared that the [[Kingdom of England]] and the [[Kingdom of Scotland]] were "United into One Kingdom by the Name of Great Britain".{{Efn|Compare to section 1 of both of the 1800 [[Acts of Union (1800)|Acts of Union]] which reads: "the kingdoms of Great Britain and Ireland shall{{spaces}}... be united into one kingdom, by the name of the United Kingdom of Great Britain and Ireland".}}<ref name="Acts of Union 1707">{{Cite web |title=The Treaty (act) of the Union of Parliament 1706 |url=http://www.scotshistoryonline.co.uk/union.html |archive-url=https://web.archive.org/web/20190527074630/http://www.scotshistoryonline.co.uk/union.html |archive-date=27 May 2019 |access-date=23 August 2011 |publisher=Scots History Online |postscript=;}} {{Cite book |last1=Barnett, Hilaire |url=https://books.google.com/books?id=LYc1tSYonrQC&pg=PA165 |title=Constitutional & Administrative Law |last2=Jago, Robert |publisher=Routledge |year=2011 |isbn=978-0-415-56301-7 |edition=8th |location=Abingdon |page=165 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328140722/https://books.google.com/books?id=LYc1tSYonrQC&pg=PA165 |url-status=live}}</ref> The term "United Kingdom" has occasionally been used for the former [[Kingdom of Great Britain]], although its official name from 1707 to 1800 was simply "Great Britain".<ref>"After the political union of England and Scotland in 1707, the nation's official name became 'Great Britain{{'"}}, ''The American Pageant, Volume 1'', Cengage Learning (2012); "From 1707 until 1801 ''Great Britain'' was the official designation of the kingdoms of England and Scotland". ''The Standard Reference Work: For the Home, School and Library, Volume 3'', Harold Melvin Stanford (1921); "In 1707, on the union with Scotland, 'Great Britain' became the official name of the British Kingdom, and so continued until the union with Ireland in 1801". ''United States Congressional serial set, Issue 10; Issue 3265'' (1895); {{Cite web |last=Gascoigne, Bamber |author-link=Bamber Gascoigne |title=History of Great Britain (from 1707) |url=http://www.historyworld.net/wrldhis/PlainTextHistories.asp?historyid=ab07 |access-date=18 July 2011 |publisher=History World |archive-date=27 May 2019 |archive-url=https://web.archive.org/web/20190527205230/http://www.historyworld.net/wrldhis/PlainTextHistories.asp?historyid=ab07 |url-status=live}}</ref> The [[Acts of Union 1800]] formed the [[United Kingdom of Great Britain and Ireland]]. Following the [[partition of Ireland]] and the independence of the [[Irish Free State]] in 1922, which left [[Northern Ireland]] as the only part of the island of Ireland within the United Kingdom, the name was changed in 1927 to the "United Kingdom of Great Britain and Northern Ireland".<ref>{{Cite book |last=Cottrell, P. |url=https://archive.org/details/irishcivilwar00cott_573 |title=The Irish Civil War 1922–23 |year=2008 |isbn=978-1-84603-270-7 |page=[https://archive.org/details/irishcivilwar00cott_573/page/n85 85] |publisher=Bloomsbury USA |url-access=limited}}</ref>
Although the United Kingdom is a sovereign country, England, Scotland, Wales and Northern Ireland are widely referred to as [[Countries of the United Kingdom|countries]].<ref>{{Citation |last1=S. Dunn |title=An Alphabetical Listing of Word, Name and Place in Northern Ireland and the Living Language of Conflict |year=2000 |place=[[Lewiston, New York]] |publisher=[[Edwin Mellen Press]] |quote=One specific problem – in both general and particular senses – is to know what to call Northern Ireland itself: in the general sense, it is not a country, or a province, or a state – although some refer to it contemptuously as a statelet: the least controversial word appears to be jurisdiction, but this might change. |last2=H. Dawson |postscript=;}} {{Cite web |date=15 December 2011 |title=Changes in the list of subdivision names and code elements |url=http://www.iso.org/iso/iso_3166-2_newsletter_ii-3_2011-12-13.pdf |access-date=28 May 2012 |website=ISO 3166-2 |publisher=International Organization for Standardization |archive-date=19 September 2016 |archive-url=https://web.archive.org/web/20160919073956/http://www.iso.org/iso/iso_3166-2_newsletter_ii-3_2011-12-13.pdf |url-status=live}}</ref> The UK Prime Minister's website has used the phrase "countries within a country" to describe it.<ref name="page823">{{Cite web |date=10 January 2003 |title=Countries within a country |url=http://www.number10.gov.uk/Page823 |archive-url=http://webarchive.nationalarchives.gov.uk/20080909013512/http://www.number10.gov.uk/Page823 |archive-date=9 September 2008 |access-date=8 March 2015 |publisher=Prime Minister's Office}}</ref> Some statistical summaries, such as those for the twelve [[NUTS of the United Kingdom|NUTS 1 regions]], refer to Scotland, Wales and Northern Ireland as "regions".<ref>{{Cite web |title=Statistical bulletin: Regional Labour Market Statistics |url=http://www.ons.gov.uk/ons/dcp171778_346117.xml |archive-url=https://web.archive.org/web/20141224045523/http://www.ons.gov.uk/ons/dcp171778_346117.xml |archive-date=24 December 2014 |access-date=5 March 2014 |postscript=;}} {{Cite web |title=13.4% Fall In Earnings Value During Recession |url=http://www.gmb.org.uk/newsroom/fall-in-earnings-value-during-recession |archive-url=https://web.archive.org/web/20140103194604/http://www.gmb.org.uk/newsroom/fall-in-earnings-value-during-recession |archive-date=3 January 2014 |access-date=5 March 2014}}</ref> Northern Ireland is also referred to as a "province".<ref>{{Cite book |last1=Dunn, Seamus |title=An Alphabetical Listing of Word, Name and Place in Northern Ireland and the Living Language of Conflict |last2=Dawson, Helen |publisher=[[Edwin Mellen Press]] |year=2000 |isbn=978-0-7734-7711-7 |location=[[Lewiston, New York]] |postscript=;}} {{Cite book |last=Murphy, Dervla |title=[[A Place Apart (Murphy book)|A Place Apart]] |publisher=Penguin |year=1979 |isbn=978-0-14-005030-1 |location=London}}</ref> With regard to Northern Ireland, the descriptive name used "can be controversial, with the choice often revealing one's political preferences".<ref>{{Cite book |last1=Whyte |first1=John |title=Interpreting Northern Ireland |last2=FitzGerald |first2=Garret |publisher=Clarendon Press |year=1991 |isbn=978-0-19-827380-6 |location=Oxford |author-link=John Henry Whyte |author-link2=Garret FitzGerald}}</ref>
The term "Great Britain" conventionally refers to the island of Great Britain, or politically to England, Scotland and Wales in combination.<ref>{{Cite news |date=19 December 2008 |title=Guardian Unlimited Style Guide |publisher=Guardian News and Media Limited |location=London |url=https://www.theguardian.com/styleguide/page/0,,184840,00.html |access-date=23 August 2011 |postscript=;}} {{Cite news |date=19 August 2002 |title=BBC style guide (Great Britain) |work=BBC News |url=http://news.bbc.co.uk/1/hi/programmes/radio_newsroom/1099593.stm#g |access-date=23 August 2011 |archive-date=15 February 2009 |archive-url=https://web.archive.org/web/20090215074832/http://news.bbc.co.uk/1/hi/programmes/radio_newsroom/1099593.stm#g |url-status=live |postscript=;}} {{Cite web |title=Key facts about the United Kingdom |url=http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_10012517 |archive-url=http://webarchive.nationalarchives.gov.uk/20121015000000/http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_10012517 |archive-date=15 October 2012 |access-date=8 March 2015 |website=Government, citizens and rights |publisher=HM Government}}</ref> It is sometimes used as a loose synonym for the United Kingdom as a whole.<ref>[[New Oxford American Dictionary]]: "Great Britain: England, Wales, and Scotland considered as a unit. The name is also often used loosely to refer to the United Kingdom."</ref> The word ''England'' is occasionally used incorrectly to refer to the United Kingdom as a whole, a mistake principally made by people from outside the UK.<ref>"When people say England, they sometimes mean Great Britain, sometimes the United Kingdom, sometimes the British Isles — but never England." — {{Citation |last=George Mikes |title=How To Be An Alien |year=1946 |publisher=Penguin}} {{ISBN|978-0-582-41686-4|postscript=;}} {{Cite web |title=England OR United Kingdom (UK)? {{!}} Vocabulary {{!}} EnglishClub |url=https://www.englishclub.com/vocabulary/cw-uk-england.htm |access-date=16 October 2022 |website=englishclub.com |archive-date=16 October 2022 |archive-url=https://web.archive.org/web/20221016192638/https://www.englishclub.com/vocabulary/cw-uk-england.htm |url-status=live}}</ref>
The term "Britain" is used as a synonym for [[Great Britain]],<ref>{{Cite web |title=Britain Meaning in the Cambridge English Dictionary |url=https://dictionary.cambridge.org/dictionary/english/britain |website=dictionary.cambridge.org |access-date=19 June 2018 |archive-date=20 June 2018 |archive-url=https://web.archive.org/web/20180620024348/https://dictionary.cambridge.org/dictionary/english/britain |url-status=live |postscript=;}} {{Cite web |title=Definition of Britain in English by Oxford Dictionaries |url=https://en.oxforddictionaries.com/definition/britain |archive-url=https://web.archive.org/web/20160926204707/https://en.oxforddictionaries.com/definition/britain |archive-date=26 September 2016 |website=Oxford Dictionaries – English}}</ref><ref name="Britain-Col">{{Cite web |title=Britain definition and meaning |url=https://www.collinsdictionary.com/dictionary/english/britain |website=collinsdictionary.com |publisher=Collins English Dictionary |access-date=19 June 2018 |archive-date=20 June 2018 |archive-url=https://web.archive.org/web/20180620024837/https://www.collinsdictionary.com/dictionary/english/britain |url-status=live}}</ref> but also sometimes for the United Kingdom.<ref>{{Cite web |title=Britain – Definition for English-Language Learners |url=http://learnersdictionary.com/definition/Britain |website=learnersdictionary.com |publisher=Merriam-Webster's Learner's Dictionary |access-date=19 June 2018 |archive-date=20 June 2018 |archive-url=https://web.archive.org/web/20180620024648/http://learnersdictionary.com/definition/Britain |url-status=live}}</ref><ref name="Britain-Col" /> Usage is mixed: the [[style guide]] of the [[Government of the United Kingdom|UK Government]] prefers the term "UK" rather than "Britain" or "British" (except when referring to embassies{{Efn|"UK" embassies became "British" embassies in 1961.<ref>{{Cite news |date=21 October 1961 |title='Cold U.K.' Becomes British |work=[[The Times]] |page=8}}</ref>}}),<ref>{{Cite web |date=21 November 2024 |orig-date=23 February 2016 |title=Style guide: A to Z |url=https://www.gov.uk/guidance/style-guide/a-to-z |url-status=live |archive-url=https://web.archive.org/web/20241122222025/https://www.gov.uk/guidance/style-guide/a-to-z |archive-date=22 November 2024 |publisher=UK Government}}</ref> while other government documents acknowledge that both terms refer to the United Kingdom and that elsewhere "British government" is used at least as frequently as "United Kingdom government".<ref name="PCGN-uk-guide">{{Cite web |last=Permanent Committee on Geographical Names |title=Toponymic guidelines for the United Kingdom |url=https://www.gov.uk/government/publications/toponymic-guidelines |website=gov.uk |date=17 May 2023 |publisher=UK Government |access-date=17 June 2018 |archive-date=17 June 2018 |archive-url=https://web.archive.org/web/20180617165832/https://www.gov.uk/government/publications/toponymic-guidelines |url-status=live}}</ref> The UK [[Permanent Committee on Geographical Names for British Official Use|Permanent Committee on Geographical Names]] recognises "United Kingdom", "UK" and "U.K." as shortened and abbreviated geopolitical terms for the United Kingdom of Great Britain and Northern Ireland in its toponymic guidelines; it does not list "Britain" but notes that "it is only the one specific nominal term 'Great Britain' which invariably excludes Northern Ireland".<ref name="PCGN-uk-guide" /> The [[BBC]] historically preferred to use "Britain" as shorthand only for Great Britain, though the present style guide does not take a position except that "Great Britain" excludes Northern Ireland.<ref>{{Cite web |title=BBC News style guide – Names |url=https://www.bbc.co.uk/academy/en/articles/art20130702112133537 |archive-url=https://web.archive.org/web/20191110082858/https://www.bbc.co.uk/academy/en/articles/art20130702112133537 |archive-date=10 November 2019 |access-date=9 November 2019 |website=BBC Academy |publisher=BBC |postscript=;}} {{Cite web |title=Alphabetical checklist |url=https://www.bbc.co.uk/academy/journalism/news-style-guide/article/art20130702112133551 |archive-url=https://web.archive.org/web/20180326162901/http://www.bbc.co.uk/academy/journalism/news-style-guide/article/art20130702112133551 |archive-date=26 March 2018 |access-date=17 June 2018 |website=BBC News |publisher=BBC}}</ref>
The adjective "British" is commonly used to refer to matters relating to the United Kingdom and is used in law to refer to United Kingdom citizenship and [[British nationality law|nationality]].<ref>{{Cite book |last1=Bradley, Anthony Wilfred |url=https://books.google.com/books?id=HT_GS2zgN5QC&pg=PA36 |title=Constitutional and administrative law |last2=Ewing, Keith D. |publisher=Pearson Longman |year=2007 |isbn=978-1-4058-1207-8 |edition=14th |volume=1 |location=Harlow |page=36 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328140723/https://books.google.com/books?id=HT_GS2zgN5QC&pg=PA36 |url-status=live}}</ref>{{Efn|Historically, the term ''British'' was used to refer to members and institutions within the British Empire and later Commonwealth and was not limited to the geographical British Isles. The UK Government adopted the term for its exclusive use only in 1961, but in recognition of its wider usage first sought the prior consent of Australia, Canada and New Zealand.<ref>{{Cite book |last1=Curran |first1=James |title=The Unknown Nation: Australia after Empire |last2=Ward |first2=Stuart |date=2010 |publisher=Melbourne University Publishing |isbn=978-0-522-85645-3 |location=Carlton, Vic |pages=26–7}}</ref><ref>{{Cite book |last=Ward |first=Stuart |title=Untied kingdom: A Global History of the End of Britain |date=2023 |publisher=Cambridge University Press |isbn=978-1-107-14599-3 |at=Chapter 1}}</ref>}} People of the United Kingdom use several different terms to describe their national identity and may identify themselves as being [[British people|British]], [[English people|English]], [[Scottish people|Scottish]], [[Welsh people|Welsh]], [[People of Northern Ireland|Northern Irish]] or [[Irish people|Irish]];<ref>{{Cite web |year=2010 |title=Which of these best describes the way you think of yourself? |url=http://www.ark.ac.uk/nilt/2010/Community_Relations/NINATID.html |access-date=1 July 2010 |website=Northern Ireland Life and Times Survey 2010 |publisher=ARK – Access Research Knowledge |archive-date=23 September 2015 |archive-url=https://web.archive.org/web/20150923175111/http://www.ark.ac.uk/nilt/2010/Community_Relations/NINATID.html |url-status=live}}</ref> or as having a combination of different national identities.<ref>{{Cite web |title=Ethnicity and National Identity in England and Wales |url=https://www.ons.gov.uk/peoplepopulationandcommunity/culturalidentity/ethnicity/articles/ethnicityandnationalidentityinenglandandwales/2012-12-11 |access-date=25 June 2020 |website=Office for National Statistics |archive-date=21 January 2022 |archive-url=https://web.archive.org/web/20220121012603/https://www.ons.gov.uk/peoplepopulationandcommunity/culturalidentity/ethnicity/articles/ethnicityandnationalidentityinenglandandwales/2012-12-11 |url-status=live |postscript=;}} {{Cite book |last=Schrijver, Frans |url=https://books.google.com/books?id=u8gZklxHTMUC&pg=PA275 |title=Regionalism after regionalisation: Spain, France and the United Kingdom |publisher=Amsterdam University Press |year=2006 |isbn=978-90-5629-428-1 |pages=275–277 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328140905/https://books.google.com/books?id=u8gZklxHTMUC&pg=PA275#v=onepage&q&f=false |url-status=live}}</ref>
== History ==
{{Main|Formation of the United Kingdom of Great Britain and Northern Ireland|History of the British Isles}}
{{Further|History of the constitution of the United Kingdom|Timeline of British history}}
=== Prior to the Treaty of Union ===
{{Main|History of England|History of Wales|History of Scotland|History of Ireland}}
{{further|Kingdom of England|Kingdom of Scotland}}
[[File:Stonehenge2007 07 30.jpg|thumb|[[Stonehenge]] in [[Wiltshire]] is a ring of stones, each about {{Cvt|13|ft|0|order=flip}} high, {{Cvt|7|ft|0|order=flip}} wide and 25 [[tonne]]s, erected 2400–2200 BC.]]
Settlement by [[Cro-Magnon]]s of what is now the United Kingdom occurred in waves beginning by about 30,000 years ago.<ref>[http://news.bbc.co.uk/1/hi/wales/south_west/7069001.stm "Ancient skeleton was 'even older'] {{Webarchive|url=https://web.archive.org/web/20210213081240/http://news.bbc.co.uk/2/hi/uk_news/wales/south_west/7069001.stm |date=13 February 2021}}". [[BBC News]]. 30 October 2007. Retrieved 27 April 2011.</ref> The island has been continuously inhabited since the last retreat of ice around 11,500 years ago.<ref>{{Cite web |date=9 February 2018 |title=A 12,000-year story - revealing the history of settlers in Britain from the end of the Ice Age to the present day {{!}} University of Oxford |url=https://www.ox.ac.uk/news/2018-02-09-12000-year-story-revealing-history-settlers-britain-end-ice-age-present-day |access-date=6 July 2025 |website=ox.ac.uk |language=en }}{{Dead link|date=May 2026 |bot=InternetArchiveBot }}</ref> By the end of the [[Prehistoric Britain|region's prehistoric period]], the population is thought to have belonged largely to a culture termed [[Insular Celts|Insular Celtic]], comprising [[Britons (historical)|Brittonic Britain]] and [[Gaelic Ireland]].<ref>{{Cite book |last=Koch, John T. |url=https://archive.org/details/celticculturehis00koch_128 |title=Celtic culture: A historical encyclopedia |publisher=ABC-CLIO |year=2006 |isbn=978-1-85109-440-0 |location=Santa Barbara, CA |page=[https://archive.org/details/celticculturehis00koch_128/page/n1016 973] |url-access=limited}}</ref>
The [[Roman conquest of Britain|Roman conquest]], beginning in AD 43, and the 400-year [[Roman Britain|rule of southern Britain]], was followed by an invasion by [[Germanic peoples|Germanic]] [[Anglo-Saxon]] settlers, reducing the Brittonic area mainly [[Wales#Post-Roman era|to what was to become Wales]], [[Cornwall]] and, until the latter stages of the Anglo-Saxon settlement, the [[Hen Ogledd]] (northern England and parts of southern Scotland).<ref>{{Cite book |title=[[Encyclopaedia of Wales|The Welsh Academy Encyclopaedia of Wales]] |publisher=University of Wales Press |year=2008 |isbn=978-0-7083-1953-6 |editor-last=Davies |editor-first=John |editor-link=John Davies (historian) |location=Cardiff |page=915 |editor-last2=Jenkins |editor-first2=Nigel |editor-link2=Nigel Jenkins |editor-last3=Baines |editor-first3=Menna |editor-last4=Lynch |editor-first4=Peredur I. |editor-link4=Peredur Lynch}}</ref> Most of the [[Anglo-Saxon England|region settled by the Anglo-Saxons]] became unified as the Kingdom of England in the 10th century.<ref>{{Cite magazine |title=Short Athelstan biography |url=https://www.bbc.co.uk/history/historic_figures/athelstan.shtml |magazine=BBC History |access-date=9 April 2013 |archive-date=13 February 2007 |archive-url=https://web.archive.org/web/20070213191353/http://www.bbc.co.uk/history/historic_figures/athelstan.shtml |url-status=live}}</ref> [[Dál Riata|Gaelic speakers in north-west Britain]] (with connections to the north-east of Ireland and traditionally supposed to have migrated from there in the 5th century)<ref>{{Cite book |last=Mackie, J.D. |url=https://archive.org/details/historyofscotlan00mack_0/page/18 |title=A History of Scotland |publisher=Penguin |year=1991 |isbn=978-0-14-013649-4 |location=London |pages=[https://archive.org/details/historyofscotlan00mack_0/page/18 18–19] |author-link=J.D. Mackie |postscript=;}} {{Cite book |last=Campbell |first=Ewan |title=Saints and Sea-kings: The First Kingdom of the Scots |publisher=Canongate |year=1999 |isbn=978-0-86241-874-8 |location=Edinburgh |pages=8–15}}</ref> united with the [[Picts]] to create the [[Kingdom of Scotland]] in the 9th century.<ref>{{Cite book |last=Haigh |first=Christopher |url=https://archive.org/details/cambridgehistori0000unse_a9n8/page/30 |title=The Cambridge Historical Encyclopedia of Great Britain and Ireland |publisher=Cambridge University Press |year=1990 |isbn=978-0-521-39552-6 |page=[https://archive.org/details/cambridgehistori0000unse_a9n8/page/30 30]}}</ref>
[[File:Roman Baths in Bath Spa, England - July 2006.jpg|alt=Photograph of the Baths showing a rectangular area of greenish water surrounded by yellow stone buildings with pillars. In the background is the tower of the abbey.|thumb|The [[Roman Baths (Bath)|Roman Baths]] in [[Bath, Somerset]], are a well-preserved ''[[thermae]]'' from [[Roman Britain]].]]
In 1066, the [[Normans]] invaded England from northern France. After [[Norman conquest of England|conquering England]] they seized [[Norman invasion of Wales|large parts of Wales]], [[Norman invasion of Ireland|conquered much of Ireland]] and were invited to settle in Scotland, bringing to each country [[feudalism]] on the Northern French model and [[Norman-French]] culture.<ref>{{Cite book |last=Ganshof, F.L. |url=https://archive.org/details/feudalism0000gans_j4b5 |title=Feudalism |publisher=University of Toronto |year=1996 |isbn=978-0-8020-7158-3 |page=165 |url-access=registration}}</ref> The [[Anglo-Normans|Anglo-Norman]] [[ruling class]] greatly influenced, but eventually assimilated with, the local cultures.<ref>{{Cite book |last=Chibnall, Marjorie |url=https://books.google.com/books?id=qJl5Jm-IndUC&pg=PA115 |title=The Debate on the Norman Conquest |publisher=Manchester University Press |year=1999 |isbn=978-0-7190-4913-2 |pages=115–122 |author-link=Marjorie Chibnall |access-date=20 March 2023 |archive-date=26 March 2023 |archive-url=https://web.archive.org/web/20230326164802/https://books.google.com/books?id=qJl5Jm-IndUC&pg=PA115 |url-status=live}}</ref> Subsequent [[House of Plantagenet|medieval English kings]] completed the [[conquest of Wales]] and tried unsuccessfully [[Wars of Scottish Independence|to annex Scotland]]. Asserting its independence in the 1320 [[Declaration of Arbroath]], Scotland maintained its independence thereafter, albeit in [[Anglo-Scottish Wars|near-constant conflict with England]].<ref>{{Cite web |date=3 June 2023 |title=The Declaration of Arbroath |url=https://www.nms.ac.uk/past-exhibitions/the-declaration-of-arbroath |access-date=6 July 2025 |website=NMS |language=en}}</ref>
In 1215, [[Magna Carta]] was the first document to state that no government was above the law and that citizens have rights protecting them.<ref>{{Cite web |title=Magna Carta |url=https://www.parliament.uk/about/living-heritage/evolutionofparliament/originsofparliament/birthofparliament/overview/magnacarta/ |access-date=27 May 2024 |publisher=parliament.uk}} {{Cite web |title=The contents of Magna Carta |url=https://www.parliament.uk/about/living-heritage/evolutionofparliament/originsofparliament/birthofparliament/overview/magnacarta/magnacartaclauses/ |access-date=27 May 2024 |publisher=parliament.uk |archive-date=28 August 2022 |archive-url=https://web.archive.org/web/20220828101448/https://www.parliament.uk/about/living-heritage/evolutionofparliament/originsofparliament/birthofparliament/overview/magnacarta/magnacartaclauses/ |url-status=live}} {{Cite web |title=Magna Carta Key Facts |url=https://www.britannica.com/summary/Magna-Carta-Key-Facts |access-date=27 May 2024 |publisher=Britannica |archive-date=27 May 2024 |archive-url=https://web.archive.org/web/20240527191804/https://www.britannica.com/summary/Magna-Carta-Key-Facts |url-status=live}}</ref>
The English monarchs, through inheritance of [[Angevin Empire|substantial territories in France]] and claims to the French crown, were also heavily involved in conflicts in France, most notably the [[Hundred Years' War]], while the [[List of Scottish monarchs|Kings of Scots]] were in [[Auld Alliance|an alliance with the French]] during this period.<ref>Keen, Maurice. [https://www.bbc.co.uk/history/british/middle_ages/hundred_years_war_01.shtml "The Hundred Years' War"] {{Webarchive|url=https://web.archive.org/web/20131214092949/http://www.bbc.co.uk/history/british/middle_ages/hundred_years_war_01.shtml |date=14 December 2013 }}. BBC History.</ref> [[Early modern Britain]] saw religious conflict resulting from the [[Reformation]] and the introduction of [[Protestant]] state churches in each country.<ref>[https://www.britannica.com/EBchecked/topic/479892/Protestantism/41558/The-Reformation-in-England-and-Scotland The Reformation in England and Scotland] {{Webarchive|url=https://web.archive.org/web/20150515015218/https://www.britannica.com/EBchecked/topic/479892/Protestantism/41558/The-Reformation-in-England-and-Scotland |date=15 May 2015 }} and [https://www.britannica.com/EBchecked/topic/293754/Ireland/22978/The-Reformation-period Ireland: The Reformation Period & Ireland under Elizabeth I] {{Webarchive|url=https://web.archive.org/web/20150521133445/http://www.britannica.com/EBchecked/topic/293754/Ireland/22978/The-Reformation-period |date=21 May 2015 }}, Encyclopædia Britannica Online.</ref> The [[English Reformation]] ushered in political, constitutional, social and cultural change in the 16th century and [[State religion|established]] the [[Church of England]]. It defined a national identity for England and slowly, but profoundly, changed people's religious beliefs.<ref>{{Cite web |title=English Reformation c1527-1590 |url=https://www.nationalarchives.gov.uk/education/resources/the-english-reformation-c1527-1590/ |access-date=20 January 2023 |website=The National Archives |archive-date=2 December 2022 |archive-url=https://web.archive.org/web/20221202002512/https://www.nationalarchives.gov.uk/education/resources/the-english-reformation-c1527-1590/ |url-status=live}}</ref> Wales was [[Laws in Wales Acts 1535 and 1542|fully incorporated into the Kingdom of England]],<ref>{{Cite magazine |date=5 November 2009 |title=British History in Depth – Wales under the Tudors |url=https://www.bbc.co.uk/history/british/tudors/wales_tudors_01.shtml |magazine=BBC History |access-date=21 September 2010 |archive-date=7 February 2012 |archive-url=https://web.archive.org/web/20120207145836/http://www.bbc.co.uk/history/british/tudors/wales_tudors_01.shtml |url-status=live}}</ref> and Ireland was constituted as a kingdom in personal union with the English crown.<ref>{{Cite book |last=Nicholls |first=Mark |url=https://archive.org/details/historyofmodernb0000nich |title=A history of the modern British Isles, 1529–1603: The two kingdoms |publisher=Blackwell |year=1999 |isbn=978-0-631-19334-0 |location=Oxford |pages=171–172 |url-access=registration}}</ref> During the [[Plantation of Ulster]] in the 17th century, the lands of the Catholic Gaelic nobility were confiscated by the Crown and granted to Protestant settlers from England and Scotland.<ref>{{Cite book |last=Canny |first=Nicholas P. |url=https://archive.org/details/makingirelandbri00cann |title=Making Ireland British, 1580–1650 |publisher=Oxford University Press |year=2003 |isbn=978-0-19-925905-2 |pages=189–200 |url-access=registration}}</ref>
[[File:Adam de Colone (c.1572-1651) - James VI and I (1566–1625), King of Scotland (1567–1625), King of England and Ireland (1603–1625) - PG 2172 - National Galleries of Scotland.jpg|thumb|right|[[James VI and I|James VI]], [[King of Scotland]], succeeded to the English and Irish thrones in 1603.]]
The [[Union of the Crowns]] occurred in 1603 when [[James VI of Scotland]] inherited the thrones of England and Ireland, subsequently moving his court from Edinburgh to London. Although unified under a single monarch, the three realms remained entirely separate political entities, preserving their respective parliaments, judicial systems, and established churches.<ref>Ross, D. (2002). ''[[iarchive:chronologyofscot0000ross|Chronology of Scottish History]]''. Glasgow: Geddes & Grosset. p. 56. {{ISBN|978-1-85534-380-1}}; Hearn, J. (2002). ''Claiming Scotland: National Identity and Liberal Culture''. Edinburgh University Press. p. 104. {{ISBN|978-1-902930-16-9}}.</ref>
In the mid-17th century, all three kingdoms [[Wars of the Three Kingdoms|were involved in a series of connected wars]] (including the [[English Civil War]]) which led to the temporary overthrow of the monarchy, with [[Execution of Charles I|the execution]] of [[Charles I of England|King Charles I]], and the establishment of the short-lived [[unitary republic]] of the [[Commonwealth of England]], Scotland and Ireland.<ref>{{Cite encyclopedia |title=English Civil Wars |encyclopedia=Encyclopædia Britannica |url=https://www.britannica.com/EBchecked/topic/187936/English-Civil-Wars |access-date=28 April 2013 |archive-date=2 May 2015 |archive-url=https://web.archive.org/web/20150502204708/https://www.britannica.com/EBchecked/topic/187936/English-Civil-Wars |url-status=live}}; {{Cite web |date=14 March 2010 |title=Scotland and the Commonwealth: 1651–1660 |url=http://www.archontology.org/nations/uk/scotland/01_laws.php |access-date=9 March 2015 |publisher=Archontology.org |archive-date=16 July 2012 |archive-url=https://web.archive.org/web/20120716194016/http://www.archontology.org/nations/uk/scotland/01_laws.php |url-status=live}}</ref>
Although the [[Restoration (1660)|monarchy was restored]], the [[Interregnum (1649–1660)|Interregnum]] along with the [[Glorious Revolution]] of 1688 and the subsequent [[Bill of Rights 1689]] in England and [[Claim of Right Act 1689]] in Scotland ensured that, unlike much of the rest of Europe, [[royal absolutism]] would not prevail, and a professed Catholic could never accede to the throne. The [[British constitution]] would develop on the basis of [[constitutional monarchy]] and the [[parliamentary system]].<ref>{{Cite book |last=Lodge |first=Richard |url=https://books.google.com/books?id=EBSpvBxGyqcC |title=The History of England – From the Restoration to the Death of William III (1660–1702) |publisher=Read Books |year=2007 |isbn=978-1-4067-0897-4 |page=8 |orig-date=1910 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328140723/https://books.google.com/books?id=EBSpvBxGyqcC |url-status=live}}</ref> With the founding of the [[Royal Society]] in 1660, science was greatly encouraged. During this period, particularly in England, the development of [[English navy|naval power]] and an interest in [[Age of Discovery|voyages of discovery]] led to the acquisition and settlement of overseas colonies, particularly in North America and the Caribbean.<ref>{{Cite web |title=Tudor Period and the Birth of a Regular Navy |url=http://www.royal-navy.org/lib/index.php?title=Tudor_Period_and_the_Birth_of_a_Regular_Navy_Part_Two |archive-url=https://web.archive.org/web/20111103013901/http://www.royal-navy.org/lib/index.php?title=Tudor_Period_and_the_Birth_of_a_Regular_Navy_Part_Two |archive-date=3 November 2011 |access-date=8 March 2015 |website=Royal Navy History |url-status=usurped |publisher=Institute of Naval History}}; {{Cite book |last=Canny |first=Nicholas |url=https://books.google.com/books?id=eQHSivGzEEMC |title=The Origins of Empire, The Oxford History of the British Empire Volume I |publisher=Oxford University Press |year=1998 |isbn=978-0-19-924676-2 |ref=refOHBEv1 |access-date=29 September 2020 |archive-date=11 January 2023 |archive-url=https://web.archive.org/web/20230111135256/https://books.google.com/books?id=eQHSivGzEEMC |url-status=live}}</ref>
Though previous attempts at uniting the two kingdoms within Great Britain in 1606, 1667 and 1689 had proved unsuccessful, the attempt initiated in 1705 led to the [[Treaty of Union]] of 1706 being agreed and ratified by both parliaments.
{{Clear left}}
=== Union of England and Scotland ===
{{Main|Treaty of Union|Kingdom of Great Britain}}
[[File:Articles of Union between England and Scotland 28 Jan 1707.png|thumb|right|170px|The [[Treaty of Union]] which unified the [[Kingdom of England]] and [[Kingdom of Scotland]] on 1 May 1707]]
On 1 May 1707 the Kingdom of Great Britain was formed, the result of the [[Acts of Union 1707]] between the [[Kingdom of England]] and [[Kingdom of Scotland]].<ref>{{Cite web |title=Articles of Union with Scotland 1707 |url=http://www.nationalarchives.gov.uk/pathways/citizenship/rise_parliament/docs/articles_union.htm |access-date=19 October 2008 |publisher=UK Parliament |archive-date=8 June 2012 |archive-url=https://web.archive.org/web/20120608152446/http://www.nationalarchives.gov.uk/pathways/citizenship/rise_parliament/docs/articles_union.htm |url-status=live}}; {{Cite web |title=Acts of Union 1707 |url=http://www.parliament.uk/about/living-heritage/evolutionofparliament/legislativescrutiny |access-date=6 January 2011 |publisher=UK Parliament |archive-date=27 December 2010 |archive-url=https://web.archive.org/web/20101227033859/http://www.parliament.uk/about/living-heritage/evolutionofparliament/legislativescrutiny/ |url-status=live}}; {{Cite web |title=Treaty (act) of Union 1706 |url=http://www.scotshistoryonline.co.uk/union.html |archive-url=https://web.archive.org/web/20190527074630/http://www.scotshistoryonline.co.uk/union.html |archive-date=27 May 2019 |access-date=3 February 2011 |publisher=Scottish History online}}</ref> In the 18th century cabinet government developed under [[Robert Walpole]], who is considered the ''[[de facto]]'' first [[Prime Minister of the United Kingdom|prime minister]] from 1721 to 1742. A series of [[Jacobite uprisings]] sought to remove the Protestant [[House of Hanover]] from the throne and restore the Catholic [[House of Stuart]]. In 1746, the Jacobites were defeated at the [[Battle of Culloden]], after which the [[Scottish Highlanders]] were forcibly assimilated into Scotland by revoking the feudal independence of [[Scottish clan chief|clan chiefs]]. The British colonies in North America that broke away in the [[American Revolutionary War|American War of Independence]] became the [[United States]]. British imperial ambition turned towards Asia, particularly to [[British Raj|India]].<ref>Library of Congress, [https://books.google.com/books?id=BQDgr_XvsHoC&pg=PA73 ''The Impact of the American Revolution Abroad''] {{Webarchive|url=https://web.archive.org/web/20240328140724/https://books.google.com/books?id=BQDgr_XvsHoC&pg=PA73 |date=28 March 2024 }}, p. 73.</ref>
British merchants played a leading part in the [[Atlantic slave trade]], mainly between 1662 and 1807 when British or British-colonial [[slave ships]] transported nearly 3.3 million slaves from Africa.<ref>{{Cite book |last=Morgan |first=Kenneth |url=https://books.google.com/books?id=SGcwgJz5rQMC&pg=PA12 |title=Slavery and the British Empire: From Africa to America |publisher=Oxford University Press, USA |year=2007 |isbn=978-0-19-156627-1 |page=12 |access-date=5 October 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141229/https://books.google.com/books?id=SGcwgJz5rQMC&pg=PA12#v=onepage&q&f=false |url-status=live}}</ref> The slaves were taken to [[Plantation economy|work on plantations]], principally [[History of the British West Indies|in the Caribbean]] but also [[British America|in North America]].<ref>{{Cite book |last=Morgan |first=Kenneth |url=https://books.google.com/books?id=SGcwgJz5rQMC&pg=PA15 |title=Slavery and the British Empire: From Africa to America |publisher=Oxford University Press, US |year=2007 |isbn=978-0-19-156627-1 |page=15 |access-date=5 October 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141229/https://books.google.com/books?id=SGcwgJz5rQMC&pg=PA15#v=onepage&q&f=false |url-status=live}}</ref> However, with pressure from the [[Abolitionism in the United Kingdom|abolitionist movement]], Parliament banned the trade in 1807, banned slavery in the British Empire in 1833, and Britain took a leading role in the movement to abolish slavery worldwide through the [[blockade of Africa]] and pressing other nations to end their trade with a series of treaties.<ref>[https://www.bbc.co.uk/devon/content/articles/2007/03/20/abolition_navy_feature.shtml Sailing against slavery] {{Webarchive|url=https://web.archive.org/web/20081103004954/https://www.bbc.co.uk/devon/content/articles/2007/03/20/abolition_navy_feature.shtml |date=3 November 2008 }}. BBC Devon. 2007.; {{Cite book |last=Lovejoy |first=Paul E. |url=https://archive.org/details/transformationsi0000love/page/290 |title=Transformations in Slavery: A History of Slavery in Africa |publisher=Cambridge University Press |year=2000 |isbn=978-0-521-78012-4 |edition=2nd |location=New York |page=[https://archive.org/details/transformationsi0000love/page/290 290]}}</ref>
=== United Kingdom of Great Britain and Ireland ===
{{Main|History of the United Kingdom|Acts of Union 1800|United Kingdom of Great Britain and Ireland}}
[[File:Victoria in her Coronation robes.jpg|upright|thumb|[[Queen Victoria|Victoria]] reigned as [[Monarchy of the United Kingdom|Queen of the United Kingdom]] and [[Empress of India]] during the 19th century.]]
In 1800, the parliaments of Great Britain and Ireland each passed an Act of Union, uniting the two kingdoms and creating the United Kingdom of Great Britain and Ireland on 1 January 1801.<ref>{{Cite web |title=The Act of Union |url=http://www.actofunion.ac.uk/actofunion.htm#act |archive-url=https://web.archive.org/web/20120415061235/http://www.actofunion.ac.uk/actofunion.htm#act |archive-date=15 April 2012 |access-date=15 May 2006 |publisher=Act of Union Virtual Library}}</ref>
After the defeat of France at the end of the [[French Revolutionary Wars]] and [[Napoleonic Wars]] (1792–1815), the United Kingdom emerged as the principal naval and imperial power (with London the [[List of largest cities throughout history|largest city in the world from about 1830]]).<ref>Tellier, L.-N. (2009). ''Urban World History: an Economic and Geographical Perspective''. Quebec: PUQ. p. 463. {{ISBN|978-2-7605-1588-8}}.</ref> [[History of the Royal Navy (after 1707)#Pax Britannica, 1815–1914|Unchallenged at sea]], British dominance was later described as the ''[[Pax Britannica]]'' ("British Peace"), a period of [[International relations of the Great Powers (1814–1919)|relative peace amongst the great powers]] (1815–1914) during which the British Empire became the global [[hegemon]]<ref>{{Cite book |last=Mathias |first=P. |title=The First Industrial Nation: the Economic History of Britain, 1700–1914 |publisher=Routledge |year=2001 |isbn=978-0-415-26672-7 |location=London}}; {{Cite book |last=Ferguson |first=Niall |url=https://archive.org/details/empire00nial |title=Empire: The rise and demise of the British world order and the lessons for global power |publisher=Basic Books |year=2004 |isbn=978-0-465-02328-8 |location=New York |url-access=registration}}</ref><ref>{{Cite encyclopedia |title=20th-century international relations |encyclopedia=[[Encyclopædia Britannica]] |url=https://www.britannica.com/topic/20th-century-international-relations-2085155 |access-date=6 May 2023 |last=McDougall |first=Walter A. |date=4 May 2023 |author-link=Walter A. McDougall |archive-url=https://web.archive.org/web/20190712124130/https://www.britannica.com/topic/20th-century-international-relations-2085155 |archive-date=12 July 2019 |url-status=live}}</ref> and adopted the role of [[global policeman]].<ref>Sondhaus, L. (2004). ''Navies in Modern World History''. London: Reaktion Books. p. 9. {{ISBN|978-1-86189-202-7}}.</ref><ref>{{Cite book |last=Porter |first=Andrew |url=https://books.google.com/books?id=oo3F2X8IDeEC |title=The Nineteenth Century, The Oxford History of the British Empire Volume III |publisher=Oxford University Press |year=1998 |isbn=978-0-19-924678-6 |page=332 |ref=refOHBEv3}}</ref> From 1853 to 1856, Britain took part in the [[Crimean War]], allied with the [[Ottoman Empire]] against [[Russian Empire|Tsarist Russia]].<ref>{{Cite journal |last=Benn |first=David Wedgwood |title=The Crimean War and its lessons for today |journal=[[International Affairs (journal)|International Affairs]] |volume=88 |issue=2 |date=March 2012 |pages=387–391 |jstor=41428613 |publisher=Oxford University Press |doi=10.1111/j.1468-2346.2012.01078.x}}</ref> Following the [[Indian Rebellion of 1857]] the British government led by [[Henry John Temple, 3rd Viscount Palmerston|Lord Palmerston]] assumed [[direct rule]] over [[British Raj|India]]. Alongside the formal control it exerted over its own colonies, British dominance of much of world trade meant that it [[Informal empire|effectively controlled]] the economies of regions such as [[East Asia]] and [[Latin America]].<ref>{{Cite book |last=Porter |first=Andrew |url=https://books.google.com/books?id=oo3F2X8IDeEC |title=The Nineteenth Century, The Oxford History of the British Empire Volume III |publisher=Oxford University Press |year=1998 |isbn=978-0-19-924678-6 |page=8 |ref=refOHBEv3}}; {{Cite book |last=Marshall |first=P.J. |url=https://books.google.com/books?id=S2EXN8JTwAEC |title=The Cambridge Illustrated History of the British Empire |publisher=Cambridge University Press |year=1996 |isbn=978-0-521-00254-7 |pages=156–157 |ref=refMarshall |access-date=29 September 2020 |archive-date=16 January 2023 |archive-url=https://web.archive.org/web/20230116094154/https://books.google.com/books?id=S2EXN8JTwAEC |url-status=live}}</ref>
Throughout the [[Victorian era]] (1837–1901), political attitudes favoured [[free trade]] and ''[[laissez-faire]]'' policies. Beginning with the [[Great Reform Act]] in 1832, Parliament gradually [[Reform Acts|widened the voting franchise]], with the [[Representation of the People Act 1884|1884 Reform Act]] championed by [[William Ewart Gladstone|William Gladstone]] granting [[suffrage]] to a majority of males for the first time. The British population increased at a dramatic rate, accompanied by rapid [[urbanisation]], causing significant social and economic stresses.<ref>{{Cite book |last=Tompson |first=Richard S. |url=https://books.google.com/books?id=H5kcJqmXk2oC&pg=PA63 |title=Great Britain: a reference guide from the Renaissance to the present |publisher=Facts on File |year=2003 |isbn=978-0-8160-4474-0 |location=New York |page=63}}</ref> By the late 19th century, [[Conservative Party (UK)|Conservative governments]] under [[Benjamin Disraeli]] and [[Robert Gascoyne-Cecil, 3rd Marquess of Salisbury|Lord Salisbury]] accelerated [[Scramble for Africa|imperial expansion in Africa]], sustained a foreign policy of "[[splendid isolation]]" from European alliances, and intensified strategic containment of the [[Russian Empire]] in [[Central Asia]], a competition known as the [[Great Game]].<ref>{{Cite journal |last=Fromkin |first=David |date=1980 |title=The Great Game in Asia |url=https://www.jstor.org/stable/20040512 |journal=Foreign Affairs |volume=58 |issue=4 |pages=936–951 |doi=10.2307/20040512 |jstor=20040512 |issn=0015-7120 |access-date=4 June 2023 |archive-date=12 April 2021 |archive-url=https://web.archive.org/web/20210412053528/https://www.jstor.org/stable/20040512 |url-status=live |url-access=subscription}}</ref> During this time, [[Canada]], [[Australia]] and [[New Zealand]] were granted self-governing [[dominion]] status.<ref>{{Cite book |last=Hosch, William L. |title=World War I: People, Politics, and Power |publisher=Britannica Educational Publishing |year=2009 |isbn=978-1-61530-048-8 |series=America at War |location=New York |page=21}}</ref> At the turn of the 20th century, Britain's industrial dominance became challenged by the [[German Empire]] and the [[United States]].<ref>{{Cite book |last=Zarembka |first=Paul |url=https://books.google.com/books?id=NSrwpggmHigC&pg=PP1 |title=Contradictions: Finance, Greed, and Labor Unequally Paid |date=2013 |publisher=Emerald Group Publishing |isbn=978-1-78190-670-5 |access-date=21 October 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141231/https://books.google.com/books?id=NSrwpggmHigC&pg=PP1#v=onepage&q&f=false |url-status=live}}</ref> The [[Edwardian era]] (1901–1910) saw [[Liberal welfare reforms|social reform]] and [[Irish Home Rule movement|home rule for Ireland]] become important domestic issues, while the [[Labour Party (UK)|Labour Party]] emerged from an alliance of [[Trade unions in the United Kingdom|trade unions]] and small socialist groups in 1900, and [[suffragettes]] campaigned for women's right to vote.<ref>Sophia A. Van Wingerden, ''The women's suffrage movement in Britain, 1866–1928'' (1999) ch 1.</ref>
=== World wars and partition of Ireland ===
{{Main|History of the United Kingdom during the First World War|Partition of Ireland|Interwar Britain|United Kingdom home front during the Second World War|Military history of the United Kingdom during World War II}}
[[File:Wreaths Are Laid at the Cenotaph, London During Remembrance Sunday Service MOD 45152052.jpg|thumb|Wreaths being laid during the [[Remembrance Sunday]] service at the [[The Cenotaph|Cenotaph]] in [[Whitehall]], London]]
[[File:Spitfire and Hurricane in the Battle of Britain Memorial Flight.jpg|thumb|A [[Supermarine Spitfire|Spitfire]] and a [[Hawker Hurricane|Hurricane]] as flown in the [[Battle of Britain]] during the [[Second World War]]]]
Britain was one of the principal [[Allies of World War I|Allies]] that defeated the [[Central Powers]] in the [[First World War]] (1914–1918). Alongside their French, Russian and (after 1917) American counterparts,<ref>Turner, John (1988). ''Britain and the First World War''. London: Unwin Hyman. pp. 22–35. {{ISBN|978-0-04-445109-9}}.</ref> British armed forces were engaged across much of the British Empire and in several regions of Europe, particularly on the [[Western Front (World War I)|Western Front]].<ref name="Westwell&Cove" /> The high fatalities of [[trench warfare]] caused the loss of much of a generation of men, with lasting social effects in the nation and a great disruption in the social order. Britain had suffered 2.5 million casualties and finished the war with a huge national debt.<ref name="Westwell&Cove">Westwell, I.; Cove, D. (eds) (2002). ''History of World War I, Volume 3''. London: Marshall Cavendish. pp. 698, 705. {{ISBN|978-0-7614-7231-5}}.</ref>
The consequences of the war persuaded the government to expand the right to vote in national and local elections to all adult men and most adult women with the [[Representation of the People Act 1918]].<ref name="Westwell&Cove" /> After the war Britain became a permanent member of the Executive Council of the [[League of Nations]] and received [[League of Nations mandate|a mandate]] over a number of former German and [[Ottoman Empire|Ottoman]] colonies. Under the leadership of [[David Lloyd George]], the British Empire reached its greatest extent, covering a fifth of the world's land surface and a quarter of its population.<ref>Turner, J. (1988). ''Britain and the First World War''. Abingdon: Routledge. p. 41. {{ISBN|978-0-04-445109-9}}.</ref>
By the mid-1920s, most of the British population could listen to [[BBC]] radio programmes.<ref>{{Cite web |date=15 June 2020 |title=100 years of radio since Marconi's big breakthrough |url=https://www.ofcom.org.uk/about-ofcom/latest/features-and-news/100-years-of-radio |access-date=17 November 2020 |website=Ofcom |archive-date=4 August 2020 |archive-url=https://web.archive.org/web/20200804031332/https://www.ofcom.org.uk/about-ofcom/latest/features-and-news/100-years-of-radio |url-status=live}}</ref><ref>{{Cite web |title=History of the BBC: The origins of BBC Local Radio |url=https://www.bbc.com/historyofthebbc/research/local-radio |access-date=18 September 2022 |website=[[BBC]] |last=Linfoot |first=Matthew |archive-date=20 September 2022 |archive-url=https://web.archive.org/web/20220920232207/https://www.bbc.com/historyofthebbc/research/local-radio/ |url-status=live}}</ref> Experimental [[Television in the United Kingdom|television]] broadcasts [[History of television#United Kingdom|began in 1929]] and the [[First day of BBC television|first scheduled BBC Television Service]] commenced in 1936.<ref>{{Cite web |title=History of the BBC: 1920s |url=https://www.bbc.com/historyofthebbc/timelines/1920s |access-date=18 September 2022 |website=[[BBC]] |archive-date=26 September 2022 |archive-url=https://web.archive.org/web/20220926064808/https://www.bbc.com/historyofthebbc/timelines/1920s |url-status=live}}</ref> The rise of [[Irish nationalism]], and disputes within Ireland over the terms of [[Irish Home Rule]], led eventually to the [[Partition of Ireland|partition of the island]] in 1921.<ref>[[SR&O 1921]]/533 of 3 May 1921.</ref> [[The Troubles in Ulster (1920–1922)|A period of conflict in what is now Northern Ireland]] occurred from June 1920 until June 1922. The [[Irish Free State]] became independent, initially with [[Dominion]] status in 1922, and [[Statute of Westminster 1931#Irish Free State|unambiguously independent in 1931]]. Northern Ireland remained part of the United Kingdom.<ref>{{Cite web |title=The Anglo-Irish Treaty, 6 December 1921 |url=http://cain.ulst.ac.uk/issues/politics/docs/ait1921.htm |access-date=15 May 2006 |website=CAIN Web Service |archive-date=14 May 2012 |archive-url=https://web.archive.org/web/20120514145108/http://cain.ulst.ac.uk/issues/politics/docs/ait1921.htm |url-status=live}}</ref> The [[1928 Equal Franchise Act]] gave women electoral equality with men in national elections. Strikes in the mid-1920s culminated in the [[General Strike of 1926]]. Still suffering from the long-term economic effects of the First World War, Britain was severely impacted by the [[Great Depression in the United Kingdom|Great Depression]] (1929–1932), which intensified hardship in old industrial areas in traditional sectors, led to mass unemployment peaking near 3 million, and precipitated widespread political instability and social unrest. [[National Government (1931)|A coalition government]] was formed in 1931.<ref>Rubinstein, W.D. (2004). ''Capitalism, Culture, and Decline in Britain, 1750–1990''. Abingdon: Routledge. p. 11. {{ISBN|978-0-415-03719-8}}.</ref>
Nonetheless, Britain was described as "a very wealthy country, formidable in arms, ruthless in pursuit of its interests and sitting at the heart of a global production system."<ref name="Edgerton2012">{{Cite book |last=Edgerton |first=David |date=2012 |title=Britain's War Machine |url=https://www.penguin.co.uk/books/55731/britain-s-war-machine/9780141026107.html |access-date=10 May 2020 |publisher=Penguin |postscript=none |archive-date=28 April 2020 |archive-url=https://web.archive.org/web/20200428080558/https://www.penguin.co.uk/books/55731/britain-s-war-machine/9780141026107.html |url-status=live}}; {{Cite web |title=Britain's War Machine: Weapons, Resources and Experts in the Second World War |url=https://reviews.history.ac.uk/review/1114 |access-date=10 May 2020 |website=[[Reviews in History]] |archive-date=12 June 2020 |archive-url=https://web.archive.org/web/20200612173058/https://reviews.history.ac.uk/review/1114 |url-status=live}}</ref> After [[Nazi Germany]]'s [[invasion of Poland]] in 1939, Britain entered the [[Second World War]]. Despite the defeat of its European allies in the first year, Britain and its empire continued the war against Germany.<ref name="Edgerton2012" />
In 1940, the [[Royal Air Force]] successfully defended British airspace by repelling the German ''[[Luftwaffe]]'' in the [[Battle of Britain]]. Urban areas suffered heavy bombing during [[the Blitz]]. The [[Grand Alliance (World War II)|Grand Alliance]] of Britain, the United States and the [[Soviet Union]] formed in 1941, leading the [[Allies of World War II|Allies]] against the [[Axis powers]]. There were eventual hard-fought victories in the [[Battle of the Atlantic]], the [[North Africa campaign]] and the [[Italian campaign (World War II)|Italian campaign]]. British forces played important roles in the [[Normandy landings]] of 1944 and the [[liberation of Europe]]. The British Army led the [[Burma campaign]] against Japan, and the [[British Pacific Fleet]] fought Japan at sea. [[British contribution to the Manhattan Project|British scientists contributed]] to the American [[Manhattan Project]], whose task was to build a [[nuclear weapon]].<ref>{{cite book |author=Septimus H. Paul |url=https://books.google.com/books?id=fSZpgW-N628C&pg=PA1 |title=Nuclear Rivals: Anglo-American Atomic Relations, 1941–1952 |publisher=Ohio State U.P. |year=2000 |isbn=978-0-8142-0852-6 |pages=1–5}}</ref>
=== Post-war 20th century ===
{{Main|Post-war Britain (1945–1979)|Social history of post-war Britain (1945–1979)}}
[[File:British Empire 1921.png|thumb|right|upright=1.4|The [[British Empire]] at its territorial peak in 1921]]
The United Kingdom was one of the [[Big Three (World War II)|Big Three]] powers (with the United States and the Soviet Union) who met to plan the [[Aftermath of World War II|post-war world]];<ref>{{Cite book |last1=Doenecke |first1=Justus D. |url=https://books.google.com/books?id=xdMF9rX6mX8C&pg=PA62 |title=Debating Franklin D. Roosevelt's foreign policies, 1933–1945 |last2=Stoler |first2=Mark A. |year=2005 |publisher=Rowman & Littlefield |isbn=978-0-8476-9416-7 |access-date=19 March 2016 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141231/https://books.google.com/books?id=xdMF9rX6mX8C&pg=PA62#v=onepage&q&f=false |url-status=live|author-link=Justus Drew Doenecke}}; {{Cite book |last=Kelly |first=Brian |url=https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=37681 |title=The Four Policemen and Postwar Planning, 1943–1945: The Collision of Realist and Idealist Perspectives |publisher=Indiana University of Pennsylvania |access-date=25 August 2015 |archive-date=22 October 2015 |archive-url=https://web.archive.org/web/20151022125442/https://www.iup.edu/WorkArea/DownloadAsset.aspx?id=37681 |url-status=live}}</ref> it drafted the [[Declaration by United Nations]] with the United States and became one of the five permanent members of the [[United Nations Security Council]]. It worked closely with the United States to establish the [[International Monetary Fund]], the [[World Bank]] and [[NATO]].<ref>{{Cite web |date=22 July 2010 |title=The "Special Relationship" between Great Britain and the United States Began with FDR |work=Roosevelt Institute |url=http://rooseveltinstitute.org/special-relationship-between-great-britain-and-united-states-began-fdr |archive-url=https://web.archive.org/web/20180125021103/http://rooseveltinstitute.org/special-relationship-between-great-britain-and-united-states-began-fdr |archive-date=25 January 2018 |access-date=24 January 2018 |quote=and the joint efforts of both powers to create a new post-war strategic and economic order through the drafting of the Atlantic Charter; the establishment of the International Monetary Fund and the World Bank; and the creation of the United Nations.}}; {{Cite press release |title=Remarks by the President Obama and Prime Minister Cameron in Joint Press Conference |date=22 April 2016 |publisher=The White House |url=https://obamawhitehouse.archives.gov/the-press-office/2016/04/22/remarks-president-obama-and-prime-minister-cameron-joint-press |quote=That's what we built after World War II. The United States and the UK designed a set of institutions – whether it was the United Nations, or the Bretton Woods structure, IMF, World Bank, NATO, across the board. |access-date=24 January 2018 |archive-date=8 June 2021 |archive-url=https://web.archive.org/web/20210608110653/https://obamawhitehouse.archives.gov/the-press-office/2016/04/22/remarks-president-obama-and-prime-minister-cameron-joint-press |url-status=live}}</ref> The war left the UK severely weakened and financially dependent on the American [[Marshall Plan]],<ref>{{Cite news |date=28 December 2006 |title=Britain to make its final payment on World War II loan from U.S. |work=The New York Times |url=https://www.nytimes.com/2006/12/28/business/worldbusiness/28iht-nazi.4042453.html |access-date=25 August 2011 |archive-date=20 August 2017 |archive-url=https://web.archive.org/web/20170820022220/http://www.nytimes.com/2006/12/28/business/worldbusiness/28iht-nazi.4042453.html |url-status=live}}</ref> but it was spared the total war that devastated [[eastern Europe]].<ref>{{Cite news |last=Reynolds |first=David |date=17 April 2011 |title=Britain's War Machine by David Edgerton – review |work=The Guardian |location=London |url=https://www.theguardian.com/books/2011/apr/17/britains-war-machine-david-edgerton-review |access-date=10 May 2020 |archive-date=12 June 2020 |archive-url=https://web.archive.org/web/20200612130213/https://www.theguardian.com/books/2011/apr/17/britains-war-machine-david-edgerton-review |url-status=live}}</ref>
In the immediate post-war years the [[Labour Government 1945–1951|Labour government]] under [[Clement Attlee]] initiated a radical programme of reforms, which significantly affected British society [[Post-war consensus|in the following decades]].<ref>{{Cite book |last=Francis |first=Martin |title=Ideas and policies under Labour, 1945–1951: Building a new Britain |publisher=Manchester University Press |year=1997 |isbn=978-0-7190-4833-3 |pages=225–233}}</ref> Major industries and public utilities were [[nationalised]], a [[welfare state]] was established, and a comprehensive, publicly funded healthcare system, the [[National Health Service]], was created.<ref>{{Cite book |last=Lee |first=Stephen J. |url=https://archive.org/details/aspectsbritishpo00lees |title=Aspects of British political history, 1914–1995 |publisher=Routledge |year=1996 |isbn=978-0-415-13103-2 |location=London; New York |pages=[https://archive.org/details/aspectsbritishpo00lees/page/n183 173]–199 |url-access=limited}}</ref> The rise of nationalism in the colonies coincided with Britain's much-diminished economic position after [[History of the United Kingdom during the First World War|its involvement in the First World War]] and [[Military history of the United Kingdom during World War II|in the Second World War]], so that a policy of [[decolonisation]] was unavoidable.<ref>{{cite book |last=Brown |first=Judith |author-link=Judith M. Brown |url=https://books.google.com/books?id=CpSvK3An3hwC |title=The Twentieth Century, The Oxford History of the British Empire Volume IV |publisher=Oxford University Press |year=1998 |isbn=978-0-19-924679-3 |ref=refOHBEv4 |access-date=22 July 2009 |archive-url=https://web.archive.org/web/20140103114315/http://books.google.com/books?id=CpSvK3An3hwC |archive-date=3 January 2014 |url-status=live}} p. 319.</ref><ref>{{cite book |last=Louis |first=Wm. Roger |url=https://books.google.com/books?id=NQnpQNKeKKAC |title=Ends of British Imperialism: The Scramble for Empire, Suez and Decolonization |publisher=I.B. Tauris |year=2006 |isbn=978-1-84511-347-6 |ref=refLouis2006 |access-date=22 July 2009 |archive-url=https://web.archive.org/web/20170222045215/https://books.google.com/books?id=NQnpQNKeKKAC |archive-date=22 February 2017 |url-status=live}} p. 337.</ref><ref>{{cite book |last=Abernethy |first=David |url=https://books.google.com/books?id=ennqNS1EOuMC |title=The Dynamics of Global Dominance, European Overseas Empires 1415–1980 |publisher=Yale University Press |year=2000 |isbn=978-0-300-09314-8 |ref=refAbernethy2000 |access-date=22 July 2009 |archive-url=https://web.archive.org/web/20111214082531/http://books.google.com/books?id=ennqNS1EOuMC |archive-date=14 December 2011 |url-status=live}} p. 146.</ref> Independence was granted to India and Pakistan in 1947.<ref>{{Cite book |last=Larres |first=Klaus |url=https://books.google.com/books?id=7D66_9YOof4C&pg=PA118 |title=A companion to Europe since 1945 |publisher=Wiley-Blackwell |year=2009 |isbn=978-1-4051-0612-2 |location=Chichester |page=118 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141350/https://books.google.com/books?id=7D66_9YOof4C&pg=PA118 |url-status=live}}</ref> Over the next three decades, most colonies of the British Empire gained their independence, and many became members of the [[Commonwealth of Nations]].<ref>{{Cite web |date=19 March 2009 |title=Country List |url=http://www.thecommonwealth.org/Templates/System/YearbookHomePage.asp?NodeID=152099&load=countrylist |archive-url=https://web.archive.org/web/20130506071236/http://www.thecommonwealth.org/Templates/System/YearbookHomePage.asp?NodeID=152099&load=countrylist |archive-date=6 May 2013 |access-date=8 March 2015 |publisher=[[Commonwealth Secretariat]]}}</ref>
The UK was the third country to develop [[Nuclear weapons and the United Kingdom|a nuclear weapons arsenal]], with its first atomic bomb test, [[Operation Hurricane]], in 1952, although the post-war limitations of Britain's international role were illustrated by the [[Suez Crisis]] of 1956. As a result of a shortage of workers in the 1950s, the government [[Modern immigration to the United Kingdom|encouraged immigration]] from [[Commonwealth countries]]. In the following decades the UK became a more [[Multiracialism|multiracial]] and [[Multiculturalism|multicultural]] society.<ref>{{Cite book |last=Julios |first=Christina |url=https://books.google.com/books?id=s3RQ4dsFEkoC&pg=PA84 |title=Contemporary British identity: English language, migrants, and public discourse |publisher=Ashgate |year=2008 |isbn=978-0-7546-7158-9 |series=Studies in migration and diaspora |location=Aldershot |page=84 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141350/https://books.google.com/books?id=s3RQ4dsFEkoC&pg=PA84 |url-status=live}}</ref> Despite rising living standards in the late 1950s and 1960s, the United Kingdom's economic performance was less successful than many of its main competitors such as France, [[West Germany]] and Japan. In 1969, the United Kingdom was the first democratic nation to [[Representation of the People Act 1969|lower its voting age to 18]].<ref>{{Cite journal |last1=Loughran |first1=Thomas |last2=Mycock |first2=Andrew |last3=Tonge |first3=Jonathan |date=3 April 2021 |title=A coming of age: how and why the UK became the first democracy to allow votes for 18-year-olds |url=https://www.tandfonline.com/doi/full/10.1080/13619462.2021.1890589 |journal=Contemporary British History |volume=35 |issue=2 |pages=284–313 |doi=10.1080/13619462.2021.1890589 |issn=1361-9462 |s2cid=233956982 |access-date=24 May 2024 |archive-date=4 June 2023 |archive-url=https://web.archive.org/web/20230604093606/https://www.tandfonline.com/doi/full/10.1080/13619462.2021.1890589 |url-status=live |url-access=subscription}}</ref>
In the decades-long process of [[European integration]] the UK was a founding member of the [[Western European Union]], established with the [[London and Paris Conferences]] in 1954. In 1960 the UK was one of the seven founding members of the [[European Free Trade Association]] (EFTA), but in 1973 it left to join the [[European Communities]] (EC). In a [[1975 United Kingdom European Communities membership referendum|1975 referendum]] 67 per cent voted to stay in it.<ref>{{Cite news |title=1975: UK embraces Europe in referendum |work=BBC News |url=http://news.bbc.co.uk/onthisday/hi/dates/stories/june/6/newsid_2499000/2499297.stm |access-date=8 March 2015 |archive-date=20 June 2018 |archive-url=https://web.archive.org/web/20180620044520/http://news.bbc.co.uk/onthisday/hi/dates/stories/june/6/newsid_2499000/2499297.stm |url-status=live}}</ref> When the EC became the [[European Union]] (EU) in 1993, the UK was one of the 12 founding member states.
From the late 1960s, Northern Ireland experienced communal and [[paramilitary]] violence, sometimes affecting other parts of the UK, known as [[the Troubles]]. It is usually considered to have ended with the 1998 [[Belfast Agreement|Belfast "Good Friday" Agreement]].<ref>{{Cite book |last=Aughey |first=Arthur |url=https://archive.org/details/politicsnorthern00augh |title=The Politics of Northern Ireland: Beyond the Belfast Agreement |publisher=Routledge |year=2005 |isbn=978-0-415-32788-6 |location=London |page=[https://archive.org/details/politicsnorthern00augh/page/n15 7] |url-access=limited}}; "The troubles were over, but the killing continued. Some of the heirs to Ireland's violent traditions refused to give up their inheritance." {{Cite book |last=Holland |first=Jack |url=https://archive.org/details/hopeagainsthisto00holl/page/221 |title=Hope against History: The Course of Conflict in Northern Ireland |publisher=Henry Holt |year=1999 |isbn=978-0-8050-6087-4 |location=New York |page=[https://archive.org/details/hopeagainsthisto00holl/page/221 221]}}; Elliot, Marianne (2007). ''The Long Road to Peace in Northern Ireland: Peace Lectures from the Institute of Irish Studies at Liverpool University.'' University of Liverpool Institute of Irish Studies, Liverpool University Press. p. 2. {{ISBN|978-1-84631-065-2}}.</ref> Following a period of widespread economic slowdown and industrial strife in the 1970s, the [[Conservative Party (UK)|Conservative]] government of the 1980s led by [[Margaret Thatcher]] initiated a radical policy of [[monetarism]], [[deregulation]], particularly of the financial sector (for example, the [[Big Bang (financial markets)|Big Bang]] in 1986) and labour markets, the sale of state-owned companies (privatisation), and the withdrawal of subsidies to others.<ref>{{Cite book |last=Dorey |first=Peter |title=British politics since 1945 |publisher=Blackwell |year=1995 |isbn=978-0-631-19075-2 |series=Making contemporary Britain |location=Oxford |pages=164–223}}</ref>
In 1982, [[Argentina]] invaded the British territories of [[South Georgia and the South Sandwich Islands|South Georgia]] and the [[Falkland Islands]], leading to the 10-week [[Falklands War]] in which Argentine forces were defeated. The inhabitants of the islands strongly favour British sovereignty, expressed in a [[2013 Falkland Islands sovereignty referendum|2013 referendum]]. From 1984 the British economy was helped by the inflow of substantial [[North Sea oil]] revenues.<ref>{{Cite book |last1=Griffiths, Alan |url=http://vig.pearsoned.co.uk/catalog/uploads/Griffiths_C01.pdf |title=Applied Economics |last2=Wall, Stuart |publisher=Financial Times Press |year=2007 |isbn=978-0-273-70822-3 |edition=11th |location=Harlow |page=6 |access-date=26 December 2010 |archive-date=23 August 2009 |archive-url=https://web.archive.org/web/20090823124048/http://vig.pearsoned.co.uk/catalog/uploads/Griffiths_C01.pdf |url-status=dead}}</ref> Another British Overseas Territory, [[Gibraltar]],<ref>{{cite wikisource |title=Peace and Friendship Treaty of Utrecht between Spain and Great Britain}}</ref> is [[Port of Gibraltar|a key military base]]; a [[2002 Gibraltar sovereignty referendum|referendum in 2002]] on shared sovereignty with Spain was rejected.
By the late 20th century, major changes were made to the governance of the UK with the establishment of [[devolution|devolved]] administrations for Scotland, Wales and Northern Ireland.<ref>{{Cite journal |last=Keating |first=Michael |date=1 January 1998 |title=Reforging the Union: Devolution and Constitutional Change in the United Kingdom |journal=Publius: The Journal of Federalism |volume=28 |issue=1 |pages=217–234 |doi=10.1093/oxfordjournals.pubjof.a029948}}</ref> [[Human Rights Act 1998|The statutory incorporation]] followed acceptance of the [[European Convention on Human Rights]]. The UK remained a [[List of modern great powers#United Kingdom|great power]] with global diplomatic and military influence and a leading role in the United Nations and NATO.<ref name="David M. McCourt">{{Cite book |last=McCourt |first=David |url=https://books.google.com/books?id=lwpOnwEACAAJ&q=Britain+and+World+Power+Since+1945:+Constructing+a+Nation%27s+Role+in+International+Politics |title=Britain and World Power Since 1945: Constructing a Nation's Role in International Politics |publisher=[[University of Michigan Press]] |year=2014 |isbn=978-0-472-07221-7 |access-date=21 October 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141741/https://books.google.com/books?id=lwpOnwEACAAJ&q=Britain+and+World+Power+Since+1945:+Constructing+a+Nation%27s+Role+in+International+Politics |url-status=live}}</ref>
=== 21st century ===
{{Main|Political history of the United Kingdom (1979–present)|Social history of the United Kingdom (1979–present)}}
[[File:Johnson signed Brexit Withdrawal Agreement.jpg|thumb|Prime Minister [[Boris Johnson]] signs the [[Brexit withdrawal agreement]] in 2020, formally [[Brexit|withdrawing the UK]] from the [[European Union]] (EU).]]
The United Kingdom broadly supported the United States' approach to the "[[war on terror]]" in the early 21st century.<ref>{{Cite news |last=McSmith |first=Andy |date=5 July 2016 |title=The inside story of how Tony Blair led Britain to war in Iraq |work=Independent |location=London |url=https://www.independent.co.uk/news/uk/politics/chilcot-report-iraq-war-inquiry-tony-blair-george-bush-us-uk-what-happened-a7119761.html |access-date=17 February 2022 |archive-date=4 July 2016 |archive-url=https://web.archive.org/web/20160704200931/https://www.independent.co.uk/news/uk/politics/chilcot-report-iraq-war-inquiry-tony-blair-george-bush-us-uk-what-happened-a7119761.html |url-status=live}}</ref> British troops fought in the [[War in Afghanistan (2001–2021)|war in Afghanistan]], but controversy surrounded Britain's [[Iraq War|military deployment in Iraq]], which saw the [[15 February 2003 anti-war protests|largest protest in British history]] in opposition to the government led by [[Tony Blair]].<ref>{{Cite news |last=Adams |first=Tim |date=11 February 2023 |title='A beautiful outpouring of rage': did Britain's biggest ever protest change the world? |work=The Observer |location=London |url=https://www.theguardian.com/uk-news/2023/feb/11/slugs-iraq-war-london-protest-2003-legacy |access-date=5 June 2023 |archive-date=6 April 2023 |archive-url=https://web.archive.org/web/20230406052000/https://www.theguardian.com/uk-news/2023/feb/11/slugs-iraq-war-london-protest-2003-legacy |url-status=live}}</ref>
The [[Great Recession]] (2007–2010) severely affected the British economy,<ref name="Latest UK GDP data">{{cite web |date=20 December 2013 |title=Quarterly National Accounts – National accounts aggregates (ABMI Gross Domestic Product: chained volume measures: Seasonally adjusted £m, constant prices) |url=http://www.ons.gov.uk/ons/datasets-and-tables/data-selector.html?cdid=ABMI&dataset=qna&table-id=A2 |publisher=Office for National Statistics |access-date=28 July 2023 |archive-date=29 September 2015 |archive-url=https://web.archive.org/web/20150929150429/http://www.ons.gov.uk/ons/datasets-and-tables/data-selector.html?cdid=ABMI&dataset=qna&table-id=A2 |url-status=live}}</ref> and was followed by a period of weak growth and stagnation.<ref>{{Cite web |last=Harari |first=Daniel |date=16 July 2024 |title=Low growth: The economy's biggest challenge |url=https://commonslibrary.parliament.uk/low-growth-the-economys-biggest-challenge/#:~: |access-date=16 April 2025 |website=House of Commons Library}}</ref><ref>{{Cite news |last1=Rees |first1=Tom |last2=Atkinson |first2=Andrew |last3=Aldrick |first3=Philip |date=12 March 2023 |title=A Lost Decade Worse Than Japan's Threatens to Change UK Forever |url=https://www.bloomberg.com/news/articles/2023-03-12/a-lost-decade-worse-than-japan-s-threatens-to-change-uk-forever |access-date=16 April 2025 |work=[[Bloomberg News]] |archive-date=13 March 2023 |archive-url=https://web.archive.org/web/20230313051724/https://www.bloomberg.com/news/articles/2023-03-12/a-lost-decade-worse-than-japan-s-threatens-to-change-uk-forever |url-status=live }}</ref> The [[Cameron–Clegg coalition]] government of 2010 introduced [[United Kingdom government austerity programme|austerity measures]] intended to tackle the substantial public deficits.<ref>{{Cite news |date=7 November 2022 |title=What is austerity and where could 'eye-watering' cuts fall now? |work=BBC News |url=https://www.bbc.com/news/63304224 |access-date=28 July 2023 |archive-date=28 July 2023 |archive-url=https://web.archive.org/web/20230728105646/https://www.bbc.com/news/63304224 |url-status=live}}</ref> [[2014 Scottish independence referendum|A referendum]] on [[Scottish independence]] in 2014 resulted in the Scottish electorate voting by 55.3 to 44.7 per cent to remain part of the United Kingdom.<ref>{{Cite web |title=Scottish independence referendum – Results |url=https://www.bbc.co.uk/news/events/scotland-decides/results |access-date=18 February 2022 |website=BBC News |archive-date=18 September 2014 |archive-url=https://web.archive.org/web/20140918212409/https://www.bbc.co.uk/news/events/scotland-decides/results |url-status=live}}</ref>
In 2016, 51.9 per cent of voters in the UK [[2016 United Kingdom European Union membership referendum|voted to leave the European Union]] (EU).<ref>{{Cite news |date=24 June 2016 |title=In stunning decision, Britain votes to leave the E.U. |newspaper=[[The Washington Post]] |url=https://www.washingtonpost.com/world/britons-head-to-the-polls-for-historic-vote-on-eu/2016/06/23/0d466fb0-34a7-11e6-ab9d-1da2b0f24f93_story.html |access-date=24 June 2016 |first1=Griff |last1=Witte |first2=Karla |last2=Adam |first3=Dan |last3=Balz |archive-date=30 November 2022 |archive-url=https://web.archive.org/web/20221130215030/https://www.washingtonpost.com/world/britons-head-to-the-polls-for-historic-vote-on-eu/2016/06/23/0d466fb0-34a7-11e6-ab9d-1da2b0f24f93_story.html |url-status=live}}</ref> The [[Brexit|UK left the EU]] in 2020.<ref>{{Cite news |date=1 January 2021 |title=Brexit: New era for UK as it completes separation from European Union |work=BBC News |url=https://www.bbc.com/news/uk-politics-55502781 |access-date=18 February 2022 |archive-date=14 January 2021 |archive-url=https://web.archive.org/web/20210114212309/https://www.bbc.com/news/uk-politics-55502781 |url-status=live}}</ref> On 1 May 2021 the [[EU–UK Trade and Cooperation Agreement]], a free trade agreement between the UK and the EU, came into force.<ref name="commission.europa.eu">{{Cite web |title=The EU-UK Trade and Cooperation Agreement |url=https://commission.europa.eu/strategy-and-policy/relations-non-eu-countries/relations-united-kingdom/eu-uk-trade-and-cooperation-agreement_en |archive-url=https://web.archive.org/web/20230325155905/https://commission.europa.eu/strategy-and-policy/relations-non-eu-countries/relations-united-kingdom/eu-uk-trade-and-cooperation-agreement_en |archive-date=25 March 2023 |access-date=25 March 2023}}</ref><ref>{{Cite web |access-date=12 September 2025 |title=Free Trade Agreements EU-UK |url=https://rtais.wto.org/UI/PublicShowRTAIDCard.aspx?rtaid=1137}}</ref>
The [[COVID-19 pandemic in the United Kingdom|COVID-19 pandemic]] had a severe [[Economic impact of the COVID-19 pandemic in the United Kingdom|impact on the British economy]], caused major [[Impact of the COVID-19 pandemic on education in the United Kingdom|disruptions to education]] and had [[Social impact of the COVID-19 pandemic in the United Kingdom|far-reaching impacts on society and politics]] in 2020 and 2021.<ref name="GOVUK">{{cite web |url=https://coronavirus.data.gov.uk/ |title=Coronavirus (COVID-19) in the UK |website=[[gov.uk]] |publisher=Government of the United Kingdom |access-date=15 April 2020 |archive-url=https://web.archive.org/web/20210501022145/https://coronavirus.data.gov.uk/ |archive-date=1 May 2021}}</ref><ref>{{Cite web |title=Coronavirus and the impact on output in the UK economy: April 2020 |url=https://www.ons.gov.uk/economy/grossdomesticproductgdp/articles/coronavirusandtheimpactonoutputintheukeconomy/april2020 |access-date=2 August 2020 |publisher=Government of the United Kingdom |website=ons.gov.uk |archive-date=2 August 2020 |archive-url=https://web.archive.org/web/20200802031859/https://www.ons.gov.uk/economy/grossdomesticproductgdp/articles/coronavirusandtheimpactonoutputintheukeconomy/april2020 |url-status=live}}</ref><ref>{{Cite news |last=Walker |first=Andrew |date=10 June 2020 |title=Coronavirus: UK economy could be among worst hit of leading nations, says OECD |work=BBC News |url=https://www.bbc.com/news/business-52991913 |access-date=2 August 2020 |archive-date=18 August 2020 |archive-url=https://web.archive.org/web/20200818031423/https://www.bbc.com/news/business-52991913 |url-status=live}}</ref> The United Kingdom was the first country in the world to use an approved [[COVID-19 vaccine]]. Developing a [[Oxford–AstraZeneca COVID-19 vaccine|vaccine in the UK]] allowed the rollout to be amongst the fastest in the world.<ref>{{Cite web |title=Landmark moment as first NHS patient receives COVID-19 vaccination |url=https://www.england.nhs.uk/2020/12/landmark-moment-as-first-nhs-patient-receives-covid-19-vaccination/ |archive-url=https://web.archive.org/web/20230225194320/https://www.england.nhs.uk/2020/12/landmark-moment-as-first-nhs-patient-receives-covid-19-vaccination/ |archive-date=25 February 2023 |website=NHS |date=8 December 2020}}</ref><ref>{{Cite web |title=Oxford University/AstraZeneca COVID-19 vaccine approved |url=https://www.gov.uk/government/news/oxford-universityastrazeneca-covid-19-vaccine-approved |archive-url=https://web.archive.org/web/20230225194442/https://www.gov.uk/government/news/oxford-universityastrazeneca-covid-19-vaccine-approved |archive-date=25 February 2023 |website=UK Government}}</ref>
== Geography ==
{{Main|Geography of the United Kingdom|Fauna of Great Britain|Flora of Great Britain and Ireland}}
[[File:MODIS - Great Britain and Northern Ireland - 2012-06-04 during heat wave (cropped).jpg|thumb|upright|A satellite image of the United Kingdom excluding [[Shetland]]]]
The total area of the United Kingdom is approximately {{Convert|244376|km2|sqmi|order=flip}},{{efn|name=ONSArea}}<ref name="ONS Standard Area Measurement" /> with a land area of {{convert|242741|km2|sqmi|order=flip}}.<ref name="ONS Standard Area Measurement" /> It occupies the major part of the [[British Isles]]<ref>[[Oxford English Dictionary]]: "British Isles: a geographical term for the islands comprising Great Britain and Ireland with all their offshore islands including the Isle of Man and the Channel Islands."</ref> and includes the island of Great Britain, the north-eastern one-sixth of the island of Ireland and [[List of islands of the United Kingdom|some smaller surrounding islands]], meaning it comprises [[England]], [[Scotland]], [[Wales]] and [[Northern Ireland]].<ref name="ONS Geography Guide">{{cite web |url=https://geoportal.statistics.gov.uk/datasets/d1f39e20edb940d58307a54d6e1045cd/about |title=A Beginner's Guide to UK Geography (2023) |author=<!--Not stated--> |date=4 February 2025 |website=Open Geography Portal |publisher=Office for National Statistics |access-date=14 May 2025}}</ref>
Geographically, the United Kingdom lies between the [[North Atlantic Ocean]] and the [[North Sea]] with the southeast coast coming within {{Convert|35|km|mi|0|order=flip}} of the coast of northern France, from which it is separated by the [[English Channel]].<ref name="factbook">{{Cite web |title=United Kingdom |url=https://www.cia.gov/the-world-factbook/countries/united-kingdom |access-date=21 January 2007 |website=[[The World Factbook]] |publisher=Central Intelligence Agency |archive-date=9 January 2021 |archive-url=https://web.archive.org/web/20210109221834/https://www.cia.gov/the-world-factbook/countries/united-kingdom |url-status=dead}}</ref>
The nearby island polities of the [[Isle of Man]], [[Jersey]] and [[Guernsey]] are [[Crown Dependencies]], in union with the [[Monarchy of the United Kingdom|British monarch]], but do not strictly form part of the United Kingdom or any of its three jurisdictions or four countries, although the British government retains responsibility for their external affairs. The Isle of Man lies roughly midway between Great Britain and the [[Ireland|island of Ireland]] in the [[Irish Sea]], while the Channel Islands lie just off the northern French coast.
The [[Royal Observatory, Greenwich|Royal Greenwich Observatory]] in London was chosen as the defining point of the [[Prime Meridian]]<ref>{{Cite web |last=ROG Learning Team |date=23 August 2002 |title=The Prime Meridian at Greenwich |url=http://www.rmg.co.uk/explore/astronomy-and-time/astronomy-facts/history/the-prime-meridian-at-greenwich |archive-url=https://web.archive.org/web/20151107023957/http://www.rmg.co.uk/explore/astronomy-and-time/astronomy-facts/history/the-prime-meridian-at-greenwich |archive-date=7 November 2015 |access-date=11 September 2012 |website=Royal Museums Greenwich}}</ref> at the [[International Meridian Conference]] in 1884.<ref>{{Cite news |date=13 August 2015 |title=Greenwich Royal Observatory: How the Prime Meridian line is actually 100 metres away from where it was believed to be |work=Independent |location=London |url=https://www.independent.co.uk/news/science/greenwich-royal-observatory-how-the-prime-meridian-line-is-actually-100-metres-away-from-where-it-10452386.html |access-date=13 December 2018 |archive-date=23 March 2019 |archive-url=https://web.archive.org/web/20190323081414/https://www.independent.co.uk/news/science/greenwich-royal-observatory-how-the-prime-meridian-line-is-actually-100-metres-away-from-where-it-10452386.html |url-status=live}}</ref>
The UK lies between latitudes [[49th parallel north|49°]] and [[61st parallel north|61° N]], and longitudes [[9th meridian west|9° W]] and [[2nd meridian east|2° E]]. Northern Ireland shares a {{Convert|499|km|mi|0|adj=on|order=flip}} land boundary with the Republic of Ireland<ref name="factbook" /> and has a {{Convert|650|km|mi|0|adj=on|order=flip}} coastline.<ref name="NI coastline">{{Cite web |title=Northern Ireland Coastal and Marine Forum |url=https://library2.nics.gov.uk/pdf/dard/2014/EEUD.pdf |archive-url=https://web.archive.org/web/20241123094028/https://library2.nics.gov.uk/pdf/dard/2014/EEUD.pdf |archive-date=23 November 2024 |access-date=13 March 2025 |publisher=Northern Ireland Coastal and Marine Forum}}</ref> The length of coastline of Great Britain plus its principal islands is about {{Convert|31368|km|mi|0|order=flip}} long, with the coastline of the main island Great Britain being {{Convert|17820|km|mi|0|order=flip}} of that,<ref name="UK coastline">{{Cite web |last=Darkes |first=Giles |date=January 2008 |title=How long is the UK coastline? |url=http://www.cartography.org.uk/default.asp?contentID=749 |archive-url=https://web.archive.org/web/20120522042745/http://www.cartography.org.uk/default.asp?contentID=749 |archive-date=22 May 2012 |access-date=24 January 2015 |publisher=The [[British Cartographic Society]]}}</ref> though measurements can vary greatly due to the [[coastline paradox]].<ref>{{Cite web |last=Weiner |first=Sophie |date=3 March 2018 |title=Why it's Impossible to Accurately Measure a Coastline |url=https://www.popularmechanics.com/science/environment/a19068718/why-its-impossible-to-accurately-measure-a-coastline/ |access-date=29 June 2024 |website=Popular Mechanics |archive-date=29 June 2024 |archive-url=https://web.archive.org/web/20240629025825/https://www.popularmechanics.com/science/environment/a19068718/why-its-impossible-to-accurately-measure-a-coastline/ |url-status=live}}</ref> It is connected to continental Europe by the [[Channel Tunnel]], which at {{Convert|50|km|mi|0|order=flip}} ({{Convert|38|km|mi|0|order=flip}} underwater) is the longest underwater tunnel in the world.<ref>{{Cite web |title=The Channel Tunnel |url=http://www.eurotunnel.com/ukcP3Main/ukcCorporate/ukcTunnelInfrastructure/ukcInfrastructure |archive-url=https://web.archive.org/web/20101218114514/http://www.eurotunnel.com/ukcP3Main/ukcCorporate/ukcTunnelInfrastructure/ukcInfrastructure |archive-date=18 December 2010 |access-date=8 March 2015 |publisher=Eurotunnel}}</ref>
The UK contains four terrestrial [[ecoregion]]s: [[Celtic broadleaf forests]], [[English Lowlands beech forests]], [[North Atlantic moist mixed forests]], and [[Caledonian Forest|Caledonian conifer forests]].<ref>{{Cite journal |last1=Dinerstein |first1=Eric |last2=Olson |first2=David |last3=Joshi |first3=Anup |last4=Vynne |first4=Carly |last5=Burgess |first5=Neil D. |last6=Wikramanayake |first6=Eric |last7=Hahn |first7=Nathan |last8=Palminteri |first8=Suzanne |last9=Hedao |first9=Prashant |last10=Noss |first10=Reed |last11=Hansen |first11=Matt |last12=Locke |first12=Harvey |last13=Ellis |first13=Erle C |last14=Jones |first14=Benjamin |last15=Barber |first15=Charles Victor |display-authors=1 |year=2017 |title=An Ecoregion-Based Approach to Protecting Half the Terrestrial Realm |journal=BioScience |volume=67 |issue=6 |pages=534–545 |doi=10.1093/biosci/bix014 |issn=0006-3568 |pmc=5451287 |pmid=28608869 |doi-access=free |last16=Hayes |first16=Randy |last17=Kormos |first17=Cyril |last18=Martin |first18=Vance |last19=Crist |first19=Eileen |last20=Sechrest |first20=Wes |last21=Price |first21=Lori |last22=Baillie |first22=Jonathan E. M. |last23=Weeden |first23=Don |last24=Suckling |first24=Kierán |last25=Davis |first25=Crystal |last26=Sizer |first26=Nigel |last27=Moore |first27=Rebecca |last28=Thau |first28=David |last29=Birch |first29=Tanya |last30=Potapov |first30=Peter |last31=Turubanova |first31=Svetlana |last32=Tyukavina |first32=Alexandra |last33=de Souza |first33=Nadia |last34=Pintea |first34=Lilian |last35=Brito |first35=José C. |last36=Llewellyn |first36=Othman A. |last37=Miller |first37=Anthony G. |last38=Patzelt |first38=Annette |last39=Ghazanfar |first39=Shahina A. |last40=Timberlake |first40=Jonathan |last41=Klöser |first41=Heinz |last42=Shennan-Farpón |first42=Yara |last43=Kindt |first43=Roeland |last44=Lillesø |first44=Jens-Peter Barnekow |last45=van Breugel |first45=Paulo |last46=Graudal |first46=Lars |last47=Voge |first47=Maianna |last48=Al-Shammari |first48=Khalaf F. |last49=Saleem |first49=Muhammad}}</ref> The area of woodland in the UK was estimated to be 3.25 million hectares in 2023, which represents 13 per cent of its land area.<ref>{{Cite web |url=https://www.forestresearch.gov.uk/tools-and-resources/statistics/statistics-by-topic/woodland-statistics/ |title=Woodland Statistics, Key findings |work=Forest Research |access-date=8 July 2023 |archive-date=2 August 2023 |archive-url=https://web.archive.org/web/20230802030149/https://www.forestresearch.gov.uk/tools-and-resources/statistics/statistics-by-topic/woodland-statistics/ |url-status=live}}</ref>
=== Climate ===
{{Main|Climate of the United Kingdom|Climate change in the United Kingdom}}
{{Further|Climate of England|Climate of Scotland|Climate of Wales|Climate of Northern Ireland}}
Most of the United Kingdom has a temperate climate, with generally cool temperatures and plentiful rainfall all year round.<ref name="factbook" /> The temperature varies with the seasons rarely dropping below {{Convert|0|C|lk=on}} or rising above {{Convert|30|C}}.<ref>{{Cite web |title=Hottest day of each year from 1900 |url=https://www.trevorharley.com/hottest-day-of-each-year-from-1900.html |website=trevorharley.com |access-date=23 November 2019 |archive-date=16 June 2023 |archive-url=https://web.archive.org/web/20230616173152/https://www.trevorharley.com/hottest-day-of-each-year-from-1900.html |url-status=live}}; {{Cite web |title=Coldest day of each year from 1900 |url=https://www.trevorharley.com/coldest-days-of-each-year-from-1900.html |website=trevorharley.com |access-date=23 November 2019 |archive-date=9 July 2023 |archive-url=https://web.archive.org/web/20230709173537/https://www.trevorharley.com/coldest-days-of-each-year-from-1900.html |url-status=live}}</ref> Some parts, away from the coast, of upland England, Wales, Northern Ireland and most of Scotland, experience a [[subpolar oceanic climate]]. Higher elevations in Scotland experience a [[Subarctic climate|continental subarctic climate]] and the mountains experience a [[tundra climate]].<ref>{{Cite web |date=9 August 2016 |title=English: A map of Köppen climate types in the United Kingdom (SVG version) |url=https://commons.wikimedia.org/wiki/File:UK_K%C3%B6ppen.svg |access-date=23 November 2019 |archive-date=9 July 2023 |archive-url=https://web.archive.org/web/20230709202702/https://commons.wikimedia.org/wiki/File:UK_K%C3%B6ppen.svg |url-status=live}}</ref>
The prevailing wind is from the southwest and bears frequent spells of mild and wet weather from the Atlantic Ocean,<ref name="factbook" /> although the eastern parts are mostly sheltered from this wind. Since the majority of the rain falls over the western regions, the eastern parts are the driest. Atlantic currents, warmed by the [[Gulf Stream]], bring mild winters, especially in the west where winters are wet and even more so over high ground. Summers are warmest in the southeast of England and coolest in the north. Heavy snowfall can occur in winter and early spring on high ground, and occasionally settles to great depth away from the hills.<ref>{{Cite web |title=Atlantic Ocean Circulation (Gulf Stream) |url=http://ukclimateprojections.metoffice.gov.uk/23152 |access-date=8 March 2015 |website=UK Climate Projections |publisher=Met Office |archive-date=17 October 2018 |archive-url=https://web.archive.org/web/20181017162552/http://ukclimateprojections.metoffice.gov.uk/23152 |url-status=live}}</ref>
The average total annual sunshine in the United Kingdom was 1,339.7 hours between 1971 and 2000.<ref name="ukaverages">{{cite web |title=UK 1971–2000 averages |url=http://www.metoffice.gov.uk/climate/uk/averages/19712000/areal/uk.html |url-status=dead |archive-url=https://web.archive.org/web/20090705140124/http://www.metoffice.gov.uk/climate/uk/averages/19712000/areal/uk.html |archive-date=5 July 2009 |access-date=4 August 2007 |publisher=Met Office}}</ref> The hours of sunshine vary from 1,200 to about 1,580 hours per year.<ref name="met off climate series">{{Cite web |url=https://www.metoffice.gov.uk/research/climate/maps-and-data/uk-temperature-rainfall-and-sunshine-time-series |title=UK temperature, rainfall and sunshine time series |website=Met Office |access-date=31 December 2022 |archive-date=17 October 2019 |archive-url=https://web.archive.org/web/20191017203556/https://www.metoffice.gov.uk/research/climate/maps-and-data/uk-temperature-rainfall-and-sunshine-time-series |url-status=live}}</ref>
Climate change has serious impacts on the country. A third of food price rise in 2023 was attributed to it.<ref>{{cite web |last1=Smeeton |first1=George |title=Families hit by £605 food bill as extreme weather and energy crisis bites |url=https://eciu.net/media/press-releases/2023/families-hit-by-605-food-bill-as-extreme-weather-and-energy-crisis-bites |website=Energy & Climate Intelligence Unit |date=28 November 2023 |access-date=19 July 2024 |archive-date=16 July 2024 |archive-url=https://web.archive.org/web/20240716124143/https://eciu.net/media/press-releases/2023/families-hit-by-605-food-bill-as-extreme-weather-and-energy-crisis-bites |url-status=live}}</ref> In 2024 the United Kingdom ranked 5th out of 180 countries in the [[Environmental Performance Index]].<ref>{{Cite web |title=2024 Environmental Performance Index |url=https://epi.yale.edu/measure/2024/EPI |access-date=27 May 2025 |website=Environmental Performance Index |language=en |archive-date=10 July 2024 |archive-url=https://web.archive.org/web/20240710023935/https://epi.yale.edu/measure/2024/EPI |url-status=live }}</ref> A law has been passed that [[Greenhouse gas emissions by the United Kingdom|UK greenhouse gas emissions]] will be [[net zero]] by 2050.<ref>{{Cite web |title=UK net zero target |url=https://www.instituteforgovernment.org.uk/explainers/net-zero-target#:~:text=In%20June%202019%2C%20parliament%20passed,to%201990%20levels%20by%202050.&text=Prior%20to%20this%2C%20the%20UK,1990%20levels%2C%20also%20by%202050. |access-date=20 March 2024 |website=Institute for Government |date=20 April 2020|last=Shepheard|first=Marcus}}</ref>{{Update after|2050|01|01|category|reason=Hello from 2024! By the time you're reading this, that law will be a little older than 30 years old. Could you check if the UK ever ended up hitting that net zero GHG target?}}
=== Topography ===
[[File:uk topo en.jpg|thumb|right|The United Kingdom's topography]]
[[Geography of England|England]] accounts for 53 per cent of the UK, covering {{Convert|130395|km2|sqmi|order=flip|-1}}.<ref>{{Cite news |date=11 February 2010 |title=England – Profile |work=BBC News |url=http://news.bbc.co.uk/2/hi/europe/country_profiles/7327029.stm |access-date=9 October 2010 |archive-date=15 April 2018 |archive-url=https://web.archive.org/web/20180415064122/http://news.bbc.co.uk/1/hi/world/europe/country_profiles/7327029.stm |url-status=live}}</ref> Most of the country consists of lowland terrain,<ref name="Atlapedia">{{Cite web |last=Latimer Clarke Corporation Pty Ltd |title=United Kingdom – Atlapedia Online |url=http://www.atlapedia.com/online/countries/unitedki.htm |access-date=26 October 2010 |website=Atlapedia.com |archive-date=21 March 2012 |archive-url=https://web.archive.org/web/20120321191308/http://www.atlapedia.com/online/countries/unitedki.htm |url-status=live}}{{better source needed|date=July 2023}}</ref> with upland and mountainous terrain northwest of the [[Tees–Exe line]] which roughly divides the UK into [[lowland and upland]] areas. Lowland areas include [[Cornwall]], the [[New Forest]], the [[South Downs]] and the [[The Broads|Norfolk Broads]]. Upland areas include the [[Lake District]], the [[Pennines]], the [[Yorkshire Dales]], [[Exmoor]] and [[Dartmoor]]. The main rivers and estuaries are the [[River Thames|Thames]], [[River Severn|Severn]], and the [[Humber]]. England's highest mountain is [[Scafell Pike]], at {{Convert|978|m|ft|0}} in the Lake District; its largest island is the [[Isle of Wight]].
[[Geography of Scotland|Scotland]] accounts for 32 per cent of the UK, covering {{Convert|78772|km2|sqmi|order=flip|-1}}.<ref>{{Cite web |title=Scotland Facts |url=http://www.scotland.org/about/fact-file/index.html |archive-url=https://web.archive.org/web/20080621045248/http://www.scotland.org/about/fact-file/index.html |archive-date=21 June 2008 |access-date=16 July 2008 |publisher=Scotland Online Gateway}}</ref> This includes [[List of islands of Scotland|nearly 800 islands]],<ref>{{Cite news |last=Winter |first=Jon |date=1 June 2000 |title=The complete guide to the ... Scottish Islands |work=Independent |location=London |url=https://www.independent.co.uk/travel/uk/the-complete-guide-to-the--scottish-islands-633851.html |access-date=8 March 2015 |archive-date=2 April 2015 |archive-url=https://web.archive.org/web/20150402164423/http://www.independent.co.uk/travel/uk/the-complete-guide-to-the--scottish-islands-633851.html |url-status=live}}</ref> notably the [[Hebrides]], [[Orkney]] Islands and [[Shetland Islands]]. Scotland is the most mountainous constituent country of the UK. The [[Scottish Highlands|Highlands]] to the north and west are the more rugged region containing the majority of Scotland's mountainous land, including the [[Cairngorms]], [[Loch Lomond and The Trossachs]] and [[Ben Nevis]] which at {{Convert|1345|m|ft|0}}<ref>{{Cite web |date=18 March 2016 |title=Great Britain's tallest mountain is taller |work=Ordnance Survey Blog |url=https://www.ordnancesurvey.co.uk/blog/2016/03/britains-tallest-mountain-is-taller |access-date=9 September 2018 |publisher=Ordnance Survey |archive-date=9 September 2018 |archive-url=https://web.archive.org/web/20180909000504/https://www.ordnancesurvey.co.uk/blog/2016/03/britains-tallest-mountain-is-taller/ |url-status=live}}</ref> is the highest point in the British Isles.<ref>{{Cite web |title=Ben Nevis Weather |url=http://www.bennevisweather.co.uk/index.asp |archive-url=https://web.archive.org/web/20120510193022/http://www.bennevisweather.co.uk/index.asp |archive-date=10 May 2012 |access-date=26 October 2008 |publisher=Ben Nevis Weather}}</ref>
[[Geography of Wales|Wales]] accounts for less than 9 per cent of the UK, covering {{Convert|20779|km2|sqmi|order=flip|-1}}.<ref>{{Cite news |date=9 June 2010 |title=Profile: Wales |work=BBC News |url=http://news.bbc.co.uk/2/hi/europe/country_profiles/6233450.stm |access-date=7 November 2010 |archive-date=26 August 2018 |archive-url=https://web.archive.org/web/20180826085704/http://news.bbc.co.uk/2/hi/europe/country_profiles/6233450.stm |url-status=live}}</ref> It is mostly mountainous, though [[South Wales]] is less mountainous than [[North Wales|North]] and [[Mid Wales]]. The highest mountains in Wales are in [[Snowdonia]] and include [[Snowdon]] ({{Langx|cy|Yr Wyddfa}}) which, at {{Convert|1085|m|ft|0}}, is the highest peak in Wales.<ref name="Atlapedia" /> Wales has over {{Convert|1680|mi|0|abbr=off}} of coastline including the [[Pembrokeshire Coast]].<ref name="UK coastline" /> Several islands lie off the Welsh mainland, the largest of which is [[Anglesey]] (''Ynys Môn'').
[[Geography of Ireland|Northern Ireland]], separated from Great Britain by the [[Irish Sea]] and [[North Channel (Great Britain and Ireland)|North Channel]], has an area of {{Convert|14160|km2|sqmi|order=flip|-1}} and is mostly hilly. It includes [[Lough Neagh]] which, at {{Convert|388|km2|sqmi|order=flip|0}}, is the largest lake in the British Isles by area,<ref>{{Cite web |title=Geography of Northern Ireland |url=http://cain.ulst.ac.uk/ni/geog.htm |access-date=22 May 2006 |publisher=University of Ulster |archive-date=18 January 2012 |archive-url=https://web.archive.org/web/20120118133131/http://cain.ulst.ac.uk/ni/geog.htm |url-status=live}}</ref> [[Lough Erne]], which has over 150 islands, and the [[Giant's Causeway]], which is listed by [[UNESCO]] as a [[World Heritage Site]]. The highest peak in Northern Ireland is [[Slieve Donard]] in the [[Mourne Mountains]] at {{Convert|852|m|ft|0}}.<ref name="Atlapedia" />
== Government and politics ==
{{Main|Politics of the United Kingdom|Government of the United Kingdom|Monarchy of the United Kingdom}}
{{Further|Constitution of the United Kingdom}}{{Multiple image
| direction = horizontal
| align = right
| caption_align = center
| total_width = 320
| image1 = King Charles III (July 2023).jpg
| image2 = Prime Minister Andy Burnham portrait (cropped).jpg
| caption1 = {{nowrap|[[Charles III]]}}<br>[[Monarch of the United Kingdom|King]]
| caption2 = {{nowrap|[[Andy Burnham]]}}<br>{{nowrap|[[Prime Minister of the United Kingdom|Prime Minister]]}}
| alt1 =
| alt2 =
}}
The United Kingdom is a [[constitutional monarchy]] and a [[parliamentary democracy]]<ref>[http://www.royal.gov.uk/MonarchUK/HowtheMonarchyworks/Whatisconstitutionalmonarchy.aspx The British Monarchy, "What is constitutional monarchy?"] {{Webarchive|url=https://web.archive.org/web/20190604151257/http://www.royal.gov.uk/MonarchUK/HowtheMonarchyworks/Whatisconstitutionalmonarchy.aspx|date=4 June 2019}}. Retrieved 17 July 2013; [https://www.cia.gov/the-world-factbook/countries/united-kingdom/ "United Kingdom"] {{Webarchive|url=https://web.archive.org/web/20210109221834/https://www.cia.gov/the-world-factbook/countries/united-kingdom/|date=9 January 2021}} CIA ''The World Factbook''. Retrieved 17 July 2013</ref> operating under the [[Westminster system]], otherwise known as a "democratic parliamentary monarchy".<ref>{{Cite journal |last1=Stepan |first1=Alfred |last2=Linz |first2=Juan J. |last3=Minoves |first3=Juli F. |date=2014 |title=Democratic Parliamentary Monarchies |url=http://muse.jhu.edu/content/crossref/journals/journal_of_democracy/v025/25.2.stepan.html |journal=Journal of Democracy |volume=25 |issue=2 |pages=35–36 |doi=10.1353/jod.2014.0032 |issn=1086-3214 |s2cid=154555066 |url-access=subscription |archive-date=31 January 2026 |access-date=11 January 2023 |archive-url=https://web.archive.org/web/20260131155632/https://muse.jhu.edu/content/crossref/journals/journal_of_democracy/v025/25.2.stepan.html |url-status=live }}</ref> It is a [[Centralized government|centralised]], [[unitary state]]<ref>{{Cite web |last=Lewer |first=Andrew |date=5 May 2021 |title=The UK is one of the most centralised advanced democracies – it's time that changed |url=https://www.newstatesman.com/spotlight/2021/05/the-uk-is-one-of-the-most-centralised-advanced-democracies-its-time-that-changed |access-date=3 July 2023 |website=[[New Statesman]] |archive-date=3 July 2023 |archive-url=https://web.archive.org/web/20230703131907/https://www.newstatesman.com/spotlight/2021/05/the-uk-is-one-of-the-most-centralised-advanced-democracies-its-time-that-changed |url-status=live|author-link=Andrew Lewer}}</ref><ref>{{Cite web |title=Centralisation Nation: Britain's system of local government and its impact on the national economy |url=https://www.centreforcities.org/?post_type=publication&p=40951 |access-date=3 July 2023 |website=Centre for Cities |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141833/https://www.centreforcities.org/publication/centralisation-nation/ |url-status=live}}</ref> wherein the [[Parliament of the United Kingdom]] is [[Parliamentary sovereignty in the United Kingdom|sovereign]].<ref>{{Cite web |title=Parliamentary Sovereignty |url=https://www.parliament.uk/site-information/glossary/parliamentary-sovereignty |access-date=19 July 2021 |website=[[parliament.uk]] |archive-date=11 August 2021 |archive-url=https://web.archive.org/web/20210811195135/https://www.parliament.uk/site-information/glossary/parliamentary-sovereignty/ |url-status=live}}</ref> Parliament is made up of the elected [[House of Commons of the United Kingdom|House of Commons]], the appointed [[House of Lords]] and [[the Crown]] (as personified by [[Monarchy of the United Kingdom|the monarch]]).{{Efn|British [[sovereignty]] derives from the Crown, a [[corporation sole]] occupied by the monarch. It is therefore by and through the monarch that Parliament exercises supreme legislative authority over both the executive and judiciary. Distinguished Professor of [[Public Law]] Maurice Sunkin opined the Crown symbolically occupies "...what in other places would be a core element of a written constitution."<ref>{{Cite web |url=https://www.ibanet.org/Relationship-between-UK-Crown-and-law-in-focus-as-Carolean-era-begins |title=Relationship between UK Crown and law in focus as Carolean era begins |author=Polly Botsford |publisher=International Bar Association |publication-date=22 September 2022 |access-date=4 July 2023 |archive-date=6 May 2023 |archive-url=https://web.archive.org/web/20230506211218/https://www.ibanet.org/Relationship-between-UK-Crown-and-law-in-focus-as-Carolean-era-begins |url-status=live}}</ref> As a result of this state of constitutional affairs, the monarch is formally referred to as "[[Sovereign|the Sovereign]]" in legislation.<ref>{{Cite web |url=https://www.legislation.gov.uk/ukpga/1978/30/section/10 |title=Interpretation Act 1978 (c. 30, s. 10) |publisher=The National Archives |access-date=4 July 2023 |archive-date=30 July 2023 |archive-url=https://web.archive.org/web/20230730073659/https://www.legislation.gov.uk/ukpga/1978/30/section/10 |url-status=live}}</ref>}}<ref name="parliament.uk">{{Cite web |title=Parliament |url=https://www.parliament.uk/about/how/role |access-date=19 July 2021 |website=[[parliament.uk]] |archive-date=18 February 2026 |archive-url=https://web.archive.org/web/20260218150954/https://www.parliament.uk/about/how/role/ |url-status=live }}</ref> The main business of Parliament takes place in the two houses,<ref name="parliament.uk" /> but [[royal assent]] is required for a bill to become an [[Act of Parliament (UK)|act of Parliament]] (that is, [[statute law]]).<ref>{{Cite web |title=Royal Assent |url=https://www.parliament.uk/about/how/laws/passage-bill/lords/lrds-royal-assent |access-date=19 July 2021 |website=[[parliament.uk]] |archive-date=16 July 2021 |archive-url=https://web.archive.org/web/20210716022947/https://www.parliament.uk/about/how/laws/passage-bill/lords/lrds-royal-assent/ |url-status=live}}</ref> As a result of parliamentary sovereignty, the [[Constitution of the United Kingdom|British constitution]] is [[Uncodified constitution|uncodified]], consisting mostly of disparate written sources, including parliamentary [[statute]]s, judge-made [[case law]] and international treaties, together with [[British Constitution#Conventions|constitutional conventions]].<ref>{{Cite web |last=Carter, Sarah |title=A Guide To the UK Legal System |url=http://www.llrx.com/features/uk2.htm#UK%20Legal%20System |archive-url=https://web.archive.org/web/20120505115306/http://www.llrx.com/features/uk2.htm |archive-date=5 May 2012 |access-date=16 May 2006 |publisher=[[University of Kent]] at Canterbury}}</ref> Nevertheless, the [[Supreme Court of the United Kingdom|Supreme Court]] recognises a number of principles underlying the British constitution, such as parliamentary sovereignty, the [[rule of law]], [[democracy]] and upholding [[Internationalism (politics)|international law]].<ref>See ''[[R (Miller) v Prime Minister]]'' [2019] UKSC 41 (Parliamentary sovereignty), ''[[R (UNISON) v Lord Chancellor]]'' [2017] [http://www.bailii.org/uk/cases/UKSC/2017/51.html UKSC 51] {{Webarchive|url=https://web.archive.org/web/20230104095357/https://www.bailii.org/uk/cases/UKSC/2017/51.html|date=4 January 2023}}, [67] ff (rule of law), ''[[R (Animal Defenders International) v Secretary of State for Culture Media and Sport]]'' [2008] UKHL 15, [48] (democracy), ''[[R v Lyons]]'' [2002] [https://www.bailii.org/uk/cases/UKHL/2002/44.html UKHL 44] {{Webarchive|url=https://web.archive.org/web/20230122064021/https://www.bailii.org/uk/cases/UKHL/2002/44.html|date=22 January 2023}}, [27] (international law).</ref>
[[Charles III|King Charles III]] is the [[monarch]] and [[head of state]] of the United Kingdom and 14 other independent [[sovereign state]]s, referred to as "[[Commonwealth realm]]s". The monarch is formally vested with all executive authority as the personal embodiment of [[the Crown]] and is "fundamental to the law and working of government in the UK".<ref>{{Cite journal |url=https://kclpure.kcl.ac.uk/portal/en/publications/the-constitutional-role-and-working-of-the-monarchy-in-the-united |title=The Constitutional Role and Working of the Monarchy in the United Kingdom |author=Robert Blackburn |journal=Jahrbuch des Öffentlichen Rechts der Gegenwart |series=Neue Folge |year=2022 |volume=70 |pages=181–201 |editor=O. Lepsius |editor2=A. Nußberger |editor3=C. Schönberger |editor4=C. Waldhoff |editor5=C. Walter |name-list-style=amp |publisher=Mohr Siebeck |doi=10.1628/joer-2022-0009 |s2cid=257830288 |publication-date=2 June 2022 |access-date=19 June 2023 |archive-date=19 June 2023 |archive-url=https://web.archive.org/web/20230619174428/https://kclpure.kcl.ac.uk/portal/en/publications/the-constitutional-role-and-working-of-the-monarchy-in-the-united |url-status=live}}</ref> The disposition of such powers however, including those belonging to the [[Royal prerogative in the United Kingdom|royal prerogative]], is generally exercised only on the [[Advice (constitutional law)|advice]] of [[ministers of the Crown]] responsible to Parliament and thence to the electorate. Nevertheless, in the performance of official duties the monarch has "the right to be consulted, the right to encourage, and the right to warn".<ref>[[Walter Bagehot|Bagehot, Walter]] (1867). ''The English Constitution''. London: Chapman and Hall. p. 103.</ref> In addition the monarch has a number of [[Reserve power#United Kingdom|reserve powers]] at his disposal to uphold [[responsible government]] and prevent [[constitutional crisis|constitutional crises]].{{Efn|For instance, the monarch alone appoints the prime minister and confers [[Orders, decorations, and medals of the United Kingdom|state honours]] in the personal gift of the Crown. When necessary, the monarch may also refuse a [[dissolution of Parliament|dissolution]] or [[Prorogation in the United Kingdom|prorogation of Parliament]], withhold [[royal assent]] to [[Act of Parliament (UK)|primary legislation]], and prevent illegal use of the [[British Armed Forces]], amongst other reserve powers.<ref>{{Cite web |url=https://researchbriefings.files.parliament.uk/documents/CBP-8885/CBP-8885.pdf |title=The Crown and the Constitution |author=David Torrance |publisher=House of Commons Library |publication-date=11 January 2023 |access-date=19 June 2023 |pages=22 |archive-date=2 March 2023 |archive-url=https://web.archive.org/web/20230302033737/https://researchbriefings.files.parliament.uk/documents/CBP-8885/CBP-8885.pdf |url-status=live}}</ref>}}
The prime minister is the [[head of government]] in the United Kingdom.<ref>{{Cite web |title=The Government, Prime Minister and Cabinet |url=http://direct.gov.uk/en/Governmentcitizensandrights/UKgovernment/Centralgovernmentandthemonarchy/DG_073444 |archive-url=https://web.archive.org/web/20120921004951/http://www.direct.gov.uk/en/Governmentcitizensandrights/UKgovernment/Centralgovernmentandthemonarchy/DG_073444 |archive-date=21 September 2012 |access-date=9 March 2015 |website=Public services all in one place |publisher=[[Directgov]]}}</ref> Acting under the direction and supervision of a [[Cabinet of the United Kingdom|Cabinet]] of senior ministers selected and led by the prime minister, [[His Majesty's Government]] serves as the principal instrument for public policymaking, administers public services and, through the [[Privy Council of the United Kingdom|Privy Council]], promulgates [[statutory instrument (UK)|statutory instruments]] and tenders advice to the monarch.<ref>{{Cite web |url=https://www.instituteforgovernment.org.uk/explainer/cabinet |title=Cabinet |author=Tim Durrant |date=25 March 2020 |publisher=Institute for Government |publication-date=25 March 2020 |access-date=4 July 2023 |archive-date=4 July 2023 |archive-url=https://web.archive.org/web/20230704112925/https://www.instituteforgovernment.org.uk/explainer/cabinet |url-status=live}}</ref><ref>{{Cite web |url=https://www.parliament.uk/about/how/role/relations-with-other-institutions/parliament-government/ |title=Parliament and Government |publisher=UK Parliament |access-date=4 July 2023 |archive-date=4 July 2023 |archive-url=https://web.archive.org/web/20230704112925/https://www.parliament.uk/about/how/role/relations-with-other-institutions/parliament-government/ |url-status=live}}</ref><ref>{{Cite book |url=https://books.google.com/books?id=mN6SzMefot4C |title=The Monarchy and the Constitution, Chapter 3 – The Basic Constitutional Rules: Influence and the Prerogative |author=Vernon Bogdanor |year=1995 |publisher=Clarendon Press |isbn=978-0-19-829334-7 |publication-date=1995 |access-date=4 July 2023}}</ref> Nearly all prime ministers have served concurrently as [[First Lord of the Treasury]]<ref>{{Cite web |last1=Blick |first1=Andrew |last2=Jones |first2=George |date=1 January 2012 |title=The Institution of Prime Minister – History of government |url=https://history.blog.gov.uk/2012/01/01/the-institution-of-prime-minister |access-date=19 July 2021 |website=[[gov.uk]] |archive-date=21 July 2021 |archive-url=https://web.archive.org/web/20210721060401/https://history.blog.gov.uk/2012/01/01/the-institution-of-prime-minister/ |url-status=live}}</ref> and all prime ministers have continuously served as First Lord of the Treasury since 1905,<ref>{{Cite book |last=Brown |first=Jack |title=The Prime Ministers |publisher=[[Hodder & Stoughton]] |year=2020 |isbn=978-1-5293-1214-0 |editor-last=Dale |editor-first=Iain |page=303}}</ref> [[Minister for the Civil Service]] since 1968,<ref>{{Cite web |title=Minister for the Civil Service |url=https://www.gov.uk/government/ministers/minister-for-the-civil-service |access-date=19 July 2021 |website=[[gov.uk]] |archive-date=2 September 2017 |archive-url=https://web.archive.org/web/20170902233116/https://www.gov.uk/government/ministers/minister-for-the-civil-service |url-status=live}}</ref> and [[Minister for the Union]] since 2019.<ref>{{Cite news |last=Woodcock |first=Andrew |date=26 July 2021 |title=Boris Johnson accused of 'cynical rebranding' after appointing himself 'Minister for the Union' |work=[[The Independent|Independent]] |url=https://www.independent.co.uk/news/uk/politics/boris-johnson-minister-union-scotland-independence-referendum-snp-a9022356.html |access-date=19 July 2021 |archive-date=27 July 2019 |archive-url=https://web.archive.org/web/20190727080405/https://www.independent.co.uk/news/uk/politics/boris-johnson-minister-union-scotland-independence-referendum-snp-a9022356.html |url-status=live}}; {{Cite web |title=Minister for the Union |url=https://www.gov.uk/government/ministers/minister-for-the-union |access-date=19 July 2021 |website=[[gov.uk]] |archive-date=19 July 2020 |archive-url=https://web.archive.org/web/20200719053618/https://www.gov.uk/government/ministers/minister-for-the-union |url-status=live}}</ref> While appointed by the monarch, in modern times the prime minister is, by [[Constitutional conventions of the United Kingdom|convention]], an MP, the leader of the political party with the most seats in the House of Commons, and holds office by virtue of their ability to [[Confidence motions in the United Kingdom|command the confidence]] of the House of Commons.<ref>{{Cite web |date=October 2011 |title=The Cabinet Manual |url=https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/60641/cabinet-manual.pdf |access-date=19 July 2021 |website=[[gov.uk]] |pages=7, 21 |archive-date=15 April 2018 |archive-url=https://web.archive.org/web/20180415090557/https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/60641/cabinet-manual.pdf |url-status=live}}</ref><ref>{{Cite book |last=Norton |first=Philip |title=Governing Britain: Parliament, Ministers and Our Ambiguous Constitution |publisher=[[Manchester University Press]] |year=2020 |isbn=978-1-5261-4545-1 |page=130}}</ref> The prime minister as of 20 July 2026 is [[Andy Burnham]], the [[Leader of the Labour Party (UK)|leader of the Labour Party]].
Although not part of the United Kingdom, the three [[Crown Dependencies]] of [[Jersey]], [[Guernsey]] and the [[Isle of Man]], as well as the 14 [[British Overseas Territories]], are subject to the sovereignty of the British Crown.<ref>{{cite book |last=Palan |first=Rolen |editor-last1=Palan |editor-first1=Rolen |editor-last2=Halperin |editor-first2=Sandra |chapter=The second British Empire and the re-emergence of global finance |chapter-url=https://books.google.com/books?id=76QyCgAAQBAJ&dq=%22British+overseas+territories%22+%22crown+dependencies%22+UK+%22British+crown%22&pg=PA48 |title=Legacies of Empire: Imperial Roots of the Contemporary Global Order |year=2015 |publisher=Cambridge University Press |isbn=978-1-107-10946-9 |page=48 |access-date=13 April 2024 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002212946/https://books.google.com/books?id=76QyCgAAQBAJ&dq=%22British+overseas+territories%22+%22crown+dependencies%22+UK+%22British+crown%22&pg=PA48#v=onepage&q=%22British%20overseas%20territories%22%20%22crown%20dependencies%22%20UK%20%22British%20crown%22&f=false |url-status=live}}</ref>
[[Democratic backsliding]] was found by the 2026 [[V-Dem Institute#Democracy Report|V-Dem Democracy Report]] for the United Kingdom.<ref name="j496">{{cite web | title=Democracy Report 2026, Unraveling The Democratic Era? | url=https://v-dem.net/documents/75/V-Dem_Institute_Democracy_Report_2026_lowres.pdf | access-date=17 March 2026}}</ref>{{Relevance inline|date=August 2026|discuss=A country becoming a bit more or less democratic is not unusual and happens all the time. Such a development is not in itself notable, unless the change is disproportionately big, or the country slips under a certain threshold (e.g., being no longer classified as a liberal democracy, but as a hybrid regime). Is this the case here? If yes, then that should be more thoroughly explained. If no, then this sentence should probably be removed for not being notable enough for a high-level overview article of the UK.}}
===Elections===
{{Main|Elections in the United Kingdom}}
[[File:Houses of Parliament in 2022 (cropped).jpg|thumb|upright=1.25|alt=Large sand-coloured building of Gothic design beside brown river. The building has several large towers, including large clock tower.|The [[Palace of Westminster]] in London is the seat of both houses of the Parliament of the United Kingdom.]]
For [[General elections in the United Kingdom|general elections]] (elections to the House of Commons), the United Kingdom is divided into 650 [[United Kingdom constituencies|constituencies]], each of which is represented by one [[Member of Parliament (United Kingdom)|member of Parliament]] (MP) elected by the [[First-past-the-post voting|first-past-the-post]] system.<ref name="parliament.uk-2">{{Cite web |title=General elections |url=https://www.parliament.uk/about/how/elections-and-voting/general |access-date=19 July 2021 |website=[[parliament.uk]]}}</ref> MPs hold office for up to five years and must then stand for re-election if they wish to continue to be an MP.<ref name="parliament.uk-2" /> The [[Conservative Party (UK)|Conservative Party]], colloquially known as the Tory Party or the Tories, and the [[Labour Party (UK)|Labour Party]] have been the dominant political parties in the country since the 1920s, leading to the UK being described as a [[two-party system]]. However, since the 1920s other [[List of political parties in the United Kingdom|political parties]] have won seats in the House of Commons, although never more than the Conservatives or Labour.<ref>{{Cite web |last=Raymond |first=C |date=2016 |title=Why British Politics is Not a Two-Party System |url=https://pureadmin.qub.ac.uk/ws/portalfiles/portal/107735631/The_United_Kingdom_is_Not_a_Two_Party_System.pdf |website=Queen's University Belfast |access-date=3 July 2023 |archive-date=9 July 2023 |archive-url=https://web.archive.org/web/20230709172832/https://pureadmin.qub.ac.uk/ws/portalfiles/portal/107735631/The_United_Kingdom_is_Not_a_Two_Party_System.pdf |url-status=live}}</ref> The 2020s marked the erosion of the two-party system and the growth of a multi-party system.<ref>{{Cite web |date=8 May 2026 |title=Sir John Curtice: Election results show politics in the UK has fragmented |url=https://www.bbc.com/news/articles/ce8p4yn448vo |access-date=9 May 2026 |website=[[BBC News]] |language=en-GB}}</ref>
=== Administrative divisions ===
{{Main|Countries of the United Kingdom|Administrative geography of the United Kingdom|List of counties in the United Kingdom}}
[[File:United Kingdom labelled map7 vector.svg|thumb|upright=0.8|The four countries of the United Kingdom]]
The geographical division of the United Kingdom into counties or [[shire]]s began in England and Scotland in the [[early Middle Ages]], and was completed throughout Great Britain and Ireland by the [[early modern period]].<ref>Hackwood Frederick William: ''The Story of the Shire, Being the Lore, History and Evolution of English County Institutions'' (1851)</ref> Modern [[local government]] by elected councils, partly based on the ancient counties, was established by separate Acts of Parliament: in England and Wales [[Local Government Act 1888|in 1888]], Scotland [[Local Government (Scotland) Act 1889|in 1889]] and Ireland [[Local Government (Ireland) Act 1898|in 1898]], meaning there is no consistent system of administrative or geographic demarcation across the UK,<ref>{{Cite web |last=United Nations Economic and Social Council |author-link=United Nations Economic and Social Council |date=August 2007 |title=Ninth UN Conference on the standardization of Geographical Names |url=http://unstats.un.org/unsd/geoinfo/UNGEGN/docs/9th-uncsgn-docs/report%20of%209th%20uncsgn%20n0750902%20en.pdf |url-status=live |archive-url=https://web.archive.org/web/20091211213055/http://unstats.un.org/unsd/geoinfo/9th-UNCSGN-Docs/E-CONF-98-48-Add1.pdf |archive-date=11 December 2009 |access-date=21 October 2008 |publisher=UN Statistics Division}}</ref> and [[English law|England and Wales]], [[Scots law|Scotland]] and [[Law of Northern Ireland|Northern Ireland]] each have their own distinct jurisdictions.<ref>{{Cite book |last1=Dewart |first1=Megan |url=https://books.google.com/books?id=XW_EtwEACAAJ |title=The Scottish Legal System |date=2019 |publisher=[[Bloomsbury Academic]] |isbn=978-1-5265-0633-7 |location=London |page=57 |quote=The laws and legal institutions of Scotland and of England and Wales were not merged by the Union of 1707. Thus, they remain separate 'law areas', with separate court systems (as does Northern Ireland), and it is necessary to distinguish Scots law and English law (and Northern Irish law). |access-date=4 July 2023 |archive-url=https://web.archive.org/web/20230704040048/https://books.google.com/books?id=XW_EtwEACAAJ |archive-date=4 July 2023 |url-status=live}}; {{Cite web |title=The justice system and the constitution |url=https://www.judiciary.uk/about-the-judiciary/our-justice-system/jud-acc-ind/justice-sys-and-constitution/#:~:text=The%20United%20Kingdom%20has%20three,of%20Union%201707%20and%201800. |archive-url=https://web.archive.org/web/20230521180341/https://www.judiciary.uk/about-the-judiciary/our-justice-system/jud-acc-ind/justice-sys-and-constitution/ |archive-date=21 May 2023 |access-date=13 June 2023 |publisher=Courts and Tribunals Judiciary |quote=The United Kingdom has three separate legal systems; one each for England and Wales, Scotland and Northern Ireland. This reflects its historical origins and the fact that both Scotland and Ireland, and later Northern Ireland, retained their own legal systems and traditions under the Acts of Union 1707 and 1800.}}</ref> Until the 19th century there was little change to those arrangements, but there has since been a constant evolution of role and function.<ref>{{Cite book |last=Barlow |first=I.M. |title=Metropolitan Government |publisher=Routledge |year=1991 |isbn=978-0-415-02099-2 |location=London}}</ref>
[[Local government in England]] is complex, with the distribution of functions varying according to local arrangements. The upper-tier [[subdivisions of England]] are the nine [[Regions of England|regions]], used primarily for statistical purposes.<ref>{{Cite web |title=Welcome to the national site of the Government Office Network |url=http://www.gos.gov.uk/national |archive-url=https://web.archive.org/web/20090606073647/http://www.gos.gov.uk/national |archive-date=6 June 2009 |access-date=3 July 2008 |publisher=Government Offices}}</ref> One of the regions, [[Greater London Authority|Greater London]], has had a directly elected assembly and mayor since 2000 following popular support for the proposal in a [[1998 Greater London Authority referendum|1998 referendum]].<ref>{{Cite web |title=A short history of London government |url=http://www.london.gov.uk/london-life/city-government/history.jsp |archive-url=https://web.archive.org/web/20080421023053/http://www.london.gov.uk/london-life/city-government/history.jsp |archive-date=21 April 2008 |access-date=4 October 2008 |publisher=Greater London Authority}}</ref>
[[Local government in Scotland]] is divided into [[subdivisions of Scotland|32 council areas]] with a wide variation in size and population. The cities of [[Glasgow]], Edinburgh, [[Aberdeen]] and [[Dundee]] are separate council areas, as is the [[Politics of the Highland council area|Highland Council]], which includes a third of Scotland's area but only just over 200,000 people. Local councils are made up of elected councillors, of whom there are 1,223.<ref name="political-studies-association">{{Cite web |title=STV in Scotland: Local Government Elections 2007 |url=http://www.psa.ac.uk/2007/pps/Bennie.pdf |archive-url=https://web.archive.org/web/20110222124635/http://www.psa.ac.uk/2007/pps/Bennie.pdf |archive-date=22 February 2011 |access-date=2 August 2008 |publisher=Political Studies Association}}</ref>
[[Local government in Wales]] consists of 22 [[Unitary authority|unitary authorities]], each led by a leader and cabinet elected by the council itself. These include the cities of Cardiff, [[Swansea]] and [[Newport, Wales|Newport]], which are unitary authorities in their own right.<ref name="unitary">{{Cite web |year=2014 |title=Unitary authorities |url=http://gov.wales/topics/localgovernment/local-authorities/?lang=en |archive-url=https://web.archive.org/web/20150310210146/http://gov.wales/topics/localgovernment/local-authorities/?lang=en |archive-date=10 March 2015 |access-date=9 March 2015 |publisher=Welsh Government}}</ref> Elections are held every four years under the first-past-the-post system.<ref name="unitary" />
[[Local government in Northern Ireland]] since 2015 has been organised into 11 district councils, each elected by single transferable vote. Their powers are limited to services such as waste collection, dog control, and maintaining parks and cemeteries.<ref name="Devenport">{{Cite news |last=Devenport |first=Mark |date=18 November 2005 |title=NI local government set for shake-up |work=BBC News |url=http://news.bbc.co.uk/1/hi/northern_ireland/4449092.stm |access-date=15 November 2008 |archive-date=12 December 2008 |archive-url=https://web.archive.org/web/20081212221731/http://news.bbc.co.uk/1/hi/northern_ireland/4449092.stm |url-status=live}}</ref> This system was introduced after a 2008 decision by the executive to replace the previous structure of 26 districts which had been in place since 1973.<ref>{{Cite press release |title=Foster announces the future shape of local government |date=13 March 2008 |publisher=Northern Ireland Executive |url=http://www.northernireland.gov.uk/news/news-doe/news-doe-130308-foster-announces-the.htm |access-date=20 October 2008 |archive-url=https://web.archive.org/web/20080725002254/http://www.northernireland.gov.uk/news/news-doe/news-doe-130308-foster-announces-the.htm |archive-date=25 July 2008}}</ref>
=== Devolution ===
{{Main|Devolution in the United Kingdom}}
{{further|Devolved, reserved and excepted matters}}
[[File:Council of Nations and Regions (54059219744) (cropped).jpg|thumb|right|Prime Minister Keir Starmer meets with the first ministers of Scotland, Northern Ireland and Wales during the [[Council of Nations and Regions]] summit.]]
In the United Kingdom a process of devolution has transferred various powers from the UK Government to three of the four UK countries—Scotland, Northern Ireland and Wales—as well as to the regions of England, which since 1999 have their own governments and parliaments that control various devolved matters.<ref>{{Cite web |title=Devolution of powers to Scotland, Wales and Northern Ireland |url=https://www.gov.uk/devolution-of-powers-to-scotland-wales-and-northern-ireland#devolved-administrations |url-status=live |archive-url=https://web.archive.org/web/20130718065448/https://www.gov.uk/devolution-of-powers-to-scotland-wales-and-northern-ireland#devolved-administrations |archive-date=18 July 2013 |access-date=17 April 2013 |publisher=United Kingdom Government |quote=In a similar way to how the government is formed from members from the two Houses of Parliament, members of the devolved legislatures nominate ministers from amongst themselves to comprise executives, known as the devolved administrations...}}; {{Cite web |title=Country Overviews: United Kingdom |url=http://www.transport-research.info/web/countryprofiles/uk.cfm |archive-url=https://web.archive.org/web/20100404062853/http://www.transport-research.info/web/countryprofiles/uk.cfm |archive-date=4 April 2010 |access-date=28 March 2010 |url-status=usurped |publisher=Transport Research Knowledge Centre}}</ref> These powers vary and have been moved to the [[Scottish Government]], the [[Welsh Government]], the [[Northern Ireland Executive]] and (in England) to [[strategic authorities]]: the [[Greater London Authority]], [[Combined authorities and combined county authorities|combined authorities, and combined county authorities]].<ref>{{cite book |last1=Le Sueur |first1=Andrew |last2=Sunkin |first2=Maurice |last3=Murkens |first3=Jo Eric Khushal |title=Public Law: Text, Cases, and Materials |year=2023 |edition=5th |isbn=978-0-19-287061-2 |publisher=Oxford University Press |page=147 |url=https://books.google.com/books?id=6sLDEAAAQBAJ&dq=Le+sueur+Public+Law%C2%A0fifth+edition&pg=PR3 |access-date=13 April 2024 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002213048/https://books.google.com/books?id=6sLDEAAAQBAJ&dq=Le+sueur+Public+Law%C2%A0fifth+edition&pg=PR3#v=onepage&q=Le%20sueur%20Public%20Law%C2%A0fifth%20edition&f=false |url-status=live}}</ref> Amongst the devolved parliaments across the United Kingdom, the [[Scottish Parliament]] has the most extensive responsibilities for [[Devolved, reserved and excepted matters|devolved powers]], and has been described as "one of the most powerful devolved parliaments in the world".<ref>{{cite web |title=The progress of devolution - Erskine May - UK Parliament |url=https://erskinemay.parliament.uk/section/4537/the-progress-of-devolution |website=erskinemay.parliament.uk |access-date=1 March 2025}}</ref><ref>{{cite web |title=David Mundell speech: 20 years of Scottish devolution |url=https://www.gov.uk/government/news/david-mundell-speech-20-years-of-scottish-devolution |website=GOV.UK |access-date=1 March 2025}}</ref>
The United Kingdom has an [[uncodified constitution]] and constitutional matters are not amongst the powers that have been devolved. Under the doctrine of [[Parliamentary sovereignty in the United Kingdom|parliamentary sovereignty]], the UK Parliament could, in theory, therefore, abolish the Scottish Parliament, Senedd or Northern Ireland Assembly.<ref>{{Cite journal |last=Burrows |first=N. |year=1999 |title=Unfinished Business: The Scotland Act 1998 |journal=The Modern Law Review |volume=62 |issue=2 |pages=241–260 [p. 249] |doi=10.1111/1468-2230.00203 |quote=The UK Parliament is sovereign and the Scottish Parliament is subordinate. The White Paper had indicated that this was to be the approach taken in the legislation. The Scottish Parliament is not to be seen as a reflection of the settled will of the people of Scotland or of popular sovereignty but as a reflection of its subordination to a higher legal authority. Following the logic of this argument, the power of the Scottish Parliament to legislate can be withdrawn or overridden...}}; {{Cite journal |last=Elliot |first=M. |year=2004 |title=United Kingdom: Parliamentary sovereignty under pressure |journal=International Journal of Constitutional Law |volume=2 |issue=3 |pages=545–627, 553–554 |doi=10.1093/icon/2.3.545 |quote=Notwithstanding substantial differences among the schemes, an important common factor is that the UK Parliament has not renounced legislative sovereignty in relation to the three nations concerned. For example, the Scottish Parliament is empowered to enact primary legislation on all matters, save those in relation to which competence is explicitly denied ... but this power to legislate on what may be termed "devolved matters" is concurrent with the Westminster Parliament's general power to legislate for Scotland on any matter at all, including devolved matters ... In theory, therefore, Westminster may legislate on Scottish devolved matters whenever it chooses... |doi-access=free}}</ref> Though in the [[Scotland Act 2016]] and the [[Wales Act 2017]] it states that the Scottish Government and the Welsh Government "are a permanent part of the United Kingdom's constitutional arrangements".<ref>{{cite web |title=Scotland Act 2016 |url=https://www.legislation.gov.uk/ukpga/2016/11/part/1/crossheading/the-scottish-parliament-and-the-scottish-government#:~:text=(1)The%20Scottish%20Parliament%20and,the%20United%20Kingdom's%20constitutional%20arrangements. |website=Gov.uk |access-date=28 June 2024 |archive-date=28 June 2024 |archive-url=https://web.archive.org/web/20240628211304/https://www.legislation.gov.uk/ukpga/2016/11/part/1/crossheading/the-scottish-parliament-and-the-scottish-government#:~:text=(1)The%20Scottish%20Parliament%20and,the%20United%20Kingdom's%20constitutional%20arrangements. |url-status=live}}</ref><ref>{{cite web |title=Wales Act 2017 |url=https://www.legislation.gov.uk/ukpga/2017/4/section/1/enacted |access-date=13 July 2024 |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002212916/https://www.legislation.gov.uk/ukpga/2017/4/section/1/enacted |url-status=live}}</ref>
In practice it would be politically difficult for the UK Parliament to abolish devolution to the Scottish Parliament and the Senedd because these institutions were created by referendums.<ref>{{Cite journal |last=Gamble |first=A. |year=2006 |title=The Constitutional Revolution in the United Kingdom |journal=Publius |volume=36 |issue=1 |pages=19–35 [p. 29] |doi=10.1093/publius/pjj011 |quote=The British parliament has the power to abolish the Scottish parliament and the Welsh assembly by a simple majority vote in both houses, but since both were sanctioned by referenda, it would be politically difficult to abolish them without the sanction of a further vote by the people. In this way, several of the constitutional measures introduced by the Blair government appear to be entrenched and not subject to a simple exercise of parliamentary sovereignty at Westminster.}}</ref> The political constraints placed upon the UK Parliament's power to interfere with devolution in Northern Ireland are greater still, because devolution in Northern Ireland rests upon an international agreement with the [[Government of Ireland]].<ref>{{Cite journal |last=Meehan |first=E. |year=1999 |title=The Belfast Agreement – Its Distinctiveness and Points of Cross-Fertilization in the UK's Devolution Programme |journal=Parliamentary Affairs |volume=52 |issue=1 |pages=19–31 [p. 23] |doi=10.1093/pa/52.1.19 |quote=[T]he distinctive involvement of two governments in the Northern Irish problem means that Northern Ireland's new arrangements rest upon an intergovernmental agreement. If this can be equated with a treaty, it could be argued that the forthcoming distribution of power between Westminster and Belfast has similarities with divisions specified in the written constitutions of federal states...Although the Agreement makes the general proviso that Westminster's 'powers to make legislation for Northern Ireland' remains 'unaffected', without an explicit categorical reference to reserved matters, it may be more difficult than in Scotland or Wales for devolved powers to be repatriated. The retraction of devolved powers would not merely entail consultation in Northern Ireland backed implicitly by the absolute power of parliamentary sovereignty but also the renegotiation of an intergovernmental agreement. |doi-access=free}}</ref> The UK Parliament restricts the three devolved parliaments' legislative powers in economic policy matters through [[United Kingdom Internal Market Act 2020|an act]] passed in 2020.<ref name="UKIM" />
==== England ====
Unlike Scotland, Northern Ireland and Wales, England does not have a separate devolved government or national parliament,<ref>{{cite web |title=English devolution |url=https://www.instituteforgovernment.org.uk/explainer/english-devolution#:~:text=After%201997%20Labour%20governments%20devolved,assembly%20were%20created%20in%202000. |publisher=Institute for Government |access-date=30 August 2024 |date=21 June 2024 |archive-date=30 August 2024 |archive-url=https://web.archive.org/web/20240830150949/https://www.instituteforgovernment.org.uk/explainer/english-devolution#:~:text=After%201997%20Labour%20governments%20devolved,assembly%20were%20created%20in%202000. |url-status=live}}</ref> rather a process of devolution of powers from the central government to local authorities has taken place, first in 1998.<ref>{{cite web |title=Devolution explained |url=https://www.local.gov.uk/topics/devolution/devolution-hub/devolution-explained |publisher=Local Government Association |access-date=30 August 2024 |archive-date=30 August 2024 |archive-url=https://web.archive.org/web/20240830152450/https://www.local.gov.uk/topics/devolution/devolution-hub/devolution-explained |url-status=live}}</ref> The [[Greater London Authority]] was set up following a [[1998 Greater London Authority referendum|referendum in 1998]]. Colloquially known as City Hall, it is the devolved regional government body for Greater London. It consists of two political branches: a directly elected [[Mayor of London]] and the [[London Assembly]], which serves as a check and balance on the Mayor.
A [[Combined authorities and combined county authorities|combined authority]] is a type of local government institution introduced in England outside Greater London by the [[Local Democracy, Economic Development and Construction Act 2009]]. CAs allow a group of local authorities to pool appropriate responsibility and receive certain devolved functions from central government in order to deliver transport and economic policy more effectively over a wider area.<ref>{{Cite web |date=6 March 2023 |title=English devolution |url=https://www.instituteforgovernment.org.uk/explainer/english-devolution |access-date=4 February 2024 |publisher=Institute for Government |archive-date=2 October 2024 |archive-url=https://web.archive.org/web/20241002212917/https://www.instituteforgovernment.org.uk/explainer/english-devolution |url-status=live}}</ref> A combined county authority is a similar type of local-government institution introduced in England outside Greater London by the [[Levelling-up and Regeneration Act 2023]], but may only be formed by upper-tier authorities: [[county council]]s and [[Unitary authority|unitary authorities]].<ref>{{Cite web |date=6 April 2023 |title=Combined County Authorities – key differences to Combined Authorities |url=https://www.localgovernmentlawyer.co.uk/governance/314-governance-a-risk-articles/53464-combined-county-authorities-key-differences-to-combined-authorities |access-date=4 February 2024 |website=Local Government Lawyer |archive-date=4 February 2024 |archive-url=https://web.archive.org/web/20240204170903/https://www.localgovernmentlawyer.co.uk/governance/314-governance-a-risk-articles/53464-combined-county-authorities-key-differences-to-combined-authorities |url-status=live}}</ref>
==== Scotland ====
{{main|Responsibilities of the Scottish Government}}
[[File:First Minister meets Prime Minister (53840421342).jpg|thumb|Prime Minister Keir Starmer meets with [[First Minister of Scotland]] [[John Swinney]], the head of the [[Scottish Government]], at [[Bute House]], Edinburgh.]]
Since 1999 Scotland has had a devolved national government and parliament with wide-ranging powers over any matter that has not been specifically [[Reserved and excepted matters|reserved]] to the UK Parliament.<ref name="Scottish Parliament">{{cite web |title=Devolved and Reserved Powers |url=https://www.parliament.scot/about/how-parliament-works/devolved-and-reserved-powers |website=parliament.scot |publisher=Scottish Parliament |access-date=28 December 2023 |archive-date=20 September 2023 |archive-url=https://web.archive.org/web/20230920053732/https://www.parliament.scot/about/how-parliament-works/devolved-and-reserved-powers |url-status=live}}</ref><ref>{{Cite news |date=8 April 1999 |title=Scotland's Parliament – powers and structures |work=BBC News |url=http://news.bbc.co.uk/1/hi/events/scotland_99/the_scottish_parliament/310036.stm |access-date=21 October 2008 |archive-date=18 February 2007 |archive-url=https://web.archive.org/web/20070218234816/http://news.bbc.co.uk/1/hi/events/scotland_99/the_scottish_parliament/310036.stm |url-status=live}}</ref> Scotland has the most devolved powers of any of the three devolved parliaments in the United Kingdom, with full legislative control over [[Education in Scotland|education]], [[Scots law|law and order]], [[Economy of Scotland|the economy]], [[Health in Scotland|healthcare]], [[Elections in Scotland|elections]], [[Crown Estate Scotland]], the [[Planning system in Scotland|planning system]] and [[Housing in Scotland|housing]].<ref>{{cite web |title=Devolved and Reserved Matters - Visit & Learn Scottish Parliament |url=http://www.parliament.scot/visitandlearn/Education/18642.aspx |archive-url=https://web.archive.org/web/20170722092046/http://www.parliament.scot/visitandlearn/Education/18642.aspx |url-status=dead |archive-date=22 July 2017 |access-date=1 March 2025 |date=22 July 2017}}</ref>
Additional powers were transferred to the Scottish Parliament via the [[Scotland Act 2012]] and the [[Scotland Act 2016]], such as [[Taxation in Scotland|some taxation powers]], including full control of [[Income tax in Scotland|income tax]] on income earned through employment, [[Land and Buildings Transaction Tax]], [[Scottish Landfill Tax|Landfill Tax]], Aggregates Levy, [[Air Departure Tax]] and [[Revenue Scotland]], as well as aspects of the [[Energy in Scotland|energy network]], including [[Renewable energy in Scotland|renewable energy]], energy efficiency and onshore [[Oil industry in Scotland|oil and gas licensing]].<ref name="Devolved Matters in Scotland">{{cite web |url=https://www.gov.scot/about/what-the-government-does/ |title=What the Scottish Government does |publisher=Scottish Government |access-date=8 August 2019 |archive-date=8 July 2019 |archive-url=https://web.archive.org/web/20190708045359/https://www.gov.scot/about/what-the-government-does/ |url-status=live}}</ref><ref name="Scottish Parliament" /> Their power over economic issues is significantly constrained by an [[United Kingdom Internal Market Act 2020|act of the UK Parliament]] passed in 2020.{{refn|name=UKIM|<ref name="Keating21">{{Cite journal |last=Keating |first=Michael |date=2 February 2021 |title=Taking back control? Brexit and the territorial constitution of the United Kingdom |journal=[[Journal of European Public Policy]] |location=Abingdon |publisher=[[Taylor & Francis]] |volume=28 |issue=4 |pages=6–7 |doi=10.1080/13501763.2021.1876156 |quote=The UK Internal Market Act gives ministers sweeping powers to enforce mutual recognition and non-discrimination across the four jurisdictions. Existing differences and some social and health matters are exempted but these are much less extensive than the exemptions permitted under the EU Internal Market provisions. Only after an amendment in the House of Lords, the Bill was amended to provide a weak and non-binding consent mechanism for amendments (equivalent to the Sewel Convention) to the list of exemptions. The result is that, while the devolved governments retain regulatory competences, these are undermined by the fact that goods and services originating in, or imported into, England can be marketed anywhere. |hdl-access=free |hdl=1814/70296 |s2cid=234066376}}</ref><ref name="KenMcEw21">{{Cite journal |last1=Kenny |first1=Michael |author-link=Michael Kenny (political scientist) |last2=McEwen |first2=Nicola |author-link2=Nicola McEwen |date=1 March 2021 |title=Intergovernmental Relations and the Crisis of the Union |journal=Political Insight |publisher=[[SAGE Publishing]] |volume=12 |issue=1 |pages=12–15 |doi=10.1177/20419058211000996 |quote=That phase of joint working was significantly damaged by the UK Internal Market Act, pushed through by the Johnson government in December 2020...the Act diminishes the authority of the devolved institutions, and was vehemently opposed by them. |doi-access=free |s2cid=232050477}}</ref><ref name="WolffeDevol">{{Cite journal |last=Wolffe |first=W James |author-link=James Wolffe |date=7 April 2021 |title=Devolution and the Statute Book |url=https://academic.oup.com/slr/advance-article/doi/10.1093/slr/hmab003/6213886 |journal=[[Statute Law Review]] |location=Oxford |publisher=[[Oxford University Press]] |doi=10.1093/slr/hmab003 |access-date=18 April 2021 |quote=the Internal Market Bill—a Bill that contains provisions which, if enacted, would significantly constrain, both legally and as a matter of practicality, the exercise by the devolved legislatures of their legislative competence; provisions that would be significantly more restrictive of the powers of the Scottish Parliament than either EU law or Articles 4 and 6 of the Acts of the Union...The UK Parliament passed the European Union (Withdrawal Agreement) Act 2020 and the Internal Market Act 2020 notwithstanding that, in each case, all three of the devolved legislatures had withheld consent. |archive-date=21 April 2021 |archive-url=https://web.archive.org/web/20210421145355/https://academic.oup.com/slr/advance-article/doi/10.1093/slr/hmab003/6213886 |url-status=live |url-access=subscription}}</ref><ref name="Wincott21">{{Cite journal |last1=Wincott |first1=Daniel |author-link=Daniel Wincott |last2=Murray |first2=C. R. G. |last3=Davies |first3=Gregory |date=17 May 2021 |title=The Anglo-British imaginary and the rebuilding of the UK's territorial constitution after Brexit: unitary state or union state? |journal=Territory, Politics, Governance |location=Abingdon/Brighton |publisher=[[Taylor & Francis]]; [[Regional Studies Association]] |volume=10 |issue=5 |pages=696–713 |doi=10.1080/21622671.2021.1921613 |quote=Taken as a whole, the Internal Market Act imposes greater restrictions upon the competences of the devolved institutions than the provisions of the EU Single Market which it replaced, in spite of pledges to use common frameworks to address these issues. [[David Hope, Baron Hope of Craighead|Lord Hope]], responsible for many of the leading judgments relating to the first two decades of devolution, regarded the legislation's terms as deliberately confrontational: 'this Parliament can do what it likes, but a different approach is essential if the union is to hold together'. |doi-access=free}}</ref><ref name="DouganMcEwen20">{{Cite report |url=https://www.centreonconstitutionalchange.ac.uk/publications/uk-and-internal-market-devolution-and-union |title=UK and the Internal Market, Devolution and the Union |last1=Dougan |first1=Michael |last2=Hayward |first2=Katy |date=2020 |publisher=[[University of Edinburgh]]; [[University of Aberdeen]] |pages=2–3 |last3=Hunt |first3=Jo |last4=McEwen |first4=Nicola |last5=McHarg |first5=Aileen |last6=Wincott |first6=Daniel |author-link=Michael Dougan |author-link2=Katy Hayward |access-date=16 October 2020 |author-link4=Nicola McEwen |author-link6=Daniel Wincott |department=Centre on Constitutional Change |archive-date=18 October 2020 |archive-url=https://web.archive.org/web/20201018185830/https://www.centreonconstitutionalchange.ac.uk/publications/uk-and-internal-market-devolution-and-union |url-status=live}}</ref><ref name="Dougan20Brief">{{Cite report |url=https://www.liverpool.ac.uk/media/livacuk/law/2-research/eull/UKIM,Briefing,Paper,-,Prof,Michael,Dougan,15,September,2020.pdf |title=Briefing Paper. United Kingdom Internal Market Bill: Implications for Devolution |last=Dougan |first=Michael |date=2020 |publisher=[[University of Liverpool]] |location=Liverpool |pages=4–5 |author-link=Michael Dougan |access-date=15 October 2020 |archive-date=26 October 2020 |archive-url=https://web.archive.org/web/20201026161836/https://www.liverpool.ac.uk/media/livacuk/law/2-research/eull/UKIM,Briefing,Paper,-,Prof,Michael,Dougan,15,September,2020.pdf |url-status=live}}</ref><ref name="DouHu22">{{cite journal |last1=Dougan |first1=Michael |last2=Hunt |first2=Jo |last3=McEwen |first3=Nicola |last4=McHarg |first4=Aileen |author-link1=Michael Dougan |author-link3=Nicola McEwen |title=Sleeping with an Elephant: Devolution and the United Kingdom Internal Market Act 2020 |journal=[[Law Quarterly Review]] |date=2022 |url=https://dro.dur.ac.uk/35167/ |location=London |publisher=[[Sweet & Maxwell]] |ssrn=4018581 |via=[[Durham University|Durham Research Online]] |access-date=4 March 2022 |quote=The Act has restrictive – and potentially damaging – consequences for the regulatory capacity of the devolved legislatures...This was not the first time since the Brexit referendum that the Convention had been set aside, but it was especially notable given that the primary purpose of the legislation was to constrain the capacity of the devolved institutions to use their regulatory autonomy...in practice, it constrains the ability of the devolved institutions to make effective regulatory choices for their territories in ways that do not apply to the choices made by the UK government and parliament for the English market. |issn=0023-933X |archive-date=2 August 2022 |archive-url=https://web.archive.org/web/20220802185022/https://dro.dur.ac.uk/35167/ |url-status=live}}</ref>}}
The [[Scottish Government]] is a [[Scottish National Party]] (SNP) [[minority government]],<ref>{{cite web |title=Humza Yousaf's precarious position puts the SNP – and Scotland – at a crossroads |url=https://www.instituteforgovernment.org.uk/comment/humza-yousaf-snp-scotland-crossroads |website=Institute for Government |access-date=26 April 2024 |date=26 April 2024 |archive-date=26 April 2024 |archive-url=https://web.archive.org/web/20240426221203/https://www.instituteforgovernment.org.uk/comment/humza-yousaf-snp-scotland-crossroads |url-status=live}}</ref> led by the [[First Minister of Scotland|first minister]], currently [[John Swinney]], the [[leader of the SNP]]. In 2014 the [[2014 Scottish independence referendum|Scottish independence referendum]] was held, with 55.3 per cent voting against independence from the United Kingdom and 44.7 per cent voting in favour, resulting in Scotland staying within the United Kingdom. [[Local government in Scotland]] is divided into [[subdivisions of Scotland|32 council areas]] with a wide variation in size and population. Local councils are made up of elected councillors, of whom there are 1,223.<ref name="political-studies-association" />
The Scottish Parliament is separate from the Scottish Government. It is made up of 129 elected [[members of the Scottish Parliament]] (MSPs). It is the law-making body of Scotland, and thus it scrutinises the work of the incumbent Scottish Government and considers any piece of proposed legislation through parliamentary debates, committees and parliamentary questions.<ref name="Devolved Matters in Scotland"/>
==== Wales ====
Since 1999 Wales has had a devolved national government and legislature, known as the [[Senedd]]. Elections to the Senedd used the [[additional member system]] until 2026 when the voting system was changed to [[closed list]] proportional representation. The number of elected members also increased from 60 to 96, representing 16 [[Senedd constituencies|six-member constituencies]]. The Senedd has more limited powers than those devolved to Scotland.<ref>{{Cite news |date=9 April 1999 |title=Structure and powers of the Assembly |work=BBC News |url=http://news.bbc.co.uk/1/hi/events/wales_99/the_welsh_assembly/309033.stm |access-date=21 October 2008 |archive-date=7 February 2004 |archive-url=https://web.archive.org/web/20040207162926/http://news.bbc.co.uk/1/hi/events/wales_99/the_welsh_assembly/309033.stm |url-status=live}}</ref> It can legislate on any matter not specifically reserved to the UK Parliament by [[Acts of Senedd Cymru]]. The [[Welsh Government]] is currently a [[Plaid Cymru]] minority government led by the [[First Minister of Wales|first minister]], [[Rhun ap Iorwerth]]. [[Local government in Wales]] consists of 22 unitary authorities, each led by a leader and cabinet elected by the council itself.
==== Northern Ireland ====
The devolved form of government in Northern Ireland is based on the 1998 [[Good Friday Agreement]], which brought to an end a 30-year period of [[Unionism in Ireland|unionist]]-[[Irish nationalism|nationalist]] communal conflict known as [[the Troubles]]. The Agreement was [[1998 Northern Ireland Good Friday Agreement referendum|confirmed by referendum]] and implemented later that year. It established [[power sharing]] arrangements for a devolved government and legislature, referred to as the [[Northern Ireland Executive]] and the [[Northern Ireland Assembly]] respectively.<ref>{{cite web |title=Good Friday Agreement: What is it? |url=https://www.bbc.co.uk/news/uk-northern-ireland-61968177 |website=BBC News |date=3 April 2023 |access-date=11 April 2024 |archive-date=15 May 2024 |archive-url=https://web.archive.org/web/20240515131233/https://www.bbc.co.uk/news/uk-northern-ireland-61968177 |url-status=live}}</ref> Elections to the Assembly use the [[single transferable vote]] system. The Executive and Assembly have powers similar to those devolved to Scotland.<ref>{{Cite web |date=8 May 2019 |title=Devolution of powers to Scotland, Wales and Northern Ireland |url=https://www.gov.uk/guidance/devolution-of-powers-to-scotland-wales-and-northern-ireland |access-date=11 June 2024 |website=GOV.UK |archive-date=7 March 2023 |archive-url=https://web.archive.org/web/20230307093336/https://www.gov.uk/guidance/devolution-of-powers-to-scotland-wales-and-northern-ireland |url-status=live}}</ref> The Executive is led by a [[diarchy]] representing [[Designated Unionist|unionist]] and [[Designated Nationalist|nationalist]] members of the Assembly.<ref name="northernireland1">{{Cite web |date=25 September 2015 |title=Your Executive |url=https://www.northernireland.gov.uk/topics/your-executive |publisher=Northern Ireland Executive |access-date=14 August 2016 |archive-date=21 August 2016 |archive-url=https://web.archive.org/web/20160821135048/https://www.northernireland.gov.uk/topics/your-executive |url-status=live}}</ref> The [[First Minister and Deputy First Minister of Northern Ireland|first minister and deputy first minister of Northern Ireland]] are the joint heads of government of Northern Ireland.<ref>{{Cite news |title=Stormont: Why were NI leaders given unequal job titles? |work=BBC News |date=15 May 2022 |url=https://www.bbc.co.uk/news/uk-northern-ireland-61393736 |access-date=2 February 2024 |archive-url=https://web.archive.org/web/20240202190001/https://www.bbc.com/news/uk-northern-ireland-61393736 |archive-date=2 February 2024}}</ref><ref>{{Cite web |title=Northern Ireland Executive: Ministerial Code |date=28 September 2015 |url=https://www.northernireland.gov.uk/topics/your-executive/ministerial-code |access-date=2 February 2024 |archive-url=https://web.archive.org/web/20240202191115/https://www.northernireland.gov.uk/topics/your-executive/ministerial-code |archive-date=2 February 2024}}</ref> [[Local government in Northern Ireland]] since 2015 has been divided between 11 councils with limited responsibilities.<ref name="Devenport" />
=== Foreign relations ===
{{Main|Foreign relations of the United Kingdom}}
[[File:Trump-Starmer bilateral 2025-02-27-16-07.jpg|thumb|right|UK prime minister Keir Starmer and US president [[Donald Trump]] shaking hands in a joint press conference in 2025. The UK and the US share a "[[Special Relationship]]".]]
The United Kingdom is [[Big Five (United Nations)|a permanent member]] of the [[United Nations Security Council]] and a member of [[NATO]], [[AUKUS]], the Commonwealth of Nations, the [[G7]], the [[G-20 major economies|G20]], the [[Organisation for Economic Co-operation and Development|OECD]], the [[World Trade Organization|WTO]], the [[Council of Europe]] and the [[Organization for Security and Co-operation in Europe|OSCE]].<ref>{{Cite web |last=May |first=Theresa |author-link=Theresa May |date=29 March 2017 |title=Prime Minister's letter to Donald Tusk triggering Article 50 |url=https://www.gov.uk/government/publications/prime-ministers-letter-to-donald-tusk-triggering-article-50/prime-ministers-letter-to-donald-tusk-triggering-article-50 |via=Gov.uk |access-date=19 June 2017 |archive-date=5 June 2017 |archive-url=https://web.archive.org/web/20170605184239/https://www.gov.uk/government/publications/prime-ministers-letter-to-donald-tusk-triggering-article-50/prime-ministers-letter-to-donald-tusk-triggering-article-50 |url-status=live}}</ref> It maintains the [[British Council]], an organisation specialising in international cultural and educational opportunities in over 100 countries. The UK remains a [[great power]] with considerable political, cultural, economic and military influence.<ref name="PaulWirtz2004">{{cite book |last1=Paul |first1=T.V. |url=https://books.google.com/books?id=9jy28vBqscQC&pg=PA59 |title=Balance of Power: Theory and Practice in the 21st century |last2=Wirtz |first2=James |last3=Fortmann |first3=Michel |date=2004 |publisher=Stanford University Press |isbn=978-0-8047-5017-2 |page=59}}</ref><ref>{{Cite news |date=10 May 2012 |title=United Kingdom country profile |url=https://www.bbc.com/news/world-europe-18023389 |access-date=6 July 2025 |work=BBC News |language=en-GB |archive-date=3 January 2023 |archive-url=https://web.archive.org/web/20230103160059/https://www.bbc.com/news/world-europe-18023389 |url-status=live }}</ref>
The United Kingdom is said to have a "[[Special Relationship]]" with the United States and a close partnership with France – the "[[Entente cordiale]]" – and shares nuclear weapons technology with both countries;<ref>{{Cite web |last=Swaine |first=Jon |date=13 January 2009 |title=Barack Obama presidency will strengthen special relationship, says Gordon Brown |url=https://www.telegraph.co.uk/news/worldnews/barackobama/4226246/Barack-Obama-presidency-will-strengthen-special-relationship-says-Gordon-Brown.html |url-access=subscription |access-date=30 May 2011 |website=[[The Daily Telegraph|The Telegraph]] |publication-place=[[London]] |archive-date=4 July 2020 |archive-url=https://web.archive.org/web/20200704192159/https://www.telegraph.co.uk/news/worldnews/barackobama/4226246/Barack-Obama-presidency-will-strengthen-special-relationship-says-Gordon-Brown.html |url-status=live}}</ref><ref>{{Cite book |last1=Kirchner |first1=Emil Joseph |title=Global Security Governance: Competing Perceptions of Security in the 21st century |last2=Sperling |first2=James |publisher=[[Routledge]] |year=2007 |isbn=978-0-415-39162-7 |edition=illustrated |location=London |page=100}}</ref> the [[Anglo-Portuguese Alliance]] is considered to be the oldest binding military alliance in the world. The UK is also closely linked with the Republic of Ireland; the two countries share a [[Common Travel Area]] and co-operate through the [[British-Irish Intergovernmental Conference]] and the [[British-Irish Council]]. Britain's global presence and influence is further amplified through its trading relations, foreign investments, [[official development assistance]] and military engagements.<ref>{{Cite web |last=The Committee Office, House of Commons |date=19 February 2009 |title=DFID's expenditure on development assistance |url=http://www.parliament.the-stationery-office.co.uk/pa/cm200809/cmselect/cmintdev/220/22007.htm |archive-url=https://web.archive.org/web/20130112222226/http://www.parliament.the-stationery-office.co.uk/pa/cm200809/cmselect/cmintdev/220/22007.htm |archive-date=12 January 2013 |access-date=28 April 2013 |publisher=UK Parliament}}</ref>
=== Military ===
{{Main|British Armed Forces|Military history of the United Kingdom}}
[[File:United Kingdom overseas military installations and operations.png|thumb|upright=1.4|
{{Legend|#0000FF|Overseas military installations of the United Kingdom, and locally raised units of the [[British Overseas Territories]]}}
{{Legend|#F0002B|Military interventions since 2000: [[British military intervention in the Sierra Leone Civil War|Palliser]] (Sierra Leone); [[Operation Herrick|Herrick]] (Afghanistan); [[Operation Enduring Freedom – Horn of Africa|Enduring Freedom]] (Horn of Africa); [[Operation Telic|Telic]] (Iraq); [[Operation Ellamy|Ellamy]] (Libya); and [[Operation Shader|Shader]] (Islamic State of Iraq and the Levant).}}]]
The British Armed Forces consist of three professional service branches: the [[Royal Navy]] and [[Royal Marines]] (forming the [[Naval Service (United Kingdom)|Naval Service]]), the [[British Army]] and the [[Royal Air Force]].<ref>{{Cite web |title=Ministry of Defence |url=http://www.mod.uk/DefenceInternet/Home |access-date=21 February 2012 |publisher=Ministry of Defence |archive-date=19 February 2012 |archive-url=https://web.archive.org/web/20120219194140/http://mod.uk/DefenceInternet/Home/ |url-status=live}}</ref> The armed forces of the United Kingdom are managed by the [[Ministry of Defence (United Kingdom)|Ministry of Defence]] and controlled by the [[Defence Council of the United Kingdom|Defence Council]], chaired by the [[Secretary of State for Defence]]. The [[Commander-in-Chief]] is the [[Monarchy of the United Kingdom|British monarch]], to whom members of the forces swear an oath of allegiance.<ref>{{Cite web |date=30 March 2012 |title=Speaker addresses Her Majesty Queen Elizabeth II |url=http://www.parliament.uk/business/news/2012/march/speaker-addresses-hm-the-queen |access-date=28 April 2013 |publisher=UK Parliament |archive-date=1 May 2013 |archive-url=https://web.archive.org/web/20130501221305/http://www.parliament.uk/business/news/2012/march/speaker-addresses-hm-the-queen/ |url-status=live}}</ref>
The armed forces are charged with protecting the United Kingdom and its overseas territories, promoting the UK's global security interests and supporting international peacekeeping efforts. They are active and regular participants in [[NATO]] (including the [[Allied Rapid Reaction Corps]]), the [[Five Power Defence Arrangements]], [[RIMPAC]] and other worldwide coalition operations. [[Overseas military bases of the United Kingdom|Overseas garrisons]] and facilities are maintained in [[RAF Ascension Island|Ascension Island]], [[Mina Salman|Bahrain]], [[Military of Belize|Belize]], [[Military Forces based in Brunei|Brunei]], [[British Army Training Unit Suffield|Canada]], [[British Forces Cyprus|Cyprus]], [[Diego Garcia]], the [[Military of the Falkland Islands|Falkland Islands]], [[British Forces Germany|Germany]], [[British Forces Gibraltar|Gibraltar]], [[British Army Training Unit Kenya|Kenya]], [[Oman]], [[Al Udeid Air Base|Qatar]] and [[Singapore]].<ref>{{Cite web |title=House of Commons Hansard |url=https://publications.parliament.uk/cgi-bin/newhtml_hl?DB=semukparl&STEMMER=en&WORDS=raf%20diego%20garcia&ALL=RAF&ANY=&PHRASE=%22Diego%20Garcia%20%22&CATEGORIES=&SIMPLE=&SPEAKER=&COLOUR=red&STYLE=s&ANCHOR=50221w33.html_spnew0&URL=/pa/cm200405/cmhansrd/vo050221/text/50221w33.htm#50221w33.html_spnew0 |archive-url=https://web.archive.org/web/20090309114107/http://www.publications.parliament.uk/cgi-bin/newhtml_hl?DB=semukparl&STEMMER=en&WORDS=raf%20diego%20garcia&ALL=RAF&ANY=&PHRASE=%22Diego%20Garcia%20%22&CATEGORIES=&SIMPLE=&SPEAKER=&COLOUR=red&STYLE=s&ANCHOR=50221w33.html_spnew0&URL=%2Fpa%2Fcm200405%2Fcmhansrd%2Fvo050221%2Ftext%2F50221w33.htm#50221w33.html_spnew0 |archive-date=9 March 2009 |access-date=23 October 2008 |publisher=UK Parliament}}; {{Cite web |title=House of Commons Hansard Written Answers for 17 Jun 2013 (pt 0002) |url=https://publications.parliament.uk/pa/cm201314/cmhansrd/cm130617/text/130617w0002.htm#13061746000236 |archive-url=https://web.archive.org/web/20150214025754/http://www.publications.parliament.uk/pa/cm201314/cmhansrd/cm130617/text/130617w0002.htm#13061746000236 |archive-date=14 February 2015 |access-date=4 March 2015 |publisher=Publications.parliament.uk}}</ref>
According to the [[Stockholm International Peace Research Institute]]<ref>{{Cite web |date=April 2026|title=Trends in Military Expenditure 2025|url=https://www.sipri.org/sites/default/files/2026-04/2604_milex_2025.pdf#page=2|access-date=31 May 2026|publisher=[[Stockholm International Peace Research Institute]]}}</ref> and the [[International Institute for Strategic Studies]],<ref>{{Cite web |title=The Military Balance 2026: Global defence spending|url=https://www.iiss.org/publications/the-military-balance/2026/the-military-balance-2026/global-defence-spending/|access-date=31 May 2026|website=IISS|language=en}}</ref> the UK had the world's [[List of countries by military expenditures|sixth- or fifth-highest military expenditures]] in 2025. Total defence spending in 2024 was estimated at 2.3 per cent of [[gross domestic product]].<ref>{{Cite web |title=Rishi Sunak vows to boost UK defence spending to 2.5% of GDP by 2030 |url=https://www.bbc.co.uk/news/uk-politics-68880171 |access-date=24 April 2024 |publisher=BBC News |date=24 April 2024 |archive-date=23 April 2024 |archive-url=https://web.archive.org/web/20240423233438/https://www.bbc.co.uk/news/uk-politics-68880171 |url-status=live}}</ref> Following the end of the [[Cold War]], defence policy has a stated assumption that "the most demanding operations" will be undertaken as part of a coalition.<ref>''UK 2005: The Official Yearbook of the United Kingdom of Great Britain and Northern Ireland''. Office for National Statistics. p. 89.</ref>
=== Law and criminal justice ===
<!-- Copyedit done to here -->
{{Main|Law of the United Kingdom|Crime in the United Kingdom}}
{{Further|English law|Northern Ireland law|Scots law}}
[[File:Middlesex Guildhall (cropped).jpg|thumb|The [[Supreme Court of the United Kingdom|Supreme Court]] is the final court of appeal for England, Wales and Northern Ireland, and for Scottish civil cases.]]
The United Kingdom does not have a single legal system as the [[Treaty of Union|1706 Treaty of Union]] provided for the continuation of Scotland's separate legal system.<ref name="Acts of Union 1707" /> The UK has three distinct [[Legal systems of the world|systems of law]]: English law, Northern Ireland law and Scots law. A new [[Supreme Court of the United Kingdom]] came into being in October 2009 to replace the [[judicial functions of the House of Lords|Appellate Committee of the House of Lords]].<ref>{{Cite news |date=1 October 2009 |title=UK Supreme Court judges sworn in |work=BBC News |url=http://news.bbc.co.uk/1/hi/uk/8283939.stm |access-date=6 October 2009 |archive-date=7 February 2020 |archive-url=https://web.archive.org/web/20200207160453/http://news.bbc.co.uk/1/hi/uk/8283939.stm |url-status=live}}; {{Cite web |date=July 2003 |title=Constitutional reform: A Supreme Court for the United Kingdom |url=http://www.dca.gov.uk/consult/supremecourt/supreme.pdf |archive-url=http://webarchive.nationalarchives.gov.uk/20090117132005/http://www.dca.gov.uk/consult/supremecourt/supreme.pdf |archive-date=17 January 2009 |access-date=13 May 2013 |publisher=Department for Constitutional Affairs}}</ref> The [[Judicial Committee of the Privy Council]], including the same members as the Supreme Court, is the highest court of appeal for several independent Commonwealth countries, the [[British Overseas Territories]] and the [[Crown Dependencies]].<ref>{{Cite web |title=Role of the JCPC |url=http://www.jcpc.uk/about/role-of-the-jcpc.html |access-date=28 April 2013 |publisher=Judicial Committee of the Privy Council |archive-date=14 January 2014 |archive-url=https://web.archive.org/web/20140114165910/http://www.jcpc.uk/about/role-of-the-jcpc.html |url-status=live}}</ref>
Both English law, which applies in England and Wales, and Northern Ireland law are based on [[common law]] (or [[case law]]) principles.<ref>{{Cite book |last=Bainham |first=Andrew |url=https://books.google.com/books?id=AF303DEl0MkC&pg=PA298 |title=The international survey of family law: 1996 |publisher=Martinus Nijhoff |year=1998 |isbn=978-90-411-0573-8 |location=The Hague |page=298 |access-date=29 September 2020 |archive-date=28 March 2024 |archive-url=https://web.archive.org/web/20240328141743/https://books.google.com/books?id=AF303DEl0MkC&pg=PA298#v=onepage&q&f=false |url-status=live}}</ref> It originated in England in the [[Middle Ages]] and is the basis for many legal systems around the world.<ref>{{Cite web |title=Common Law |url=https://www.britannica.com/topic/common-law |access-date=27 May 2024 |publisher=Britannica |date=19 May 2024 |archive-date=6 May 2021 |archive-url=https://web.archive.org/web/20210506134920/https://www.britannica.com/topic/common-law |url-status=live}}</ref> The [[courts of England and Wales]] are headed by the [[Senior Courts of England and Wales]], consisting of the [[Court of Appeal of England and Wales|Court of Appeal]], the [[High Court of Justice]] for civil cases and the [[Crown Court]] for criminal cases.<ref>{{Cite web |title=The Australian courts and comparative law |url=http://www.alpn.edu.au/node/66 |archive-url=https://web.archive.org/web/20130414202207/http://alpn.edu.au/node/66 |archive-date=14 April 2013 |access-date=9 March 2015 |publisher=Australian Law Postgraduate Network}}</ref> Scots law is a hybrid system based on common-law and [[Civil law (legal system)|civil-law]] principles. The chief courts are the [[Court of Session]], for civil cases,<ref>{{Cite web |title=Court of Session – Introduction |url=http://www.scotcourts.gov.uk/session/index.asp |archive-url=https://web.archive.org/web/20080731094308/http://www.scotcourts.gov.uk/session/index.asp |archive-date=31 July 2008 |access-date=8 March 2015 |publisher=Scottish Courts}}</ref> and the [[High Court of Justiciary]], for criminal cases.<ref>{{Cite web |title=High Court of Justiciary – Introduction |url=http://www.scotcourts.gov.uk/justiciary/index.asp |archive-url=https://web.archive.org/web/20080912204821/http://www.scotcourts.gov.uk/justiciary/index.asp |archive-date=12 September 2008 |access-date=9 March 2015 |publisher=Scottish Courts}}</ref> The Supreme Court of the United Kingdom serves as the highest court of appeal for civil cases under Scots law.<ref>{{Cite web |title=House of Lords – Practice Directions and Standing Orders Applicable to Civil Appeals |url=https://publications.parliament.uk/pa/ld199697/ldinfo/ld08judg/bluebook/bluebk03.htm |archive-url=https://web.archive.org/web/20131206120915/http://www.publications.parliament.uk/pa/ld199697/ldinfo/ld08judg/bluebook/bluebk03.htm |archive-date=6 December 2013 |access-date=8 March 2015 |publisher=UK Parliament}}</ref> The criminal justice system has been characterised by low [[conviction rate]]s and [[Justice delayed is justice denied|court delays]] for some crime types.<ref name="s576">{{cite journal | last1=Lovett | first1=Jo | last2=Hales | first2=Gavin | last3=Kelly | first3=Liz | last4=Khan | first4=Aneela | last5=Hardiman | first5=Margaret | last6=Trott | first6=Louise | title=What can We Learn from Police Data About Timeliness in Rape and Serious Sexual Offence Investigations in England and Wales? | journal=International Criminology | volume=2 | issue=3 | date=2022 | issn=2662-9976 | doi=10.1007/s43576-022-00069-8 | pages=286–298| pmc=9527390 }}</ref>
Crime in England and Wales increased between 1981 and 1995. Since that peak there has been an overall fall of 66% in recorded crime from 1995 to 2015,<ref>{{Cite web |url=http://www.ons.gov.uk/ons/dcp171778_419450.pdf |title=Crime in England and Wales, Year Ending June 2015 |publisher=Office for National Statistics |website=UK Government Web Archive |access-date=16 March 2023 |archive-date=16 March 2023 |archive-url=https://web.archive.org/web/20230316221317/https://webarchive.nationalarchives.gov.uk/ukgwa/20160105160709/http://www.ons.gov.uk/ons/dcp171778_419450.pdf |url-status=bot: unknown}}</ref> according to [[Crime statistics in the United Kingdom|UK crime statistics]].
[[United Kingdom labour law|UK labour laws]] establish employment rights including [[National Minimum Wage Act 1998|a minimum wage]], a minimum of 28 days annual holiday, parental leave, statutory sick pay and [[Pensions Act 2008|a pension]]. [[Same-sex marriage]] has been legal in England, Scotland, and Wales since 2014, and in [[Northern Ireland]] since 2020.<ref>{{cite web |last1=Wratten |first1=Marcus |title=Tom Allen to host vital new BBC show marking 10th anniversary of same-sex marriage |url=https://www.thepinknews.com/2023/07/03/tom-allen-bbc-my-big-gay-wedding-same-sex-marriage/ |website=PinkNews |date=3 July 2023 |access-date=2 September 2023 |archive-date=2 September 2023 |archive-url=https://web.archive.org/web/20230902195143/https://www.thepinknews.com/2023/07/03/tom-allen-bbc-my-big-gay-wedding-same-sex-marriage/ |url-status=live}}</ref> [[LGBT rights in the United Kingdom|LGBT equality]] in the United Kingdom is considered advanced by modern standards.<ref>{{Cite web |date=5 June 2023 |title=The 203 Worst (& Safest) Countries for LGBTQ+ Travel in 2023 |url=https://www.asherfergusson.com/lgbtq-travel-safety/ |access-date=20 August 2023 |website=Asher & Lyric |archive-date=10 September 2021 |archive-url=https://web.archive.org/web/20210910063408/https://www.asherfergusson.com/lgbtq-travel-safety/ |url-status=live}}</ref><ref>{{cite web |last1=R. Flores |first1=Andrew |title=Social Acceptance of LGBTI People in 175 Countries and Locations |url=https://williamsinstitute.law.ucla.edu/publications/global-acceptance-index-lgbt/ |website=Williams Institute |access-date=11 September 2023 |archive-date=13 September 2023 |archive-url=https://web.archive.org/web/20230913091254/https://williamsinstitute.law.ucla.edu/publications/global-acceptance-index-lgbt/ |url-status=live}}</ref>
Since leaving the [[European Union|EU]] most disputes under UK-EU agreements are addressed through consultation between the parties. If consultation fails to resolve the issue, either party can request [[arbitration]], typically at the [[Permanent Court of Arbitration|PCA]] in [[Peace Palace|The Hague]].<ref name="commission.europa.eu" /><ref>{{Cite web |title=Disputes under the Trade and Cooperation Agreement |date=November 2021 |url=https://www.instituteforgovernment.org.uk/explainer/disputes-trade-and-cooperation-agreement |access-date=26 January 2025 |publisher=Institute for Government}}</ref><ref>{{Cite web |title=Sandeel fishing ban to remain in place |date=2 May 2025 |url=https://www.bbc.co.uk/news/articles/ckgrwxxzxkjo |website=BBC |access-date=4 May 2025 |archive-url=https://web.archive.org/web/20250504203005/https://www.bbc.com/news/articles/ckgrwxxzxkjo |archive-date=4 May 2025}}</ref> The [[EU–UK Trade and Cooperation Agreement]] states that the UK and EU have to cooperate and negotiate with each other with 'full mutual respect and good faith', as defined by international law.<ref>{{Cite web |title=Good Faith in Public Law |date=20 January 2022 |url=https://www.law.ox.ac.uk/news/2022-01-20-good-faith-public-law |website=ox.ac.uk |access-date=13 May 2025 |archive-url=https://web.archive.org/web/20250513165454/https://www.law.ox.ac.uk/news/2022-01-20-good-faith-public-law |archive-date=13 May 2025}}</ref> Under the [[Windsor Framework]], [[Northern Ireland]] matters requiring interpretation of EU law go to the [[European Court of Justice|ECJ]], though the [[Stormont Brake]] can prevent new EU rules from taking effect.
== Economy ==
{{Main|Economy of the United Kingdom}}
{{Further|Economy of England|Economy of Scotland|Economy of Northern Ireland|Economy of Wales}}
[[File:Bank junction - 2020-09-20 (2).jpg|thumb|[[City of London]] skyline from at [[Bank Junction]]. [[London]] is Europe's largest financial centre.<ref>{{Cite web |last=Yanatma |first=Servet |date=16 March 2024 |title=Europe's top financial centres: Where's best to do business? |url=https://www.euronews.com/business/2024/03/16/europes-top-financial-centres-wheres-best-to-do-business |access-date=16 August 2025 |publisher=[[Euronews]] |quote=While the US dominates the upper end of the list, with New York taking the number one spot, London continues to lead in Europe.}}</ref>]]
The United Kingdom has a highly developed [[social market economy]].<ref>{{Cite journal |last1=Thane |first1=Pat |year=2019 |title=The Origins of the British Welfare State |journal=The Journal of Interdisciplinary History |volume=50 |issue=3 |pages=427–433 |doi=10.1162/jinh_a_01448 |s2cid=208223636 |doi-access=free}}</ref><ref name="ftms">{{cite web |last1=Griffiths |first1=Alan |last2=Wall |first2=Stuart |date=16 July 2011 |title=Applied Economics |url=http://www.ftms.edu.my/pdf/Download/UndergraduateStudent/BusinessEconomics/BC215001S%20-%20BE%20Key%20Text%20-%20Applied%20Economics.pdf |url-status=dead |archive-url=https://web.archive.org/web/20130620120524/http://www.ftms.edu.my/pdf/Download/UndergraduateStudent/BusinessEconomics/BC215001S%20-%20BE%20Key%20Text%20-%20Applied%20Economics.pdf |archive-date=20 June 2013 |access-date=25 September 2014}}</ref> With an estimated nominal [[gross domestic product]] (GDP) of £2.819 trillion in 2025,<ref name="IMFWEO.UK" /> it is the [[List of countries by GDP (nominal)|fifth-largest national economy]] in the world and the [[List of sovereign states in Europe by GDP (nominal)|second-largest]] in Europe. Its currency, the [[pound sterling]], is the [[Foreign exchange market#Most traded currencies by value|fourth-most-traded currency]] in the [[foreign exchange market]] and the world's fourth-largest [[reserve currency]], after the [[United States dollar]], the [[euro]] and the [[yen]].<ref>{{Cite web |title=World Currency Composition of Official Foreign Exchange Reserves |url=https://data.imf.org/regular.aspx?key=41175 |access-date=10 October 2021 |website=IMF Data |archive-date=12 May 2016 |archive-url=https://web.archive.org/web/20160512202858/https://data.imf.org/regular.aspx?key=41175 |url-status=live}}</ref> The pound sterling maintains its high nominal value through both its long history of stability and by never undergoing formal [[redenomination]]. Since 2022 the UK has been both the world's [[List of countries by exports|fourth-largest exporter]]<ref>{{Cite web |title=Exports of goods and services (BoP, current US$) |url=https://data.worldbank.org/indicator/BX.GSR.GNFS.CD?end=2024&most_recent_value_desc=true |access-date=22 September 2025 |website=[[World Bank]]}}</ref> and [[List of countries by imports|fourth-largest importer]]<ref>{{Cite web |title=Imports of goods and services (current US$) |url=https://data.worldbank.org/indicator/NE.IMP.GNFS.CD?most_recent_value_desc=true |access-date=22 September 2025 |website=[[World Bank]] |archive-date=13 September 2025 |archive-url=https://web.archive.org/web/20250913065521/https://data.worldbank.org/indicator/NE.IMP.GNFS.CD?most_recent_value_desc=true |url-status=live }}</ref> of goods and services. Despite having one of the highest levels of [[Income inequality in the United Kingdom|income inequality]] in the [[OECD]],<ref>{{Cite web |last1=Francis-Devine |first1=Brigid |title=House of Commons Research Briefing on Income inequality in the UK. |url=https://commonslibrary.parliament.uk/research-briefings/cbp-7484/ |url-status=live |archive-url=https://web.archive.org/web/20220210104536/https://commonslibrary.parliament.uk/research-briefings/cbp-7484/ |archive-date=10 February 2022 |access-date=1 July 2023 |website=UK Parliament}}</ref><ref>{{Cite web |title=Inequality – Income inequality – OECD Data |url=http://data.oecd.org/inequality/income-inequality.htm |archive-url=https://web.archive.org/web/20230629183322/https://data.oecd.org/inequality/income-inequality.htm |archive-date=29 June 2023 |access-date=3 July 2023 |website=theOECD}}</ref> the UK has a very high [[Human Development Index|HDI]] ranking, including when [[List of countries by inequality-adjusted Human Development Index|adjusted for inequality]]. As of 2025 the [[Unemployment in the United Kingdom|UK unemployment rate]] is 4.7%<ref>{{Cite web |last1=Labiak |first1=Mitchell |last2=Smith |first2=Oliver |date=17 July 2025 |title=UK jobs market weakens as unemployment rate rises |url=https://www.bbc.com/news/articles/cg754negn75o |access-date=25 September 2025 |website=www.bbc.com |language=en-GB |archive-date=15 September 2025 |archive-url=https://web.archive.org/web/20250915184829/https://www.bbc.com/news/articles/cg754negn75o |url-status=live }}</ref> and the annual [[List of countries by real GDP per capita growth|real GDP per head growth]] was 1.1%.<ref name="f919">{{cite web | title=GDP quarterly national accounts, UK | website=Office for National Statistics | date=2026 | url=https://www.ons.gov.uk/economy/grossdomesticproductgdp/bulletins/quarterlynationalaccounts/octobertodecember2025 | access-date=24 April 2026}}</ref>
[[HM Treasury]], led by the [[Chancellor of the Exchequer]], is responsible for developing and executing the government's [[public finance]] and [[economic policy]]. The [[Department for Business and Trade]] is responsible for business, international trade, and enterprise. The [[Bank of England]] is the UK's [[central bank]] and responsible for issuing notes and coins in the pound sterling. Banks in Scotland and Northern Ireland retain the right to issue their own notes, subject to retaining enough Bank of England notes in reserve to cover their issue.
=== Industries and services ===
[[File:Bank-of-England.jpg|thumb|The [[Bank of England]] is the [[central bank]] of the United Kingdom and the model on which most modern central banks have been based.]]
[[File:British Airways Concorde G-BOAC 03.jpg|thumb|[[Concorde]] was a [[Supersonic speed|supersonic]] airliner that reduced transatlantic flight time from 8 hours to 3.5 hours.<ref>{{Cite web |title=Celebrating Concorde |url=https://www.britishairways.com/en-gb/information/about-ba/history-and-heritage/celebrating-concorde |archive-url=https://web.archive.org/web/20230317103939/https://www.britishairways.com/en-gb/information/about-ba/history-and-heritage/celebrating-concorde |archive-date=17 March 2023 |access-date=30 March 2023}}</ref>]]
The [[Tertiary sector of the economy|service sector]] made up around 80 per cent of the UK's [[Gross value added|GVA]] in 2023.<ref>{{Cite web |last=Hutton |first=Georgina |date=3 October 2024 |title=Industries in the UK |url=https://commonslibrary.parliament.uk/research-briefings/cbp-8353/ |access-date=19 May 2025 |website=UK Parliament: House of Commons Library |archive-date=7 October 2021 |archive-url=https://web.archive.org/web/20211007134640/https://commonslibrary.parliament.uk/research-briefings/cbp-8353/ |url-status=live }}</ref> As of 2023 it is the world's [[List of countries by service exports|second-largest exporter of services]]<ref>{{Cite web |title=Service exports (BoP, current US$) |url=https://data.worldbank.org/indicator/BX.GSR.NFSV.CD?most_recent_value_desc=true&year_high_desc=false |access-date=19 May 2025 |website=World Bank Open Data |archive-date=17 March 2023 |archive-url=https://web.archive.org/web/20230317140633/https://data.worldbank.org/indicator/BX.GSR.NFSV.CD?most_recent_value_desc=true&year_high_desc=false |url-status=live }}</ref> and in 2024 was the world's largest net exporter of [[Financial services in the United Kingdom|financial services]].<ref>{{Cite web |date=15 January 2025 |title=UK leads world in financial services trade surplus |url=https://www.thecityuk.com/news/uk-leads-world-in-financial-services-trade-surplus/ |access-date=2 June 2025 |website=TheCityUK |language=en}}</ref> [[London]] is the world capital for foreign exchange trading, with a market share of 37.8 per cent in 2022 of the global turnover.<ref>{{Cite web |date=30 September 2025 |title=BIS Triennial Survey of Foreign Exchange and Over-The-Counter Interest Rate Derivatives Markets in April 2025 – UK Data |url=https://www.bankofengland.co.uk/news/2025/september/bis-triennial-survey-of-foreign-exchange-and-over-the-counter-interest-rate-derivatives-markets |access-date=7 December 2025 |publisher=Bank of England}}</ref> It is the largest urban economy in Europe<ref>{{Cite web |last=Florida |first=Richard |date=16 March 2017 |title=The Economic Power of Cities Compared to Nations |url=https://www.bloomberg.com/news/articles/2017-03-16/top-metros-have-more-economic-power-than-most-nations |url-status=live |archive-url=https://web.archive.org/web/20240308074221/https://www.bloomberg.com/news/articles/2017-03-16/top-metros-have-more-economic-power-than-most-nations |archive-date=8 March 2024 |access-date=22 February 2024 |website=Bloomberg}}</ref> and, alongside [[New York City|New York]], the city in the world most integrated with the [[World economy|global economy]].<ref>{{Cite web |title=World Cities 2024 |url=https://gawc.lboro.ac.uk/gawc-worlds/the-world-according-to-gawc/world-cities-2024/ |access-date=21 September 2025 |website=GaWC |language=en-US |archive-date=3 July 2025 |archive-url=https://web.archive.org/web/20250703071437/https://gawc.lboro.ac.uk/gawc-worlds/the-world-according-to-gawc/world-cities-2024/ |url-status=live }}</ref> London is also one of the world's leading financial centres, ranking second in the 2025 [[Global Financial Centres Index]].<ref name="www.longfinance.net">{{Cite web |title=GFCI 36 Rank - Long Finance |url=https://www.longfinance.net/programmes/financial-centre-futures/global-financial-centres-index/gfci-36-explore-the-data/gfci-36-rank/ |access-date=19 May 2025 |website=www.longfinance.net |archive-date=25 September 2024 |archive-url=https://web.archive.org/web/20240925155927/https://www.longfinance.net/programmes/financial-centre-futures/global-financial-centres-index/gfci-36-explore-the-data/gfci-36-rank/ |url-status=live }}</ref> [[Edinburgh]], the UK's second-largest financial centre, ranks 29th in the world in the same index.<ref name="www.longfinance.net" />
The [[Manufacturing in the United Kingdom|UK's manufacturing sector]] in 2024 was the world's [[List of countries by manufacturing output|10th-largest]] and Europe's fourth-largest by value output.<ref>{{Cite web |title=World Bank Open Data |url=https://data.worldbank.org/indicator/NV.IND.MANF.CD?most_recent_value_desc=true |access-date=5 August 2025 |website=World Bank Open Data |archive-date=7 January 2020 |archive-url=https://web.archive.org/web/20200107135049/https://data.worldbank.org/indicator/NV.IND.MANF.CD?most_recent_value_desc=true |url-status=live }}</ref> At the end of 2024 manufacturing in the United Kingdom accounted for 8 per cent of the workforce and 8.6 per cent of national economic output.<ref>{{Cite web |date=22 May 2025 |title=Manufacturing industries: Economic indicators |url=https://commonslibrary.parliament.uk/research-briefings/sn05206/ |access-date=1 June 2025 |website=House of Commons Library}}</ref> As reported in 2017 the [[East Midlands Manufacturing|East Midlands]] and [[West Midlands Manufacturing|West Midlands]] (at 12.6 and 11.8 per cent respectively) were the regions with the highest proportion of employees in manufacturing. [[London manufacturing|London's manufacturing sector]] had the lowest at 2.8 per cent.<ref>Hennik Research. [http://www.themanufacturer.com/wp-content/uploads/2017/01/Annual-Manufacturing-Report-2017-Final-Version.pdf ''Annual Manufacturing Report: 2017'' (Dec. 2016)] {{Webarchive|url=https://web.archive.org/web/20170131192050/http://www.themanufacturer.com/wp-content/uploads/2017/01/Annual-Manufacturing-Report-2017-Final-Version.pdf|date=31 January 2017}}</ref>
The [[Tourism in the United Kingdom|country's tourism sector]] is important to the British economy;<ref>{{Cite web |last1=Chan |first1=Kelvin |date=25 April 2023 |title=King Charles' coronation is bringing millions of tourists and a cash infusion to London but it probably won't save the British economy |url=https://fortune.com/2023/04/25/king-charles-coronation-tourists-money-london-british-economy/ |archive-url=https://web.archive.org/web/20230502144950/https://fortune.com/2023/04/25/king-charles-coronation-tourists-money-london-british-economy/ |archive-date=2 May 2023 |access-date=9 May 2023 |website=[[fortune.com]] |agency=The Associated Press}}</ref> The [[creative industries]] accounted for 5.9 per cent of the UK's GVA in 2019,<ref>{{Cite web |title=DCMS Economic Estimates 2019 (provisional): Gross Value Added |url=https://www.gov.uk/government/statistics/dcms-economic-estimates-2019-gross-value-added/dcms-economic-estimates-2019-provisional-gross-value-added |access-date=31 January 2023 |website=gov.uk |archive-date=31 January 2023 |archive-url=https://web.archive.org/web/20230131001226/https://www.gov.uk/government/statistics/dcms-economic-estimates-2019-gross-value-added/dcms-economic-estimates-2019-provisional-gross-value-added |url-status=live}}</ref> and contributed £111 billion to the UK economy in 2018.<ref>{{Cite web |year=2020 |title=UK's Creative Industries contributes almost £13 million to the UK economy every hour |url=https://www.gov.uk/government/news/uks-creative-industries-contributes-almost-13-million-to-the-uk-economy-every-hour |access-date=21 February 2023 |publisher=UK Government |archive-date=21 February 2023 |archive-url=https://web.archive.org/web/20230221131518/https://www.gov.uk/government/news/uks-creative-industries-contributes-almost-13-million-to-the-uk-economy-every-hour |url-status=live}}</ref> [[Lloyd's of London]], located in London, is the world's largest [[insurance]] and [[reinsurance]] market.<ref>{{Cite web |title=Lloyd's of London – value proposition |url=https://www.lloyds.com/about-lloyds/value-proposition-coverholder |archive-url=https://web.archive.org/web/20230227100951/https://www.lloyds.com/about-lloyds/value-proposition-coverholder |archive-date=27 February 2023 |website=Lloyd's of London}}</ref> [[WPP plc]] is one of the world's biggest advertising companies and also based in London.<ref>{{Cite web |title=Rankings 2025 - Creative 100 |url=https://www.warc.com/creative/rankings/creative-100 |website=WARC |access-date=12 June 2025 |archive-url=https://web.archive.org/web/20250612162216/https://www.warc.com/creative/rankings/creative-100 |archive-date=12 June 2025}}</ref> The UK is one of Europe's leading retail markets and its largest [[e-commerce]] market.<ref>{{Cite web |url=https://www.great.gov.uk/international/content/investment/sectors/retail/ |access-date=18 January 2024 |title=Retail |publisher=great.gov.uk |archive-date=18 January 2024 |archive-url=https://web.archive.org/web/20240118084416/https://www.great.gov.uk/international/content/investment/sectors/retail/ |url-status=live}}</ref> With [[Consumer spending|consumption expenditures]] of over US$2 trillion in 2023, it has the [[List of largest consumer markets|second-largest consumer market]] in Europe.<ref>{{Cite web |title=Households and NPISHs Final consumption expenditure (current US$) |url=https://data.worldbank.org/indicator/NE.CON.PRVT.CD?year_high_desc=true |access-date=17 August 2024 |website=World Bank Group |archive-date=12 June 2018 |archive-url=https://web.archive.org/web/20180612143614/https://data.worldbank.org/indicator/NE.CON.PRVT.CD?year_high_desc=true |url-status=live}}</ref> [[John Lewis Partnership|John Lewis]] is the UK's largest employee-owned business.<ref>{{Cite web |url=https://employeeownership.co.uk/resources/what-the-evidence-tells-us/ |access-date=18 January 2024 |title=Employee owned businesses - What the evidence tells us |archive-date=2 December 2023 |archive-url=https://web.archive.org/web/20231202155249/https://employeeownership.co.uk/resources/what-the-evidence-tells-us/ |url-status=live}}</ref>
The [[Automotive industry in the United Kingdom|British automotive industry]] generates £47 billion of exports (12 per cent of the UK's total exports of goods).<ref name="Auto Output 2025" /> In 2024 the UK produced 779,584 passenger vehicles and 125,649 commercial vehicles; 8 out of 10 cars produced in the UK are exported overseas.<ref name="Auto Output 2025">{{Cite web |date=15 May 2025 |title=SMMT Motor Industry Facts 2025 |url=https://www.smmt.co.uk/smmt-motor-industry-facts-2025/ |access-date=26 May 2025 |website=SMMT |archive-date=26 May 2025 |archive-url=https://web.archive.org/web/20250526074751/https://www.smmt.co.uk/smmt-motor-industry-facts-2025/ |url-status=live}}</ref> Britain is known for iconic cars like [[Mini Hatch|Mini]] and [[Jaguar Cars|Jaguar]],<ref>{{Cite web |date=19 November 2020 |title=Best British cars: Top 50 all-time greatest British-built cars revealed - page 2 |url=https://www.autoexpress.co.uk/best-cars-vans/351729/best-british-cars-top-50-all-time-greatest-british-built-cars-revealed/page-2 |access-date=9 March 2024 |website=Auto Express |archive-date=16 March 2024 |archive-url=https://web.archive.org/web/20240316184015/https://www.autoexpress.co.uk/best-cars-vans/351729/best-british-cars-top-50-all-time-greatest-british-built-cars-revealed/page-2 |url-status=live}}</ref> as well as luxury cars such as [[Rolls-Royce Motor Cars|Rolls-Royce]], [[Bentley]] and [[Range Rover]]. The UK is a major centre for engine manufacturing: 1.59 million engines were produced in 2024.<ref name="Auto Output 2025" /> It was the world's [[List of countries by engine exports|third-largest exporter of engines]] by value in 2023.<ref>{{Cite web |title=Combustion Engines |url=https://oec.world/en/profile/hs/combustion-engines |access-date=26 May 2025 |website=OEC - The Observatory of Economic Complexity |archive-date=26 May 2025 |archive-url=https://web.archive.org/web/20250526073421/https://oec.world/en/profile/hs/combustion-engines |url-status=live}}</ref> The [[Motorsport in the United Kingdom|UK motorsport]] industry has an annual turnover of around £10 billion.<ref>{{Cite web |year=2020 |title=UK motorsport industry in pole position for F1's 70th anniversary |url=https://www.gov.uk/government/news/uk-motorsport-industry-in-pole-position-for-f1s-70th-anniversary |access-date=19 February 2023 |publisher=UK Government |archive-date=19 February 2023 |archive-url=https://web.archive.org/web/20230219100712/https://www.gov.uk/government/news/uk-motorsport-industry-in-pole-position-for-f1s-70th-anniversary |url-status=live}}</ref> Seven of the eleven [[Formula One]] teams are based in the UK, with their technology being used in supercars and hypercars from [[McLaren Automotive|McLaren]], [[Aston Martin]] and [[Lotus Cars|Lotus]].{{Efn|Car brands here are classed as British based on several of the following criteria: historical heritage, cultural significance, design and engineering base, manufacturing location, headquarters location, UK registered company (even with overseas investors).}} The [[Aerospace industry in the United Kingdom|aerospace industry of the UK]] is the second-largest in the world<ref>{{cite web |title=United Kingdom - Country Commercial Guide: Aerospace and Defense |url=https://www.trade.gov/country-commercial-guides/united-kingdom-aerospace-and-defense |website=[[International Trade Administration]] |date=3 November 2023 |access-date=17 December 2024 |archive-date=12 June 2023 |archive-url=https://web.archive.org/web/20230612142750/https://www.trade.gov/country-commercial-guides/united-kingdom-aerospace-and-defense |url-status=live }}</ref> and has an annual turnover of around £30 billion.<ref>{{Cite news |last=Tovey |first=Alan |date=29 June 2016 |title=Britain's aerospace sector soars amid fears Brexit could clip its wings |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/business/2016/06/29/britains-aerospace-sector-soars-amid-fears-brexit-could-clip-its |url-status=live |url-access=subscription |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/business/2016/06/29/britains-aerospace-sector-soars-amid-fears-brexit-could-clip-its |archive-date=10 January 2022}}{{Cbignore}}</ref> The [[British space programme|UK space industry]] was worth £17.5 billion in 2020/21 and employed around 48,800 people.<ref>{{cite web |title=UK space sector income reaches £17.5 billion as jobs and services grow |url=https://www.ukspace.org/uk-space-sector-income-reaches-17-5-billion-as-jobs-and-services-grow/ |website=UKspace |date=27 March 2023}}</ref><ref>{{cite web |title=UK space sector income reaches £17.5 billion as jobs and services grow |url=https://www.gov.uk/government/news/uk-space-sector-income-reaches-175-billion-as-jobs-and-services-grow |website=gov.uk |date=29 March 2023 |access-date=10 August 2025}}</ref> The [[UK Space Agency]] has stated in 2023 that it is investing £1.6 billion in space-related projects.<ref>{{Cite web |url=https://www.gov.uk/government/news/new-funding-to-support-space-exploration-using-moon-resources-and-nuclear-power |title=New funding to support space exploration using Moon resources and nuclear power |access-date=11 March 2023 |archive-date=11 March 2023 |archive-url=https://web.archive.org/web/20230311195622/https://www.gov.uk/government/news/new-funding-to-support-space-exploration-using-moon-resources-and-nuclear-power}} <!-- (last checked 2023-03-11) --></ref>
The [[Agriculture in the United Kingdom|British agriculture industry]] is intensive, highly mechanised and efficient by European standards, producing approximately 60 per cent of the country's overall food requirements and 73 per cent of its indigenous food needs, utilising around 0.9 per cent of the labour force (292,000 workers).<ref>{{Cite web |title=UK Food Security Index 2024 |url=https://www.gov.uk/government/publications/uk-food-security-index-2024/uk-food-security-index-2024 |access-date=19 May 2024 |publisher=Department for the Environment Food & Rural Affairs |archive-date=18 May 2024 |archive-url=https://web.archive.org/web/20240518072412/https://www.gov.uk/government/publications/uk-food-security-index-2024/uk-food-security-index-2024 |url-status=live}};{{Cite web |title=Agricultural workforce in England at 1 June 2023 |url=https://www.gov.uk/government/statistics/agricultural-workforce-in-england-at-1-june/agricultural-workforce-in-england-at-1-june-2023 |access-date=19 May 2024 |publisher=Department for the Environment Food & Rural Affairs |archive-date=19 May 2024 |archive-url=https://web.archive.org/web/20240519211112/https://www.gov.uk/government/statistics/agricultural-workforce-in-england-at-1-june/agricultural-workforce-in-england-at-1-june-2023 |url-status=live}}</ref> Around two-thirds of production is devoted to [[livestock]] and one-third to [[arable crops]]. The UK retains a significant though much reduced fishing industry, with at least 49 per cent of UK fish sustainably caught in 2020.<ref>{{Cite web |url=https://jncc.gov.uk/our-work/ukbi-b2-sustainable-fisheries |title=Sustainable fisheries: fish stocks harvested within safe limits |website=JNCC |access-date=14 December 2024}}</ref> The UK marine natural capital assets were estimated to have a value of £211 billion in 2021.<ref>{{Cite web |title=Marine accounts, natural capital, UK: 2021 |date=6 April 2021 |url=https://www.ons.gov.uk/economy/environmentalaccounts/bulletins/marineaccountsnaturalcapitaluk/2021 |website=ONS |access-date=21 May 2025 |archive-url=https://web.archive.org/web/20250521071820/https://www.ons.gov.uk/economy/environmentalaccounts/bulletins/marineaccountsnaturalcapitaluk/2021 |archive-date=21 May 2025}}</ref> It is rich in a variety of other natural resources including coal, [[petroleum]], [[natural gas]], tin, limestone, iron ore, salt, clay, chalk, [[gypsum]], lead, and silica and has an abundance of arable land.<ref>{{Cite web |url=http://www.bgs.ac.uk/mineralsuk/mines/coal/home.html |title=Coal |website=BGS Minerals UK |access-date=7 July 2015 |archive-date=26 April 2009 |archive-url=https://web.archive.org/web/20090426141109/http://www.bgs.ac.uk/ |url-status=live}}</ref>
=== Science and technology ===
{{Main|Science and technology in the United Kingdom|Telecommunications in the United Kingdom}}
[[File:Cambridge Science Park Napp.jpg|thumb|The [[Cambridge Cluster]] is the most intensive research cluster for science and technology in the world.<ref>{{Cite book |last=WIPO |url=https://www.wipo.int/global_innovation_index/en/2022/index.html |title=Global Innovation Index 2022, 15th Edition |publisher=World Intellectual Property Organization |year=2022 |isbn=978-92-805-3432-0 |doi=10.34667/tind.46596 |access-date=16 November 2022 |archive-date=3 December 2022 |archive-url=https://web.archive.org/web/20221203061259/https://www.wipo.int/global_innovation_index/en/2022/index.html |url-status=live}}; {{Cite web |title=Global Innovation Index 2021 |url=https://www.wipo.int/global_innovation_index/en/2021 |access-date=5 March 2022 |website=[[World Intellectual Property Organization]] |publisher=[[United Nations]] |archive-date=5 March 2022 |archive-url=https://web.archive.org/web/20220305010458/https://www.wipo.int/global_innovation_index/en/2021/ |url-status=live}}; {{Cite web |title=Release of the Global Innovation Index 2020: Who Will Finance Innovation? |url=https://www.wipo.int/global_innovation_index/en/2020/index.html |access-date=2 September 2021 |website=World Intellectual Property Organization |archive-date=3 June 2021 |archive-url=https://web.archive.org/web/20210603121259/https://www.wipo.int/global_innovation_index/en/2020/index.html |url-status=live}}; {{Cite web |title=Global Innovation Index 2019 |url=https://www.wipo.int/global_innovation_index/en/2019/index.html |access-date=2 September 2021 |website=World Intellectual Property Organization |archive-date=2 September 2021 |archive-url=https://web.archive.org/web/20210902101818/https://www.wipo.int/global_innovation_index/en/2019/index.html |url-status=live}}; {{Cite web |title=RTD – Item |url=https://ec.europa.eu/newsroom/rtd/items/691898 |access-date=2 September 2021 |website=ec.europa.eu |archive-date=2 September 2021 |archive-url=https://web.archive.org/web/20210902140715/https://ec.europa.eu/newsroom/rtd/items/691898 |url-status=live}}</ref>]]
England and Scotland were leading centres of the [[Scientific Revolution]] from the 17th century.<ref>Gascoin, J. "A reappraisal of the role of the universities in the Scientific Revolution", in Lindberg, David C. and Westman, Robert S., eds (1990), ''Reappraisals of the Scientific Revolution''. Cambridge University Press. p. 248. {{ISBN|978-0-521-34804-1}}.</ref> The United Kingdom led the [[Industrial Revolution]] from the 18th century, and has continued to produce scientists and [[List of British engineers|engineers]] credited with [[List of British innovations and discoveries|important advances]].<ref>Reynolds, E.E.; Brasher, N.H. (1966). ''Britain in the Twentieth Century, 1900–1964''. Cambridge University Press. p. 336. {{OCLC|474197910}}</ref> Major theorists from the 17th and 18th centuries include [[Isaac Newton]], whose [[Newton's laws of motion|laws of motion]] and illumination of [[gravitation|gravity]] have been seen as a keystone of modern science;<ref>Burtt, E.A. (2003) 1924.[https://books.google.com/books?id=G9WBMa1Rz_kC&pg=PA207 ''The Metaphysical Foundations of Modern Science''] {{Webarchive|url=https://web.archive.org/web/20230326164803/https://books.google.com/books?id=G9WBMa1Rz_kC&pg=PA207 |date=26 March 2023 }}. Mineola, NY: Courier Dover. p. 207. {{ISBN|978-0-486-42551-1}}.</ref> from the 19th century [[Charles Darwin]], whose theory of [[evolution]] by [[natural selection]] was fundamental to the development of modern biology, and [[James Clerk Maxwell]], who formulated classical [[electromagnetic theory]]; and more recently [[Stephen Hawking]], who advanced major theories in the fields of [[cosmology]], [[quantum gravity]] and the investigation of [[black holes]].<ref>Hatt, C. (2006). [https://books.google.com/books?id=BVBvehqrAPQC ''Scientists and Their Discoveries''] {{Webarchive|url=https://web.archive.org/web/20230326164803/https://books.google.com/books?id=BVBvehqrAPQC |date=26 March 2023 }}. London: Evans Brothers. pp. 16, 30 and 46. {{ISBN|978-0-237-53195-9}}.</ref>
The [[Department for Science, Innovation and Technology]] (DSIT) is responsible for helping to develop and manage the UK's scientific, research, and technological outputs. Scientific research and development remains important in [[Universities in the United Kingdom|British universities]], with many establishing [[science park]]s to facilitate production and co-operation with industry.<ref>Castells, M.; Hall, P.; Hall, P.G. (2004). ''Technopoles of the World: the Making of Twenty-First-Century Industrial Complexes''. London: Routledge. pp. 98–100. {{ISBN|978-0-415-10015-1}}.</ref> In 2022, the UK produced [[List of countries by number of scientific and technical journal articles|6.0 per cent of the world's scientific research papers]] and had an 8.8 per cent share of scientific citations, the fourth and third highest among <abbr>G7</abbr> countries and Brazil, China, India, Russia, and South Korea. The UK ranked 1st among these countries for Field-Weighted Citation Impact.<ref>{{Cite web |title=International comparison of the UK research base, 2025 |url=https://www.gov.uk/government/publications/international-comparison-of-the-uk-research-base-2025/international-comparison-of-the-uk-research-base-2025 |access-date=7 December 2025 |website=GOV.UK |language=en}}</ref> Scientific journals produced in the UK include publications by the [[Royal Society]], ''[[Nature (journal)|Nature]]'', the ''[[BMJ|British Medical Journal]]'' and ''[[The Lancet]]''.<ref>{{Cite journal |last=McCook, Alison |year=2006 |title=Is peer review broken? |url=http://gaia.pge.utexas.edu/Good/Materials/scientist_02_28_2006.htm |journal=The Scientist |volume=20 |issue=2 |page=26 |archive-url=https://web.archive.org/web/20110816230933/http://gaia.pge.utexas.edu/Good/Materials/scientist_02_28_2006.htm |archive-date=16 August 2011 |access-date=22 June 2011}}</ref>
By 2024 the UK tech sector reached a value of US$1.2 trillion surpassing the combined values of the French and German sectors.<ref>{{Cite web |last=Greenberg |first=Elizabeth |date=14 January 2025 |title=UK Innovation Economy Worth a Combined $1.2 trillion |url=https://www.digit.fyi/uk-innovation-economy-worth-a-combined-1-2-trillion/ |access-date=26 May 2026 |publisher=Digit News |language=en |quote=Valued at $1.2 trillion collectively, the UK innovation ecosystem is worth more than the French and German ecosystems combined.}}</ref> Cambridge was named the number one university in the world for producing successful technology founders.<ref>{{Cite web |title=UK tech sector retains #1 spot in Europe and #3 in world as sector resilience brings continued growth |date=21 December 2022 |url=https://www.gov.uk/government/news/uk-tech-sector-retains-1-spot-in-europe-and-3-in-world-as-sector-resilience-brings-continued-growth |website=gov.uk |access-date=27 May 2025 |archive-url=https://web.archive.org/web/20250527173044/https://www.gov.uk/government/news/uk-tech-sector-retains-1-spot-in-europe-and-3-in-world-as-sector-resilience-brings-continued-growth |archive-date=27 May 2025}}</ref> The [[Artificial intelligence industry in the United Kingdom|UK's artificial intelligence industry]] is the largest in Europe by value<ref>{{Cite web |date=11 June 2024 |title=UK AI sector most valuable in Europe, new report reveals |url=https://www.holyrood.com/news/view,uk-ai-sector-most-valuable-in-europe-new-report-reveals |access-date=20 July 2025 |website=[[Holyrood (magazine)|Holyrood]] |language=en}}</ref> and the country ranked fifth globally in a 2026 report on artificial intelligence development by [[Stanford University]].<ref>{{Cite web |title=Which countries are leading in AI? {{!}} Stanford HAI |url=https://hai.stanford.edu/ai-index/global-vibrancy-tool |access-date=9 May 2026 |website=hai.stanford.edu |language=en}}</ref> The UK ranked 6th in the 2025 [[Global Innovation Index]].<ref>{{Cite web |title=GII Innovation Ecosystems & Data Explorer 2025 |url=https://www.wipo.int/gii-ranking/en/united-kingdom |access-date=16 October 2025 |website=WIPO}}</ref><ref>{{Cite book |last1=Dutta |first1=Soumitra |url=https://www.wipo.int/web-publications/global-innovation-index-2025/en/index.html |title=Global Innovation Index 2025: Innovation at a Crossroads |last2=Lanvin |first2=Bruno |publisher=[[World Intellectual Property Organization]] |year=2025 |isbn=978-92-805-3797-0 |page=19 |language=en |doi=10.34667/tind.58864 |access-date=17 October 2025}}</ref>
=== Transport ===
{{Main|Transport in the United Kingdom}}
{{further|Transport in England|Transport in Scotland|Transport in Wales|Transport in Northern Ireland}}
[[File:An LNER Azuma train on the East Coast Railway Line, geograph 6275180 by Walter Baxter.jpg|thumb|A high-speed [[East Coast Main Line]] train in [[Northumberland]], England]]
[[File:London City Airport Sunset.jpg|thumb|A plane taking off from [[London City Airport]]. [[Airports of London|London's airports]] make it the city with the [[List of busiest city airport systems by passenger traffic|busiest airport system]] in the world.]]
In the UK, all traffic [[Left- and right-hand traffic|drives on the left]], with distance and speed being measured in miles, yards and miles per hour (mph). All vehicles manufactured for use in the UK have the steering wheel situated on the right side of the vehicle. A radial road network totals {{Convert|29145|mi|km}} of main roads, {{Convert|2173|mi|km}} of motorways and {{Convert|213750|mi|km}} of paved roads.<ref name="factbook" /> The [[M25 motorway|M25]], encircling London, is the largest and busiest bypass in the world.<ref>{{Cite book |last=Moran |first=Joe |url=https://archive.org/details/readingeveryday00mora |title=Reading the Everyday |date=16 November 2005 |publisher=Routledge |isbn=978-1-134-37216-4 |page=[https://archive.org/details/readingeveryday00mora/page/n107 95] |url-access=limited}}</ref> In 2024 there were 41.7 million licensed vehicles in the UK.<ref>{{cite web |title=General facts and figures about roads and road use |url=https://www.racfoundation.org/motoring-faqs/mobility |access-date=31 May 2025 |archive-date=18 May 2025 |archive-url=https://web.archive.org/web/20250518191035/https://www.racfoundation.org/motoring-faqs/mobility}}</ref>
The UK has an extensive railway network of {{Convert|10072|mi|0|abbr=out}}. In Great Britain, the [[British Rail]] network [[privatisation of British Rail|was privatised]] between 1994 and 1997, followed by a rapid rise in passengers. [[Great British Railways]] is a planned state-owned public body that will oversee [[rail transport in Great Britain]]. The UK was ranked eighth amongst national European rail systems in the 2017 European Railway Performance Index assessing intensity of use, quality of service and safety.<ref>{{Cite web |last1=Sylvain Duranton |last2=Agnès Audier |last3=Joël Hazan |last4=Mads Peter Langhorn |last5=Vincent Gauche |date=18 April 2017 |title=The 2017 European Railway Performance Index |url=https://www.bcg.com/en-ch/publications/2017/transportation-travel-tourism-2017-european-railway-performance-index.aspx |publisher=Boston Consulting Group |access-date=4 February 2019 |archive-date=31 May 2020 |archive-url=https://web.archive.org/web/20200531104458/https://www.bcg.com/en-ch/publications/2017/transportation-travel-tourism-2017-european-railway-performance-index.aspx |url-status=live}}</ref>
A train runs directly from London to [[Paris]].<ref>{{Cite web |title=London to Paris Trains |url=https://www.eurostar.com/uk-en/train/london-to-paris |access-date=11 May 2024 |publisher=Eurostar |archive-url=https://web.archive.org/web/20240511114452/https://www.eurostar.com/uk-en/train/london-to-paris |archive-date=11 May 2024}}</ref> Called the [[Eurostar]], it travels through the [[Channel Tunnel]] under the [[English Channel]]. At 23.5 miles long, it is the world's longest undersea tunnel.<ref>{{Cite web |title=Channel Tunnel, Tunnel, Europe |url=https://www.britannica.com/topic/Channel-Tunnel |access-date=11 May 2024 |publisher=Britannica |date=10 May 2024}}</ref> There is also a car service through the tunnel to France called [[LeShuttle]]. The [[Elizabeth line]], a rail link running between [[East London|East]] and [[West London]], was named in honour of [[Queen Elizabeth II]] in 2016 and opened in 2022.<ref>{{Cite news |date=2 January 2012 |title=Crossrail's giant tunnelling machines unveiled |work=BBC News |url=https://www.bbc.co.uk/news/av/uk-16289051 |access-date=20 June 2018 |archive-date=10 April 2016 |archive-url=https://web.archive.org/web/20160410034914/http://www.bbc.co.uk/news/uk-16289051 |url-status=live}}; {{Cite news |last=Leftly |first=Mark |date=29 August 2010 |title=Crossrail delayed to save £1bn |work=Independent |location=London |url=https://www.independent.co.uk/news/business/news/crossrail-delayed-to-save-1631bn-2064629.html |access-date=22 August 2017 |archive-date=16 November 2020 |archive-url=https://web.archive.org/web/20201116062835/https://www.independent.co.uk/news/business/news/crossrail-delayed-to-save-1631bn-2064629.html |url-status=live}}</ref><ref>{{Cite web |title=Crossrail to become the Elizabeth line in honour of Her Majesty the Queen |url=https://tfl.gov.uk/info-for/media/press-releases/2016/february/crossrail-to-become-the-elizabeth-line-in-honour-of-her-majesty-the-queen |archive-url=https://web.archive.org/web/20230225110413/https://tfl.gov.uk/info-for/media/press-releases/2016/february/crossrail-to-become-the-elizabeth-line-in-honour-of-her-majesty-the-queen |archive-date=25 February 2023 |website=Transport for London}}</ref> Another major infrastructure project is [[High Speed 2]] (HS2), a high-speed railway under construction since 2019. It will link London with [[Birmingham]], with the potential to extend further north and capable of speeds of up to 225 mph.<ref>{{Cite web |title=What is HS2 |url=https://www.hs2.org.uk/what-is-hs2 |website=HS2 |access-date=22 June 2022 |archive-date=21 June 2022 |archive-url=https://web.archive.org/web/20220621190841/https://www.hs2.org.uk/what-is-hs2/ |url-status=live}}</ref><ref>{{Cite web |title=HS2 Trains |url=https://www.hs2.org.uk/building-hs2/trains/ |website=HS2 |access-date=24 February 2023 |archive-date=24 February 2023 |archive-url=https://web.archive.org/web/20230224183953/https://www.hs2.org.uk/building-hs2/trains/ |url-status=live}}</ref>
In 2023 there were 4 billion bus journeys in the UK, 1.8 billion of which were in London.<ref>{{Cite web |title=Transport Statistics Great Britain: 2023 Domestic Travel |date=19 December 2024 |url=https://www.gov.uk/government/statistics/transport-statistics-great-britain-2024/transport-statistics-great-britain-2023-domestic-travel |website=gov.uk |access-date=14 March 2025}}</ref> The red [[Double-decker bus|double-decker]] bus has entered popular culture as an internationally recognised icon of London and England.<ref>{{Cite web |title=Our Collection |url=http://www.icons.org.uk/theicons/index.html |access-date=16 August 2014 |publisher=icons.org.uk}}</ref> The [[London Buses|London bus network]] is extensive, with over 6,800 scheduled services every weekday carrying about 6 million passengers on over 700 different routes, making it one of the most extensive bus systems in the world and the largest in Europe.<ref>[http://www.tfl.gov.uk/corporate/modesoftransport/1548.aspx London Buses], Transport for London. Accessed 10 May 2007.</ref>
During 2024 [[List of airports in the United Kingdom and the British Crown Dependencies|British airports]] handled nearly 292.5 million passengers.<ref name="caastats">{{Cite web |title=Size of Reporting Airports 2024 |url=https://www.caa.co.uk/Documents/Download/11910/4d230d1f-dab6-4c1a-992a-431b9cca89a2/16918 |access-date=17 January 2025 |publisher=Civil Aviation Authority}}</ref> In that period the three largest airports were [[London Heathrow Airport]] (83.9 million passengers), [[Gatwick Airport]] (43.2 million passengers) and [[Manchester Airport]] (30.8 million passengers).<ref name="caastats" /> London Heathrow Airport, located {{Convert|15|mi|km|}} west of the capital, is the world's [[List of busiest airports by passenger traffic|second-busiest airport by international passenger traffic]] and has the most international passenger traffic of any airport in the world;<ref>{{Cite news |date=25 June 2008 |title=Heathrow 'needs a third runway' |work=BBC News |url=http://news.bbc.co.uk/1/hi/business/7472432.stm |access-date=17 October 2008}}; {{Cite press release |title=Statistics: Top 30 World airports |date=July 2008 |publisher=Airports Council International |url=http://www.aci.aero/aci/aci/file/Press%20Releases/2008/TOP30_International%20Passengers_2007.pdf |access-date=15 October 2008}}</ref> it is the hub for the UK flag carrier [[British Airways]], as well as [[Virgin Atlantic]].<ref>{{Cite news |date=29 October 2008 |title=BMI being taken over by Lufthansa |work=BBC News |url=http://news.bbc.co.uk/2/hi/7697261.stm |access-date=23 December 2009}}</ref> During 2023, 18.3 million passengers travelled internationally by rail and 18.1 million by sea.<ref>{{Cite web |title=Transport Statistics Great Britain: 2023 International Travel |date=19 December 2024 |url=https://www.gov.uk/government/statistics/transport-statistics-great-britain-2024/transport-statistics-great-britain-2023-international-travel |website=gov.uk |access-date=4 March 2025}}</ref>
=== Energy ===
{{Main|Energy in the United Kingdom}}
{{further|Energy in England|Energy in Scotland|Energy in Wales|Energy in Northern Ireland}}
In 2021 the UK was the world's [[List of countries by energy consumption and production|14th-largest consumer and 22nd-largest producer of energy]].<ref name="United Kingdom Energy Profile">{{Cite web |title=United Kingdom Energy Profile |url=https://www.eia.gov/international/overview/country/GBR |archive-url=https://web.archive.org/web/20230228165225/https://www.eia.gov/international/overview/country/GBR |archive-date=28 February 2023 |access-date=28 February 2023 |publisher=U.S. Energy Information Administration}}</ref> It is home to [[Big Six energy suppliers|many large energy companies]], including two of the six major oil and gas companies{{snd}}[[BP]] and [[Shell plc|Shell]].<ref>{{Cite news |last=Mason |first=Rowena |date=24 October 2009 |title=Let the battle begin over black gold |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/finance/newsbysector/energy/6424030/Let-the-battle-begin-over-black-gold.html |url-status=live |url-access=subscription |access-date=26 November 2010 |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/finance/newsbysector/energy/6424030/Let-the-battle-begin-over-black-gold.html |archive-date=10 January 2022}}{{Cbignore}}; {{Cite news |last=Heath |first=Michael |date=26 November 2010 |title=RBA Says Currency Containing Prices, Rate Level 'Appropriate' in Near Term |work=Bloomberg |location=New York |url=https://www.bloomberg.com/news/2010-11-25/rba-s-stevens-says-inflation-unlikely-to-fall-much-further.html |access-date=26 November 2010}}</ref>
[[File:Ardrossan's fan club. - panoramio.jpg|thumb|Wind turbines overlooking [[Ardrossan]] in Scotland. The UK is [[Wind power in the United Kingdom|a major producer of wind energy]] in Europe.<ref>{{Cite web |date=13 September 2023 |title='Success story': Which European countries are leading the way on wind? |url=https://www.euronews.com/green/2023/09/13/winds-of-change-which-european-countries-are-generating-the-most-energy-from-wind |access-date=15 August 2025 |website=[[Euronews]] |language=en}}</ref>]]
Renewable electricity sources provided 51 per cent of the electricity generated in the UK in 2024. [[Wind power in the United Kingdom|Wind power]] was the largest source of electricity in 2024, generating 30 per cent of the UK's total electricity.<ref name="2024 Energy">{{Cite report |title=Britain's Electricity Explained: 2024 Review |url=https://www.neso.energy/news/britains-electricity-explained-2024-review |archive-url=https://web.archive.org/web/20250126085830/https://www.neso.energy/news/britains-electricity-explained-2024-review |archive-date=26 January 2025 |access-date=26 January 2025 |publisher=NESO}}</ref> The UK has the largest offshore wind farm in the world, which is located off the coast of [[Yorkshire]].<ref>{{Cite report |date=14 June 2021 |title=Wind energy in the UK: June 2021 |work=UK Government |url=https://www.ons.gov.uk/economy/environmentalaccounts/articles/windenergyintheuk/june2021 |access-date=8 May 2023}}</ref>
In 2023 the UK had nine nuclear reactors generating about 15 per cent of the UK's electricity.<ref name="coal-ref">{{Cite web |title=Nuclear Power in the United Kingdom |url=https://world-nuclear.org/information-library/country-profiles/countries-t-z/united-kingdom.aspx |archive-url=https://web.archive.org/web/20230228175735/https://world-nuclear.org/information-library/country-profiles/countries-t-z/united-kingdom.aspx |archive-date=28 February 2023 |access-date=28 February 2023 |publisher=World Nuclear Association}}</ref> There are two reactors under construction and more planned.<ref>{{Cite web |date=April 2013 |title=Nuclear Power in the United Kingdom |url=http://www.world-nuclear.org/info/inf84.html |archive-url=https://web.archive.org/web/20130214061431/http://www.world-nuclear.org/info/inf84.html |archive-date=14 February 2013 |access-date=9 April 2013 |publisher=World Nuclear Association}}</ref><ref>{{Cite news |title=Nuclear energy: What you need to know |url=https://www.gov.uk/government/news/nuclear-energy-what-you-need-to-know |archive-url=https://web.archive.org/web/20230228181113/https://www.gov.uk/government/news/nuclear-energy-what-you-need-to-know |archive-date=28 February 2023 |access-date=28 February 2023 |publisher=UK Government}}</ref> In the late 1990s [[Nuclear power plants in the United Kingdom|nuclear power plants]] contributed around 25 per cent of the total annual electricity generation in the UK, but this has gradually declined as old plants have been shut down. The UK government is investing in [[small modular reactors]] that operate via [[nuclear fission]], as well as in research and development towards commercial [[fusion reactors]]. To that end the government entered into a partnership with the US in late 2023 to collaborate on fusion technology, with "a commercial grid-ready fusion reactor by 2040" stated as a goal.<ref>{{Cite news |title=UKAEA implementing the UK's fusion energy strategy |work=Open Access Government |date=7 March 2024 |url=https://www.openaccessgovernment.org/ukaea-implementing-the-uks-fusion-energy-strategy/174384/ |access-date=27 May 2024 |last1=Belderbos |first1=Harriet}};{{Cite magazine |title=UK nuclear fusion reactor sets new world record for energy output |url=https://www.newscientist.com/article/2415909-uk-nuclear-fusion-reactor-sets-new-world-record-for-energy-output/ |magazine=New Scientist |access-date=27 May 2024}}</ref>
At the end of 2023 it was estimated that there were 1.1 billion [[barrels of oil equivalent]] of "proven" and "probable" [[Oil and gas reserves and resource quantification|gas reserves]] and 2.3 billion boe of "proven" and "probable" [[North Sea oil|oil reserves]] offshore, reducing reliance on imports for energy security and transitioning to renewables.<ref>{{Cite report |title=UK Oil and Gas Reserves and Resources |url=https://www.nstauthority.co.uk/media/vtjkyqnf/uk-reserves-and-resources-report-as-at-end-2023.pdf |archive-url=https://web.archive.org/web/20250113172052/https://www.nstauthority.co.uk/media/vtjkyqnf/uk-reserves-and-resources-report-as-at-end-2023.pdf |archive-date=13 January 2025 |access-date=1 February 2025 |publisher=North Sea Transition Authority}}</ref> Emissions from UK gas production are roughly four times lower than imported [[liquefied natural gas]] (LNG), according to the [[North Sea Transition Authority|UK's oil and gas regulator]].<ref>{{Cite news |title=North Sea oil and gas claims fact-checked |work=BBC |date=22 January 2024 |url=https://www.bbc.co.uk/news/science-environment-67945281 |archive-url=https://web.archive.org/web/20250201182137/https://www.bbc.com/news/science-environment-67945281 |archive-date=1 February 2025 |access-date=1 February 2025}}</ref>
In September 2024 the last coal power station was closed, making [[coal]] no longer a power source in the UK.<ref name="2024 Energy" /> The UK currently has no [[fracking]] (hydraulic fracturing) for [[shale gas]] despite a large supply, due to environmental concerns.<ref>{{Cite news |title=UK's last fracking wells to be filled with cement despite dwindling gas stocks |date=29 January 2025 |url=https://www.cityam.com/uks-last-fracking-wells-to-be-filled-with-cement-despite-dwindling-gas-stocks/ |archive-url=https://web.archive.org/web/20250201182917/https://www.cityam.com/uks-last-fracking-wells-to-be-filled-with-cement-despite-dwindling-gas-stocks/ |archive-date=1 February 2025 |access-date=1 February 2025 |work=City AM}}</ref>
=== Water supply and sanitation ===
{{Main|Water supply and sanitation in the United Kingdom}}
Access to improved water supply and sanitation in the UK is universal. It was estimated that 96 per cent of households were connected to the sewer network in 2022.<ref>{{Cite web |url=https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/69582/pb6655-uk-sewage-treatment-020424.pdf |title=Sewage Treatment in the UK |publisher=DEFRA |website=assets.publishing.service.gov.uk |date=March 2022 |page=3 |id=PB 6655 |access-date=8 April 2023}}</ref> According to the [[Environment Agency]], total water abstraction for public water supply in the UK was 16,406 [[megalitre]]s per day in 2007.<ref>{{Cite web |title=Environment Agency |url=http://www.environment-agency.gov.uk/research/library/data/112185.aspx |archive-url=https://web.archive.org/web/20091125040346/http://www.environment-agency.gov.uk/research/library/data/112185.aspx |archive-date=25 November 2009}}</ref>
In England and Wales, water and sewerage services are provided by 10 private regional water and sewerage companies and 13 mostly smaller private "water only" companies. In Scotland, said services are provided by a single public company, [[Scottish Water]]. In Northern Ireland, they are also provided by a single public entity, [[Northern Ireland Water]].<ref>{{Cite web |title=About Us |url=https://www.niwater.com/about |access-date=29 August 2020 |publisher=niwater.com}}</ref>
== Demographics ==
{{Main|Demographics of the United Kingdom|British people}}
{{Further|Ceremonial counties of England|Subdivisions of Scotland|Subdivisions of Wales|Counties of Northern Ireland}}
[[File:Elderly British Couple.jpg|thumb|261x261px|An elderly British Couple. Approximately 24% of people in England and Wales are aged 60 years and over.<ref>{{Cite web |date=31 March 2023 |title=Age groups |url=https://www.ethnicity-facts-figures.service.gov.uk/uk-population-by-ethnicity/demographics/age-groups/latest/#main-facts-and-figures |access-date=16 August 2026 |website=www.ethnicity-facts-figures.service.gov.uk |language=en}}</ref>]]
Whereas the censuses of England and Wales and of Northern Ireland went ahead as planned in 2021, the census in Scotland was delayed until 2022 due to the COVID-19 pandemic. The Office for National Statistics has estimated that the total population of the United Kingdom recorded in the census would have been 66,912,637 had it been conducted in all parts of the UK on 21 March 2021.<ref name=Ethnicity2021/> The UK population is the [[List of European countries by population|fourth-largest]] in Europe and the [[List of countries by population|22nd-largest]] in the world. In 2012 and 2013 births contributed the most to population growth, while in 2014 and 2015 net international migration contributed more.<ref name="pop2015">{{Cite web |date=23 June 2016 |title=Population Estimates for UK, England and Wales, Scotland and Northern Ireland, Mid-2015 |url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/bulletins/annualmidyearpopulationestimates/latest |publisher=Office for National Statistics}}</ref> Between 2001 and 2011 the population increased at an average annual rate of 0.7 per cent.<ref name="2011census">{{Cite web |date=21 December 2022 |title=Population estimates for the UK, England, Wales, Scotland and Northern Ireland: mid-2021 |url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/bulletins/annualmidyearpopulationestimates/mid2021 |access-date=16 April 2025 |publisher=Office for National Statistics}}</ref> The [[2011 United Kingdom census|2011 census]] also showed that, over the previous 100 years, the proportion of the population aged 0–14 fell from 31 to 18 per cent, and the proportion of people aged 65 and over rose from 5 to 16 per cent.<ref name="2011census" /> In 2018 the [[median age]] of the UK population was 41.7 years.<ref name="factbook" /> The 2021 census put Scotland's population at 5.48 million, Wales's at 3.1 million and Northern Ireland's at 1.9 million.<ref name="2011census" />
<!-- Self-maintaining population table -->
{{UK population table}}
England's population in 2021 was 56 million, representing some 84 per cent of the UK total.<ref name="2011census" /> England is one of the [[List of countries and dependencies by population density|most-densely-populated countries]] in the world, with 434 people per square kilometre in mid-2021,<ref name="2011census" /> with a particular concentration in London, the capital,<ref>{{Cite news |date=10 May 2012 |title=United Kingdom country profile |url=https://www.bbc.co.uk/news/world-europe-18023389 |access-date=24 July 2026 |work=BBC News |language=en-GB}}</ref><ref>{{Cite web |title=United Kingdom - Country Profile {{!}} OpenFactBook World Factbook |url=https://openfactbook.org/countries/united-kingdom/ |access-date=24 July 2026 |website=openfactbook.org |language=en}}</ref> and the south-east.<ref>{{Cite news |last=Khan |first=Urmee |date=16 September 2008 |title=England is most crowded country in Europe |url=https://www.telegraph.co.uk/news/newstopics/politics/2967374/England-is-most-crowded-country-in-Europe.html |archive-url=https://web.archive.org/web/20080918221002/http://www.telegraph.co.uk/news/newstopics/politics/2967374/England-is-most-crowded-country-in-Europe.html |archive-date=18 September 2008 |access-date=5 September 2009 |work=The Telegraph |location=London}}</ref> [[London metropolitan area|London's wider metropolitan area]] is the largest in [[Western Europe]], with a population of 14.9 million in 2024.<ref>{{Cite web |title=Major Agglomerations |url=http://citypopulation.de/en/world/agglomerations |url-status=live |archive-url=https://web.archive.org/web/20231004094531/https://www.citypopulation.de/en/world/agglomerations/ |archive-date=4 October 2023 |access-date=16 October 2023}}</ref>
{| class="wikitable sortable" style="text-align:right;"
|+ Population of England by region ({{UK subdivision statistics year}})<ref name="ONS mid-year pop est" />
|-
! Rowspan=2 | Region
! Colspan=2 | Land area
! Colspan=2 | Population
! Rowspan=2 | Density<br />(/km<sup>2</sup>)
|-
! (km<sup>2</sup>)
! (%)
! People
! (%)
|-
| style="text-align:left;" | [[North East England|North East]]
| 8,581
| 6%
| 2,683,040
| 5%
| 313
|-
| style="text-align:left;" | [[North West England|North West]]
| 14,108
| 11%
| 7,516,113
| 13%
| 533
|-
| style="text-align:left;" | [[Yorkshire and the Humber]]
| 15,404
| 12%
| 5,541,262
| 10%
| 360
|-
| style="text-align:left;" | [[East Midlands]]
| 15,624
| 12%
| 4,934,939
| 9%
| 316
|-
| style="text-align:left;" | [[West Midlands (region)|West Midlands]]
| 12,998
| 10%
| 6,021,653
| 11%
| 463
|-
| style="text-align:left;" | [[East of England]]
| 19,116
| 15%
| 6,398,497
| 11%
| 335
|-
| style="text-align:left;" | [[Greater London]]
| 1,572
| 1%
| 8,866,180
| 15%
| 5,640
|-
| style="text-align:left;" | [[South East England|South East]]
| 19,072
| 15%
| 9,379,833
| 16%
| 492
|-
| style="text-align:left;" | [[South West England|South West]]
| 23,836
| 18%
| 5,764,881
| 10%
| 242
|-
! style="text-align:left;" | England
! style="text-align:right;" | 130,310
! style="text-align:right;" | 100%
! style="text-align:right;" | 57,106,398
! style="text-align:right;" | 100%
! style="text-align:right;" | 438
|}
In 2021 the [[total fertility rate]] across the UK was 1.53 children born per woman,<ref>{{Cite web |title=Vital statistics: population and health reference tables |url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/vitalstatisticspopulationandhealthreferencetables |access-date=6 March 2018 |website=Office for National Statistics}}</ref> which remains considerably below the [[Mid-20th century baby boom|baby boom]] peak of 2.95 children per woman in 1964,<ref>{{Cite news |last=Boseley |first=Sarah |date=14 July 2008 |title=The question: What's behind the baby boom? |url=https://www.theguardian.com/lifeandstyle/2008/jul/14/familyandrelationships.women |access-date=28 August 2009 |work=The Guardian |location=London |page=3}}</ref> or the high of 6.02 children born per woman in 1815<ref>{{Citation |last=Roser |first=Max |title=Total Fertility Rate around the world over the last centuries |date=2014 |work=[[Our World in Data]], [[Gapminder Foundation]] |url=https://ourworldindata.org/grapher/children-born-per-woman?year=1800&country=GBR |access-date=10 December 2019 |archive-url=https://web.archive.org/web/20190705121623/https://ourworldindata.org/grapher/children-born-per-woman?year=1800&country=GBR |archive-date=5 July 2019}}</ref> and below the replacement rate of 2.1. In 2011, 47.3 per cent of births in the UK were to unmarried women.<ref>[http://epp.eurostat.ec.europa.eu/tgm/table.do?tab=table&plugin=0&language=en&pcode=tps00018 Tables, Graphs and Maps Interface (TGM) table]. Eurostat (26 February 2013). Retrieved 12 July 2013.</ref> The [[Office for National Statistics]] reported in 2015 that amongst the UK population aged 16 and over, 1.7 per cent identify as gay, lesbian, or bisexual (2.0 per cent of males and 1.5 per cent of females); 4.5 per cent of respondents responded with "other", "I don't know", or did not respond.<ref>{{Cite web |date=5 October 2016 |title=Sexual identity, UK: 2015 – Experimental Official Statistics on sexual identity in the UK in 2015 by region, sex, age, marital status, ethnicity and NS-SEC |url=https://www.ons.gov.uk/peoplepopulationandcommunity/culturalidentity/sexuality/bulletins/sexualidentityuk/2015 |access-date=19 January 2017 |publisher=[[Office for National Statistics]]}}</ref> The number of [[transgender]] people in the UK was estimated to be between 65,000 and 300,000 by research between 2001 and 2008.<ref>{{Cite web |title=Research report 27: Trans research review |url=http://www.equalityhumanrights.com/about-us/our-work/key-projects/trans-inequalities-reviewed/introduction-to-the-review |url-status=dead |archive-url=https://web.archive.org/web/20150706020643/http://www.equalityhumanrights.com/about-us/our-work/key-projects/trans-inequalities-reviewed/introduction-to-the-review |archive-date=6 July 2015 |access-date=26 November 2021 |website=equalityhumanrights.com |page=v}}</ref>
{{Largest Urban Areas of the United Kingdom}}
=== Ethnicity ===
{{Main|Ethnic groups in the United Kingdom}}
Historically, indigenous British people were thought to be [[Genetic history of the British Isles|descended from ethnic groups]] that settled there before the 12th century: the [[Celts]], Romans, Anglo-Saxons, Norse and the [[Normans]]. [[Welsh people]] could be the oldest ethnic group in the UK.<ref>{{Cite news |date=19 June 2012 |title=Welsh people could be most ancient in UK, DNA suggests |url=https://www.bbc.co.uk/news/uk-wales-18489735 |access-date=28 April 2013 |work=BBC News}}</ref> The UK has a history of non-white immigration with [[Liverpool]] having the oldest black population in the country dating from at least the 1730s,<ref>{{Cite book |last=Winder |first=Robert |url=https://books.google.com/books?id=7ORcaQIgdcEC&q=combed&pg=PT94 |title=Bloody Foreigners: The Story of Immigration to Britain |date=2010 |publisher=Little, Brown Book |isbn=978-0-7481-2396-4}}; {{Cite book |last=Costello |first=Ray |title=Black Liverpool: The Early History of Britain's Oldest Black Community 1730–1918 |date=2001 |publisher=Picton Press |isbn=978-1-873245-07-1 |location=Liverpool}}</ref> in addition to having the oldest [[British Chinese|Chinese]] community in Europe dating from the 19th century.<ref>{{Cite web |title=Culture and Ethnicity Differences in Liverpool – Chinese Community |url=http://www.mersey-gateway.org/server.php?show=ConWebDoc.1369 |archive-url=https://web.archive.org/web/20090724204513/http://www.mersey-gateway.org/server.php?show=ConWebDoc.1369 |archive-date=24 July 2009 |access-date=9 March 2015 |publisher=Chambré Hardman Trust}}</ref>
In 2021, 83.1 per cent of the UK population was classified as white, 8.6 per cent as Asian or Asian British, 3.7 per cent as Black or Black British, 2.7 per cent as mixed ethnicity, and 2.0 per cent other.<ref name=Ethnicity2021/> Ethnic diversity varies significantly across the UK. In 2021, 46.2 per cent of London's population was from a non-white ethnic minority,<ref name=Regionaldiversity>{{cite news|url=https://www.ethnicity-facts-figures.service.gov.uk/uk-population-by-ethnicity/national-and-regional-populations/regional-ethnic-diversity/latest/|title=Regional ethnic diversity|publisher=Office for National Statistics|date=22 December 2022|access-date=28 March 2026}}</ref> compared less than 10 per cent in the South West and North East of England, Wales,<ref name=Regionaldiversity/> Scotland<ref>{{cite news|url=https://www.scotlandscensus.gov.uk/census-results/at-a-glance/ethnicity/|title=Ethnicity|publisher=National Records of Scotland|date=4 February 2025|access-date=28 March 2026}}</ref> and Northern Ireland.<ref>{{cite web|url=https://www.nisra.gov.uk/system/files/statistics/census-2021-ms-b01.xlsx|title=MS-B01: Ethnic group|publisher=Northern Ireland Statistics and Research Agency|date=30 November 2023|access-date=28 March 2026}}</ref>
=== Language ===
{{Main|Languages of the United Kingdom}}
The [[English language]] is the ''[[de facto]]'' official and most widely spoken language in the United Kingdom.<ref>{{Cite web |title=English language – Government, citizens and rights |url=http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_10012519 |archive-url=http://webarchive.nationalarchives.gov.uk/20121015000000/http://www.direct.gov.uk/en/Governmentcitizensandrights/LivingintheUK/DG_10012519 |archive-date=15 October 2012 |access-date=23 August 2011 |website=[[Directgov]]}}</ref><ref>{{Cite journal |last=Mac Sithigh |first=Daithí |date=17 May 2018 |title=Official status of languages in the UK and Ireland |url=https://pureadmin.qub.ac.uk/ws/portalfiles/portal/141540053/Status_OA_Feb_2018.pdf |journal=Common Law World Review |publisher=Queen's University, Belfast |volume=47 |issue=1 |pages=77–102 |doi=10.1177/1473779518773642 |s2cid=219987922}}</ref> The UK promotes the language globally to build connections, understanding and trust between people in the UK and countries worldwide.<ref>British Council {{Cite web |title=British Council | the UK's international culture and education organisation |url=https://www.britishcouncil.org/ |url-status=live |archive-url=https://web.archive.org/web/20230201181104/https://www.britishcouncil.org/ |archive-date=1 February 2023 |access-date=5 December 2018}} (last checked 6 February 2023)</ref><ref>{{Cite web |title=About BBC Learning English |url=https://www.bbc.com/learningenglish/english/hygiene |url-status=live |archive-url=https://web.archive.org/web/20230204204233/https://www.bbc.com/learningenglish/english/hygiene |archive-date=4 February 2023 |access-date=9 February 2023 |website=BBC}}</ref>
In the UK, the English language is spoken with distinctive characteristics that collectively form what is known as [[British English]]. The variety of dialects and accents is often noted, with nearby regions frequently having highly distinct variations. [[Received Pronunciation]] is traditionally associated with educated speakers in southern England.<ref>{{Cite web |title=British English Pronunciations |url=https://www.oed.com/information/understanding-entries/pronunciation/british-english-pronunciations/?tl=true |archive-url=https://web.archive.org/web/20250605075115/https://www.oed.com/information/understanding-entries/pronunciation/british-english-pronunciations/?tl=true |archive-date=5 June 2025 |access-date=5 June 2025 |website=OED}}</ref> The main national dialects are [[Scottish English]], [[Welsh English]] and [[Northern Irish English]]. Distinctive regional varieties include
[[Brummie dialect|Brummie]], [[Cockney]], [[Geordie]], [[Manchester dialect|Mancunian]], [[Scouse]], [[West Country English|West Country]], [[Yorkshire dialect|Yorkshire]] and [[Multicultural London English|MLE]] (Multicultural London English).<ref>{{Cite web |title=10 British dialects you need to know |url=https://www.ef.com/wwen/blog/language/british-dialects-you-need-to-know/ |website=EF |access-date=5 June 2025}}</ref>
[[File:Bilingual welcome sign Newry.jpg|thumb|[[Bilingual sign]] ([[Irish language|Irish]] and [[English language|English]]) in [[Newry]], Northern Ireland]]Three indigenous [[Celtic languages]] are spoken in the UK: [[Welsh language|Welsh]], [[Irish language|Irish]] and [[Scottish Gaelic]]. [[Cornish language|Cornish]], which became extinct as a first language in the late-18th century, is being revived and has a small group of second-language speakers.<ref>{{Cite book |last1=Track |first1=Robert Lawrence |url=https://books.google.com/books?id=oLx9AgAAQBAJ&q=%E2%80%9Cthese+people+speak+the+dead+language+as+a+second+language%E2%80%9D&pg=PA63 |title=Language and Linguistics: The Key Concepts |last2=Stockwell, Peter |date=2007 |isbn=978-0-415-41358-9 |page=63 |publisher=Routledge |access-date=4 August 2019}}; {{Cite web |title=Framework Convention for the Protection of National Minorities, Strasbourg, 1.II.1995 |url=http://conventions.coe.int/Treaty/en/Treaties/Html/157.htm |access-date=9 March 2015 |publisher=Council of Europe |archive-date=22 February 2005 |archive-url=https://web.archive.org/web/20050222193410/http://conventions.coe.int/Treaty/EN/treaties/Html/157.htm |url-status=dead}}; {{Cite web |title=European Charter for Regional or Minority Languages, Strasbourg, 5.XI.1992 |url=http://conventions.coe.int/treaty/en/Treaties/Html/148.htm |access-date=9 March 2015 |publisher=Council of Europe |archive-date=26 February 2011 |archive-url=https://web.archive.org/web/20110226052008/http://conventions.coe.int/Treaty/EN/Treaties/HTML/148.htm |url-status=dead}}</ref><ref name="reglang" /> In the [[2021 United Kingdom census|2021 census]] the [[Welsh-speaking population]] of Wales aged three or older was 538,300 (17.8 per cent).<ref>{{Cite web |date=6 December 2022 |title=Welsh language in Wales (Census 2021) |url=https://gov.wales/welsh-language-wales-census-2021-html |access-date=6 December 2022 |website=gov.wales}}</ref> In addition it is estimated that about 200,000 Welsh-speakers live in England.<ref>{{Cite web |last=Wynn Thomas |first=Peter |date=March 2007 |title=Welsh today |url=https://www.bbc.co.uk/voices/multilingual/welsh.shtml |access-date=5 July 2011 |website=Voices |publisher=BBC}}</ref> In the 2021 census in Northern Ireland 12.4 per cent of people had some [[Irish language in Northern Ireland|Irish language]] ability and 10.4 per cent had some facility in the [[Ulster Scots dialect|Ulster-Scots]] language.<ref>{{Cite web |title=Census 2021: Main statistics for Northern Ireland |url=https://www.nisra.gov.uk/system/files/statistics/census-2021-main-statistics-for-northern-ireland-phase-1-statistical-bulletin-language.pdf |archive-url=https://web.archive.org/web/20240210110853/https://www.nisra.gov.uk/system/files/statistics/census-2021-main-statistics-for-northern-ireland-phase-1-statistical-bulletin-language.pdf |archive-date=10 February 2024 |access-date=10 February 2024}}</ref>
In 2001, over 92,000 people in Scotland, just under 2 per cent of the population, had some Gaelic language ability, including 72 per cent of those living in the [[Outer Hebrides]].<ref>{{Cite web |title=Scotland's Census 2001 – Gaelic Report |url=http://www.gro-scotland.gov.uk/press/news2005/scotlands-census-2001-gaelic-report.html |archive-url=https://web.archive.org/web/20130522110328/http://www.gro-scotland.gov.uk/press/news2005/scotlands-census-2001-gaelic-report.html |archive-date=22 May 2013 |access-date=28 April 2013 |publisher=General Register Office for Scotland}}</ref> The number of children being taught either Welsh or Scottish Gaelic is increasing.<ref>{{Cite news |date=12 February 2009 |title=Local UK languages 'taking off' |url=http://news.bbc.co.uk/1/hi/education/7885493.stm |work=BBC News}}</ref> [[Scots language|Scots]], a language descended from early northern [[Middle English]], has limited [[European Charter for Regional or Minority Languages|recognition]] alongside its regional variant, [[Ulster Scots dialects|Ulster Scots]] in Northern Ireland, without specific commitments to protection and promotion.<ref name="reglang" /><ref>{{Cite web |title=Language Data – Scots |url=http://www.eurolang.net/index.php?option=com_content&task=view&id=2449&Itemid=52&lang=en |archive-url=https://web.archive.org/web/20070623185445/http://eurolang.net/index.php?option=com_content&task=view&id=2449&Itemid=52&lang=en |archive-date=23 June 2007 |access-date=2 November 2008 |publisher=European Bureau for Lesser-Used Languages}}</ref> As of April 2020 there are around 151,000 users of [[British Sign Language]] (BSL), a [[sign language]] used by deaf people, in the UK.<ref>{{Cite news |last=Brown |first=Hannah |date=23 April 2020 |title='People are dying because of this': Calls for UK Gov to follow Scotland with sign language interpreter at Covid-19 briefing |url=https://www.scotsman.com/news/politics/people-are-dying-because-calls-uk-gov-follow-scotland-sign-language-interpreter-covid-19-briefing-2547989 |access-date=19 December 2021 |work=The Scotsman}}</ref>
In 2013, it was estimated that 95 per cent of the UK's population were [[monolingual]] English speakers.<ref name="BBC languages">{{Cite web |title=Languages across Europe: United Kingdom |url=https://www.bbc.co.uk/languages/european_languages/countries/uk.shtml |access-date=4 February 2013 |website=BBC}}</ref> In 2013, over 5 per cent of the population were estimated to speak languages brought to the UK as a result of immigration.<ref name="BBC languages" /> [[South Asian languages]] are the largest group, which includes [[Punjabi language|Punjabi]], [[Urdu]], [[Bengali language|Bengali]], [[Sylheti language|Sylheti]], [[Hindi]], [[Pahari-Pothwari]], [[Tamil language|Tamil]] and [[Gujarati language|Gujarati]].<ref>Carl Skutsch (2013). ''Encyclopedia of the World's Minorities''. pp.1261. Routledge. Retrieved 3 December 2020.</ref> In the 2011 census [[Polish language|Polish]] was the second-largest language spoken in England, with 546,000 speakers.<ref>{{Cite news |last=Booth |first=Robert |date=30 January 2013 |title=Polish becomes England's second language |url=https://www.theguardian.com/uk/2013/jan/30/polish-becomes-englands-second-language |access-date=4 February 2012 |work=The Guardian |location=London}}</ref> In 2019 some three-quarters of a million people spoke little or no English.<ref>{{Cite news |date=23 April 2019 |title=The teenagers who translate for their parents |url=https://www.bbc.co.uk/news/av/uk-47982494 |access-date=23 April 2019 |work=BBC News}}</ref>
=== Religion ===
{{Main|Religion in the United Kingdom|Freedom of religion in the United Kingdom}}
[[File:Westminster_Abbey_St_Peter.jpg|thumb|The [[Westminster Abbey]] in [[London]]. This was the [[Coronation of the British monarch|coronation]] site of 40 monarchs, 18 royal burials, and at least 16 royal weddings since 1100.]]
[[Christianity]] has dominated religious life in the United Kingdom for [[History of Christianity in Britain|more than 1,400 years]].<ref>Cannon, John, ed. (2nd edn., 2009). [https://books.google.com/books?id=TYnfhTq2M7EC&pg=PA144 ''A Dictionary of British History'']. Oxford University Press. p. 144. {{ISBN|978-0-19-955037-1}}.</ref> Although a majority of citizens still identify with Christianity in surveys, regular church attendance has fallen dramatically since the middle of the 20th century,<ref>Field, Clive D. (November 2009). [http://www.brin.ac.uk/wp-content/uploads/2011/12/development-of-religious-statistics.pdf "British religion in numbers"]. BRIN Discussion Series on Religious Statistics, Discussion Paper 001. Retrieved 7 March 2015.</ref> while immigration and demographic change have contributed to the growth of Islam and other faiths.<ref>Yilmaz, Ihsan (2005). [https://books.google.com/books?id=ryrD2YODzxUC&pg=PA291 ''Muslim Laws, Politics and Society in Modern Nation States: Dynamic Legal Pluralisms in England, Turkey, and Pakistan'']. Aldershot: Ashgate Publishing. pp. 55–56. {{ISBN|978-0-7546-4389-0}}.</ref> This has led some commentators to describe the UK as a multi-faith,<ref>Brown, Callum G. (2006). [https://books.google.com/books?id=ryrD2YODzxUC&pg=PA291 ''Religion and Society in Twentieth-Century Britain'']. Harlow: Pearson Education. p. 291. {{ISBN|978-0-582-47289-1}}.</ref> [[secularised]],<ref>Norris, Pippa; Inglehart, Ronald (2004). [https://books.google.com/books?id=dto-P2YfWJIC&pg=PA84 ''Sacred and Secular: Religion and Politics Worldwide'']. Cambridge University Press. p. 84. {{ISBN|978-0-521-83984-6}}.</ref> or [[post-Christian]] society.<ref>Fergusson, David (2004). [https://books.google.com/books?id=Owz4aBSEINgC&pg=PA94 ''Church, State and Civil Society'']. Cambridge University Press. p. 94. {{ISBN|978-0-521-52959-4}}.</ref>
In the 2021 census of England and Wales, 46.2 per cent of respondents reported that they were Christians, with the next largest faiths being [[Islam in the United Kingdom|Islam]] (6.5 per cent), [[Hinduism in the United Kingdom|Hinduism]] (1.7 per cent), [[Sikhism in the United Kingdom|Sikhism]] (0.9 per cent), [[Buddhism in the United Kingdom|Buddhism]] (0.5 per cent), [[Judaism in the United Kingdom|Judaism]] (0.5 per cent), and all other religions (0.6 per cent). Of the respondents, 37.2 per cent stated that they had [[Irreligion in the United Kingdom|no religion]] and a further 6.0 per cent did not answer the optional question.<ref>{{cite news|url=https://www.ons.gov.uk/peoplepopulationandcommunity/culturalidentity/religion/bulletins/religionenglandandwales/census2021|title=Religion, England and Wales: Census 2021|publisher=Office for National Statistics|first=Michael|last=Roskams|date=29 November 2022|access-date=28 March 2026}}</ref> In the census of Northern Ireland, 42.3 per cent of the population was recorded as Catholic, 37.7% as Protestant or other Christian, 1.3 per cent as belonging to other religions, 17.4 per cent as having no religion and 1.6 per cent did not state a religion.<ref>{{cite web|url=https://www.nisra.gov.uk/system/files/statistics/census-2021-ms-b19.xlsx|title=MS-B19: Religion|publisher=Northern Ireland Statistics and Research Agency|date=30 November 2023}}</ref> In Scotland's 2022 census, 51.1 per cent of the population stated that they had no religion, 20.4 per cent were recorded as Church of Scotland, 13.3 per cent as Catholic, 5.1 per cent as other Christian, 2.2 per cent as Muslim and 0.6 per cent as Hindu, with 1.2 per cent belonging to other religions and 6.2 per cent not stating a religion.<ref>{{cite web|url=https://www.scotlandscensus.gov.uk/2022-reports/scotland-s-census-2022-ethnic-group-national-identity-language-and-religion/|title=Scotland's Census 2022 - Ethnic group, national identity, language and religion|publisher=National Records of Scotland|date=21 May 2024|access-date=28 March 2026}}</ref>
A [[Tearfund]] survey in 2007 showed that one Briton in ten attends church weekly.<ref>{{Cite web |date=4 April 2007 |title=United Kingdom: New Report Finds Only One in 10 Attend Church |url=http://news.adventist.org/2007/04/uite-kigom-ew-report-fis-oly-oe-i-10-atte-church.html |archive-url=https://web.archive.org/web/20111213155625/http://news.adventist.org/2007/04/uite-kigom-ew-report-fis-oly-oe-i-10-atte-church.html |archive-date=13 December 2011 |access-date=9 March 2015 |website=News.adventist.org}}</ref> Between the 2001 and 2011 censuses there was a 12 per cent decrease in those who identified as Christian, while the percentage reporting no religious affiliation doubled. This contrasted with growth in the other main religious group categories, with the number of [[Muslims]] increasing the most to about 5 per cent.<ref>{{Cite news |last=Philby |first=Charlotte |date=12 December 2012 |title=Less religious and more ethnically diverse: Census reveals a picture of Britain today |url=https://www.independent.co.uk/news/uk/home-news/less-religious-and-more-ethnically-diverse-census-reveals-a-picture-of-britain-today-8406506.html |work=[[The Independent|Independent]] |location=London}}</ref>
The [[Church of England]] is the [[State religion|established church]] in England.<ref>{{Cite web |date=2004 |title=The History of the Church of England |url=http://www.cofe.anglican.org/about/history/ |url-status=dead |archive-url=https://web.archive.org/web/20100221212004/http://www.cofe.anglican.org/about/history |archive-date=21 February 2010 |access-date=23 November 2008 |website=The Church of England}}</ref> It retains [[Lords Spiritual|representation]] in the UK Parliament, and the British monarch is its [[Supreme Governor of the Church of England|Supreme Governor]].<ref>{{Cite web |title=Queen and Church of England |url=http://www.royalinsight.gov.uk/output/Page4708.asp |archive-url=https://web.archive.org/web/20061008203611/http://www.royalinsight.gov.uk/output/Page4708.asp |archive-date=8 October 2006 |access-date=5 June 2010 |publisher=British Monarchy Media Centre}}</ref> In [[religion in Scotland|Scotland]] the [[Church of Scotland]] is the [[national church]]. It is not subject to state control, and the British monarch is an ordinary member, required to swear an oath to "maintain and preserve the Protestant Religion and [[Presbyterian polity|Presbyterian Church Government]]" upon his or her accession.<ref>{{Cite web |title=Queen and the Church |url=http://www.royal.gov.uk/MonarchUK/QueenandChurch/History.aspx |url-status=live |archive-url=https://web.archive.org/web/20110605025533/http://www.royal.gov.uk/MonarchUK/QueenandChurch/History.aspx |archive-date=5 June 2011 |publisher=The British Monarchy (Official Website)}}</ref><ref name="reglang" /><ref>{{Cite web |date=22 February 2010 |title=Our structure |url=https://www.churchofscotland.org.uk/about-us/our-structure |url-status=live |archive-url=https://web.archive.org/web/20200125192732/https://www.churchofscotland.org.uk/about-us/our-structure |archive-date=25 January 2020 |website=churchofscotland.org.uk}}</ref> The [[Church in Wales]] was disestablished in 1920 and, because the [[Church of Ireland]] was disestablished in 1870 before the [[partition of Ireland]], there is no established church in Northern Ireland.<ref>Weller, Paul (2005). [https://books.google.com/books?id=tHc88PzAPLMC&pg=PA80 ''Time for a Change: Reconfiguring Religion, State, and Society'']. London: Continuum. pp. 79–80. {{ISBN|978-0-567-08487-3}}.</ref> Although there are no UK-wide data in the 2001 census on adherence to individual Christian denominations, it has been estimated that 62 per cent of Christians are Anglican, 13.5 per cent Catholic, 6 per cent Presbyterian, and 3.4 per cent Methodist, with smaller numbers of other denominations.<ref>Peach, Ceri, [https://books.google.com/books?id=i6ER_z8gcD4C "United Kingdom, a major transformation of the religious landscape"], in H. Knippenberg. ed. (2005). ''The Changing Religious Landscape of Europe''. Amsterdam: Het Spinhuis. pp. 44–58. {{ISBN|978-90-5589-248-8}}.</ref>
=== Migration ===
{{Main|Historical immigration to Great Britain|Modern immigration to the United Kingdom}}
{{See also|Foreign-born population of the United Kingdom}}
[[File:United Kingdom foreign born population by country of birth.png|thumb|upright=1.35|Estimated foreign-born population by country of birth from April 2007 to March 2008]]
[[File:British expats countrymap.svg|thumb|upright=1.35|Estimated number of British citizens living overseas by country in 2006:
{{legend|#002255|Greater than or equal to 1,000,000}}
{{legend|#003380|500,000 - 999,999}}
{{legend|#0044aa|100,000 - 499,999}}
{{legend|#0055d4|50,000 - 99,999}}
{{legend|#0066ff|10,000 - 49,999}}
{{legend|#2a7fff|5,000 - 9,999}}
{{legend|#5599ff|1,000 - 4,999}}
{{legend|#80b3ff|100 - 999}}
{{legend|#afc6e9|Less than 100 or no data}}
{{legend|#000000|UK}}
]]
Immigration is contributing to a rising population in the United Kingdom,<ref>{{Cite news |date=21 August 2008 |title=Immigration and births to non-British mothers pushes British population to record high |url=https://www.standard.co.uk/news/immigration-and-births-to-nonbritish-mothers-pushes-british-population-to-record-high-6816318.html |work=London Evening Standard}}</ref><ref name="bbc-23-05-2024">{{cite news |title=Migration: How many people come to the UK and how are the salary rules changing? |url=https://www.bbc.com/news/uk-48785695 |work=BBC News |date=23 May 2024}}</ref> with arrivals and UK-born children of migrants accounting for about half of the population increase between 1991 and 2001. According to statistics released in 2015, 27 per cent of UK live births in 2014 were to mothers born outside the UK.<ref>{{Cite web |date=15 July 2015 |title=Births in England and Wales: 2014 |url=http://www.ons.gov.uk/ons/rel/vsob1/birth-summary-tables--england-and-wales/2014/index.html |website=Office for National Statistics }}{{Dead link|date=May 2026 |bot=InternetArchiveBot }}</ref>
In 2013 approximately 208,000 foreign nationals were naturalised as British citizens, the highest number since 1962. This figure fell to around 125,800 in 2014. Between 2009 and 2013 the average number of British citizenships granted annually was 195,800. The most common origins of those naturalised in 2024 were Pakistani, Indian, [[Nigeria]]n, [[Philippines|Filipino]], [[Bangladesh]]i, Italian, Turkish, Romanian and Iranian. The number of grants of settlement, which confer [[Permanent residency|permanent residence]] in the UK but not [[British citizenship|citizenship]],<ref>{{Cite web |last=Blinder |first=Scott |date=11 June 2014 |title=Settlement in the UK |url=http://www.migrationobservatory.ox.ac.uk/briefings/settlement-uk |archive-url=https://web.archive.org/web/20150906232123/http://migrationobservatory.ox.ac.uk/briefings/settlement-uk |archive-date=6 September 2015 |access-date=1 August 2015 |publisher=The Migration Observatory, University of Oxford}}</ref> was approximately 154,700 in 2013, higher than the previous two years.<ref name="Blinder2015">{{Cite web |last=Blinder |first=Scott |date=27 March 2015 |title=Naturalisation as a British Citizen: Concepts and Trends |url=http://www.migrationobservatory.ox.ac.uk/sites/files/migobs/Briefing%20-%20Naturalisation%20as%20a%20British%20Citizen%20-%20Concepts%20and%20Trends_0.pdf |archive-url=https://web.archive.org/web/20150916052200/http://www.migrationobservatory.ox.ac.uk/sites/files/migobs/Briefing%20-%20Naturalisation%20as%20a%20British%20Citizen%20-%20Concepts%20and%20Trends_0.pdf |archive-date=16 September 2015 |access-date=1 August 2015 |publisher=The Migration Observatory, University of Oxford}}</ref> Long-term net migration (the number of people immigrating minus the number emigrating) reached a record of 860,000 in 2023, with immigration at 1.326 million and emigration at 466,000. In comparison, in 2024 net migration was estimated to be 431,000 with immigration at 948,000 and emigration at 517,000.<ref>{{Cite web |title=Long-term international migration, provisional: year ending December 2024 |date=22 May 2025 |url=https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/internationalmigration/bulletins/longterminternationalmigrationprovisional/yearendingdecember2024 |website=gov.uk |access-date=22 May 2025}}</ref>
[[British diaspora|Emigration]] was an important feature of British society in the 19th century. Between 1815 and 1930, around 11.4 million people emigrated from Britain and 7.3 million from Ireland.<ref>{{Cite book |last=Hammar |first=Tomas |url=https://www.cambridge.org/core/books/european-immigration-policy/10B639425685B0C101619FA11522C409 |title=European Immigration Policy: A Comparative Study |date=1985 |publisher=Cambridge University Press |isbn=978-0-521-12437-9 |series=Comparative Ethnic and Race Relations |location=Cambridge}}</ref><ref name="richards-2018">{{Cite book |last=Richards |first=Eric |url=https://www.jstor.org/stable/j.ctvnb7rj2 |title=The genesis of international mass migration: The British case, 1750-1900 |date=2018 |publisher=Manchester University Press |edition=1 |jstor=j.ctvnb7rj2}}</ref> Estimates show that by the end of the 20th century, some 300 million people of British and Irish descent were permanently settled around the globe.<ref name="richards-2018" /> In 2006 at least 5.5 million UK-born people lived abroad,<ref name="BritsAbroad">{{Cite web |last1=Sriskandarajah |first1=Dhananjayan |last2=Drew |first2=Catherine |date=11 December 2006 |title=Brits Abroad: Mapping the scale and nature of British emigration |url=http://www.ippr.org/publicationsandreports/publication.asp?id=509 |archive-url=https://web.archive.org/web/20070828011816/http://www.ippr.org/publicationsandreports/publication.asp?id=509 |archive-date=28 August 2007 |access-date=9 March 2015 |publisher=Institute for Public Policy Research}}</ref><ref>{{Cite news |title=Brits Abroad: world overview |url=http://news.bbc.co.uk/1/shared/spl/hi/in_depth/brits_abroad/html/default.stm |access-date=20 April 2007 |publisher=BBC}}; {{Cite news |last=Casciani |first=Dominic |date=11 December 2006 |title=5.5 m Britons 'opt to live abroad' |work=BBC News |url=http://news.bbc.co.uk/2/hi/uk_news/6210358.stm |access-date=20 April 2007}}</ref> mainly in Australia, Spain, the United States and Canada.<ref name="BritsAbroad" /><ref>{{Cite news |date=11 December 2006 |title=Brits Abroad: Country-by-country |url=http://news.bbc.co.uk/2/hi/uk_news/6161705.stm |work=BBC News}}</ref>
=== Education ===
{{Main|Education in the United Kingdom|Universities in the United Kingdom}}
{{Further|Education in England|Education in Scotland|Education in Wales|Education in Northern Ireland}}
Education in the United Kingdom is a [[Devolution|devolved]] matter, with each country having a separate education system. About 38 per cent of the United Kingdom population has a university or [[college degree]], the highest percentage in Europe and one of the highest in the world.<ref>{{Cite web |date=24 September 2012 |title=The Most Educated Countries in the World |url=https://finance.yahoo.com/news/the-most-educated-countries-in-the-world.html;_ylt=AlaWy8IcyeBaviKi7_.WJyhE6odG;_ylu=X3oDMTJrY2d2NGZyBG1pdANDeFMgRmluYW5jaWFsbHkgRml0IEFydGljbGUgQXJ0aWNsZSBCb2R5IFByb2QEcG9zAzMEc2VjA01lZGlhQXJ0aWNsZUJvZHlBc3NlbWJseQ--;_ylg=X3oDMTNjdGVoaXJqBGludGwDdXMEbGFuZwNlbi11cwRwc3RhaWQDY2IyOTRhMGEtYmY2OS0zYTdlLThlYTUtZWFlNTU3YWI1ZTc3BHBzdGNhdANleGNsdXNpdmVzfGZpbmFuY2lhbGx5Zml0BHB0A3N0b3J5cGFnZQ--;_ylv=3?page=1 |archive-url=https://web.archive.org/web/20160204213400/http://finance.yahoo.com/news/the-most-educated-countries-in-the-world.html%3B_ylt%3DAlaWy8IcyeBaviKi7_.WJyhE6odG%3B_ylu%3DX3oDMTJrY2d2NGZyBG1pdANDeFMgRmluYW5jaWFsbHkgRml0IEFydGljbGUgQXJ0aWNsZSBCb2R5IFByb2QEcG9zAzMEc2VjA01lZGlhQXJ0aWNsZUJvZHlBc3NlbWJseQ--%3B_ylg%3DX3oDMTNjdGVoaXJqBGludGwDdXMEbGFuZwNlbi11cwRwc3RhaWQDY2IyOTRhMGEtYmY2OS0zYTdlLThlYTUtZWFlNTU3YWI1ZTc3BHBzdGNhdANleGNsdXNpdmVzfGZpbmFuY2lhbGx5Zml0BHB0A3N0b3J5cGFnZQ--%3B_ylv%3D3?page=1 |archive-date=4 February 2016 |access-date=20 April 2016 |website=Yahoo Finance }}; {{Cite magazine |date=27 September 2012 |title=And the World's Most Educated Country Is... |url=https://newsfeed.time.com/2012/09/27/and-the-worlds-most-educated-country-is/ |magazine=Time |location=New York |access-date=20 April 2016 |archive-date=30 April 2018 |archive-url=https://web.archive.org/web/20180430040213/http://newsfeed.time.com/2012/09/27/and-the-worlds-most-educated-country-is/ |url-status=dead }}</ref> The UK is home to [[List of universities in the United Kingdom|many universities]], including the [[University of Oxford]] and [[University of Cambridge]], which often achieve first place on global rankings.<ref>{{Cite web |title=The Times Higher Education World University Rankings 2024 |date=25 September 2023 |url=https://www.timeshighereducation.com/world-university-rankings/2024/world-ranking |access-date=17 April 2024}}</ref><ref>{{Cite web |title=QS World University Rankings 2024 |url=https://www.topuniversities.com/university-rankings/world-university-rankings/2024 |access-date=17 April 2024}}</ref>
University education has varied [[Student loans and grants in the United Kingdom|tuition fees]] in different regions of the UK. England and Wales have a fixed maximum annual fee for all UK citizens, contingent on attaining a certain level of income. Only those who reach a certain salary threshold pay this fee through [[Taxation in the United Kingdom|general taxation]].<ref>{{Cite web |title=Repaying your student loan |url=https://www.gov.uk/repaying-your-student-loan/what-you-pay |website=gov.uk |access-date=21 June 2025}}</ref> Northern Ireland and Scotland have a reduced maximum fee or no fee for citizens where it is their home region. Some NHS courses have bursaries which pay the fee and in 2017 it was stated that each doctor gets subsidised by £230,000 during their training.<ref>{{Cite web |date=20 October 2014 |title=Undergraduate Tuition Fess and Student Loans |url=https://www.ucas.com/money-and-student-life/money/student-finance/undergraduate-tuition-fees-and-student-loans |access-date=24 February 2024 |website=UCAS}}</ref><ref>{{Cite web |title=More undergraduate medical education places |url=https://www.gov.uk/government/news/more-undergraduate-medical-education-places |access-date=24 February 2024 |website=gov.uk}}</ref>
In 2022 the [[Programme for International Student Assessment]] (PISA) ranked the overall knowledge and skills of British 15-year-olds as 14th in the world in reading, mathematics and science. The average British student scored 494, above the [[OECD]] average of 478.<ref>{{Cite web |title=PISA 2022 UK Results |url=https://www.oecd.org/publication/pisa-2022-results/country-notes/united-kingdom-9c15db47#chapter-d1e11 |access-date=24 February 2024 |website=OECD |date=4 December 2023}}</ref>
=== Health ===
{{Main|Health in the United Kingdom|Healthcare in the United Kingdom}}
{{Further|Healthcare in England|Healthcare in Scotland|Healthcare in Wales|Healthcare in Northern Ireland}}
[[File:QEUH.jpg|thumb|[[NHS Scotland]]'s [[Queen Elizabeth University Hospital]] in Glasgow, the largest hospital campus in Europe]]
The modern system of [[Universal service|universal]] [[Publicly funded health care|publicly funded healthcare]] in the United Kingdom has its origins in the establishment of the [[National Health Service]] (NHS), which began operating in 1948 as the primary healthcare provider in the United Kingdom.<ref>{{cite web |title=The foundation of the NHS |url=https://www.nationalarchives.gov.uk/explore-the-collection/stories/the-foundation-of-the-nhs/ |access-date=6 July 2026 |publisher=The National Archives}}</ref> The widespread popularity of the NHS has led to it being described as a "national religion".<ref>{{Cite news |last=Gill |first=Martha |date=9 July 2023 |title=To those who claim the NHS has turned into a British religion, I say: keep the faith |url=https://www.theguardian.com/commentisfree/2023/jul/09/nhs-british-religion-keep-faith-nhs-at-75 |access-date=16 July 2023 |work=The Observer}}</ref><ref>{{Cite web |date=14 April 2020 |title=Is the NHS our new national religion? – Religion Media Centre |url=https://religionmediacentre.org.uk/news/is-the-nhs-our-new-national-religion/ |access-date=16 July 2023 |website=religionmediacentre.org.uk}}</ref> Healthcare in the United Kingdom is a [[Devolution|devolved matter]] and each country has its own system of universal publicly funded healthcare ([[NHS in England]], [[NHS Scotland]], [[Health and Social Care in Northern Ireland]] and [[NHS Wales]]), although private healthcare is also available. Public healthcare is provided to all [[British nationality law|UK permanent residents]] and is mostly free at the point of need, being paid for from [[Taxation in the United Kingdom|general taxation]]. The [[World Health Organization]], in 2000, ranked the provision of healthcare in the United Kingdom as fifteenth-best in Europe and eighteenth in the world.<ref>{{Cite book |url=https://archive.org/details/worldhealthrepor00worl |title=The world health report 2000 – Health systems: improving performance |publisher=World Health Organization |date=2000 |isbn=978-92-4-156198-3 |editor-last=Haden |editor-first=Angela |location=Geneva |access-date=5 July 2011 |editor-last2=Campanini |editor-first2=Barbara}}; {{Cite web |last=World Health Organization |author-link=World Health Organization |title=Measuring overall health system performance for 191 countries |url=http://pages.stern.nyu.edu/~wgreene/Statistics/WHO-COMP-Study-30.pdf |access-date=5 July 2011 |publisher=New York University}}</ref>
Since 1979 expenditure on healthcare has increased significantly.<ref>{{Cite journal |last=Fisher |first=Peter |title=The NHS from Thatcher to Blair |url=http://www.healthp.org/node/71 |journal=NHS Consultants Association |archive-url=https://web.archive.org/web/20181120124807/http://www.healthp.org/node/71 |archive-date=20 November 2018 |access-date=19 December 2018 |quote=The Budget ... was even more generous to the NHS than had been expected amounting to an annual rise of 7.4 per cent above the rate of inflation for the next five years. This would take us to 9.4 per cent of GDP spent on health ie around EU average.}}</ref> The 2018 [[OECD]] data, which incorporates in health a chunk of what in the UK is classified as social care, has the UK spending £3,121 per person.<ref>{{Cite news |date=24 September 2019 |title=Swindells: They aren't 'your' patients |url=https://www.hsj.co.uk/policy-and-regulation/swindells-they-arent-your-patients/7025988.article? |access-date=19 November 2019 |publisher=Health Service Journal}}</ref> In 2017 the UK spent £2,989 per person on healthcare, near the median for members of the Organisation for Economic Co-operation and Development.<ref>{{Cite news |date=29 August 2019 |title=How does UK healthcare spending compare with other countries? |url=https://www.ons.gov.uk/peoplepopulationandcommunity/healthandsocialcare/healthcaresystem/articles/howdoesukhealthcarespendingcomparewithothercountries/2019-08-29 |access-date=5 October 2019 |publisher=Office of National Statistics}}</ref>
Regulatory bodies are organised on a UK-wide basis such as the [[General Medical Council]], the [[Nursing and Midwifery Council]] and non-governmental-based, such as the [[Medical royal college|Royal College]]s. Political and operational responsibility for healthcare lies with four national [[governments]]; healthcare in England is the responsibility of the UK Government; healthcare in Northern Ireland is the responsibility of the Northern Ireland Executive; healthcare in Scotland is the responsibility of the Scottish Government; and healthcare in Wales is the responsibility of the Welsh Government.<ref>{{Cite news |date=28 August 2008 |title='Huge contrasts' in devolved NHS |url=http://news.bbc.co.uk/1/hi/health/7586147.stm |work=BBC News}}; {{Cite news |last=Triggle |first=Nick |date=2 January 2008 |title=NHS now four different systems |work=BBC News |url=http://news.bbc.co.uk/1/hi/health/7149423.stm}}</ref>
== Culture ==
{{Main|Culture of the United Kingdom}}
{{Further|Culture of England|Culture of Scotland|Culture of Wales|Culture of Northern Ireland}}
The culture of the United Kingdom is influenced by the nation's island status, its history, and being a [[political union]] of four countries with each preserving distinctive traditions, customs and symbolism. British influence can be observed in the language, culture and [[Common law|legal systems]] of many of [[List of countries that have gained independence from the United Kingdom|its former colonies]], in particular the United States, Australia, Canada, New Zealand and Ireland, a common culture known as the Anglosphere.<ref>{{Cite book |last=Julian Go |title=Constitutionalism and political reconstruction |date=2007 |publisher=Brill |isbn=978-90-04-15174-1 |editor-last=Arjomand |editor-first=Saïd Amir |pages=92–94 |chapter=A Globalizing Constitutionalism?, Views from the Postcolony, 1945–2000 |chapter-url=https://books.google.com/books?id=kYmmnYKEvE0C&pg=PA94}}</ref>{{Sfn|Ferguson|2004|p=307}} Most of its former colonies are Commonwealth countries, bonded by a shared British inheritance.<ref>{{Cite web |title=The Commonwealth |url=https://www.mfat.govt.nz/en/peace-rights-and-security/the-commonwealth/ |access-date=8 January 2024 |website=[[New Zealand Ministry of Foreign Affairs and Trade]] |language=en-NZ}}</ref><ref>{{Cite web |title=Commonwealth of Nations |url=https://www.parliament.uk/about/living-heritage/evolutionofparliament/legislativescrutiny/parliament-and-empire/contemporary-context/ |access-date=22 February 2026 |publisher=UK Parliament |language=en}}</ref><ref>{{Cite book |last1=Mazrui |first1=Ali Al Amin |title=Anglo-African Commonwealth |last2=Taylor |first2=D. |last3=Bradley |first3=Kenneth |date=1967 |publisher=Pergamon |isbn=978-0-08-012253-3 |pages=40–41 |quote=...in the ultimate analysis, what could a New Zealander have in common with a Jamaican or a Zambian, if not the bonds of a shared British-ness?}}</ref> A global survey in 2024 ranked the UK third in the 'Most Influential Countries' rankings, behind the US and China.<ref>{{Cite web |title=Most Influential Countries |url=https://www.usnews.com/news/best-countries/most-influential-countries |access-date=22 September 2025 |website=[[U.S. News & World Report]]}}</ref>
=== Literature and drama ===
{{Main|British literature|Theatre of the United Kingdom}}
{{Further|Literature of England|Scottish literature|Welsh literature|Literature of Northern Ireland}}
{{multiple image
| align = right
| total_width = 320
| image1 = PG 1063Burns Naysmith.jpg
| alt1 = Robert Burns
| caption1 = [[Robert Burns]] (1759–1796)
| image2 = William Shakespeare by John Taylor, edited.jpg
| alt2 = William Shakespeare
| caption2 = [[William Shakespeare]] (1564–1616)
| footer = Burns and Shakespeare are considered the [[national poet]]s of Scotland and England respectively.
}}
British literature includes that associated with the United Kingdom, the [[Isle of Man]] and the [[Channel Islands]]. Most British literature is in English. In 2022, 669 million physical books were sold in the UK, the most ever.<ref>{{Cite web |title=UK publishing industry reports record-breaking year in 2022 |url=https://www.theguardian.com/books/2023/apr/17/uk-publishing-industry-reports-record-breaking-year-in-2022 |access-date=9 May 2024 |work=[[The Guardian]] |date=17 April 2023}}</ref> Britain is renowned for [[Literature for children|children's literature]]; writers include [[Daniel Defoe]], [[Rudyard Kipling]], [[Lewis Carroll]] and [[Beatrix Potter]], who also illustrated her own books. Other writers include [[A. A. Milne]], [[Enid Blyton]], [[J. R. R. Tolkien]], [[Roald Dahl]], [[Terry Pratchett]] and [[J. K. Rowling]], who wrote ''[[Harry Potter]]'', the [[List of best-selling book series|best-selling book series]] of all time.<ref>{{Cite web |title=Best-selling Book Series Of All Time |url=https://wordsrated.com/best-selling-book-series-of-all-time-statistics/ |access-date=18 May 2024 |publisher=Wordsrated |date=20 July 2023}}</ref>
The playwright and poet [[William Shakespeare]] is generally regarded as the greatest dramatist ever and the [[national poet]] of England.<ref>{{Cite web |title=William Shakespeare (English author) |url=https://www.britannica.com/EBchecked/topic/537853/William-Shakespeare |access-date=26 February 2006 |publisher=[[Encyclopædia Britannica]]}}; {{Cite encyclopedia |title=MSN Encarta Encyclopedia article on Shakespeare |url=http://encarta.msn.com/encyclopedia_761562101/Shakespeare.html |access-date=26 February 2006 |archive-url=https://web.archive.org/web/20060209154055/http://encarta.msn.com/encyclopedia_761562101/Shakespeare.html |archive-date=9 February 2006}}; {{Cite web |title=William Shakespeare |work=TheFreeDictionary.com |publisher=Columbia Electronic Encyclopedia |url=http://encyclopedia2.thefreedictionary.com/Shakespeare%2c+William |access-date=26 February 2006}}</ref> Theatre of United Kingdom plays an important part in British culture and has had a vibrant tradition of [[theatre]] since the Renaissance with roots going back to the Roman occupation. Other important figures in the literature of England are [[Geoffrey Chaucer]], known for ''[[The Canterbury Tales]]'', the poet [[William Wordsworth]], and other [[Romantic Poetry|Romantic poets]], also the novelists [[Charles Dickens]], [[H. G. Wells]], [[George Orwell]], [[Aldous Huxley]] and [[Ian Fleming]]. The 20th-century English crime writer [[Agatha Christie]] is the [[List of best-selling fiction authors|best-selling novelist]] in history.<ref>{{Cite news |date=19 December 2005 |title=Mystery of Christie's success is solved |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/news/uknews/1505799/Mystery-of-Christies-success-is-solved.html |url-status=live |url-access=subscription |access-date=14 November 2010 |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/news/uknews/1505799/Mystery-of-Christies-success-is-solved.html |archive-date=10 January 2022}}{{Cbignore}}</ref> Twelve of the top 25 of 100 novels by British writers chosen by a BBC poll of global critics were written by women; these included works by [[George Eliot]], [[Virginia Woolf]], [[Charlotte Brontë]], [[Emily Brontë]], [[Mary Shelley]], [[Jane Austen]], [[Doris Lessing]] and [[Zadie Smith]].<ref>{{Cite news |last=Ciabattari |first=Jane |date=December 2015 |title=The 25 greatest British novels |work=BBC Culture |url=https://www.bbc.com/culture/article/20151204-the-25-greatest-british-novels |access-date=29 December 2021}}</ref>
Scottish literature includes [[Arthur Conan Doyle]] (the creator of [[Sherlock Holmes]]), [[Walter Scott|Sir Walter Scott]], [[J. M. Barrie]], [[Robert Louis Stevenson]] (whose novel ''[[Treasure Island]]'' strongly influenced the portrayal of [[pirates in the arts and popular culture]]), and the poet [[Robert Burns]], who is considered the national poet of Scotland. More recently [[Hugh MacDiarmid]] and [[Neil M. Gunn]] contributed to the [[Scottish Renaissance]], with grimmer works from [[Ian Rankin]] and [[Iain Banks]]. Edinburgh was UNESCO's first worldwide [[City of Literature]].<ref>{{Cite web |year=2004 |title=Edinburgh, United Kingdom, UNESCO City of Literature |url=http://www.unesco.org/new/en/culture/themes/creativity/creative-industries/creative-cities-network/literature/edinburgh |archive-url=https://web.archive.org/web/20130528152834/http://www.unesco.org/new/en/culture/themes/creativity/creative-industries/creative-cities-network/literature/edinburgh |archive-date=28 May 2013 |url-status=dead |access-date=9 March 2015 |work=Unesco}}</ref>
Welsh literature includes Britain's oldest known poem, ''[[Y Gododdin]]'', most likely composed in the late 6th century. It was written in [[Cumbric language|Cumbric]] or [[Old Welsh]] and contains the earliest known reference to [[King Arthur]].<ref>{{Cite web |title=Early Welsh poetry |url=https://www.bbc.co.uk/wales/history/sites/themes/society/language_poetry.shtml |access-date=29 December 2010 |work=BBC Wales}}</ref> The [[Arthurian legend]] was further developed by [[Geoffrey of Monmouth]].<ref>{{Cite book |last=Lang, Andrew |url=https://books.google.com/books?id=dKJiPyyTevgC |title=History of English Literature from Beowulf to Swinburne |publisher=Wildside Press |year=2003 |isbn=978-0-8095-3229-2 |location=Holicong, PA |page=42 |orig-date=1913}}</ref> [[Dafydd ap Gwilym]] (''fl.'' 1320–1370) is widely regarded as one of the greatest European poets of his age.<ref>{{Cite web |year=2011 |title=Dafydd ap Gwilym |url=http://www.academi.org/dafydd-ap-gwilym-eng |archive-url=https://web.archive.org/web/20120324034938/http://www.literaturewales.org/dafydd-ap-gwilym-eng |archive-date=24 March 2012 |url-status=dead |access-date=3 January 2011 |website=[[Literature Wales|Academi.org]] |quote=Dafydd ap Gwilym is widely regarded as one of the greatest Welsh poets of all time, and amongst the leading European poets of the Middle Ages.}}</ref> [[Daniel Owen]] is credited as the first Welsh-language novelist, publishing ''[[Rhys Lewis (novel)|Rhys Lewis]]'' in 1885. The best-known of the [[Anglo-Welsh poetry|Anglo-Welsh poets]] are [[Dylan Thomas]] and [[R. S. Thomas]], the latter nominated for the [[Nobel Prize in Literature]] in 1996. Leading Welsh novelists of the twentieth century include [[Richard Llewellyn]] and [[Kate Roberts (author)|Kate Roberts]].<ref>{{Cite web |url=http://newsalerts.bbc.co.uk/1/low/wales/551486.stm |title=True birthplace of Wales's literary hero |archive-url=https://web.archive.org/web/20200316173733/http://newscdn.bbc.net.uk/2/hi/uk_news/wales/551486.stm |archive-date=16 March 2020 |url-status=dead |website=BBC News |date=5 December 1999 |access-date=28 April 2012}}</ref><ref>{{Cite web |title=Kate Roberts: Biography |url=https://www.bbc.co.uk/wales/northwest/halloffame/arts/kateroberts.shtml |url-status=dead |access-date=19 February 2017 |website=BBC Wales |archive-url=https://web.archive.org/web/20130308000646/https://www.bbc.co.uk/wales/northwest/halloffame/arts/kateroberts.shtml |archive-date=8 March 2013}}</ref>
Northern Ireland's most popular writer is [[C. S. Lewis]], who was born in Belfast and wrote ''[[The Chronicles of Narnia]]''.<ref>{{Cite web |title=The Chronicles of Narnia Book Series Statistics |url=https://wordsrated.com/the-chronicles-of-narnia-book-series-statistics/ |access-date=18 May 2024 |publisher=Wordsrated |date=19 July 2023}}</ref> Irish writers, living at a time when all of Ireland was part of the United Kingdom, include [[Oscar Wilde]],<ref>{{Cite book |last=Varty |first=Anne |title=A Preface to Oscar Wilde |date=2014 |publisher=Routledge |isbn=978-1-317-89231-1 |pages=[https://books.google.com/books?id=A9YFBAAAQBAJ&pg=PA231 231–232]}}; {{Cite encyclopedia |title=Oscar Wilde |encyclopedia=[[Encyclopedia.com]] |publisher=[[Cengage]] |url=https://www.encyclopedia.com/people/literature-and-arts/english-literature-19th-cent-biographies/oscar-wilde |access-date=10 December 2019}}</ref> [[Bram Stoker]] (who wrote ''[[Dracula]]'')<ref>{{Cite book |last=Moss |first=Joyce |url=https://archive.org/details/isbn_9780787637286 |title=British and Irish Literature and Its Times: The Victorian Era to the Present (1837–) |publisher=Gale Group |year=2001 |isbn=978-0-7876-3729-3 |page=[https://archive.org/details/isbn_9780787637286/page/107 107] |url-access=registration}}</ref> and [[George Bernard Shaw]].<ref>{{Cite book |last=Holroyd |first=Michael |url=https://archive.org/details/bernardshaw00holr/page/384 |title=Bernard Shaw, Volume 2: 1898–1918: The Pursuit of Power |publisher=Chatto & Windus |year=1989 |isbn=978-0-7011-3350-4 |page=[https://archive.org/details/bernardshaw00holr/page/384 384]}}; {{Cite web |title=G B Shaw |url=https://www.bl.uk/people/g-b-shaw |access-date=10 December 2019 |website=Discovering Literature: 20th century |publisher=[[British Library]] |archive-date=9 August 2020 |archive-url=https://web.archive.org/web/20200809155152/https://www.bl.uk/people/g-b-shaw |url-status=dead}}</ref> There have been many authors whose origins were from outside the United Kingdom but who moved to the UK, including [[Joseph Conrad]],<ref>{{Cite book |last=Middleton |first=Tim |url=https://books.google.com/books?id=Azd1f8NBpUoC&pg=PA159 |title=Joseph Conrad |publisher=Routledge |year=2006 |isbn=978-0-415-26851-6 |page=159}}</ref> [[T. S. Eliot]],<ref>{{Cite book |last=Cooper |first=John Xiros |url=https://books.google.com/books?id=XqmNjQzhwV4C&pg=PA111 |title=The Cambridge Introduction to T. S. Eliot |date=2006 |publisher=Cambridge University Press |isbn=978-1-139-45790-3 |page=111}}</ref> [[Kazuo Ishiguro]],<ref>{{Cite book |last=Sim |first=Wai-chew |url=https://books.google.com/books?id=WcKLAgAAQBAJ&pg=PT201 |title=Kazuo Ishiguro |date=2009 |publisher=Routledge |isbn=978-1-135-19867-1 |page=201}}</ref> Sir [[Salman Rushdie]]<ref>{{Cite web |title=Salman Rushdie |url=https://www.oxfordreference.com/view/10.1093/oi/authority.20110803100433765 |access-date=10 December 2019 |website=Oxford Reference |publisher=[[Oxford University Press]]}}</ref> and [[Ezra Pound]].<ref>{{Cite news |last=Campbell |first=James |date=17 May 2008 |title=Home from home |work=The Guardian |url=https://www.theguardian.com/books/2008/may/17/poetry3 |access-date=10 December 2019}}; {{Cite book |last=Nadel |first=Ira |url=https://books.google.com/books?id=ECiGDAAAQBAJ&pg=PA90 |title=Ezra Pound: A Literary Life |date=2004 |publisher=Palgrave Macmillan |isbn=978-0-230-37881-0 |page=90}}</ref>
=== Philosophy ===
{{Main|British philosophy}}
The United Kingdom is famous for "[[British Empiricism]]", a branch of the philosophy that states that only knowledge verified by experience is valid, and 'Scottish Philosophy', sometimes referred to as the '[[Scottish School of Common Sense]]'.<ref>{{Cite book |url=http://www.rrbltd.co.uk/bibliographies/scottish_v5_bibliog.pdf |title=A bibliography of Scottish common sense philosophy: Sources and origins |publisher=Thoemmes Press |year=2000 |editor-last=Fieser, James |location=Bristol |access-date=17 December 2010 |archive-date=9 April 2023 |archive-url=https://web.archive.org/web/20230409171906/https://www.rrbltd.co.uk/bibliographies/scottish_v5_bibliog.pdf |url-status=dead}}</ref> The most famous philosophers of British Empiricism are [[John Locke]], [[George Berkeley]]{{Efn|Berkeley is in fact Irish but was called a 'British empiricist' due to the territory of what is now known as the [[Republic of Ireland]] being in the UK at the time.}} and [[David Hume]]; while [[Dugald Stewart]], [[Thomas Reid]] and [[Sir William Hamilton, 9th Baronet|William Hamilton]] were major exponents of the Scottish "common sense" school. Two Britons are also notable for the ethical theory of [[utilitarianism]], a moral philosophy first used by [[Jeremy Bentham]] and later by [[John Stuart Mill]] in his short work ''[[Utilitarianism (book)|Utilitarianism]]''.<ref>{{Cite book |last=Palmer, Michael |url=https://books.google.com/books?id=s7y5MJOuN30C&pg=PA66 |title=Moral Problems in Medicine: A Practical Coursebook |publisher=Lutterworth Press |year=1999 |isbn=978-0-7188-2978-0 |location=Cambridge |page=66}}; {{Cite book |last=Scarre, Geoffrey |url=https://books.google.com/books?id=8A4xLnzfqYwC&pg=PA82 |title=Utilitarianism |publisher=Routledge |year=1995 |isbn=978-0-415-12197-2 |location=London |page=82}}</ref>
=== Media ===
{{Main|Media of the United Kingdom|Censorship in the United Kingdom}}
{{Further|Media of England|Media of Scotland|Media of Wales|Media of Northern Ireland}}
The [[BBC]], founded in 1922, is the United Kingdom's publicly funded radio, television and Internet broadcasting corporation, and is the oldest and largest broadcaster in the world.<ref name="MediaNewsline">{{Cite web |title=BBC: World's largest broadcaster & Most trusted media brand |url=http://www.medianewsline.com/news/151/ARTICLE/4930/2009-08-13.html |archive-url=https://web.archive.org/web/20101005004930/http://www.medianewsline.com/news/151/ARTICLE/4930/2009-08-13.html |archive-date=5 October 2010 |access-date=23 September 2010 |publisher=Media Newsline}}</ref><ref name="ProspectMag">{{Cite web |title=Digital license |url=http://www.prospectmagazine.co.uk/?p=64654 |archive-url=https://web.archive.org/web/20111107024637/http://www.prospectmagazine.co.uk/2009/07/digitallicense |archive-date=7 November 2011 |access-date=9 March 2015 |publisher=Prospect}}</ref><ref name="AboutBBC">{{Cite news |title=About the BBC – What is the BBC |work=BBC Online |url=https://www.bbc.co.uk/info/purpose/what.shtml |access-date=9 March 2015 |archive-url=https://web.archive.org/web/20100116202334/http://www.bbc.co.uk/info/purpose/what.shtml |archive-date=16 January 2010}}</ref> It operates television and radio stations across the UK and abroad and its domestic services are funded by the [[Television licensing in the United Kingdom|television licence]].<ref>{{Cite journal |date=13 August 2009 |title=BBC: World's largest broadcaster & Most trusted media brand |url=http://www.medianewsline.com/news/151/ARTICLE/4930/2009-08-13.html |journal=Media Newsline |archive-url=https://web.archive.org/web/20110510090842/http://www.medianewsline.com/news/151/ARTICLE/4930/2009-08-13.html |archive-date=10 May 2011 |access-date=19 June 2011}}; {{Cite web |date=April 2010 |title=TV Licence Fee: facts & figures |url=https://www.bbc.co.uk/pressoffice/keyfacts/stories/licencefee.shtml |url-status=live |archive-url=https://web.archive.org/web/20110427080539/http://www.bbc.co.uk/pressoffice/keyfacts/stories/licencefee.shtml |archive-date=27 April 2011 |publisher=BBC Press Office}}</ref> The [[BBC World Service]] is an [[International broadcasting|international broadcaster]] owned and operated by the BBC, and the world's largest.<ref>{{Cite web |title=Microsoft Word – The Work of the BBC World Service 2008–09 HC 334 FINAL.doc |url=https://publications.parliament.uk/pa/cm200910/cmselect/cmfaff/334/334.pdf |archive-url=https://web.archive.org/web/20201021001645/https://publications.parliament.uk/pa/cm200910/cmselect/cmfaff/334/334.pdf |archive-date=21 October 2020 |access-date=16 February 2011}}</ref> It broadcasts radio news, speech and discussions in more than 40 languages.<ref>{{Cite web |title=News in your language – BBC News |url=https://www.bbc.co.uk/ws/languages |website=BBC}}; {{Cite web |title=BBC World Service |url=https://www.facebook.com/pages/category/Media-News-Company/bbcworldservice/about |website=Facebook.com}}</ref>
Other major players in the UK media include [[ITV plc|ITV]], which operates 11 of the 15 regional television broadcasters that make up the [[ITV (TV network)|ITV Network]],<ref>{{Cite web |title=Publications & Policies: The History of ITV |url=http://www.itv.com/aboutitv/publications-policies |archive-url=https://web.archive.org/web/20110411224117/http://www.itv.com/aboutitv/publications-policies |archive-date=11 April 2011 |website=ITV.com}}</ref> and [[Sky UK|Sky]].<ref>{{Cite journal |title=Direct Broadcast Satellite Television |url=http://www.newscorp.com/operations/dbst.html |journal=News Corporation |archive-url=https://web.archive.org/web/20110604095622/http://www.newscorp.com/operations/dbst.html |archive-date=4 June 2011}}</ref> Newspapers produced in the United Kingdom include the ''[[Daily Mail]]'', ''[[The Guardian]]'', ''[[The Daily Telegraph|The Telegraph]]'', ''[[The Times]]'', and the ''[[Financial Times]]''.<ref>{{Cite news |date=10 October 2008 |title=ABCs: National daily newspaper circulation September 2008 |work=The Guardian |location=London |url=https://www.theguardian.com/media/table/2008/oct/10/abcs-pressandpublishing |access-date=17 October 2008}}</ref> Magazines and journals published in the United Kingdom that have achieved worldwide circulation include ''[[The Spectator]]'', ''[[The Economist]]'', ''[[New Statesman]]'' and ''[[Radio Times]]''.
[[File:Media City Footbridge and BBC Offices (geograph 2685261).jpg|thumb|[[MediaCityUK]] in [[Salford]], [[Greater Manchester]], is one of the largest media production facilities in Europe.]]London dominates the media sector in the UK: national newspapers and television and radio are largely based there, although [[MediaCityUK]] in Manchester is also a significant national media centre. Edinburgh and Glasgow, and Cardiff, are important centres of newspaper and broadcasting production in Scotland and Wales, respectively.<ref>William, D. (2010). [https://books.google.com/books?id=7yg45P35KDMC ''UK Cities: A Look at Life and Major Cities in England, Scotland, Wales and Northern Ireland'']. Eastbourne: Gardners Books. {{ISBN|978-9987-16-021-1}}, pp. 22, 46, 109 and 145.</ref> The UK publishing sector, including books, directories and databases, journals, magazines and business media, newspapers and news agencies, has a combined turnover of around £20 billion and employs 167,000 people.<ref>{{Cite web |title=Publishing |url=http://www.culture.gov.uk/what_we_do/creative_industries/3280.aspx |url-status=live |archive-url=https://web.archive.org/web/20110505104322/http://www.culture.gov.uk/what_we_do/creative_industries/3280.aspx |archive-date=5 May 2011 |publisher=Department of Culture, Media and Sport}}</ref> In 2015 the UK published 2,710 book titles per million inhabitants, more than any other country, with much of this exported to other [[Anglophone]] countries.<ref>{{Cite web |last=<!--Not stated--> |date=2016 |title=Annual Report 2015–2016 |url=https://www.internationalpublishers.org/images/reports/Annual_Report_2016/IPA_Annual_Report_2015-2016_interactive.pdf |access-date=14 January 2021 |website=internationalpublishers.org |publisher=International Publishers Association |page=16 |archive-date=31 August 2023 |archive-url=https://web.archive.org/web/20230831205753/https://www.internationalpublishers.org/images/reports/Annual_Report_2016/IPA_Annual_Report_2015-2016_interactive.pdf |url-status=dead}}</ref>
In 2010, 82.5 per cent of the UK population were Internet users, the [[List of countries by number of Internet users|highest proportion]] amongst the 20 countries with the largest total number of users in that year.<ref>{{Cite journal |title=Top 20 countries with the highest number of Internet users |url=http://www.internetworldstats.com/top20.htm |journal=Internet World Stats |archive-url=https://web.archive.org/web/20110610104435/http://www.internetworldstats.com/top20.htm |archive-date=10 June 2011 |access-date=19 June 2011}}</ref> The [[Video games in the United Kingdom|British video game industry]] is the largest in Europe, and since 2022 the UK has the [[List of video games markets by country|largest video game market]] in Europe by sales, surpassing [[Video games in Germany|Germany]].<ref>{{Cite web |last=Dring |first=Christopher |date=12 January 2023 |title=European console and PC game sales fall 7.1% in 2022 |url=https://www.gamesindustry.biz/european-console-and-pc-game-sales-fall-71-over-2021 |access-date=30 September 2023 |website=GamesIndustry.biz}}</ref> It is the world's third-largest producer of video games after [[Video games in Japan|Japan]] and the [[Video games in the United States|United States]].<ref>{{Cite web |title=About UK Video Games Industry |url=https://tiga.org/about-tiga-and-our-industry/about-uk-video-games-industry |access-date=6 June 2023 |website=TIGA}}</ref>
=== Visual art ===
{{Main|Art of the United Kingdom|Architecture of the United Kingdom}}
[[File:Angel of the North - 6150534524.jpg|thumb|The [[Angel of the North]] sculpture by [[Antony Gormley]] has become a symbol of [[Northern England]].]]
Major British artists include the [[Romanticism|Romantic]] artists [[William Blake]], [[John Constable]], [[Samuel Palmer]], and [[J. M. W. Turner]]; the [[portrait]] painters [[Joshua Reynolds|Sir Joshua Reynolds]] and [[Lucian Freud]]; the landscape artists [[Thomas Gainsborough]] and [[L. S. Lowry]]; the pioneer of the [[Arts and Crafts movement]] [[William Morris]]; the figurative painter [[Francis Bacon (artist)|Francis Bacon]]; the [[Pop artist]]s [[Peter Blake (artist)|Peter Blake]], [[Richard Hamilton (artist)|Richard Hamilton]] and [[David Hockney]]; the pioneers of [[conceptual art]] movement [[Art & Language]];<ref>{{Cite news |last=Tate |title=Art & Language – Art Term {{!}} Tate |work=Tate |url=https://www.tate.org.uk/art/art-terms/a/art-language |access-date=8 September 2018}}</ref> the collaborative duo [[Gilbert and George]]; the [[Abstract art|abstract]] artist [[Howard Hodgkin]]; and the sculptors [[Antony Gormley]], [[Anish Kapoor]] and [[Henry Moore]]. During the late 1980s and 1990s the [[Saatchi Gallery]] in London helped to bring to public attention a group of multi-genre artists who would become known as the "[[Young British Artists]]": [[Damien Hirst]], [[Chris Ofili]], [[Rachel Whiteread]], [[Tracey Emin]], [[Mark Wallinger]], [[Steve McQueen (director)|Steve McQueen]], [[Sam Taylor-Wood]] and the [[Jake and Dinos Chapman|Chapman Brothers]] are amongst the better-known members of this loosely affiliated movement.
The [[Royal Academy]] in London is a key organisation for the promotion of the visual arts in the United Kingdom. Major schools of art in the UK include: the six-school [[University of the Arts London]], which includes the [[Central Saint Martins College of Art and Design]] and [[Chelsea College of Art and Design]]; [[Goldsmiths, University of London]]; the [[Slade School of Fine Art]] (part of [[University College London]]); the [[Glasgow School of Art]]; the [[Royal College of Art]]; and [[The Ruskin School of Drawing and Fine Art]] (part of the University of Oxford). The [[Courtauld Institute of Art]] is a leading centre for the teaching of the [[history of art]]. Important art galleries in the United Kingdom include the [[National Gallery]], [[National Portrait Gallery (London)|National Portrait Gallery]], [[Tate Britain]], and [[Tate Modern]] (the most-visited modern art gallery in the world, with around 4.7 million visitors per year).<ref>{{Cite news |last=Bayley |first=Stephen |date=24 April 2010 |title=The startling success of Tate Modern |work=[[The Times]] |location=London |url=http://entertainment.timesonline.co.uk/tol/arts_and_entertainment/visual_arts/article7105032.ece |archive-url=https://web.archive.org/web/20110429173928/http://entertainment.timesonline.co.uk/tol/arts_and_entertainment/visual_arts/article7105032.ece |url-status=dead |archive-date=29 April 2011 |access-date=19 January 2011}} {{Subscription required}}</ref>
=== Music ===
{{Main|Music of the United Kingdom}}
{{Further|Music of England (disambiguation){{!}}Music of England|Music of Scotland|Music of Wales|Music of Northern Ireland}}
<!----Caution should be taken to ensure that the sections are not simply a listing of names or mini biographies of individuals accomplishments.---->
[[File:Royal Albert Hall, BBC Proms 2017.jpg|thumb|[[The Proms]] is a classical music festival, most closely associated with [[Henry Wood]] and held at the [[Royal Albert Hall]] in London, which regularly plays music by [[Edward Elgar]] and other British composers.]]
Various styles of music have become popular in the UK, including the [[folk music]] of [[Folk music of England|England]], [[Folk music of Scotland|Scotland]], [[Music of Wales#Folk music|Wales]] and [[Folk music of Northern Ireland|Northern Ireland]]. English folk features melodic ballads with strong lyrics and music for country dancing often using accordion and fiddles.<ref>{{Cite web |access-date=15 September 2025 |title=Songs of England |url=https://www.english-heritage.org.uk/visit/inspire-me/songs-of-england}}</ref> Scottish folk features bagpipes and fiddles playing traditional dance tunes with bouncy tempos.<ref>{{Cite web |access-date=15 September 2025 |title=The influence of traditional Scottish Music |url=https://www.visitscotland.com/things-to-do/events/music-festivals/traditional-folk}}</ref> Welsh folk has harps and vocal harmonies often sung in Welsh.<ref>{{Cite web |access-date=15 September 2025 |title=Celtic connections: the story of folk music in Wales |date=17 February 2020 |url=https://www.wales.com/culture-and-sport/music-and-performance/roots-and-shoots-welsh-folk-music}}</ref> Northern Irish folk blends fiddles with flutes merging Scottish and Irish influences.<ref>{{Cite web |access-date=15 September 2025 |title=Why you should experience traditional music in Ireland |url=https://www.ireland.com/en-us/magazine/music/traditional-music/}}</ref>
Historically, there has been [[Renaissance music]] from the [[Tudor period]], with [[Mass (music)|masses]], [[madrigal]]s and [[lute]] music by [[Thomas Tallis]], [[John Taverner]], [[William Byrd]], [[Orlando Gibbons]] and [[John Dowland]]. After the [[Stuart Restoration]], an English tradition of dramatic [[masque]]s, anthems and airs became established, led by [[Henry Purcell]], followed by [[Thomas Arne]] and others. [[George Frideric Handel]] composed the anthem ''[[Zadok the Priest]]'' for the [[coronation of George II]]; it became the traditional ceremonial music for anointing all future monarchs. Handel's many oratorios, such as his famous ''[[Messiah (Handel)|Messiah]]'', were written in English.<ref>{{Cite web |date=20 July 2009 |title=British Citizen by Act of Parliament: George Frideric Handel |url=http://www.parliament.uk/parliamentary_publications_and_archives/parliamentary_archives/handel_and_naturalisation.cfm |archive-url=https://web.archive.org/web/20100326164147/http://www.parliament.uk/parliamentary_publications_and_archives/parliamentary_archives/handel_and_naturalisation.cfm |archive-date=26 March 2010 |access-date=9 March 2015 |publisher=UK Parliament}}; {{Cite news |last=Andrews |first=John |date=14 April 2006 |title=Handel all'inglese |work=Playbill |location=New York |url=http://www.playbillarts.com/features/article/4236.html |access-date=11 September 2009 |archive-url=https://web.archive.org/web/20080516210558/http://www.playbillarts.com/features/article/4236.html |archive-date=16 May 2008}}</ref>
In the second half of the 19th century, [[Arthur Sullivan]] and his librettist [[W. S. Gilbert]] wrote their popular [[Savoy opera]]s, and [[Edward Elgar]] composed a wide range of music. Increasingly, composers became inspired by the English countryside and its [[folk music]], notably [[Gustav Holst]], [[Ralph Vaughan Williams]] and [[Benjamin Britten]], a pioneer of modern British opera. Amongst the many post-war composers, some of the most notable have made their own personal choice of musical identity: [[Peter Maxwell Davies]] (Orkney), [[Harrison Birtwistle]] (mythological), and [[John Tavener]] (religious).<ref>{{Cite Grove |title=Great Britain |first1=Nicholas |last1=Iemperley |date=2002 |url=https://doi.org/10.1093/gmo/9781561592630.article.O006236 |url-access=subscription}}; {{Cite Grove |title=England (i) |date=2001 |url=https://doi.org/10.1093/gmo/9781561592630.article.40044 |url-access=subscription |first1=Stephen |last1=Banfield |first2=Ian |last2=Russell}}; {{Cite Grove |title=Wales |date=2001 |first1=Geraint |last1=Lewis |first2=Lyn |last2=Davies |first3=Phyllis |last3=Kinney |url=https://doi.org/10.1093/gmo/9781561592630.article.41108 |url-access=subscription}}; {{Cite Grove |title=Scotland |first1=Kenneth |last1=Elliott |first2=Francis |last2=Collinson |first3=Peggy |last3=Duesenberry |url=https://doi.org/10.1093/gmo/9781561592630.article.40113 |url-access=subscription |date=2001}}; {{Cite Grove |title=Ireland |first1=Harry |last1=White |first2=Nicholas |last2=Carolan |url=https://doi.org/10.1093/gmo/9781561592630.article.13901 |url-access=subscription |date=2011}}; {{Cite web |title=British 20th century composers |url=https://www.bbc.co.uk/bitesize/guides/zdjw7p3/revision/1 |access-date=21 April 2022 |website=[[BBC]]}}</ref> Recent classical singers include [[Alfie Boe]], [[Bryn Terfel]], [[Katherine Jenkins]], [[Michael Ball]], [[Roderick Williams]], [[Russell Watson]] and [[Sarah Brightman]], while [[Nicola Benedetti]] and [[Nigel Kennedy]] are renowned for their violin ability.<ref>{{Cite web |date=21 June 2022 |title=30 of the greatest violinists on record |url=https://www.gramophone.co.uk/features/article/30-of-the-greatest-violinists-on-record |access-date=4 March 2024 |website=Gramophone}};{{Cite web |date=1 January 2020 |title=Katherine Jenkins has officially sold the most classical albums this century |url=https://www.classicfm.com/radio/shows-presenters/classic-fm-chart/katherine-jenkins-most-classical-albums/ |access-date=4 March 2024 |website=Classic FM}};{{Cite web |date=6 May 2023 |title=Who is Roderick Williams, the British baritone and composer at the King's coronation? |url=https://www.classicfm.com/discover-music/roderick-williams-composer-baritone-singing-roles/ |access-date=4 March 2024 |website=Classic FM}};{{Cite web |date=23 February 2024 |title=Michael Ball |url=https://www.eno.org/artists/michael-ball-2/ |access-date=4 March 2024 |website=English National Opera}};{{Cite web |title=Alfie Bow |url=https://www.classicfm.com/artists/alfie-boe/ |access-date=4 March 2024 |website=Classic FM}};{{Cite web |date=11 July 2023 |title=Sarah Brightman facts |url=https://www.smoothradio.com/news/music/sarah-brightman-age-husband-songs/ |access-date=4 March 2024 |website=Smooth Radio}}</ref>
According to ''[[The New Grove Dictionary of Music and Musicians]]'' the term "[[pop music]]" originated in Britain in the mid-1950s to describe [[rock and roll]]'s fusion with the "new youth music".<ref>R. Middleton, et al., [http://www.oxfordmusiconline.com/public/book/omo_gmo "Pop"], ''Grove music online'', retrieved 14 March 2010. {{Subscription required}} {{Webarchive|url=https://web.archive.org/web/20110113160329/http://www.oxfordmusiconline.com/public/book/omo_gmo|date=13 January 2011}}</ref> ''The Oxford Dictionary of Music'' states that artists such as [[the Beatles]] and [[the Rolling Stones]] drove pop music to the forefront of popular music in the early 1960s.<ref>"Pop", [http://www.oxfordmusiconline.com/public/book/omo_t237 ''The Oxford Dictionary of Music''], retrieved 9 March 2010.{{Subscription required}} {{Webarchive|url=https://web.archive.org/web/20171112170116/http://www.oxfordmusiconline.com/public/book/omo_t237|date=12 November 2017}}</ref> Birmingham became known as the birthplace of [[heavy metal music|heavy metal]], with the band [[Black Sabbath]] starting there in the 1960s.<ref>{{Cite news |title=Birmingham, England ... the unlikely birthplace of heavy metal |work=CNN |date=1 July 2011 |first1=Laura |last1=Allsop |url=http://www.cnn.com/2011/WORLD/europe/07/01/birmingham.home.of.metal/index.html |access-date=28 February 2022 |postscript=;}} {{Cite web |last=Bentley |first=David |date=4 June 2013 |title=Midlands rocks! How Birmingham's industrial heritage made it the birthplace of heavy metal |url=http://www.birminghampost.co.uk/whats-on/music/birmingham-birthplace-of-heavy-metal-4031445 |access-date=28 February 2022 |website=[[Birmingham Post]]}}</ref> In the following years, Britain took part in the development of [[rock music]], with British acts pioneering [[hard rock]],<ref>{{Cite web |title=The Rolling Stones {{!}} Biography & History |url=https://www.allmusic.com/artist/the-rolling-stones-mn0000894465/biography |access-date=22 July 2020 |website=AllMusic}}</ref> [[raga rock]], heavy metal,<ref>{{Cite book |last=Tom Larson |url=https://books.google.com/books?id=vGJ7XmA8rjIC&pg=PA183 |title=History of Rock and Roll |publisher=Kendall/Hunt Pub. |year=2004 |isbn=978-0-7872-9969-9 |pages=183–187}}</ref> [[space rock]], [[glam rock]],<ref>{{Cite encyclopedia |title=Glam Rock |url=http://encarta.msn.com/dictionary_561509274/glam_rock.html |access-date=21 December 2008 |archive-url=https://web.archive.org/web/20090828224412/http://encarta.msn.com/dictionary_561509274/glam_rock.html |archive-date=28 August 2009 |encyclopedia=[[Encarta]]}}</ref> [[Gothic rock]],<ref>{{Cite web |year=2004 |title=NME Originals: Goth |url=https://www.nme.com/originals/4 |archive-url=https://web.archive.org/web/20080126150121/http://www.nme.com/originals/4 |archive-date=26 January 2008 |access-date=30 September 2013 |website=[[NME]]}}</ref> [[psychedelic rock]]<ref>{{Cite web |title=Pop/Rock » Psychedelic/Garage |url=https://www.allmusic.com/subgenre/psychedelic-garage-ma0000002800 |access-date=6 August 2020 |publisher=[[AllMusic]]}}</ref> and [[punk rock]].<ref>{{cite magazine |author1=Charles M. Young |title=Rock is Sick and Living in London |url=https://www.rollingstone.com/feature/a-report-on-the-sex-pistols-119989/ |magazine=Rolling Stone |access-date=23 February 2026 |date=20 October 1977 |archive-url=https://web.archive.org/web/20250328094721/https://www.rollingstone.com/feature/a-report-on-the-sex-pistols-119989/ |archive-date=28 March 2025}}</ref> British acts also developed [[neo soul]] and created [[dubstep]].<ref>Henderson, Alex (1 August 2003). [https://web.archive.org/web/20101104165122/http://allmusic.com/explore/essay/british-soul-t2160 British Soul]. Allmusic. Retrieved 6 March 2011.; [http://www.allmusic.com/style/dubstep-ma0000004465 AllMusic – Dubstep] {{Webarchive|url=https://web.archive.org/web/20170923151236/http://www.allmusic.com/style/dubstep-ma0000004465|date=23 September 2017}} "Absorbed and transfigured elements of techno, drum'n' bass and dub"; {{Cite news |last=Goldman |first=Vivien |date=31 January 2012 |title=Local Groove Does Good: The Story Of Trip-Hop's Rise From Bristol |work=NPR |url=https://www.npr.org/sections/therecord/2012/01/31/142607358/local-groove-does-good-the-story-of-trip-hops-rise-from-bristol}}</ref> The UK has produced some of the most prominent English-speaking [[rappers]] along with the United States, including [[Stormzy]], [[Kano (rapper)|Kano]], [[Yxng Bane]], [[Ramz (rapper)|Ramz]], [[Little Simz]] and [[Skepta]].<ref>{{Cite magazine |title=5 U.K. Rappers Primed to Take Over America in 2018 |url=https://www.billboard.com/music/rb-hip-hop/uk-rappers-to-watch-2018-8097878/ |magazine=Billboard |access-date=18 June 2018}}</ref>
[[File:The SSE Hydro arena - geograph.org.uk - 6725739.jpg|thumb|right|The [[OVO Hydro]] in [[Glasgow]], Scotland, a 14,500-capacity arena consistently ranked within the top ten busiest venues worldwide<ref>{{cite web |title=OVO Hydro {{!}} SEC |url=https://www.sec.co.uk/organise-an-event/event-spaces/the-ovo-hydro |website=www.sec.co.uk |access-date=9 February 2026 |language=en}}</ref>]]
The Beatles have international sales of over 1 billion units and are the [[List of best-selling music artists|biggest-selling band]], in addition to being [[Cultural impact of the Beatles|widely regarded as the most influential band]] in the history of popular music.<ref name="Beatles sales">{{Cite web |title=1960–1969 |url=http://www.emimusic.com/about/history/1960-1969/# |archive-url=https://web.archive.org/web/20140425011032/http://www.emimusic.com/about/history/1960-1969 |archive-date=25 April 2014 |access-date=9 March 2015 |publisher=EMI Group}}</ref><ref name="McCartney">{{Cite magazine |date=8 June 1992 |title=Paul At Fifty |url=http://www.time.com/time/magazine/article/0,9171,975715-2,00.html |magazine=Time |location=New York |archive-url=https://web.archive.org/web/20090206120350/http://www.time.com/time/magazine/article/0,9171,975715-2,00.html |archive-date=6 February 2009}}</ref><ref name="Guinness">[https://books.google.com/books?id=rdU1xtIWJz0C Most Successful Group] ''[[The Guinness Book of Records]]'' 1999, p. 230. Retrieved 19 March 2011.</ref><ref>{{Cite news |date=25 November 2010 |title=Beatles a big hit with downloads |work=Belfast Telegraph |url=http://www.belfasttelegraph.co.uk/entertainment/music/news/beatles-a-big-hit-with-downloads-15013117.html |access-date=16 May 2011}}</ref> Other prominent British contributors to popular music over the last 50 years include the Rolling Stones, [[Pink Floyd]], [[Queen (band)|Queen]], [[Led Zeppelin]], the [[Bee Gees]] and [[Elton John]], all of whom have worldwide record sales of 200 million or more.<ref>{{Cite press release |title=British rock legends get their own music title for PlayStation3 and PlayStation2 |date=2 February 2009 |publisher=[[EMI]] |url=http://www.emimusic.com/news/2009/singstar®-queen-to-be-launched-by-sony-computer-entertainment-europe |access-date=9 March 2015 |archive-url=https://web.archive.org/web/20140423012539/http://www.emimusic.com/news/2009/singstar%C2%AE-queen-to-be-launched-by-sony-computer-entertainment-europe |archive-date=23 April 2014}}; {{Cite news |last=Khan |first=Urmee |date=17 July 2008 |title=Sir Elton John honoured in Ben and Jerry ice cream |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/news/newstopics/celebritynews/2305273/Sir-Elton-John-honoured-in-Ben-and-Jerry-ice-cream.html |archive-url=https://web.archive.org/web/20080730164432/http://www.telegraph.co.uk/news/newstopics/celebritynews/2305273/Sir-Elton-John-honoured-in-Ben-and-Jerry-ice-cream.html |archive-date=30 July 2008}}; {{Cite news |last=Alleyne |first=Richard |date=19 April 2008 |title=Rock group Led Zeppelin to reunite |work=The Telegraph |location=London |url=https://www.telegraph.co.uk/news/uknews/1562875/Rock-group-Led-Zeppelin-to-reunite.html |url-status=live |url-access=subscription |access-date=31 March 2010 |archive-url=https://ghostarchive.org/archive/20220110/https://www.telegraph.co.uk/news/uknews/1562875/Rock-group-Led-Zeppelin-to-reunite.html |archive-date=10 January 2022}}{{Cbignore}}; {{Cite news |date=11 July 2006 |title=Floyd 'true to Barrett's legacy' |work=BBC News |url=http://news.bbc.co.uk/1/hi/entertainment/5170644.stm}}; {{Cite news |last=Holton |first=Kate |date=17 January 2008 |title=Rolling Stones sign Universal album deal |work=Reuters |url=https://www.reuters.com/article/entertainmentNews/idUSL1767761020080117 |access-date=26 October 2008}}; {{Cite news |last=Walker |first=Tim |date=12 May 2008 |title=Jive talkin': Why Robin Gibb wants more respect for the Bee Gees |work=Independent |location=London |url=https://www.independent.co.uk/arts-entertainment/music/features/jive-talkin-why-robin-gibb-wants-more-respect-for-the-bee-gees-826116.html |access-date=26 October 2008 |archive-url=https://web.archive.org/web/20111013215157/http://www.independent.co.uk/arts-entertainment/music/features/jive-talkin-why-robin-gibb-wants-more-respect-for-the-bee-gees-826116.html |archive-date=13 October 2011}}</ref> The [[Brit Awards]] are the [[British Phonographic Industry|BPI]]'s annual music awards, and some of the British recipients of the [[Brit Award for Outstanding Contribution to Music|Outstanding Contribution to Music]] award include [[the Who]], [[David Bowie]], [[Eric Clapton]], [[Rod Stewart]], [[the Police]] and [[Fleetwood Mac]] (who are a British-American band).<ref>[https://www.theguardian.com/news/datablog/2012/feb/22/brit-awards-winners-list-2012 "Brit awards winners list 2012: every winner since 1977"]. ''The Guardian'' (London). Retrieved 28 February 2012.</ref> <!-- Please note that the following list of recent musicians and groups includes only those selling more than 30 million records. -->More recent UK music acts that have had international success include [[George Michael]], [[Oasis (band)|Oasis]], [[Spice Girls]], [[Radiohead]], [[Coldplay]], [[Arctic Monkeys]], [[Robbie Williams]], [[Amy Winehouse]], [[Susan Boyle]], [[Adele]], [[Ed Sheeran]], [[Lewis Capaldi]], [[One Direction]], [[Harry Styles]] and [[Dua Lipa]].<ref>{{Cite web |date=12 January 2020 |title=Harry Styles Has Weathered the Post-Boy Band Storm Better Than Most |url=https://consequence.net/2020/01/harry-styles-solo-career/ |access-date=15 September 2020 |website=Consequence of Sound}}; {{Cite magazine |date=16 July 2020 |title=10 Years of One Direction: The Story of the World's Biggest Boy Band, Told With the Fans Who Made It Happen |magazine=Billboard |url=https://www.billboard.com/music/pop/one-direction-ten-year-anniversary-fan-interviews-9419436/ |access-date=15 September 2020}}; {{Cite news |last=Corner, Lewis |date=16 February 2012 |title=Adele, Coldplay biggest-selling UK artists worldwide in 2011 |work=Digital Spy |url=http://www.digitalspy.co.uk/music/news/a366130/adele-coldplay-biggest-selling-uk-artists-worldwide-in-2011.html |access-date=22 March 2012}}; {{Cite web |title=Ed Sheeran's career journey: From street busker to global superstar |url=https://planetradio.co.uk/hits-radio/entertainment/celebrity/ed-sheeran-career-timeline/ |access-date=7 January 2023 |website=PlanetRadio.co.uk |last=Magliola |first=Anna Sky |date=30 November 2022}}; {{Cite web |url=https://open.spotify.com/artist/6M2wZ9GZgrQXHCFfjv46we |title=Dua Lipa, 77.5M Monthly listeners |date=6 May 2024 |publisher=Spotify}}</ref> As of 2024 the UK is the world's [[List of largest music markets|third-largest music market]] behind the US and Japan,<ref>{{Cite web |last=Paine |first=Andre |date=10 September 2024 |title=IFPI report reveals EU risks falling behind in global market - UK still among top music exporters |url=https://www.musicweek.com/labels/read/ifpi-report-reveals-eu-risks-falling-behind-in-global-market-uk-still-among-top-music-exporters/090424 |access-date=17 November 2025 |website=[[Music Week]] |language=en}}</ref> and in 2021 was the second-largest exporter of music behind the US.<ref>{{Cite news |last=Savage |first=Mark |date=16 June 2021 |title=British music exports reach a record high |url=https://www.bbc.com/news/entertainment-arts-57486272 |access-date=17 November 2025 |work=[[BBC]] |language=en-GB}}</ref>
Many British cities are known for their music. Acts from Liverpool have had 54 UK chart number 1 hit singles, more per capita than any other city worldwide.<ref>{{Cite news |last=Hughes |first=Mark |date=14 January 2008 |title=A tale of two cities of culture: Liverpool vs Stavanger |work=Independent |location=London |url=https://www.independent.co.uk/news/uk/this-britain/a-tale-of-two-cities-of-culture-liverpool-vs-stavanger-770076.html?r=RSS |access-date=2 August 2009 |archive-url=https://web.archive.org/web/20180618175425/https://www.independent.co.uk/news/uk/this-britain/a-tale-of-two-cities-of-culture-liverpool-vs-stavanger-770076.html?r=RSS |archive-date=18 June 2018}}</ref> Glasgow's contribution was recognised in 2008 when it was named a [[City of Music (UNESCO)|City of Music]] by [[UNESCO]].<ref>{{Cite news |date=20 August 2008 |title=Glasgow gets city of music honour |work=BBC News |url=http://news.bbc.co.uk/1/hi/scotland/glasgow_and_west/7570915.stm |access-date=2 August 2009}}</ref> Manchester played a role in the spread of dance music such as [[acid house]], and from the mid-1990s, [[Britpop]]. London and Bristol are closely associated with the origins of [[electronic music]] sub-genres such as [[drum and bass]] and [[trip hop]].<ref>{{Cite web |title=Out of the melting pot: The origins and evolution of drum'n'bass |url=https://www.redbull.com/gb-en/history-of-drum-and-bass-music |access-date=1 August 2021 |website=Red Bull |date=25 June 2020}}</ref>
UK dance music traces its roots back to the black British [[Sound system (Jamaican)|Sound System Culture]] and the [[New Age travellers|New Age Traveller]] movement of the 60s and 70s,<ref>{{Cite web |date=3 August 2023 |title=Parties, protest and police: the neglected histories of UK dance music |url=https://www.dazeddigital.com/music/article/60511/1/ed-gillet-new-book-party-lines-politics-history-uk-dance-music-clubbing |access-date=27 February 2024 |website=Dazed}}</ref> it also has influences from the [[House music|Chicago House]] and [[Detroit techno|Detroit Techno]] scenes. In the late 1980s, dance music exploded with [[Rave]] culture mainly [[Acid House]] tracks which were made mainstream with novelty records (such as Smart E's [[Sesame's Treet]] and the Prodigy's [[Charly (song)|Charly]])<ref>{{Cite web |date=20 January 2001 |title=Rave |url=https://www.oxfordmusiconline.com/search?q=rave |access-date=27 February 2024 |website=Oxford Music Online}}</ref> and the [[Balearic beat|Balearic sound]] brought back from the Ibiza club scene. This led on to genres such as [[UK Garage]], [[Speed Garage]], [[Drum and bass]], [[Jungle music|Jungle]], [[Trance music|Trance]], and [[Dubstep]]. Influential UK dance acts past and present include [[808 State]], [[Orbital (band)|Orbital]], [[the Prodigy]], [[Underworld (band)|Underworld]], [[Roni Size]], [[Leftfield]], [[Massive Attack]], [[Groove Armada]], [[Fatboy Slim]], [[Faithless]], [[Basement Jaxx]], [[Chemical Brothers]], [[Disclosure (band)|Disclosure]], [[Calvin Harris]], and [[Fred Again]].<ref>{{Cite web |title=Mixmag's Greatest Dance Act of all Time Revealed |date=19 January 2012 |url=http://www.mixmag.net/words/news/mixmags-greatest-dance-act-revealed |archive-date=14 April 2012 |archive-url=https://web.archive.org/web/20120414045620/http://www.mixmag.net/words/news/mixmags-greatest-dance-act-revealed}};{{Cite web |date=26 February 2024 |title=Fred Again: who is the DJ who has thousands queuing for a 'secret rave' at the Sydney Opera House? |url=https://www.theguardian.com/music/2024/feb/27/fred-again-dj-sydney-opera-house-secret-show-tickets-sell-out-profile-bio-details |access-date=27 February 2024 |website=The Guardian}}</ref> Other influential UK DJs include [[Judge Jules]], [[Pete Tong]], [[Carl Cox]], [[Paul Oakenfold]], [[John Digweed]] and [[Sasha (dj)|Sasha]].<ref>{{Cite web |title=Top 100 DJs Poll results 2003 |url=http://djmag.com/top100chart.asp |archive-date=7 December 2003 |archive-url=https://web.archive.org/web/20031207071739/http://djmag.com/top100chart.asp}}</ref>
=== Cinema ===
{{Main|Cinema of the United Kingdom|Independent cinema in the United Kingdom}}
The United Kingdom has had a considerable influence on the history of the cinema. The British directors [[Alfred Hitchcock]], whose film ''[[Vertigo (film)|Vertigo]]'' is considered by some critics as the [[List of films considered the best|best film of all time]],<ref>{{Cite news |date=2 August 2012 |title=Vertigo is named 'greatest film of all time' |work=BBC News |url=https://www.bbc.co.uk/news/entertainment-arts-19078948 |access-date=18 August 2012}}</ref> and [[David Lean]], who directed ''[[Lawrence of Arabia (film)|Lawrence of Arabia]]'', are amongst the most critically acclaimed directors ever.<ref>{{Cite web |title=The Directors' Top Ten Directors |url=http://www.bfi.org.uk/sightandsound/topten/poll/directors-directors.html |url-status=dead |archive-url=https://web.archive.org/web/20120517155218/http://www.bfi.org.uk/sightandsound/topten/poll/directors-directors.html |archive-date=17 May 2012 |publisher=British Film Institute}}</ref> Recent popular directors include [[Christopher Nolan]], [[Sam Mendes]], [[Steve McQueen (director)|Steve McQueen]], [[Richard Curtis]], [[Danny Boyle]], [[Tony Scott]] and [[Ridley Scott]].<ref>{{Cite web |title=The 24 Best British Directors of All Time |date=13 May 2023 |url=https://movieweb.com/best-british-directors-of-all-time/ |access-date=17 February 2024 |publisher=Movieweb}}</ref><ref>{{Cite web |title=Top 22 U.K. Film Directors |url=https://www.imdb.com/list/ls062383258/ |access-date=17 February 2024 |publisher=IMDb}}</ref><ref>{{Cite web |title=5 of the best ... Richard Curtis films |url=https://www.thetimes.com/culture/tv-radio/article/5-of-the-best-richard-curtis-films-tzxx9fv2h |work=The Times |access-date=4 June 2024 |date=17 April 2024}}</ref><ref>{{Cite web |title=The UK's top 50 film directors |date=23 May 2012 |url=https://www.televisual.com/news/the-uk-s-top-50-film-directors_bid-357/ |access-date=17 February 2024 |publisher=Televisual}}</ref> Many British actors have achieved international fame and critical success. Some of the most commercially successful films have been produced in the United Kingdom, including two of the [[List of highest-grossing film series|highest-grossing film franchises]] (''[[Harry Potter (film series)|Harry Potter]]'' and ''[[James Bond (film series)|James Bond]]'').<ref>{{Cite news |date=11 September 2007 |title=Harry Potter becomes highest-grossing film franchise |work=The Guardian |location=London |url=https://www.theguardian.com/film/2007/sep/11/jkjoannekathleenrowling |access-date=2 November 2010}}</ref>
2019 was a particularly good year for British films which grossed around £10.3 billion globally, accounting for 28.7 per cent of global box office revenue.<ref>{{Cite web |title=UK Film Industry Statistics 2023 |date=10 April 2023 |url=https://www.socialfilms.co.uk/blog/uk-film-industry-statistics |archive-url=https://web.archive.org/web/20240217211749/https://www.socialfilms.co.uk/blog/uk-film-industry-statistics |archive-date=17 February 2024 |access-date=17 February 2024}}</ref> UK box-office takings totalled £1.25 billion in 2019, with around 176 million admissions.<ref>{{Cite web |title=The UK box office in 2019 |url=https://www2.bfi.org.uk/sites/bfi.org.uk/files/downloads/bfi-uk-box-office-2019.pdf |archive-url=https://web.archive.org/web/20240217214846/https://www2.bfi.org.uk/sites/bfi.org.uk/files/downloads/bfi-uk-box-office-2019.pdf |archive-date=17 February 2024 |access-date=17 February 2024}}</ref> In 2023 UK film and television studio stage space stood at 6.9 million sq ft, with 1 million sq ft added in the past year with more in development.<ref>{{Cite web |title=UK Film and Television Studios Market Report |url=https://content.knightfrank.com/research/2439/documents/en/uk-film-and-television-studios-market-2023-10567.pdf |access-date=17 February 2024 |publisher=Knight Frank}}</ref> The annual [[British Academy Film Awards|BAFTA Film Awards]] are hosted by the [[British Academy of Film and Television Arts]].<ref>{{Cite news |date=26 February 2001 |title=Baftas fuel Oscars race |work=BBC News |url=http://news.bbc.co.uk/1/hi/entertainment/1190562.stm |access-date=14 February 2011}}</ref>
=== Cuisine ===
{{Main|British cuisine}}
{{Further|English cuisine|Scottish cuisine|Welsh cuisine|Northern Irish cuisine}}
[[File:Fish, chips and mushy peas.jpg|thumb|[[Fish and chips]], a traditional British dish, served with lemon, tartar sauce and mushy peas]]
British cuisine developed from influences reflective of its land, settlements, [[Immigration to the United Kingdom|arrivals of new settlers and immigrants]], trade and colonialism. The food of England has historically been characterised by simplicity of approach and a reliance on the high quality of natural produce.<ref>{{Cite book |last=Else |first=David |title=Inghilterra |publisher=EDT srl |date=2007 |isbn=978-88-6040-136-6 |page=76}}</ref> The traditional [[Sunday roast]] is one example, featuring a [[roasting|roast joint]] (usually of beef), lamb, chicken, or pork, often [[free range]] (and generally grass-fed, in the case of beef). Roasts are served with either roasted or boiled vegetables, [[Yorkshire pudding]] and [[gravy]]. Other traditional meals include [[meat pie]]s and [[stew]]s. A poll by [[YouGov]] in 2019 rated classic British food, with more than 80 per cent liking the Sunday roast, Yorkshire pudding, [[fish and chips]], [[crumpet]]s and the [[full English breakfast]].<ref>{{Cite web |url=https://yougov.co.uk/topics/consumer/articles-reports/2019/06/12/classic-british-cuisine-ranked-britons |date=11 June 2019 |title=Classic British cuisine ranked by Britons }}{{Dead link|date=May 2026 |bot=InternetArchiveBot }}</ref>
The UK is home to a large selection of [[fine dining]]. The nation hosts multiple restaurant guides such as ''[[The Good Food Guide]]'' and ''[[Harden's]]''. In 2025 there were 197 restaurants with a [[Michelin Star]]; [[List of Michelin 3-star restaurants in the United Kingdom|ten of which have received a three-star rating]].<ref>{{cite web |url=https://guide.michelin.com/en/gb/restaurants/all-starred |title=United Kingdom |publisher=Michelin Guide |access-date=12 May 2025}}</ref> Sweet foods are common within British cuisine, and there is a long list of [[List of British desserts|British desserts]]. Afternoon tea is a light afternoon meal served with tea in tea rooms and hotels around the United Kingdom, with the tradition dating back to around 1840.<ref>{{Cite web |title=The tea-rific history of Victorian afternoon tea |work=The British Museum |url=https://www.britishmuseum.org/blog/tea-rific-history-victorian-afternoon-tea |access-date=11 April 2023}}</ref> A poll from July 2024 revealed that 3 per cent of the UK population follow a [[vegan]] diet, 6 per cent are [[vegetarian]], and 13 per cent identify as [[flexitarian]] (following a mainly vegetarian diet).<ref>{{Cite web |title=Dietary choices of Brits (e.g. vegeterian, flexitarian, meat-eater etc) |url=https://yougov.co.uk/topics/society/trackers/dietery-choices-of-brits-eg-vegeterian-flexitarian-meat-eater-etc |access-date=26 November 2024 |date=8 July 2024 |website=YouGov.co.uk}}</ref> The British Empire facilitated knowledge of [[Indian cuisine]] with its "strong, penetrating spices and herbs". British cuisine has absorbed the cultural influence of those who have settled in Britain, producing hybrid dishes, such as [[chicken tikka masala]].<ref>{{Cite news |date=19 April 2001 |title=Robin Cook's chicken tikka masala speech |work=The Guardian |location=London |url=https://www.theguardian.com/world/2001/apr/19/race.britishidentity |access-date=7 September 2021}}; {{Cite news |last=BBC E-Cyclopedia |date=20 April 2001 |title=Chicken tikka masala: Spice and easy does it |publisher=BBC |url=http://news.bbc.co.uk/1/hi/special_report/1999/02/99/e-cyclopedia/1285804.stm |access-date=28 September 2007}}</ref>
The UK has many [[gastropub]]s and is the birthplace of many alcoholic drinks including several beer styles such as [[pale ale]], [[India pale ale]], [[bitter (beer)|bitter]], [[brown ale]], [[porter (beer)|porter]], and [[stout]]. The number of [[craft beer]]s and microbreweries has expanded rapidly in the last two decades.<ref>{{Cite web |title=A guide to British Beer |url=https://www.expatica.com/uk/lifestyle/food-drink/british-beer-469903/ |access-date=25 November 2024 |website=Expatica}}</ref> Other popular alcoholic drinks produced in the UK include [[Scotch whisky]], [[Wine from the United Kingdom|English wine]], [[gin]], [[perry]] and [[cider]].
=== Sport ===
{{Main|Sport in the United Kingdom|Great Britain at the Olympics}}
{{Further|Sport in England|Sport in Scotland|Sport in Wales|Sport in Northern Ireland}}
[[File:City vs United FA Cup final 2023.jpg|thumb|right|The [[2023 FA Cup final]] at [[Wembley Stadium]] between [[Manchester City]] and [[Manchester United]]]]
[[File:Old 18th tee lr.jpg|thumb|right|Golf originated from the [[Old Course at St Andrews]] in Scotland.]]
[[Association football]], [[tennis]], [[table tennis]], [[badminton]], [[rugby union]], [[rugby league]], [[rugby sevens]], [[golf]], [[boxing]], [[netball]], [[water polo]], [[field hockey]], [[English billiards|billiards]], [[darts]], [[Rowing (sport)|rowing]], [[rounders]] and [[cricket]] originated or were substantially developed in the UK, with the rules and codes of many modern sports invented and codified in the Victorian era.{{efn|In 2012, the president of the IOC, [[Jacques Rogge]], stated, "This great, sports-loving country is widely recognised as the birthplace of modern sport. It was here that the concepts of sportsmanship and fair play were first codified into clear rules and regulations. It was here that sport was included as an educational tool in the school curriculum."<ref>{{Cite web |url=http://www.olympic.org/Documents/Games_London_2012/London_2012_Opening_ceremony_Speech_Jacques_Rogge.pdf |title=Opening Ceremony of the Games of the XXX Olympiad |website=Olympic.org |access-date=30 November 2013 |date=27 July 2012 |archive-date=19 August 2013 |archive-url=https://web.archive.org/web/20130819135346/http://www.olympic.org/Documents/Games_London_2012/London_2012_Opening_ceremony_Speech_Jacques_Rogge.pdf |url-status=dead}}</ref><ref>{{Cite web |url=http://uk.reuters.com/article/uk-oly-preview-ad-idUKBRE86M0I720120723 |title=Unparalleled Sporting History |work=Reuters |access-date=30 November 2013 |last=Mehaffey |first=John |location=London |archive-date=25 May 2017 |archive-url=https://web.archive.org/web/20170525164121/http://uk.reuters.com/article/uk-oly-preview-ad-idUKBRE86M0I720120723 |url-status=dead}}</ref>}}
A poll in 2003 found that football is the most popular sport in the UK.<ref name="sports poll">{{Cite web |date=22 December 2003 |title=Rugby Union 'Britain's Second Most Popular Sport' |url=http://www.ipsos-mori.com/researchpublications/researcharchive/928/Rugby-Union-Britains-Second-Most-Popular-Sport.aspx |access-date=28 April 2013 |publisher=Ipsos-Mori}}</ref> England is recognised by [[FIFA]] as the birthplace of club football, and the [[Football Association]] is the oldest of its kind, with the [[Laws of the Game (association football)|rules of football]] first drafted in 1863 by [[Ebenezer Cobb Morley]].<ref>{{Cite news |last=Rudd |first=Alyson |date=7 April 2008 |title=The father of football deserves much more |work=The Times |location=London |url=http://www.timesonline.co.uk/tol/sport/football/article3694775.ece |url-access=subscription |access-date=29 January 2015 |archive-date=4 June 2011 |archive-url=https://web.archive.org/web/20110604183514/http://www.timesonline.co.uk/tol/sport/football/article3694775.ece |url-status=dead}}; {{Cite web |date=24 October 2007 |title=Sheffield FC: 150 years of history |url=https://www.fifa.com/worldfootball/clubfootball/news/newsid=621801.html |archive-url=https://web.archive.org/web/20071025033006/http://www.fifa.com/worldfootball/clubfootball/news/newsid=621801.html |archive-date=25 October 2007 |access-date=29 January 2015 |publisher=[[FIFA]]}}</ref> Each of the [[Home Nations]] (England, Scotland, Wales and Northern Ireland) has its own football association, national team and [[league system]], and each is individually a governing member of the [[International Football Association Board]] alongside FIFA. The English top division, the [[Premier League]], is the most watched football league in the world.<ref>{{Cite news |last=Ebner |first=Sarah |date=2 July 2013 |title=History and time are key to power of football, says Premier League chief |work=The Times |location=London |url=http://www.thetimes.co.uk/tto/public/ceo-summit/article3804923.ece |url-access=subscription |access-date=30 November 2013}}</ref> The first international football match was contested by [[England national football team|England]] and [[Scotland national football team|Scotland]] on 30 November 1872.<ref>{{Cite web |last=Mitchell, Paul |author-link=Paul Mitchell (broadcaster) |date=November 2005 |title=The first international football match |url=https://www.bbc.co.uk/scotland/sportscotland/asportingnation/article/0012/index.shtml |access-date=15 December 2013 |publisher=BBC Sport Scotland}}</ref> England, Scotland, [[Wales national football team|Wales]] and [[Northern Ireland national football team|Northern Ireland]] usually compete as separate countries in international competitions.<ref>{{Cite news |last=Harlow |first=Phil |date=5 August 2008 |title=Why is there no GB Olympics football team? |work=[[BBC Sport]] |url=http://news.bbc.co.uk/sport1/hi/olympics/football/7529807.stm |access-date=31 December 2010}}</ref>
In 2003 rugby union was ranked the second-most-popular sport in the UK.<ref name="sports poll" /> The sport was created in [[Rugby School]], Warwickshire, and the [[1871 England versus Scotland rugby union match|first rugby international]] took place on 27 March 1871 between [[England national rugby union team|England]] and [[Scotland national rugby union team|Scotland]].<ref>{{Cite web |url=https://www.bbc.co.uk/news/uk-england-coventry-warwickshire-25946757 |title=Six ways the town of Rugby helped change the world |work=BBC News |access-date=29 January 2015 |date=1 February 2014}}</ref><ref>{{Cite book |last1=Godwin |first1=Terry |last2=Rhys |first2=Chris |year=1981 |title=The Guinness Book of Rugby Facts & Feats |page=10 |publisher=Guinness Superlatives |isbn=978-0-85112-214-4}}</ref> England, Scotland, [[Wales national rugby union team|Wales]], [[Ireland national rugby union team|Ireland]], [[France national rugby union team|France]] and [[Italy national rugby union team|Italy]] compete in the [[Six Nations Championship]], the premier international rugby union tournament in the northern hemisphere. [[Sports governing bodies]] in [[Rugby union in England|England]], [[Rugby union in Scotland|Scotland]], [[Rugby union in Wales|Wales]] and [[Rugby union in Ireland|Ireland]] organise and regulate the game separately.<ref>{{Cite book |last1=Louw, Jaco |url=https://books.google.com/books?id=0-IiowvNomMC&pg=PA95 |title=The Girlfriends Guide to Rugby |last2=Nesbit, Derrick |publisher=South Publishers |year=2008 |isbn=978-0-620-39541-0 |location=Johannesburg}}</ref> Every four years the Home Nations make a combined team known as the [[British and Irish Lions]] which tours Australia, New Zealand and South Africa.
The United Kingdom hosted the [[Summer Olympic Games]] in [[1908 Summer Olympics|1908]], [[1948 Summer Olympics|1948]] and [[2012 Summer Olympics|2012]], with London acting as the host city on all three occasions. Birmingham hosted the [[2022 Commonwealth Games]], the seventh time a country of the United Kingdom hosted the [[Commonwealth Games]] (England, Scotland and Wales have each hosted the Commonwealth Games at least once).<ref>{{Cite news |title=The journey of India in Commonwealth Games in 2022 |work=The Times of India |url=https://timesofindia.indiatimes.com/readersblog/allaboutsports/the-journey-of-india-in-commonwealth-games-in-2022-44477/ |access-date=29 June 2023}}</ref>
=== Symbols ===
{{Main|Symbols of the United Kingdom, the Channel Islands and the Isle of Man|l1 = Symbols of the United Kingdom}}
[[File:Queen Elizabeth II Platinum Jubilee 2022 - Platinum Pageant (52123378222).jpg|thumb|Union Jack flags on [[The Mall, London|The Mall]], London]]
The [[flag of the United Kingdom]] is the [[Union Flag]], which is also referred to as the Union Jack.<ref>{{Cite web |title=Union Jack or Union Flag? |url=https://www.flaginstitute.org/wp/uk-flags/the-union-jack-or-the-union-flag |access-date=26 September 2022 |website=The Flag Institute}}</ref> It was created in 1606 by the superimposition of the [[flag of England]], representing [[Saint George]], on the [[flag of Scotland]], representing [[Saint Andrew]], and was updated in 1801 with the addition of [[Saint Patrick's Flag]].<ref>{{Cite web |title=college-of-arms.gov.uk |url=https://www.college-of-arms.gov.uk/resources/union-flag-approved-designs |access-date=14 January 2022 |publisher=The College of Arms}}</ref> Wales is not represented in the Union Flag, as Wales had been conquered and [[annexed]] to England prior to the formation of the United Kingdom. The possibility of redesigning the Union Flag to include representation of Wales was discussed in 2007.<ref>{{Cite news |date=27 November 2007 |title=Welsh dragon call for Union flag |work=BBC News |url=http://news.bbc.co.uk/1/hi/uk/7114248.stm |access-date=17 October 2008}}</ref> The [[national anthem]] of the United Kingdom is "[[God Save the King]]", with "King" replaced with "Queen" in the lyrics whenever the monarch is a woman.
[[National symbols of England|England]], [[National symbols of Wales|Wales]] and [[National symbols of Scotland|Scotland]] each have their own national symbols, including their national flags. [[National symbols of Northern Ireland|Northern Ireland]] also has symbols, [[National symbols of Ireland, the Republic of Ireland and Northern Ireland|many of which are shared]] with the [[Republic of Ireland]], but has no official flag<ref name="minahan">{{cite book |last=Minahan |first=James |url=https://books.google.com/books?id=jfrWCQAAQBAJ |title=The Complete Guide to National Symbols and Emblems |publisher=ABC-CLIO |year=2009 |isbn=9780313344978 |page=486 |quote=The official flag of the province is the Union Flag. There is no official national flag of Northern Ireland, following the Northern Ireland Constitution Act of 1973, nor any unofficial flag universally accepted in Northern Ireland. |access-date=23 September 2020 |archive-url=https://web.archive.org/web/20241203090220/https://books.google.com/books?id=jfrWCQAAQBAJ |archive-date=3 December 2024 |url-status=live}}</ref>. Beside [[the Lion and the Unicorn]] and the [[Welsh Dragon]] of heraldry, the [[bulldog]] is also used and commonly represented with the Union Flag.<ref>{{Cite book |last=Baker |first=Steve |title=Picturing the Beast |publisher=University of Illinois Press |year=2001 |isbn=978-0-252-07030-3 |page=52}}</ref> Great Britain, rather than the United Kingdom as a whole, also has [[national personification|personifications]] representing it, two of which are [[Britannia]]<ref>{{Cite web |title=Britannia on British Coins |url=http://www.24carat.co.uk/britanniaframe.html |access-date=25 June 2006 |publisher=Chard}}</ref><ref name="Collins">{{cite dictionary|url=https://www.collinsdictionary.com/dictionary/english/britannia|dictionary=Collins Dictionary|title=Britannia|accessdate=14 February 2021}}</ref> and [[John Bull]].<ref>{{Cite web |last=<!--Not stated--> |title=Who is John Bull |url=https://www.loc.gov/wiseguide/jan04/johnbull.html |access-date=11 January 2022 |publisher=The Library of Congress}}</ref>
== See also ==
{{Portal|United Kingdom|England|Northern Ireland|Scotland|Wales}}
* [[Outline of the United Kingdom]]
** [[Outline of England]]
** [[Outline of Northern Ireland]]
** [[Outline of Scotland]]
** [[Outline of Wales]]
* [[Historiography of the United Kingdom]]
== Notes ==
{{Notelist}}
== References ==
{{Reflist}}
== External links ==
{{Sister project links|auto=yes}}
* [https://www.bbc.co.uk/news/world-europe-18023389 United Kingdom] from [[BBC News]]
* [https://web.archive.org/web/20260118175542/https://www.cia.gov/the-world-factbook/countries/united-kingdom/ United Kingdom]. ''[[The World Factbook]]''. [[Central Intelligence Agency]].
* [https://web.archive.org/web/20090406224510/http://ucblibraries.colorado.edu/govpubs/for/british.htm United Kingdom] from ''UCB Libraries GovPubs'' (archived 6 April 2009)
* {{Wikiatlas|United Kingdom}}
* {{OSM relation|62149}}
* [http://www.ifs.du.edu/ifs/frm_CountryProfile.aspx?Country=GB Key Development Forecasts for the United Kingdom] from [[International Futures]]
=== Government ===
* [https://www.gov.uk/ Official website of HM Government]
* [https://www.royal.uk/ Official website of the British Monarchy]
* [https://www.gov.uk/government/organisations/prime-ministers-office-10-downing-street Official website of the British Prime Minister's Office]
=== Travel ===
* [http://www.visitbritain.com/en/ Official tourist guide to Britain]
<!-- Please discuss links on the talk page before adding them to this list – remember to read the WP:EL guideline.-->
{{United Kingdom topics}}
{{Navboxes
| list =
{{United Kingdom constituents and affiliations}}
{{British Isles}}
{{Sovereign states of Europe}}
{{Commonwealth realms}}
{{English official language clickable map}}
{{The Commonwealth}}
}}
{{Authority control}}
{{Coord|55|N|3|W|type:country_region:GB|display=title}}
[[Category:United Kingdom| ]]
[[Category:British Islands]]
[[Category:Countries in Europe]]
[[Category:Countries and territories where English is an official language]]
[[Category:G20 members]]
[[Category:Island countries]]
[[Category:Member states of NATO]]
[[Category:Member states of the Commonwealth of Nations]]
[[Category:Member states of the Council of Europe]]
[[Category:Member states of the United Nations]]
[[Category:OECD members]]
[[Category:States and territories established in 1707]]
[[Category:States and territories established in 1801]]
[[Category:States and territories established in 1922]]
rroytc0k94zjpuyz1nelpaugut572su
Mercury
0
3742
22001
2026-09-10T17:28:22Z
Swpb
702
(AWB) dab cleanup+style sync per [[WP:DDD]] etc.
22001
wikitext
text/x-wiki
{{wiktionary|Mercury|mercury}}
'''Mercury''' most commonly refers to:
* [[Mercury (planet)]], the closest planet to the Sun
* [[Mercury (element)]], a chemical element
* [[Mercury (mythology)]], a Roman deity
'''Mercury''' or '''The Mercury''' may also refer to:
{{tocright}}
== Companies ==
* [[Mercury (toy manufacturer)]], a brand of diecast toy cars manufactured in Italy
* [[Mercury Communications]], a British telecommunications firm set up in the 1980s
* [[Mercury Corporation]], an American aircraft manufacturer
* [[Mercury Cyclecar Company]], a defunct American car company
* [[Mercury Drug]], a Philippine pharmacy chain
* [[Mercury Energy]], an electricity generation and retail company in New Zealand
* [[Mercury Filmworks]], a Canadian independent animation studio
* [[Mercury General]], a multiple-line American insurance organization
* [[Mercury Interactive]], a software testing tools vendor
* [[The Mercury Mall]], a shopping centre in Romford, England
* [[Mercury Marine]], a manufacturer of marine engines, particularly outboard motors
* [[Mercury Technologies]], a financial technology company
* [[Mercury Truck & Tractor Company]], a defunct English manufacturer of industrial vehicles
* Shenzhen Mercury Communication Technology Co., Ltd., a Chinese market subsidiary of [[TP-Link]]
== Computing ==
* [[Mercury (programming language)]], a functional logic programming language
* [[Mercury (metadata search system)]], a data search system for earth science research
* [[Ferranti Mercury]], an early 1950s commercial computer
* [[Mercury Browser]], a freeware mobile browser
* [[Mercury Mail Transport System]], an email server
== Film and television ==
* [[Mercury (film)|''Mercury'' (film)]], a 2018 Indian silent horror thriller by Karthik Subbaraj
* [[Mercury (TV series)|''Mercury'' (TV series)]], an Australian television series
* [[List of RWBY characters#Mercury Black|Mercury Black]], a character in the ''RWBY'' web series
* [[Sailor Mercury]], a character in the ''Sailor Moon'' manga and anime franchise
==Literature==
===Comics===
* [[Mercury (Marvel Comics)]], a character who can turn herself into a mercurial substance
* [[Makkari (character)]] or Mercury, an Eternal, a Marvel Comics race of superhumans
* Mercury, a member of the [[Metal Men]], a DC Comics team
* Mercury, a member of [[Cerebro's X-Men]]
* Mercury, an [[List of Amalgam Comics characters#JLX #1|Amalgam Comics character]]
===Magazines===
* [[Mercury (magazine)|''Mercury'' (magazine)]], an astronomy magazine
* ''[[The American Mercury]]'', originally a literary and later political magazine
===<span class="anchor" id="papers"></span>Newspapers===
<!--Only ones whose full title is "Mercury" or "The Mercury"-->
* [[The Mercury (Hobart)|''The Mercury'' (Hobart)]], Hobart, Tasmania, Australia
* [[The Mercury (South Africa)|''The Mercury'' (South Africa)]], Durban, South Africa
* [[The Mercury (Pennsylvania)|''The Mercury'' (Pennsylvania)]], Pottstown, Pennsylvania
* ''[[Newport Mercury]]'', a defunct newspaper, Newport, Rhode Island
* ''The Mercury'', former name of the now-defunct ''[[Reading Mercury]]'', Reading, Berkshire, England
* ''[[The Mercury News]]'', San Jose, California
* [[List of newspapers named Mercury|List of newspapers named ''Mercury'']], for newspapers with titles including the word "Mercury"
===Novels===
* [[Mercury (Bova novel)|''Mercury'' (Bova novel)]], by Ben Bova
* [[Mercury (Livesey novel)|''Mercury'' (Livesey novel)]], by Margot Livesey
* ''Mercury'', a novel by [[Anna Kavan]]
==Music==
===Albums===
* [[Mercury (American Music Club album)|''Mercury'' (American Music Club album)]] (1993)
* [[Mercury (Longview album)|''Mercury'' (Longview album)]] (2003)
* [[Mercury (Madder Mortem album)|''Mercury'' (Madder Mortem album)]] (1999)
* ''[[Mercury – Act 1]]'' (2021), by Imagine Dragons
* ''[[Mercury – Act 2|Mercury – Acts 1 & 2]]'' (2022), by Imagine Dragons
===Songs===
* [[Mercury (song)|"Mercury" (song)]], 2008, by Bloc Party
* "Mercury", a song by Counting Crows from ''[[Recovering the Satellites]]''
* "Mercury", a song by Kathleen Edwards from ''[[Failer]]''
* "Mercury", a song by Sufjan Stevens, Bryce Dessner, Nico Muhly and James McAlister from ''[[Planetarium (album)|Planetarium]]''
* "Mercury", a song by Steve Lacy from ''[[Gemini Rights]]''
===Other music===
* [[Mercury Nashville]], a record label
* [[Mercury Records]], a record label
* [[Mercury Prize]], an annual music prize awarded for the best album from the UK
* "[[Mercury, the Winged Messenger]]", a movement in Gustav Holst's ''The Planets''
==Military==
* [[Operation Mercury]], codename for the German invasion of Crete during World War II
* [[Boeing E-6 Mercury]], an American aircraft used as an airborne command post and communications relay
* [[Miles Mercury]], a British aircraft designed during the Second World War
* {{HMS|Mercury}}, various vessels or shore establishments of that name
* {{USS|Mercury}}, seven vessels of that name
* {{ship|Russian brig|Mercury}}, an 1820 warship
* [[Mercury (pigeon)]], honored for bravery during World War II
==Places==
===United States===
* Mercury, a [[List of places in Alabama: I–M#M|place in Alabama]]
* [[Mercury, Nevada]], a closed city within the Nevada Test Site
* [[Mercury, Texas]], an unincorporated community
===Elsewhere===
* [[Mercury, Savoie]], a commune in southeastern France
* [[Mercury Bay]], New Zealand
== Plants ==
* [[Mercury (plant)]], members of the plant genus ''Mercurialis''
* [[Annual mercury]] (''Mercurialis annua''), a species of flowering plant
* [[English Mercury|English mercury]], or mercury goosefoot (''Blitum bonus-henricus''), a species of goosefoot
== Radio ==
* [[Mercury FM]], a radio station in Surrey, UK
* [[Mercury 96.6]] or Heart Hertfordshire, a radio station in Hertfordshire, UK
==Sports==
* [[Edmonton Mercurys]], a Canadian 1940s and 1950s intermediate ice hockey team
* [[Fujita Soccer Club Mercury]], a Japanese women's football team active from 1989 to 1999
* [[Memphis Mercury]], American women's soccer team
* [[Phoenix Mercury]], a Women's National Basketball Association team from Arizona
* [[Toledo Mercurys]], a defunct International Hockey League franchise from Ohio
==Theatres==
* [[Mercury Cinema]], a theatre in Adelaide, Australia
* [[Mercury Theatre (disambiguation)]], a list of Mercury theatres
==Vehicles==
===Air===
* [[Blackburn Mercury]], a British aircraft from 1911
* [[Bristol Mercury]], a nine-cylinder aircraft engine
===Land===
* [[Mercury (automobile)]], a brand of automobiles produced by the Ford Motor Company from 1938 to 2011
* [[Mercury (cyclecar)]], an American cyclecar from 1914
* [[Mercury (train)|''Mercury'' (train)]], a family of New York Central streamliner passenger trains (1936–1958)
===Sea===
* {{ship||Mercury|ship}}, several ships of that name
* [[Cape Cod Mercury 15]], an American sailboat design
* [[Mercury 18]], an American sailboat design
===Space===
* [[Project Mercury]], a US human spaceflight program, 1958–1963
* [[Mercury (satellite)]], a series of American spy satellites
== Other uses ==
* [[Mercury (name)]], including a list of people with the surname, given name or nickname
* [[Mercury Boulevard]], in the cities of Hampton and Newport News, Virginia, US
* [[Mercury (cipher machine)]], a 1950s British cipher machine
* ''[[Archer Maclean's Mercury]]'', a 2005 PlayStation Portable video game
* [[Shuttle America]]'s callsign
==See also==
{{Commons|mercury}}
* {{look from}}
* ''[[The American Mercury]]'', an American magazine published from 1924 to 1981
* [[Mercure (disambiguation)]]
* [[Mercuri]], a surname and list of people with the surname
* [[Mercurius (disambiguation)]]
* [[Mercury 1 (disambiguation)]]
* [[Mercury 2 (disambiguation)]]
* [[Mercury 3 (disambiguation)]]
* [[Mercury 4 (disambiguation)]]
* [[Mercury 5 (disambiguation)]]
* [[Mercury 6 (disambiguation)]]
* [[Mercury 7 (disambiguation)]]
* [[Mercury 8 (disambiguation)]]
* [[Mercury City (disambiguation)]]
* [[Mercury FM (disambiguation)]]
* [[Mercury House (disambiguation)]]
* [[Mercury mission (disambiguation)]]
* [[Mercury program (disambiguation)]]
* [[Mercury project (disambiguation)]]
* {{in title|Mercury}}
{{disambiguation cleanup|geo|ships|date=September 2026}}<!--May require further organization; see [[WP:LONGDAB]]-->
0m202b5xg9g967gxp8nkxqaa3bkk2iv
22002
22001
2026-09-18T15:20:21Z
Amire80
9
1 измена увезена из [[:en:Mercury]]: importing from the English Wikipedia
22001
wikitext
text/x-wiki
{{wiktionary|Mercury|mercury}}
'''Mercury''' most commonly refers to:
* [[Mercury (planet)]], the closest planet to the Sun
* [[Mercury (element)]], a chemical element
* [[Mercury (mythology)]], a Roman deity
'''Mercury''' or '''The Mercury''' may also refer to:
{{tocright}}
== Companies ==
* [[Mercury (toy manufacturer)]], a brand of diecast toy cars manufactured in Italy
* [[Mercury Communications]], a British telecommunications firm set up in the 1980s
* [[Mercury Corporation]], an American aircraft manufacturer
* [[Mercury Cyclecar Company]], a defunct American car company
* [[Mercury Drug]], a Philippine pharmacy chain
* [[Mercury Energy]], an electricity generation and retail company in New Zealand
* [[Mercury Filmworks]], a Canadian independent animation studio
* [[Mercury General]], a multiple-line American insurance organization
* [[Mercury Interactive]], a software testing tools vendor
* [[The Mercury Mall]], a shopping centre in Romford, England
* [[Mercury Marine]], a manufacturer of marine engines, particularly outboard motors
* [[Mercury Technologies]], a financial technology company
* [[Mercury Truck & Tractor Company]], a defunct English manufacturer of industrial vehicles
* Shenzhen Mercury Communication Technology Co., Ltd., a Chinese market subsidiary of [[TP-Link]]
== Computing ==
* [[Mercury (programming language)]], a functional logic programming language
* [[Mercury (metadata search system)]], a data search system for earth science research
* [[Ferranti Mercury]], an early 1950s commercial computer
* [[Mercury Browser]], a freeware mobile browser
* [[Mercury Mail Transport System]], an email server
== Film and television ==
* [[Mercury (film)|''Mercury'' (film)]], a 2018 Indian silent horror thriller by Karthik Subbaraj
* [[Mercury (TV series)|''Mercury'' (TV series)]], an Australian television series
* [[List of RWBY characters#Mercury Black|Mercury Black]], a character in the ''RWBY'' web series
* [[Sailor Mercury]], a character in the ''Sailor Moon'' manga and anime franchise
==Literature==
===Comics===
* [[Mercury (Marvel Comics)]], a character who can turn herself into a mercurial substance
* [[Makkari (character)]] or Mercury, an Eternal, a Marvel Comics race of superhumans
* Mercury, a member of the [[Metal Men]], a DC Comics team
* Mercury, a member of [[Cerebro's X-Men]]
* Mercury, an [[List of Amalgam Comics characters#JLX #1|Amalgam Comics character]]
===Magazines===
* [[Mercury (magazine)|''Mercury'' (magazine)]], an astronomy magazine
* ''[[The American Mercury]]'', originally a literary and later political magazine
===<span class="anchor" id="papers"></span>Newspapers===
<!--Only ones whose full title is "Mercury" or "The Mercury"-->
* [[The Mercury (Hobart)|''The Mercury'' (Hobart)]], Hobart, Tasmania, Australia
* [[The Mercury (South Africa)|''The Mercury'' (South Africa)]], Durban, South Africa
* [[The Mercury (Pennsylvania)|''The Mercury'' (Pennsylvania)]], Pottstown, Pennsylvania
* ''[[Newport Mercury]]'', a defunct newspaper, Newport, Rhode Island
* ''The Mercury'', former name of the now-defunct ''[[Reading Mercury]]'', Reading, Berkshire, England
* ''[[The Mercury News]]'', San Jose, California
* [[List of newspapers named Mercury|List of newspapers named ''Mercury'']], for newspapers with titles including the word "Mercury"
===Novels===
* [[Mercury (Bova novel)|''Mercury'' (Bova novel)]], by Ben Bova
* [[Mercury (Livesey novel)|''Mercury'' (Livesey novel)]], by Margot Livesey
* ''Mercury'', a novel by [[Anna Kavan]]
==Music==
===Albums===
* [[Mercury (American Music Club album)|''Mercury'' (American Music Club album)]] (1993)
* [[Mercury (Longview album)|''Mercury'' (Longview album)]] (2003)
* [[Mercury (Madder Mortem album)|''Mercury'' (Madder Mortem album)]] (1999)
* ''[[Mercury – Act 1]]'' (2021), by Imagine Dragons
* ''[[Mercury – Act 2|Mercury – Acts 1 & 2]]'' (2022), by Imagine Dragons
===Songs===
* [[Mercury (song)|"Mercury" (song)]], 2008, by Bloc Party
* "Mercury", a song by Counting Crows from ''[[Recovering the Satellites]]''
* "Mercury", a song by Kathleen Edwards from ''[[Failer]]''
* "Mercury", a song by Sufjan Stevens, Bryce Dessner, Nico Muhly and James McAlister from ''[[Planetarium (album)|Planetarium]]''
* "Mercury", a song by Steve Lacy from ''[[Gemini Rights]]''
===Other music===
* [[Mercury Nashville]], a record label
* [[Mercury Records]], a record label
* [[Mercury Prize]], an annual music prize awarded for the best album from the UK
* "[[Mercury, the Winged Messenger]]", a movement in Gustav Holst's ''The Planets''
==Military==
* [[Operation Mercury]], codename for the German invasion of Crete during World War II
* [[Boeing E-6 Mercury]], an American aircraft used as an airborne command post and communications relay
* [[Miles Mercury]], a British aircraft designed during the Second World War
* {{HMS|Mercury}}, various vessels or shore establishments of that name
* {{USS|Mercury}}, seven vessels of that name
* {{ship|Russian brig|Mercury}}, an 1820 warship
* [[Mercury (pigeon)]], honored for bravery during World War II
==Places==
===United States===
* Mercury, a [[List of places in Alabama: I–M#M|place in Alabama]]
* [[Mercury, Nevada]], a closed city within the Nevada Test Site
* [[Mercury, Texas]], an unincorporated community
===Elsewhere===
* [[Mercury, Savoie]], a commune in southeastern France
* [[Mercury Bay]], New Zealand
== Plants ==
* [[Mercury (plant)]], members of the plant genus ''Mercurialis''
* [[Annual mercury]] (''Mercurialis annua''), a species of flowering plant
* [[English Mercury|English mercury]], or mercury goosefoot (''Blitum bonus-henricus''), a species of goosefoot
== Radio ==
* [[Mercury FM]], a radio station in Surrey, UK
* [[Mercury 96.6]] or Heart Hertfordshire, a radio station in Hertfordshire, UK
==Sports==
* [[Edmonton Mercurys]], a Canadian 1940s and 1950s intermediate ice hockey team
* [[Fujita Soccer Club Mercury]], a Japanese women's football team active from 1989 to 1999
* [[Memphis Mercury]], American women's soccer team
* [[Phoenix Mercury]], a Women's National Basketball Association team from Arizona
* [[Toledo Mercurys]], a defunct International Hockey League franchise from Ohio
==Theatres==
* [[Mercury Cinema]], a theatre in Adelaide, Australia
* [[Mercury Theatre (disambiguation)]], a list of Mercury theatres
==Vehicles==
===Air===
* [[Blackburn Mercury]], a British aircraft from 1911
* [[Bristol Mercury]], a nine-cylinder aircraft engine
===Land===
* [[Mercury (automobile)]], a brand of automobiles produced by the Ford Motor Company from 1938 to 2011
* [[Mercury (cyclecar)]], an American cyclecar from 1914
* [[Mercury (train)|''Mercury'' (train)]], a family of New York Central streamliner passenger trains (1936–1958)
===Sea===
* {{ship||Mercury|ship}}, several ships of that name
* [[Cape Cod Mercury 15]], an American sailboat design
* [[Mercury 18]], an American sailboat design
===Space===
* [[Project Mercury]], a US human spaceflight program, 1958–1963
* [[Mercury (satellite)]], a series of American spy satellites
== Other uses ==
* [[Mercury (name)]], including a list of people with the surname, given name or nickname
* [[Mercury Boulevard]], in the cities of Hampton and Newport News, Virginia, US
* [[Mercury (cipher machine)]], a 1950s British cipher machine
* ''[[Archer Maclean's Mercury]]'', a 2005 PlayStation Portable video game
* [[Shuttle America]]'s callsign
==See also==
{{Commons|mercury}}
* {{look from}}
* ''[[The American Mercury]]'', an American magazine published from 1924 to 1981
* [[Mercure (disambiguation)]]
* [[Mercuri]], a surname and list of people with the surname
* [[Mercurius (disambiguation)]]
* [[Mercury 1 (disambiguation)]]
* [[Mercury 2 (disambiguation)]]
* [[Mercury 3 (disambiguation)]]
* [[Mercury 4 (disambiguation)]]
* [[Mercury 5 (disambiguation)]]
* [[Mercury 6 (disambiguation)]]
* [[Mercury 7 (disambiguation)]]
* [[Mercury 8 (disambiguation)]]
* [[Mercury City (disambiguation)]]
* [[Mercury FM (disambiguation)]]
* [[Mercury House (disambiguation)]]
* [[Mercury mission (disambiguation)]]
* [[Mercury program (disambiguation)]]
* [[Mercury project (disambiguation)]]
* {{in title|Mercury}}
{{disambiguation cleanup|geo|ships|date=September 2026}}<!--May require further organization; see [[WP:LONGDAB]]-->
0m202b5xg9g967gxp8nkxqaa3bkk2iv
UK
0
3743
22003
2026-05-05T17:46:07Z
Lijil
2821
Reverted edits by [[Special:Contribs/~2026-27308-47|~2026-27308-47]] ([[User talk:~2026-27308-47|talk]]): vandalism ([[:en:WP:WikiShield|WS]])
22003
wikitext
text/x-wiki
#REDIRECT [[United Kingdom]]
{{Redirect category shell|1=
{{R from initialism}}
{{R mentioned in a hatnote}}
{{R printworthy}}
}}
0idoh74ren3deto9c1iaypnb7r104rv
22004
22003
2026-09-18T15:20:21Z
Amire80
9
1 измена увезена из [[:en:UK]]: importing from the English Wikipedia
22003
wikitext
text/x-wiki
#REDIRECT [[United Kingdom]]
{{Redirect category shell|1=
{{R from initialism}}
{{R mentioned in a hatnote}}
{{R printworthy}}
}}
0idoh74ren3deto9c1iaypnb7r104rv
Розгварка:United Kingdom
1
3744
22005
2026-09-06T20:01:54Z
~2026-48355-83
2822
/* Government seat */ Reply
22005
wikitext
text/x-wiki
{{Skip to talk}}
{{Talk header}}
{{FAQ|collapsed=no}}
{{British English|date=September 2010}}
{{Article history
|action1=PR
|action1date=06:34, 3 May 2006
|action1link=Wikipedia:Peer review/United Kingdom/archive1
|action1result=reviewed
|action1oldid=51316003
|action2=GAN
|action2date=22:20, 22 July 2006
|action2link=Talk:United Kingdom/Archive 6#Good Article
|action2result=listed
|action2oldid=65278328
|action3=FAC
|action3date=15:46, 30 September 2006
|action3link=Wikipedia:Featured article candidates/United Kingdom/archive1
|action3result=not promoted
|action3oldid=78670594
|action4=FAC
|action4date=00:11, 11 February 2007
|action4link=Wikipedia:Featured article candidates/United Kingdom/archive2
|action4result=not promoted
|action4oldid=107189748
|action5=GAR
|action5link=Talk:United Kingdom/GA1
|action5date=19:51, 3 October 2008 (UTC)
|action5result=delisted
|action5oldid=242810269
|action6=GAN
|action6link=Talk:United Kingdom/GA2
|action6date=22 January 2010
|action6result=not listed
|action6oldid=339258206
|action7=GAN
|action7link=Talk:United Kingdom/GA3
|action7date=6 March 2015
|action7result=not listed
|action7oldid=650163344
|action8=GAN
|action8link=Talk:United Kingdom/GA4
|action8date=18:52, 24 September 2018 (UTC)
|action8result=not listed
|action8oldid=861034594
|topic=geography
|currentstatus=DGA
}}
{{WikiProject banner shell|class=B|collapsed=yes|vital=yes|blp=No|1=
{{WikiProject Countries}}
{{WikiProject Europe|importance=Top}}
{{WikiProject Guild of Copy Editors||user=Chaosdruid|date=17 May 2011}}
{{WikiProject Politics of the United Kingdom| importance = Top}}
{{WikiProject UK geography|importance=Top}}
{{WikiProject United Kingdom|importance=Top}}
}}
{{Press|date=August 17, 2009 |url= http://www.telegraph.co.uk/technology/wikipedia/6043534/The-50-most-viewed-Wikipedia-articles-in-2009-and-2008.html |title=The 50 most-viewed Wikipedia articles in 2009 and 2008 |org=[[The Daily Telegraph]] }}
{{Other banners|collapsed=yes|
{{Annual report|[[Wikipedia:2007 Top 50 Report|2007]], [[Wikipedia:2008 Top 50 Report|2008]], [[Wikipedia:2009 Top 50 Report|2009]], [[Wikipedia:2010 Top 50 Report|2010]], [[Wikipedia:2011 Top 50 Report|2011]], [[Wikipedia:2012 Top 50 Report|2012]], [[Wikipedia:2013 Top 50 Report|2013]], [[Wikipedia:2014 Top 50 Report|2014]], [[Wikipedia:Top 25 Report/2016|2016]], [[Wikipedia:2021 Top 50 Report|2021]], and [[Wikipedia:2022 Top 50 Report|2022]]}}
}}
{{section sizes}}
{{Talk:United Kingdom/archivebox}}
{{User:MiszaBot/config
|archiveheader = {{Automatic archive navigator}}
|maxarchivesize = 150K
|counter = 40
|algo = old(60d)
|archive = Talk:United Kingdom/Archive %(counter)d
}}{{User:HBC Archive Indexerbot/OptIn
|target=Talk:United Kingdom/Archive index
|mask1=Talk:United Kingdom/Archive <#>
|mask2=Talk:United_Kingdom/Country, Kingdom or State Archive <#>
|mask3=Talk:United_Kingdom/Terminology archive<#>
|mask4=Talk:United_Kingdom/Subdivision name archive<#>
|leading_zeros=0
|indexhere=yes}}
== Extended-confirmed-protected edit request on 6 July 2026 ==
{{edit extended-protected|United Kingdom|answered=yes}}
Change this line:
The modern system of [[Universal service|universal]] [[Publicly funded health care|publicly funded healthcare]] in the United Kingdom has its origins in the creation of the [[National Health Service]] (NHS) in 1949 is the primary healthcare provider in the United Kingdom.
To this:
The modern system of [[Universal service|universal]] [[Publicly funded health care|publicly funded healthcare]] in the United Kingdom has its origins in the establishment of the [[National Health Service]] (NHS), which began operating in 1948<ref>{{cite web |title=The foundation of the NHS |url=https://www.nationalarchives.gov.uk/explore-the-collection/stories/the-foundation-of-the-nhs/ |publisher=The National Archives |access-date=6 July 2026}}</ref> as the primary healthcare provider.
Reason:
Grammar fix, the current sentence is malformed ("...in 1949 is the primary healthcare provider..."). Year correction 1949→1948, sourced to The National Archives: the NHS began operating on 5 July 1948 (the "appointed day"). Wording changed from "creation of the NHS in 1949" to "establishment of the NHS, which began operating in 1948" because the NHS was created by separate acts across the UK (England and Wales: National Health Service Act 1946; Scotland: National Health Service (Scotland) Act 1947; Northern Ireland: Health Services Act (Northern Ireland) 1948) but launched UK-wide in 1948, so "establishment" plus the 1948 operating date avoids tying creation to a single year. Also removed the redundant second mention of "United Kingdom" at the end of the sentence. [[User:Dannyjamescarter|Dannyjamescarter]] ([[User talk:Dannyjamescarter|talk]]) 15:59, 6 July 2026 (UTC)
:{{done}}<!-- Template:EEp --> [[wp:solidarity|In solidarity]], [[User:Brynn Who Likes Editing|<span style="color: #04A">Brynn Who Likes Editing</span>]] <span style="color: #A59">'''|'''</span> [[User talk:Brynn Who Likes Editing|<span style="color:#E07">talk ''w''/ me!</span>]] 10:18, 19 August 2026 (UTC)
[[User:Lam312321321|Quack!]] [[User:Mutt Lunker|Mutt Lunker]] ([[User talk:Mutt Lunker|talk]]) 16:20, 6 July 2026 (UTC)
:Hi Mutt Lunker, I understand that the "Quack!" implies I'm a returning blocked user. I'm not. This is my only account, I have no connection to any blocked or banned editor, and I've built an ordinary editing history over my time here. I'd ask that the request be judged on its substance rather than on an assumption about who I am: it's a sourced correction (the NHS began operating on 5 July 1948, per The National Archives) and a fix to a grammatically broken sentence. If anyone genuinely believes otherwise about the account, the formal process exists for that. I've said my piece here and won't belabour it further. [[User:Dannyjamescarter|Dannyjamescarter]] ([[User talk:Dannyjamescarter|talk]]) 16:50, 6 July 2026 (UTC)
:[[User:Dannyjamescarter|Dannyjamescarter]] is neither listed in the confirmed sock puppets nor the suspected sock puppets of the ''Quack!'' account you linked to. Please do not create insinuations that an account is a sock puppet without evidence, as this can have a chilling effect. [[wp:solidarity|In solidarity]], [[User:Brynn Who Likes Editing|<span style="color: #04A">Brynn Who Likes Editing</span>]] <span style="color: #A59">'''|'''</span> [[User talk:Brynn Who Likes Editing|<span style="color:#E07">talk ''w''/ me!</span>]] 10:03, 19 August 2026 (UTC)
{{talk reflist}}
== costal =coastal ==
Article locked so cannot change.[[Special:Contributions/~2026-32542-29|~2026-32542-29]] ([[User talk:~2026-32542-29|talk]]) 03:35, 8 July 2026 (UTC)
:{{fixed}} I verified that the reference it's in misspelled the name of the publisher. –[[User:LaundryPizza03|<b style="color:#77b">Laundry</b><b style="color:#fb0">Pizza</b><b style="color:#b00">03</b>]] ([[User talk:LaundryPizza03|<span style="color:#0d0">d</span>]][[Special:Contribs/LaundryPizza03|<span style="color:#0bf">c̄</span>]]) 03:51, 8 July 2026 (UTC)
== Extended-confirmed-protected edit request on 12 July 2026 ==
{{edit extended-protected|United Kingdom|answered=yes}}
Instead of "country", The United Kingdom should be called a "sovereign state" because it is a political entity made up of multiple countries and represents multiple countries in the international stage. [[User:TheCountriesoftheWorld|TheCountriesoftheWorld]] ([[User talk:TheCountriesoftheWorld|talk]]) 02:14, 12 July 2026 (UTC)
:{{not done}} pls see [[Talk:United_Kingdom/Archive_30#sovereign_state,_not_country| a discussion that links to many other discussions]].<span style="display:inline-flex;rotate:-15deg;color:darkblue">'''[[User:Moxy|Moxy]]'''</span><span style="display:inline-flex;rotate:15deg;color:darkblue">[[User talk:Moxy|🍁]]</span> 02:31, 12 July 2026 (UTC)
== Government seat ==
{{ping|Bazza 7}} Usually when the seat of government is different to the capital city, infoboxes show that (e.g. see [[Kingdom of the Netherlands]]). I considered adding a "government seat" field but thought that would be [[WP:UNDUE]] emphasis for a very recent change when most government work is still done from London, which is why I added a footnote instead. [[User:Chessrat|<b style="color: #c90; font-family: comic sans ms">Chessrat</b>]] <sup>([[User talk:Chessrat|<span style="color:green">talk</span>]], [[Special:Contribs/Chessrat|<span style="color:#f78">contributions</span>]])</sup> 11:19, 24 July 2026 (UTC)
:I'm not sure that's a solid analogy. The Netherlands presents an unusual problem, in that while the ordinarily meaning of "capital city" is "place from which an entity is governed", Amsterdam, the ''official'' capital, outright fails to be the capital in the ordinary sense of the term. It seems to me that the situation with Manchester is better compared to the United States, where (a) there's an official presidential retreat in Camp David, Maryland, where many presidents have held official meetings, (b) the current president treats his estate in Palm Beach, Florida, as a secondary White House, and (c) the Department of Defense is in Arlington, Virginia. But the [[United States]] article makes no mention of either Camp David or Palm Beach, and mentions Arlington only in the caption under a photo of the Pentagon. [[User:Largoplazo|Largoplazo]] ([[User talk:Largoplazo|talk]]) 11:41, 24 July 2026 (UTC)
::That's reasonable enough. Thanks for your thoughts. [[User:Chessrat|<b style="color: #c90; font-family: comic sans ms">Chessrat</b>]] <sup>([[User talk:Chessrat|<span style="color:green">talk</span>]], [[Special:Contribs/Chessrat|<span style="color:#f78">contributions</span>]])</sup> 12:54, 24 July 2026 (UTC)
:@[[User:Chessrat|Chessrat]]: Thanks for starting this discussion.
:As always, whatever is stated requires sourcing. So [https://www.bbc.co.uk/news/world-europe-18023389] (last updated 2024) plainly states the capital of the UK is London. So does [https://openfactbook.org/countries/united-kingdom/]. So that's what should be in the article (of which [[MOS:INFOBOXPURPOSE|the infobox is a summary]]). In the surprising absence of any referenced statement about the capital, I've added one in {{section link|United_Kingdom|Demographics}} (which location might seem odd but I couldn't figure anywhere else to put it). If someone finds reliable sources which state that London is usually the capital but Manchester takes over sometimes, then that can be added at the appropriate place.
:If the government of the day chooses to [https://www.bbc.co.uk/news/articles/ckgvyr76973o work elsewhere on Fridays], then that might be appropriate for the {{section link|United Kingdom|Government and politics}}, although I note that there is nothing about location in that section, which is probably as it should be; there is, though, at {{Section link|Government_of_the_United_Kingdom|Location}} so that may be the best place to add more sourced information to.
:I'll also note that I'm not a fan of placing facts which should be in article text inside notes: they're fine for clarifying a word or phrase, but not for carrying information. The MOS [[MOS:NOTES|obliquely implies that this might be an allowed use of notes]], but my own opinion is that if it's worth saying, then say it in the text of the appropriate article. [[User:Bazza_7|Bazza <span style="color:grey">7</span>]] ([[User_talk:Bazza_7|talk]]) 12:22, 24 July 2026 (UTC)
:Most government work is done from Westminster, not London. London (the city of) may be the capital 'City', but it's not the centre of government. London, capital but nowhere near the largest city in the UK.
:Would you Americans (who try to correct us on everything about the country we live in) say New York City has an area of 54,556 square miles with a population of 20 million? "No", you'd say. "That's New York State, not New York City". So why is it that an Englishman can't state the same fact about London without being 'corrected' by some know-it-all Yank from over the pond? [[Special:Contributions/~2026-48355-83|~2026-48355-83]] ([[User talk:~2026-48355-83|talk]]) 20:01, 6 September 2026 (UTC)
== Britain is not an accurate name ==
Might it be worth noting in the opening paragraph that although it is commonly referred to as Britain this is not the correct name. [[User:Dwnsdp|Dwnsdp]] ([[User talk:Dwnsdp|talk]]) 09:45, 14 August 2026 (UTC)
:What, for you, distinguishes between whether a commonly used name is correct or incorrect? Can you give separate examples of commonly used alternate names for things that are correct and that aren't correct? What I'm getting at here is that correctness doesn't apply and we aren't here to scold people for referring to it by a name commonly used to refer to it. [[User:Largoplazo|Largoplazo]] ([[User talk:Largoplazo|talk]]) 11:30, 14 August 2026 (UTC)
::@[[User:Largoplazo|Largoplazo]] Referring to the UK as Britain is incorrect not because it is ''technically'' incorrect - as I agree we should not scold people for - but because as a name it directly excluded one of four kingdoms. A lot of people call the UK "England" due to a misunderstanding, which is not mentioned as an alternative name as it is not correct. What separates that common name from Britain. [[User:Dwnsdp|Dwnsdp]] ([[User talk:Dwnsdp|talk]]) 11:36, 14 August 2026 (UTC)
:::Not everyone shares the view that Britain strictly refers to just [[Great Britain]]. [[User:Chipmunkdavis|CMD]] ([[User talk:Chipmunkdavis|talk]]) 12:09, 14 August 2026 (UTC)
:::@[[User:Dwnsdp|Dwnsdp]]: Who says it's "incorrect"? [https://hansard.parliament.uk/lords/1964-07-09/debates/daef6f24-989f-44ee-8f0e-62940f5d2cbd/BritainSOfficialTitle This statement], made some time ago, considered "Britain" to be acceptable. The term might be ambiguous, or casual, or not official, but it's not incorrect. Perhaps you are confusing "correct" with "official"? In which case, it's not the "official name" of the United Kingdom, but neither is [https://www.gov.uk/government/publications/country-names/country-names-the-permanent-committee-on-geographical-names-for-british-official-use#u "United Kingdom"].
:::The first sentence of the article includes a note explaining the commonly-used "Britain". The "Etymology and terminology" and terminology in the first section of the article goes to great length to explain the country's various names. [[User:Bazza_7|Bazza <span style="color:grey">7</span>]] ([[User_talk:Bazza_7|talk]]) 12:13, 14 August 2026 (UTC)
::::It is ambiguous, yes. It has two common definitions: 1) the island containing three of the four nations (England, Scotland and Wales) of the United Kingdom (aka Great Britain), 2) the United Kingdom as a whole (England, Northern Ireland, Scotland and Wales). It is similar to the America vs. United States question. This could be explained in the article.
::::Given its ambiguity and potential to confuse though, it's probably more encyclopaedic to use "United Kingdom" or "UK" in general usage in other articles. -- [[User:DeFacto|<span style="color:#3366CC;">DeFacto</span>]] ([[User Talk:DeFacto|talk]]). 13:10, 14 August 2026 (UTC)
:::::@[[User:DeFacto|DeFacto]]: The article already contains a good summary of naming, with links to two in-depth articles for those who need more.
:::::I wasn't suggesting "Britain" should be used at all, for the reasons you state. On the contrary, things would be clearer if the MOS forbad it in Wikipedia articles other than when the word is the topic of discussion (as at the start of this article) or it's being quoted. (The [https://www.bbc.co.uk/newsstyleguide/all/#b BBC has a half-hearted go], the UK government [https://guidance.publishing.service.gov.uk/writing-to-gov-uk-standards/style-guides/a-to-z-style-guide/#britain slightly more].)
:::::I can't see that happening, though. But it's wrong to label others using it as "incorrect". [[User:Bazza_7|Bazza <span style="color:grey">7</span>]] ([[User_talk:Bazza_7|talk]]) 15:42, 14 August 2026 (UTC)
::::::@[[User:Bazza 7|Bazza 7]], fair enough, and yep, I totally agree with your second sentence. -- [[User:DeFacto|<span style="color:#3366CC;">DeFacto</span>]] ([[User Talk:DeFacto|talk]]). 16:51, 14 August 2026 (UTC)
:::"City of London" excludes most of the city of London. Many online articles can be found with phrases along the lines of "10 Downing Street issued a statement" or "10 Downing Street issued an apology", but we understand that it's neither the address nor the building designated by it that did the issuing, it was human beings inside of it. The word "decimate" originally referred to the killing of one in ten of the enemy but now it's used to connote a much greater level of devastation. South Africa excludes most of the south of Africa. The standard Turkish name for Morocco is "Fas", though more specifically it refers to the city of Fez. That the use of a name doesn't adhere strictly to its origin or its ''literal'' meaning doesn't mean it's incorrect. [[User:Largoplazo|Largoplazo]] ([[User talk:Largoplazo|talk]]) 12:46, 14 August 2026 (UTC)
== Extended-confirmed-protected edit request on 15 August 2026 ==
{{edit extended-protected|United Kingdom|answered=yes}}
Add [[Speaker of the House of Commons (United Kingdom)]], with the incumbent [[Lindsay Hoyle]] to the infobox under the monarch and prime minister. [[Special:Contributions/~2026-44665-10|~2026-44665-10]] ([[User talk:~2026-44665-10|talk]]) 12:58, 15 August 2026 (UTC)
:[[File:X mark.svg|20px|link=|alt=]] '''Not done for now:''' please establish a [[Wikipedia:Consensus|consensus]] for this alteration '''[[Wikipedia:Edit requests#Planning a request|before]]''' posting an edit request.<!-- Template:EEp --> We don't typically list the speaker on this article. — '''[[User:Czello|<i style="color:#8000FF">Czello</i>]]''' <sup>''([[User talk:Czello|<i style="color:#8000FF">music</i>]])''</sup> 13:14, 15 August 2026 (UTC)
g4atro2g4dfe2ywlrnd65zrvxmkc4bv
22006
22005
2026-09-18T15:20:22Z
Amire80
9
1 измена увезена из [[:en:Talk:United_Kingdom]]: importing from the English Wikipedia
22005
wikitext
text/x-wiki
{{Skip to talk}}
{{Talk header}}
{{FAQ|collapsed=no}}
{{British English|date=September 2010}}
{{Article history
|action1=PR
|action1date=06:34, 3 May 2006
|action1link=Wikipedia:Peer review/United Kingdom/archive1
|action1result=reviewed
|action1oldid=51316003
|action2=GAN
|action2date=22:20, 22 July 2006
|action2link=Talk:United Kingdom/Archive 6#Good Article
|action2result=listed
|action2oldid=65278328
|action3=FAC
|action3date=15:46, 30 September 2006
|action3link=Wikipedia:Featured article candidates/United Kingdom/archive1
|action3result=not promoted
|action3oldid=78670594
|action4=FAC
|action4date=00:11, 11 February 2007
|action4link=Wikipedia:Featured article candidates/United Kingdom/archive2
|action4result=not promoted
|action4oldid=107189748
|action5=GAR
|action5link=Talk:United Kingdom/GA1
|action5date=19:51, 3 October 2008 (UTC)
|action5result=delisted
|action5oldid=242810269
|action6=GAN
|action6link=Talk:United Kingdom/GA2
|action6date=22 January 2010
|action6result=not listed
|action6oldid=339258206
|action7=GAN
|action7link=Talk:United Kingdom/GA3
|action7date=6 March 2015
|action7result=not listed
|action7oldid=650163344
|action8=GAN
|action8link=Talk:United Kingdom/GA4
|action8date=18:52, 24 September 2018 (UTC)
|action8result=not listed
|action8oldid=861034594
|topic=geography
|currentstatus=DGA
}}
{{WikiProject banner shell|class=B|collapsed=yes|vital=yes|blp=No|1=
{{WikiProject Countries}}
{{WikiProject Europe|importance=Top}}
{{WikiProject Guild of Copy Editors||user=Chaosdruid|date=17 May 2011}}
{{WikiProject Politics of the United Kingdom| importance = Top}}
{{WikiProject UK geography|importance=Top}}
{{WikiProject United Kingdom|importance=Top}}
}}
{{Press|date=August 17, 2009 |url= http://www.telegraph.co.uk/technology/wikipedia/6043534/The-50-most-viewed-Wikipedia-articles-in-2009-and-2008.html |title=The 50 most-viewed Wikipedia articles in 2009 and 2008 |org=[[The Daily Telegraph]] }}
{{Other banners|collapsed=yes|
{{Annual report|[[Wikipedia:2007 Top 50 Report|2007]], [[Wikipedia:2008 Top 50 Report|2008]], [[Wikipedia:2009 Top 50 Report|2009]], [[Wikipedia:2010 Top 50 Report|2010]], [[Wikipedia:2011 Top 50 Report|2011]], [[Wikipedia:2012 Top 50 Report|2012]], [[Wikipedia:2013 Top 50 Report|2013]], [[Wikipedia:2014 Top 50 Report|2014]], [[Wikipedia:Top 25 Report/2016|2016]], [[Wikipedia:2021 Top 50 Report|2021]], and [[Wikipedia:2022 Top 50 Report|2022]]}}
}}
{{section sizes}}
{{Talk:United Kingdom/archivebox}}
{{User:MiszaBot/config
|archiveheader = {{Automatic archive navigator}}
|maxarchivesize = 150K
|counter = 40
|algo = old(60d)
|archive = Talk:United Kingdom/Archive %(counter)d
}}{{User:HBC Archive Indexerbot/OptIn
|target=Talk:United Kingdom/Archive index
|mask1=Talk:United Kingdom/Archive <#>
|mask2=Talk:United_Kingdom/Country, Kingdom or State Archive <#>
|mask3=Talk:United_Kingdom/Terminology archive<#>
|mask4=Talk:United_Kingdom/Subdivision name archive<#>
|leading_zeros=0
|indexhere=yes}}
== Extended-confirmed-protected edit request on 6 July 2026 ==
{{edit extended-protected|United Kingdom|answered=yes}}
Change this line:
The modern system of [[Universal service|universal]] [[Publicly funded health care|publicly funded healthcare]] in the United Kingdom has its origins in the creation of the [[National Health Service]] (NHS) in 1949 is the primary healthcare provider in the United Kingdom.
To this:
The modern system of [[Universal service|universal]] [[Publicly funded health care|publicly funded healthcare]] in the United Kingdom has its origins in the establishment of the [[National Health Service]] (NHS), which began operating in 1948<ref>{{cite web |title=The foundation of the NHS |url=https://www.nationalarchives.gov.uk/explore-the-collection/stories/the-foundation-of-the-nhs/ |publisher=The National Archives |access-date=6 July 2026}}</ref> as the primary healthcare provider.
Reason:
Grammar fix, the current sentence is malformed ("...in 1949 is the primary healthcare provider..."). Year correction 1949→1948, sourced to The National Archives: the NHS began operating on 5 July 1948 (the "appointed day"). Wording changed from "creation of the NHS in 1949" to "establishment of the NHS, which began operating in 1948" because the NHS was created by separate acts across the UK (England and Wales: National Health Service Act 1946; Scotland: National Health Service (Scotland) Act 1947; Northern Ireland: Health Services Act (Northern Ireland) 1948) but launched UK-wide in 1948, so "establishment" plus the 1948 operating date avoids tying creation to a single year. Also removed the redundant second mention of "United Kingdom" at the end of the sentence. [[User:Dannyjamescarter|Dannyjamescarter]] ([[User talk:Dannyjamescarter|talk]]) 15:59, 6 July 2026 (UTC)
:{{done}}<!-- Template:EEp --> [[wp:solidarity|In solidarity]], [[User:Brynn Who Likes Editing|<span style="color: #04A">Brynn Who Likes Editing</span>]] <span style="color: #A59">'''|'''</span> [[User talk:Brynn Who Likes Editing|<span style="color:#E07">talk ''w''/ me!</span>]] 10:18, 19 August 2026 (UTC)
[[User:Lam312321321|Quack!]] [[User:Mutt Lunker|Mutt Lunker]] ([[User talk:Mutt Lunker|talk]]) 16:20, 6 July 2026 (UTC)
:Hi Mutt Lunker, I understand that the "Quack!" implies I'm a returning blocked user. I'm not. This is my only account, I have no connection to any blocked or banned editor, and I've built an ordinary editing history over my time here. I'd ask that the request be judged on its substance rather than on an assumption about who I am: it's a sourced correction (the NHS began operating on 5 July 1948, per The National Archives) and a fix to a grammatically broken sentence. If anyone genuinely believes otherwise about the account, the formal process exists for that. I've said my piece here and won't belabour it further. [[User:Dannyjamescarter|Dannyjamescarter]] ([[User talk:Dannyjamescarter|talk]]) 16:50, 6 July 2026 (UTC)
:[[User:Dannyjamescarter|Dannyjamescarter]] is neither listed in the confirmed sock puppets nor the suspected sock puppets of the ''Quack!'' account you linked to. Please do not create insinuations that an account is a sock puppet without evidence, as this can have a chilling effect. [[wp:solidarity|In solidarity]], [[User:Brynn Who Likes Editing|<span style="color: #04A">Brynn Who Likes Editing</span>]] <span style="color: #A59">'''|'''</span> [[User talk:Brynn Who Likes Editing|<span style="color:#E07">talk ''w''/ me!</span>]] 10:03, 19 August 2026 (UTC)
{{talk reflist}}
== costal =coastal ==
Article locked so cannot change.[[Special:Contributions/~2026-32542-29|~2026-32542-29]] ([[User talk:~2026-32542-29|talk]]) 03:35, 8 July 2026 (UTC)
:{{fixed}} I verified that the reference it's in misspelled the name of the publisher. –[[User:LaundryPizza03|<b style="color:#77b">Laundry</b><b style="color:#fb0">Pizza</b><b style="color:#b00">03</b>]] ([[User talk:LaundryPizza03|<span style="color:#0d0">d</span>]][[Special:Contribs/LaundryPizza03|<span style="color:#0bf">c̄</span>]]) 03:51, 8 July 2026 (UTC)
== Extended-confirmed-protected edit request on 12 July 2026 ==
{{edit extended-protected|United Kingdom|answered=yes}}
Instead of "country", The United Kingdom should be called a "sovereign state" because it is a political entity made up of multiple countries and represents multiple countries in the international stage. [[User:TheCountriesoftheWorld|TheCountriesoftheWorld]] ([[User talk:TheCountriesoftheWorld|talk]]) 02:14, 12 July 2026 (UTC)
:{{not done}} pls see [[Talk:United_Kingdom/Archive_30#sovereign_state,_not_country| a discussion that links to many other discussions]].<span style="display:inline-flex;rotate:-15deg;color:darkblue">'''[[User:Moxy|Moxy]]'''</span><span style="display:inline-flex;rotate:15deg;color:darkblue">[[User talk:Moxy|🍁]]</span> 02:31, 12 July 2026 (UTC)
== Government seat ==
{{ping|Bazza 7}} Usually when the seat of government is different to the capital city, infoboxes show that (e.g. see [[Kingdom of the Netherlands]]). I considered adding a "government seat" field but thought that would be [[WP:UNDUE]] emphasis for a very recent change when most government work is still done from London, which is why I added a footnote instead. [[User:Chessrat|<b style="color: #c90; font-family: comic sans ms">Chessrat</b>]] <sup>([[User talk:Chessrat|<span style="color:green">talk</span>]], [[Special:Contribs/Chessrat|<span style="color:#f78">contributions</span>]])</sup> 11:19, 24 July 2026 (UTC)
:I'm not sure that's a solid analogy. The Netherlands presents an unusual problem, in that while the ordinarily meaning of "capital city" is "place from which an entity is governed", Amsterdam, the ''official'' capital, outright fails to be the capital in the ordinary sense of the term. It seems to me that the situation with Manchester is better compared to the United States, where (a) there's an official presidential retreat in Camp David, Maryland, where many presidents have held official meetings, (b) the current president treats his estate in Palm Beach, Florida, as a secondary White House, and (c) the Department of Defense is in Arlington, Virginia. But the [[United States]] article makes no mention of either Camp David or Palm Beach, and mentions Arlington only in the caption under a photo of the Pentagon. [[User:Largoplazo|Largoplazo]] ([[User talk:Largoplazo|talk]]) 11:41, 24 July 2026 (UTC)
::That's reasonable enough. Thanks for your thoughts. [[User:Chessrat|<b style="color: #c90; font-family: comic sans ms">Chessrat</b>]] <sup>([[User talk:Chessrat|<span style="color:green">talk</span>]], [[Special:Contribs/Chessrat|<span style="color:#f78">contributions</span>]])</sup> 12:54, 24 July 2026 (UTC)
:@[[User:Chessrat|Chessrat]]: Thanks for starting this discussion.
:As always, whatever is stated requires sourcing. So [https://www.bbc.co.uk/news/world-europe-18023389] (last updated 2024) plainly states the capital of the UK is London. So does [https://openfactbook.org/countries/united-kingdom/]. So that's what should be in the article (of which [[MOS:INFOBOXPURPOSE|the infobox is a summary]]). In the surprising absence of any referenced statement about the capital, I've added one in {{section link|United_Kingdom|Demographics}} (which location might seem odd but I couldn't figure anywhere else to put it). If someone finds reliable sources which state that London is usually the capital but Manchester takes over sometimes, then that can be added at the appropriate place.
:If the government of the day chooses to [https://www.bbc.co.uk/news/articles/ckgvyr76973o work elsewhere on Fridays], then that might be appropriate for the {{section link|United Kingdom|Government and politics}}, although I note that there is nothing about location in that section, which is probably as it should be; there is, though, at {{Section link|Government_of_the_United_Kingdom|Location}} so that may be the best place to add more sourced information to.
:I'll also note that I'm not a fan of placing facts which should be in article text inside notes: they're fine for clarifying a word or phrase, but not for carrying information. The MOS [[MOS:NOTES|obliquely implies that this might be an allowed use of notes]], but my own opinion is that if it's worth saying, then say it in the text of the appropriate article. [[User:Bazza_7|Bazza <span style="color:grey">7</span>]] ([[User_talk:Bazza_7|talk]]) 12:22, 24 July 2026 (UTC)
:Most government work is done from Westminster, not London. London (the city of) may be the capital 'City', but it's not the centre of government. London, capital but nowhere near the largest city in the UK.
:Would you Americans (who try to correct us on everything about the country we live in) say New York City has an area of 54,556 square miles with a population of 20 million? "No", you'd say. "That's New York State, not New York City". So why is it that an Englishman can't state the same fact about London without being 'corrected' by some know-it-all Yank from over the pond? [[Special:Contributions/~2026-48355-83|~2026-48355-83]] ([[User talk:~2026-48355-83|talk]]) 20:01, 6 September 2026 (UTC)
== Britain is not an accurate name ==
Might it be worth noting in the opening paragraph that although it is commonly referred to as Britain this is not the correct name. [[User:Dwnsdp|Dwnsdp]] ([[User talk:Dwnsdp|talk]]) 09:45, 14 August 2026 (UTC)
:What, for you, distinguishes between whether a commonly used name is correct or incorrect? Can you give separate examples of commonly used alternate names for things that are correct and that aren't correct? What I'm getting at here is that correctness doesn't apply and we aren't here to scold people for referring to it by a name commonly used to refer to it. [[User:Largoplazo|Largoplazo]] ([[User talk:Largoplazo|talk]]) 11:30, 14 August 2026 (UTC)
::@[[User:Largoplazo|Largoplazo]] Referring to the UK as Britain is incorrect not because it is ''technically'' incorrect - as I agree we should not scold people for - but because as a name it directly excluded one of four kingdoms. A lot of people call the UK "England" due to a misunderstanding, which is not mentioned as an alternative name as it is not correct. What separates that common name from Britain. [[User:Dwnsdp|Dwnsdp]] ([[User talk:Dwnsdp|talk]]) 11:36, 14 August 2026 (UTC)
:::Not everyone shares the view that Britain strictly refers to just [[Great Britain]]. [[User:Chipmunkdavis|CMD]] ([[User talk:Chipmunkdavis|talk]]) 12:09, 14 August 2026 (UTC)
:::@[[User:Dwnsdp|Dwnsdp]]: Who says it's "incorrect"? [https://hansard.parliament.uk/lords/1964-07-09/debates/daef6f24-989f-44ee-8f0e-62940f5d2cbd/BritainSOfficialTitle This statement], made some time ago, considered "Britain" to be acceptable. The term might be ambiguous, or casual, or not official, but it's not incorrect. Perhaps you are confusing "correct" with "official"? In which case, it's not the "official name" of the United Kingdom, but neither is [https://www.gov.uk/government/publications/country-names/country-names-the-permanent-committee-on-geographical-names-for-british-official-use#u "United Kingdom"].
:::The first sentence of the article includes a note explaining the commonly-used "Britain". The "Etymology and terminology" and terminology in the first section of the article goes to great length to explain the country's various names. [[User:Bazza_7|Bazza <span style="color:grey">7</span>]] ([[User_talk:Bazza_7|talk]]) 12:13, 14 August 2026 (UTC)
::::It is ambiguous, yes. It has two common definitions: 1) the island containing three of the four nations (England, Scotland and Wales) of the United Kingdom (aka Great Britain), 2) the United Kingdom as a whole (England, Northern Ireland, Scotland and Wales). It is similar to the America vs. United States question. This could be explained in the article.
::::Given its ambiguity and potential to confuse though, it's probably more encyclopaedic to use "United Kingdom" or "UK" in general usage in other articles. -- [[User:DeFacto|<span style="color:#3366CC;">DeFacto</span>]] ([[User Talk:DeFacto|talk]]). 13:10, 14 August 2026 (UTC)
:::::@[[User:DeFacto|DeFacto]]: The article already contains a good summary of naming, with links to two in-depth articles for those who need more.
:::::I wasn't suggesting "Britain" should be used at all, for the reasons you state. On the contrary, things would be clearer if the MOS forbad it in Wikipedia articles other than when the word is the topic of discussion (as at the start of this article) or it's being quoted. (The [https://www.bbc.co.uk/newsstyleguide/all/#b BBC has a half-hearted go], the UK government [https://guidance.publishing.service.gov.uk/writing-to-gov-uk-standards/style-guides/a-to-z-style-guide/#britain slightly more].)
:::::I can't see that happening, though. But it's wrong to label others using it as "incorrect". [[User:Bazza_7|Bazza <span style="color:grey">7</span>]] ([[User_talk:Bazza_7|talk]]) 15:42, 14 August 2026 (UTC)
::::::@[[User:Bazza 7|Bazza 7]], fair enough, and yep, I totally agree with your second sentence. -- [[User:DeFacto|<span style="color:#3366CC;">DeFacto</span>]] ([[User Talk:DeFacto|talk]]). 16:51, 14 August 2026 (UTC)
:::"City of London" excludes most of the city of London. Many online articles can be found with phrases along the lines of "10 Downing Street issued a statement" or "10 Downing Street issued an apology", but we understand that it's neither the address nor the building designated by it that did the issuing, it was human beings inside of it. The word "decimate" originally referred to the killing of one in ten of the enemy but now it's used to connote a much greater level of devastation. South Africa excludes most of the south of Africa. The standard Turkish name for Morocco is "Fas", though more specifically it refers to the city of Fez. That the use of a name doesn't adhere strictly to its origin or its ''literal'' meaning doesn't mean it's incorrect. [[User:Largoplazo|Largoplazo]] ([[User talk:Largoplazo|talk]]) 12:46, 14 August 2026 (UTC)
== Extended-confirmed-protected edit request on 15 August 2026 ==
{{edit extended-protected|United Kingdom|answered=yes}}
Add [[Speaker of the House of Commons (United Kingdom)]], with the incumbent [[Lindsay Hoyle]] to the infobox under the monarch and prime minister. [[Special:Contributions/~2026-44665-10|~2026-44665-10]] ([[User talk:~2026-44665-10|talk]]) 12:58, 15 August 2026 (UTC)
:[[File:X mark.svg|20px|link=|alt=]] '''Not done for now:''' please establish a [[Wikipedia:Consensus|consensus]] for this alteration '''[[Wikipedia:Edit requests#Planning a request|before]]''' posting an edit request.<!-- Template:EEp --> We don't typically list the speaker on this article. — '''[[User:Czello|<i style="color:#8000FF">Czello</i>]]''' <sup>''([[User talk:Czello|<i style="color:#8000FF">music</i>]])''</sup> 13:14, 15 August 2026 (UTC)
g4atro2g4dfe2ywlrnd65zrvxmkc4bv
Модул:Transclusion count/data/P
828
3745
22007
2026-09-13T05:10:50Z
Ahechtbot
2779
[[Wikipedia:BOT|Bot]]: Updated page.
22007
Scribunto
text/plain
return {
["P"] = 6400,
["P-1"] = 4800,
["P-phrases"] = 4300,
["P."] = 4000,
["P1"] = 233000,
["P2"] = 514000,
["PAGENAMEBASE"] = 1910000,
["PAGENAMEU"] = 55000,
["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"] = 3300,
["PD-ineligible-USonly"] = 7700,
["PD-notice"] = 26000,
["PD-old-100"] = 3200,
["PD-self"] = 31000,
["PD-textlogo"] = 6200,
["PDB_Gallery"] = 2900,
["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"] = 2600,
["POTD_archive/footer"] = 2600,
["POTD_default"] = 12000,
["POTD_image"] = 3900,
["POTD_image1"] = 2600,
["POTD_image2"] = 2600,
["POTD_navigation"] = 7800,
["POTD_texttitle"] = 2600,
["POTDlink"] = 8300,
["POV"] = 3200,
["POW"] = 2600,
["PR/header"] = 3100,
["PR/heading"] = 7200,
["PRI"] = 2200,
["PRT"] = 6400,
["PR_link"] = 119000,
["PS"] = 3100,
["Pad"] = 51000,
["Paddle_Steamer"] = 3100,
["Page"] = 4400,
["Page_list"] = 12000,
["Page_name_sub"] = 52000,
["Page_needed"] = 23000,
["Page_tabs"] = 4100,
["Page_tabs/styles.css"] = 4100,
["Pagelinks"] = 75000,
["Pagelist"] = 15000,
["Pagetype"] = 11400000,
["Paid"] = 17000,
["Pakistani_English"] = 4000,
["Para"] = 2960000,
["Parabr"] = 3800,
["Paragraph_break"] = 2160000,
["Param_value"] = 153000,
["Param_value/styles.css"] = 153000,
["Parameter"] = 3110000,
["Parameter_names_example"] = 2700,
["ParmPart"] = 15000,
["Partial"] = 5600,
["Partial_minor_planet_designation"] = 5700,
["Partly_done"] = 4300,
["Party_color"] = 82000,
["Party_color_cell"] = 6600,
["Party_index_link"] = 3300,
["Party_name_with_color"] = 7300,
["Party_name_with_colour"] = 4200,
["Party_shading/Democratic"] = 19000,
["Party_shading/Independent"] = 3400,
["Party_shading/Republican"] = 18000,
["Party_stripe"] = 18000,
["Pass"] = 3300,
["Pb"] = 2130000,
["Pd-notice"] = 2200,
["Pedigree"] = 4400,
["Peer_review/heading"] = 10000,
["Peer_review_links"] = 3300,
["Peer_review_tools"] = 9600,
["Penalty_shoot-out"] = 6000,
["Pending"] = 6500,
["Pending_DYK_American_hooks"] = 5200,
["Pending_DYK_biographies"] = 11000,
["Pending_changes–protected"] = 4400,
["Pending_film"] = 2800,
["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"] = 8200,
["Phabricator"] = 8400,
["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"] = 8300,
["Pie_chart"] = 8500,
["Pie_chart/styles.css"] = 8500,
["Ping"] = 286000,
["Pipe"] = 97000,
["Place_name_disambiguation"] = 40000,
["Plain_link"] = 120000,
["Plain_list"] = 56000,
["Plain_text"] = 109000,
["Plainlink"] = 30000,
["Plainlist"] = 380000,
["Plainlist/styles.css"] = 3130000,
["Player"] = 3900,
["Player2"] = 2900,
["Please_check_ISSN"] = 16000,
["Plural"] = 108000,
["Pluralize_from_text"] = 2880000,
["Pn"] = 2900,
["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"] = 246000,
["Portal_and_project"] = 263000,
["Portal_bar"] = 186000,
["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"] = 10000,
["Pp-pc"] = 3700,
["Pp-protected"] = 13000,
["Pp-semi"] = 6900,
["Pp-semi-indef"] = 4700,
["Pp-template"] = 4400,
["Pp-vandalism"] = 2700,
["Precision"] = 6000,
["Preferences"] = 18000,
["Preferences/section"] = 3300,
["PresFoot"] = 3300,
["PresHead"] = 3900,
["PresRow"] = 3900,
["Press"] = 5800,
["Preview_warning"] = 490000,
["Primary_source_inline"] = 8200,
["Primary_sources"] = 33000,
["Principal_rank"] = 655000,
["Prisoner_of_war"] = 2600,
["Prl"] = 119000,
["ProCyclingStats"] = 2400,
["ProQuest"] = 36000,
["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_due_to_vandalism"] = 2900,
["Protected_page"] = 25000,
["Protected_page_maintenance_message"] = 42000,
["Protection_padlock"] = 3600,
["Proxy_block"] = 2200,
["Pso"] = 5100,
["Purge"] = 570000,
["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"] = 13600000,
["Module:Pagetype/softredirect"] = 17800000,
["Module:ParameterCount"] = 1760000,
["Module:Parameter_names_example"] = 2700,
["Module:Parameter_validation"] = 166000,
["Module:Parameter_validation/default_config"] = 166000,
["Module:Party_name_with_color"] = 13000,
["Module:Percentage"] = 18000,
["Module:Person_date"] = 1790000,
["Module:Person_height"] = 284000,
["Module:Person_length"] = 7700,
["Module:Person_weight"] = 85000,
["Module:Phone_size"] = 2100,
["Module:Photo_montage"] = 4900,
["Module:Piechart"] = 8500,
["Module:Piechart/cuts.json"] = 8500,
["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"] = 59000,
["Module:Political_party/E"] = 7000,
["Module:Political_party/F"] = 15000,
["Module:Political_party/G"] = 22000,
["Module:Political_party/H"] = 7600,
["Module:Political_party/I"] = 63000,
["Module:Political_party/J"] = 10000,
["Module:Political_party/K"] = 6300,
["Module:Political_party/L"] = 47000,
["Module:Political_party/M"] = 15000,
["Module:Political_party/N"] = 39000,
["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"] = 8000,
["Module:Political_party/W"] = 15000,
["Module:Political_party/Y"] = 2400,
["Module:Pop_density"] = 10000,
["Module:PopulationFromWikidata"] = 15000,
["Module:Portal"] = 11300000,
["Module:Portal-inline"] = 251000,
["Module:Portal/images/a"] = 2060000,
["Module:Portal/images/aliases"] = 361000,
["Module:Portal/images/b"] = 3580000,
["Module:Portal/images/c"] = 2330000,
["Module:Portal/images/d"] = 120000,
["Module:Portal/images/e"] = 598000,
["Module:Portal/images/f"] = 1020000,
["Module:Portal/images/g"] = 711000,
["Module:Portal/images/h"] = 549000,
["Module:Portal/images/i"] = 1300000,
["Module:Portal/images/j"] = 349000,
["Module:Portal/images/k"] = 89000,
["Module:Portal/images/l"] = 536000,
["Module:Portal/images/m"] = 775000,
["Module:Portal/images/n"] = 843000,
["Module:Portal/images/o"] = 461000,
["Module:Portal/images/other"] = 272000,
["Module:Portal/images/p"] = 986000,
["Module:Portal/images/q"] = 3300,
["Module:Portal/images/r"] = 443000,
["Module:Portal/images/s"] = 2010000,
["Module:Portal/images/t"] = 865000,
["Module:Portal/images/u"] = 1420000,
["Module:Portal/images/v"] = 348000,
["Module:Portal/images/w"] = 214000,
["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:Protected_page"] = 75000,
["Module:Protected_page/config"] = 75000,
["Module:Protection_banner"] = 22000,
["Module:Purge"] = 592000,
}
7iiy9jr6et4x1fr57n132rk10wkizuv
22008
22007
2026-09-18T15:20:22Z
Amire80
9
1 измена увезена из [[:en:Module:Transclusion_count/data/P]]: importing from the English Wikipedia
22007
Scribunto
text/plain
return {
["P"] = 6400,
["P-1"] = 4800,
["P-phrases"] = 4300,
["P."] = 4000,
["P1"] = 233000,
["P2"] = 514000,
["PAGENAMEBASE"] = 1910000,
["PAGENAMEU"] = 55000,
["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"] = 3300,
["PD-ineligible-USonly"] = 7700,
["PD-notice"] = 26000,
["PD-old-100"] = 3200,
["PD-self"] = 31000,
["PD-textlogo"] = 6200,
["PDB_Gallery"] = 2900,
["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"] = 2600,
["POTD_archive/footer"] = 2600,
["POTD_default"] = 12000,
["POTD_image"] = 3900,
["POTD_image1"] = 2600,
["POTD_image2"] = 2600,
["POTD_navigation"] = 7800,
["POTD_texttitle"] = 2600,
["POTDlink"] = 8300,
["POV"] = 3200,
["POW"] = 2600,
["PR/header"] = 3100,
["PR/heading"] = 7200,
["PRI"] = 2200,
["PRT"] = 6400,
["PR_link"] = 119000,
["PS"] = 3100,
["Pad"] = 51000,
["Paddle_Steamer"] = 3100,
["Page"] = 4400,
["Page_list"] = 12000,
["Page_name_sub"] = 52000,
["Page_needed"] = 23000,
["Page_tabs"] = 4100,
["Page_tabs/styles.css"] = 4100,
["Pagelinks"] = 75000,
["Pagelist"] = 15000,
["Pagetype"] = 11400000,
["Paid"] = 17000,
["Pakistani_English"] = 4000,
["Para"] = 2960000,
["Parabr"] = 3800,
["Paragraph_break"] = 2160000,
["Param_value"] = 153000,
["Param_value/styles.css"] = 153000,
["Parameter"] = 3110000,
["Parameter_names_example"] = 2700,
["ParmPart"] = 15000,
["Partial"] = 5600,
["Partial_minor_planet_designation"] = 5700,
["Partly_done"] = 4300,
["Party_color"] = 82000,
["Party_color_cell"] = 6600,
["Party_index_link"] = 3300,
["Party_name_with_color"] = 7300,
["Party_name_with_colour"] = 4200,
["Party_shading/Democratic"] = 19000,
["Party_shading/Independent"] = 3400,
["Party_shading/Republican"] = 18000,
["Party_stripe"] = 18000,
["Pass"] = 3300,
["Pb"] = 2130000,
["Pd-notice"] = 2200,
["Pedigree"] = 4400,
["Peer_review/heading"] = 10000,
["Peer_review_links"] = 3300,
["Peer_review_tools"] = 9600,
["Penalty_shoot-out"] = 6000,
["Pending"] = 6500,
["Pending_DYK_American_hooks"] = 5200,
["Pending_DYK_biographies"] = 11000,
["Pending_changes–protected"] = 4400,
["Pending_film"] = 2800,
["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"] = 8200,
["Phabricator"] = 8400,
["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"] = 8300,
["Pie_chart"] = 8500,
["Pie_chart/styles.css"] = 8500,
["Ping"] = 286000,
["Pipe"] = 97000,
["Place_name_disambiguation"] = 40000,
["Plain_link"] = 120000,
["Plain_list"] = 56000,
["Plain_text"] = 109000,
["Plainlink"] = 30000,
["Plainlist"] = 380000,
["Plainlist/styles.css"] = 3130000,
["Player"] = 3900,
["Player2"] = 2900,
["Please_check_ISSN"] = 16000,
["Plural"] = 108000,
["Pluralize_from_text"] = 2880000,
["Pn"] = 2900,
["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"] = 246000,
["Portal_and_project"] = 263000,
["Portal_bar"] = 186000,
["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"] = 10000,
["Pp-pc"] = 3700,
["Pp-protected"] = 13000,
["Pp-semi"] = 6900,
["Pp-semi-indef"] = 4700,
["Pp-template"] = 4400,
["Pp-vandalism"] = 2700,
["Precision"] = 6000,
["Preferences"] = 18000,
["Preferences/section"] = 3300,
["PresFoot"] = 3300,
["PresHead"] = 3900,
["PresRow"] = 3900,
["Press"] = 5800,
["Preview_warning"] = 490000,
["Primary_source_inline"] = 8200,
["Primary_sources"] = 33000,
["Principal_rank"] = 655000,
["Prisoner_of_war"] = 2600,
["Prl"] = 119000,
["ProCyclingStats"] = 2400,
["ProQuest"] = 36000,
["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_due_to_vandalism"] = 2900,
["Protected_page"] = 25000,
["Protected_page_maintenance_message"] = 42000,
["Protection_padlock"] = 3600,
["Proxy_block"] = 2200,
["Pso"] = 5100,
["Purge"] = 570000,
["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"] = 13600000,
["Module:Pagetype/softredirect"] = 17800000,
["Module:ParameterCount"] = 1760000,
["Module:Parameter_names_example"] = 2700,
["Module:Parameter_validation"] = 166000,
["Module:Parameter_validation/default_config"] = 166000,
["Module:Party_name_with_color"] = 13000,
["Module:Percentage"] = 18000,
["Module:Person_date"] = 1790000,
["Module:Person_height"] = 284000,
["Module:Person_length"] = 7700,
["Module:Person_weight"] = 85000,
["Module:Phone_size"] = 2100,
["Module:Photo_montage"] = 4900,
["Module:Piechart"] = 8500,
["Module:Piechart/cuts.json"] = 8500,
["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"] = 59000,
["Module:Political_party/E"] = 7000,
["Module:Political_party/F"] = 15000,
["Module:Political_party/G"] = 22000,
["Module:Political_party/H"] = 7600,
["Module:Political_party/I"] = 63000,
["Module:Political_party/J"] = 10000,
["Module:Political_party/K"] = 6300,
["Module:Political_party/L"] = 47000,
["Module:Political_party/M"] = 15000,
["Module:Political_party/N"] = 39000,
["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"] = 8000,
["Module:Political_party/W"] = 15000,
["Module:Political_party/Y"] = 2400,
["Module:Pop_density"] = 10000,
["Module:PopulationFromWikidata"] = 15000,
["Module:Portal"] = 11300000,
["Module:Portal-inline"] = 251000,
["Module:Portal/images/a"] = 2060000,
["Module:Portal/images/aliases"] = 361000,
["Module:Portal/images/b"] = 3580000,
["Module:Portal/images/c"] = 2330000,
["Module:Portal/images/d"] = 120000,
["Module:Portal/images/e"] = 598000,
["Module:Portal/images/f"] = 1020000,
["Module:Portal/images/g"] = 711000,
["Module:Portal/images/h"] = 549000,
["Module:Portal/images/i"] = 1300000,
["Module:Portal/images/j"] = 349000,
["Module:Portal/images/k"] = 89000,
["Module:Portal/images/l"] = 536000,
["Module:Portal/images/m"] = 775000,
["Module:Portal/images/n"] = 843000,
["Module:Portal/images/o"] = 461000,
["Module:Portal/images/other"] = 272000,
["Module:Portal/images/p"] = 986000,
["Module:Portal/images/q"] = 3300,
["Module:Portal/images/r"] = 443000,
["Module:Portal/images/s"] = 2010000,
["Module:Portal/images/t"] = 865000,
["Module:Portal/images/u"] = 1420000,
["Module:Portal/images/v"] = 348000,
["Module:Portal/images/w"] = 214000,
["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:Protected_page"] = 75000,
["Module:Protected_page/config"] = 75000,
["Module:Protection_banner"] = 22000,
["Module:Purge"] = 592000,
}
7iiy9jr6et4x1fr57n132rk10wkizuv
Шаблон:High use
10
3746
22009
2021-10-05T19:24:15Z
MusikBot II
2764
Protected "[[Template:High use]]": [[Wikipedia:High-risk templates|High-risk template or module]]: 345 transclusions ([[User:MusikBot II/TemplateProtector|more info]]) ([Edit=Require autoconfirmed or confirmed access] (indefinite))
22009
wikitext
text/x-wiki
#Redirect [[Template:High-use]]
{{Redirect category shell|{{R from modification}}{{R from template shortcut}}}}
bw41vdqof5okzxgwyo9ltlzrt2hnqnm
22010
22009
2026-09-18T15:20:22Z
Amire80
9
1 измена увезена из [[:en:Template:High_use]]: importing from the English Wikipedia
22009
wikitext
text/x-wiki
#Redirect [[Template:High-use]]
{{Redirect category shell|{{R from modification}}{{R from template shortcut}}}}
bw41vdqof5okzxgwyo9ltlzrt2hnqnm
Шаблон:Pagetype/doc
10
3747
22011
2024-08-30T18:35:48Z
2600 etc
2818
22011
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{high use}}
{{cascade-protected template}}
{{lua|Module:Pagetype}}
This template is used to detect the page type of a given page. It detects [[WP:REDIRECT|redirect pages]] automatically and is highly customisable. It can be used on its own or as a meta-template to create other page-type-detection templates.
== Syntax ==
; Basic code
<pre>
{{pagetype}}
</pre>
; Full code
<pre>
{{pagetype
| page =
| defaultns =
| main =
| user =
| wikipedia =
| project =
| wp =
| file =
| image =
| mediawiki =
| template =
| help =
| category =
| portal =
| timedtext =
| module =
| special =
| media =
| talk =
| redirect =
| dab =
| na =
| other =
| plural =
}}
</pre>
== Basic usage ==
For simple detection of the page type of the current page, use the default settings:
{{pagetype}}
That will produce the following results, depending on the page type or the [[WP:NAMESPACE|namespace]]:
{| class="wikitable"
! Page type / namespace !! Output
|-
| Redirects (in any namespace) || <code>redirect</code>
|-
| Main namespace || <code>article</code>
|-
| File namespace || <code>file</code>
|-
| Template namespace || <code>template</code>
|-
| Category namespace || <code>category</code>
|-
| Module namespace || <code>module</code>
|-
| Other namespaces || <code>page</code>
|}
If the template is used on a talk page, it will detect the page type for the corresponding subject page.
; Example
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype}}</nowiki></code> || {{pagetype}}
|}
=== Page parameter ===
You can use the <code>page</code> parameter to make the template act as though it was called from that page.
{{pagetype|page=''page name''}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=UK}}</nowiki></code> || {{pagetype|page=UK}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=File:Example.svg}}</nowiki></code> || {{pagetype|page=File:Example.svg}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}
|}
== Adding and removing namespaces ==
It is possible to specify different behaviour for each namespace than that described in the [[#Basic usage|basic usage]] section. For example, you might want the template to display "user page" for pages in the user namespace, instead of the default "page". To do this, you can use the code {{para|user|yes}}. This looks up the typical name used for pages in the user namespace, in this case "user page", and uses that text when the template is used with a page in the user namespace. To use this with other namespaces, use the namespace name in lower case as a parameter:
{{pagetype
| user = ''yes''
| wikipedia = ''yes''
| project = ''yes''
| wp = ''yes''
| mediawiki = ''yes''
| help = ''yes''
| portal = ''yes''
| timedtext = ''yes''
| special = ''yes''
| media = ''yes''
}}
You can use any of the following to specify the namespace: "<code>yes</code>", "<code>y</code>", "<code>true</code>" or "<code>1</code>". They can be used in any combination of upper and lower case. (These values are defined by [[Module:Yesno]].)
The default text for these namespaces is as follows:
{| class="wikitable"
! Page type / namespace !! Output
|-
| User namespace || <code>user page</code>
|-
| Wikipedia namespace || <code>project page</code>
|-
| MediaWiki namespace || <code>interface page</code>
|-
| Help namespace || <code>help page</code>
|-
| Portal namespace || <code>portal</code>
|-
| Timed Text namespace || <code>Timed Text page</code>
|-
| Special namespace || <code>special page</code>
|-
| Media namespace || <code>file</code>
|}
You can use a similar process to remove any of the default namespace values as well. For example, if you use the code {{para|template|no}}, then the template will display "page" when used on a template page, rather than the default "template".
{{pagetype
| main = ''no''
| file = ''no''
| template = ''no''
| category = ''no''
| module = ''no''
}}
The following values will all work to remove namespace values: "<code>no</code>", "<code>n</code>", "<code>false</code>" or "<code>0</code>". They can be used in any combination of upper and lower case.
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|wikipedia=yes}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|wikipedia=yes}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom|talk=y}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom|talk=y}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|main=no}}</nowiki></code> || {{pagetype|page=United Kingdom|main=no}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt|timedtext=Yes}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt|timedtext=Yes}}
|}
== Default namespace sets ==
As well as adding and removing individual namespaces, it is possible to specify different sets of namespaces by using the {{para|defaultns}}. There are four different sets available: <code>all</code>, <code>extended</code>, <code>none</code> and the default set. These sets allow you to specify many namespaces at once, without having to use all of the individual namespace parameters. Namespaces are set according to the following table:
{| class="wikitable"
|-
! rowspan="2" | Namespace
! colspan="4" | Value of {{para|defaultns}}
! rowspan="2" | Output
|-
| style="width: 75px; text-align: center;" | <code>none</code>
| style="width: 75px; text-align: center;" | <code>extended</code>
| style="width: 75px; text-align: center;" | <code>all</code>
| style="width: 75px; text-align: center;" | Other values
|-
| Main
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| article
|-
| User
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| user page
|-
| Wikipedia
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| project page
|-
| File
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| file
|-
| MediaWiki
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| interface page
|-
| Template
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| template
|-
| Help
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| help page
|-
| Category
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| category
|-
| Portal
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| portal
|-
| TimedText
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| Timed Text page
|-
| Module
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| module
|-
| All talk namespaces
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| talk page
|-
| Special
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| special page
|-
| Media
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| file
|}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|defaultns=none}}</nowiki></code> || {{pagetype|page=United Kingdom|defaultns=none}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom|defaultns=all}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom|defaultns=all}}
|-
| <code><nowiki>{{pagetype|page=File:Example.svg}}</nowiki></code> || {{pagetype|page=File:Example.svg}}
|-
| <code><nowiki>{{pagetype|page=File:Example.svg|defaultns=none}}</nowiki></code> || {{pagetype|page=File:Example.svg|defaultns=none}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|defaultns=extended}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|defaultns=extended}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt|defaultns=extended}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt|defaultns=extended}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt|defaultns=all}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt|defaultns=all}}
|}
== Custom namespace values ==
It is possible to specify a custom value for any namespace:
{{pagetype
| main = ''custom text''
| user = ''custom text''
| wikipedia = ''custom text''
| project = ''custom text''
| wp = ''custom text''
| file = ''custom text''
| image = ''custom text''
| mediawiki = ''custom text''
| template = ''custom text''
| help = ''custom text''
| category = ''custom text''
| portal = ''custom text''
| timedtext = ''custom text''
| module = ''custom text''
| special = ''custom text''
| media = ''custom text''
}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|wikipedia=custom text}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|wikipedia=custom text}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom|talk=custom text}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom|talk=custom text}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|main=custom text}}</nowiki></code> || {{pagetype|page=United Kingdom|main=custom text}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt|timedtext=custom text}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt|timedtext=custom text}}
|}
== Talk parameter ==
Normally, the template will treat talk pages as if they were in the corresponding subject namespace. However, if the <code>talk</code> parameter is set, the template will treat talk pages separately from subject pages. The <code>talk</code> parameter sets values for all talk pages, i.e. pages in the Talk: namespace, pages in the User talk: namespace, pages in the Wikipedia talk: namespace, and so on.
{{pagetype|talk=''yes''}}
{{pagetype|talk=''custom text''}}
The default value for "<code>talk=''yes''</code>" is "talk page".
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|talk=yes}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|talk=yes}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes|talk=yes}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes|talk=yes}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|talk=custom text}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|talk=custom text}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes|talk=custom text}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes|talk=custom text}}
|}
== Main namespace classes ==
For pages in the main namespace, it is possible to add a class value in the first positional parameter:
{{pagetype|''class''}}
If the class value matches one of the values in the table below, it will produce an alternative to the default output of <code>article</code>.
{| class="wikitable"
|-
! Class !! Class values !! Output
|-
| No applicable class || <code>na</code>, <code>n/a</code> || <code>page</code>
|-
|}
You can input the class value in any combination of upper and lower case.
=== Custom main namespace classes ===
It is also possible to specify a custom value for the main namespace classes:
{{pagetype|''class''|na=''yes''}}
{{pagetype|''class''|na=''custom text''}}
This works the same way that it does for the custom namespace page types. Possible parameters are:
* '''na''': a custom value for NA-class pages. It works in the same way as the <code>dab</code> parameter. The default value for "<code>yes</code>" etc. is "page".
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|na}}</nowiki></code> || {{pagetype|page=United Kingdom|na}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|na|na=custom text}}</nowiki></code> || {{pagetype|page=United Kingdom|na|na=custom text}}
|}
== Redirects ==
By default, the template automatically detects redirects in all namespace. It is not possible to specify redirect behaviour by namespace, but you can turn redirect detection off, or use a custom value for redirect pages.
{{pagetype|redirect=''no''}}
{{pagetype|redirect=''custom text''}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=UK}}</nowiki></code> || {{pagetype|page=UK}}
|-
| <code><nowiki>{{pagetype|page=UK|redirect=no}}</nowiki></code> || {{pagetype|page=UK|redirect=no}}
|-
| <code><nowiki>{{pagetype|page=UK|redirect=custom text}}</nowiki></code> || {{pagetype|page=UK|redirect=custom text}}
|}
Note: redirects which are under discussion at [[Wikipedia:Redirects for discussion]], are now also detected automatically.
== Disambiguation pages ==
By default, the template uses [[Module:Disambiguation]] to detect [[WP:DAB|disambiguation pages]] in the main namespace. If you want, you can turn this detection off, or use a custom value for disambiguation pages.
{{pagetype|dab=''no''}}
{{pagetype|dab=''custom text''}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Mercury}}</nowiki></code> || {{pagetype|page=Mercury}}
|-
| <code><nowiki>{{pagetype|page=Mercury|dab=no}}</nowiki></code> || {{pagetype|page=Mercury|dab=no}}
|-
| <code><nowiki>{{pagetype|page=Mercury|dab=custom text}}</nowiki></code> || {{pagetype|page=Mercury|dab=custom text}}
|}
== Other namespaces ==
By default, the template produces "<code>page</code>" if used from a namespace that hasn't been specified. This value can be changed with the {{para|other}} parameter:
{{pagetype|other=''custom text''}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|other=custom text}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|other=custom text}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|other=custom text|wikipedia=wikipedia-space text}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|other=custom text|wikipedia=wikipedia-space text}}
|}
== Plurals ==
By default the module returns the name of the namespace in the singular. Adding the parameter {{para|plural|y}} returns the plural form.
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|plural=y}}</nowiki></code> || {{pagetype|page=United Kingdom|plural=y}}
|-
| <code><nowiki>{{pagetype|page=Category:Books}}</nowiki></code> || {{pagetype|page=Category:Books}}
|-
| <code><nowiki>{{pagetype|page=Category:Books|plural=y}}</nowiki></code> || {{pagetype|page=Category:Books|plural=y}}
|}
The rules for pluralisation can be customised in [[Module:Pagetype/config]] to allow localisation.
== Capitalisation ==
By default the module returns the page type in lowercase. Adding the parameter {{para|caps|y}} returns a version with a capital letter at the start.
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|caps=y}}</nowiki></code> || {{pagetype|page=United Kingdom|caps=y}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|plural=y|caps=y}}</nowiki></code> || {{pagetype|page=United Kingdom|plural=y|caps=y}}
|}
==TemplateData==
{{Collapse top|[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"description": "This template Identifies the type of a given page. It is highly customisable. By default it detects redirects, articles, files, templates, categories, and modules, and other types of page are displayed as \"page\".",
"params": {
"1": {
"label": "Class",
"description": "Class is used to distinguish between different non-article pages in mainspace. 'disambig', 'disamb', 'dab', 'na' and 'n/a' give \"page\". The values can be customised with the \"dab\" and \"na\" parameters.",
"type": "string",
"required": false,
"suggestedvalues": [
"na"
]
},
"page": {
"label": "Page name",
"description": "The name of the page to detect the type of. Defaults to the current subject page, or to the current page if the \"talk\" parameter is activated.",
"type": "wiki-page-name",
"required": false,
"default": "{{SUBST:PAGENAME}}"
},
"main": {
"type": "string",
"label": "Main namespace",
"description": "When enabled, outputs \"article\" or custom text for the main namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes"
},
"user": {
"type": "string",
"label": "User namespace",
"description": "When enabled, outputs \"user page\" or custom text for the User namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"wikipedia": {
"aliases": [
"project",
"wp"
],
"type": "string",
"label": "Wikipedia namespace",
"description": "When enabled, outputs \"project page\" or custom text for the Wikipedia namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "no",
"example": "custom"
},
"file": {
"type": "string",
"aliases": [
"image"
],
"label": "File namespace",
"description": "When enabled, outputs \"file\" or custom text for the File namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes",
"example": "custom"
},
"mediawiki": {
"type": "string",
"label": "MediaWiki namespace",
"description": "When enabled, outputs \"interface page\" or custom text for the MediaWiki namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"template": {
"type": "string",
"label": "Template namespace",
"description": "When enabled, outputs \"template\" or custom text for the Template namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes",
"example": "custom"
},
"help": {
"type": "string",
"label": "Help namespace",
"description": "When enabled, outputs \"help page\" or custom text for the Help namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "no",
"example": "custom"
},
"category": {
"type": "string",
"label": "Category namespace",
"description": "When enabled, outputs \"category\" or custom text for the Category namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes"
},
"portal": {
"type": "string",
"label": "Portal namespace",
"description": "When enabled, outputs \"portal\" or custom text for the Portal namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "no",
"example": "custom"
},
"timedtext": {
"type": "string",
"label": "TimedText namespace",
"description": "When enabled, outputs \"Timed Text page\" or custom text for the TimedText namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"module": {
"type": "string",
"label": "Module namespace",
"description": "When enabled, outputs \"module\" or custom text for the Module namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes"
},
"special": {
"type": "string",
"label": "Special namespace",
"description": "When enabled, outputs \"special page\" or custom text for the Special namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"media": {
"type": "string",
"label": "Media namespace",
"description": "When enabled, outputs \"file\" or custom text for the Media namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"talk": {
"type": "string",
"label": "All talk namespaces",
"description": "When enabled, outputs \"talk page\" or custom text for all talk namespaces. When disabled, uses the subject page of the specified page",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"redirect": {
"label": "Redirect page value",
"description": "When enabled, outputs \"redirect\" or custom text for redirects. When disabled, uses the destination",
"example": "custom",
"type": "string",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes"
},
"dab": {
"type": "string",
"label": "Disambiguation page value",
"description": "When enabled, outputs \"disambiguation page\" or custom text for when the \"Class\" parameter has been set to \"disambiguation\", \"disamb\", or \"dab\"",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"na": {
"type": "string",
"label": "N/A page value",
"description": "When enabled, outputs \"page\" or custom text for pages in mainspace when the \"Class\" parameter has been set to \"disambiguation\", \"disamb\", or \"dab\"",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"other": {
"type": "string",
"label": "Other namespaces",
"description": "Outputs \"page\" or custom text for namespaces that have not been specified",
"default": "page"
},
"defaultns": {
"type": "line",
"label": "Set of default namespaces",
"description": "This parameter is used to specify the set of namespaces used by default. By default the template detects page types in the main, File, Template, Category, and Module namespaces. If this parameter is set to \"none\", the template doesn't detect page types in any namespaces. If it is set to \"extended\", the template detects page types in the main, User, Wikipedia, File, MediaWiki, Template, Help, Category, Portal, and Module namespaces. If it is set to \"all\", the template detects page types in all namespaces, including talk pages. The namespaces set by this parameter can be overridden by the parameters for individual namespaces.",
"suggestedvalues": [
"all",
"extended",
"none",
"default"
],
"default": "default"
},
"plural": {
"type": "boolean",
"label": "Pluralise output?",
"description": "Outputs a plural form (e.g. \"articles\" instead of \"article\").",
"default": "n"
},
"caps": {
"type": "boolean",
"label": "Capitalise output?",
"description": "Outputs a capital letter (e.g. \"Article\" instead of \"article\").",
"default": "n"
}
}
}
</templatedata>
{{Collapse bottom}}
<includeonly>{{Sandbox other||
<!--Categories below this line, please; interwikis at Wikidata-->
[[Category:Namespace manipulation templates]]
}}</includeonly>
1mavbzulf9vx2u1or7jmpsf5m6jrd72
22012
22011
2026-09-18T15:20:22Z
Amire80
9
1 измена увезена из [[:en:Template:Pagetype/doc]]: importing from the English Wikipedia
22011
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{high use}}
{{cascade-protected template}}
{{lua|Module:Pagetype}}
This template is used to detect the page type of a given page. It detects [[WP:REDIRECT|redirect pages]] automatically and is highly customisable. It can be used on its own or as a meta-template to create other page-type-detection templates.
== Syntax ==
; Basic code
<pre>
{{pagetype}}
</pre>
; Full code
<pre>
{{pagetype
| page =
| defaultns =
| main =
| user =
| wikipedia =
| project =
| wp =
| file =
| image =
| mediawiki =
| template =
| help =
| category =
| portal =
| timedtext =
| module =
| special =
| media =
| talk =
| redirect =
| dab =
| na =
| other =
| plural =
}}
</pre>
== Basic usage ==
For simple detection of the page type of the current page, use the default settings:
{{pagetype}}
That will produce the following results, depending on the page type or the [[WP:NAMESPACE|namespace]]:
{| class="wikitable"
! Page type / namespace !! Output
|-
| Redirects (in any namespace) || <code>redirect</code>
|-
| Main namespace || <code>article</code>
|-
| File namespace || <code>file</code>
|-
| Template namespace || <code>template</code>
|-
| Category namespace || <code>category</code>
|-
| Module namespace || <code>module</code>
|-
| Other namespaces || <code>page</code>
|}
If the template is used on a talk page, it will detect the page type for the corresponding subject page.
; Example
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype}}</nowiki></code> || {{pagetype}}
|}
=== Page parameter ===
You can use the <code>page</code> parameter to make the template act as though it was called from that page.
{{pagetype|page=''page name''}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=UK}}</nowiki></code> || {{pagetype|page=UK}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=File:Example.svg}}</nowiki></code> || {{pagetype|page=File:Example.svg}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}
|}
== Adding and removing namespaces ==
It is possible to specify different behaviour for each namespace than that described in the [[#Basic usage|basic usage]] section. For example, you might want the template to display "user page" for pages in the user namespace, instead of the default "page". To do this, you can use the code {{para|user|yes}}. This looks up the typical name used for pages in the user namespace, in this case "user page", and uses that text when the template is used with a page in the user namespace. To use this with other namespaces, use the namespace name in lower case as a parameter:
{{pagetype
| user = ''yes''
| wikipedia = ''yes''
| project = ''yes''
| wp = ''yes''
| mediawiki = ''yes''
| help = ''yes''
| portal = ''yes''
| timedtext = ''yes''
| special = ''yes''
| media = ''yes''
}}
You can use any of the following to specify the namespace: "<code>yes</code>", "<code>y</code>", "<code>true</code>" or "<code>1</code>". They can be used in any combination of upper and lower case. (These values are defined by [[Module:Yesno]].)
The default text for these namespaces is as follows:
{| class="wikitable"
! Page type / namespace !! Output
|-
| User namespace || <code>user page</code>
|-
| Wikipedia namespace || <code>project page</code>
|-
| MediaWiki namespace || <code>interface page</code>
|-
| Help namespace || <code>help page</code>
|-
| Portal namespace || <code>portal</code>
|-
| Timed Text namespace || <code>Timed Text page</code>
|-
| Special namespace || <code>special page</code>
|-
| Media namespace || <code>file</code>
|}
You can use a similar process to remove any of the default namespace values as well. For example, if you use the code {{para|template|no}}, then the template will display "page" when used on a template page, rather than the default "template".
{{pagetype
| main = ''no''
| file = ''no''
| template = ''no''
| category = ''no''
| module = ''no''
}}
The following values will all work to remove namespace values: "<code>no</code>", "<code>n</code>", "<code>false</code>" or "<code>0</code>". They can be used in any combination of upper and lower case.
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|wikipedia=yes}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|wikipedia=yes}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom|talk=y}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom|talk=y}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|main=no}}</nowiki></code> || {{pagetype|page=United Kingdom|main=no}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt|timedtext=Yes}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt|timedtext=Yes}}
|}
== Default namespace sets ==
As well as adding and removing individual namespaces, it is possible to specify different sets of namespaces by using the {{para|defaultns}}. There are four different sets available: <code>all</code>, <code>extended</code>, <code>none</code> and the default set. These sets allow you to specify many namespaces at once, without having to use all of the individual namespace parameters. Namespaces are set according to the following table:
{| class="wikitable"
|-
! rowspan="2" | Namespace
! colspan="4" | Value of {{para|defaultns}}
! rowspan="2" | Output
|-
| style="width: 75px; text-align: center;" | <code>none</code>
| style="width: 75px; text-align: center;" | <code>extended</code>
| style="width: 75px; text-align: center;" | <code>all</code>
| style="width: 75px; text-align: center;" | Other values
|-
| Main
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| article
|-
| User
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| user page
|-
| Wikipedia
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| project page
|-
| File
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| file
|-
| MediaWiki
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| interface page
|-
| Template
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| template
|-
| Help
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| help page
|-
| Category
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| category
|-
| Portal
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| portal
|-
| TimedText
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| Timed Text page
|-
| Module
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{tick}}
| module
|-
| All talk namespaces
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| talk page
|-
| Special
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| special page
|-
| Media
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{cross}}
| style="text-align: center;" | {{tick}}
| style="text-align: center;" | {{cross}}
| file
|}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|defaultns=none}}</nowiki></code> || {{pagetype|page=United Kingdom|defaultns=none}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom|defaultns=all}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom|defaultns=all}}
|-
| <code><nowiki>{{pagetype|page=File:Example.svg}}</nowiki></code> || {{pagetype|page=File:Example.svg}}
|-
| <code><nowiki>{{pagetype|page=File:Example.svg|defaultns=none}}</nowiki></code> || {{pagetype|page=File:Example.svg|defaultns=none}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|defaultns=extended}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|defaultns=extended}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt|defaultns=extended}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt|defaultns=extended}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt|defaultns=all}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt|defaultns=all}}
|}
== Custom namespace values ==
It is possible to specify a custom value for any namespace:
{{pagetype
| main = ''custom text''
| user = ''custom text''
| wikipedia = ''custom text''
| project = ''custom text''
| wp = ''custom text''
| file = ''custom text''
| image = ''custom text''
| mediawiki = ''custom text''
| template = ''custom text''
| help = ''custom text''
| category = ''custom text''
| portal = ''custom text''
| timedtext = ''custom text''
| module = ''custom text''
| special = ''custom text''
| media = ''custom text''
}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|wikipedia=custom text}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|wikipedia=custom text}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=Talk:United Kingdom|talk=custom text}}</nowiki></code> || {{pagetype|page=Talk:United Kingdom|talk=custom text}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|main=custom text}}</nowiki></code> || {{pagetype|page=United Kingdom|main=custom text}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt}}
|-
| <code><nowiki>{{pagetype|page=TimedText:MS_Sam.ogg.en.srt|timedtext=custom text}}</nowiki></code> || {{pagetype|page=TimedText:MS_Sam.ogg.en.srt|timedtext=custom text}}
|}
== Talk parameter ==
Normally, the template will treat talk pages as if they were in the corresponding subject namespace. However, if the <code>talk</code> parameter is set, the template will treat talk pages separately from subject pages. The <code>talk</code> parameter sets values for all talk pages, i.e. pages in the Talk: namespace, pages in the User talk: namespace, pages in the Wikipedia talk: namespace, and so on.
{{pagetype|talk=''yes''}}
{{pagetype|talk=''custom text''}}
The default value for "<code>talk=''yes''</code>" is "talk page".
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|talk=yes}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|talk=yes}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes|talk=yes}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes|talk=yes}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|talk=custom text}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|talk=custom text}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes|talk=custom text}}</nowiki></code> || {{pagetype|page=Wikipedia talk:Namespace|wikipedia=yes|talk=custom text}}
|}
== Main namespace classes ==
For pages in the main namespace, it is possible to add a class value in the first positional parameter:
{{pagetype|''class''}}
If the class value matches one of the values in the table below, it will produce an alternative to the default output of <code>article</code>.
{| class="wikitable"
|-
! Class !! Class values !! Output
|-
| No applicable class || <code>na</code>, <code>n/a</code> || <code>page</code>
|-
|}
You can input the class value in any combination of upper and lower case.
=== Custom main namespace classes ===
It is also possible to specify a custom value for the main namespace classes:
{{pagetype|''class''|na=''yes''}}
{{pagetype|''class''|na=''custom text''}}
This works the same way that it does for the custom namespace page types. Possible parameters are:
* '''na''': a custom value for NA-class pages. It works in the same way as the <code>dab</code> parameter. The default value for "<code>yes</code>" etc. is "page".
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|na}}</nowiki></code> || {{pagetype|page=United Kingdom|na}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|na|na=custom text}}</nowiki></code> || {{pagetype|page=United Kingdom|na|na=custom text}}
|}
== Redirects ==
By default, the template automatically detects redirects in all namespace. It is not possible to specify redirect behaviour by namespace, but you can turn redirect detection off, or use a custom value for redirect pages.
{{pagetype|redirect=''no''}}
{{pagetype|redirect=''custom text''}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=UK}}</nowiki></code> || {{pagetype|page=UK}}
|-
| <code><nowiki>{{pagetype|page=UK|redirect=no}}</nowiki></code> || {{pagetype|page=UK|redirect=no}}
|-
| <code><nowiki>{{pagetype|page=UK|redirect=custom text}}</nowiki></code> || {{pagetype|page=UK|redirect=custom text}}
|}
Note: redirects which are under discussion at [[Wikipedia:Redirects for discussion]], are now also detected automatically.
== Disambiguation pages ==
By default, the template uses [[Module:Disambiguation]] to detect [[WP:DAB|disambiguation pages]] in the main namespace. If you want, you can turn this detection off, or use a custom value for disambiguation pages.
{{pagetype|dab=''no''}}
{{pagetype|dab=''custom text''}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Mercury}}</nowiki></code> || {{pagetype|page=Mercury}}
|-
| <code><nowiki>{{pagetype|page=Mercury|dab=no}}</nowiki></code> || {{pagetype|page=Mercury|dab=no}}
|-
| <code><nowiki>{{pagetype|page=Mercury|dab=custom text}}</nowiki></code> || {{pagetype|page=Mercury|dab=custom text}}
|}
== Other namespaces ==
By default, the template produces "<code>page</code>" if used from a namespace that hasn't been specified. This value can be changed with the {{para|other}} parameter:
{{pagetype|other=''custom text''}}
; Examples
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|other=custom text}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|other=custom text}}
|-
| <code><nowiki>{{pagetype|page=Wikipedia:Namespace|other=custom text|wikipedia=wikipedia-space text}}</nowiki></code> || {{pagetype|page=Wikipedia:Namespace|other=custom text|wikipedia=wikipedia-space text}}
|}
== Plurals ==
By default the module returns the name of the namespace in the singular. Adding the parameter {{para|plural|y}} returns the plural form.
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|plural=y}}</nowiki></code> || {{pagetype|page=United Kingdom|plural=y}}
|-
| <code><nowiki>{{pagetype|page=Category:Books}}</nowiki></code> || {{pagetype|page=Category:Books}}
|-
| <code><nowiki>{{pagetype|page=Category:Books|plural=y}}</nowiki></code> || {{pagetype|page=Category:Books|plural=y}}
|}
The rules for pluralisation can be customised in [[Module:Pagetype/config]] to allow localisation.
== Capitalisation ==
By default the module returns the page type in lowercase. Adding the parameter {{para|caps|y}} returns a version with a capital letter at the start.
{| class="wikitable"
|-
! Code !! Result
|-
| <code><nowiki>{{pagetype|page=United Kingdom}}</nowiki></code> || {{pagetype|page=United Kingdom}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|caps=y}}</nowiki></code> || {{pagetype|page=United Kingdom|caps=y}}
|-
| <code><nowiki>{{pagetype|page=United Kingdom|plural=y|caps=y}}</nowiki></code> || {{pagetype|page=United Kingdom|plural=y|caps=y}}
|}
==TemplateData==
{{Collapse top|[[Wikipedia:TemplateData|TemplateData]] documentation used by [[Wikipedia:VisualEditor|VisualEditor]] and other tools}}
{{TemplateData header|noheader=1}}
<templatedata>
{
"description": "This template Identifies the type of a given page. It is highly customisable. By default it detects redirects, articles, files, templates, categories, and modules, and other types of page are displayed as \"page\".",
"params": {
"1": {
"label": "Class",
"description": "Class is used to distinguish between different non-article pages in mainspace. 'disambig', 'disamb', 'dab', 'na' and 'n/a' give \"page\". The values can be customised with the \"dab\" and \"na\" parameters.",
"type": "string",
"required": false,
"suggestedvalues": [
"na"
]
},
"page": {
"label": "Page name",
"description": "The name of the page to detect the type of. Defaults to the current subject page, or to the current page if the \"talk\" parameter is activated.",
"type": "wiki-page-name",
"required": false,
"default": "{{SUBST:PAGENAME}}"
},
"main": {
"type": "string",
"label": "Main namespace",
"description": "When enabled, outputs \"article\" or custom text for the main namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes"
},
"user": {
"type": "string",
"label": "User namespace",
"description": "When enabled, outputs \"user page\" or custom text for the User namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"wikipedia": {
"aliases": [
"project",
"wp"
],
"type": "string",
"label": "Wikipedia namespace",
"description": "When enabled, outputs \"project page\" or custom text for the Wikipedia namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "no",
"example": "custom"
},
"file": {
"type": "string",
"aliases": [
"image"
],
"label": "File namespace",
"description": "When enabled, outputs \"file\" or custom text for the File namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes",
"example": "custom"
},
"mediawiki": {
"type": "string",
"label": "MediaWiki namespace",
"description": "When enabled, outputs \"interface page\" or custom text for the MediaWiki namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"template": {
"type": "string",
"label": "Template namespace",
"description": "When enabled, outputs \"template\" or custom text for the Template namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes",
"example": "custom"
},
"help": {
"type": "string",
"label": "Help namespace",
"description": "When enabled, outputs \"help page\" or custom text for the Help namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "no",
"example": "custom"
},
"category": {
"type": "string",
"label": "Category namespace",
"description": "When enabled, outputs \"category\" or custom text for the Category namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes"
},
"portal": {
"type": "string",
"label": "Portal namespace",
"description": "When enabled, outputs \"portal\" or custom text for the Portal namespace",
"suggestedvalues": [
"yes",
"no"
],
"default": "no",
"example": "custom"
},
"timedtext": {
"type": "string",
"label": "TimedText namespace",
"description": "When enabled, outputs \"Timed Text page\" or custom text for the TimedText namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"module": {
"type": "string",
"label": "Module namespace",
"description": "When enabled, outputs \"module\" or custom text for the Module namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes"
},
"special": {
"type": "string",
"label": "Special namespace",
"description": "When enabled, outputs \"special page\" or custom text for the Special namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"media": {
"type": "string",
"label": "Media namespace",
"description": "When enabled, outputs \"file\" or custom text for the Media namespace",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"talk": {
"type": "string",
"label": "All talk namespaces",
"description": "When enabled, outputs \"talk page\" or custom text for all talk namespaces. When disabled, uses the subject page of the specified page",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"redirect": {
"label": "Redirect page value",
"description": "When enabled, outputs \"redirect\" or custom text for redirects. When disabled, uses the destination",
"example": "custom",
"type": "string",
"suggestedvalues": [
"yes",
"no"
],
"default": "yes"
},
"dab": {
"type": "string",
"label": "Disambiguation page value",
"description": "When enabled, outputs \"disambiguation page\" or custom text for when the \"Class\" parameter has been set to \"disambiguation\", \"disamb\", or \"dab\"",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"na": {
"type": "string",
"label": "N/A page value",
"description": "When enabled, outputs \"page\" or custom text for pages in mainspace when the \"Class\" parameter has been set to \"disambiguation\", \"disamb\", or \"dab\"",
"example": "custom",
"suggestedvalues": [
"yes",
"no"
],
"default": "no"
},
"other": {
"type": "string",
"label": "Other namespaces",
"description": "Outputs \"page\" or custom text for namespaces that have not been specified",
"default": "page"
},
"defaultns": {
"type": "line",
"label": "Set of default namespaces",
"description": "This parameter is used to specify the set of namespaces used by default. By default the template detects page types in the main, File, Template, Category, and Module namespaces. If this parameter is set to \"none\", the template doesn't detect page types in any namespaces. If it is set to \"extended\", the template detects page types in the main, User, Wikipedia, File, MediaWiki, Template, Help, Category, Portal, and Module namespaces. If it is set to \"all\", the template detects page types in all namespaces, including talk pages. The namespaces set by this parameter can be overridden by the parameters for individual namespaces.",
"suggestedvalues": [
"all",
"extended",
"none",
"default"
],
"default": "default"
},
"plural": {
"type": "boolean",
"label": "Pluralise output?",
"description": "Outputs a plural form (e.g. \"articles\" instead of \"article\").",
"default": "n"
},
"caps": {
"type": "boolean",
"label": "Capitalise output?",
"description": "Outputs a capital letter (e.g. \"Article\" instead of \"article\").",
"default": "n"
}
}
}
</templatedata>
{{Collapse bottom}}
<includeonly>{{Sandbox other||
<!--Categories below this line, please; interwikis at Wikidata-->
[[Category:Namespace manipulation templates]]
}}</includeonly>
1mavbzulf9vx2u1or7jmpsf5m6jrd72
Википедия:Namespace
4
3748
22013
2026-09-04T21:17:00Z
Rusalkii
2823
/* Pseudo-namespaces */ self-evident and not particularly useful
22013
wikitext
text/x-wiki
{{Short description|Prefix before a Wikipedia page's name}}
{{redirect-distinguish|WP:NS|Wikipedia:WikiProject Nova Scotia}}
{{redirect-distinguish|WP:NSPACE|Wikipedia:Notability (astronomical objects)}}
{{pp-semi-vandalism|small=yes}}{{pp-move-indef}}
{{Infopage|WP:NS|WP:NSPACE}}
{{Namespaces}}
A Wikipedia '''namespace''' is a set of Wikipedia pages whose [[Help:page name|names]] begin with a reserved word, followed by a colon. The reserved word is recognized by the [[MediaWiki]] software. For example, in the ''user namespace'' all titles begin with the prefix ''User:''. In the case of the article (or main) namespace, in which encyclopedia articles appear, the reserved word and colon are absent. (Note: main space articles can optionally include a colon at the beginning with no reserved word, so <code>[<nowiki/>[Article]]</code> and <code>[<nowiki/>[:Article]]</code> are equivalent. This is usually only necessary for the advanced technique of [[WP:Transclusion|transcluding]] a main space article into a page in another namespace.)
More generally, a Wikipedia '''namespace''' is a class of pages that falls under a common type. All pages in the <code>User</code> namespace, for example, are [[Wikipedia:User pages|user pages]], whereas [[WP:Drafts|Drafts]] are in the <code>Draft</code> namespace. This page is in the <code>[[WP:Project namespace|Wikipedia]]</code> namespace, for information or discussions about the project itself and its policies.
Wikipedia has 30 current namespaces: 14 subject namespaces, 14 corresponding talk namespaces, and 2 virtual namespaces. These are all listed in the box to the right. While surfing Wikipedia, a list of namespaces is available in two clicks: do an empty search, then click ''Advanced'' under the search box. The list also makes itself available where needed in the dropdown menus of, for example, [[Special:PrefixIndex]], [[Special:AllPages]], [[Special:RecentChanges]], and [[Special:Contributions]].
The aliases '''WP''' for '''Wikipedia''', and '''WT''' for '''Wikipedia talk''', work for page names in the search box, and making links as well as inclusions. See [[#Aliases|Aliases]] below for other aliases. (The pseudo-namespaces such as '''H''' for '''Help''', and '''CAT''' for '''Category''', are extremely limited. See ''[[#Pseudo-namespaces|Pseudo-namespaces]]'' below.)
The table on the right shows what number to use when you want to hide pages that are on your watchlist. See: [[Wikipedia:Hide Pages in Watchlist]] for details.
== Subject namespaces ==
{{see|Wikipedia:Administration#Data structure and development}}
[[File:Policies and guidelines indicator.png|thumb|350px|This page is in the [[Wikipedia:Project namespace|Wikipedia namespace]].]]
Namespaces allow for the organization and separation of [[Wikipedia:Administration#Content namespaces|content pages]] from [[Wikipedia:Administration#Administrative namespaces|administration pages]]. Namespaces separate data into core sets, those intended for public viewing, and those intended for the editing community. Wikipedia's subject namespaces and their functions are listed below. A brief description is provided, but see the link for more information.
{{anchor|subjectpage}}A namespace is sometimes called a ''space'', for short, as in "Project space". A ''subject page'' and its ''talk page'' form a pair.
<!--
in order of {{NAMESPACENUMBER}}
-->
===Current namespaces===
* '''[[Wikipedia:Main namespace|Main namespace]]''' (no prefix): contains all encyclopedia articles, lists, [[Wikipedia:Disambiguation|disambiguation pages]], and encyclopedia [[Wikipedia:Redirect|redirects]]. Sometimes referred to as "mainspace" or "Article".
* '''[[Wikipedia:User namespace|User namespace]]''' (prefix '''User:'''): contains user pages and other pages created by individual users for their own personal use. Pages under this namespace can still be viewed and modified by others, so do not keep any of your sensitive data here.
* '''[[Wikipedia:Wikipedia namespace|Wikipedia namespace]]''' or '''[[Wikipedia:Project namespace|Project namespace]]''' (prefix '''Wikipedia:'''): contains many types of pages connected with the Wikipedia project itself: information, policies, guidelines, essays, processes, discussion, etc. [[Wikipedia:Namespace#Aliases|Namespace aliases]]: '''WP:''' or '''Project:'''
*{{anchor|File|File namespace}}'''[[Wikipedia:File namespace|File namespace]]''' (prefix '''File:'''): contains [[Help:File description page|description pages for media files]] (images, videos, and audio files). A link starting with <code><nowiki>[[File:</nowiki></code> will display the media at that position on the page instead of showing a wikilink that leads to the specified file description page, so if you want the latter effect, use a link beginning with <code><nowiki>[[:File:</nowiki></code> (the [[Help:Colon trick|colon trick]]). Namespace alias: '''Image:'''
* '''[[Help:MediaWiki namespace|MediaWiki namespace]]''' (prefix '''MediaWiki:'''): a namespace containing interface texts, such as the links and messages that appear on automatically generated pages. Pages in this namespace are permanently [[Wikipedia:Protection policy|protected]] against editing by regular users. For a list of these messages, see [[Special:AllMessages]]. (The prefix ''cannot'' be shortened to "MW" because '''mw''' is an interwiki prefix. See ''[[#Interwiki links|Interwiki links]]'' below.)
* '''[[Wikipedia:Template namespace|Template namespace]]''' (prefix '''Template:'''): contains templates – pages that are intended primarily to be [[Wikipedia:Transclusion|transcluded]] or [[Wikipedia:Substitution|substituted]] onto other pages to insert standard text or boxes such as infoboxes and navigation boxes. [[Wikipedia:Namespace#Aliases|Namespace alias]]: '''TM:'''
* '''[[WP:Help namespace|Help namespace]]''' (prefix '''Help:'''): contains pages which provide help in using Wikipedia and its software, both for users of the encyclopedia and for editors.
* '''[[Wikipedia:Category namespace|Category namespace]]''' (prefix '''Category:'''): contains category pages, which are curated lists of related pages and subcategories, along with optional additional text. A link beginning with <code><nowiki>[[Category:</nowiki></code> has the effect of adding the page the link appears on to the specified category; it will not result in a wikilink to the category page itself. If you want the latter, use the [[Help:Colon trick|colon trick]]: <code><nowiki>[[:Category:</nowiki></code>.
* '''[[Wikipedia:Portal namespace|Portal namespace]]''' (prefix '''Portal:'''): for reader-oriented portals that help readers find articles related to a specific topic, and may contain links to encourage contributions to relevant [[Wikipedia:WikiProject|WikiProjects]]. See, for example, [[Portal:Cricket]] and [[Portal:Spaceflight]].
* '''[[Wikipedia:Draft namespace|Draft namespace]]''' (prefix '''Draft:'''): hosts drafts of new (potential) Wikipedia articles.
* '''[[mw:Extension:TimedMediaHandler|TimedText namespace]]''' (prefix '''TimedText:'''): synchronized subtitles for media files.
* '''[[Wikipedia:Module namespace|Module namespace]]''' (prefix '''Module:'''): contains [[mw:Extension:Scribunto|Scribunto]] modules – Lua scripts implementing special-purpose [[mw:Manual:Parser functions|parser functions]] for use in templates, beyond the [[Help:Magic words#Parser functions|basic set]] included with MediaWiki and its [[mw:Extensions FAQ|extensions]].
* {{anchor|MOS}}'''[[WP:Manual of Style|MOS namespace]]''' (prefix '''MOS:'''): contains redirects to subpages of [[WP:Manual of Style]]. Until 2024 this was a pseudo-namespace, but it was turned into a real namespace in 2024 to avoid conflicts with the [[Mooré]] Wikipedia (with the language code <code>mos:</code>).<ref>[[phab:T363538]]</ref>
* '''[[Event:Sandbox|Event namespace]]''' (prefix '''Event:''') contains [[mw:Extension:CampaignEvents]] events.
===Former namespaces===
The following namespaces previously existed but no longer do:
*'''[[Wikipedia:Flow|Flow namespace]]''' (prefix '''Topic:''') was a proposed talk page replacement, formerly installed on English Wikipedia by [[mw:Extension:StructuredDiscussions|Extension:StructuredDiscussions]]. It is no longer installed after being rejected by the community.
* '''[[Wikipedia:Course pages|Education Program namespace]]''' (prefix '''Education Program:'''): uninstalled in 2018, and replaced with the [[wmfdashboard:|Programs & Events Dashboard]].<ref>[[outreach:Education/News/January 2018/Education Extension scheduled shutdown|Education Extension scheduled shutdown]], Wikimedia outreach</ref><ref>{{Section link|Wikipedia:Education noticeboard/Archive 18#NOTICE:_EducationProgram extension is being deprecated}}</ref> However, the namespace was re-added later that year to allow access to old talk pages in the Education program talk: namespace. The namespace was then uninstalled again in 2021 after the remaining talk pages were moved to subpages of [[Wikipedia talk:Education program archive]].
* '''[[Wikipedia:Books|Book namespace]]''' (prefix '''Book:'''): contained entries for Wikipedia books, collections of articles about one theme, which were used to generate downloadable files or printable documents or order books from PediaPress. In 2017, the online book rendering service was withdrawn, leading to the removal of most links leading to the namespace in 2019. The namespace and its transclusions were still retained in the hope that the WMF would come up with a solution,<ref>{{Section link|Wikipedia:Village pump (technical)/Archive 176|Suppress rendering of Template:Wikipedia books}}</ref> but in 2021 the namespace was uninstalled after all remaining books were moved to subpages of [[Wikipedia:Books/archive]].
* '''Gadget namespace''' (prefix '''Gadget:'''):<ref>{{Section link|Wikipedia:Village pump (technical)/Archive 139#New "Gadget:" and "Gadget definition:" namespaces?}}</ref> was intended to store [[Wikipedia:Gadget|Gadgets]], which are small [[Snippet (programming)|snippets]] enabled in [[Special:Preferences#mw-prefsection-gadgets|user preferences]], but was never used for anything other than redirects to the video game ''[[Gadget: Invention, Travel, & Adventure]]'', and for most of its existence could only be edited by WMF staff. Gadgets currently use the [[Help:MediaWiki namespace|MediaWiki namespace]] with the ''MediaWiki:Gadget-'' page name prefix. It was a [[mw:Manual:Using custom namespaces|custom namespace]] installed by the [[mw:Extension:Gadgets|Gadget extension]].
* '''Gadget definition namespace''' (prefix '''Gadget definition:'''): installed but never used; see above for more information. Gadget definitions currently use the [[MediaWiki:Gadgets-definition]] page.
===Aliases and pseudo-namespaces===
{{redirect|Wikipedia:Alias|template parameter aliases|Help:Template#Handling parameters}}
An ''alias'' of a namespace is its namespace. For example, '''WP:''' is '''Wikipedia:''', and so
<code><nowiki>[[</nowiki>Wikipedia:[[WP:Page name|''Page name'']]]]</code> can be abbreviated <code><nowiki>[[WP:</nowiki>[[WP:Page name|''Page name'']]]]</code>.
See ''[[#Aliases|Aliases]]'' below, for a list of aliases, such as '''WT:''' for '''Wikipedia talk:'''.
A ''pseudo-namespace'' is an agreement to create redirect pages named that way, each of which
is a shortcut from mainspace to ''a single page in its namespace''.
So an alias refers to ''any page in its namespace'', but a pseudo-namespace has far fewer pages than its real namespace.
There are a few pseudo-namespace names like '''H:''' for '''Help:''', and '''CAT:''' for '''Category:''', and these can be discovered below in the section ''[[#Pseudo-namespaces|Pseudo-namespaces]]''.
== <span id="Talk"></span><span id="Wikipedia talk"></span><span id="WT"></span> Talk namespaces==
{{shortcut|WP:TALKSPACE}}
{{main|Help:Using talk pages|Wikipedia:Talk page guidelines}}
Each of the above namespaces (but not the virtual namespaces and the former Topic: namespace) has an associated [[help:talk page|talk namespace]]—these are also known as ''discussion pages''. The talk namespaces are designated by appending the word <code>talk</code> to the namespace name. For example, the talk namespace associated with the user namespace has the prefix '''User talk:'''. The talk namespace associated with the article namespace is '''Talk:'''.
Most of the pages in the talk namespaces are used to discuss changes to the corresponding page in the associated namespace. Pages in the ''user talk'' namespace are used to leave messages for a particular user. The user talk namespace is special in that, whenever a user's talk page is edited, that user will see an orange box saying "You have new messages" on the top of every page that they view until they visit their talk page. By default, logged-in users will see [[Wikipedia:Notifications|a red notification square]] ''and'' a small orange box on the top right hand corner of the page; IP users will only see a wide orange box spanning the top of the page. (Minor edits made by [[Wikipedia:Bot policy|bots]] no longer set off the new message bar. For logged-in users, the new-message bar may be disabled in [[Special:Preferences]].)
Note that the prefix '''WT:''' expands to '''Wikipedia talk:''', just as '''WP:''' expands to '''Wikipedia:''' (see [[#Aliases|Aliases]] below). For example, <nowiki>[[WT:Verifiability]]</nowiki> links to [[Wikipedia talk:Verifiability]].
== Virtual namespaces<span id="Special"></span> ==
In addition to subject namespaces and their corresponding talk pages, there are two virtual namespaces (without corresponding talk pages) for specialist purposes:
=== Special ===
{{Main|Help:Special page}}
The ''Special:'' namespace consists of pages (called ''special pages'') that are created by the software on demand, such as [[Special:RecentChanges]]. These pages can be linked as usual, as with <nowiki>[[Special:RecentChanges]]</nowiki>, except when they have parameters. To use parameters, the full URL must be given as an external link. For example, https:{{SERVER}}{{SCRIPTPATH}}/index.php?title=Special:Recentchanges&days=3&limit=10, which returns the last ten changes in the last three days.
You can create a [[Wikipedia:redirect|redirect]] to a Special page, but the redirect will not be followed automatically.
For a list of special pages, see [[Special:SpecialPages]].
=== Media<span class="anchor" id="Media namespace"></span> ===
{{Main|Help:Files}}
The ''Media:'' namespace can be used to link directly to a file, rather than to the file description page.
== Aliases and pseudo-namespaces==
{{See|Wikipedia:Shortcut#List of prefixes}}
Aliases and pseudo-namespaces are not namespaces in themselves; their main role is to provide handy ways to link to actual namespaces, by providing shortened links.
The main difference between them being the way they work for this purpose; while aliases directly link to namespaces, pseudo-namespaces can only link to other namespaces by using specialist [[Wikipedia:Redirect|redirect pages]] in the main namespace called [[Wikipedia:Shortcut|shortcuts]]. While aliases are also used for shortcuts, this isn't necessary if the pagename is not shortened.
Pseudo-namespaces all actually reside in main namespace; but a pseudo-namespace called [[m:Help:Transwiki|Transwiki:]] exists as a pseudo-namespace before being moved to another namespace.
=== Aliases ===
{{Shortcut|WP:ALIAS}}
There are seven aliases defined for namespaces, all of which are case-insensitive:
{| class=wikitable
!Namespace
!Alias
|-
| rowspan="2" |Wikipedia
|WP
|-
|Project
|-
| rowspan="2" |Wikipedia talk
|WT
|-
|Project talk
|-
|File
|Image
|-
|File talk
|Image talk
|-
|Template
|TM
|}
These aliases are automatically translated by the Wikipedia servers to the proper namespace prefix. So if a link is made to a page title beginning with one of these aliases, or else entered in the search box or used in a URL in a browser address bar, the alias links to the page with the corresponding true namespace prefix. Hence entering [[WP:External links]] or [[Project:External links]] is equivalent to entering [[Wikipedia:External links]]; and entering [[WT:External links]] or [[Project talk:External links]] is equivalent to entering [[Wikipedia talk:External links]].
An alias cannot be used as the actual namespace in a page title. For example, you cannot create page ''WP:123''; if tried, the page name is instantly converted to ''Wikipedia:123''. It ''is'', however, possible to [[Wikipedia:Page name#Changing the displayed title|change the ''displayed'' title]] on page ''Wikipedia:123'' to make it ''WP:123'' or ''Project:123''.
<span class="plainlinks">This is very handy for the creation of [[Wikipedia:Shortcut|shortcuts]]. For example, the shortcut for this section is [[WP:ALIAS]], as shown in the right-side box. When the link is clicked, it is automatically translated to [https://en.wikipedia.org/w/index.php?title=Wikipedia:ALIAS&redirect=no Wikipedia:ALIAS]. At this page is a [[Help:Redirect|redirect]] to {{Section link|Wikipedia:Namespace#Aliases}}. This means that the shortcut goes directly to this section from anywhere on Wikipedia. It can also be entered as a [[URL]] in the browser address bar as https://en.wikipedia.org/wiki/WP:ALIAS .</span>
=== Pseudo-namespaces ===
<!-- This section is linked from [[Wikipedia:Glossary]] -->
{{Shortcut|WP:PNS}}
Apart from Wikipedia's 24 regular namespaces and their aliases, and 2 virtual ones, there are several title prefixes appearing in [[Help:Shortcut|shortcut redirects]] pointing to frequently-referred-to Wikipedia pages. These prefixes are referred to as '''pseudo-namespaces''' and include the following:
* '''[[Special:Prefixindex/CAT:|CAT:]]''' for shortcuts to the [[Wikipedia:Category namespace|Category namespace]]. See also [[:Category:Redirects to category space]]
* '''[[Special:Prefixindex/H:|H:]]''' for shortcuts to the [[Wikipedia:Help namespace|Help namespace]]. See also [[:Category:Redirects to help namespace]]
* '''[[Special:Prefixindex/P:|P:]]''' for shortcuts to the [[Wikipedia:Portal namespace|Portal namespace]]. See also [[:Category:Redirects to portal namespace]]
A more complete list is available at {{Section link|Wikipedia:Shortcut#List of prefixes}}.
Pseudo-namespaces are not in any way recognised by the wiki software; they are purely a community custom. Titles in pseudo-namespaces actually belong technically in the main (article) namespace and are treated as such by the software: they are case-sensitive and appear in [[Help:Search#Syntax|search results]] restricted to the main namespace. An alias is treated like a real namespace, resulting in a search for the [[WP:page name|pagename]] in its namespace, but the "pseudo-namespace:pagename" search is in mainspace, not its pseudo-namespace. For example, searching for "H:S" will not search '''Help'''.
To learn some of these shortcuts, first follow the pseudo-namespace link above, then follow one of the redirects listed on that page. It will take you to the target, where you then notice any {{tl|shortcut}} boxes to the right of the page, which may also list some additional shortcuts to that same area. By observing these steps repeatedly, you can discover ways to shorten your typing.
To understand the appropriateness of redirects of this type, see [[Wikipedia:Cross-namespace redirects]]. All shortcuts are discoverable by [[Help:Searching|searching]] for redirects. There is also the category [[:Category:Wikipedia redirects|Wikipedia redirects]].
As a final example, every [[Wikimedia Foundation]] project has a "[[m:Help:Transwiki|Transwiki:]]" pseudo-namespace (sometimes a real namespace) for importing articles manually. A wiki project that would manually move many pages between [[wp:sister|sister projects]] uses this tag. Redirects/shortcuts are not directly involved here, as described above. Instead, the page title is [[WP:move|move]]d to "Transwiki:''namespace:pagename''", and that content is then copied and pasted into a new page name of that temporary title on the target wiki. When it is accepted, the title is then moved out of the '''Transwiki''' pseudo-namespace there and becomes a real page name in its respective namespace.
==<span id="Interwiki links"></span>Interwiki and interlanguage links ==
{{see|Help:Interwiki linking|Help:Interlanguage links}}
[[m:Table of Wikimedia projects|Interwiki]] and [[m:List of Wikipedias|interlanguage]] prefixes do not define namespaces, but point to pages in other Wikimedia projects, outside the en.wikipedia.org website. They are mentioned here because they use a namespace-like prefix technique for linking. Examples of interwiki prefixes include '''w:''' for Wikipedia; '''m:''' (or '''meta:''') for [[Meta-Wiki]], '''mw:''' for [[MediaWiki]], and '''wikt:''' for [[Wiktionary]]. Examples of interlanguage prefixes include '''en:''' for English language, '''fr:''' for French language, and '''de:''' for German language.
Important points to note:
* In the presence of an interwiki prefix and the absence of an interlanguage prefix, the link will be to a specified project in the current language. So <code><nowiki>[[w:Internet]]</nowiki></code> links to "[[w:Internet|Internet]]" on the English Wikipedia, if the link is on any English-language Wikimedia project.
* In the presence of an interlanguage prefix and the absence of an interwiki prefix, the link will be to a specified language in the current project. So <code><nowiki>[[:en:Internet]]</nowiki></code> will link to "[[:en:Internet|Internet]]" on the English Wikipedia, if the link is on a Wikipedia project in any language.
When making links to other language Wikipedias, add an initial colon if you want the link to appear inline rather than in the skin's sidebar under "Languages"; see [[Help:Colon trick]] for an explanation. So <code><nowiki>[[:de:Internet]]</nowiki></code> is an inline link to "[[:de:Internet|Internet]]" in the German Wikipedia; but if using an interwiki prefix this is unnecessary, for example <code><nowiki>[[w:de:Internet]]</nowiki></code> is the same inline link.
Further examples:
* [[m:Meta:Babel]] and [[meta:Meta:Babel]] both link to the "Babel" page in the project namespace (Meta:, the 2nd prefix) of Meta-Wiki (m: or meta:, the 1st prefix).
* [[wikt:fr:Discuter:pied/fusion daf]] links to the "pied/fusion daf" page in the talk namespace (Discuter:, the 3rd prefix) of French (fr:, the 2nd prefix) Wiktionary (wikt:, the 1st prefix).
Interwiki prefixes are not just for Wikimedia projects. For example, [[google:]] is the interwiki link for [[Google]]. For a complete list of interwiki prefixes, see the [[m:Interwiki map|interwiki map]] and [[m:Special:Interwiki|interwiki table]].
As with aliases, it is not possible to create a page with a title beginning with an interwiki or interlanguage prefix. It is also not possible to create redirects to interwiki pages, unless it is a [[Wikipedia:Soft redirect|soft redirect]].
== Case insensitivity ==
Standard namespace names, aliases and interwiki prefixes are case insensitive. The same applies to the first character after the colon. Hence the following all link to the same page:
* [[Wikipedia:Afd]], [[WIKIPEDIA:Afd]], [[wIKIpedia:Afd]], [[wikipedia:afd]]
* [[wP:Afd]], [[wp:Afd]], [[WP:afd]]
* [[PROJECT:Afd]], [[project:Afd]], [[ProjecT:Afd]], [[Project:afd]]
== Namespace-dependent functionality ==
The namespace name is a useful variable for searching in and reporting on sets of [[WP:Page name|pages]]. It is also used to apply features that configure the sets of pages in one namespace differently from another namespace. Using the namespace name MediaWiki can:
*[[WP:Search|Search]] for pages in a particular namespace only.
* [[Help:Special page|Report]] on [[Special:AllPages|content]] or [[WP:Recent changes|changes in content]] of a namespace.
* Enable or disable the [[WP:Subpage|subpage]] feature, per namespace.
* Offer a [[WP:Random article|random article]] for the mainspace (<kbd><nowiki>[[</nowiki>Special:Random<nowiki>]]</nowiki></kbd>), or for a namespace <kbd><nowiki>[[</nowiki>Special:Random/''Namespace'']]</kbd>.
* Change the functionality of <kbd><nowiki>[[</nowiki>''wikilink''<nowiki>]]</nowiki></kbd> if it targets the '''Category''' namespace or '''File''' namespace. Normally wikilinks are activated by the mouse, but <kbd><nowiki>[[</nowiki>Category:''Pagename''<nowiki>]]</nowiki></kbd> activates software functionality when the [[WP:Category|page is saved]], and <kbd><nowiki>[[</nowiki>File:''Page name''<nowiki>]]</nowiki></kbd> activates software functionality when the [[WP:Image|page is rendered]].
* Change the functionality of <kbd><nowiki>{{</nowiki>[[WP:Transclusion|pagename]]<nowiki>}}</nowiki></kbd> so that it defaults to the set of pagenames in '''Template'''.
* Tailor ''[[Wikipedia:Edit notices|edit notices]]'' to a particular namespace's edit page, informing an editor of certain aspects about the content of that namespace.
* Allow ''[[Wikipedia:Templates|templates]]'' to behave differently on pages of different namespaces.
The namespace functionality is often visible in the URL, where you will see a namespace number. These are given in the table below.
Subpages are configured for all namespaces except Main, File, MediaWiki and Category namespaces. Subpages are configured in the software by enabling or disabling the subpage feature per namespace. This further extends the function of a namespace by extending the types of pages or topics of pages a namespace can home. For example, talk page ''/archives'' are subpages, and they are both namespace searchable and page name searchable from the search box, unlike [[WP:page history|history pages]], which are in no namespace. Another example is in the Template namespace where it is routine to put the documentation in a subpage called ''/doc''.
Random pages are enabled, in the default software configuration, only for the mainspace.
Searching and reporting can operate over the entire database, or they can be limited to a namespace, and so they will offer a list of all the namespaces currently configured. [[Special:WhatLinksHere]] also offers a list of namespaces.
== <span class="anchor" id="Enumeration"></span> Programming ==
The 30 namespaces in the English Wikipedia are numbered for programming purposes. The prefix for each namespace is generated using the [[Help:Magic words#Paths|magic word]] <syntaxhighlight lang=wikitext inline>{{ns}}</syntaxhighlight>, in the form <syntaxhighlight lang=wikitext inline>{{ns:xx}}</syntaxhighlight>, as shown in the table below.
{| border="0" cellpadding="4" cellspacing="0" class="wikitable"
|-
!Namespace variable
!Result (namespace name)
!Namespace variable
!Result (talk namespace name)
|-
|<syntaxhighlight lang=wikitext inline>{{ns:-2}}</syntaxhighlight>
|{{ns:-2}}
|
|
|-
|<syntaxhighlight lang=wikitext inline>{{ns:-1}}</syntaxhighlight>
|{{ns:-1}}
|
|
|-
|<syntaxhighlight lang=wikitext inline>{{ns:0}}</syntaxhighlight>
|{{ns:0}} (main namespace, returns empty string)
|<syntaxhighlight lang=wikitext inline>{{ns:1}}</syntaxhighlight>
|{{ns:1}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:2}}</syntaxhighlight>
|{{ns:2}}
|<syntaxhighlight lang=wikitext inline>{{ns:3}}</syntaxhighlight>
|{{ns:3}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:4}}</syntaxhighlight>
|{{ns:4}}
|<syntaxhighlight lang=wikitext inline>{{ns:5}}</syntaxhighlight>
|{{ns:5}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:6}}</syntaxhighlight>
|{{ns:6}}
|<syntaxhighlight lang=wikitext inline>{{ns:7}}</syntaxhighlight>
|{{ns:7}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:8}}</syntaxhighlight>
|{{ns:8}}
|<syntaxhighlight lang=wikitext inline>{{ns:9}}</syntaxhighlight>
|{{ns:9}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:10}}</syntaxhighlight>
|{{ns:10}}
|<syntaxhighlight lang=wikitext inline>{{ns:11}}</syntaxhighlight>
|{{ns:11}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:12}}</syntaxhighlight>
|{{ns:12}}
|<syntaxhighlight lang=wikitext inline>{{ns:13}}</syntaxhighlight>
|{{ns:13}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:14}}</syntaxhighlight>
|{{ns:14}}
|<syntaxhighlight lang=wikitext inline>{{ns:15}}</syntaxhighlight>
|{{ns:15}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:100}}</syntaxhighlight>
|{{ns:100}}
|<syntaxhighlight lang=wikitext inline>{{ns:101}}</syntaxhighlight>
|{{ns:101}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:118}}</syntaxhighlight>
|{{ns:118}}
|<syntaxhighlight lang=wikitext inline>{{ns:119}}</syntaxhighlight>
|{{ns:119}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:126}}</syntaxhighlight>
|{{ns:126}}
|<syntaxhighlight lang=wikitext inline>{{ns:127}}</syntaxhighlight>
|{{ns:127}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:710}}</syntaxhighlight>
|{{ns:710}}
|<syntaxhighlight lang=wikitext inline>{{ns:711}}</syntaxhighlight>
|{{ns:711}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:828}}</syntaxhighlight>
|{{ns:828}}
|<syntaxhighlight lang=wikitext inline>{{ns:829}}</syntaxhighlight>
|{{ns:829}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:1728}}</syntaxhighlight>
|{{ns:1728}}
|<syntaxhighlight lang=wikitext inline>{{ns:1729}}</syntaxhighlight>
|{{ns:1729}}
|}
Alternative variables are available for most namespaces, for example <syntaxhighlight lang=wikitext inline>{{ns:talk}}</syntaxhighlight>, <syntaxhighlight lang=wikitext inline>{{ns:user}}</syntaxhighlight>, and <syntaxhighlight lang=wikitext inline>{{ns:user_talk}}</syntaxhighlight> for <syntaxhighlight lang=wikitext inline>{{ns:1}}</syntaxhighlight>, <syntaxhighlight lang=wikitext inline>{{ns:2}}</syntaxhighlight> and <syntaxhighlight lang=wikitext inline>{{ns:3}}</syntaxhighlight>. The portal namespace is numbered in the 100-plus range, as are all MediaWiki nonstandard namespaces. It is also possible to use {{tl|Namespace name}} for this, i.e. "<syntaxhighlight lang=wikitext inline>{{Namespace name|711}}</syntaxhighlight>" produces "{{Namespace name|711}}".
All namespaces with a positive number or zero in this list are searchable. Specifically, the {{ns:-2}} and {{ns:-1}} namespaces are not searchable.
The [[Help:Magic words|magic word]] <syntaxhighlight lang=wikitext inline>{{NAMESPACE}}</syntaxhighlight> returns the namespace prefix of the current page. This can be used in combination with other magic words and [[meta:Help:ParserFunctions|parser functions]] to change the appearance of [[WP:Template|templates]] depending on the namespace in which they are transcluded.
Meta-templates have been created to simplify this process. These include the simple template {{tl|main other}}, and the more complex and versatile {{tl|namespace detect}}.
For information on changing the appearance of a page or template by namespace based on CSS, see '''CSS''' section of [[mw:Help:Namespaces#Identifying namespaces|Identifying namespaces]] on the MediaWiki help page.
== See also ==
{{Help desk}}
* [[Wikipedia:Page name]]
* [[Wikipedia:Controlling search engine indexing]]
* [[mw:Help:Namespaces|MediaWiki help page on namespaces]], for general MediaWiki technical information
* [[mw:Extension default namespaces]], for namespaces added by extensions
* [[Special:NamespaceInfo]] - automated listing of information for configured namespaces
== References ==
{{reflist}}
{{Wikipedia technical help|collapsed}}
[[Category:Wikipedia features]]
[[Category:Wikipedia namespace administration| ]]
gih8fq7hbz0ksgpv1cmktye9chw1pt9
22014
22013
2026-09-18T15:20:23Z
Amire80
9
1 измена увезена из [[:en:Wikipedia:Namespace]]: importing from the English Wikipedia
22013
wikitext
text/x-wiki
{{Short description|Prefix before a Wikipedia page's name}}
{{redirect-distinguish|WP:NS|Wikipedia:WikiProject Nova Scotia}}
{{redirect-distinguish|WP:NSPACE|Wikipedia:Notability (astronomical objects)}}
{{pp-semi-vandalism|small=yes}}{{pp-move-indef}}
{{Infopage|WP:NS|WP:NSPACE}}
{{Namespaces}}
A Wikipedia '''namespace''' is a set of Wikipedia pages whose [[Help:page name|names]] begin with a reserved word, followed by a colon. The reserved word is recognized by the [[MediaWiki]] software. For example, in the ''user namespace'' all titles begin with the prefix ''User:''. In the case of the article (or main) namespace, in which encyclopedia articles appear, the reserved word and colon are absent. (Note: main space articles can optionally include a colon at the beginning with no reserved word, so <code>[<nowiki/>[Article]]</code> and <code>[<nowiki/>[:Article]]</code> are equivalent. This is usually only necessary for the advanced technique of [[WP:Transclusion|transcluding]] a main space article into a page in another namespace.)
More generally, a Wikipedia '''namespace''' is a class of pages that falls under a common type. All pages in the <code>User</code> namespace, for example, are [[Wikipedia:User pages|user pages]], whereas [[WP:Drafts|Drafts]] are in the <code>Draft</code> namespace. This page is in the <code>[[WP:Project namespace|Wikipedia]]</code> namespace, for information or discussions about the project itself and its policies.
Wikipedia has 30 current namespaces: 14 subject namespaces, 14 corresponding talk namespaces, and 2 virtual namespaces. These are all listed in the box to the right. While surfing Wikipedia, a list of namespaces is available in two clicks: do an empty search, then click ''Advanced'' under the search box. The list also makes itself available where needed in the dropdown menus of, for example, [[Special:PrefixIndex]], [[Special:AllPages]], [[Special:RecentChanges]], and [[Special:Contributions]].
The aliases '''WP''' for '''Wikipedia''', and '''WT''' for '''Wikipedia talk''', work for page names in the search box, and making links as well as inclusions. See [[#Aliases|Aliases]] below for other aliases. (The pseudo-namespaces such as '''H''' for '''Help''', and '''CAT''' for '''Category''', are extremely limited. See ''[[#Pseudo-namespaces|Pseudo-namespaces]]'' below.)
The table on the right shows what number to use when you want to hide pages that are on your watchlist. See: [[Wikipedia:Hide Pages in Watchlist]] for details.
== Subject namespaces ==
{{see|Wikipedia:Administration#Data structure and development}}
[[File:Policies and guidelines indicator.png|thumb|350px|This page is in the [[Wikipedia:Project namespace|Wikipedia namespace]].]]
Namespaces allow for the organization and separation of [[Wikipedia:Administration#Content namespaces|content pages]] from [[Wikipedia:Administration#Administrative namespaces|administration pages]]. Namespaces separate data into core sets, those intended for public viewing, and those intended for the editing community. Wikipedia's subject namespaces and their functions are listed below. A brief description is provided, but see the link for more information.
{{anchor|subjectpage}}A namespace is sometimes called a ''space'', for short, as in "Project space". A ''subject page'' and its ''talk page'' form a pair.
<!--
in order of {{NAMESPACENUMBER}}
-->
===Current namespaces===
* '''[[Wikipedia:Main namespace|Main namespace]]''' (no prefix): contains all encyclopedia articles, lists, [[Wikipedia:Disambiguation|disambiguation pages]], and encyclopedia [[Wikipedia:Redirect|redirects]]. Sometimes referred to as "mainspace" or "Article".
* '''[[Wikipedia:User namespace|User namespace]]''' (prefix '''User:'''): contains user pages and other pages created by individual users for their own personal use. Pages under this namespace can still be viewed and modified by others, so do not keep any of your sensitive data here.
* '''[[Wikipedia:Wikipedia namespace|Wikipedia namespace]]''' or '''[[Wikipedia:Project namespace|Project namespace]]''' (prefix '''Wikipedia:'''): contains many types of pages connected with the Wikipedia project itself: information, policies, guidelines, essays, processes, discussion, etc. [[Wikipedia:Namespace#Aliases|Namespace aliases]]: '''WP:''' or '''Project:'''
*{{anchor|File|File namespace}}'''[[Wikipedia:File namespace|File namespace]]''' (prefix '''File:'''): contains [[Help:File description page|description pages for media files]] (images, videos, and audio files). A link starting with <code><nowiki>[[File:</nowiki></code> will display the media at that position on the page instead of showing a wikilink that leads to the specified file description page, so if you want the latter effect, use a link beginning with <code><nowiki>[[:File:</nowiki></code> (the [[Help:Colon trick|colon trick]]). Namespace alias: '''Image:'''
* '''[[Help:MediaWiki namespace|MediaWiki namespace]]''' (prefix '''MediaWiki:'''): a namespace containing interface texts, such as the links and messages that appear on automatically generated pages. Pages in this namespace are permanently [[Wikipedia:Protection policy|protected]] against editing by regular users. For a list of these messages, see [[Special:AllMessages]]. (The prefix ''cannot'' be shortened to "MW" because '''mw''' is an interwiki prefix. See ''[[#Interwiki links|Interwiki links]]'' below.)
* '''[[Wikipedia:Template namespace|Template namespace]]''' (prefix '''Template:'''): contains templates – pages that are intended primarily to be [[Wikipedia:Transclusion|transcluded]] or [[Wikipedia:Substitution|substituted]] onto other pages to insert standard text or boxes such as infoboxes and navigation boxes. [[Wikipedia:Namespace#Aliases|Namespace alias]]: '''TM:'''
* '''[[WP:Help namespace|Help namespace]]''' (prefix '''Help:'''): contains pages which provide help in using Wikipedia and its software, both for users of the encyclopedia and for editors.
* '''[[Wikipedia:Category namespace|Category namespace]]''' (prefix '''Category:'''): contains category pages, which are curated lists of related pages and subcategories, along with optional additional text. A link beginning with <code><nowiki>[[Category:</nowiki></code> has the effect of adding the page the link appears on to the specified category; it will not result in a wikilink to the category page itself. If you want the latter, use the [[Help:Colon trick|colon trick]]: <code><nowiki>[[:Category:</nowiki></code>.
* '''[[Wikipedia:Portal namespace|Portal namespace]]''' (prefix '''Portal:'''): for reader-oriented portals that help readers find articles related to a specific topic, and may contain links to encourage contributions to relevant [[Wikipedia:WikiProject|WikiProjects]]. See, for example, [[Portal:Cricket]] and [[Portal:Spaceflight]].
* '''[[Wikipedia:Draft namespace|Draft namespace]]''' (prefix '''Draft:'''): hosts drafts of new (potential) Wikipedia articles.
* '''[[mw:Extension:TimedMediaHandler|TimedText namespace]]''' (prefix '''TimedText:'''): synchronized subtitles for media files.
* '''[[Wikipedia:Module namespace|Module namespace]]''' (prefix '''Module:'''): contains [[mw:Extension:Scribunto|Scribunto]] modules – Lua scripts implementing special-purpose [[mw:Manual:Parser functions|parser functions]] for use in templates, beyond the [[Help:Magic words#Parser functions|basic set]] included with MediaWiki and its [[mw:Extensions FAQ|extensions]].
* {{anchor|MOS}}'''[[WP:Manual of Style|MOS namespace]]''' (prefix '''MOS:'''): contains redirects to subpages of [[WP:Manual of Style]]. Until 2024 this was a pseudo-namespace, but it was turned into a real namespace in 2024 to avoid conflicts with the [[Mooré]] Wikipedia (with the language code <code>mos:</code>).<ref>[[phab:T363538]]</ref>
* '''[[Event:Sandbox|Event namespace]]''' (prefix '''Event:''') contains [[mw:Extension:CampaignEvents]] events.
===Former namespaces===
The following namespaces previously existed but no longer do:
*'''[[Wikipedia:Flow|Flow namespace]]''' (prefix '''Topic:''') was a proposed talk page replacement, formerly installed on English Wikipedia by [[mw:Extension:StructuredDiscussions|Extension:StructuredDiscussions]]. It is no longer installed after being rejected by the community.
* '''[[Wikipedia:Course pages|Education Program namespace]]''' (prefix '''Education Program:'''): uninstalled in 2018, and replaced with the [[wmfdashboard:|Programs & Events Dashboard]].<ref>[[outreach:Education/News/January 2018/Education Extension scheduled shutdown|Education Extension scheduled shutdown]], Wikimedia outreach</ref><ref>{{Section link|Wikipedia:Education noticeboard/Archive 18#NOTICE:_EducationProgram extension is being deprecated}}</ref> However, the namespace was re-added later that year to allow access to old talk pages in the Education program talk: namespace. The namespace was then uninstalled again in 2021 after the remaining talk pages were moved to subpages of [[Wikipedia talk:Education program archive]].
* '''[[Wikipedia:Books|Book namespace]]''' (prefix '''Book:'''): contained entries for Wikipedia books, collections of articles about one theme, which were used to generate downloadable files or printable documents or order books from PediaPress. In 2017, the online book rendering service was withdrawn, leading to the removal of most links leading to the namespace in 2019. The namespace and its transclusions were still retained in the hope that the WMF would come up with a solution,<ref>{{Section link|Wikipedia:Village pump (technical)/Archive 176|Suppress rendering of Template:Wikipedia books}}</ref> but in 2021 the namespace was uninstalled after all remaining books were moved to subpages of [[Wikipedia:Books/archive]].
* '''Gadget namespace''' (prefix '''Gadget:'''):<ref>{{Section link|Wikipedia:Village pump (technical)/Archive 139#New "Gadget:" and "Gadget definition:" namespaces?}}</ref> was intended to store [[Wikipedia:Gadget|Gadgets]], which are small [[Snippet (programming)|snippets]] enabled in [[Special:Preferences#mw-prefsection-gadgets|user preferences]], but was never used for anything other than redirects to the video game ''[[Gadget: Invention, Travel, & Adventure]]'', and for most of its existence could only be edited by WMF staff. Gadgets currently use the [[Help:MediaWiki namespace|MediaWiki namespace]] with the ''MediaWiki:Gadget-'' page name prefix. It was a [[mw:Manual:Using custom namespaces|custom namespace]] installed by the [[mw:Extension:Gadgets|Gadget extension]].
* '''Gadget definition namespace''' (prefix '''Gadget definition:'''): installed but never used; see above for more information. Gadget definitions currently use the [[MediaWiki:Gadgets-definition]] page.
===Aliases and pseudo-namespaces===
{{redirect|Wikipedia:Alias|template parameter aliases|Help:Template#Handling parameters}}
An ''alias'' of a namespace is its namespace. For example, '''WP:''' is '''Wikipedia:''', and so
<code><nowiki>[[</nowiki>Wikipedia:[[WP:Page name|''Page name'']]]]</code> can be abbreviated <code><nowiki>[[WP:</nowiki>[[WP:Page name|''Page name'']]]]</code>.
See ''[[#Aliases|Aliases]]'' below, for a list of aliases, such as '''WT:''' for '''Wikipedia talk:'''.
A ''pseudo-namespace'' is an agreement to create redirect pages named that way, each of which
is a shortcut from mainspace to ''a single page in its namespace''.
So an alias refers to ''any page in its namespace'', but a pseudo-namespace has far fewer pages than its real namespace.
There are a few pseudo-namespace names like '''H:''' for '''Help:''', and '''CAT:''' for '''Category:''', and these can be discovered below in the section ''[[#Pseudo-namespaces|Pseudo-namespaces]]''.
== <span id="Talk"></span><span id="Wikipedia talk"></span><span id="WT"></span> Talk namespaces==
{{shortcut|WP:TALKSPACE}}
{{main|Help:Using talk pages|Wikipedia:Talk page guidelines}}
Each of the above namespaces (but not the virtual namespaces and the former Topic: namespace) has an associated [[help:talk page|talk namespace]]—these are also known as ''discussion pages''. The talk namespaces are designated by appending the word <code>talk</code> to the namespace name. For example, the talk namespace associated with the user namespace has the prefix '''User talk:'''. The talk namespace associated with the article namespace is '''Talk:'''.
Most of the pages in the talk namespaces are used to discuss changes to the corresponding page in the associated namespace. Pages in the ''user talk'' namespace are used to leave messages for a particular user. The user talk namespace is special in that, whenever a user's talk page is edited, that user will see an orange box saying "You have new messages" on the top of every page that they view until they visit their talk page. By default, logged-in users will see [[Wikipedia:Notifications|a red notification square]] ''and'' a small orange box on the top right hand corner of the page; IP users will only see a wide orange box spanning the top of the page. (Minor edits made by [[Wikipedia:Bot policy|bots]] no longer set off the new message bar. For logged-in users, the new-message bar may be disabled in [[Special:Preferences]].)
Note that the prefix '''WT:''' expands to '''Wikipedia talk:''', just as '''WP:''' expands to '''Wikipedia:''' (see [[#Aliases|Aliases]] below). For example, <nowiki>[[WT:Verifiability]]</nowiki> links to [[Wikipedia talk:Verifiability]].
== Virtual namespaces<span id="Special"></span> ==
In addition to subject namespaces and their corresponding talk pages, there are two virtual namespaces (without corresponding talk pages) for specialist purposes:
=== Special ===
{{Main|Help:Special page}}
The ''Special:'' namespace consists of pages (called ''special pages'') that are created by the software on demand, such as [[Special:RecentChanges]]. These pages can be linked as usual, as with <nowiki>[[Special:RecentChanges]]</nowiki>, except when they have parameters. To use parameters, the full URL must be given as an external link. For example, https:{{SERVER}}{{SCRIPTPATH}}/index.php?title=Special:Recentchanges&days=3&limit=10, which returns the last ten changes in the last three days.
You can create a [[Wikipedia:redirect|redirect]] to a Special page, but the redirect will not be followed automatically.
For a list of special pages, see [[Special:SpecialPages]].
=== Media<span class="anchor" id="Media namespace"></span> ===
{{Main|Help:Files}}
The ''Media:'' namespace can be used to link directly to a file, rather than to the file description page.
== Aliases and pseudo-namespaces==
{{See|Wikipedia:Shortcut#List of prefixes}}
Aliases and pseudo-namespaces are not namespaces in themselves; their main role is to provide handy ways to link to actual namespaces, by providing shortened links.
The main difference between them being the way they work for this purpose; while aliases directly link to namespaces, pseudo-namespaces can only link to other namespaces by using specialist [[Wikipedia:Redirect|redirect pages]] in the main namespace called [[Wikipedia:Shortcut|shortcuts]]. While aliases are also used for shortcuts, this isn't necessary if the pagename is not shortened.
Pseudo-namespaces all actually reside in main namespace; but a pseudo-namespace called [[m:Help:Transwiki|Transwiki:]] exists as a pseudo-namespace before being moved to another namespace.
=== Aliases ===
{{Shortcut|WP:ALIAS}}
There are seven aliases defined for namespaces, all of which are case-insensitive:
{| class=wikitable
!Namespace
!Alias
|-
| rowspan="2" |Wikipedia
|WP
|-
|Project
|-
| rowspan="2" |Wikipedia talk
|WT
|-
|Project talk
|-
|File
|Image
|-
|File talk
|Image talk
|-
|Template
|TM
|}
These aliases are automatically translated by the Wikipedia servers to the proper namespace prefix. So if a link is made to a page title beginning with one of these aliases, or else entered in the search box or used in a URL in a browser address bar, the alias links to the page with the corresponding true namespace prefix. Hence entering [[WP:External links]] or [[Project:External links]] is equivalent to entering [[Wikipedia:External links]]; and entering [[WT:External links]] or [[Project talk:External links]] is equivalent to entering [[Wikipedia talk:External links]].
An alias cannot be used as the actual namespace in a page title. For example, you cannot create page ''WP:123''; if tried, the page name is instantly converted to ''Wikipedia:123''. It ''is'', however, possible to [[Wikipedia:Page name#Changing the displayed title|change the ''displayed'' title]] on page ''Wikipedia:123'' to make it ''WP:123'' or ''Project:123''.
<span class="plainlinks">This is very handy for the creation of [[Wikipedia:Shortcut|shortcuts]]. For example, the shortcut for this section is [[WP:ALIAS]], as shown in the right-side box. When the link is clicked, it is automatically translated to [https://en.wikipedia.org/w/index.php?title=Wikipedia:ALIAS&redirect=no Wikipedia:ALIAS]. At this page is a [[Help:Redirect|redirect]] to {{Section link|Wikipedia:Namespace#Aliases}}. This means that the shortcut goes directly to this section from anywhere on Wikipedia. It can also be entered as a [[URL]] in the browser address bar as https://en.wikipedia.org/wiki/WP:ALIAS .</span>
=== Pseudo-namespaces ===
<!-- This section is linked from [[Wikipedia:Glossary]] -->
{{Shortcut|WP:PNS}}
Apart from Wikipedia's 24 regular namespaces and their aliases, and 2 virtual ones, there are several title prefixes appearing in [[Help:Shortcut|shortcut redirects]] pointing to frequently-referred-to Wikipedia pages. These prefixes are referred to as '''pseudo-namespaces''' and include the following:
* '''[[Special:Prefixindex/CAT:|CAT:]]''' for shortcuts to the [[Wikipedia:Category namespace|Category namespace]]. See also [[:Category:Redirects to category space]]
* '''[[Special:Prefixindex/H:|H:]]''' for shortcuts to the [[Wikipedia:Help namespace|Help namespace]]. See also [[:Category:Redirects to help namespace]]
* '''[[Special:Prefixindex/P:|P:]]''' for shortcuts to the [[Wikipedia:Portal namespace|Portal namespace]]. See also [[:Category:Redirects to portal namespace]]
A more complete list is available at {{Section link|Wikipedia:Shortcut#List of prefixes}}.
Pseudo-namespaces are not in any way recognised by the wiki software; they are purely a community custom. Titles in pseudo-namespaces actually belong technically in the main (article) namespace and are treated as such by the software: they are case-sensitive and appear in [[Help:Search#Syntax|search results]] restricted to the main namespace. An alias is treated like a real namespace, resulting in a search for the [[WP:page name|pagename]] in its namespace, but the "pseudo-namespace:pagename" search is in mainspace, not its pseudo-namespace. For example, searching for "H:S" will not search '''Help'''.
To learn some of these shortcuts, first follow the pseudo-namespace link above, then follow one of the redirects listed on that page. It will take you to the target, where you then notice any {{tl|shortcut}} boxes to the right of the page, which may also list some additional shortcuts to that same area. By observing these steps repeatedly, you can discover ways to shorten your typing.
To understand the appropriateness of redirects of this type, see [[Wikipedia:Cross-namespace redirects]]. All shortcuts are discoverable by [[Help:Searching|searching]] for redirects. There is also the category [[:Category:Wikipedia redirects|Wikipedia redirects]].
As a final example, every [[Wikimedia Foundation]] project has a "[[m:Help:Transwiki|Transwiki:]]" pseudo-namespace (sometimes a real namespace) for importing articles manually. A wiki project that would manually move many pages between [[wp:sister|sister projects]] uses this tag. Redirects/shortcuts are not directly involved here, as described above. Instead, the page title is [[WP:move|move]]d to "Transwiki:''namespace:pagename''", and that content is then copied and pasted into a new page name of that temporary title on the target wiki. When it is accepted, the title is then moved out of the '''Transwiki''' pseudo-namespace there and becomes a real page name in its respective namespace.
==<span id="Interwiki links"></span>Interwiki and interlanguage links ==
{{see|Help:Interwiki linking|Help:Interlanguage links}}
[[m:Table of Wikimedia projects|Interwiki]] and [[m:List of Wikipedias|interlanguage]] prefixes do not define namespaces, but point to pages in other Wikimedia projects, outside the en.wikipedia.org website. They are mentioned here because they use a namespace-like prefix technique for linking. Examples of interwiki prefixes include '''w:''' for Wikipedia; '''m:''' (or '''meta:''') for [[Meta-Wiki]], '''mw:''' for [[MediaWiki]], and '''wikt:''' for [[Wiktionary]]. Examples of interlanguage prefixes include '''en:''' for English language, '''fr:''' for French language, and '''de:''' for German language.
Important points to note:
* In the presence of an interwiki prefix and the absence of an interlanguage prefix, the link will be to a specified project in the current language. So <code><nowiki>[[w:Internet]]</nowiki></code> links to "[[w:Internet|Internet]]" on the English Wikipedia, if the link is on any English-language Wikimedia project.
* In the presence of an interlanguage prefix and the absence of an interwiki prefix, the link will be to a specified language in the current project. So <code><nowiki>[[:en:Internet]]</nowiki></code> will link to "[[:en:Internet|Internet]]" on the English Wikipedia, if the link is on a Wikipedia project in any language.
When making links to other language Wikipedias, add an initial colon if you want the link to appear inline rather than in the skin's sidebar under "Languages"; see [[Help:Colon trick]] for an explanation. So <code><nowiki>[[:de:Internet]]</nowiki></code> is an inline link to "[[:de:Internet|Internet]]" in the German Wikipedia; but if using an interwiki prefix this is unnecessary, for example <code><nowiki>[[w:de:Internet]]</nowiki></code> is the same inline link.
Further examples:
* [[m:Meta:Babel]] and [[meta:Meta:Babel]] both link to the "Babel" page in the project namespace (Meta:, the 2nd prefix) of Meta-Wiki (m: or meta:, the 1st prefix).
* [[wikt:fr:Discuter:pied/fusion daf]] links to the "pied/fusion daf" page in the talk namespace (Discuter:, the 3rd prefix) of French (fr:, the 2nd prefix) Wiktionary (wikt:, the 1st prefix).
Interwiki prefixes are not just for Wikimedia projects. For example, [[google:]] is the interwiki link for [[Google]]. For a complete list of interwiki prefixes, see the [[m:Interwiki map|interwiki map]] and [[m:Special:Interwiki|interwiki table]].
As with aliases, it is not possible to create a page with a title beginning with an interwiki or interlanguage prefix. It is also not possible to create redirects to interwiki pages, unless it is a [[Wikipedia:Soft redirect|soft redirect]].
== Case insensitivity ==
Standard namespace names, aliases and interwiki prefixes are case insensitive. The same applies to the first character after the colon. Hence the following all link to the same page:
* [[Wikipedia:Afd]], [[WIKIPEDIA:Afd]], [[wIKIpedia:Afd]], [[wikipedia:afd]]
* [[wP:Afd]], [[wp:Afd]], [[WP:afd]]
* [[PROJECT:Afd]], [[project:Afd]], [[ProjecT:Afd]], [[Project:afd]]
== Namespace-dependent functionality ==
The namespace name is a useful variable for searching in and reporting on sets of [[WP:Page name|pages]]. It is also used to apply features that configure the sets of pages in one namespace differently from another namespace. Using the namespace name MediaWiki can:
*[[WP:Search|Search]] for pages in a particular namespace only.
* [[Help:Special page|Report]] on [[Special:AllPages|content]] or [[WP:Recent changes|changes in content]] of a namespace.
* Enable or disable the [[WP:Subpage|subpage]] feature, per namespace.
* Offer a [[WP:Random article|random article]] for the mainspace (<kbd><nowiki>[[</nowiki>Special:Random<nowiki>]]</nowiki></kbd>), or for a namespace <kbd><nowiki>[[</nowiki>Special:Random/''Namespace'']]</kbd>.
* Change the functionality of <kbd><nowiki>[[</nowiki>''wikilink''<nowiki>]]</nowiki></kbd> if it targets the '''Category''' namespace or '''File''' namespace. Normally wikilinks are activated by the mouse, but <kbd><nowiki>[[</nowiki>Category:''Pagename''<nowiki>]]</nowiki></kbd> activates software functionality when the [[WP:Category|page is saved]], and <kbd><nowiki>[[</nowiki>File:''Page name''<nowiki>]]</nowiki></kbd> activates software functionality when the [[WP:Image|page is rendered]].
* Change the functionality of <kbd><nowiki>{{</nowiki>[[WP:Transclusion|pagename]]<nowiki>}}</nowiki></kbd> so that it defaults to the set of pagenames in '''Template'''.
* Tailor ''[[Wikipedia:Edit notices|edit notices]]'' to a particular namespace's edit page, informing an editor of certain aspects about the content of that namespace.
* Allow ''[[Wikipedia:Templates|templates]]'' to behave differently on pages of different namespaces.
The namespace functionality is often visible in the URL, where you will see a namespace number. These are given in the table below.
Subpages are configured for all namespaces except Main, File, MediaWiki and Category namespaces. Subpages are configured in the software by enabling or disabling the subpage feature per namespace. This further extends the function of a namespace by extending the types of pages or topics of pages a namespace can home. For example, talk page ''/archives'' are subpages, and they are both namespace searchable and page name searchable from the search box, unlike [[WP:page history|history pages]], which are in no namespace. Another example is in the Template namespace where it is routine to put the documentation in a subpage called ''/doc''.
Random pages are enabled, in the default software configuration, only for the mainspace.
Searching and reporting can operate over the entire database, or they can be limited to a namespace, and so they will offer a list of all the namespaces currently configured. [[Special:WhatLinksHere]] also offers a list of namespaces.
== <span class="anchor" id="Enumeration"></span> Programming ==
The 30 namespaces in the English Wikipedia are numbered for programming purposes. The prefix for each namespace is generated using the [[Help:Magic words#Paths|magic word]] <syntaxhighlight lang=wikitext inline>{{ns}}</syntaxhighlight>, in the form <syntaxhighlight lang=wikitext inline>{{ns:xx}}</syntaxhighlight>, as shown in the table below.
{| border="0" cellpadding="4" cellspacing="0" class="wikitable"
|-
!Namespace variable
!Result (namespace name)
!Namespace variable
!Result (talk namespace name)
|-
|<syntaxhighlight lang=wikitext inline>{{ns:-2}}</syntaxhighlight>
|{{ns:-2}}
|
|
|-
|<syntaxhighlight lang=wikitext inline>{{ns:-1}}</syntaxhighlight>
|{{ns:-1}}
|
|
|-
|<syntaxhighlight lang=wikitext inline>{{ns:0}}</syntaxhighlight>
|{{ns:0}} (main namespace, returns empty string)
|<syntaxhighlight lang=wikitext inline>{{ns:1}}</syntaxhighlight>
|{{ns:1}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:2}}</syntaxhighlight>
|{{ns:2}}
|<syntaxhighlight lang=wikitext inline>{{ns:3}}</syntaxhighlight>
|{{ns:3}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:4}}</syntaxhighlight>
|{{ns:4}}
|<syntaxhighlight lang=wikitext inline>{{ns:5}}</syntaxhighlight>
|{{ns:5}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:6}}</syntaxhighlight>
|{{ns:6}}
|<syntaxhighlight lang=wikitext inline>{{ns:7}}</syntaxhighlight>
|{{ns:7}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:8}}</syntaxhighlight>
|{{ns:8}}
|<syntaxhighlight lang=wikitext inline>{{ns:9}}</syntaxhighlight>
|{{ns:9}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:10}}</syntaxhighlight>
|{{ns:10}}
|<syntaxhighlight lang=wikitext inline>{{ns:11}}</syntaxhighlight>
|{{ns:11}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:12}}</syntaxhighlight>
|{{ns:12}}
|<syntaxhighlight lang=wikitext inline>{{ns:13}}</syntaxhighlight>
|{{ns:13}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:14}}</syntaxhighlight>
|{{ns:14}}
|<syntaxhighlight lang=wikitext inline>{{ns:15}}</syntaxhighlight>
|{{ns:15}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:100}}</syntaxhighlight>
|{{ns:100}}
|<syntaxhighlight lang=wikitext inline>{{ns:101}}</syntaxhighlight>
|{{ns:101}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:118}}</syntaxhighlight>
|{{ns:118}}
|<syntaxhighlight lang=wikitext inline>{{ns:119}}</syntaxhighlight>
|{{ns:119}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:126}}</syntaxhighlight>
|{{ns:126}}
|<syntaxhighlight lang=wikitext inline>{{ns:127}}</syntaxhighlight>
|{{ns:127}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:710}}</syntaxhighlight>
|{{ns:710}}
|<syntaxhighlight lang=wikitext inline>{{ns:711}}</syntaxhighlight>
|{{ns:711}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:828}}</syntaxhighlight>
|{{ns:828}}
|<syntaxhighlight lang=wikitext inline>{{ns:829}}</syntaxhighlight>
|{{ns:829}}
|-
|<syntaxhighlight lang=wikitext inline>{{ns:1728}}</syntaxhighlight>
|{{ns:1728}}
|<syntaxhighlight lang=wikitext inline>{{ns:1729}}</syntaxhighlight>
|{{ns:1729}}
|}
Alternative variables are available for most namespaces, for example <syntaxhighlight lang=wikitext inline>{{ns:talk}}</syntaxhighlight>, <syntaxhighlight lang=wikitext inline>{{ns:user}}</syntaxhighlight>, and <syntaxhighlight lang=wikitext inline>{{ns:user_talk}}</syntaxhighlight> for <syntaxhighlight lang=wikitext inline>{{ns:1}}</syntaxhighlight>, <syntaxhighlight lang=wikitext inline>{{ns:2}}</syntaxhighlight> and <syntaxhighlight lang=wikitext inline>{{ns:3}}</syntaxhighlight>. The portal namespace is numbered in the 100-plus range, as are all MediaWiki nonstandard namespaces. It is also possible to use {{tl|Namespace name}} for this, i.e. "<syntaxhighlight lang=wikitext inline>{{Namespace name|711}}</syntaxhighlight>" produces "{{Namespace name|711}}".
All namespaces with a positive number or zero in this list are searchable. Specifically, the {{ns:-2}} and {{ns:-1}} namespaces are not searchable.
The [[Help:Magic words|magic word]] <syntaxhighlight lang=wikitext inline>{{NAMESPACE}}</syntaxhighlight> returns the namespace prefix of the current page. This can be used in combination with other magic words and [[meta:Help:ParserFunctions|parser functions]] to change the appearance of [[WP:Template|templates]] depending on the namespace in which they are transcluded.
Meta-templates have been created to simplify this process. These include the simple template {{tl|main other}}, and the more complex and versatile {{tl|namespace detect}}.
For information on changing the appearance of a page or template by namespace based on CSS, see '''CSS''' section of [[mw:Help:Namespaces#Identifying namespaces|Identifying namespaces]] on the MediaWiki help page.
== See also ==
{{Help desk}}
* [[Wikipedia:Page name]]
* [[Wikipedia:Controlling search engine indexing]]
* [[mw:Help:Namespaces|MediaWiki help page on namespaces]], for general MediaWiki technical information
* [[mw:Extension default namespaces]], for namespaces added by extensions
* [[Special:NamespaceInfo]] - automated listing of information for configured namespaces
== References ==
{{reflist}}
{{Wikipedia technical help|collapsed}}
[[Category:Wikipedia features]]
[[Category:Wikipedia namespace administration| ]]
gih8fq7hbz0ksgpv1cmktye9chw1pt9
Розгварка о Википедиї:Namespace
5
3749
22015
2026-08-23T08:52:08Z
Qwerty123M
2824
Reverted 1 edit by [[Special:Contributions/Shafi19871|Shafi19871]] ([[User talk:Shafi19871|talk]]) to last revision by Andrybak
22015
wikitext
text/x-wiki
{{WikiProject banner shell|
{{Wikipedia Help Project|class=NA|importance=high}}
}}
{{old moves|list=
*Wikipedia:Namespace → Help:Namespace, 13 January 2013, [[Wikipedia talk:Namespace#Requested move]]
}}
{{merged-from |Help:Namespace |12 June 2009}}
{{Archives}}
== FAQ Namespace ==
Where would one petition to have a FAQ namespace added? There are many articles where discussions are endlessly repeated, and calls for merges, deletions, or era changes, etc are repeated by newcomers. A few of the Talk pages I've seen recently have mentioned the desire to have a FAQ page where results of major-change discussions, or results of discussions of questions frequently asked can be placed for easy reference without having to rehash a long discussion all over again on the Talk page. Is there a place at WP where a request for a new namespace could be placed? Many thanks. — [[User:Imeriki al-Shimoni|<span style="color:#60d;font-weight:bold;text-shadow:3px 3px 2px #aaa;">al-Shimoni</span>]] ([[User talk:Imeriki al-Shimoni|talk]]) 07:51, 16 December 2011 (UTC)
== Request for comment: Page move nomination ==
Due to the fact that this page is a how to guide, It should be moved to Help:Namespaces with a redirect. -- [[User:PythonSwarm|PythonSwarm]] <sup>[[User talk:PythonSwarm|Talk]] | [[Special:Contribs/PythonSwarm|Contribs]] | [[Special:CentralAuth/PythonSwarm|Global]]</sup> 01:10, 24 August 2020 (UTC)
:{{u|PythonSwarm}}, this is '''almost''' a [[WP:RM|requested move]] discussion. [[User:I dream of horses|I dream of horses]] [[Special:Contribs/I dream of horses|(Contribs)]] Please [[WP:NOTIFY|notify]] me after replying off my [[User talk:I dream of horses|talk page.]] Thank you. 02:34, 24 August 2020 (UTC)
=== Discussion ===
*'''Opposed''' really only seeing infomation here rather then how to do something.--<span style="font-weight:bold;color:darkblue">[[User_talk:Moxy|Moxy]]</span> <span style="color:red">🍁</span> 03:04, 24 August 2020 (UTC)
*'''Oppose''' <small>(Called forth by bot)</small> This is not a help page, it does fine in the Wikipedia namespace. We try to keep only the most relevant things in the help namespace so that our experienced hands can easily find things by searching something like "WP:NAMESPACE". I wouldn't think to search "Help:Namespace", because help pages are not really built for our experienced hands, and I don't think this page is meant as a starter guide. [[User:CaptainEek|<span style="color:#6a1f7f">'''CaptainEek'''</span>]] <sup>[[User talk:CaptainEek|<span style="font-size:82%"><span style="color:#a479e5">''Edits Ho Cap'n!''</span></span>]]</sup>[[Special:Contributions/CaptainEek|⚓]] 04:18, 24 August 2020 (UTC)
*'''opposed''' This page is more than a help page. It fits this namespace well. [[User:Philoserf|—¿philoserf?]] ([[User talk:Philoserf|talk]]) 22:48, 24 August 2020 (UTC)
*'''Keep'''. This page is more about the guidelines we have established for the use of namespaces on Wikipedia, than about how namespaces work within our software. --[[User:Bsherr|Bsherr]] ([[User talk:Bsherr|talk]]) 04:02, 25 August 2020 (UTC)
*'''Support''', this is almost entirely a help page, and I believe these should ideally placed in the Help namespace. Almost all of it is about the technical aspects of namespaces, and there is very little policy discussion or commentary. --[[User:Mrjulesd|<span style="color:orange;">--Jules</span>]] [[User talk:Mrjulesd|(Mrjulesd)]] 20:59, 25 August 2020 (UTC)
== RIP Gadget talk: Invention, Travel, & Adventure ==
GOOD NIGHT SWEET PRINCE
YOU WILL BE MISSED
/-_-\
/ / \
/ / \
\ \ /
\__\__/
\\
-\\ ____
\\ / /
____ \\/___/
\ \ -//
\___\//-
-//
\\
//
//-
-//
//
\\
\\
<b style="font-family: monospace; color:#E35BD8">[[User:JPxG|<b style="color:#029D74">jp</b>]]×[[Special:Contributions/JPxG|<b style="color: #029D74">g</b>]][[User talk:JPxG|🗯️]]</b> 07:42, 3 March 2024 (UTC)
== Semi-protected edit request on 21 August 2024 ==
{{edit semi-protected|Wikipedia:Namespace|answered=yes}}
Please change the Wikimedia Outreach reference: from <code><nowiki>[https://outreach.m.wikimedia.org/wiki/Education/News/January_2018/Education_Extension_scheduled_shutdown Education_Extension_scheduled_shutdown, Wikimedia outreach]</nowiki></code> to <code><nowiki>[https://outreach.wikimedia.org/wiki/Education/News/January_2018/Education_Extension_scheduled_shutdown "Education Extension scheduled shutdown"], Wikimedia Outreach</nowiki></code>; this removes the [[:Help:Mobile access|mobile site prefix]] that isn't optimised for desktop usage (and if browsing on a mobile, it should be automatically changed anyway), and it also doesn't display underscores in the link. [[Special:Contributions/83.28.217.24|83.28.217.24]] ([[User talk:83.28.217.24|talk]]) 09:22, 21 August 2024 (UTC)
:It would be better to use <code><nowiki>[[outreach:Education/News/January 2018/Education Extension scheduled shutdown|Education Extension scheduled shutdown]]</nowiki></code> which yields [[outreach:Education/News/January 2018/Education Extension scheduled shutdown|Education Extension scheduled shutdown]]. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] 🌹 ([[User talk:Redrose64|talk]]) 16:49, 21 August 2024 (UTC)
:: Agreed, {{done}}<!-- Template:ESp --> [[User:Tollens|Tollens]] ([[User talk:Tollens|talk]]) 19:32, 21 August 2024 (UTC)
== Alias "cat:" ==
Commons already supports it, e.g., [[:c:cat:SVG numbers]] redirects to [[:c:Category:SVG numbers]] -- why not on English Wikipedia, too? [[Wikipedia_talk:Namespace/Archive_1#Integrate_pseudo-namespace_into_alias-namespace|Previous discussion]] alluded to "pollution" and the use of colon character in article titles. But the actual problem would be articles starting with "cat:", which currently are only some "pseudo-namespaces" (cross-space redirects) [https://en.wikipedia.org/wiki/Special:PrefixIndex/CAT:] . [[User:Fgnievinski|fgnievinski]] ([[User talk:Fgnievinski|talk]]) 02:45, 23 February 2025 (UTC)
==Discussion at [[:Wikipedia:Village pump (technical)#Adding a SecurePoll namespace|Wikipedia:Village pump (technical) § Adding a SecurePoll namespace]]==
[[File:Symbol watching blue lashes high contrast.svg|25px|link=|alt=]] You are invited to join the discussion at [[:Wikipedia:Village pump (technical)#Adding a SecurePoll namespace|Wikipedia:Village pump (technical) § Adding a SecurePoll namespace]]. –[[User:Novem Linguae|<span style="color:blue">'''Novem Linguae'''</span>]] <small>([[User talk:Novem Linguae|talk]])</small> 08:06, 19 June 2025 (UTC)<!-- [[Template:Please see]] -->
== Feedback requested regarding WP and Help namespaces ==
Your feedback would be appreciated at the following discussion: [[WP:Village pump (idea lab)#Same titled page in both WP and Help namespaces]]. Thanks, [[User:Mathglot|Mathglot]] ([[User talk:Mathglot|talk]]) 09:20, 14 December 2025 (UTC)
: It should be further noted that subpage [[Wikipedia:Namespace/Help vs. Wikipedia]] is featured in that discussion, and was created for it. [[User:Mathglot|Mathglot]] ([[User talk:Mathglot|talk]]) 10:26, 16 December 2025 (UTC)
e2qkxdlgdb0fv5gimfzwdhiv3re4o5o
22016
22015
2026-09-18T15:20:23Z
Amire80
9
1 измена увезена из [[:en:Wikipedia_talk:Namespace]]: importing from the English Wikipedia
22015
wikitext
text/x-wiki
{{WikiProject banner shell|
{{Wikipedia Help Project|class=NA|importance=high}}
}}
{{old moves|list=
*Wikipedia:Namespace → Help:Namespace, 13 January 2013, [[Wikipedia talk:Namespace#Requested move]]
}}
{{merged-from |Help:Namespace |12 June 2009}}
{{Archives}}
== FAQ Namespace ==
Where would one petition to have a FAQ namespace added? There are many articles where discussions are endlessly repeated, and calls for merges, deletions, or era changes, etc are repeated by newcomers. A few of the Talk pages I've seen recently have mentioned the desire to have a FAQ page where results of major-change discussions, or results of discussions of questions frequently asked can be placed for easy reference without having to rehash a long discussion all over again on the Talk page. Is there a place at WP where a request for a new namespace could be placed? Many thanks. — [[User:Imeriki al-Shimoni|<span style="color:#60d;font-weight:bold;text-shadow:3px 3px 2px #aaa;">al-Shimoni</span>]] ([[User talk:Imeriki al-Shimoni|talk]]) 07:51, 16 December 2011 (UTC)
== Request for comment: Page move nomination ==
Due to the fact that this page is a how to guide, It should be moved to Help:Namespaces with a redirect. -- [[User:PythonSwarm|PythonSwarm]] <sup>[[User talk:PythonSwarm|Talk]] | [[Special:Contribs/PythonSwarm|Contribs]] | [[Special:CentralAuth/PythonSwarm|Global]]</sup> 01:10, 24 August 2020 (UTC)
:{{u|PythonSwarm}}, this is '''almost''' a [[WP:RM|requested move]] discussion. [[User:I dream of horses|I dream of horses]] [[Special:Contribs/I dream of horses|(Contribs)]] Please [[WP:NOTIFY|notify]] me after replying off my [[User talk:I dream of horses|talk page.]] Thank you. 02:34, 24 August 2020 (UTC)
=== Discussion ===
*'''Opposed''' really only seeing infomation here rather then how to do something.--<span style="font-weight:bold;color:darkblue">[[User_talk:Moxy|Moxy]]</span> <span style="color:red">🍁</span> 03:04, 24 August 2020 (UTC)
*'''Oppose''' <small>(Called forth by bot)</small> This is not a help page, it does fine in the Wikipedia namespace. We try to keep only the most relevant things in the help namespace so that our experienced hands can easily find things by searching something like "WP:NAMESPACE". I wouldn't think to search "Help:Namespace", because help pages are not really built for our experienced hands, and I don't think this page is meant as a starter guide. [[User:CaptainEek|<span style="color:#6a1f7f">'''CaptainEek'''</span>]] <sup>[[User talk:CaptainEek|<span style="font-size:82%"><span style="color:#a479e5">''Edits Ho Cap'n!''</span></span>]]</sup>[[Special:Contributions/CaptainEek|⚓]] 04:18, 24 August 2020 (UTC)
*'''opposed''' This page is more than a help page. It fits this namespace well. [[User:Philoserf|—¿philoserf?]] ([[User talk:Philoserf|talk]]) 22:48, 24 August 2020 (UTC)
*'''Keep'''. This page is more about the guidelines we have established for the use of namespaces on Wikipedia, than about how namespaces work within our software. --[[User:Bsherr|Bsherr]] ([[User talk:Bsherr|talk]]) 04:02, 25 August 2020 (UTC)
*'''Support''', this is almost entirely a help page, and I believe these should ideally placed in the Help namespace. Almost all of it is about the technical aspects of namespaces, and there is very little policy discussion or commentary. --[[User:Mrjulesd|<span style="color:orange;">--Jules</span>]] [[User talk:Mrjulesd|(Mrjulesd)]] 20:59, 25 August 2020 (UTC)
== RIP Gadget talk: Invention, Travel, & Adventure ==
GOOD NIGHT SWEET PRINCE
YOU WILL BE MISSED
/-_-\
/ / \
/ / \
\ \ /
\__\__/
\\
-\\ ____
\\ / /
____ \\/___/
\ \ -//
\___\//-
-//
\\
//
//-
-//
//
\\
\\
<b style="font-family: monospace; color:#E35BD8">[[User:JPxG|<b style="color:#029D74">jp</b>]]×[[Special:Contributions/JPxG|<b style="color: #029D74">g</b>]][[User talk:JPxG|🗯️]]</b> 07:42, 3 March 2024 (UTC)
== Semi-protected edit request on 21 August 2024 ==
{{edit semi-protected|Wikipedia:Namespace|answered=yes}}
Please change the Wikimedia Outreach reference: from <code><nowiki>[https://outreach.m.wikimedia.org/wiki/Education/News/January_2018/Education_Extension_scheduled_shutdown Education_Extension_scheduled_shutdown, Wikimedia outreach]</nowiki></code> to <code><nowiki>[https://outreach.wikimedia.org/wiki/Education/News/January_2018/Education_Extension_scheduled_shutdown "Education Extension scheduled shutdown"], Wikimedia Outreach</nowiki></code>; this removes the [[:Help:Mobile access|mobile site prefix]] that isn't optimised for desktop usage (and if browsing on a mobile, it should be automatically changed anyway), and it also doesn't display underscores in the link. [[Special:Contributions/83.28.217.24|83.28.217.24]] ([[User talk:83.28.217.24|talk]]) 09:22, 21 August 2024 (UTC)
:It would be better to use <code><nowiki>[[outreach:Education/News/January 2018/Education Extension scheduled shutdown|Education Extension scheduled shutdown]]</nowiki></code> which yields [[outreach:Education/News/January 2018/Education Extension scheduled shutdown|Education Extension scheduled shutdown]]. --[[User:Redrose64|<span style="color:#a80000; background:#ffeeee; text-decoration:inherit">Red</span>rose64]] 🌹 ([[User talk:Redrose64|talk]]) 16:49, 21 August 2024 (UTC)
:: Agreed, {{done}}<!-- Template:ESp --> [[User:Tollens|Tollens]] ([[User talk:Tollens|talk]]) 19:32, 21 August 2024 (UTC)
== Alias "cat:" ==
Commons already supports it, e.g., [[:c:cat:SVG numbers]] redirects to [[:c:Category:SVG numbers]] -- why not on English Wikipedia, too? [[Wikipedia_talk:Namespace/Archive_1#Integrate_pseudo-namespace_into_alias-namespace|Previous discussion]] alluded to "pollution" and the use of colon character in article titles. But the actual problem would be articles starting with "cat:", which currently are only some "pseudo-namespaces" (cross-space redirects) [https://en.wikipedia.org/wiki/Special:PrefixIndex/CAT:] . [[User:Fgnievinski|fgnievinski]] ([[User talk:Fgnievinski|talk]]) 02:45, 23 February 2025 (UTC)
==Discussion at [[:Wikipedia:Village pump (technical)#Adding a SecurePoll namespace|Wikipedia:Village pump (technical) § Adding a SecurePoll namespace]]==
[[File:Symbol watching blue lashes high contrast.svg|25px|link=|alt=]] You are invited to join the discussion at [[:Wikipedia:Village pump (technical)#Adding a SecurePoll namespace|Wikipedia:Village pump (technical) § Adding a SecurePoll namespace]]. –[[User:Novem Linguae|<span style="color:blue">'''Novem Linguae'''</span>]] <small>([[User talk:Novem Linguae|talk]])</small> 08:06, 19 June 2025 (UTC)<!-- [[Template:Please see]] -->
== Feedback requested regarding WP and Help namespaces ==
Your feedback would be appreciated at the following discussion: [[WP:Village pump (idea lab)#Same titled page in both WP and Help namespaces]]. Thanks, [[User:Mathglot|Mathglot]] ([[User talk:Mathglot|talk]]) 09:20, 14 December 2025 (UTC)
: It should be further noted that subpage [[Wikipedia:Namespace/Help vs. Wikipedia]] is featured in that discussion, and was created for it. [[User:Mathglot|Mathglot]] ([[User talk:Mathglot|talk]]) 10:26, 16 December 2025 (UTC)
e2qkxdlgdb0fv5gimfzwdhiv3re4o5o
Модул:Wikitext Parsing
828
3750
22017
2026-07-29T21:33:46Z
Pppery
88
Copy from sandbox per request
22017
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
22018
22017
2026-09-18T15:20:23Z
Amire80
9
1 измена увезена из [[:en:Module:Wikitext_Parsing]]: importing from the English Wikipedia
22017
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
Модул:Disambiguation/templates
828
3751
22019
2026-02-26T17:22:58Z
Pppery
88
Update list
22019
Scribunto
text/plain
-- This page contains a table of all disambiguation templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
["Disambiguation"] = true,
["Begriffsklärung"] = true,
["DAB"] = true,
["Dab"] = true,
["Dab page"] = true,
["Dabpage"] = true,
["Dbig"] = true,
["Dis"] = true,
["Disam"] = true,
["Disamb"] = true,
["Disambig"] = true,
["Disambig misspelling"] = true,
["Disambig-plants"] = true,
["Disambiguation page"] = true,
["Manual of Style disambiguation"] = true,
["Meta disambig"] = true,
["MOS disambiguation"] = true,
["MoS disambiguation"] = true,
["Portal disambig"] = true,
["Portal disambiguation"] = true,
["Project disambiguation"] = true,
["Shortcut disambig"] = true,
["Wikipedia disambiguation"] = true,
["WP disambig"] = true,
["WP-disambig"] = true,
["Airport disambiguation"] = true,
["Airport disambig"] = true,
["Biology disambiguation"] = true,
["Call sign disambiguation"] = true,
["Callsigndis"] = true,
["Caselaw disambiguation"] = true,
["Case law disambiguation"] = true,
["Chinese title disambiguation"] = true,
["Chinese title disambig"] = true,
["CJKVdab"] = true,
["Disambig-Chinese-char-title"] = true,
["Disambiguation cleanup"] = true,
["Cleanup disambig"] = true,
["Cleanup disambiguation"] = true,
["CleanupDisambig"] = true,
["Dab cleanup"] = true,
["Dab-cleanup"] = true,
["Dabclean"] = true,
["Disamb-cleanup"] = true,
["Disambcleanup"] = true,
["Disambig cleanup"] = true,
["Disambig-cleanup"] = true,
["Disambig-CU"] = true,
["Disambig-cu"] = true,
["Disambigcleanup"] = true,
["Disambiguate-cleanup"] = true,
["Disambiguation-cleanup"] = true,
["Geodis-cleanup"] = true,
["Disambiguation with potential"] = true,
["Disambiguation with possibilties"] = true,
["Genus disambiguation"] = true,
["Genus disambig"] = true,
["Greek letter organization disambiguation"] = true,
["GLO disambiguation"] = true,
["Hangul title disambiguation"] = true,
["Hospital disambiguation"] = true,
["Hospitaldis"] = true,
["Human name disambiguation"] = true,
["Bio-dab"] = true,
["Hndab"] = true,
["HNDIS"] = true,
["HnDis"] = true,
["Hndis"] = true,
["Hndisambig"] = true,
["Human name dab"] = true,
["Name list"] = true,
["Personal name"] = true,
["Personal name disambiguation"] = true,
["Human name disambiguation cleanup"] = true,
["Hndis-cleanup"] = true,
["Personal name disambiguation cleanup"] = true,
["Hurricane season disambiguation"] = true,
["Letter–number combination disambiguation"] = true,
["Letter-Number Combination Disambiguation"] = true,
["Letter-Number combination disambiguation"] = true,
["Letter-number combination disambiguation"] = true,
["Letter-NumberCombDisambig"] = true,
["Letter-NumberCombdisambig"] = true,
["Letter-NumberCombinationDisambiguation"] = true,
["LNCD"] = true,
["Mathematical disambiguation"] = true,
["Math dab"] = true,
["Math disambiguation"] = true,
["Math-dab"] = true,
["Mathdab"] = true,
["Mathematics disambiguation"] = true,
["Maths disambiguation"] = true,
["Military unit disambiguation"] = true,
["Mil-unit-dis"] = true,
["Mil-unit-disambig"] = true,
["Music disambiguation"] = true,
["Music disambig"] = true,
["Number disambiguation"] = true,
["Numberdis"] = true,
["Numdab"] = true,
["Numdisambig"] = true,
["Opus number disambiguation"] = true,
["Phonetics disambiguation"] = true,
["Place name disambiguation"] = true,
["DisambigG"] = true,
["DisambigGeo"] = true,
["Disambiggeo"] = true,
["Geo-dis"] = true,
["Geodab"] = true,
["Geodis"] = true,
["Geodisambig"] = true,
["Geographic disambiguation"] = true,
["Geographical disambiguation"] = true,
["Pnd"] = true,
["Road disambiguation"] = true,
["Roaddis"] = true,
["School disambiguation"] = true,
["School disambig"] = true,
["Schooldab"] = true,
["Schooldis"] = true,
["Species Latin name abbreviation disambiguation"] = true,
["Species Latin name disambiguation"] = true,
["LatinNameDisambig"] = true,
["Species disambiguation"] = true,
["SpeciesLatinNameDisambig"] = true,
["Station disambiguation"] = true,
["Station dab"] = true,
["Synagogue disambiguation"] = true,
["Taxonomy disambiguation"] = true,
["Template disambiguation"] = true,
["Template ambiguous"] = true,
["Template dab"] = true,
["Template disambig"] = true,
["WoO number disambiguation"] = true,
}
120emfqmecg5jbyx2n1prgswwe275a0
22020
22019
2026-09-18T15:20:23Z
Amire80
9
1 измена увезена из [[:en:Module:Disambiguation/templates]]: importing from the English Wikipedia
22019
Scribunto
text/plain
-- This page contains a table of all disambiguation templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
["Disambiguation"] = true,
["Begriffsklärung"] = true,
["DAB"] = true,
["Dab"] = true,
["Dab page"] = true,
["Dabpage"] = true,
["Dbig"] = true,
["Dis"] = true,
["Disam"] = true,
["Disamb"] = true,
["Disambig"] = true,
["Disambig misspelling"] = true,
["Disambig-plants"] = true,
["Disambiguation page"] = true,
["Manual of Style disambiguation"] = true,
["Meta disambig"] = true,
["MOS disambiguation"] = true,
["MoS disambiguation"] = true,
["Portal disambig"] = true,
["Portal disambiguation"] = true,
["Project disambiguation"] = true,
["Shortcut disambig"] = true,
["Wikipedia disambiguation"] = true,
["WP disambig"] = true,
["WP-disambig"] = true,
["Airport disambiguation"] = true,
["Airport disambig"] = true,
["Biology disambiguation"] = true,
["Call sign disambiguation"] = true,
["Callsigndis"] = true,
["Caselaw disambiguation"] = true,
["Case law disambiguation"] = true,
["Chinese title disambiguation"] = true,
["Chinese title disambig"] = true,
["CJKVdab"] = true,
["Disambig-Chinese-char-title"] = true,
["Disambiguation cleanup"] = true,
["Cleanup disambig"] = true,
["Cleanup disambiguation"] = true,
["CleanupDisambig"] = true,
["Dab cleanup"] = true,
["Dab-cleanup"] = true,
["Dabclean"] = true,
["Disamb-cleanup"] = true,
["Disambcleanup"] = true,
["Disambig cleanup"] = true,
["Disambig-cleanup"] = true,
["Disambig-CU"] = true,
["Disambig-cu"] = true,
["Disambigcleanup"] = true,
["Disambiguate-cleanup"] = true,
["Disambiguation-cleanup"] = true,
["Geodis-cleanup"] = true,
["Disambiguation with potential"] = true,
["Disambiguation with possibilties"] = true,
["Genus disambiguation"] = true,
["Genus disambig"] = true,
["Greek letter organization disambiguation"] = true,
["GLO disambiguation"] = true,
["Hangul title disambiguation"] = true,
["Hospital disambiguation"] = true,
["Hospitaldis"] = true,
["Human name disambiguation"] = true,
["Bio-dab"] = true,
["Hndab"] = true,
["HNDIS"] = true,
["HnDis"] = true,
["Hndis"] = true,
["Hndisambig"] = true,
["Human name dab"] = true,
["Name list"] = true,
["Personal name"] = true,
["Personal name disambiguation"] = true,
["Human name disambiguation cleanup"] = true,
["Hndis-cleanup"] = true,
["Personal name disambiguation cleanup"] = true,
["Hurricane season disambiguation"] = true,
["Letter–number combination disambiguation"] = true,
["Letter-Number Combination Disambiguation"] = true,
["Letter-Number combination disambiguation"] = true,
["Letter-number combination disambiguation"] = true,
["Letter-NumberCombDisambig"] = true,
["Letter-NumberCombdisambig"] = true,
["Letter-NumberCombinationDisambiguation"] = true,
["LNCD"] = true,
["Mathematical disambiguation"] = true,
["Math dab"] = true,
["Math disambiguation"] = true,
["Math-dab"] = true,
["Mathdab"] = true,
["Mathematics disambiguation"] = true,
["Maths disambiguation"] = true,
["Military unit disambiguation"] = true,
["Mil-unit-dis"] = true,
["Mil-unit-disambig"] = true,
["Music disambiguation"] = true,
["Music disambig"] = true,
["Number disambiguation"] = true,
["Numberdis"] = true,
["Numdab"] = true,
["Numdisambig"] = true,
["Opus number disambiguation"] = true,
["Phonetics disambiguation"] = true,
["Place name disambiguation"] = true,
["DisambigG"] = true,
["DisambigGeo"] = true,
["Disambiggeo"] = true,
["Geo-dis"] = true,
["Geodab"] = true,
["Geodis"] = true,
["Geodisambig"] = true,
["Geographic disambiguation"] = true,
["Geographical disambiguation"] = true,
["Pnd"] = true,
["Road disambiguation"] = true,
["Roaddis"] = true,
["School disambiguation"] = true,
["School disambig"] = true,
["Schooldab"] = true,
["Schooldis"] = true,
["Species Latin name abbreviation disambiguation"] = true,
["Species Latin name disambiguation"] = true,
["LatinNameDisambig"] = true,
["Species disambiguation"] = true,
["SpeciesLatinNameDisambig"] = true,
["Station disambiguation"] = true,
["Station dab"] = true,
["Synagogue disambiguation"] = true,
["Taxonomy disambiguation"] = true,
["Template disambiguation"] = true,
["Template ambiguous"] = true,
["Template dab"] = true,
["Template disambig"] = true,
["WoO number disambiguation"] = true,
}
120emfqmecg5jbyx2n1prgswwe275a0
Катеґория:Books
14
3752
22021
2026-06-06T09:10:28Z
en>~2026-26767-44
0
Remove redundant category
22021
wikitext
text/x-wiki
{{Portal|Books}}
{{Commons category}}
{{Wikisourcecat|Books}}
{{Category main article|book|outline of books}}
{{Distinguish|Category:Wikibooks}}
{{Category see also|Literature}}
{{Category diffuse}}
[[Category:Documents]]
[[Category:Humanities]]
[[Category:Literature by medium]]
[[Category:Manufactured goods]]
[[Category:Media formats]]
[[Category:Paper products]]
[[Category:Print media]]
[[Category:Publications by format]]
[[Category:Publishing]]
[[Category:Written communication]]
3ob5fmwcfe42c6cxa1gpe2u820ns2cj
22022
22021
2026-09-18T15:20:24Z
Amire80
9
1 измена увезена из [[:en:Category:Books]]: importing from the English Wikipedia
22021
wikitext
text/x-wiki
{{Portal|Books}}
{{Commons category}}
{{Wikisourcecat|Books}}
{{Category main article|book|outline of books}}
{{Distinguish|Category:Wikibooks}}
{{Category see also|Literature}}
{{Category diffuse}}
[[Category:Documents]]
[[Category:Humanities]]
[[Category:Literature by medium]]
[[Category:Manufactured goods]]
[[Category:Media formats]]
[[Category:Paper products]]
[[Category:Print media]]
[[Category:Publications by format]]
[[Category:Publishing]]
[[Category:Written communication]]
3ob5fmwcfe42c6cxa1gpe2u820ns2cj
TimedText:MS Sam.ogg.en.srt
710
3753
22023
2020-12-02T07:41:13Z
Graham87
2825
Protected "[[TimedText:MS Sam.ogg.en.srt]]" ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefinite))
22023
wikitext
text/x-wiki
1
00:00:00,000 --> 00:00:08,900
The quick brown fox jumps over the lazy dog 1,234,567,890 times.
2
00:00:09,000 --> 00:00:10,900
Soif.
mfzkmboq6h4q02gc1jxkfdb0ik9eosy
22024
22023
2026-09-18T15:20:24Z
Amire80
9
1 измена увезена из [[:en:TimedText:MS_Sam.ogg.en.srt]]: importing from the English Wikipedia
22023
wikitext
text/x-wiki
1
00:00:00,000 --> 00:00:08,900
The quick brown fox jumps over the lazy dog 1,234,567,890 times.
2
00:00:09,000 --> 00:00:10,900
Soif.
mfzkmboq6h4q02gc1jxkfdb0ik9eosy
Модул:Pagetype/disambiguation
828
3754
22025
2024-02-23T03:46:01Z
Pppery
88
Use built-in redirect syntax
22025
Scribunto
text/plain
return require [[Module:Disambiguation/templates]]
i5ooe2bqffrglszpd82v0i3pqyp187b
22026
22025
2026-09-18T15:20:24Z
Amire80
9
1 измена увезена из [[:en:Module:Pagetype/disambiguation]]: importing from the English Wikipedia
22025
Scribunto
text/plain
return require [[Module:Disambiguation/templates]]
i5ooe2bqffrglszpd82v0i3pqyp187b
Модул:Pagetype/softredirect
828
3755
22027
2024-08-08T21:25:34Z
MSGJ
2752
update from sandbox as StradBot found lots more of these templates
22027
Scribunto
text/plain
-- This page contains a table of all soft redirect templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
["R from category navigation"] = true,
["Redirect from category navigation"] = true,
["Category redirect"] = true,
["Cat move"] = true,
["Cat red"] = true,
["Cat redir"] = true,
["Cat redirect"] = true,
["Category move"] = true,
["Category Redirect"] = true,
["Categoryredirect"] = true,
["Catr"] = true,
["Catred"] = true,
["Catredir"] = true,
["Catredirect"] = true,
["R from template-generated category"] = true,
["Redirect from template-generated category"] = true,
["Portal soft redirect"] = true,
["Portal Redirect"] = true,
["Portal redirect"] = true,
["Portal Soft Redirect"] = true,
["Portalredirect"] = true,
["Portalsoftredirect"] = true,
["PortRed"] = true,
["Portred"] = true,
["Portsoftred"] = true,
["PSR"] = true,
["Psr"] = true,
["Soft portal redirect"] = true,
["Soft redirect portal"] = true,
["SPR"] = true,
["Spr"] = true,
["SRP"] = true,
["Srp"] = true,
["Salted redirect"] = true,
["Soft redirect"] = true,
["Interwiki redirect"] = true,
["Plain soft redirect"] = true,
["Soft"] = true,
["Soft link"] = true,
["Soft redir"] = true,
["Soft Redirect"] = true,
["Softr"] = true,
["Softredir"] = true,
["SoftRedirect"] = true,
["Softredirect"] = true,
["Userrename"] = true,
["Wikibooks redirect"] = true,
["WBOOK"] = true,
["Wbook"] = true,
["Wikibook redirect"] = true,
["Wikibooks Redirect"] = true,
["WikibooksRedirect"] = true,
["Wikibooksredirect"] = true,
["Wikimedia Commons redirect"] = true,
["COMM"] = true,
["Comm"] = true,
["Commons Redirect"] = true,
["Commons redirect"] = true,
["CommonsRedirect"] = true,
["Commonsredirect"] = true,
["Wikimedia commons redirect"] = true,
["Wikiquote redirect"] = true,
["Wq"] = true,
["Wikisource redirect"] = true,
["Wikispecies redirect"] = true,
["Wikispecies Redirect"] = true,
["WikispeciesRedirect"] = true,
["Wikispeciesredirect"] = true,
["WSPEC"] = true,
["Wspec"] = true,
["Wikivoyage redirect"] = true,
["Wiktionary redirect"] = true,
["Moved to Wiktionary"] = true,
["RedirecttoWiktionary"] = true,
["Wi"] = true,
["Wikt red"] = true,
["Wikt redirect"] = true,
["Wiktionary Redirect"] = true,
["Wiktionary-redirect"] = true,
["WiktionaryRedirect"] = true,
["Wiktionaryredirect"] = true,
["Wiktr"] = true,
["Wiktred"] = true,
["Wiktredir"] = true,
["Wtr"] = true,
["Wtsr"] = true,
}
krad2do3vq17ck777hpwdoaxr3vo5yt
22028
22027
2026-09-18T15:20:24Z
Amire80
9
1 измена увезена из [[:en:Module:Pagetype/softredirect]]: importing from the English Wikipedia
22027
Scribunto
text/plain
-- This page contains a table of all soft redirect templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
["R from category navigation"] = true,
["Redirect from category navigation"] = true,
["Category redirect"] = true,
["Cat move"] = true,
["Cat red"] = true,
["Cat redir"] = true,
["Cat redirect"] = true,
["Category move"] = true,
["Category Redirect"] = true,
["Categoryredirect"] = true,
["Catr"] = true,
["Catred"] = true,
["Catredir"] = true,
["Catredirect"] = true,
["R from template-generated category"] = true,
["Redirect from template-generated category"] = true,
["Portal soft redirect"] = true,
["Portal Redirect"] = true,
["Portal redirect"] = true,
["Portal Soft Redirect"] = true,
["Portalredirect"] = true,
["Portalsoftredirect"] = true,
["PortRed"] = true,
["Portred"] = true,
["Portsoftred"] = true,
["PSR"] = true,
["Psr"] = true,
["Soft portal redirect"] = true,
["Soft redirect portal"] = true,
["SPR"] = true,
["Spr"] = true,
["SRP"] = true,
["Srp"] = true,
["Salted redirect"] = true,
["Soft redirect"] = true,
["Interwiki redirect"] = true,
["Plain soft redirect"] = true,
["Soft"] = true,
["Soft link"] = true,
["Soft redir"] = true,
["Soft Redirect"] = true,
["Softr"] = true,
["Softredir"] = true,
["SoftRedirect"] = true,
["Softredirect"] = true,
["Userrename"] = true,
["Wikibooks redirect"] = true,
["WBOOK"] = true,
["Wbook"] = true,
["Wikibook redirect"] = true,
["Wikibooks Redirect"] = true,
["WikibooksRedirect"] = true,
["Wikibooksredirect"] = true,
["Wikimedia Commons redirect"] = true,
["COMM"] = true,
["Comm"] = true,
["Commons Redirect"] = true,
["Commons redirect"] = true,
["CommonsRedirect"] = true,
["Commonsredirect"] = true,
["Wikimedia commons redirect"] = true,
["Wikiquote redirect"] = true,
["Wq"] = true,
["Wikisource redirect"] = true,
["Wikispecies redirect"] = true,
["Wikispecies Redirect"] = true,
["WikispeciesRedirect"] = true,
["Wikispeciesredirect"] = true,
["WSPEC"] = true,
["Wspec"] = true,
["Wikivoyage redirect"] = true,
["Wiktionary redirect"] = true,
["Moved to Wiktionary"] = true,
["RedirecttoWiktionary"] = true,
["Wi"] = true,
["Wikt red"] = true,
["Wikt redirect"] = true,
["Wiktionary Redirect"] = true,
["Wiktionary-redirect"] = true,
["WiktionaryRedirect"] = true,
["Wiktionaryredirect"] = true,
["Wiktr"] = true,
["Wiktred"] = true,
["Wiktredir"] = true,
["Wtr"] = true,
["Wtsr"] = true,
}
krad2do3vq17ck777hpwdoaxr3vo5yt
Модул:Pagetype/setindex
828
3756
22029
2026-09-02T16:24:50Z
MSGJ
2752
update list
22029
Scribunto
text/plain
-- This page contains a table of all set index templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
["Set index article"] = true,
["Sia"] = true,
["Set index"] = true,
["SIA"] = true,
["Set-index"] = true,
["Setindex"] = true,
["Set-index article"] = true,
["Animal common name"] = true,
["Award index"] = true,
["Chemistry index"] = true,
["Chemdisambig"] = true,
["Chemistry disambiguation"] = true,
["Chemistry set index"] = true,
["Chemindex"] = true,
["Chem set index"] = true,
["Chem index"] = true,
["Conflict index"] = true,
["Election index"] = true,
["Enzyme index"] = true,
["Fungus common name"] = true,
["Given name"] = true,
["First name"] = true,
["Forename"] = true,
["Greek mythology index"] = true,
["Greek myth index"] = true,
["History index"] = true,
["Korea index"] = true,
["Lake index"] = true,
["Lakeindex"] = true,
["List index"] = true,
["Locomotive index"] = true,
["Media set index"] = true,
["Media index"] = true,
["Molecular formula index"] = true,
["MolFormDisambig"] = true,
["Molecular formula disambiguation"] = true,
["MolFormIndex"] = true,
["Mountain index"] = true,
["Mountainindex"] = true,
["Nickname"] = true,
["Painting index"] = true,
["Plant common name"] = true,
["Politics index"] = true,
["River index"] = true,
["Road index"] = true,
["Roadindex"] = true,
["Ship index"] = true,
["Shipindex"] = true,
["Sport index"] = true,
["Sportindex"] = true,
["Storm index"] = true,
["Surname"] = true,
["Surnames"] = true,
["DisambigName"] = true,
["DisambigNm"] = true,
["DisambigN"] = true,
["Television index"] = true,
["Weapon index"] = true
}
tdg9tz46mnf6zi5ohmcoeyrn2n1akbq
22030
22029
2026-09-18T15:20:24Z
Amire80
9
1 измена увезена из [[:en:Module:Pagetype/setindex]]: importing from the English Wikipedia
22029
Scribunto
text/plain
-- This page contains a table of all set index templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
["Set index article"] = true,
["Sia"] = true,
["Set index"] = true,
["SIA"] = true,
["Set-index"] = true,
["Setindex"] = true,
["Set-index article"] = true,
["Animal common name"] = true,
["Award index"] = true,
["Chemistry index"] = true,
["Chemdisambig"] = true,
["Chemistry disambiguation"] = true,
["Chemistry set index"] = true,
["Chemindex"] = true,
["Chem set index"] = true,
["Chem index"] = true,
["Conflict index"] = true,
["Election index"] = true,
["Enzyme index"] = true,
["Fungus common name"] = true,
["Given name"] = true,
["First name"] = true,
["Forename"] = true,
["Greek mythology index"] = true,
["Greek myth index"] = true,
["History index"] = true,
["Korea index"] = true,
["Lake index"] = true,
["Lakeindex"] = true,
["List index"] = true,
["Locomotive index"] = true,
["Media set index"] = true,
["Media index"] = true,
["Molecular formula index"] = true,
["MolFormDisambig"] = true,
["Molecular formula disambiguation"] = true,
["MolFormIndex"] = true,
["Mountain index"] = true,
["Mountainindex"] = true,
["Nickname"] = true,
["Painting index"] = true,
["Plant common name"] = true,
["Politics index"] = true,
["River index"] = true,
["Road index"] = true,
["Roadindex"] = true,
["Ship index"] = true,
["Shipindex"] = true,
["Sport index"] = true,
["Sportindex"] = true,
["Storm index"] = true,
["Surname"] = true,
["Surnames"] = true,
["DisambigName"] = true,
["DisambigNm"] = true,
["DisambigN"] = true,
["Television index"] = true,
["Weapon index"] = true
}
tdg9tz46mnf6zi5ohmcoeyrn2n1akbq
Модул:Pagetype/rfd
828
3757
22031
2024-08-20T20:41:41Z
Pppery
88
Changed protection settings for "[[Module:Pagetype/rfd]]": The highest-use template on the project that's not currently fully protected ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))
22031
Scribunto
text/plain
-- This page contains a table of all RfD templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
-- Template forms (these should be substituted so we should rarely see these)
["Redirect for discussion"] = true,
["RFD"] = true,
["RfD"] = true,
["Rfd1"] = true,
["Rfd-t"] = true,
["Rfd"] = true,
["Rfd-NPF"] = true,
["Rfd-NPF/core"] = true,
-- Module forms
["#invoke:RfD"] = true,
["<includeonly>safesubst:</includeonly>#invoke:RfD"] = true, -- The form made by substituting RfD
}
9dx0g2c8g863kg6hcwx1wgsou16k45p
22032
22031
2026-09-18T15:20:24Z
Amire80
9
1 измена увезена из [[:en:Module:Pagetype/rfd]]: importing from the English Wikipedia
22031
Scribunto
text/plain
-- This page contains a table of all RfD templates and their
-- redirects. Templates names are capitalized, and the Template: prefix is
-- removed. Templates are grouped with the main template first, followed by
-- its redirects.
return {
-- Template forms (these should be substituted so we should rarely see these)
["Redirect for discussion"] = true,
["RFD"] = true,
["RfD"] = true,
["Rfd1"] = true,
["Rfd-t"] = true,
["Rfd"] = true,
["Rfd-NPF"] = true,
["Rfd-NPF/core"] = true,
-- Module forms
["#invoke:RfD"] = true,
["<includeonly>safesubst:</includeonly>#invoke:RfD"] = true, -- The form made by substituting RfD
}
9dx0g2c8g863kg6hcwx1wgsou16k45p